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

Merged
merged 64 commits into from
Oct 18, 2024
Merged

feat(earn): support partial withdrawals #6128

merged 64 commits into from
Oct 18, 2024

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 89.90826% with 11 lines in your changes missing coverage. Please review.

Project coverage is 88.79%. Comparing base (7ebdccf) to head (ed38faa).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/earn/prepareTransactions.ts 72.72% 6 Missing ⚠️
src/earn/EarnEnterAmount.tsx 93.42% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6128   +/-   ##
=======================================
  Coverage   88.78%   88.79%           
=======================================
  Files         728      728           
  Lines       30870    30941   +71     
  Branches     5645     5669   +24     
=======================================
+ Hits        27409    27474   +65     
- Misses       3264     3270    +6     
  Partials      197      197           
Files with missing lines Coverage Δ
src/analytics/Properties.tsx 100.00% <ø> (ø)
src/earn/EarnDepositBottomSheet.tsx 98.75% <ø> (ø)
src/earn/EarnPoolInfoScreen.tsx 95.48% <100.00%> (+0.12%) ⬆️
src/earn/types.ts 100.00% <ø> (ø)
src/statsig/types.ts 100.00% <100.00%> (ø)
test/values.ts 100.00% <ø> (ø)
src/earn/EarnEnterAmount.tsx 89.09% <93.42%> (+0.41%) ⬆️
src/earn/prepareTransactions.ts 92.30% <72.72%> (+0.37%) ⬆️

... and 1 file 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 7ebdccf...ed38faa. 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
MuckT and others added 2 commits October 9, 2024 13:51
Co-authored-by: Finnian Jacobson-Schulte <140328381+finnian0826@users.noreply.github.com>
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

src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
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.

src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/prepareTransactions.ts Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.tsx Outdated Show resolved Hide resolved
src/earn/EarnEnterAmount.test.tsx Outdated Show resolved Hide resolved
fireEvent.changeText(getByTestId('EarnEnterAmount/TokenAmountInput'), '20.001')
expect(getByTestId('EarnEnterAmount/NotEnoughBalanceWarning')).toBeTruthy()
expect(getByTestId('EarnEnterAmount/Continue')).toBeDisabled()
})
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add tests for checking transaction preparation is called with the right amounts?

src/earn/EarnEnterAmount.test.tsx Outdated Show resolved Hide resolved
@MuckT MuckT added this pull request to the merge queue Oct 18, 2024
Merged via the queue into main with commit b1c5b2c Oct 18, 2024
15 checks passed
@MuckT MuckT deleted the tomm/act-1386 branch October 18, 2024 07:53
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.

4 participants