lib-base.fees.redemptionrate

Home > @mosaic/lib-base > Fees > redemptionRate

Fees.redemptionRate() method

Calculate the current redemption rate.

Signature:

redemptionRate(redeemedFractionOfSupply?: Decimalish, when?: Date): Decimal;

Parameters

ParameterTypeDescription

redeemedFractionOfSupply

The amount of MoUSD being redeemed divided by the total supply.

when

Date

Optional timestamp that can be used to calculate what the redemption rate would decay to at a point of time in the future.

Returns:

Decimal

Remarks

By default, the fee is calculated at the time of the latest block. This can be overridden using the when parameter.

Unlike the borrowing rate, the redemption rate depends on the amount being redeemed. To be more precise, it depends on the fraction of the redeemed amount compared to the total MoUSD supply, which must be passed as a parameter.

To calculate the redemption fee in MoUSD, multiply the redeemed MoUSD amount with the redemption rate.

Example

const fees = await mosaic.getFees();
const total = await mosaic.getTotal();

const redeemedMoUSDAmount = Decimal.from(100);
const redeemedFractionOfSupply = redeemedMoUSDAmount.div(total.debt);
const redemptionRate = fees.redemptionRate(redeemedFractionOfSupply);
const redemptionFeeMoUSD = redemptionRate.mul(redeemedMoUSDAmount);

Last updated