New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ERC827 Token #518
Merged
Merged
Add ERC827 Token #518
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a4b1cd6
Add SmartToken contract with tests and documentation
AugustoL a806520
change SmartToken test to work with new linter rules
AugustoL e57f4be
Rename SmartToken to ERC827
AugustoL f36f8e9
Delete SmartToken old docs
AugustoL 4ecdf31
Change order of ERC20 methods and call in transferData and transferDa…
AugustoL 7bd95b1
Overload ERC20 funcitons with new _data argument
AugustoL e911b4d
Add findMethod function in ERC827Token test
AugustoL 685d208
Add increase and decrease approval functions to ERC827 with tests
AugustoL 8854966
change throw for require in MessageHelper contract@
AugustoL 87f5916
Separate ERC827 interface in another contract
AugustoL 7ddd66f
fix increaseApproval in ERC827Token with tests
AugustoL d060d29
Merge remote-tracking branch 'upstream/master' into add-smart-token
AugustoL 2b008f4
Fix solidity linter errors
AugustoL 969466b
Add ethjs-abi dependency needed in ERC827 tests
AugustoL File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,4 +78,48 @@ contract ERC827 is StandardToken { | |
return true; | ||
} | ||
|
||
/** | ||
* @dev Addition to StandardToken methods. Increase the amount of tokens that | ||
* an owner allowed to a spender and execute a call with the sent data. | ||
* | ||
* approve should be called when allowed[_spender] == 0. To increment | ||
* allowed value is better to use this function to avoid 2 calls (and wait until | ||
* the first transaction is mined) | ||
* From MonolithDAO Token.sol | ||
* @param _spender The address which will spend the funds. | ||
* @param _addedValue The amount of tokens to increase the allowance by. | ||
* @param _data ABI-encoded contract call to call `_spender` address. | ||
*/ | ||
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) { | ||
require(_spender != address(this)); | ||
|
||
super.approve(_spender, _addedValue); | ||
|
||
require(_spender.call(_data)); | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* @dev Addition to StandardToken methods. Decrease the amount of tokens that | ||
* an owner allowed to a spender and execute a call with the sent data. | ||
* | ||
* approve should be called when allowed[_spender] == 0. To decrement | ||
* allowed value is better to use this function to avoid 2 calls (and wait until | ||
* the first transaction is mined) | ||
* From MonolithDAO Token.sol | ||
* @param _spender The address which will spend the funds. | ||
* @param _subtractedValue The amount of tokens to decrease the allowance by. | ||
* @param _data ABI-encoded contract call to call `_spender` address. | ||
*/ | ||
function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public returns (bool) { | ||
require(_spender != address(this)); | ||
|
||
super.decreaseApproval(_spender, _subtractedValue); | ||
|
||
require(_spender.call(_data)); | ||
|
||
return true; | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't believe how simple the code for this contract ended up. Congrats for the awesome work. 👏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks to community and maintainers 🎉 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
super.increaseApproval
, notapprove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit worried that the tests did not catch this one. Maybe make sure that the increase approval test works on a spender that already has a certain approval set?