Skip to content

Latest commit

 

History

History
275 lines (183 loc) · 5.7 KB

FYToken.md

File metadata and controls

275 lines (183 loc) · 5.7 KB

FYToken

Point

event Point(bytes32 param, address value)

FlashFeeFactorSet

event FlashFeeFactorSet(uint256 fee)

SeriesMatured

event SeriesMatured(uint256 chiAtMaturity)

Redeemed

event Redeemed(address from, address to, uint256 amount, uint256 redeemed)

CHI_NOT_SET

uint256 CHI_NOT_SET

MAX_TIME_TO_MATURITY

uint256 MAX_TIME_TO_MATURITY

FLASH_LOAN_RETURN

bytes32 FLASH_LOAN_RETURN

FLASH_LOANS_DISABLED

uint256 FLASH_LOANS_DISABLED

flashFeeFactor

uint256 flashFeeFactor

oracle

contract IOracle oracle

join

contract IJoin join

Source of redemption funds.

underlying

address underlying

Asset that is returned on redemption.

underlyingId

bytes6 underlyingId

maturity

uint256 maturity

Unix time at which redemption of fyToken for underlying are possible

chiAtMaturity

uint256 chiAtMaturity

constructor

constructor(bytes6 underlyingId_, contract IOracle oracle_, contract IJoin join_, uint256 maturity_, string name, string symbol) public

afterMaturity

modifier afterMaturity()

beforeMaturity

modifier beforeMaturity()

point

function point(bytes32 param, address value) external

Point to a different Oracle or Join

setFlashFeeFactor

function setFlashFeeFactor(uint256 flashFeeFactor_) external

Set the flash loan fee factor

mature

function mature() external

Mature the fyToken by recording the chi. If called more than once, it will revert.

_mature

function _mature() private returns (uint256 _chiAtMaturity)

Mature the fyToken by recording the chi.

accrual

function accrual() external returns (uint256)

Retrieve the chi accrual since maturity, maturing if necessary.

_accrual

function _accrual() private returns (uint256 accrual_)

Retrieve the chi accrual since maturity, maturing if necessary. Note: Call only after checking we are past maturity

redeem

function redeem(address to, uint256 amount) external returns (uint256 redeemed)

Burn fyToken after maturity for an amount that increases according to chi If amount is 0, the contract will redeem instead the fyToken balance of this contract. Useful for batches.

mintWithUnderlying

function mintWithUnderlying(address to, uint256 amount) external

Mint fyToken providing an equal amount of underlying to the protocol

mint

function mint(address to, uint256 amount) external

Mint fyTokens.

burn

function burn(address from, uint256 amount) external

Burn fyTokens. The user needs to have either transferred the tokens to this contract, or have approved this contract to take them.

_burn

function _burn(address from, uint256 amount) internal returns (bool)

Burn fyTokens. Any tokens locked in this contract will be burned first and subtracted from the amount to burn from the user's wallet. This feature allows someone to transfer fyToken to this contract to enable a burn, potentially saving the cost of approve or permit.

maxFlashLoan

function maxFlashLoan(address token) external view returns (uint256)

From ERC-3156. The amount of currency available to be lended.

Name Type Description
token address The loan currency. It must be a FYDai contract.
Name Type Description
[0] uint256 The amount of token that can be borrowed.

flashFee

function flashFee(address token, uint256 amount) external view returns (uint256)

From ERC-3156. The fee to be charged for a given loan.

Name Type Description
token address The loan currency. It must be the asset.
amount uint256 The amount of tokens lent.
Name Type Description
[0] uint256 The amount of token to be charged for the loan, on top of the returned principal.

_flashFee

function _flashFee(uint256 amount) internal view returns (uint256)

The fee to be charged for a given loan.

Name Type Description
amount uint256 The amount of tokens lent.
Name Type Description
[0] uint256 The amount of token to be charged for the loan, on top of the returned principal.

flashLoan

function flashLoan(contract IERC3156FlashBorrower receiver, address token, uint256 amount, bytes data) external returns (bool)

From ERC-3156. Loan amount fyDai to receiver, which needs to return them plus fee to this contract within the same transaction. Note that if the initiator and the borrower are the same address, no approval is needed for this contract to take the principal + fee from the borrower. If the borrower transfers the principal + fee to this contract, they will be burnt here instead of pulled from the borrower.

Name Type Description
receiver contract IERC3156FlashBorrower The contract receiving the tokens, needs to implement the onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata) interface.
token address The loan currency. Must be a fyDai contract.
amount uint256 The amount of tokens lent.
data bytes A data parameter to be passed on to the receiver for any custom use.