BondFactory

This factory contract issues new bond contracts.

Events

BondCreated

Emitted when a new bond is created.

address
newBond

string

name

string

symbol

address indexed

owner

uint256

maturity

address indexed

paymentToken

address indexed

collateralToken

uint256

collateralTokenAmount

uint256

convertibleTokenAmount

uint256

bonds

IssuerAllowListEnabled

Emitted when the restriction of bond creation to allow-listed accounts is toggled on or off.

RoleAdminChanged

bytes32 indexed

role

bytes32 indexed

previousAdminRole

bytes32 indexed

newAdminRole

RoleGranted

bytes32 indexed

role

address indexed

account

address indexed

sender

RoleRevoked

bytes32 indexed

role

address indexed

account

address indexed

sender

TokenAllowListEnabled

Emitted when the restriction of collateralToken and paymentToken to allow-listed tokens is toggled on or off.

Errors

CollateralTokenAmountLessThanConvertibleTokenAmount

  • There must be more collateralTokens than convertibleTokens.

InvalidDeposit

  • Fails if the collateralToken takes a fee.

InvalidMaturity

  • Maturity date is not valid.

TokensMustBeDifferent

  • The paymentToken and collateralToken must be different.

TooManyDecimals

  • Decimals with more than 18 digits are not supported.

ZeroBondsToMint

  • Bonds must be minted during initialization.

Methods

ALLOWED_TOKEN

The role given to allowed tokens.

Returns

DEFAULT_ADMIN_ROLE

Returns

ISSUER_ROLE

The role required to issue bonds.

Returns

createBond

Creates a new Bond. The calculated ratios are rounded down.

Parameters

string
name
Passed into the ERC20 token to define the name.

string

symbol

Passed into the ERC20 token to define the symbol.

uint256

maturity

The timestamp at which the Bond will mature.

address

paymentToken

The ERC20 token address the Bond is redeemable for.

address

collateralToken

The ERC20 token address the Bond is backed by.

uint256

collateralTokenAmount

The amount of collateral tokens per bond.

uint256

convertibleTokenAmount

The amount of convertible tokens per bond.

uint256

bonds

The amount of Bonds given to the owner during the one-time mint during the `Bond`'s `initialize`.

Returns

getRoleAdmin

Parameters

Returns

grantRole

Parameters

bytes32
role

address

account

hasRole

Parameters

bytes32
role

address

account

Returns

isBond

Returns whether or not the given address key is a bond created by this Bond factory.

Parameters

Returns

isIssuerAllowListEnabled

If enabled, issuance is restricted to those with ISSUER_ROLE.

Returns

isTokenAllowListEnabled

If enabled, tokens used as paymentToken and collateralToken are restricted to those with the ALLOWED_TOKEN role.

Returns

renounceRole

Parameters

bytes32
role

address

account

revokeRole

Parameters

bytes32
role

address

account

setIsIssuerAllowListEnabled

Sets the state of bond restriction to allow-listed accounts.

Parameters

setIsTokenAllowListEnabled

Sets the state of token restriction to the list of allowed tokens.

Parameters

supportsInterface

Parameters

Returns

tokenImplementation

Address where the bond implementation contract is stored.

Returns

Last updated