Skip to content
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

refactor HasNoTokens.sol to extract reclaimToken #348

Merged
merged 2 commits into from
Aug 24, 2017

Conversation

SylTi
Copy link
Contributor

@SylTi SylTi commented Aug 3, 2017

By splitting reclaimToken of HasNoTokens.sol, it can be used on a contract that can receive a specific type of token, or receive them only a certain way (through transferFrom for example) but want to be able to reclaim all others. inheriting from a HasNoTokens on that type of contract seems counter-intuitive?

@maraoz
Copy link
Contributor

maraoz commented Aug 3, 2017

Love this, but I'm not 100% convinced with the name CanReclaimToken. @frangio if you're ok with it, please merge. If not, can you think of a better name? I coudn't

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

I agree the name is not ideal, but we can keep it if we have nothing better.

* @param tokenAddr address The address of the token contract
*/
function reclaimToken(address tokenAddr) external onlyOwner {
ERC20Basic tokenInst = ERC20Basic(tokenAddr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can avoid this cast by defining the function to take an ERC20Basic instance: reclaimToken(ERC20Basic token). (I also think token is a better variable name than tokenInst.)

let token = null;
let canReclaimToken = null;

beforeEach(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a function expression instead of an arrow function here. (See https://mochajs.org/#arrow-functions)

@SylTi
Copy link
Contributor Author

SylTi commented Aug 9, 2017 via email

@frangio
Copy link
Contributor

frangio commented Aug 24, 2017

Merging this but it may be superceded by the more general TokenWallet of #378.

@frangio frangio merged commit af6fdae into OpenZeppelin:master Aug 24, 2017
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
refactor HasNoTokens.sol to extract reclaimToken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants