mirror of
git://holbrook.no/erc20-demurrage-token
synced 2024-12-22 11:57:32 +01:00
Decrease allowance on transferfrom
This commit is contained in:
parent
4f1bd36c12
commit
e49493def1
File diff suppressed because one or more lines are too long
@ -360,6 +360,12 @@ class TestBasic(TestDemurrageDefault):
|
|||||||
balance = c.parse_balance_of(r)
|
balance = c.parse_balance_of(r)
|
||||||
self.assertEqual(balance, 500)
|
self.assertEqual(balance, 500)
|
||||||
|
|
||||||
|
(tx_hash, o) = c.transfer_from(self.address, self.accounts[2], self.accounts[1], self.accounts[3], 1)
|
||||||
|
self.rpc.do(o)
|
||||||
|
o = receipt(tx_hash)
|
||||||
|
r = self.rpc.do(o)
|
||||||
|
self.assertEqual(r['status'], 0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -442,7 +442,7 @@ contract DemurrageTokenSingleCap {
|
|||||||
uint256 baseValue;
|
uint256 baseValue;
|
||||||
|
|
||||||
baseValue = toBaseAmount(_value);
|
baseValue = toBaseAmount(_value);
|
||||||
require(allowance[msg.sender][_spender] <= baseValue);
|
require(allowance[msg.sender][_spender] >= baseValue);
|
||||||
|
|
||||||
changePeriod();
|
changePeriod();
|
||||||
|
|
||||||
@ -487,7 +487,9 @@ contract DemurrageTokenSingleCap {
|
|||||||
baseValue = toBaseAmount(_value);
|
baseValue = toBaseAmount(_value);
|
||||||
require(allowance[_from][msg.sender] >= baseValue);
|
require(allowance[_from][msg.sender] >= baseValue);
|
||||||
|
|
||||||
|
allowance[_from][msg.sender] -= baseValue;
|
||||||
result = transferBase(_from, _to, baseValue);
|
result = transferBase(_from, _to, baseValue);
|
||||||
|
|
||||||
emit Transfer(_from, _to, _value);
|
emit Transfer(_from, _to, _value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user