ERC5095.sol

This document describes the functions, attributes and modifiers in ERC5095.sol

ERC5095

Git Source

Inherits: ERC20Permit, IERC5095

State Variables

maturity

unix timestamp when the ERC5095 token can be redeemed

uint256 public immutable override maturity;

underlying

address of the ERC20 token that is returned on ERC5095 redemption

address public immutable override underlying;

lender

address of the minting authority

address public immutable lender;

marketplace

address of the "marketplace" YieldSpace AMM router

address public immutable marketplace;

pool

Interface to interact with the pool

address public pool;

redeemer

address and interface for an external custody contract (necessary for some project's backwards compatability)

address public immutable redeemer;

Functions

authorized

ensures that only a certain address can call the function

modifier authorized(address a);

Parameters

constructor

constructor(
    address _underlying,
    uint256 _maturity,
    address _redeemer,
    address _lender,
    address _marketplace,
    string memory name_,
    string memory symbol_,
    uint8 decimals_
) ERC20Permit(name_, symbol_, decimals_);

setPool

Allows the marketplace to set the pool

function setPool(address p) external authorized(marketplace) returns (bool);

Parameters

Returns

approveMarketPlace

Allows the marketplace to spend underlying, principal tokens held by the token

This is necessary when MarketPlace calls pool methods to swap tokens

function approveMarketPlace() external authorized(marketplace) returns (bool);

Returns

convertToUnderlying

Post or at maturity, converts an amount of principal tokens to an amount of underlying that would be returned.

function convertToUnderlying(uint256 s) external view override returns (uint256);

Parameters

Returns

convertToShares

Post or at maturity, converts a desired amount of underlying tokens returned to principal tokens needed.

function convertToShares(uint256 a) external view override returns (uint256);

Parameters

Returns

maxRedeem

Returns user's PT balance

function maxRedeem(address o) external view override returns (uint256);

Parameters

Returns

maxWithdraw

Post or at maturity, returns user's PT balance. Prior to maturity, returns a previewRedeem for owner's PT balance.

function maxWithdraw(address o) external view override returns (uint256);

Parameters

Returns

previewDeposit

After maturity, returns 0. Prior to maturity, returns the amount of shares when spending a in underlying on a YieldSpace AMM.

function previewDeposit(uint256 a) public view returns (uint256);

Parameters

Returns

previewMint

After maturity, returns 0. Prior to maturity, returns the amount of assets in underlying spent on a purchase of s in PT on a YieldSpace AMM.

function previewMint(uint256 s) public view returns (uint256);

Parameters

Returns

previewRedeem

Post or at maturity, simulates the effects of redemption. Prior to maturity, returns the amount of assets from a sale of s PTs on a YieldSpace AMM.

function previewRedeem(uint256 s) public view override returns (uint256);

Parameters

Returns

previewWithdraw

Post or at maturity, simulates the effects of withdrawal at the current block. Prior to maturity, simulates the amount of PTs necessary to receive a in underlying from the sale of PTs on a YieldSpace AMM.

function previewWithdraw(uint256 a) public view override returns (uint256);

Parameters

Returns

deposit

Before maturity spends a of underlying, and sends PTs to r. Post or at maturity, reverts.

function deposit(uint256 a, address r, uint256 m) external returns (uint256);

Parameters

Returns

deposit

Before maturity spends assets of underlying, and sends shares of PTs to receiver. Post or at maturity, reverts.

function deposit(uint256 a, address r) external override returns (uint256);

Parameters

Returns

mint

Before maturity mints s of PTs to r by spending underlying. Post or at maturity, reverts.

function mint(uint256 s, address r, uint256 m) external returns (uint256);

Parameters

Returns

mint

Before maturity mints shares of PTs to receiver by spending underlying. Post or at maturity, reverts.

function mint(uint256 s, address r) external override returns (uint256);

Parameters

Returns

withdraw

At or after maturity, burns PTs from owner and sends a underlying to r. Before maturity, sends a by selling shares of PT on a YieldSpace AMM.

function withdraw(uint256 a, address r, address o, uint256 m) external returns (uint256);

Parameters

Returns

withdraw

At or after maturity, burns PTs from owner and sends a underlying to r. Before maturity, sends a by selling shares of PT on a YieldSpace AMM.

function withdraw(uint256 a, address r, address o) external override returns (uint256);

Parameters

Returns

redeem

At or after maturity, burns exactly s of Principal Tokens from o and sends underlying tokens to r. Before maturity, sends underlying by selling s of PT on a YieldSpace AMM.

function redeem(uint256 s, address r, address o, uint256 m) external returns (uint256);

Parameters

Returns

redeem

At or after maturity, burns exactly shares of Principal Tokens from owner and sends assets of underlying tokens to receiver. Before maturity, sells s of PT on a YieldSpace AMM.

function redeem(uint256 s, address r, address o) external override returns (uint256);

Parameters

Returns

authBurn

function authBurn(address f, uint256 a) external authorized(redeemer) returns (bool);

Parameters

Returns

authMint

function authMint(address t, uint256 a) external authorized(lender) returns (bool);

Parameters

Returns

authApprove

function authApprove(address o, address s, uint256 a) external authorized(redeemer) returns (bool);

Parameters

_deposit

function _deposit(address r, uint256 a, uint256 m) internal returns (uint256);

_mint

function _mint(address r, uint256 s, uint256 m) internal returns (uint256);

_withdraw

function _withdraw(uint256 a, address r, address o, uint256 m) internal returns (uint256);

_redeem

function _redeem(uint256 s, address r, address o, uint256 m) internal returns (uint256);

Last updated