Update celery staking calculations

This commit is contained in:
mainnet-pat
2022-05-06 14:47:12 +00:00
parent f086c01ad8
commit 2a1018a1db

View File

@@ -1,41 +1,15 @@
const sdk = require('@defillama/sdk');
const { getBlock } = require('../helper/getBlock');
const { default: BigNumber } = require('bignumber.js');
const { staking } = require('../helper/staking')
const CHAIN = "smartbch"
// token contract
const CLY = "0x7642df81b5beaeeb331cc5a104bd13ba68c34b91"
const getTotalStakingSupply = async (timestamp, ethBlock, chainBlocks) => {
const block = await getBlock(timestamp, CHAIN, chainBlocks, false)
const total = (await sdk.api.abi.call({
target: CLY,
abi: {
"inputs": [],
"name": "getTotalStakingSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
chain: CHAIN,
block
})).output
return {'celery': BigNumber(total).dividedBy(10 ** 18)}
}
module.exports = {
misrepresentedTokens: false,
methodology: "Contract function is called to get the total staked CLY tokens in the smart contract",
methodology: "Staked CLY tokens are counted towards staking metric",
smartbch: {
tvl: () => ({}),
staking: getTotalStakingSupply,
staking: staking(CLY, CLY, CHAIN, "celery", 18),
},
}