An open source standard for assets on the Stacks network from Wrapped.com, written in Clarity
Wrapped Token on the Stacks Blockchain
Mainnet deployments
xBTC
SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-BitcoinxUSD
SP2TZK01NKDC89J6TA56SA47SDF7RTHYEQ79AAB9A.Wrapped-USDAbout
The token implements the SIP 10 standard and has been reviewed and audited by NCC Group.
The SIP-10 standard is the "Standard Trait Definition for Fungible Tokens" on the Stacks network. This trait exposes functions for token metadata:
- get-name
- get-symbol
- get-decimals
- get-token-uri
get-token-uri method mimics the functionality found on the ERC721 standard. The expectation is that a token owner can set this to reference an external URI that contains extra metadata about the token (such as logos, agreements, or other documentation)
In addition to metadata, it exposes functions for querying the current total supply of the token and the balance for a specific account:
- get-balance
- get-total-supply
- transfer
ft-trait.clar.
Token Restrictions
The following public functions are available similar to ERC1404:
- detect-transfer-restriction
- message-for-transfer-restriction
transfer function would fail with a u403 error code. 403 was chosen to mimic the HTTP 403 Forbidden status.
A wallet should check the detect-transfer-restriction function to determine why the transfer was restricted, and then can return a human readable message found by calling message-for-transfer-restriction to the user to take corrective actions.
This trait is defined in restricted-token-trait.clar.
Initialization
Each deployed token should have a different name, symbol, etc. The principal that deploys the contract can call an initialize function on the contract to set all initial values. This function can only be called once and will set the following:
- Token Name
- Token Symbol
- Decimals
- Initial Owner Principal
Role Based Access Control
The token has certain roles built into it to allow administrative actions. One or more principals can be granted each of the roles and a principal can be granted multiple roles. The following roles are available:
- Owner
- Minter
- Burner
- Revoker
- Blacklister
initialize call will be granted the Owner role. The Owner role is the only role that can add or remove other accounts from roles.
NOTE!!! If all owners are removed then no other role administration can be performed. Any time an owner removes themselves, great care must be taken to ensure another owner still exists. Also, this means that all admin functionality can be irrevocably disabled by removing all roles from all principals.
Administrative Capabilities
Minting
A principal with theMinter role can mint new tokens to any principal. The total supply of the token will be increased when new tokens are minted.
Burning
A principal with theBurner role can burn new tokens from any principal. The total supply of the token will be decreased when existing tokens are burned.
Revoking
A principal with theRevoker role can move tokens from any principal to another principal.
Blacklisting
A principal with theBlacklister role can add or remove any principal to a blacklist. Any transaction sending tokens to OR from a blacklisted account will be denied and the transaction will fail.
Dev
Install dependencies:yarn install
Testing
yarn test
Questions? Feedback?
Stop by our Telegram or send us an email.