Skip to main content
Code examples for common stablecoin scenarios.
These examples assume you’ve completed the Quickstart setup steps (dependencies and environment variables).

Setup


Transfer with memo

Attach a 32-byte reference to a transfer for off-chain reconciliation — for example, an order ID or payment reference.
Memo values are permanently visible on the public blockchain. Do not include sensitive information such as customer names, account numbers, or PII. Use only non-sensitive references (such as a hashed or opaque order ID). If you need to attach sensitive data, encrypt it off-chain before encoding as bytes32 and decrypt it off-chain when reading the event.

Read a memo from a transaction


Approve and transferFrom

Delegate spending to a contract or address, then transfer on the owner’s behalf:

Gasless approvals (ERC-2612 Permit)

Allow a spender to be approved without the owner paying gas:

Gasless transfers (ERC-3009)

Allow a token holder to authorize a specific transfer without paying gas:

Restrict submission to the recipient (anti-front-running)

Use receiveWithAuthorization when you want only the intended recipient to be able to submit the transaction:

Cancel a signed authorization

If a token holder signs an ERC-3009 authorization and changes their mind before any relayer submits it, they can void the nonce by signing a CancelAuthorization message:

Listen for on-chain events

Real-time event subscriptions are essential for balance tracking, order reconciliation, and detecting safety-control state changes.

Subscribe to live events

Query historical events


Production Readiness

Best practices for production integrations

Troubleshooting

Common errors and solutions

Reference

Full function and program reference

Quickstart

Back to quickstart