From 9b538d0e47fb6ed20f5a356f02be95f238401db6 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 6 Feb 2021 15:48:17 +0100 Subject: [PATCH] Use base amount on minting --- python/tests/test_redistribution.py | 2 +- solidity/RedistributedDemurrageToken.sol | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/tests/test_redistribution.py b/python/tests/test_redistribution.py index 9a95911..fd3c1de 100644 --- a/python/tests/test_redistribution.py +++ b/python/tests/test_redistribution.py @@ -147,7 +147,7 @@ class Test(unittest.TestCase): r = self.w3.eth.getTransactionReceipt(tx_hash) # No cheating! self.contract.functions.transfer(self.w3.eth.accounts[3], spend_amount).transact({'from': self.w3.eth.accounts[3]}) - # Cheapskate! + # No cheapskating! self.contract.functions.transfer(external_address, spend_amount-1).transact({'from': self.w3.eth.accounts[4]}) self.assertEqual(r.status, 1) diff --git a/solidity/RedistributedDemurrageToken.sol b/solidity/RedistributedDemurrageToken.sol index 1958c51..bcc56dc 100644 --- a/solidity/RedistributedDemurrageToken.sol +++ b/solidity/RedistributedDemurrageToken.sol @@ -117,12 +117,15 @@ contract RedistributedDemurrageToken { // Creates new tokens out of thin air, and allocates them to the given address // Triggers tax function mintTo(address _beneficiary, uint256 _amount) external returns (bool) { + uint256 baseAmount; + require(minter[msg.sender]); applyDemurrage(); changePeriod(); + baseAmount = _amount; totalSupply += _amount; - increaseBaseBalance(_beneficiary, _amount); + increaseBaseBalance(_beneficiary, baseAmount); emit Mint(msg.sender, _beneficiary, _amount); saveRedistributionSupply(); return true;