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 branch 'DefiLlama:main' into main
- Loading branch information
Showing
16 changed files
with
288 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const sdk = require("@defillama/sdk"); | ||
const {pool2Exports} = require("../helper/pool2"); | ||
|
||
const token = "0xDDa0F0E1081b8d64aB1D64621eb2679F93086705"; | ||
const emissionRewardPool = "0xDDa0F0E1081b8d64aB1D64621eb2679F93086705"; | ||
|
||
const DiamondLPs = [ | ||
"0xf5e8B220843EC7114B91AfF0D25342c24eB953b5", // DIAMOND-FTM | ||
"0x2f1569094CB256fB745901fa92e57aF011D32B2C" // BOMB-DIAMOND | ||
] | ||
|
||
module.exports = { | ||
fantom: { | ||
tvl: async () => ({}), | ||
pool2: pool2Exports(emissionRewardPool, DiamondLPs, "fantom", addr=>`fantom:${addr}`) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); | ||
|
||
module.exports = { | ||
methodology: `Uses factory(0x23c7FA9A9f81B322684F25b8079e22C37e00b46b) address and whitelisted tokens address to find and price Liquidity Pool pairs`, | ||
thundercore: { | ||
tvl: calculateUsdUniTvl( | ||
"0x23c7FA9A9f81B322684F25b8079e22C37e00b46b", | ||
"thundercore", | ||
"0x413cEFeA29F2d07B8F2acFA69d92466B9535f717", | ||
[""], | ||
"thunder-token" | ||
), | ||
}, | ||
}; |
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,27 +1,36 @@ | ||
const {fetchURL} = require('../helper/utils'); | ||
const { sumSingleBalance, TOKEN_LIST, getBalance, } = require('../helper/terra') | ||
|
||
// Source: https://docs.loterra.io/resources/contract-addresses | ||
const contracts = ["terra1e7hzp3tnsswpfcu6gt4wlgfm20lcsqqywhaagu", "terra1zcf0d95z02u2r923sgupp28mqrdwmt930gn8x5", "terra14mevcmeqt0n4myggt7c56l5fl0xw2hwa2mhlg0", "terra1q2k29wwcz055q4ftx4eucsq6tg9wtulprjg75w"] | ||
|
||
async function tvl(){ | ||
const tokens = await Promise.all(contracts.map(contract=>fetchURL(`https://fcd.terra.dev/v1/bank/${contract}`))) | ||
const total = tokens.map(data=>{ | ||
const ust = data.data.balance.find(t=>t.denom === "uusd") | ||
if(ust === undefined){ | ||
return 0 | ||
} | ||
return Number(ust.available) | ||
}) | ||
|
||
return { | ||
'terrausd': total.reduce((t, c)=>c+t)/1e6 | ||
} | ||
const contracts = { | ||
multiSig: 'terra1s4twvkqy0eel5saah64wxezpckm7v9535jjshy', | ||
dogether: 'terra19h4xk8xxxew0ne6fuw0mvuf7ltmjmxjxssj5ts' | ||
} | ||
|
||
async function tvl(timestamp, ethBlock, { terra: block }) { | ||
const balances = {} | ||
|
||
// Add aUST tokens in the multi-sig | ||
const aUSTBalance = await getBalance(TOKEN_LIST.anchorust, contracts.dogether, block) | ||
sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) | ||
|
||
return balances | ||
} | ||
|
||
async function treasury(timestamp, ethBlock, { terra: block }) { | ||
const balances = {} | ||
|
||
// Add aUST tokens in the multi-sig | ||
const aUSTBalance = await getBalance(TOKEN_LIST.anchorust, contracts.multiSig, block) | ||
sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) | ||
|
||
return balances | ||
} | ||
|
||
module.exports = { | ||
methodology: 'TVL counts the UST that is available as a prize on the protocol.', | ||
terra:{ | ||
tvl | ||
}, | ||
historical: false, | ||
methodology: 'TVL counts the UST that is available as a prize on the protocol.', | ||
terra: { | ||
tvl, | ||
treasury, | ||
}, | ||
timetravel: false, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
totalHoldings: { | ||
inputs: [], | ||
name: "totalHoldings", | ||
outputs: [ | ||
{ | ||
internalType: "uint256", | ||
name: "totalUnderlyingHeld", | ||
type: "uint256", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
}; |
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,10 @@ | ||
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; | ||
|
||
module.exports = { | ||
moonriver: [ | ||
{ | ||
ADDRESS: "0xc24D43093b44b7A9657571DDB79FEdf014eaef7d", | ||
UNDERLYING: USDC, | ||
}, | ||
], | ||
}; |
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,39 @@ | ||
const sdk = require("@defillama/sdk"); | ||
const { getBlock } = require("../helper/getBlock"); | ||
const ADDRESSES = require("./addresses"); | ||
const scionVaultAbi = require("./abis/scionVaultAbi"); | ||
|
||
async function getVaultBalance(timestamp, chainBlocks, chain) { | ||
const block = await getBlock(timestamp, chain, chainBlocks); | ||
const balances = {}; | ||
|
||
const vaults = ADDRESSES[chain]; | ||
|
||
for (const vault of vaults) { | ||
const { ADDRESS, UNDERLYING } = vault; | ||
|
||
const totalHoldings = await sdk.api.abi.call({ | ||
abi: scionVaultAbi.totalHoldings, | ||
chain, | ||
target: ADDRESS, | ||
block, | ||
}); | ||
|
||
await sdk.util.sumSingleBalance(balances, UNDERLYING, totalHoldings.output); | ||
} | ||
|
||
return balances; | ||
} | ||
|
||
async function moonriver(timestamp, block, chainBlocks) { | ||
return getVaultBalance(timestamp, chainBlocks, "moonriver"); | ||
} | ||
|
||
module.exports = { | ||
timetravel: true, | ||
misrepresentedTokens: false, | ||
methodology: "Measures the total value deposited in Scion vault contracts", | ||
moonriver: { | ||
tvl: moonriver, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const sdk = require("@defillama/sdk"); | ||
const { getChainTransform } = require("../helper/portedTokens"); | ||
|
||
const ETHSherpaContracts = [ | ||
"0x6ceB170e3ec0fAfaE3Be5A02FEFb81F524FE85C5", | ||
"0x7CE57f6a5a135eb1a8e9640Af1eff9665ade00D9", | ||
"0xe1376DeF383D1656f5a40B6ba31F8C035BFc26Aa", | ||
]; | ||
const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; | ||
|
||
function getNativeTVL(contractAddresses, chain, token) { | ||
return async function (timestamp, block, chainBlocks) { | ||
const balances = {}; | ||
const chainTransform = await getChainTransform(chain); | ||
|
||
for (const contract of contractAddresses) { | ||
const result = ( | ||
await sdk.api.eth.getBalance({ | ||
target: contract, | ||
block: chainBlocks[chain], | ||
chain: chain, | ||
}) | ||
).output; | ||
|
||
sdk.util.sumSingleBalance(balances, chainTransform(token), result); | ||
} | ||
|
||
return balances; | ||
}; | ||
} | ||
|
||
module.exports = { | ||
timetravel: true, | ||
misrepresentedTokens: false, | ||
methodology: "TVL consists of the sum of the balances of the Sherpa Cash privacy pools.", | ||
avax: { | ||
tvl: getNativeTVL(ETHSherpaContracts, "avax", WAVAX), | ||
}, | ||
}; |
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
Oops, something went wrong.