You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I want to know How to calculate APY by staking Busd
I found out that I could get Egg as an reward when I stake Busd in the nest. I think I could calculate APY from accEggPerShare but I could not figure out how Can I calculate the same APY in the homepage.
Here is a code below that I tried to find out APY var web3 = new Web3(new Web3.providers.HttpProvider(endpoint)); let contract = new web3.eth.Contract(_contractABI_Goose , _contractAddress_Goose); let PoolInfo_busd = await contract.methods.poolInfo(13).call(); let eggPerBlock = await contract.methods.eggPerBlock().call(); let totalAllocPoint = await contract.methods.totalAllocPoint().call(); let lastRewardBlock_busd = PoolInfo_busd.lastRewardBlock; console.log('lastRewardBlock_busd',lastRewardBlock_busd) let blocknumber = await web3.eth.getBlockNumber() console.log('blocknumber',blocknumber) let getMultiplier = await contract.methods.getMultiplier(lastRewardBlock_busd,blocknumber).call(); console.log('getMultiplier',getMultiplier); console.log("totalAllocPoint",totalAllocPoint) let underliyng_busd = new web3.eth.Contract(_contractABI_busd , _contractAddress_busd); let lpSupply_busd = await underliyng_busd.methods.balanceOf(_contractAddress_Goose).call(); console.log("lpSupply_busd",lpSupply_busd) let accEggPerShare_busd = PoolInfo_busd.accEggPerShare; let allocPoint_busd = PoolInfo_busd.allocPoint; let accEggPerShare_busd_real = (accEggPerShare_busd)/(1e12); console.log(accEggPerShare_egg_real*accEggPerShare_busd_real); let eggReward_busd = ((getMultiplier*eggPerBlock*allocPoint_busd)/(totalAllocPoint)); console.log("eggReward_busd",eggReward_busd) let new_accEggPerShare_busd = (accEggPerShare_busd_real + eggReward_busd*(1e12))/(lpSupply_busd); console.log("new_accEggPerShare_busd",new_accEggPerShare_busd)
The text was updated successfully, but these errors were encountered:
Hello I want to know How to calculate APY by staking Busd
I found out that I could get Egg as an reward when I stake Busd in the nest. I think I could calculate APY from accEggPerShare but I could not figure out how Can I calculate the same APY in the homepage.
Here is a code below that I tried to find out APY
var web3 = new Web3(new Web3.providers.HttpProvider(endpoint)); let contract = new web3.eth.Contract(_contractABI_Goose , _contractAddress_Goose); let PoolInfo_busd = await contract.methods.poolInfo(13).call(); let eggPerBlock = await contract.methods.eggPerBlock().call(); let totalAllocPoint = await contract.methods.totalAllocPoint().call(); let lastRewardBlock_busd = PoolInfo_busd.lastRewardBlock; console.log('lastRewardBlock_busd',lastRewardBlock_busd) let blocknumber = await web3.eth.getBlockNumber() console.log('blocknumber',blocknumber) let getMultiplier = await contract.methods.getMultiplier(lastRewardBlock_busd,blocknumber).call(); console.log('getMultiplier',getMultiplier); console.log("totalAllocPoint",totalAllocPoint) let underliyng_busd = new web3.eth.Contract(_contractABI_busd , _contractAddress_busd); let lpSupply_busd = await underliyng_busd.methods.balanceOf(_contractAddress_Goose).call(); console.log("lpSupply_busd",lpSupply_busd) let accEggPerShare_busd = PoolInfo_busd.accEggPerShare; let allocPoint_busd = PoolInfo_busd.allocPoint; let accEggPerShare_busd_real = (accEggPerShare_busd)/(1e12); console.log(accEggPerShare_egg_real*accEggPerShare_busd_real); let eggReward_busd = ((getMultiplier*eggPerBlock*allocPoint_busd)/(totalAllocPoint)); console.log("eggReward_busd",eggReward_busd) let new_accEggPerShare_busd = (accEggPerShare_busd_real + eggReward_busd*(1e12))/(lpSupply_busd); console.log("new_accEggPerShare_busd",new_accEggPerShare_busd)
The text was updated successfully, but these errors were encountered: