Skip to content

Instantly share code, notes, and snippets.

@AyDeveloper
Last active August 9, 2022 20:21
Show Gist options
  • Save AyDeveloper/5f34d19ab82d98f1db0d7894514a3c14 to your computer and use it in GitHub Desktop.
Save AyDeveloper/5f34d19ab82d98f1db0d7894514a3c14 to your computer and use it in GitHub Desktop.
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