fix increaseApproval in ERC827Token with tests

pull/518/head
AugustoL 7 years ago
parent 87f5916341
commit 7ddd66fb74
  1. 2
      contracts/token/ERC827Token.sol
  2. 11
      test/ERC827Token.js

@ -94,7 +94,7 @@ contract ERC827Token is ERC827, StandardToken {
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.approve(_spender, _addedValue);
super.increaseApproval(_spender, _addedValue);
require(_spender.call(_data));

@ -183,6 +183,11 @@ contract('ERC827 Token', function (accounts) {
web3.toHex(123456), 666, 'Transfer Done'
);
await token.approve(message.contract.address, 10);
new BigNumber(10).should.be.bignumber.equal(
await token.allowance(accounts[0], message.contract.address)
);
const abiMethod = findMethod(token.abi, 'increaseApproval', 'address,uint256,bytes');
const increaseApprovalData = ethjsABI.encodeMethod(abiMethod,
[message.contract.address, 50, extraData]
@ -193,7 +198,7 @@ contract('ERC827 Token', function (accounts) {
assert.equal(2, transaction.receipt.logs.length);
new BigNumber(50).should.be.bignumber.equal(
new BigNumber(60).should.be.bignumber.equal(
await token.allowance(accounts[0], message.contract.address)
);
});
@ -205,6 +210,10 @@ contract('ERC827 Token', function (accounts) {
await token.approve(message.contract.address, 100);
new BigNumber(100).should.be.bignumber.equal(
await token.allowance(accounts[0], message.contract.address)
);
const extraData = message.contract.showMessage.getData(
web3.toHex(123456), 666, 'Transfer Done'
);

Loading…
Cancel
Save