Skip to content

Instantly share code, notes, and snippets.

@AyDeveloper
Last active August 9, 2022 20:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
}
contract Token {
// state variable called ERC20ContractAddress that represents the address of the ERC20 contract
address private constant ERC20ContractAddress = CONTRACTADDRESS;
// to access the functions in the ERC20 contract
// use the interface declared above and wrap the ERC20 contract address in ()
IERC20 TokenInstance = IERC20(ERC20ContractAddress) ;
function getTotalSupply() external pure returns(uint) {
return TokenInstance.totalSupply();
}
function getBalanceOf() external pure returns(uint) {
return TokenInstance.balanceOf();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment