Ir al contenido

Fungible Tokens

Esta página aún no está disponible en tu idioma.

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}

Note: The base token’s smart contract must be of infinite supply in order to mint tokens.

GET http://localhost:7292/tkapi/TKV2/TokenMint/{id}/{fromAddress}/{amount}

id: The token’s smart contract identifier.

fromAddress: The smart contract owner’s address.

amount: The amount of tokens to mint (decimals supported)

{
"Success": true,
"Message": "TX Success. SCUID: ..."
}

Note: all token action methods will return a similar response structure. If Success is false the Message param will include details.

GET http://localhost:7292/tkapi/TKV2/TransferToken/{id}/{fromAddress}/{toAddress}/{amount}

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)

GET http://localhost:7292/tkapi/TKV2/BurnToken/{id}/{fromAddress}/{amount}

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”
GET http://localhost:7292/tkapi/TKV2/PauseTokenContract/{id}/{fromAddress}

id: The token’s smart contract identifier.

fromAddress: The address of the token owner.

GET http://localhost:7292/tkapi/TKV2/ChangeTokenContractOwnership/{id}/{fromAddress}/{toAddress}

id: The token’s smart contract identifier.

fromAddress: The sender’s address

toAddress: The recipient’s address

POST http://localhost:7292/tkapi/TKV2/CreateTokenTopic
{
"TopicName": "",
"TopicDescription": "",
"SmartContractUID": "",
"MinimumVoteRequirement": "",
"FromAddress": "",
"VotingEndDays": "",
}
GET http://localhost:7292/tkapi/TKV2/CastTokenTopicVote/{id}/{fromAddress}/{topicUid}/{vote}

id: The token’s smart contract identifier.

fromAddress: The voter’s address

topicUid: The topic’s unique identifier

vote: 1 == YES; 0 == NO