Skip to content

How to unlock depositing after a 100% seize on the pool #234

@pdyraga

Description

@pdyraga

Consider the following scenario:

  • 1 T is deposited into the asset pool.
  • The risk manager seizes 1 T (100% of the pool).
  • There is 1 covT in existence and 0 T deposited in the asset pool.

When someone tries to deposit in this state, the transaction will revert because collateralBalance is 0:

/// @dev Calculates underwriter tokens to mint.
function _calculateTokensToMint(uint256 amountToDeposit)
internal
returns (uint256)
{
rewardsPool.withdraw();
uint256 covSupply = underwriterToken.totalSupply();
uint256 collateralBalance = collateralToken.balanceOf(address(this));
if (covSupply == 0) {
return amountToDeposit;
}
return (amountToDeposit * covSupply) / collateralBalance;
}

The pool can be unlocked by depositing some amount of T and I think this was the original intention when implementing this piece of code - it is hard to come up with _calculateTokensToMint value if there is nothing deposited but the covT supply is non-zero.

We should revisit this decision or at least make it clear in the docs what should be done after the 100% seize event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions