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

Feat/g dollar of latest develop #522

Merged
merged 21 commits into from
Oct 24, 2024
Merged

Conversation

philbow61
Copy link
Contributor

Description

A few sentences describing the overall effects and goals of the pull request's commits.
What is the current behavior, and what is the updated/expected behavior with this PR?

Other changes

Describe any minor or "drive-by" changes here.

Tested

An explanation of how the changes were tested or an explanation as to why they don't need to be.

Related issues

  • Fixes #[issue number here]

Backwards compatibility

Brief explanation of why these changes are/are not backwards compatible.

Documentation

The set of community facing docs that have been added/modified because of this change

philbow61 and others added 20 commits October 6, 2024 16:53
for better differentiation against the OZ version
### Description
Fixes mento-protocol/mento-general#562
Fixes mento-protocol/mento-general#560

- [x] Changed access controls for GoodDollarExchangeProvider according
to mento-protocol/mento-general#562
- [x] Changed access controls for GoodDollarExpansionController
according to mento-protocol/mento-general#560
- [x] Updated and expanded unit tests
- [x] Fixed prettier config warnings
- [x] Fixed all linter warnings
- [x] Fixed `Lint & Test` CI job (was missing the rpc URL env var)
### Description

Fixes #525

Mostly false positives where I added comments.

One change I did make was adding reentrancy guards to the `mint`
functions in the `GoodDollarExpansionController`.

Even though the slither warnings were only a "medium" around possibly
manipulating event data via re-entrancy, I thought it'd still be a good
idea to disallow reentrancy for all mint functions.
### Description

Fixes mento-protocol/mento-general#552

- [x] Made error messages across GoodDollar contracts more consistent
- [x] Made comments across GoodDollar comments more consistent
- [x] Introduced @inheritdoc to reduce comment duplication between
interfaces and implementations in 0.8 contracts
- [x] Changed `Broker.configureTradingLimit()` from ~~public~~ to
**external**
### 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 <[email protected]>
Co-authored-by: baroooo <[email protected]>
### Description

This PR adds additional tests to to the exchange provider and includes
fuzz testing

### Related issues

- Fixes mento-protocol/mento-general#454
-

---------

Co-authored-by: bowd <[email protected]>
Co-authored-by: philbow61 <[email protected]>
Co-authored-by: baroooo <[email protected]>
Co-authored-by: philbow61 <[email protected]>
### Description

- [x] Wrote fork tests for Good Dollar contracts
- [x] Wrote fork tests for BancorExchangeProvider (this one's debatable;
it's largely the same logic, but I wasn't sure if we might use this
contract in isolation in the future)
- [x] Deleted Good Dollar Integration test (this was already a fork test
in disguise and all of its logic has been merged into the new good
dollar fork tests)
- [x] Added two additional `require`s to
`BancorExchangeProvider.executeSwap()` to guard against potential
underflows
- [x] Moved `.solhint.test.json` into `./test/.solhint.json` so the VS
Code solidity extension can pick it up (rn it's using the main config
also for tests which results in lots of annoying red squiggles that are
non-issues)
- [x] Removed some Baklava remnants

### How to review

- [ ] Check out this branch: `git checkout chore/gooddollar-fork-tests`
- [ ] Run `yarn fork-test:celo-mainnet`, they should be green (alfajores
is broken due to L2 changes unrelated to this PR)
- [ ] Review the code and see if there's anything missing that you think
should be covered by the fork tests
@philbow61 philbow61 marked this pull request as ready for review October 23, 2024 14:46
@bowd bowd merged commit 8722c6d into develop Oct 24, 2024
5 checks passed
@bowd bowd deleted the feat/GDollar-of-latest-develop branch October 24, 2024 12:57
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 this pull request may close these issues.

4 participants