Token
CityCoin contract functions related to CityCoin tokens.
Last updated
Was this helpful?
CityCoin contract functions related to CityCoin tokens.
Last updated
Was this helpful?
The CityCoins token contract exists separate from the CityCoins core contract as part of the protocol, however there are some functions used by the core contract to interact with the token.
In addition to those functions, the token contract fully supports the on the Stacks blockchain, including functions for , , and more.
CityCoins also support the function, allowing up to 200 transfer operations to be performed in a single transaction.
CityCoins can only be minted by a core contract as part of the mining claim process.
CityCoins are not minted until miners claim them.
CityCoins can be burned by their owners following the same checks and balances as the transfer function.
Type: Public Function
Input: coreContract as principal
and stacksHeight as uint
Success: (ok true)
Errors:
ERR_UNAUTHORIZED u2000
ERR_TOKEN_ALREADY_ACTIVATED u2002
Note: this function is available both in the CityCoin core contract and the CityCoin token contract.
Type: Read-only Function
Input: none
Returns: (ok (coinbaseThresholds)) as a tuple
or error
Errors:
citycoin-core: ERR_CONTRACT_NOT_ACTIVATED u1005
citycoin-token: ERR_TOKEN_NOT_ACTIVATED u2001
coinbaseThreshold1
- bonus + first epoch
coinbaseThreshold2
- second epoch
coinbaseThreshold3
- third epoch
coinbaseThreshold4
- fourth epoch
coinbaseThreshold5
- fifth epoch
Type: Read-only Function
Input: minerBlockHeight as uint
Type: Public Function
Input: newUri as optional string-utf8 256
Success: (ok true)
Errors:
ERR_UNAUTHORIZED u2000
Type: Public Function
Input: recipients as list of tuples, up to 200, including:
to as principal
amount as uint
memo as optional buff 34
Success: (ok true)
Errors:
ERR_UNAUTHORIZED u2000
Sending to many recipients happens through calling the send-many
function in the token contract, which accepts a list up to 200 items in length.
Type: Public Function
Input: amount as uint
and owner as principal
Success: (ok true)
Errors:
ERR_UNAUTHORIZED u2000
Allows a user or contract to burn tokens with the same guards as token transfers.
Type: Public Function
Input: none
Success: (ok true)
Errors:
ERR_V1_BALANCE_NOT_FOUND u2003
This function checks the V1 CityCoin balance for the user, burns the V1 amount, and mints the equivalent V2 CityCoin amount.
Type: Public Function
Input: amount as uint
, from as principal
, to as principal
, memo as optional buff 34
Success: (ok true)
Errors:
ERR_UNAUTHORIZED u2000
Transferring CityCoins from one account to another happens through calling the transfer
function in the token contract, which accepts information about the transfer and an optional memo that is printed on-chain.
Type: Read-only Function
Input: none
Returns: (ok tokenName)
Returns the full name of a CityCoin.
Type: Read-only Function
Input: none
Returns: (ok tokenSymbol)
Returns the symbol of a CityCoin.
Type: Read-only Function
Input: none
Returns: (ok tokenDecimals)
Returns the number of decimals used for a CityCoin.
Type: Read-only Function
Input: user as principal
Returns: (ok balance)
Returns the balance for a given user's principal.
Type: Read-only Function
Input: none
Returns: (ok totalSupply)
Returns the total supply for a CityCoin.
Note: the total supply only increases when miners claim their mining reward.
Type: Read-only Function
Input: none
Returns: (ok tokenUri)
Returns the token URI for a CityCoin.
A one-time use function to activate the token halving as defined in the at a given Stacks block height. This function must be called by an active core contract, and once called, cannot be used again.
Returns the coinbase thresholds based on the Stacks block height the token was activated, based on the as a tuple.
Note: after each threshold is completed above, the perpetual block reward will remain at 3,125 CityCoins per block based on the sixth epoch in the .
Returns: mintedTokens as uint
based on the at the given block height
Updating the token URI () happens through calling the set-token-uri
function, which accepts a new URI as an optional parameter.
is the standard for fungible tokens on the Stacks blockchain, similar to ERC-20 on Ethereum. As part of the standard, all SIP-010 compliant tokens use the functions defined below.