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

function batchRedeem(uint256[] tokenIds_, uint256[] amounts_) external nonpayable

Redeem multiple fixed-term bond tokens for the underlying tokens (bond tokens must have matured)

Parameters

NameTypeDescription

tokenIds_

uint256[]

Array of bond token ids

amounts_

uint256[]

Array of amounts of bond tokens to redeem

create

function create(contract ERC20 underlying_, uint48 expiry_, uint256 amount_) external nonpayable returns (uint256, uint256)

Deposit an ERC20 token and mint a future-dated ERC1155 bond token

Parameters

NameTypeDescription

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

NameTypeDescription

tokenId

uint256

ID of the ERC1155 bond token received

amountOut

uint256

Amount of the ERC1155 bond token received

createFeeDiscount

function createFeeDiscount() external view returns (uint48)

'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

NameTypeDescription

feeDiscount

uint48

undefined

deploy

function deploy(contract ERC20 underlying_, uint48 expiry_) external nonpayable returns (uint256)

"Deploy" a new ERC1155 bond token for an (underlying, expiry) pair and return its ID.

Parameters

NameTypeDescription

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

NameTypeDescription

tokenId

uint256

ID of the ERC1155 bond token being created

getTokenId

function getTokenId(contract ERC20 underlying_, uint48 expiry_) external pure returns (uint256)

Get token ID from token and expiry

Parameters

NameTypeDescription

underlying_

contract ERC20

Address of the underlying token

expiry_

uint48

Expiry of the bond

Returns

NameTypeDescription

tokenId

uint256

ID of the bond token

getTokenNameAndSymbol

function getTokenNameAndSymbol(uint256 tokenId_) external view returns (string, string)

Get the token name and symbol for a bond token

Parameters

NameTypeDescription

tokenId_

uint256

ID of the bond token

Returns

NameTypeDescription

name

string

Bond token name

symbol

string

Bond token symbol

redeem

function redeem(uint256 tokenId_, uint256 amount_) external nonpayable

Redeem a fixed-term bond token for the underlying token (bond token must have matured)

Parameters

NameTypeDescription

tokenId_

uint256

ID of the bond token to redeem

amount_

uint256

Amount of bond token to redeem

tokenMetadata

function tokenMetadata(uint256) external view returns (bool active, contract ERC20 payoutToken, uint48 expiry, uint256 supply)

Parameters

NameTypeDescription

tokenId_

uint256

ID of the bond token

Returns

NameTypeDescription

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

event ERC1155BondTokenCreated(uint256 tokenId, contract ERC20 indexed payoutToken, uint48 indexed expiry)

Parameters

NameTypeDescription

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