Skip to content
Docs / Contracts

Build on Ordeo

Contract reference

Constructors, functions, events, errors and constants of every Ordeo contract, as written in contracts/src. None of them is deployed yet.


On this page

Common properties

  • Foundry project, solc 0.8.28, EVM paris, optimizer 200 runs, no via-IR. OpenZeppelin for ERC-20 helpers, reentrancy guards and mulDiv.
  • No owner, no admin, no proxy, no upgrade and no pause in any contract. All parameters are constructor arguments, set once.
  • Not deployed yet. Addresses appear on Deployments once set.

OrdeoShroud: functions

Constructor: (IOrdeoVerify verifier, IERC20 token, address feeSink, uint256 shieldFeeBps, uint256 transferFeeBps, uint256 unshieldFeeEth, uint256 unshieldFeeToken). Reverts BadParameter if the verifier or token has no code, the fee sink is zero, a rate is above 500 bps or a flat fee is above 2^120 - 1.

FunctionWhat it does
shield(uint8 asset, uint256 amount, uint256 ownerHash, bytes encryptedNote) payablePublic ETH or token in, one new note out. The pool computes the commitment from what it received.
transact(bytes proof, PublicArgs args, ExtData ext)Private send. ext.recipient must be zero; any exit value pays the relayer only, and only the relayer may send it.
unshield(bytes proof, PublicArgs args, ExtData ext)Notes out to ext.recipient. The flat fee and the relayer fee come out of the exit.
donate(uint256 amount)Adds tokens to the vault backing without new shares.
sweepEthFees()Sends accrued ETH fees to feeSink. Anyone may call.
state() view returns (uint256 leaves, uint256 lastRoot, uint256 shares, uint256 vaultBacking, uint256 pending, uint256 ethFeesAccrued)Everything the app shows, in one call.
isKnownRoot(uint256 root) view returns (bool)True when root is among the 100 most recent (never for 0).
getLastRoot() view returns (uint256)The current root.
spentMany(uint256[] nullifiers) view returns (bool[])Spent flags for many nullifiers.
nullifierSpent(uint256) view returns (bool)Spent flag for one nullifier.
valueOfShares(uint256 shares) view returns (uint256)Token value of shares now, rounded down, before any unshield fee.
previewShieldShares(uint256 amount) view returns (uint256)Shares a token shield of amount would receive now, after the fee.
extDataHash(ExtData ext) view returns (uint256)The hash the proof must bind.
zeros(uint256 i) pure returns (uint256)Empty-subtree hash at level i (0 to 24).
nextIndex(), currentRootIndex(), roots(uint256), filledSubtrees(uint256)Tree state.
totalShares(), backing(), pendingYield(), ethFees()Vault state.
verifier(), token(), feeSink(), shieldFeeBps(), transferFeeBps(), unshieldFeeEth(), unshieldFeeToken()Immutables.
struct PublicArgs {
  uint256 root;
  uint8 asset;              // 0 ETH, 1 token
  uint256[2] nullifiers;
  uint256[2] commitments;
  uint256 exitValue;        // note units leaving the pool: wei, or shares
  uint256 transferFee;      // note units paid as the private transfer fee
}

struct ExtData {
  address recipient;
  address relayer;
  uint256 relayerFee;       // wei for ETH, token units for the token
  bytes encryptedOutput0;
  bytes encryptedOutput1;
}

OrdeoShroud: events, errors and constants

EventWhen
NewCommitment(uint256 indexed commitment, uint256 indexed leafIndex, bytes encryptedNote)Every new leaf
NewNullifier(uint256 indexed nullifier)Every spent input, fillers included
Shielded(uint8 indexed asset, address indexed from, uint256 amount, uint256 fee, uint256 noteValue, uint256 leafIndex)A shield; from is the caller (the router for app buys)
PrivateTransfer(uint8 indexed asset, uint256 transferFee, address indexed relayer, uint256 relayerPaid)A private send
Unshielded(uint8 indexed asset, address indexed recipient, address indexed relayer, uint256 amountOut, uint256 relayerPaid, uint256 protocolFee)An unshield
YieldAdded(uint256 amount, uint256 totalShares, uint256 backing)A token fee or donation joins the vault
SharesBurned(uint256 shares, uint256 totalShares)Transfer fee shares burned on a token spend
EthFeeAccrued(uint256 amount)An ETH fee is set aside
Donated(address indexed from, uint256 amount)A donation
EthFeesSwept(address indexed to, uint256 amount)ETH fees sent to the fee sink
ErrorRaised when
BadParameterConstructor check fails, or zeros(i) with i above 24
BadAssetAsset is not 0 or 1
BadAmountZero amount, msg.value mismatch, zero note value, or an unshield with zero exit
NoteTooLargeAn encrypted note above 512 bytes
NotInFieldownerHash, a nullifier or a commitment not below the field order
ValueTooLargeA value above 2^120 - 1
FeeOnTransferTokenThe pool received a different amount than requested
ZeroSharesA token shield would mint zero shares
TreeFullAll 2^24 leaves are used
UnknownRootThe proof uses a root outside the last 100
NullifierSpentAn input is already spent
SameNullifierBoth inputs have the same nullifier
InvalidProofThe verifier rejects the proof or reverts
BadRecipientA private send names a recipient, or an unshield names none
BadRelayerA relayer fee or exit with no relayer address
ExitTooSmallThe exit does not cover the fees
EthTransferFailedAn ETH payment was refused
NothingToSweepsweepEthFees with no ETH fees
NotRelayerA spend that pays a relayer, sent by someone else
ConstantValue
FIELD_SIZEBN254 scalar field order
TREE_DEPTH24
ROOT_HISTORY100
MAX_VALUE2^120 - 1
VIRTUAL_SHARES1,000,000
MAX_NOTE_BYTES512
MAX_FEE_BPS500 (5%)
ASSET_ETH / ASSET_TOKEN0 / 1

