Created
January 18, 2021 17:52
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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