Assessment reports>Programmable Derivatives>Discussion>Inconsistencies between documentation and implementation

Inconsistencies between documentation and implementation

The collateral-level calculation of the redemption of bond tokens is inconsistent with the documentation. In the "Redemption of bondETH" section, the documentation states that the formula for the collateral level is TVL / (bondSupply x 100BOND_TARGET_PRICE). But the implementation includes depositAmount:

function getRedeemAmount(
    // [...]
  ) public pure returns(uint256) {
    // [...]

    uint256 tvl = (ethPrice * poolReserves).toBaseUnit(oracleDecimals);
    uint256 assetSupply = bondSupply;
    uint256 multiplier = POINT_EIGHT;

    // Calculate the collateral level based on the token type
    uint256 collateralLevel;
    if (tokenType == TokenType.BOND) {
      collateralLevel = ((tvl - (depositAmount * BOND_TARGET_PRICE)) * PRECISION) / ((bondSupply - depositAmount) * BOND_TARGET_PRICE);
    }
    // [...]
}

Additionally, the documentation mentions that the redeem price will be compared with the market price and the lower will be taken, but this is not reflected in the implementation.

Consider updating the documentation or implementation to ensure consistency.

Plaza Finance updated the documentation to align with the implementation.

Zellic © 2025Back to top ↑