API

ForTube Bond API

fortube bond contract interface document

BondFactory

  • BondFactory

    • issue

function issue

issue a bond

function issue(
address[2] calldata tokens,
uint256 _minCollateralAmount,
uint256[8] calldata info,
bool[2] calldata _redeemPutback
) external payable returns (uint256)

Issue a new bond use specifical config information

Inputs

address[2]

tokens

The addresses of collateral and issue token

tokens[0]

The address of collateral token

tokens[1]

The address of issue token

uint256

_minCollateralAmount

The minimum collateral token amount

uint256[8]

info

bond config infomation

info[0]

total bond issuance

info[1]

_couponRate in one term

info[2]

maturity

info[3]

issueFee

info[4]

minIssueRatio

info[5]

the hash of financePurpose

info[6]

the hash of paymentSource

info[7]

timestamp when issue bond

bool[2]

_redeemPutback

the bond redeem and putback info

_redeemPutback[0]

whether the bond support redeem

_redeemPutback[1]

whether the bond support putback

Outputs

uint256

bondId

The new issued bond id

BondData

  • BondData

    • deposit

    • invest

    • txOutCrowd

    • repay

    • withdrawPawn

    • withdrawPrincipal

    • withdrawPrincipalAndInterest

    • vote

    • take

    • profit

    • withdrawSysProfit

    • liquidate

function deposit

deposit collateral into a bond

function deposit(uint256 amount) external nonReentrant payable

deposit amount of collateral token into a bond

Inputs

uint256

amount

The deposit collateral token amount

function invest

invest a bond

function invest(uint256 amount) external nonReentrant

invest a bond with amount of crowd token

Inputs

uint256

amount

The deposit collateral token amount

function txOutCrowd

withdraw the crowd token from bond

function txOutCrowd() external nonReentrant

bond issuer do this only once

function repay

bond issuer repay the debt

function repay() external nonReentrant

bond issuer do this only once

function withdrawPawn

bond issuer withdraw bond collateral token

function withdrawPawn() external nonReentrant

bond issuer do this only once

function withdrawPrincipal

bond invester withdraw bond crowd token when bond is not crowd success

function withdrawPrincipal() external nonReentrant

bond invester do this only once

function withdrawPrinciwithdrawPrincipalAndInterestpal

bond invester withdraw bond crowd token when bond is crowd success

function withdrawPrincipalAndInterest() external nonReentrant

bond invester do this only once

function vote

vote a bond

function vote(address proposal, uint256 amount) external nonReentrant

vote a proposal with amount of govenance token

Inputs

address

proposal

the bond proposal address

uint256

amount

vote amount

function take

take govenance token from a bond

function take() external nonReentrant

voter take his govenance token only once

Inputs

address

proposal

the bond proposal address

uint256

amount

vote amount

function profit

take voter's profit from a bond

function profit() external nonReentrant

voter take his profit only once

function withdrawSysProfit

platform manager withdraw system profit from a bond

function withdrawSysProfit() external nonReentrant auth

platform manager withdraw system profit only once

function liquidate

liquidate a bond

function liquidate(uint liquidateAmount) external nonReentrant

liquidate a bond with liquidateAmount of crowd token

Inputs

uint256

liquidateAmount

The liquidate crowd token amount

Vote

  • Vote

    • prcast

    • rating

function prcast

vote a bond as a professional voter

function prcast(uint256 id, address proposal, uint256 reason) external nonReentrant

vote a bond with its id, proposal and reason as a professional voter

Inputs

uint256

id

bond id

address

proposal

bond proposal address

uint256

reason

the hash of vote reason

PRA

  • PRA

    • lock

    • set

    • unlock

function lock

lock govenance token to become a professional voter

function lock() external nonReentrant

lock only once

function set

set vote to become a professional vote or not

function set(address who, bool enable) external auth

set who with enable

Inputs

address

who

voter

bool

enable

become a professional vote flag

function unlock

professional voter unlock his goverance token

function unlock() external nonReentrant

unlock only once