-
Notifications
You must be signed in to change notification settings - Fork 19
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
DRAFT - FM_PC_ExternalPriceSetter, Oracle, blacklist contracts and interfaces implemented #696
DRAFT - FM_PC_ExternalPriceSetter, Oracle, blacklist contracts and interfaces implemented #696
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work. Overall looks great and right on track. I've left a comments which are mostly about style, formatting etc and some related to how the implementation might be done differently.
Running a bit out of time on my end to do a second pass but I think this will give you guys enough to keep developing.
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work guys!
I have reviewed everything again until the sell function in the FM. I will need to come back to finish the review tomorrow
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/interfaces/IERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/interfaces/IERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/LM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/LM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/LM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/LM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IOraclePrice_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/interfaces/IERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/interfaces/IERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/token/ERC20Issuance_blacklist_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IOraclePrice_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another review. Think we are almost there except for some work on the sell function. We should plan a quick sync around this maybe tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my comments up until this point have been addressed
src/modules/fundingManager/oracle/interfaces/ILM_ManualExternalPriceSetter_v1.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the solution you guys found to add the emit to the _sellOrder
function. However I think we need to adapt it just a bit, as well as the fee collection.
Also I believe the question around the decimals for price setting is still open.
Other than that it looks great, and only added a few small comments
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/interfaces/IFM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave the last few comments and will be requesting a review of @marvinkruse today
src/modules/fundingManager/oracle/interfaces/IOraclePrice_v1.sol
Outdated
Show resolved
Hide resolved
@vendrell46 additionally I noticed that there are several natspec comments in the FM which could be moved to the interface as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, leaving some comments as I pause my review for today before I continue tomorrow morning (CET time)! :) Really great work overall, really appreciate this! 👏 Definitely on the right track, just a few small things to iron out, mainly on the Inverter Standard side. It's not easy, even for us, to fully follow it yet, as it's quite a lot of rules and some of them are quite cryptic, so please don't see my comments or the amount of comments as a bad thing, I like your work! 🙏
Some general comments:
- We end each natspec comment with a dot, like
@notice Maximum number of addresses that can be blacklisted in a batch.
- Section delimiters should have a whitespace between the
//
and the---
part - We prefer to press tab after each NatSpec keyword. I left comments for this here and there, so you probably see what I mean?
- There are cases of
@inheritdoc
tags with just two//
in front instead of three///
, found these inFM_PC_ExternalPrice_Redeeming_v1.sol
specifically. - Some lines are >80 characters (also including whitespaces at the front, etc.), which need a few line breaks here and there, as we do not want to go above that limit of 80.
Thank you in advance 🙏 Let me know if you have any question or need clarifications or feedback on anything.
// Imports | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use any header to signal the "imports" section, so this can just be removed. Otherwise the imports look fine 👍`suggestion
// Imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we double-check with @Zitzak ? It was suggested by him
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can go with what @marvinkruse suggests, as he is up to date with the Inverter standard.
Apologies for letting you add it in @vendrell46 🙇♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed Imports header
* - Batch blacklisting operations | ||
* - Owner-controlled manager role assignment | ||
* - Blacklist manager controlled blacklist management | ||
* All blacklist operations can only be performed by the contract owner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is a bit confusing, i.e. the blacklist operations (like adding someone to the blacklist) can not be performed by the contract owner in the code, but by someone who has the backlist manager role. The management of the blacklist managers is on the contract owner, though.
This sentence in line 31 doesn't really capture this (i.e. says the opposite) and may need a bit of an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarified
* our Security Policy at security.inverter.network or | ||
* email us directly! | ||
* | ||
* @custom:version 1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is a space too much, after each @keyword
we just press tab once, which on my end adds 2 spaces, while this seems like it has 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, eagle eye. Fixed
* | ||
* @custom:version 1.0.0 | ||
* | ||
* @custom:standard-version 1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is a space too much, after each @keyword
we just press tab once, which on my end adds 1 space, while this seems like it has 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, so which format would we go with, the one you suggested in the previous comment or the current one?
Should we leave 1 or 2 spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, using the tabs adds just one space. Fixed
// Storage | ||
|
||
/// @notice Mapping of blacklisted addresses | ||
mapping(address => bool) private _blacklist; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we prefer for mappings is to directly name the involved parameters so it's easy to see what is being mapped, like so for example:
mapping(address => bool) private _blacklist; | |
mapping(address account => bool isBlacklisted) private _blacklist; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// Cache Collateral Token | ||
IERC20 collateralToken = __Module_orchestrator.fundingManager().token(); | ||
|
||
// Require that enough collateral token is held to be redeemable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is missing the part that this is just about the fee, not in general (as it's just checking for there to be enough for the fee).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
_projectFeeCollected(projectFeeAmount); | ||
} | ||
|
||
// Revert when the redeem amount is lower than minimum amount the user expects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is too long, needs a break at 80 characters max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has not been fixed yet I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now
/// @dev Internal function which only emits the event for amount of project fee collected. The contract | ||
/// does not hold collateral as the payout is managed through a redemption queue | ||
/// @param _projectFeeAmount The amount of fee collected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is too long, needs a break at 80 characters max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/// This function overrides the internal function set in {BondingCurveBase_v1}, and | ||
/// it updates the `issuanceToken` state variable and caches the decimals as `_issuanceTokenDecimals`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is too long, needs a break at 80 characters max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/// @dev The price_ parameter should be provided with the same number of decimals as the collateral token. | ||
/// For example, if the collateral token has 6 decimals and the price is 1.5, input should be 1500000. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is too long, needs a break at 80 characters max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/modules/fundingManager/oracle/FM_PC_ExternalPrice_Redeeming_v1.sol
Outdated
Show resolved
Hide resolved
// Burn issued token from user. | ||
_burn(_msgSender(), _depositAmount); | ||
|
||
// Process the protocol fee. We can re-mint some of the burned tokens, since we aren't paying out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding another comment as my last one got lost I believe:
The line is too long, needs a break at 80 characters max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @title Oracle Price Interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Natspec section needs to be copied from the contract now that that one was changed. also no dot at the end of a title 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there isn't a OraclePrice_v1
implementation, so what do you suggest, @marvinkruse?
This interface is extended in interface ILM_ManualExternalPriceSetter_v1 is IOraclePrice_v1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dot removed
fix: revert during deployment
fix issue with authorization
fix: interface check
remove function from FM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on getting the changes in, looks great 🙏 Just a simple line being too long, otherwise I couldn't spot anything obvious.
src/modules/fundingManager/oracle/interfaces/IOraclePrice_v1.sol
Outdated
Show resolved
Hide resolved
Co-authored-by: Marvin Kruse <[email protected]>
fix: Move LM_ManualPriceSetter into LM folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Longest PR I've ever seen :D Great work @vendrell46 @scab24
d4ae1ec
into
InverterNetwork:feature/FM_PC_Oracle_Redeeming_v1
The scope of this PR is to review the proposed implementation, considering that we DO NOT consider it complete, but rather a work in progress.
We want to ensure we are going in the right direction by getting feedback from the team.