Guidelines
- Introduction
- Installation
- Quick Start
Guides
- Introductions
- Build local test node
- Smart Contract - ABI Files
- Smart Contract——JS Contract
- Deploy Contracts
- Test Contract
- Develop DApp Client
Smart Contracts
- Contract Introduction
- ABI File
- Database
- Account Authority
- Call In-contract
- Notification
System Contracts
- Resources
- Account
- Permission
Token Contracts
- Transfer
- Token
- Token Exchange
- Contract Sub-Wallet
Node Guide
- Node Introduction
- Add to nodes network
- Node Data Persistence
Access Guide
- FO 接入安全指南
Token
Issue Token
The excreate
api of token contract is used while issuing token. The method and parameters explanations is shown below:
1 | void token::excreate( |
There are two types of token you can issue on FIBOS,one is the traditional token, the other one is smart token. The difference between two types of token is that smart token can be exchanged via bancor protocol. If you are not familliar with bancor protocol. You can refer to bancor protocol whitepaper.
Issue normal token
1 | //Initialize FIBOS client |
Issue smart token
1 | //Initialize FIBOS client |
Note:when the value of a token connector weight(CW) is 0,it is a normal token. For smart token, it has to have the corresponding cw(between 0-1)and max_exchange. and calculate the reserve_supply and reserve_connector_balance according to the Bancor protocol.
Check issued token
1 | //Initialize FIBOS client |
additional normal token issuing
Tips : Only normal token supports additional issuing. Smart tokens do not.
1 | //Initialize FIBOS client |
Lock & Unlock Position
Open Position
The creator of a token needs to call the opening operation before opening smart token exchange. The specific API and operation are as follows:
1 | //Initialize FIBOS client |
Note:the open/close state here only effects the transferring in of smart token. Transferring out is not effected. If the smart token is now in a closed lock state, you can still exchange the smart token to reserve or the other opening state smart token, but the reserve can not exchange to this smart token.
Lock Position
While the project party issues smart tokens, the value of parameter reserve_supply entered and the locked position amount will change by the destroy and unlock operations. The project party can transfer a part of tokens to user A by lock transfer method exlocktrans). User A can also transfer the received locking token to user B or project party. While the project is well operated, project party or user can get pay back via unlocking the token.
exlocktrans
method and parameters:
1 | void token::exlocktrans( |
Note:The parameter expiration_to
in api is for lock period. The project party can set this parameter while transferring the locking token to users. The timestamp format is accurate to seconds. So that users can not unlock before the lock period ends. expiration
parameter represents to check the user locked token via the lock period.
Example
1 | //Initialize fibos client |
In the codes above. User nmslwsndhjyz
transferred 10000.0000 locking ADC tokens to fibostest123
.
Unlock
Project parties and users can unlock the token and convert to circulation token via unlock operation.
exunlock
method and parameters:
1 | void token::exunlock( |
Note:The unlock operation can only be proceed when current time is larger than locked period. Here is what you need to note: the value of the expiration
parameter is not current time, but the lock period set by lock position transfer.
Example
1 | //Initialize FIBOS client |
Dividend
In the token economic models of FIBOS, it provides a method of paying dividends to token holder of community for the token issuer. Issuer can paying dividends via enter some amount of reserves. The token holders in community can enjoy the dividends while they are exchanging their token.
exshare
method and parameters:
1 | //Initialize FIBOS client |
Destroy token
Tips : The token can only be destroyed if the circulation amount is 0, that means the token issuer needs to take back all the circulation amount of tokens in the market, after that the token can be destroyed.
If the token is no longer needed, call exdestroySync
method to destroy it:
1 | //Initialize FIBOS client |