For the complete documentation index, see llms.txt. This page is also available as Markdown.

Reference: examples and contracts

Shipped reference contracts live in @coti-io/coti-contracts. They teach integration patterns — not production templates. For hardening guidance, see Contract patterns checklist.

Example matrix

Example
Path
What it demonstrates

MPC Adder

Minimal PodLib async request and ctUint64 callback storage

Pod Adder 128

128-bit lane primitive flow

Pod Adder 256

256-bit lane primitive flow

Pausable Adder

Same as MpcAdder, but callback reverts while paused — useful for testing fault paths

For private token flows beyond primitives:

Area
Starting point

Private ERC20 (PoD)

ERC-7984 portal tokens

Live demos: pod.coti.io (MpcAdder journey), millionaire.demo.coti.io (comparison game — source may differ from current repo layout).

MpcAdder.sol

Key ideas:

  • Extend PodLib with a network preset (PodUserSepolia or similar).

  • Accept itUint64 inputs on a payable entrypoint.

  • Pass msg.value and callbackFeeLocalWei into add64.

  • Decode callback payload as ctUint64.

Start here for the smallest working async private flow. Step-by-step guide: Tutorial: private Adder on Sepolia. Production hardening: Contract patterns checklist.

PodAdder128.sol / PodAdder256.sol

Same pattern as MpcAdder at wider bit widths. Use when your product needs itUint128 / itUint256 lanes and matching PodLib128 / PodLib256 helpers.

MpcAdderPausable.sol

Extends MpcAdder with OpenZeppelin Pausable. The success callback (receiveC) is gated with whenNotPaused, so private execution on COTI can still complete while the callback on your host chain reverts if the contract is paused.

Use this example to test fault scenarios end to end:

  1. Submit an add request while the contract is paused.

  2. Observe the outbound leg succeed on COTI, but the callback fail when the Inbox invokes receiveC.

  3. Verify your client handles the failure — for example PodRequest reporting response.execution, onDefaultMpcError / ErrorRemoteCall events, or UI failed state (Async private operations).

  4. Call unpause() and retry, or confirm stuck requests behave as your product expects.

This is primarily a testing and integration reference, not a production pause design. For operational controls in production, pair pause logic with explicit request status, error callbacks, and support runbooks (Contract patterns checklist).

Custom-logic patterns (not in examples/)

Stateful comparison games and custom COTI orchestration follow the split-contract model in:

Suggested study order

  1. MpcAdder.sol + private Adder tutorial

  2. MpcAdderPausable.sol when you need to test callback failure (e.g. paused contract)

  3. PodAdder256.sol if you need 256-bit lanes

  4. Custom logic tutorial when primitives are insufficient

  5. Token/portal contracts when building private assets

See also

Last updated

Was this helpful?