mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-04-29 21:36:44 +08:00
minor refactor
This commit is contained in:
@@ -1,39 +1,19 @@
|
||||
const sdk = require("@defillama/sdk")
|
||||
const swkava = '0x9d9682577CA889c882412056669bd936894663fd'
|
||||
const swech = '0x86e4D91800c03e803d4c8FA3293d1C7d612A7300'
|
||||
|
||||
async function tvl(timestamp, ethBlock, {kava: block}, { api }) {
|
||||
|
||||
async function kava(timestamp, ethBlock, {kava: block}) {
|
||||
const chain = "kava"
|
||||
const pooledCoin = await sdk.api.abi.call({
|
||||
block,
|
||||
chain,
|
||||
target: swkava,
|
||||
const pooledCoin = await api.call({
|
||||
target: api.chain === 'kava' ? swkava: swech,
|
||||
abi: "uint256:totalSupply",
|
||||
})
|
||||
return {
|
||||
'kava': Number(pooledCoin.output)/1e18,
|
||||
[api.chain === 'kava' ? 'kava' : 'echelon']: pooledCoin/1e18,
|
||||
}
|
||||
}
|
||||
|
||||
async function echelon(timestamp, ethBlock, {echelon: block}) {
|
||||
const chain = "echelon"
|
||||
const pooledCoin = await sdk.api.abi.call({
|
||||
block,
|
||||
chain,
|
||||
target: swech,
|
||||
abi: "uint256:totalSupply",
|
||||
})
|
||||
return {
|
||||
'echelon': Number(pooledCoin.output)/1e18,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
kava: { tvl: kava },
|
||||
echelon: { tvl: echelon },
|
||||
kava: { tvl },
|
||||
echelon: { tvl },
|
||||
methodology: "Any & Each 1 SW-Token can only ever be minted by permanent locking of 1 Native token. Hence, the totalSupply() method is used to aggregate the amounts of underlying assets, with their prices fed by the DefiLlama SDK.",
|
||||
timetravel: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user