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