Include expected minSharesQuantity in payment transaction
Closed this issue · 0 comments
kenkunz commented
Goal
As a Trading Strategy developer, I want a calculated minSharesQuantity
to be included in blockchain payment transactions, to prevent MEV bot frontrunning.
Details
We currently include a value of 1
since this is a required field. The smart contract interprets this as 1 unit, or 1e-18
shares (effectively no minimum).
The correct value should be calculated based on the current share price, the amount of USDC the user is depositing, and a slippage tolerance.
When redeeming, we currently show a estimated value of USDC. We should do the same for deposits, showing the estimated number of shares that the user will receive.
Formula:
minSharesQuantity = USDC amount / share price * (1 - slippage tolerance)
…using a hard-coded slippage tolerance of 2%
.
Acceptance criteria
- Deposit blockchain transactions include calculated
minSharesQuantity
based on the formula above - Deposit UI includes estimated shares to be received, based on the formula above
- question: should the estimate be calculated without slippage? or with a lower "average" expected slippage?