what is the math formula behind getAmountIn ?
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- solidity
- Domain
- blockchain
Research direction
Start by reading src/blindBackrun.sol at line 83 and compare the getAmountIn formula with the pool-update equations and price-equality condition in the issue. Trace each variable and fee factor, then document the algebraic derivation so the formula's result can be checked against the code.
Written by the indexing model from the issue text.
Description
I am struggling to figure out how can we deduce the formula used in getAmountIn. Basically here if we want to maximize our profit those two pools must have almost the same price at final stage. Hence we have:
(x1 + delta_x1) / (y1 - delta_y1) = (x2 - delta_x2) / (y2 + delta_y1)
Also we know how the pair pool is updating accordingly after swap:
(x1 + 0.997 * delta_x1) (y1 - delta_y1) = x1y1
(x2 - delta_x2)(y2 + 0.997 * delta_y1) = x2y2
Based on equations mentioned above, i just have no clue how can i simplify it to the formula in the code. Do i miss anything here ?
- Dominant language
- Solidity
- Stars
- 385
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flashbots/simple-blind-arbitrage
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
flashbots/simple-blind-arbitrage#15 · 2 comments ·
-
uniswapv3Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
flashbots/simple-blind-arbitrage#2 · 1 comment · 5 reactions ·
All issues in flashbots/simple-blind-arbitrage
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
blinklabs-io/dingo#5588 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
blinklabs-io/gouroboros#2816 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FilOzone/synapse-sdk#1039 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
btclib-org/btclib-node#2054 ·
Maintainers usually reply within 1 day
-
communities wallet
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day