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

⚡️ Derive user swap coin in from remaining coin received only #31

Merged

Conversation

NotJeremyLiu
Copy link
Member

@NotJeremyLiu NotJeremyLiu commented Jul 26, 2023

Background

  • When the contract was originally developed, it did not have enforcement that a user would not be allowed to leave funds on contract by accident if they input a coin_in in user_swap that was less than the remaining_coin_received on contract.
  • This was changed to be enforced after the audit findings.
  • After implementing the audit changes, the logic enforced that the coin_in in user_swap was the exact same as the remaining_coin_received, otherwise it errors. So it no longer makes sense to accept a coin_in parameter if all it does is open up a vector for a user error that errors the transaction.

This PR

  1. Removes the coin_in field in the SwapExactCoinIn type
  2. Removes logic in the entry point contract that used the coin_in field, instead just using remaining_coin_received
  3. Updates tests

@NotJeremyLiu NotJeremyLiu added the interface-breaking changes that break the user-facing interface to call the contract label Jul 26, 2023
@NotJeremyLiu NotJeremyLiu merged commit ba77f14 into main Jul 26, 2023
3 checks passed
@NotJeremyLiu NotJeremyLiu deleted the jl/derive-user-swap-coin-in-from-remaining-coin-only branch July 26, 2023 21:30
@NotJeremyLiu NotJeremyLiu mentioned this pull request Jul 26, 2023
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interface-breaking changes that break the user-facing interface to call the contract
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant