mirror of
git://holbrook.no/erc20-demurrage-token
synced 2024-12-22 11:57:32 +01:00
Add EIP 165, 173 support
This commit is contained in:
parent
ebef1948aa
commit
e332f76a04
@ -1,2 +1,2 @@
|
|||||||
chainlib~=0.0.2a10
|
chainlib~=0.0.2b1
|
||||||
crypto-dev-signer~=0.4.14b1
|
crypto-dev-signer~=0.4.14b3
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = sarafu-token
|
name = sarafu-token
|
||||||
version = 0.0.1a5
|
version = 0.0.1a7
|
||||||
description = ERC20 token with redistributed continual demurrage
|
description = ERC20 token with redistributed continual demurrage
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
@ -25,11 +25,10 @@ include_package_data = True
|
|||||||
python_requires = >= 3.6
|
python_requires = >= 3.6
|
||||||
packages =
|
packages =
|
||||||
sarafu_token
|
sarafu_token
|
||||||
sarafu_token.runnable.legacy
|
sarafu_token.runnable
|
||||||
install_requires =
|
install_requires =
|
||||||
chainlib~=0.0.2a1
|
chainlib~=0.0.2a10
|
||||||
crypto-dev-signer~=0.4.14a17
|
crypto-dev-signer~=0.4.14b1
|
||||||
web3==5.12.2
|
|
||||||
|
|
||||||
[options.package_data]
|
[options.package_data]
|
||||||
* =
|
* =
|
||||||
@ -38,4 +37,4 @@ install_requires =
|
|||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
sarafu-token-deploy = sarafu_faucet.runnable.deploy:main
|
sarafu-token-deploy = sarafu_token.runnable.deploy:main
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
web3==5.12.2
|
web3==5.12.2
|
||||||
eth_tester==0.5.0b3
|
eth_tester==0.5.0b3
|
||||||
py-evm==0.3.0a20
|
py-evm==0.3.0a20
|
||||||
giftable-erc20-token==0.0.8a1
|
giftable-erc20-token==0.0.8a10
|
||||||
|
@ -35,6 +35,8 @@ contract RedistributedDemurrageToken {
|
|||||||
// Implements EIP172
|
// Implements EIP172
|
||||||
address public owner;
|
address public owner;
|
||||||
|
|
||||||
|
address newOwner;
|
||||||
|
|
||||||
// Implements ERC20
|
// Implements ERC20
|
||||||
string public name;
|
string public name;
|
||||||
|
|
||||||
@ -93,6 +95,9 @@ contract RedistributedDemurrageToken {
|
|||||||
// Temporary event used in development, will be removed on prod
|
// Temporary event used in development, will be removed on prod
|
||||||
event Debug(bytes32 _foo);
|
event Debug(bytes32 _foo);
|
||||||
|
|
||||||
|
// EIP173
|
||||||
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173
|
||||||
|
|
||||||
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _taxLevelMinute, uint256 _periodMinutes, address _defaultSinkAddress) public {
|
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _taxLevelMinute, uint256 _periodMinutes, address _defaultSinkAddress) public {
|
||||||
// ACL setup
|
// ACL setup
|
||||||
owner = msg.sender;
|
owner = msg.sender;
|
||||||
@ -509,7 +514,7 @@ contract RedistributedDemurrageToken {
|
|||||||
return (_value * ppmDivider * 1000000) / demurrageAmount;
|
return (_value * ppmDivider * 1000000) / demurrageAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ERC20, triggers tax and/or redistribution
|
// Implements ERC20, triggers tax and/or redistribution
|
||||||
function approve(address _spender, uint256 _value) public returns (bool) {
|
function approve(address _spender, uint256 _value) public returns (bool) {
|
||||||
uint256 baseValue;
|
uint256 baseValue;
|
||||||
|
|
||||||
@ -522,7 +527,7 @@ contract RedistributedDemurrageToken {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ERC20, triggers tax and/or redistribution
|
// Implements ERC20, triggers tax and/or redistribution
|
||||||
function transfer(address _to, uint256 _value) public returns (bool) {
|
function transfer(address _to, uint256 _value) public returns (bool) {
|
||||||
uint256 baseValue;
|
uint256 baseValue;
|
||||||
bool result;
|
bool result;
|
||||||
@ -537,7 +542,7 @@ contract RedistributedDemurrageToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ERC20, triggers tax and/or redistribution
|
// Implements ERC20, triggers tax and/or redistribution
|
||||||
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
|
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
|
||||||
uint256 baseValue;
|
uint256 baseValue;
|
||||||
bool result;
|
bool result;
|
||||||
@ -566,4 +571,41 @@ contract RedistributedDemurrageToken {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements EIP173
|
||||||
|
function transferOwnership(address _newOwner) public returns (bool) {
|
||||||
|
require(msg.sender == owner);
|
||||||
|
newOwner = _newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements OwnedAccepter
|
||||||
|
function acceptOwnership() public returns (bool) {
|
||||||
|
address oldOwner;
|
||||||
|
|
||||||
|
require(msg.sender == newOwner);
|
||||||
|
oldOwner = owner;
|
||||||
|
owner = newOwner;
|
||||||
|
newOwner = address(0);
|
||||||
|
emit OwnershipTransferred(oldOwner, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements EIP165
|
||||||
|
function supportsInterface(bytes4 _sum) public pure returns (bool) {
|
||||||
|
if (_sum == 0xc6bb4b70) { // ERC20
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_sum == 0x449a52f8) { // Minter
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_sum == 0x01ffc9a7) { // EIP165
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_sum == 0x9493f8b2) { // EIP173
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_sum == 0x37a47be4) { // OwnedAccepter
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user