Skip to content

Commit

Permalink
add Ethereum staking to venofinance TVL (#9195)
Browse files Browse the repository at this point in the history
* add Ethereum staking to venofinance TVL

* code refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
CronosLabsDev and g1nt0ki authored Mar 5, 2024
1 parent 07ddd2d commit 237d759
Showing 1 changed file with 29 additions and 34 deletions.
63 changes: 29 additions & 34 deletions projects/venofinance/index.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,39 @@
const sdk = require('@defillama/sdk')
const { staking } = require("../helper/staking.js");

const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95"
const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07"
const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9"
const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95";
const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07";
const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9";

async function tvl(timestamp, ethBlock, chainBlocks, {api}) {
async function tvlCronos(timestamp, ethBlock, chainBlocks, { api }) {
const lcro_contract_address = "0x9Fae23A2700FEeCd5b93e43fDBc03c76AA7C08A6";
const latom_contract_address = "0xac974ee7fc5d083112c809ccb3fce4a4f385750d";

const cro_pooled = await api.call({ abi: "uint256:getTotalPooledCro", target: lcro_contract_address, })
const atom_pooled = await api.call({ abi: "uint256:getTotalPooledToken", target: latom_contract_address, })

const lcro_contract_address = '0x9Fae23A2700FEeCd5b93e43fDBc03c76AA7C08A6';
const latom_contract_address = '0xac974ee7fc5d083112c809ccb3fce4a4f385750d';

const block = chainBlocks.cronos

const cro_pooled = await sdk.api.abi.call({
abi: "uint256:getTotalPooledCro",
target: lcro_contract_address,
block: block,
chain: 'cronos'
})
api.addGasToken(cro_pooled)
api.addCGToken('cosmos', atom_pooled / 1e6)
return api.getBalances()
}

const atom_pooled = await sdk.api.abi.call({
abi: "uint256:getTotalPooledToken",
target: latom_contract_address,
block: block,
chain: 'cronos'
})
async function tvlEra(timestamp, ethBlock, chainBlocks, { api }) {
const leth_contract_address = "0xE7895ed01a1a6AAcF1c2E955aF14E7cf612E7F9d";

return {
'crypto-com-chain': Number(cro_pooled.output) / 1e18,
"cosmos": Number(atom_pooled.output) / 1e6
};
const eth_pooled = await api.call({ abi: "uint256:getTotalPooledToken", target: leth_contract_address, })
api.addGasToken(eth_pooled)
return api.getBalances()
}

module.exports = {
timetravel: true,
misrepresentedTokens: false,
methodology: 'TVL counts CRO staked by the protocol.',
cronos: {
tvl ,
staking: staking([fountain_contract_address, reservoir_contract_address], vno_contract_address)
}
}
methodology: "TVL counts tokens staked by the protocol.",
cronos: {
tvl: tvlCronos,
staking: staking(
[fountain_contract_address, reservoir_contract_address],
vno_contract_address
),
},
era: {
tvl: tvlEra,
},
};

0 comments on commit 237d759

Please sign in to comment.