usdcx-token
USDCx-Token Contract Summary
This contract implements USDCx, a SIP-010 fungible token on Stacks with a role-based access control system and pause functionality for protocol safety. It exposes the standard SIP-010 interface for transfers, supply queries, and metadata, while providing protocol-only functions for minting, burning, governance updates, and pausing.
Roles
The contract defines three privileged roles:
Governance (
governance-role) – manages protocol configuration, updates token metadata, and assigns roles.Mint (
mint-role) – authorized to mint, burn, and perform protocol-level transfers.Pause (
pause-role) – authorized to pause and unpause the protocol.
A protocol pause halts state-changing operations for safety. The contract deployer automatically receives the governance role. The companion contract .usdcx-v1 automatically receives the mint role.
Function-by-Function Breakdown
SIP-010 Standard Functions
transfer(amount, sender, recipient, memo)
transfer(amount, sender, recipient, memo)Transfers USDCx between principals, following SIP-010 rules. The function checks that the sender is either tx-sender or contract-caller (for contracts managing escrow or vaults) and then performs the transfer. An optional memo is logged on-chain.
get-name(), get-symbol(), get-decimals()
get-name(), get-symbol(), get-decimals()Standard SIP-010 metadata getters returning token name, symbol, and decimal precision.
get-balance(who), get-balance-available(who), get-balance-locked(who)
get-balance(who), get-balance-available(who), get-balance-locked(who)Returns the token balance for the given principal. In this implementation, all three accessor functions return the same SIP-010 balance value.
get-total-supply()
get-total-supply()Returns the total USDCx supply minted minus burned.
get-token-uri()
get-token-uri()Returns the token metadata URI.
Protocol Caller Validation
These functions enforce the contract’s role-based permissions.
is-protocol-caller(role, contract)
is-protocol-caller(role, contract)Checks whether the specified contract principal holds the required role.
validate-protocol-caller(role, contract)
validate-protocol-caller(role, contract)Ensures the caller has the correct role. If not, returns ERR_UNAUTHORIZED.
is-protocol-paused()
is-protocol-paused()Returns whether the protocol is currently paused.
validate-protocol-active()
validate-protocol-active()Asserts that the protocol is not paused, otherwise returns ERR_PAUSED.
Protocol-Only Token Operations
These functions enable minting/burning/transfers strictly for authorized protocol contracts.
protocol-transfer(amount, sender, recipient)
protocol-transfer(amount, sender, recipient)Performs a protocol-level transfer on behalf of another contract. Only callers with the mint role can use it. Fails if the protocol is paused.
protocol-mint(amount, recipient)
protocol-mint(amount, recipient)Mints new USDCx to a principal. Restricted to the mint role and disabled when paused.
protocol-burn(amount, owner)
protocol-burn(amount, owner)Burns tokens from a principal’s balance. Also restricted to the mint role and disabled when paused.
protocol-mint-many(recipients)
protocol-mint-many(recipients)Batch-mints tokens to multiple recipients in a single call. Each item includes { amount, recipient }. Only callable by entities with the mint role.
Governance Functions
Only the governance role may call these functions.
protocol-set-name(new-name)
protocol-set-name(new-name)Updates the token’s SIP-010 name.
protocol-set-symbol(new-symbol)
protocol-set-symbol(new-symbol)Updates the token’s SIP-010 ticker symbol.
protocol-set-token-uri(new-uri)
protocol-set-token-uri(new-uri)Updates the SIP-016 metadata URI.
set-active-protocol-caller(caller, role, enabled)
set-active-protocol-caller(caller, role, enabled)Adds or removes a principal from a specific protocol role. Used for rotating systems, updating companion contracts, or delegating new responsibility.
Pause Controls
These functions allow the protocol to halt operations for safety or maintenance.
pause()
pause()Pauses the contract, disabling minting, burning, and all protocol-only actions. Only callable by the pause role.
unpause()
unpause()Re-enables the protocol after a pause. Also restricted to the pause role.
Both functions emit an on-chain event for transparency.
Last updated
Was this helpful?
