fortube bond contract interface document
BondFactory
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
deposit
invest
txOutCrowd
repay
withdrawPawn
withdrawPrincipal
withdrawPrincipalAndInterest
vote
take
profit
withdrawSysProfit
liquidate
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 |
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 |
withdraw the crowd token from bond
function txOutCrowd() external nonReentrant
bond issuer do this only once
bond issuer repay the debt
function repay() external nonReentrant
bond issuer do this only once
bond issuer withdraw bond collateral token
function withdrawPawn() external nonReentrant
bond issuer do this only once
bond invester withdraw bond crowd token when bond is not crowd success
function withdrawPrincipal() external nonReentrant
bond invester do this only once
bond invester withdraw bond crowd token when bond is crowd success
function withdrawPrincipalAndInterest() external nonReentrant
bond invester do this only once
vote a bond
function vote(address proposal, uint256 amount) external nonReentrant
vote a
proposal
withamount
of govenance token
Inputs
​ | ​ | ​ |
address | proposal | the bond proposal address |
uint256 | amount | vote amount |
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 |
take voter's profit from a bond
function profit() external nonReentrant
voter take his profit only once
platform manager withdraw system profit from a bond
function withdrawSysProfit() external nonReentrant auth
platform manager withdraw system profit only once
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
prcast
rating
vote a bond as a professional voter
function prcast(uint256 id, address proposal, uint256 reason) external nonReentrant
vote a bond with its
id
,proposal
andreason
as a professional voter
Inputs
​ | ​ | ​ |
uint256 | id | bond id |
address | proposal | bond proposal address |
uint256 | reason | the hash of vote reason |
PRA
lock
set
unlock
lock govenance token to become a professional voter
function lock() external nonReentrant
lock only once
set vote to become a professional vote or not
function set(address who, bool enable) external auth
set
who
withenable
Inputs
​ | ​ | ​ |
address | who | voter |
bool | enable | become a professional vote flag |
professional voter unlock his goverance token
function unlock() external nonReentrant
unlock only once
​