minor refactor

This commit is contained in:
g1nt0ki
2023-02-27 23:33:09 +05:30
parent 91d41fe820
commit 626c4a28e6

View File

@@ -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
}