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.
FintrollerInterface public fintroller;
FyToken
The unique fyToken associated with this "RedemptionPool".
FyTokenInterface public fyToken;
Total Underlying Supply
The amount of the underlying asset available to be redeemed after maturation.
uint256 public totalUnderlyingSupply;
Non-Constant Functions
Redeem FyTokens
Pays the token holder the face value at maturation time. Emits a "RedeemFyTokens" event.
function redeemFyTokens(uint256 fyTokenAmount) external returns (bool)
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
RedemptionPool redemptionPool = RedemptionPool(0xabcd...);
uint256 fyTokenAmount = 10000000000000000000;
bool success = redemptionPool.redeemFyTokens(fyTokenAmount);
require(success, "something went wrong");
Ethers.js
const redemptionPool = new ethers.Contract(0xabcd..., redemptionPoolABI, signer);
const fyTokenAmount = "10000000000000000000";
const redeemFyTokensTx = await redemptionPool.redeemFyTokens(fyTokenAmount);
await redeemFyTokensTx.wait();
Supply Underlying
An alternative to the usual minting method that does not involve taking on debt.
function supplyUnderlying(uint256 underlyingAmount) external returns (bool)
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
RedemptionPool redemptionPool = RedemptionPool(0xabcd...);
uint256 underlyingAmount = 10000000000000000000;
bool success = redemptionPool.supplyUnderlying(underlyingAmount);
require(success, "something went wrong");
Ethers.js
const redemptionPool = new ethers.Contract(0xabcd..., redemptionPoolABI, signer);
const underlyingAmount = "10000000000000000000";
const supplyUnderlyingTx = await redemptionPool.supplyUnderlying(underlyingAmount);
await supplyUnderlyingTx.wait();
Last updated
Was this helpful?