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

DRAFT - FM_PC_ExternalPriceSetter, Oracle, blacklist contracts and interfaces implemented #696

Merged

Conversation

vendrell46
Copy link

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.

Copy link
Collaborator

@Zitzak Zitzak left a 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.

Copy link
Collaborator

@Zitzak Zitzak left a 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

Copy link
Collaborator

@Zitzak Zitzak left a 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

Copy link
Contributor

@FHieser FHieser left a 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

Copy link
Collaborator

@Zitzak Zitzak left a 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

Copy link
Collaborator

@Zitzak Zitzak left a 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

@Zitzak
Copy link
Collaborator

Zitzak commented Dec 9, 2024

@vendrell46 additionally I noticed that there are several natspec comments in the FM which could be moved to the interface as well

Copy link
Member

@marvinkruse marvinkruse left a 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 in FM_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.

Comment on lines 4 to 5
// Imports

Copy link
Member

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

Suggested change
// Imports

Copy link
Author

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

Copy link
Collaborator

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 🙇‍♂️

Copy link
Author

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.
Copy link
Member

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.

Copy link
Author

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
Copy link
Member

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?

Copy link
Author

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
Copy link
Member

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?

Copy link

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?

Copy link
Author

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;
Copy link
Member

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:

Suggested change
mapping(address => bool) private _blacklist;
mapping(address account => bool isBlacklisted) private _blacklist;

Copy link
Author

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
Copy link
Member

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).

Copy link
Author

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
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not fixed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now

Comment on lines 605 to 607
/// @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
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 664 to 668
/// This function overrides the internal function set in {BondingCurveBase_v1}, and
/// it updates the `issuanceToken` state variable and caches the decimals as `_issuanceTokenDecimals`.
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 123 to 124
/// @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.
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

// 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
Copy link
Member

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.

Copy link
Author

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.
Copy link
Member

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 🙏

Copy link
Author

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dot removed

@Zitzak Zitzak requested a review from marvinkruse December 18, 2024 19:55
Copy link
Member

@marvinkruse marvinkruse left a 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.

Copy link
Collaborator

@Zitzak Zitzak left a 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

@Zitzak Zitzak merged commit d4ae1ec into InverterNetwork:feature/FM_PC_Oracle_Redeeming_v1 Dec 19, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants