RedemptionPool

Introduction

The RedemptionPool is an auxiliary contract to the FyToken. It can mint 1 fyToken in exchange for 1 underlying before maturation and burn 1 fyToken in exchange for 1 underlying after maturation. The RedemptionPool provides access to fyTokens to the market participants who want to obtain fyTokens without taking on debt.

Gas Costs

Gas usage is not deterministic due to requisite calls to third-party Erc20 tokens. We provide the table below for guidance only:
Action
Typical Gas Cost
Redeem FyTokens
<60K
Supply Underlying
<130K

Storage Properties

Fintroller

The unique Fintroller associated with this contract.
1
FintrollerInterface public fintroller;
Copied!

FyToken

The unique fyToken associated with this "RedemptionPool".
1
FyTokenInterface public fyToken;
Copied!

Total Underlying Supply

The amount of the underlying asset available to be redeemed after maturation.
1
uint256 public totalUnderlyingSupply;
Copied!

Non-Constant Functions

Redeem FyTokens

Pays the token holder the face value at maturation time. Emits a "RedeemFyTokens" event.
1
function redeemFyTokens(uint256 fyTokenAmount) external returns (bool)
Copied!
  • fyTokenAmount: The amount of fyTokens to redeem for the underlying asset.
  • RETURN: true = success, otherwise it reverts.
Requirements
  • Must be called after maturation.
  • The amount to redeem cannot be zero.
  • The "Fintroller" must allow this action to be performed.
  • There must be enough liquidity in the "RedemptionPool".

Solidity

1
‌RedemptionPool redemptionPool = RedemptionPool(0xabcd...);
2
uint256 fyTokenAmount = 10000000000000000000;
3
bool success = redemptionPool.redeemFyTokens(fyTokenAmount);
4
require(success, "something went wrong");
Copied!

Ethers.js

1
const redemptionPool = new ethers.Contract(0xabcd..., redemptionPoolABI, signer);
2
const fyTokenAmount = "10000000000000000000";
3
const redeemFyTokensTx = await redemptionPool.redeemFyTokens(fyTokenAmount);
4
await redeemFyTokensTx.wait();
Copied!

Supply Underlying

An alternative to the usual minting method that does not involve taking on debt.
1
function supplyUnderlying(uint256 underlyingAmount) external returns (bool)
Copied!
  • underlyingAmount: The amount of underlying to supply to the Redemption Pool.
  • RETURN: true = success, otherwise it reverts.
Requirements
  • Must be called prior to maturation.
  • The amount to supply cannot be zero.
  • The "Fintroller" must allow this action to be performed.
  • The caller must have allowed this contract to spend "underlyingAmount" tokens.

Solidity

1
‌RedemptionPool redemptionPool = RedemptionPool(0xabcd...);
2
uint256 underlyingAmount = 10000000000000000000;
3
bool success = redemptionPool.supplyUnderlying(underlyingAmount);
4
require(success, "something went wrong");
Copied!

Ethers.js

1
const redemptionPool = new ethers.Contract(0xabcd..., redemptionPoolABI, signer);
2
const underlyingAmount = "10000000000000000000";
3
const supplyUnderlyingTx = await redemptionPool.supplyUnderlying(underlyingAmount);
4
await supplyUnderlyingTx.wait();
Copied!
Last modified 10mo ago