This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
Update AccountsStrategy._payForGasWithAccountBalance
to accept gas percentage to pay from liquid balance
#289
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.
Explanation of the solution
When calling
strategyRedeem(All)
funcs and having to pay part of gas fees from Accounts Diamond itself, we currently pass value1
for bothlockAmt
andliqAmt
to_payForGasWithAccountBalance
to force it to split the fee equally between locked and liquid balance portions. This in turn, with the current logic, causes balances to be decreased not just by the necessary gas amount(s), but also by this 1 extra token on both locked and liquid.To address this, we update
_payForGasWithAccountBalance
to know how to split gas fees when either or bothto accept alockAmt
andliqAmt
are 0 (zero).gasPercentFromLiq
parameter indicating the percentage of gas to be payed from liquid balance, with the rest being payed from locked balance.This way we make it possible to preserve existing behavior, which is to make fee split proportional on
invest
andredeem
, but split in half onredeemAll
, while also removing the unintended behavior described above.Instructions on making this work
yarn
oryarn install
to install npm dependencies