-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: add swap fee to FeeDetailsBottomSheet #6025
Conversation
# Conflicts: # src/earn/EarnEnterAmount.tsx
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6025 +/- ##
==========================================
+ Coverage 88.68% 88.69% +0.01%
==========================================
Files 727 727
Lines 30723 30746 +23
Branches 5596 5301 -295
==========================================
+ Hits 27246 27271 +25
- Misses 3277 3432 +155
+ Partials 200 43 -157
... and 70 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -659,14 +687,40 @@ function FeeDetailsBottomSheet({ | |||
)} | |||
</View> | |||
</View> | |||
<RowDivider style={{ marginBottom: Spacing.Large32 }} /> | |||
<View style={styles.gap8}> | |||
<RowDivider /> |
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.
nit: can we also remove the style prop from RowDivider now that it's not used? Would prefer to keep overrides at a minimum where possible
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.
Removed in d6d56d3!
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.
Is this commit on a different branch / PR?
src/earn/EarnEnterAmount.tsx
Outdated
return new BigNumber(swapTransaction.buyAmount) | ||
.multipliedBy(new BigNumber(swapTransaction.appFeePercentageIncludedInPrice).shiftedBy(-2)) // To convert from percentage to decimal | ||
.shiftedBy(-depositToken.decimals) |
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.
the app fee is a % of the from amount, not the to amount. So this should be using the amount the user inputs
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.
Fixed in fff206b!
src/earn/EarnEnterAmount.tsx
Outdated
<TokenDisplay tokenId={token.tokenId} amount={swapFeeAmount.toString()} /> | ||
{' ('} | ||
<TokenDisplay | ||
tokenId={depositToken.tokenId} |
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.
related to above comment, this should be the swap from token
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.
Fixed in fff206b!
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
# Conflicts: # locales/base/translation.json # src/earn/EarnEnterAmount.test.tsx # src/earn/EarnEnterAmount.tsx
src/earn/EarnEnterAmount.tsx
Outdated
|
||
const swapFeeAmount = useMemo(() => { | ||
if (swapTransaction && swapTransaction.appFeePercentageIncludedInPrice) { | ||
return new BigNumber(swapTransaction.buyAmount) |
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.
buyAmount
is the swap to amount. Can we use the user inputted amount (tokenAmount from the parent component)?
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.
Fixed in 4431acd!
@@ -659,14 +687,40 @@ function FeeDetailsBottomSheet({ | |||
)} | |||
</View> | |||
</View> | |||
<RowDivider style={{ marginBottom: Spacing.Large32 }} /> | |||
<View style={styles.gap8}> | |||
<RowDivider /> |
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.
Is this commit on a different branch / PR?
Description
Adds the swap fee if available to the FeedDetailsBottomSheet used in
EarnEnterAmount.tsx
.Test plan
Related issues
Backwards compatibility
Yes
Network scalability
Yes