Fixed-Expiry Teller
The Fixed Expiry Teller is an implementation of the Base Teller contract specific to handling user bond transactions and tokenizing bond markets where all purchases vest at the same timestamp as ERC20 tokens. It implements the functions required by the Fixed-Expiry Teller Interface.
Specifically, it implements the _handlePayout
function to mint ERC20 tokens to the user to represent their bond position during a purchase.
Additionally, it implements the deploy
(deploys new ERC20 token contract if one does not exist for a combination of underlying token and the maturity date), create
(allows anyone to mint Bond Tokens for a combination of an underlying token and maturity date by paying a fee to the protocol), and redeem
(redeems ERC20 Bond Tokens that have vested for the underlying token).
By design, the tokenization of the Teller is not permissioned. This allows other participants to use the same ERC20 Bond Tokens that Bond Protocol is issuing to create a standard in the market and drive additional liquidity.
Methods
This section only includes methods not inherited from Base Teller.
bondTokenImplementation
function bondTokenImplementation() external view returns (contract ERC20BondToken)
ERC20BondToken reference implementation (deployed on creation to clone from)
Returns
reference
contract ERC20BondToken
reference address that each ERC20 bond token proxies to (using a Clone architecture)
bondTokens
function bondTokens(contract ERC20, uint48) external view returns (contract ERC20BondToken)
ERC20 bond tokens (unique to a underlying and expiry)
Parameters
underlying
contract ERC20
Address of the underlying ERC20 token
expiry
uint48
Expiry of the bond token
Returns
bondToken
contract ERC20BondToken
Address of the ERC20 bond token
create
function create(contract ERC20 underlying_, uint48 expiry_, uint256 amount_) external nonpayable returns (contract ERC20BondToken, uint256)
Deposit an ERC20 token and mint a future-dated ERC20 bond token
Parameters
underlying_
contract ERC20
ERC20 token redeemable when the bond token vests
expiry_
uint48
Timestamp at which the bond token can be redeemed for the underlying token
amount_
uint256
Amount of underlying tokens to deposit
Returns
bondToken
contract ERC20BondToken
Address of the ERC20 bond token received
amountOut
uint256
Amount of the ERC20 bond token received
deploy
function deploy(contract ERC20 underlying_, uint48 expiry_) external nonpayable returns (contract ERC20BondToken)
Deploy a new ERC20 bond token for an (underlying, expiry) pair and return its address
ERC20 used for fixed-expiryIf a bond token exists for the (underlying, expiry) pair, it returns that address
Parameters
underlying_
contract ERC20
ERC20 token redeemable when the bond token vests
expiry_
uint48
Timestamp at which the bond token can be redeemed for the underlying token
Returns
bondToken
contract ERC20BondToken
Address of the ERC20 bond token being created
getBondTokenForMarket
function getBondTokenForMarket(uint256 id_) external view returns (contract ERC20BondToken)
Get the OlympusERC20BondToken contract corresponding to a market
Parameters
id_
uint256
ID of the market
Returns
bondToken
contract ERC20BondToken
ERC20BondToken contract address
redeem
function redeem(contract ERC20BondToken token_, uint256 amount_) external nonpayable
Redeem a fixed-expiry bond token for the underlying token (bond token must have matured)
Parameters
token_
contract ERC20BondToken
Token to redeem
amount_
uint256
Amount to redeem
Events
ERC20BondTokenCreated
event ERC20BondTokenCreated(contract ERC20BondToken bondToken, contract ERC20 indexed underlying, uint48 indexed expiry)
Parameters
bondToken
contract ERC20BondToken
Address of the bond token
underlying indexed
contract ERC20
Address of the underlying ERC20 token
expiry indexed
uint48
Timestamp when the bond token can be redeemed for the underlying token