-
Notifications
You must be signed in to change notification settings - Fork 1
/
5_1_HIP218_FungibleTok.sol
54 lines (40 loc) · 1.86 KB
/
5_1_HIP218_FungibleTok.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./oz/openzeppelin-contracts-4.5.0/contracts/token/ERC20/IERC20.sol";
import "./oz/openzeppelin-contracts-4.5.0/contracts/token/ERC20/extensions/IERC20Metadata.sol";
contract ERC20Contract {
function name(address token) public view returns(string memory) {
return IERC20Metadata(token).name();
}
function symbol(address token) public view returns(string memory) {
return IERC20Metadata(token).symbol();
}
function decimals(address token) public view returns(uint8) {
return IERC20Metadata(token).decimals();
}
function totalSupply(address token) public view returns(uint256){
return IERC20(token).totalSupply();
}
function balanceOf(address token, address account) public view returns(uint256){
return IERC20(token).balanceOf(account);
}
function transfer(address token, address recipient, uint256 amount) public {
IERC20(token).transfer(recipient, amount);
}
function delegateTransfer(address token, address recipient, uint256 amount) public {
(bool success, bytes memory result) = address(IERC20(token)).delegatecall(abi.encodeWithSignature("transfer(address,uint256)", recipient, amount));
}
fallback () external{}
//Not supported operations - should return a failure
function transferFrom(address token, address sender, address recipient, uint256 amount) public {
IERC20(token).transferFrom(sender, recipient, amount);
}
function allowance(address token, address owner, address spender) public view {
IERC20(token).allowance(owner, spender);
}
function approve(address token, address spender, uint256 amount) public {
IERC20(token).approve(spender, amount);
}
}
contract NestedERC20Contract {
}