Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: venofinance tvl #11749

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions projects/venofinance/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const { staking } = require("../helper/staking.js");
const sdk = require('@defillama/sdk')

const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95";
const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07";
const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9";
const zkCRO_contract_address = "0x28Ff2E4dD1B58efEB0fC138602A28D5aE81e44e2";
const ybETH_contract_address = "0x76bf2D1e6dFda645c0c17440B17Eccc181dfC351";
const ybUSD_contract_address = "0xFA59075DfCE274E028b58BdDFcC3D709960F594a";
const vETH_contract_address = "0x271602A97027ee1dd03b1E6e5dB153eB659A80b1";
const vUSD_contract_address = "0x5b91e29Ae5A71d9052620Acb813d5aC25eC7a4A2";
const lcro_contract_address = "0x9fae23a2700feecd5b93e43fdbc03c76aa7c08a6"


async function tvlCronos(api) {
Expand All @@ -30,24 +30,24 @@ async function tvlEra(api) {
return api.getBalances()
}

async function tvlEthereum(api) {
const cro_pooled = await api.call({ abi: "uint256:totalPooledCro", target: zkCRO_contract_address });
api.addCGToken('crypto-com-chain', cro_pooled / 1e8);
const eth_pooled = await api.call({ abi: "uint256:totalPooledEth", target: ybETH_contract_address });
api.addCGToken('ethereum', eth_pooled / 1e18);
const usd_pooled = await api.call({ abi: "uint256:totalUsdValue", target: ybUSD_contract_address });
api.addCGToken('dai', usd_pooled / 1e18);

return api.getBalances();
}
async function tvlCronosZkEVM(zkEvmApi) {
const totalVEth = await zkEvmApi.call({ abi: "uint256:ybEthValue", target: vETH_contract_address });
zkEvmApi.addCGToken('ethereum', totalVEth / 1e18);
const totalVUsd = await zkEvmApi.call({ abi: "uint256:ybUsdValue", target: vUSD_contract_address });
zkEvmApi.addCGToken('dai', totalVUsd / 1e18);

async function tvlCronosZkEVM(api) {
const totalVEth = await api.call({ abi: "uint256:ybEthValue", target: vETH_contract_address });
api.addCGToken('ethereum', totalVEth / 1e18);
const totalVUsd = await api.call({ abi: "uint256:ybUsdValue", target: vUSD_contract_address });
api.addCGToken('dai', totalVUsd / 1e18);
const ethApi = new sdk.ChainApi({ chain: 'ethereum' });
const cro_pooled = await ethApi.call({ abi: "uint256:totalPooledCro", target: zkCRO_contract_address });
const cronosApi = new sdk.ChainApi({ chain: 'cronos' });
const totalLcro = await cronosApi.call({
abi: 'function convertToShare(uint256 assets) view returns (uint256 shares)',
target: lcro_contract_address,
params: [cro_pooled]
});

return api.getBalances();
zkEvmApi.addCGToken('liquid-cro', totalLcro / 1e8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deduping vETH and vUSD I sort of understand, but this part, no. The interaction happens in ethereum right? why is it counted in cronos zkevm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your concern. Please see the updated code. We read the zkCRO supply directly on the Cronos zkEVM chain now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the issue remains, I didnt see any option for the users to interact with zk chain on the webpage

return zkEvmApi.getBalances();
}

module.exports = {
Expand All @@ -62,10 +62,5 @@ module.exports = {
era: {
tvl: tvlEra,
},
ethereum: {
tvl: tvlEthereum,
},
cronos_zkevm: {
tvl: tvlCronosZkEVM,
},
cronos_zkevm: {tvl: tvlCronosZkEVM}
};
Loading