Skip to content

Instantly share code, notes, and snippets.

@dangerousfood
Created January 18, 2021 17:52
Show Gist options
  • Save dangerousfood/0cb2dae7a9fda15d60379ac0e9b2d8c7 to your computer and use it in GitHub Desktop.
Save dangerousfood/0cb2dae7a9fda15d60379ac0e9b2d8c7 to your computer and use it in GitHub Desktop.
A method to get the SUSHI to xSushi exchange rate from the contracts
let sushi = new ethers.Contract('0x6b3595068778dd592e39a122f4f5a5cf09c90fe2', abi, provider)
let totalSushiStakedinXSushi = await sushi.methods.balanceOf('0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272').call()
let xSushi = new ethers.Contract('0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', abi, provider)
let totalXSushiSupply = await xSushi.methods.totalSupply().call()
let exchangeRate = totalSushiStakedinBar.div(totalXSushiSupply)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment