ETH Price: $2,629.85 (-0.31%)

Contract Diff Checker

Contract Name:
xSushiExchangeRate

Contract Source Code:

File 1 of 1 : xSushiExchangeRate

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface IERC20 {
  function totalSupply() external view returns (uint256);
  function balanceOf(address account) external view returns (uint256);
}

contract xSushiExchangeRate {

  IERC20 xSushi;
  IERC20 sushi;

  constructor(address _xSushi, address _sushi) {
    xSushi = IERC20(_xSushi);
    sushi = IERC20(_sushi);
  }

  function getExchangeRate() public view returns (uint256) {
    return sushi.balanceOf(address(xSushi))*(10**18) / xSushi.totalSupply();
  }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):