-
Notifications
You must be signed in to change notification settings - Fork 1
/
5_2_HIP218_NFT.sol
72 lines (54 loc) · 2.64 KB
/
5_2_HIP218_NFT.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./oz/openzeppelin-contracts-4.5.0/contracts/token/ERC721/IERC721.sol";
import "./oz/openzeppelin-contracts-4.5.0/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "./oz/openzeppelin-contracts-4.5.0/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
contract ERC721Contract {
function name(address token) public view returns (string memory) {
return IERC721Metadata(token).name();
}
function symbol(address token) public view returns(string memory) {
return IERC721Metadata(token).symbol();
}
function tokenURI(address token, uint256 tokenId) public view returns(string memory) {
return IERC721Metadata(token).tokenURI(tokenId);
}
function totalSupply(address token) public view returns (uint256){
return IERC721Enumerable(token).totalSupply();
}
function balanceOf(address token, address owner) public view returns(uint256) {
return IERC721(token).balanceOf(owner);
}
function ownerOf(address token, uint256 tokenId) public view returns(address) {
return IERC721(token).ownerOf(tokenId);
}
//Not supported operations - should return a failure
function transferFrom(address token, address from, address to, uint256 tokenId) public {
IERC721(token).transferFrom(from, to, tokenId);
}
function approve(address token, address to, uint256 tokenId) public {
IERC721(token).approve(to, tokenId);
}
function setApprovalForAll(address token, address operator, bool approved) public {
IERC721(token).setApprovalForAll(operator, approved);
}
function getApproved(address token, uint256 tokenId) public view {
IERC721(token).getApproved(tokenId);
}
function isApprovedForAll(address token, address owner, address operator) public view {
IERC721(token).isApprovedForAll(owner, operator);
}
function safeTransferFrom(address token, address from, address to, uint256 tokenId) public {
IERC721(token).safeTransferFrom(from, to, tokenId);
}
function safeTransferFromWithData(address token, address from, address to,
uint256 tokenId, bytes calldata data) public {
IERC721(token).safeTransferFrom(from, to, tokenId, data);
}
function tokenByIndex(address token, uint256 index) public view {
IERC721Enumerable(token).tokenByIndex(index);
}
function tokenOfOwnerByIndex(address token, address owner, uint256 index) public view {
IERC721Enumerable(token).tokenOfOwnerByIndex(owner, index);
}
}