Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 2.51 KB

File metadata and controls

28 lines (17 loc) · 2.51 KB

Fungible token

Fungible tokens are digital assets that can be sent, received, combined, and divided.

This contract implements a basic fungible token that conforms to the SIP-010 FT standard. Be sure to change the placeholder name of the collection, as well as any other variables or references to your new project.

SIP-010 Standard Trait Definition for Fungible Tokens

In Stacks Improvement Proposal 010 (SIP-010), the Stacks community proposed and approved a standard set of functions that every fungible token contract is to implement to qualify as a compliant fungible token on the Stacks chain. This creates uniformity and predictability in contract interactions, as well as enables a handful of built-in Clarity functions accessible only to SIP-010 contracts (such as ft-transfer?, etc.).

Those functions are specified in the SIP and must be implemented in each contract. Trait conformance is then asserted with an impl-trait declaration at the top of the contract pointing to the relevant trait reference published on the Stacks mainnet.

You can see this sip-010-trait reference in the Hiro Stacks Explorer.

Test your contract

You can manually test your contract in the Clarinet console. After entering the console with clarinet console you can make contract function calls like (contract-call? .ft mint u100) (contract-call? .ft get-balance tx-sender)

You can programmatically test your contracts with unit tests. See the tests/ folder where you will find unit tests that ensures the mint function returns the proper response and that the read-only functions work as expected.

Resources and Inspiration