Fix wrap adapter

This commit is contained in:
g1nt0ki
2022-06-01 01:11:17 +02:00
parent 8e94104eb2
commit 3f6f593ca6
2 changed files with 139 additions and 8 deletions

View File

@@ -1,13 +1,14 @@
const axios = require("axios");
const BigNumber = require("bignumber.js");
const { sumTokens } = require('../helper/unwrapLPs')
const tokens= require('./tokens')
const tvlUrl = 'https://stats.info.tzwrap.com/v1/tvl/volume/now';
async function fetch() {
const tvl = new BigNumber((await axios.get(tvlUrl)).data.totalUsd);
return tvl.toFixed(0);
async function tvl(_, block) {
const wrapContract = '0x5Dc76fD132354be5567ad617fD1fE8fB79421D82'
const toa = tokens.map(t => [t.ethereumContractAddress, wrapContract])
return sumTokens({}, toa, block)
}
module.exports = {
fetch
ethereum: {
tvl
}
};

130
projects/tzwrap/tokens.js Normal file
View File

@@ -0,0 +1,130 @@
// info taken from https://indexer.app.tzwrap.com/v1/configuration
module.exports = [
{
"ethereumSymbol": "LEO",
"ethereumName": "Bitfinex LEO Token",
"ethereumContractAddress": "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "BUSD",
"ethereumName": "Binance USD",
"ethereumContractAddress": "0x4fabb145d64652a948d72533023f6e7a623c7c53",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "LINK",
"ethereumName": "ChainLink Token",
"ethereumContractAddress": "0x514910771af9ca656af840dff83e8264ecf986ca",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "DAI",
"ethereumName": "Dai Stablecoin",
"ethereumContractAddress": "0x6b175474e89094c44da98b954eedeac495271d0f",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "SUSHI",
"ethereumName": "SushiToken",
"ethereumContractAddress": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "HT",
"ethereumName": "Huobi Token",
"ethereumContractAddress": "0x6f259637dcd74c767781e37bc6133cd6a68aa161",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "OKB",
"ethereumName": "OKB",
"ethereumContractAddress": "0x75231f58b43240c9718dd58b4967c5114342a86c",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "AAVE",
"ethereumName": "Aave Token",
"ethereumContractAddress": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "PAX",
"ethereumName": "Paxos Standard",
"ethereumContractAddress": "0x8e870d67f660d95d5be530380d0ec0bd388289e1",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "MKR",
"ethereumName": "Maker",
"ethereumContractAddress": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "HUSD",
"ethereumName": "HUSD",
"ethereumContractAddress": "0xdf574c24545e5ffecb9a659c229253d4111d87e1",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "UNI",
"ethereumName": "Uniswap",
"ethereumContractAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "WBTC",
"ethereumName": "Wrapped BTC",
"ethereumContractAddress": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "FTT",
"ethereumName": "FTX Token",
"ethereumContractAddress": "0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "MATIC",
"ethereumName": "Matic Token",
"ethereumContractAddress": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "CRO",
"ethereumName": "Crypto.com Coin",
"ethereumContractAddress": "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "USDC",
"ethereumName": "USD Coin",
"ethereumContractAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "CEL",
"ethereumName": "Celsius Network",
"ethereumContractAddress": "0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "COMP",
"ethereumName": "Compound",
"ethereumContractAddress": "0xc00e94cb662c3520282e6f5717214004a7f26888",
"tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ"
},
{
"ethereumSymbol": "WETH",
"ethereumName": "Wrapped Ether",
"ethereumContractAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
},
{
"ethereumSymbol": "USDT",
"ethereumName": "Tether USD",
"ethereumContractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY"
}
]