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

Add MsgSwapWithinBatch Verification and Fix OfferCoinFee Calculation #435

Closed
4 tasks
dongsam opened this issue Aug 23, 2021 · 0 comments · Fixed by #436
Closed
4 tasks

Add MsgSwapWithinBatch Verification and Fix OfferCoinFee Calculation #435

dongsam opened this issue Aug 23, 2021 · 0 comments · Fixed by #436
Assignees

Comments

@dongsam
Copy link
Contributor

dongsam commented Aug 23, 2021

Problem Definition

Currently, during the MsgSwapWithinBatch verification phase of MsgServer, if OfferCoinFee is zero, it is calculated and filled according to the current SwapFeeRate.

However, this method does not specify OfferCoinFee exactly in the msg, which can cause confusion that users expect.

so after this update, the proper OfferCoinFee should be in MsgSwapWithinBatch

and there is also a risk of using a small OfferCoin to pay less OfferCoinFee because it is currently being truncated when calculating OfferCoinFee, So It change to Ceil

  • v1.2.x: MsgSwapWithinBatch.OfferCoinFee should be OfferCoin * params.SwapFeeRate with Truncate or 0
  • v1.3.x: MsgSwapWithinBatch.OfferCoinFee should be OfferCoin * params.SwapFeeRate with Ceil

Proposal

  1. When calculating OfferCoinFee, the decimal points are rounded up.

  2. Add test code for MsgSwapWithinBatch validation and OfferCoinFee calculation

  3. Corrected the missing part of the Spec doc and updated the above.

  4. Fix reserveOfferCoinFee residual Issue due to decimal error

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
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 a pull request may close this issue.

1 participant