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
Pausable Adder
Same as MpcAdder, but callback reverts while paused — useful for testing fault paths
Related token and portal contracts
For private token flows beyond primitives:
Private ERC20 (PoD)
ERC-7984 portal tokens
Privacy portal
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
PodLibwith a network preset (PodUserSepoliaor similar).Accept
itUint64inputs on a payable entrypoint.Pass
msg.valueandcallbackFeeLocalWeiintoadd64.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:
Submit an
addrequest while the contract is paused.Observe the outbound leg succeed on COTI, but the callback fail when the Inbox invokes
receiveC.Verify your client handles the failure — for example
PodRequestreportingresponse.execution,onDefaultMpcError/ErrorRemoteCallevents, or UI failed state (Async private operations).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
MpcAdder.sol+ private Adder tutorialMpcAdderPausable.solwhen you need to test callback failure (e.g. paused contract)PodAdder256.solif you need 256-bit lanesCustom logic tutorial when primitives are insufficient
Token/portal contracts when building private assets
See also
Last updated
Was this helpful?