Add ERC5679Ext20 fills

This commit is contained in:
lash 2023-03-26 08:07:41 +01:00
parent f237bd8d82
commit 46e827390e
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
10 changed files with 42 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_supply","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"StaticToken.sol":"StaticToken"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"StaticToken.sol":{"keccak256":"0x7afcc41cbaaaeeac2e372c50ed4cf6962035af89e33b500a65927f46d8bf31f2","license":"GPL-3.0-or-later","urls":["bzz-raw://4077171f628fd470cb7f72ca80426297132050f4d08380b55ca74c87e3df2727","dweb:/ipfs/QmWvgFNWrRtzQFejyfjy6LaerghSnYQ86R5WVTnXS7wiuD"]}},"version":1} {"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_supply","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"StaticToken.sol":"StaticToken"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"StaticToken.sol":{"keccak256":"0xfb467ccf3465a3f2c8ad23bc4933f7e1ac1964d7ee1aa185e72e4698b015b5b3","license":"AGPL-3.0-or-later","urls":["bzz-raw://6c2230ba6ddadf062f5f3391f2a852da8617fbefd0c0511d9bc372c6c66c6424","dweb:/ipfs/QmWSYF3WxmKyDEHp3NZMWjE6Yu7mY6XVB6tuTeFKpjxL9P"]}},"version":1}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
pragma solidity >=0.6.11; pragma solidity >=0.8.0;
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
// File-Version: 2 // File-Version: 3
contract GiftableToken { contract GiftableToken {
@ -27,7 +27,7 @@ contract GiftableToken {
// Implements Burner // Implements Burner
uint256 public totalBurned; uint256 public totalBurned;
// Implements expire // Implements Expire
uint256 public expires; uint256 public expires;
bool expired; bool expired;
@ -78,6 +78,13 @@ contract GiftableToken {
return true; return true;
} }
// Implements Minter
// Implements ERC5679Ext20
function mint(address _to, uint256 _value, bytes calldata _data) public {
_data;
mintTo(_to, _value);
}
// Implements Writer // Implements Writer
function addWriter(address _minter) public returns (bool) { function addWriter(address _minter) public returns (bool) {
require(msg.sender == owner); require(msg.sender == owner);
@ -88,7 +95,7 @@ contract GiftableToken {
} }
// Implements Writer // Implements Writer
function removeWriter(address _minter) public returns (bool) { function deleteWriter(address _minter) public returns (bool) {
require(msg.sender == owner || msg.sender == _minter); require(msg.sender == owner || msg.sender == _minter);
writers[_minter] = false; writers[_minter] = false;
@ -140,6 +147,19 @@ contract GiftableToken {
return true; return true;
} }
// Implements Burner
function burn() public returns(bool) {
return burn(balanceOf[msg.sender]);
}
// Implements Burner
// Implements ERC5679Ext20
function burn(address _from, uint256 _value, bytes calldata _data) public {
require(msg.sender == _from, 'ERR_NOT_SELF');
_data;
burn(_value);
}
// Implements ERC20 // Implements ERC20
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(applyExpiry() == 0); require(applyExpiry() == 0);
@ -190,6 +210,9 @@ contract GiftableToken {
if (_sum == 0xb1110c1b) { // Burner if (_sum == 0xb1110c1b) { // Burner
return true; return true;
} }
if (_sum == 0x841a0e94) { // Expire
return true;
}
return false; return false;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
pragma solidity >0.6.11; pragma solidity >=0.8.0;
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
contract StaticToken { contract StaticToken {
@ -20,8 +20,11 @@ contract StaticToken {
// Implements ERC20 // Implements ERC20
mapping (address => mapping (address => uint256)) public allowance; mapping (address => mapping (address => uint256)) public allowance;
// Implements ERC20
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Implements ERC20
event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value); event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value);
// Implements ERC20
event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _supply) { constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _supply) {
@ -65,7 +68,7 @@ contract StaticToken {
// Implements EIP165 // Implements EIP165
function supportsInterface(bytes4 _sum) public pure returns (bool) { function supportsInterface(bytes4 _sum) public pure returns (bool) {
if (_sum == 0xc6bb4b70) { // ERC20 if (_sum == 0xb61bc941) { // ERC20
return true; return true;
} }
if (_sum == 0x01ffc9a7) { // EIP165 if (_sum == 0x01ffc9a7) { // EIP165