-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- User now sets an arb target and max slippage - whenever user wants to swap, first it runs a buyback then swaps.
- Loading branch information
1 parent
47106f3
commit 013ac74
Showing
6 changed files
with
126 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Slippage: 5% | ||
Initial Arb Target: 500 | ||
Initial exchange rate: X | ||
|
||
|
||
Then the arb target is when we expect them to buy to get a discount. It determines the LP size. | ||
|
||
After a user purchases, we set the new arb target based on the current arb + previous. | ||
|
||
Does this drive arb target to zero? | ||
|
||
PRBMath.SD59x18 memory one = PRBMath.SD59x18(1 ether); | ||
|
||
desiredExchangeRate = (1-slippage)*exchangeRate | ||
|
||
want = arbTarget.div(desiredExchangeRate).div( | ||
arbTarget.mul(exchangeRate).div(arbTarget.mul(desiredExchangeRate)).sub(one) | ||
); | ||
|
||
ay = bx + ab | ||
|
||
b = (ay)/(x+a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.