Compare commits

...

4 Commits

Author SHA1 Message Date
nolash
9b538d0e47
Use base amount on minting 2021-02-06 15:48:17 +01:00
nolash
3f0516d4bc Merge remote-tracking branch 'origin/master' into lash/use-timestamps 2021-02-06 15:47:43 +01:00
Louis Holbrook
cf6fd57672 Merge branch 'lash/use-timestamps' into 'master'
Use timestamps instead of blocks

See merge request grassrootseconomics/sarafu-token!4
2021-02-06 14:18:30 +00:00
Louis Holbrook
0053b90368 Use timestamps instead of blocks 2021-02-06 14:18:30 +00:00
2 changed files with 5 additions and 2 deletions

View File

@ -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)

View File

@ -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;