forked from DefiLlama/DefiLlama-Adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefiLlama#4951 from GarbleMoney/main
Adapter for Garble.Money
- Loading branch information
Showing
6 changed files
with
84 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,26 @@ | ||
const { transformPolygonAddress } = require('./helper/portedTokens'); | ||
const sdk = require('@defillama/sdk'); | ||
const { staking } = require('./helper/staking'); | ||
|
||
const contracts = [ | ||
'0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5', | ||
'0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9', | ||
'0x176586Dec2b70df5B72a6Efe158a87f210551798', | ||
'0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD', | ||
'0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f' | ||
]; | ||
const { pool2 } = require('./helper/pool2'); | ||
const { sumTokens2 } = require('./helper/unwrapLPs'); | ||
|
||
const tokens = { | ||
DAI: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', | ||
dQUICK: '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' | ||
DAI: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', | ||
dQUICK: '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' | ||
}; | ||
|
||
async function tvl(timestamp, block, chainBlocks) { | ||
const transform = await transformPolygonAddress(); | ||
const balances = {}; | ||
block = chainBlocks.polygon; | ||
|
||
const DAIbalance = (await sdk.api.abi.multiCall({ | ||
calls: contracts.map((c) => ({ | ||
target: tokens.DAI, | ||
params: c | ||
})), | ||
abi: "erc20:balanceOf", | ||
block, | ||
chain: 'polygon' | ||
})).output.reduce((a, b) => Number(a) + Number(b.output), 0); | ||
|
||
const dQUICKbalance = (await sdk.api.abi.multiCall({ | ||
calls: contracts.map((c) => ({ | ||
target: tokens.dQUICK, | ||
params: c | ||
})), | ||
abi: "erc20:balanceOf", | ||
block, | ||
chain: 'polygon' | ||
})).output.reduce((a, b) => Number(a) + Number(b.output), 0); | ||
|
||
return { | ||
[transform(tokens.DAI)]: DAIbalance, | ||
[transform(tokens.dQUICK)]: dQUICKbalance | ||
}; | ||
}; | ||
async function tvl(_, _b, _cb, { api, }) { | ||
const tokensAndOwners = [ | ||
[tokens.dQUICK, '0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5'], | ||
[tokens.dQUICK, '0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9'], | ||
[tokens.DAI, '0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD'], | ||
[tokens.DAI, '0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f'], | ||
[tokens.DAI, '0x91993f2101cc758D0dEB7279d41e880F7dEFe827'], | ||
] | ||
return sumTokens2({ ...api, tokensAndOwners, }) | ||
} | ||
|
||
// node test.js projects/gainsNetwork.js | ||
module.exports={ | ||
polygon: { | ||
tvl, | ||
pool2: staking( | ||
'0x33025b177A35F6275b78f9c25684273fc24B4e43', | ||
'0x6e53cb6942e518376e9e763554db1a45ddcd25c4', | ||
'polygon') | ||
} | ||
module.exports = { | ||
polygon: { | ||
tvl, | ||
pool2: pool2('0x33025b177A35F6275b78f9c25684273fc24B4e43', '0x6e53cb6942e518376e9e763554db1a45ddcd25c4', 'polygon') | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { sumTokensExport, nullAddress, } = require('../helper/sumTokens') | ||
|
||
async function tvl() { | ||
|
||
const balances = {} | ||
|
||
sdk.util.sumSingleBalance(balances, 'tether', await getTokenBalance('', '')) | ||
sdk.util.sumSingleBalance(balances, 'tron', await getTrxBalance('') / (10 ** 6)) | ||
sdk.util.sumSingleBalance(balances, 'usdd', await getTokenBalance('', '')) | ||
sdk.util.sumSingleBalance(balances, 'justmoney-2', await getTokenBalance('', '')) | ||
|
||
return balances | ||
} | ||
|
||
module.exports = { | ||
tron: { | ||
tvl: sumTokensExport({ | ||
tokensAndOwners: [ | ||
[nullAddress, 'TCdY8kA7XsZ5UUw8jEgbVRbS2MVttrY9AC'], | ||
['TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', 'TYaaJsD44isGwQUbvHNuii8nAnTKSxPcND'], | ||
['TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn', 'TWupFtHWnURhDNrWBfB2tK3zD4uALurBgk'], | ||
['TVHH59uHVpHzLDMFFpUgCx2dNAQqCzPhcR', 'TK76Z1mJQHN98WsuUUKeDZnNhwRsj6p5wo'], | ||
] | ||
}), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
const { getUniTVL } = require('../helper/unknownTokens') | ||
const { getUniTVL, staking } = require('../helper/unknownTokens') | ||
const sdk = require('@defillama/sdk') | ||
const uniTvl = getUniTVL({ factory: '0x20fAfD2B0Ba599416D75Eb54f48cda9812964f46', useDefaultCoreAssets: true }) | ||
const masterchef = '0xa481384653c484901b301634086c8625e550bbec' | ||
const masterchefOld = '0xeb66b69d1cc6ef04575a11d4b0a6427b1cdacc45' | ||
const oreo = '0x319e222De462ac959BAf2aEc848697AeC2bbD770' | ||
const weth = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' | ||
|
||
module.exports = { | ||
misrepresentedTokens: true, | ||
arbitrum: { | ||
tvl: getUniTVL({ factory: '0x20fAfD2B0Ba599416D75Eb54f48cda9812964f46', useDefaultCoreAssets: true }), | ||
tvl: sdk.util.sumChainTvls([uniTvl, staking({ | ||
owners: [masterchefOld, masterchef], | ||
tokens: [weth], | ||
})]), | ||
staking: staking({ | ||
owners: [masterchefOld, masterchef], | ||
tokens: [oreo], | ||
onlyLPs: true, | ||
lps: ['0xBf6a0418e31f90b60ae3d19c56a659ad8b2f4D18'], | ||
useDefaultCoreAssets: true, | ||
}) | ||
} | ||
}; |