OrdeoTradeDesk

Constructor: (IPonsFactory factory, IPoolManager poolManager, OrdeoShroud pool). Reverts BadParameter if any has no code. Reads token from the pool.

FunctionWhat it does
buy(uint256 ownerHash, uint256 minTokensOut, bytes encryptedNote) payable returns (uint256 tokensOut, uint256 leafIndex)Buys with msg.value on the live Pons venue and shields everything into one note. Refunds unused ETH.
buyAndDonate(uint256 minTokensOut) payable returns (uint256 tokensOut)Same buy, donated to the vault.
sell(bytes proof, PublicArgs args, ExtData ext) returns (uint256 ethOut)Lands a sale proof: unshield to the router, pay the submitter, sell, send ETH.
encodeSaleTerms(SaleTerms t) pure returns (bytes)SALE_MAGIC followed by abi.encode of the five terms.
decodeSaleTerms(bytes blob) pure returns (SaleTerms)Reverts BadSale unless 176 bytes, right magic, non-zero recipient and minimum.
unlockCallback(bytes data) returns (bytes)v4 swap step; callable only by the PoolManager.
receive()Accepts ETH only during a trade.
factory(), poolManager(), pool(), token(), SALE_MAGIC()Immutables and the magic prefix ("ORDEO-SALE-v1", bytes16).
struct SaleTerms {
  address ethRecipient;
  uint256 minEthOut;
  uint256 deadline;
  address submitter;      // zero: anyone may land the sale
  uint256 submitterFee;   // token units paid to the submitter
}
Event / errorMeaning
BoughtIntoNote(address indexed buyer, uint256 ethSpent, uint256 tokensOut, uint256 leafIndex)A buy into a note
BoughtForVault(address indexed buyer, uint256 ethSpent, uint256 tokensOut)A buy donated to the vault
SoldFromNotes(address indexed ethRecipient, address indexed submitter, uint256 tokensSold, uint256 ethOut, uint256 submitterFee)A private sale
ZeroAmount / NoMinimumOutNo ETH, or a zero minimum
TradingPausedThe curve is full and the pool is not open
Slippage(uint256 out, uint256 minimum)Output below the minimum
BadSale / SaleExpired / NotSubmitterMalformed sale, past deadline, wrong caller
NotPoolManager / UnexpectedEth / PaymentFailed / BadParameterCallback from elsewhere, stray ETH, refused ETH payment, bad constructor

OrdeoYieldSplit

Constructor: (address team, address holders, IPonsFactoryLite factory). Reads the Pons fee escrow from the factory. Constants BPS = 10000, TEAM_BPS = 5000.

FunctionWhat it does
receive()Accepts ETH and emits Received.
collect() returns (uint256 amount)Claims this contract's balance held in the Pons fee escrow. Returns 0 when there is none.
sweepPons(address token) returns (bool curveSwept, bool poolSwept)Asks Pons to move pending curve and pool fees into the escrow. Reverts NotCreatorRecipient unless the splitter is the launch's creator fee recipient.
split()Assigns all unassigned ETH: half to team, half to holders. Reverts NothingToSplit when there is none.
release()Pays both sides. A side that refuses ETH keeps its share owed.
distribute()collect, then split if anything is unassigned, then release.
unassigned() view returns (uint256)Balance minus what is owed.
owedTeam(), owedHolders(), totalToTeam(), totalToHolders()Owed now and lifetime totals.
team(), holders(), factory(), escrow()Immutables.

Events: Received(address indexed from, uint256 amount), Collected(uint256 amount), Split(uint256 toTeam, uint256 toHolders), Paid(address indexed to, uint256 amount). Errors: BadParameter, NothingToSplit, NotCreatorRecipient. All functions are open to any caller; none can change the addresses or the split.

OrdeoKeyLedger, OrdeoAttestor and the libraries

ContractInterface
OrdeoKeyLedgerregister(uint256 pk, bytes32 viewPub), keysOf(address) view returns (uint256 pk, bytes32 viewPub), isRegistered(address) view returns (bool), constant FIELD_SIZE. Event KeysRegistered(address indexed account, uint256 pk, bytes32 viewPub). Error BadKeys for a zero or out-of-field key or a zero viewing key. Only the caller’s own entry changes.
OrdeoAttestorverify(bytes proof, bytes32[] publicInputs) view returns (bool). Generated by Barretenberg from the circuit. Verification key constants: N = 65536, LOG_N = 16, NUMBER_OF_PUBLIC_INPUTS = 18, and VK_HASH.
OrdeoChallengeLog, OrdeoConstraintSumLinked libraries of the verifier.
OrdeoSponge2, OrdeoSponge3hash(uint256[2]) and hash(uint256[3]): circomlib-compatible Poseidon over BN254.