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 *Data methods in LifToken to use super methods #280

Merged
merged 9 commits into from Oct 9, 2017

Conversation

nberger
Copy link
Contributor

@nberger nberger commented Oct 6, 2017

Calls super.approve, super.transfer & super.transferFrom from the corresponding
*Data methods (approveData, transferData & transferDataFrom)

@nberger nberger requested a review from AugustoL October 6, 2017 16:34
}

super.approve(spender, value);
assert(spender.call(data));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we should use require instead of assert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I just changed it

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 8a590db on reuse-transfer-in-transfer-data into ** on master**.

}

super.transferFrom(from, to, value);
require(to.call(data));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be first the require to save some gas, because if it fails later the gas used by transfer will be consumed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, just changed it in d818a37

The end result is the same. But this way it will be more natural to
replace the first part of the methods with calls to the underlying
methods transfer, transferFrom and approve
Calls super.approve, super.transfer & super.transferFrom from the corresponding
*Data methods (approveData, transferData & transferDataFrom)
First do the contract call, then the approve/transfer. This way some gas
is saved in case the call fails because the approve/transfer is not executed
@nberger nberger force-pushed the reuse-transfer-in-transfer-data branch from d818a37 to b508102 Compare October 9, 2017 17:32
@nberger nberger merged commit 236e8a5 into master Oct 9, 2017
@nberger nberger deleted the reuse-transfer-in-transfer-data branch October 9, 2017 17:50
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.293% when pulling b508102 on reuse-transfer-in-transfer-data into 7d0b2e3 on master.

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.

None yet

3 participants