usdcx-v1

USDCx-v1 Contract Summary

The usdcx-v1 contract implements the USDC xReserve protocol for moving USDC between Stacks and external chains. It serves as the primary entry point for minting and burning USDCx based on Circle-issued deposit intents.

This contract handles:

  • Parsing and validating deposit intent payloads

  • Recovering and verifying Circle attestor signatures

  • Enforcing nonce-based replay protection

  • Minting USDCx through the usdcx token contract

  • Burning USDCx to initiate withdrawals

  • Managing Circle attestor keys

  • Handling Stacks-specific recipient conversions

  • Applying fee logic for sponsored mints

  • Managing minimum withdrawal thresholds

It works in tandem with the main usdcx token contract, which enforces protocol roles (mint, governance, etc.). All minting/burning occurs through protocol-mint and protocol-burn.

Minting USDCx

The entry point for minting USDCx is via the mint function. The caller provides a serialized deposit intent, along with a signature, both of which are received off-chain as part of the bridging process. The deposit intent is parsed according to the xReserve specificiation.

There are a few Stacks-specific elements:

  • The remote-token of the deposit intent MUST be the consensus-serialized bytes of the principal .usdcx (where the deployer address is network-dependent), with 0x left-padded.

  • The remote-domain for Stacks is always 10003.

  • Because Stacks only supports u128 integers, the deserialization functions throw an error if any 64-byte integers in the deposit intent are larger than u128::max. This is allowed according to the xReserve spec.

Verifying attestations

The .usdcx-v1 contract keeps a circle-attestors map to keep track of public keys of valid attestors. When a deposit intent is provided, it must be signed by a public key in this map.

Burning USDCx

To withdrawal USDCx to another chain, users call burn. The specified amount of USDCx is burned from their Stacks account. A print event is emitted, which is used for triggering a burn attestation off-chain.

The .usdcx-v1 contract stores a minimum amount variable. Users must withdrawal at least this amount, or the burn fails. Accounts with the role 0x04 can update this variable.

Last updated

Was this helpful?