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

feat(earn): support partial withdrawals #6128

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

feat(earn): support partial withdrawals #6128

wants to merge 25 commits into from

Conversation

MuckT
Copy link
Collaborator

@MuckT MuckT commented Oct 2, 2024

Description

Adds the ability to support partial withdrawals from Earn pools and adds the feature gate allow_earn_partial_withdrawal to enable this feature.

Example Deposit Example Withdrawal

Test plan

  • Tested locally on iOS
  • Tested locally on Android
  • Unit Tests Updated

Related issues

Backwards compatibility

Yes

Network scalability

Yes

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 28 lines in your changes missing coverage. Please review.

Project coverage is 88.71%. Comparing base (4c4693d) to head (ad16ffa).

Files with missing lines Patch % Lines
src/earn/prepareTransactions.ts 4.54% 21 Missing ⚠️
src/earn/EarnEnterAmount.tsx 90.54% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6128      +/-   ##
==========================================
- Coverage   88.75%   88.71%   -0.05%     
==========================================
  Files         727      727              
  Lines       30752    30825      +73     
  Branches     5317     5646     +329     
==========================================
+ Hits        27295    27346      +51     
+ Misses       3414     3281     -133     
- Partials       43      198     +155     
Files with missing lines Coverage Δ
src/analytics/Properties.tsx 100.00% <ø> (ø)
src/components/TokenDisplay.tsx 100.00% <100.00%> (ø)
src/earn/EarnDepositBottomSheet.tsx 98.75% <ø> (ø)
src/earn/EarnPoolInfoScreen.tsx 97.10% <100.00%> (+0.08%) ⬆️
src/earn/types.ts 100.00% <ø> (ø)
src/statsig/types.ts 100.00% <100.00%> (ø)
test/values.ts 100.00% <ø> (ø)
src/earn/EarnEnterAmount.tsx 88.40% <90.54%> (-0.29%) ⬇️
src/earn/prepareTransactions.ts 73.07% <4.54%> (-18.86%) ⬇️

... and 65 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c4693d...ad16ffa. Read the comment docs.

@MuckT MuckT marked this pull request as ready for review October 9, 2024 01:20
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
MuckT and others added 2 commits October 9, 2024 11:15
test/values.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jh2oman jh2oman left a comment

Choose a reason for hiding this comment

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

Can you run through deposit, and swap-deposit flows again to ensure they still work? Also making sure that they are correct for stable and non stable coins

Comment on lines 202 to 206
isWithdrawal ? inputToken.tokenId : withdrawToken.tokenId
)
const localToToken = useLocalToTokenAmount(
parsedLocalAmount,
isWithdrawal ? inputToken.tokenId : withdrawToken.tokenId
Copy link
Contributor

Choose a reason for hiding this comment

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

if deposit then use the withdrawTokenId? This seems incorrect. you can also tell b/c the fiat values are different here and in the details section

Simulator Screenshot - iPhone 15 Pro - 2024-10-10 at 13 17 50

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 96caa2e!

src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@jh2oman jh2oman left a comment

Choose a reason for hiding this comment

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

I believe the withdrawToken state can be removed now.

Copy link
Contributor

@jh2oman jh2oman left a comment

Choose a reason for hiding this comment

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

Local amount in the input amount and details section still do not match

Simulator Screenshot - iPhone 15 Pro - 2024-10-11 at 13 19 50

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