Fixed-Term Teller
The Fixed Term Teller is an implementation of the Bond Base Teller contract specific to handling user bond transactions and tokenizing bond markets where purchases vest in a fixed amount of time (rounded to the day) as ERC1155 tokens.It implements the functions required by the Fixed-Term Teller Interface and the Base Teller Abstract Contract.
It also inherits the ERC1155 standard and is itself the contract which provides information on the Bond Tokens it issues.
Specifically, it implements the _handlePayout
function to mint ERC1155 tokens to the user to represent their bond position during a purchase.
Additionally, it implements the deploy
(i.e. stores the metadata for a new ERC1155 token if one does not exist for a combination of underlying token and the maturity date), create
(allows anyone to mint ERC1155 Bond Tokens for a combination of an underlying token and maturity date by paying a fee to the protocol), and redeem
(redeems ERC1155 Bond Tokens that have vested for the underlying token).
By design, the tokenization of the Teller is not permissioned. This allows other market participants to use the same Bond Tokens that Bond Protocol is issuing to create a standard in the market and drive additional liquidity (less likely for ERC1155, but it is an option).
Methods
This section only includes methods not inherited from Base Teller or ERC1155.
batchRedeem
Redeem multiple fixed-term bond tokens for the underlying tokens (bond tokens must have matured)
Parameters
tokenIds_
uint256[]
Array of bond token ids
amounts_
uint256[]
Array of amounts of bond tokens to redeem
create
Deposit an ERC20 token and mint a future-dated ERC1155 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
tokenId
uint256
ID of the ERC1155 bond token received
amountOut
uint256
Amount of the ERC1155 bond token received
createFeeDiscount
'Create' function fee discount. Amount standard fee is reduced by for partners who just want to use the 'create' function to issue bond tokens. Configurable by policy.
Returns
feeDiscount
uint48
undefined
deploy
"Deploy" a new ERC1155 bond token for an (underlying, expiry) pair and return its ID.
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
tokenId
uint256
ID of the ERC1155 bond token being created
getTokenId
Get token ID from token and expiry
Parameters
underlying_
contract ERC20
Address of the underlying token
expiry_
uint48
Expiry of the bond
Returns
tokenId
uint256
ID of the bond token
getTokenNameAndSymbol
Get the token name and symbol for a bond token
Parameters
tokenId_
uint256
ID of the bond token
Returns
name
string
Bond token name
symbol
string
Bond token symbol
redeem
Redeem a fixed-term bond token for the underlying token (bond token must have matured)
Parameters
tokenId_
uint256
ID of the bond token to redeem
amount_
uint256
Amount of bond token to redeem
tokenMetadata
Parameters
tokenId_
uint256
ID of the bond token
Returns
active
bool
Whether the bond token has been created
payoutToken
contract ERC20
Address of the underlying token
expiry
uint48
Timestamp when the bond token can be exchanged for the underlying token
supply
uint256
Total supply of the bond token
Events
ERC1155BondTokenCreated
Parameters
tokenId
uint256
ID of the ERC1155 bond token
payoutToken indexed
contract ERC20
Address of the underlying token
expiry indexed
uint48
Timestamp when the bond token can be redeemed for the underlying token