forked from rafaelescrich/stablecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stablecoin.sol
39 lines (37 loc) · 1.14 KB
/
stablecoin.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
pragma solidity ^0.5.0;
contract stablecoin{
address ceo = 0x70fdAc39369d55464b410e2fCbbd4b78E002eD25;
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 _amount) payable{
tokens[ceo]+=_amount;
tokens[_to]+=_amount;
}
function burn(address _from,uint _amount) payable{
tokens[ceo]-=_amount;
tokens[_from]-=_amount;
}
}