Add more pinksale addresses

This commit is contained in:
g1nt0ki
2022-06-06 07:42:53 +02:00
parent 3bb377871c
commit a4be9a132c
4 changed files with 212 additions and 66 deletions

View File

@@ -78,13 +78,13 @@ function isLP(symbol, token, chain) {
// if (token && blacklisted_LPS.includes(token.toLowerCase())) return false
if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP'].includes(symbol)) return false
if (!symbol) return false
if (symbol.startsWith('ZLK-LP')) {
console.log('Blacklisting Zenlink LP because they have different abi for get reservers', symbol, token)
return false
}
let label
if (symbol.includes('DMM-LP')) {
console.log('Blacklisting Kybe DMM LP because they have different abi for get reservers', symbol, token)
if (symbol.startsWith('ZLK-LP') || symbol.includes('DMM-LP') || (chain === 'avax' && 'DLP' === symbol))
label = 'Blackisting this LP because of unsupported abi'
if (label) {
if (DEBUG_MODE) console.log(label, token, symbol)
return false
}

View File

@@ -63,4 +63,80 @@ module.exports = {
"stateMutability": "view",
"type": "function"
},
getLockAt: {
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "getLockAt",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "lockDate",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "tgeDate",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "tgeBps",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "cycle",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "cycleBps",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unlockedAmount",
"type": "uint256"
},
{
"internalType": "string",
"name": "description",
"type": "string"
}
],
"internalType": "struct PinkLock02.Lock",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
}

View File

@@ -0,0 +1,83 @@
module.exports = {
bsc: {
vaults: [
'0x7ee058420e5937496F5a2096f04caA7721cF70cc',
'0x407993575c91ce7643a4d4cCACc9A98c36eE1BBE',
],
coreAssets: [
'0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB
'0xe9e7cea3dedca5984780bafc599bd69add087d56', // BUSD
'0x55d398326f99059ff775485246999027b3197955', // USDT token
'0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // USDC token
],
blacklist: [
'0x602ba546a7b06e0fc7f58fd27eb6996ecc824689',
'0x17e65e6b9b166fb8e7c59432f0db126711246bc0',
'0xee6cacddd3a9370d87db581ee6728226883578e5',
'0x6d163b653010740bfb41bed4bee23f94b3285cba',
'0xb0228eb6c0b49f8265e6e161c3a987eed7471f42',
'0x9888d3d9fbc12487259d1c82665b2ffd009936c6',
'0x49a9f9a2271d8c5da44c57e7102aca79c222f4a9',
'0x25f6212eb410e22956856ccb0383ec1a86fceaf9',
'0x851b7cb21d7428fa1ed87a7c45da8048079b0a90',
'0xb08f67c04bfdf069017365969ca19a0ae6e66b85',
'0x4aee9d30893c5c73e5a5b8637a10d9537497f1c8',
'0x9FBff386a9405b4C98329824418ec02b5C20976b',
],
log_coreAssetPrices: [
300/ 1e18,
1/ 1e18,
1/ 1e18,
1/ 1e18,
],
log_minTokenValue: 1e6,
},
ethereum: {
vaults: [
'0x33d4cC8716Beb13F814F538Ad3b2de3b036f5e2A',
'0x71B5759d73262FBb223956913ecF4ecC51057641',
],
coreAssets: [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
],
},
polygon: {
vaults: [
'0x5fb71Dbf7248a01bf96cE2AB2DA34EEAbE58c261',
'0x6C9A0D8B1c7a95a323d744dE30cf027694710633',
],
coreAssets: [
'0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
],
},
avax: {
vaults: [
'0x4DffB05d1Bc222A2852799e2076e956acb589322',
'0x9479C6484a392113bB829A15E7c9E033C9e70D30',
],
coreAssets: [
'0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
],
},
fantom: {
vaults: [
'0xdd6e31a046b828cbbafb939c2a394629aff8bbdc',
'0x0E1757b9d6501e60B2e4Ca0D000e49532948CF6c',
],
coreAssets: [
'0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',
],
},
cronos: {
vaults: [
'0xdD6E31A046b828CbBAfb939C2a394629aff8BBdC',
'0x102137A9F278B013419332f82aCEA429D944Fc34',
],
coreAssets: [
'0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23',
],
},
}

View File

@@ -1,11 +1,17 @@
const sdk = require("@defillama/sdk")
const abi = require('./abi')
const config = require('./config')
const { sumTokensSingle } = require('../helper/unknownTokens')
const chain = 'bsc'
const vault = '0x7ee058420e5937496F5a2096f04caA7721cF70cc'
module.exports = {}
Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (timestamp, _block, { [chain]: block }) => {
const balances = {}
const { vaults, coreAssets, blacklist, log_coreAssetPrices, log_minTokenValue, } = config[chain]
for (const vault of vaults) {
const tvl = async (timestamp, _block, { [chain]: block }) => {
let calls = []
const { output: size } = await sdk.api.abi.call({
target: vault,
@@ -13,37 +19,21 @@ const tvl = async (timestamp, _block, { [chain]: block }) => {
chain, block,
})
const isLastVault = vault === vaults[vaults.length - 1]
const lockAbi = isLastVault ? abi.getLockAt : abi.getLock
for (let i = 0; i < +size; i++)
calls.push({ params: i })
let { output: tokens } = await sdk.api.abi.multiCall({
target: vault,
abi: abi.getLock,
abi: lockAbi,
calls,
chain, block,
})
tokens = tokens.map(i => i.output[1])
return sumTokensSingle({
coreAssets: [
'0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB
'0xe9e7cea3dedca5984780bafc599bd69add087d56', // BUSD
'0x55d398326f99059ff775485246999027b3197955', // USDT token
'0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // USDC token
],
blacklist: [
'0x602ba546a7b06e0fc7f58fd27eb6996ecc824689',
'0x17e65e6b9b166fb8e7c59432f0db126711246bc0',
'0xee6cacddd3a9370d87db581ee6728226883578e5',
'0x6d163b653010740bfb41bed4bee23f94b3285cba',
'0xb0228eb6c0b49f8265e6e161c3a987eed7471f42',
'0x9888d3d9fbc12487259d1c82665b2ffd009936c6',
'0x49a9f9a2271d8c5da44c57e7102aca79c222f4a9',
'0x25f6212eb410e22956856ccb0383ec1a86fceaf9',
'0x851b7cb21d7428fa1ed87a7c45da8048079b0a90',
'0xb08f67c04bfdf069017365969ca19a0ae6e66b85',
'0x4aee9d30893c5c73e5a5b8637a10d9537497f1c8',
'0x9FBff386a9405b4C98329824418ec02b5C20976b',
],
const balance = await sumTokensSingle({
coreAssets,
blacklist,
owner: vault,
tokens,
block, chain,
@@ -51,18 +41,15 @@ const tvl = async (timestamp, _block, { [chain]: block }) => {
skipConversion: false,
onlyLPs: false,
minLPRatio: 0.01,
log_coreAssetPrices: [
300/ 1e18,
1/ 1e18,
1/ 1e18,
1/ 1e18,
],
log_minTokenValue: 1e6,
log_coreAssetPrices,
log_minTokenValue,
})
};
module.exports = {
bsc: {
tvl,
},
Object.entries(balance).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal))
}
return balances
}
}
})