forked from leon-do/ERC721
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontract721.sol
33 lines (31 loc) · 1.06 KB
/
contract721.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
pragma solidity ^0.5.0;
//import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract my721 is ERC721{
mapping(address => uint) tokens;
function approval(address _owner, address _approved,uint _tokenId){
require(tokens[_owner]==_tokenId);
tokens[_approved]=_tokenId;
}
function transfer(address _to, uint _amount) public payable{
require(_amount <= tokens[msg.sender]);
tokens[msg.sender]-=_amount;
tokens[_to]+=_amount;
}
function balanceOf(address _owner) public view returns (uint){
return tokens[_owner];
}
function ownerOf(uint _tokenId) public view returns(address){
return tokens[_id].address;
}
function TransferFrom(address _from, address _to, uint _tokenId) payable{
require(tokens[_from]==_tokenId);
tokens[_from]=0;
tokens[_to]=_tokenId;
}
function approve(address _approved, uint _tokenId) payable{
require(tokens[msg.sender]==_tokenId);
tokens[_approved]=_tokenId;
}
function mint(address _to, uint _tokenId,) public{
tokens[_to] = 'mytoken '+str(uint(blockhash(block.number - 1)));
}