From 7122fc280b9dd29f38e285d97871dcb334043fef Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 5 Feb 2021 09:44:15 +0100 Subject: [PATCH] Add default sink address to constructor --- python/tests/test_basic.py | 5 ++++- solidity/RedistributedDemurrageToken.sol | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py index cff49e8..01ea18c 100644 --- a/python/tests/test_basic.py +++ b/python/tests/test_basic.py @@ -40,12 +40,15 @@ class Test(unittest.TestCase): self.abi = json.load(f) f.close() + backend = eth_tester.PyEVMBackend(eth_params) self.eth_tester = eth_tester.EthereumTester(backend) provider = web3.Web3.EthereumTesterProvider(self.eth_tester) self.w3 = web3.Web3(provider) + self.sink_address = self.w3.eth.accounts[9] + c = self.w3.eth.contract(abi=self.abi, bytecode=self.bytecode) - tx_hash = c.constructor('Foo Token', 'FOO', 6, TAX_LEVEL, PERIOD).transact({'from': self.w3.eth.accounts[0]}) + tx_hash = c.constructor('Foo Token', 'FOO', 6, TAX_LEVEL, PERIOD, self.sink_address).transact({'from': self.w3.eth.accounts[0]}) r = self.w3.eth.getTransactionReceipt(tx_hash) self.contract = self.w3.eth.contract(abi=self.abi, address=r.contractAddress) diff --git a/solidity/RedistributedDemurrageToken.sol b/solidity/RedistributedDemurrageToken.sol index a3b09c8..aec9494 100644 --- a/solidity/RedistributedDemurrageToken.sol +++ b/solidity/RedistributedDemurrageToken.sol @@ -21,6 +21,8 @@ contract RedistributedDemurrageToken { mapping (address => bool) minter; mapping (address => mapping (address => uint256 ) ) allowance; // holder -> spender -> amount (amount is subject to demurrage) + address sinkAddress; // receives redistribuion remainders + event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Mint(address indexed _minter, address indexed _beneficiary, uint256 _value); @@ -28,7 +30,7 @@ contract RedistributedDemurrageToken { event Taxed(uint256 indexed _period); event Redistribution(address indexed _account, uint256 indexed _period, uint256 _value); - constructor(string memory _name, string memory _symbol, uint8 _decimals, uint32 _taxLevel, uint256 _period) { + constructor(string memory _name, string memory _symbol, uint8 _decimals, uint32 _taxLevel, uint256 _period, address _defaultSinkAddress) { owner = msg.sender; minter[owner] = true; periodStart = block.number;