-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add BancorExchangeProvider pricing tests (#532)
### Description This Pr adds tests for the pricing logic of the bancor exchange provider. During the testing, we realized that the BancorFormula.sol contract is missing one function we need. This function is getAmountIn for the tokenIn being the BancorToken. The new function is called `saleCost()` The math formula for this function is derived from the `saleTargetAmount()` function already implemented. It's important that the base of power operation is larger one otherwise the power function in that contract reverts. These are the current formulas used for the different pricing functions: ![image](https://github.com/user-attachments/assets/f1bfd968-1c5a-4ccf-b4eb-830010ed5979) This is how we derived the formula for `saleCost()` ![image](https://github.com/user-attachments/assets/5f2af737-7f54-477a-b6bc-9bc42eb5a4d5) ### Related issues - Fixes mento-protocol/mento-general#453 ### How to review - verify formula is derived correctly - exit contribution is applied correctly - tests cover everything --------- Co-authored-by: Ryan Noble <ryanjnoble@gmail.com> Co-authored-by: baroooo <baranseltekin@gmail.com>
- Loading branch information
1 parent
fcd3d02
commit 578747c
Showing
3 changed files
with
1,095 additions
and
76 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
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.