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

Enable _claim_admin_fees for CurveCryptoPool #275

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

allt0ld
Copy link
Collaborator

@allt0ld allt0ld commented Oct 20, 2023

Description

Closes #231.

Enabled _claim_admin_fees for CurveCryptoPool. For maintainability, tricrypto_ng.vy's implementation and usage patterns are used for both 2-coin and 3-coin Cryptoswap pools. 2-coin CurveCryptoPool and cryptopool.vy will diverge primarily by calling _claim_admin_fees with different timings; any calculations involved are largely the same. I expect that differences relative to the 2-coin vyper contract's behavior will average out to a negligible amount over the course of a sim pipeline.

However, if CurveCryptoPool needs to simulate gulping, then the above solution will not be viable. One potential solution, as @chanhosuh says, would be to implement the following:

"Organize all these [CurveCryptoPool] functions by a sort of configuration based on pool version that specifies when [_claim_admin_fees] or [_tweak_price] should be called. Then it's enforced by a function that checks what method it is in and what version the pool is."

Alternatively, adding statements like if self.n == 2 or if self.n == 3 to the functions that call _claim_admin_fees in either one of tricrypto_ng.vy or cryptopool.vy (_tweak_price, add_liquidity, remove_liquidity, and remove_liquidity_one_coin) plus _claim_admin_fees itself could work. Of course, these solutions are tricky and messy, but there's no going around that.

Hygiene checklist

  • Changelog entry
  • Everything public has a Numpy-style docstring
    (modules, public functions, classes, and public methods)
  • Commit history is cleaned-up with minor changes squashed together
    and descriptive commit messages following Tim Pope's style

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@allt0ld allt0ld self-assigned this Oct 20, 2023
@allt0ld allt0ld added this to the 0.5.5 milestone Oct 20, 2023
@github-actions
Copy link
Contributor

Coverage report

The coverage rate went from 75.75% to 75.72% ⬇️
The branch rate is 62%.

100% of new lines are covered.

Diff Coverage details (click to unfold)

curvesim/pool/cryptoswap/pool.py

100% of new lines are covered (90.28% of the complete file).

@allt0ld allt0ld marked this pull request as ready for review October 20, 2023 20:27
@chanhosuh chanhosuh merged commit cc095b0 into main Oct 30, 2023
15 checks passed
@chanhosuh chanhosuh deleted the tricrypto-claim-admin-fees branch October 30, 2023 15:17
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.

Reinstate claim_admin_fees (Cryptoswap)
2 participants