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.
| Function | What it does |
|---|---|
shield(uint8 asset, uint256 amount, uint256 ownerHash, bytes encryptedNote) payable | Public 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
| Event | When |
|---|---|
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 |
| Error | Raised when |
|---|---|
BadParameter | Constructor check fails, or zeros(i) with i above 24 |
BadAsset | Asset is not 0 or 1 |
BadAmount | Zero amount, msg.value mismatch, zero note value, or an unshield with zero exit |
NoteTooLarge | An encrypted note above 512 bytes |
NotInField | ownerHash, a nullifier or a commitment not below the field order |
ValueTooLarge | A value above 2^120 - 1 |
FeeOnTransferToken | The pool received a different amount than requested |
ZeroShares | A token shield would mint zero shares |
TreeFull | All 2^24 leaves are used |
UnknownRoot | The proof uses a root outside the last 100 |
NullifierSpent | An input is already spent |
SameNullifier | Both inputs have the same nullifier |
InvalidProof | The verifier rejects the proof or reverts |
BadRecipient | A private send names a recipient, or an unshield names none |
BadRelayer | A relayer fee or exit with no relayer address |
ExitTooSmall | The exit does not cover the fees |
EthTransferFailed | An ETH payment was refused |
NothingToSweep | sweepEthFees with no ETH fees |
NotRelayer | A spend that pays a relayer, sent by someone else |
| Constant | Value |
|---|---|
FIELD_SIZE | BN254 scalar field order |
TREE_DEPTH | 24 |
ROOT_HISTORY | 100 |
MAX_VALUE | 2^120 - 1 |
VIRTUAL_SHARES | 1,000,000 |
MAX_NOTE_BYTES | 512 |
MAX_FEE_BPS | 500 (5%) |
ASSET_ETH / ASSET_TOKEN | 0 / 1 |
OrdeoTradeDesk
Constructor: (IPonsFactory factory, IPoolManager poolManager, OrdeoShroud pool). Reverts BadParameter if any has no code. Reads token from the pool.
| Function | What 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 / error | Meaning |
|---|---|
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 / NoMinimumOut | No ETH, or a zero minimum |
TradingPaused | The curve is full and the pool is not open |
Slippage(uint256 out, uint256 minimum) | Output below the minimum |
BadSale / SaleExpired / NotSubmitter | Malformed sale, past deadline, wrong caller |
NotPoolManager / UnexpectedEth / PaymentFailed / BadParameter | Callback 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.
| Function | What 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
| Contract | Interface |
|---|---|
| OrdeoKeyLedger | register(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. |
| OrdeoAttestor | verify(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, OrdeoConstraintSum | Linked libraries of the verifier. |
| OrdeoSponge2, OrdeoSponge3 | hash(uint256[2]) and hash(uint256[3]): circomlib-compatible Poseidon over BN254. |