This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
Use a pull model to withdraw deposit ETH balances #570
Merged
Conversation
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
enableWithdrawal - Enables a given address to withdraw value after the contract reaches an end state withdrawFunds - Withdraw the funds a given caller is allowed. Only callable after the contract has reached an end-state.
Use the pull model instead of forwarding value directly.
Allow for withdrawable-allowance querry.
We use this in liquidation tests now, it is still inherited for use where TestDepositUtils is used
contact -> contract _valueToDistribute -> valueToDistribute
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
} | ||
|
||
/// @notice Get the caller's withdraw allowance. | ||
/// @return The caller's withdrawable allowance in wei. |
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.
We're back-and-forthing between “withdraw allowance” and “withdrawable allowance”. I'm fine with “withdraw allowance”, but let's use it everywhere.
EDIT: And “withdrawal allowance”.
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
Shadowfiend
reviewed
Apr 9, 2020
check `contractEthBalance > valueToDistribute + 1` to avoid spliting a balance of 1 wei.
more consistent naming, remove awkward possessive
Check that the contract has what it owes
For better test safety make sure the initial balance is not influences by other factors
Checking that the final balance is greated than the initial one does not prove that the withdraw() functions correctly. Instead, account for gas cost and check the exact value.
Shadowfiend
approved these changes
Apr 10, 2020
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.
Still think it would make sense to make withdrawalAllowances
be withdrawAllowances
, but I think we can merge this as-is and get that in the next PR that handles the redemption abort liquidation path.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Push models introduce security and stability concerns, a pull model allows for better security, as well as more flexibility and freedom to third-party contract fallbacks given
.call.value()
's gas-forwarding.Closes #551.