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

Refactors #152

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Refactors #152

wants to merge 3 commits into from

Conversation

crisgarner
Copy link
Member

@crisgarner crisgarner commented Feb 16, 2023

This change is Reviewable

Base automatically changed from develop to master February 17, 2023 07:07
@voith voith changed the base branch from master to develop February 17, 2023 07:08
Copy link
Member

@voith voith left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 21 files reviewed, 4 unresolved discussions (waiting on @crisgarner)


contracts/IVaultHandler.sol line 97 at r1 (raw file):

  /// @notice Minimum amount of Index Tokens an user can mint
  uint256 public minimumMint = 0;

If I were reading this variable for the first time, it wouldn't be obvious to me.
I would either name this as minAmount or minMintAmount.


contracts/IVaultHandler.sol line 152 at r1 (raw file):

  /// @notice An event emitted when the minimum required Token is updated
  event NewMinimumMint(address indexed _owner, uint256 _minimumMint);
event NewMinimumMintAmount(address indexed _owner, uint256 _minimumMintAmount);

contracts/IVaultHandler.sol line 220 at r1 (raw file):

   * @param _ethOracle address
   * @param _treasury address
   * @param _minimumMint uint256
* @param _minMintAmount uint256

contracts/IVaultHandler.sol line 573 at r1 (raw file):

   * @notice Allow users to burn Index tokens to liquidate vaults with vault collateral ratio under the minimum ratio, the liquidator receives the staked collateral of the liquidated vault at a premium
   * @param _vaultId to liquidate
   * @param _maxIndex max amount of Index the liquidator is willing to pay to liquidate vault
* @param _maxIndexTokens max amount of Index tokens the liquidator is willing to pay to liquidate vault

Copy link
Member

@voith voith left a comment

Choose a reason for hiding this comment

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

Overall looks good.
I just suggested some name suggestions.

uint256 req = requiredLiquidationTCAP(_vaultId);
uint256 tcapPrice = TCAPPrice();
uint256 req = requiredLiquidationIndex(_vaultId);
uint256 iPrice = indexPrice();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
uint256 iPrice = indexPrice();
uint256 idxPrice = indexPrice();

iPrice reads like inverse price to me.

public
view
virtual
returns (uint256 amount)
{
Vault memory vault = vaults[_vaultId];
uint256 tcapPrice = TCAPPrice();
uint256 iPrice = indexPrice();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
uint256 iPrice = indexPrice();
uint256 idxPrice = indexPrice();

iPrice reads like an inverse price to me.

* cdaf = Collateral Decimals adjustment Factor
* cp = Collateral Price
* r = Min Vault Ratio
* p = Liquidation Penalty
*/
function requiredLiquidationTCAP(uint256 _vaultId)
function requiredLiquidationIndex(uint256 _vaultId)
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this function to ?

Suggested change
function requiredLiquidationIndex(uint256 _vaultId)
function requiredLiquidationAmount(uint256 _vaultId)

@@ -749,44 +749,44 @@ abstract contract IVaultHandler is
virtual
returns (uint256 collateral)
{
uint256 tcapPrice = TCAPPrice();
uint256 iPrice = indexPrice();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
uint256 iPrice = indexPrice();
uint256 idxPrice = indexPrice();

/// @notice Minimum amount of TCAP an user can mint
uint256 public minimumTCAP = 0;
/// @notice Minimum amount of Index Tokens an user can mint
uint256 public minimumMint = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this variable?

Suggested change
uint256 public minimumMint = 0;
uint256 public minimumMinAmount = 0;

function setMinimumTCAP(uint256 _minimumTCAP) external virtual onlyOwner {
minimumTCAP = _minimumTCAP;
emit NewMinimumTCAP(msg.sender, _minimumTCAP);
function setMinimumMint(uint256 _minimumMint) external virtual onlyOwner {
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this?

Suggested change
function setMinimumMint(uint256 _minimumMint) external virtual onlyOwner {
function setMinimumMintAmount(uint256 _minimumMintAmount) external virtual onlyOwner {

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.

2 participants