Sc 828 address omega review comments#680
Sc 828 address omega review comments#680FHieser merged 23 commits intofeature/ToposFundingManagerfrom
Conversation
The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection
| /// @dev Minimum collateral reserve | ||
| uint public constant MIN_RESERVE = 1 ether; | ||
| uint public MIN_RESERVE; |
There was a problem hiding this comment.
Curious if it's still considered a constant as it is being set during initialization? 🤔
There was a problem hiding this comment.
Yeah thought about that too
Its just in the technicality a constant, at that It wont change anymore after we set it
I think I would keep it as its technically immutable, because we cant modify it without changing the code
| // Set accepted token | ||
| _token = IERC20(_acceptedToken); | ||
|
|
||
| // MIN_RESERVE is in dependency to the decimals of the workflow token |
There was a problem hiding this comment.
| // MIN_RESERVE is in dependency to the decimals of the workflow token | |
| // MIN_RESERVE is relational to the decimals of the workflow/colalteral token |
|
|
||
| token().safeTransfer(to, amount); | ||
|
|
||
| if (MIN_RESERVE > token().balanceOf(address(this))) { |
There was a problem hiding this comment.
We could also add the check for MIN_RESERVE into the if statement above, i.e. if (amount > token().balanceOf(address(this)) - projectCollateralFeeCollected + MIN_RESERVE) revert...
There was a problem hiding this comment.
We decided to keep it here, as it creates more information in case of fail state
In case of the _Redeeming_Restricted_Repayer_Seizable_v1.sol we will adapt it though
| // Set accepted token | ||
| _token = IERC20(_acceptedToken); | ||
|
|
||
| // MIN_RESERVE is in dependency to the decimals of the workflow token |
There was a problem hiding this comment.
| // MIN_RESERVE is in dependency to the decimals of the workflow token | |
| // MIN_RESERVE is relational to the decimals of the workflow/colalteral token | |
| __Module_orchestrator.fundingManager().token().safeTransfer( | ||
| _to, _amount | ||
| ); | ||
| if (MIN_RESERVE > token().balanceOf(address(this))) { |
There was a problem hiding this comment.
See comment in FM_BC_BondingSurface_Redeeming_v1
There was a problem hiding this comment.
Now that I looked into it again I decided against implementing it here, as the _getRepayableAmount doesnt directly interact with the actual amount of tokens that are still in the contract.
I think the way I implemented it now makes more sense, so I would keep it that way
* [SC-213] Feat: Reserve Vault (#665) * Create Reservepool Contract * Rename and adapt * Create FM_EXT_ReservePool_v1.t.sol * Rename to TokenVault * Adapt to not send native token * Address comments * Add: - Internal function to modifier - Trailing underscore to parameters - Gherkin to test - Cleaned up tests * Update FM_EXT_TokenVault_v1.t.sol --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin <43185740+Zitzak@users.noreply.github.com> * Chore: Clean up TokenVault * Feat: Add FM_BC_BondingSurface_Redeemable_Repayer_Seizable_v1 (#666) * Create Reservepool Contract * Rename and adapt * Create FM_EXT_ReservePool_v1.t.sol * Topos FM * remove liquidity vault controller contracts * Rename to TokenVault * Adapt to not send native token * Rename to Token Vault * Address comments * Outcomment Burn tests for now * Create setTokenVault * Fix most Burn functions * AddSpentAllowance to ERC20Issuance * Add _spendAllowance to BondingCurveBase * Add _spendAllowance to BurnIssuanceFor * Fix Dependency Issue * Rename Redeemable to Redeeming * Create FM_BC_BondingSurface_Redeeming_v1.sol * WIP * Add: - Internal function to modifier - Trailing underscore to parameters - Gherkin to test - Cleaned up tests * restructure contracts * Add tag for testing file split * Setup seperate Tests * Update Base BondingSurface test * Rename Mock * Remove Tests that are included in the base contract * Remove parameters from BondingSurface Struct * Go over comments * Address comments * Address Comments * Adapt Naming of events * Adding Restricted to the name * Update comments * resolve comments in implementations * Fix: Finalize moving of error into funding manager base * Fix: Typos in ERC20Issuance * Chore: Start cleanup of FM_BC's * Fix: Resolve failing test Was mismatched with implementation, didn't cover the address(this) case. --------- Co-authored-by: FHieser <felix_hieser@web.de> Co-authored-by: Felix Hieser <47272854+FHieser@users.noreply.github.com> Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Sc 720 expand unit tests for topos related modules (#676) * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> * Sc 828 address omega review comments (#680) * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR * Revert if redeemamount reaches Min Reserve * Check for Min Reserve in TransferOrchestrator Token * Add MinReserveCheck to transferRepayment * Rename Modifier * Remove time casting * Enable BuyFee * Use function that can be overriden * Add gap * Make Min_Reserves variable based on Token Decimals * Use SpotPrice to get StaticPrice * adapt based on comments * Update FM_BC_BondingSurface_Redeeming_v1.t.sol --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> * Refactor Update the BondingSurface implementation to represent the code of conduct * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR * Revert if redeemamount reaches Min Reserve * Check for Min Reserve in TransferOrchestrator Token * Add MinReserveCheck to transferRepayment * Rename Modifier * Remove time casting * Enable BuyFee * Use function that can be overriden * Add gap * Make Min_Reserves variable based on Token Decimals * Use SpotPrice to get StaticPrice * adapt based on comments * Update FM_BC_BondingSurface_Redeeming_v1.t.sol * WIP push * Rename seizable * Make state internal * Rename Parameters and Return Values * Rename Contracts * Adapt to code of conduct * Adapting Interfaces to have Contract Overview Documentation * Adapt Sectioning * Adapt Mocks and Tests to parameter conventions * Remove Todos/notes * Adapt merge aftermath * Update BondingSurface.sol * Rename to prevent shadow * Adapt remapping * Address comments * Adapt init * Update inverter standard versioning * Delete FM_BC_BondingSurface_RedeemingV1_exposed.sol * Adapt Contract Naming Standards * Fix naming references * Fix test * Update naming reference * Adapt modifier to call internal function * Adapt naming of internal function * update modifier Naming * Adapt tests * Adapt naming internal functions * Adapt Parameters * Adapt naming of function state * Adapt sections * Update Interface Inheritance * Update versioning * Update natspec to be rule compliant * Fix naming * Delete ILiquidityVaultProviderWhitelist_v1.sol * Remove Liquidity Vault Controller Interface * Rename Modifier * Add solmate as lib * Revert "Add solmate as lib" This reverts commit 050b9d2. * Remove comment * Adapt natspec * Apply comment suggestions from code review Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Adapt internal function state * Add . to comments * Adapt spacing in natspec comments * Adapt spacing * Replace @dev with @notice * Adapt comment length * Adapt naming * Address Comments * Adapt Version * Reposition MIN_RESERVE * Adapt sectioning * Update more sectioning * Add title section and increment version --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Add before and afterSell functionalities * Add new contracts to scripts * Rename Files to contain .t * Add BondingSurface E2E * Use ModuleRole * Finish e2e tests * Add Documentation * Adapt the Deployment Parameters * Create Contract Template.md * 4/5 tests passing * Create BondingSurface.md * Fix missing tests * update comment about eror tolerance * refactor: resolve renaming mismatch in contracts * fix: resolve RPC issue on tests --------- Co-authored-by: Felix Hieser <47272854+FHieser@users.noreply.github.com> Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin <43185740+Zitzak@users.noreply.github.com> Co-authored-by: FHieser <felix_hieser@web.de> Co-authored-by: 0xNuggan <82726722+0xNuggan@users.noreply.github.com>
* [SC-213] Feat: Reserve Vault (#665) * Create Reservepool Contract * Rename and adapt * Create FM_EXT_ReservePool_v1.t.sol * Rename to TokenVault * Adapt to not send native token * Address comments * Add: - Internal function to modifier - Trailing underscore to parameters - Gherkin to test - Cleaned up tests * Update FM_EXT_TokenVault_v1.t.sol --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin <43185740+Zitzak@users.noreply.github.com> * Chore: Clean up TokenVault * Feat: Add FM_BC_BondingSurface_Redeemable_Repayer_Seizable_v1 (#666) * Create Reservepool Contract * Rename and adapt * Create FM_EXT_ReservePool_v1.t.sol * Topos FM * remove liquidity vault controller contracts * Rename to TokenVault * Adapt to not send native token * Rename to Token Vault * Address comments * Outcomment Burn tests for now * Create setTokenVault * Fix most Burn functions * AddSpentAllowance to ERC20Issuance * Add _spendAllowance to BondingCurveBase * Add _spendAllowance to BurnIssuanceFor * Fix Dependency Issue * Rename Redeemable to Redeeming * Create FM_BC_BondingSurface_Redeeming_v1.sol * WIP * Add: - Internal function to modifier - Trailing underscore to parameters - Gherkin to test - Cleaned up tests * restructure contracts * Add tag for testing file split * Setup seperate Tests * Update Base BondingSurface test * Rename Mock * Remove Tests that are included in the base contract * Remove parameters from BondingSurface Struct * Go over comments * Address comments * Address Comments * Adapt Naming of events * Adding Restricted to the name * Update comments * resolve comments in implementations * Fix: Finalize moving of error into funding manager base * Fix: Typos in ERC20Issuance * Chore: Start cleanup of FM_BC's * Fix: Resolve failing test Was mismatched with implementation, didn't cover the address(this) case. --------- Co-authored-by: FHieser <felix_hieser@web.de> Co-authored-by: Felix Hieser <47272854+FHieser@users.noreply.github.com> Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Sc 720 expand unit tests for topos related modules (#676) * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> * Sc 828 address omega review comments (#680) * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR * Revert if redeemamount reaches Min Reserve * Check for Min Reserve in TransferOrchestrator Token * Add MinReserveCheck to transferRepayment * Rename Modifier * Remove time casting * Enable BuyFee * Use function that can be overriden * Add gap * Make Min_Reserves variable based on Token Decimals * Use SpotPrice to get StaticPrice * adapt based on comments * Update FM_BC_BondingSurface_Redeeming_v1.t.sol --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> * Refactor Update the BondingSurface implementation to represent the code of conduct * Add empty BondingSurface test file * Remove tokenVault from init The tokenvault cant be set during init because is created simultaneously to the BondingCurve contract. It has to be added via Dependency Injection * Remove unnecessary overrides * Add and adapt tests * Adapt inheritance of functions * Update Comments * Update Tests * Update fmt * Add event to projectFeeCollected * Address comments of PR * Revert if redeemamount reaches Min Reserve * Check for Min Reserve in TransferOrchestrator Token * Add MinReserveCheck to transferRepayment * Rename Modifier * Remove time casting * Enable BuyFee * Use function that can be overriden * Add gap * Make Min_Reserves variable based on Token Decimals * Use SpotPrice to get StaticPrice * adapt based on comments * Update FM_BC_BondingSurface_Redeeming_v1.t.sol * WIP push * Rename seizable * Make state internal * Rename Parameters and Return Values * Rename Contracts * Adapt to code of conduct * Adapting Interfaces to have Contract Overview Documentation * Adapt Sectioning * Adapt Mocks and Tests to parameter conventions * Remove Todos/notes * Adapt merge aftermath * Update BondingSurface.sol * Rename to prevent shadow * Adapt remapping * Address comments * Adapt init * Update inverter standard versioning * Delete FM_BC_BondingSurface_RedeemingV1_exposed.sol * Adapt Contract Naming Standards * Fix naming references * Fix test * Update naming reference * Adapt modifier to call internal function * Adapt naming of internal function * update modifier Naming * Adapt tests * Adapt naming internal functions * Adapt Parameters * Adapt naming of function state * Adapt sections * Update Interface Inheritance * Update versioning * Update natspec to be rule compliant * Fix naming * Delete ILiquidityVaultProviderWhitelist_v1.sol * Remove Liquidity Vault Controller Interface * Rename Modifier * Add solmate as lib * Revert "Add solmate as lib" This reverts commit 050b9d2. * Remove comment * Adapt natspec * Apply comment suggestions from code review Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Adapt internal function state * Add . to comments * Adapt spacing in natspec comments * Adapt spacing * Replace @dev with @notice * Adapt comment length * Adapt naming * Address Comments * Adapt Version * Reposition MIN_RESERVE * Adapt sectioning * Update more sectioning * Add title section and increment version --------- Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin Kruse <marvinkruse@users.noreply.github.com> * Add before and afterSell functionalities * Add new contracts to scripts * Rename Files to contain .t * Add BondingSurface E2E * Use ModuleRole * Finish e2e tests * Add Documentation * Adapt the Deployment Parameters * Create Contract Template.md * 4/5 tests passing * Create BondingSurface.md * Fix missing tests * update comment about eror tolerance * refactor: resolve renaming mismatch in contracts * fix: resolve RPC issue on tests --------- Co-authored-by: Felix Hieser <47272854+FHieser@users.noreply.github.com> Co-authored-by: Zitzak <marvin88gr@gmail.com> Co-authored-by: Marvin <43185740+Zitzak@users.noreply.github.com> Co-authored-by: FHieser <felix_hieser@web.de> Co-authored-by: 0xNuggan <82726722+0xNuggan@users.noreply.github.com>
These comments are still unadressed here:
First @rororowyourboat