Fungible Tokens
Deploying a Fungible Token Smart Contract
Section titled “Deploying a Fungible Token Smart Contract”Deploying a fungible token smart contract follows the same process as any smart contract. Please review this documentation.
Adding a feature type with the token details to the payload.
{ ... "Features": [ { "FeatureName": 13, "FeatureFeatures": { "TokenName": "My Token Name", "TokenTicker": "My Token Ticker", "TokenDecimalPlaces": 16, "TokenSupply": 1000, //0 for infinite supply "TokenBurnable": true, "TokenMintable": true, "TokenVoting": true, "TokenImageURL": "https://...", // optional "TokenImageBase": "base64ImageData..." }, } ]}After compiling, the token smart contract still needs to be minted, following the same approach as any smart contract.
GET http://localhost:7292/scapi/scv1/MintSmartContract/{SMART_CONTRACT_UID}Minting Tokens
Section titled “Minting Tokens”Note: The base token’s smart contract must be of infinite supply in order to mint tokens.
API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/TokenMint/{id}/{fromAddress}/{amount}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The smart contract owner’s address.
amount: The amount of tokens to mint (decimals supported)
Success Response
Section titled “Success Response”{ "Success": true, "Message": "TX Success. SCUID: ..."}Note: all token action methods will return a similar response structure. If
SuccessisfalsetheMessageparam will include details.
Transferring Tokens
Section titled “Transferring Tokens”API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/TransferToken/{id}/{fromAddress}/{toAddress}/{amount}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The sender’s address
toAddress: The recipient’s address
amount: The amount of tokens to transfer (decimals supported)
Burning Tokens
Section titled “Burning Tokens”API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/BurnToken/{id}/{fromAddress}/{amount}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The address of the token owner to burn from.
amount: The amount of tokens to burn (decimals supported)
Pausing (and Unpausing) Token Transactions
Section titled “Pausing (and Unpausing) Token Transactions”API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/PauseTokenContract/{id}/{fromAddress}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The address of the token owner.
Change Ownership
Section titled “Change Ownership”API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/ChangeTokenContractOwnership/{id}/{fromAddress}/{toAddress}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The sender’s address
toAddress: The recipient’s address
Create Voting Topic Ownership
Section titled “Create Voting Topic Ownership”API Endpoint
Section titled “API Endpoint”POST http://localhost:7292/tkapi/TKV2/CreateTokenTopicPOST Data Params:
Section titled “POST Data Params:” { "TopicName": "", "TopicDescription": "", "SmartContractUID": "", "MinimumVoteRequirement": "", "FromAddress": "", "VotingEndDays": "", }Cast Vote
Section titled “Cast Vote”API Endpoint
Section titled “API Endpoint”GET http://localhost:7292/tkapi/TKV2/CastTokenTopicVote/{id}/{fromAddress}/{topicUid}/{vote}URL Params:
Section titled “URL Params:”id: The token’s smart contract identifier.
fromAddress: The voter’s address
topicUid: The topic’s unique identifier
vote: 1 == YES; 0 == NO