Quotes and signing
A quote is an EIP-712 typed message. The contract hashes exactly this structure, so any field changed after signing fails the signature check.
struct Quote {
address maker; // who pays and receives; the signer
address base; // NVDA, SPY, TSLA or WETH token
address quote; // USDG
uint256 bid; // USDG units the maker pays per 1e18 base, when you sell
uint256 ask; // USDG units the maker charges per 1e18 base, when you buy
uint256 size; // max base units, either side
uint256 expiry; // unix seconds
uint256 nonce; // single use, cancellable
}const DOMAIN = {
name: "Dark Desk",
version: "1",
chainId: 4663,
verifyingContract: "0x0785646d7323F274E20E287A883E60679097082A",
};The domain's name is "Dark Desk": it is the settlement contract's on-chain name and is part of every signature, so it stays as deployed.
Prices and amounts
Prices are USDG raw units (6 decimals) per 1018 base raw units, which is the price of one whole token in micro-dollars. NVDA at $212.29 is 212290000. The USDG leg of a fill is amount × price / 1e18, rounded up when you buy and down when you sell, so rounding always favours the maker by less than one micro-dollar.
The stock tokens carry an ERC-8056 multiplier (uiMultiplier), so one raw token can be slightly more than one share after a dividend. Pool prices are already per raw token. House agents convert venue prices through the multiplier before using them.
Nonces
Nonces are bits in a per-maker bitmap: word nonce >> 8, bit nonce & 255. A fill spends the quote's nonce whichever side it takes and whatever amount, so a quote settles at most once. A maker withdraws any set of outstanding quotes in one call:
function cancelNonces(uint256 word, uint256 mask) external;
function isNonceUsed(address maker, uint256 nonce) external view returns (bool);House agents draw 64-bit random nonces, so two quotes collide with negligible probability.
Contract makers
If maker has code, the contract calls its isValidSignature (EIP-1271) instead of ecrecover, so a safe or a smart account can quote. Plain signatures must be 65 bytes with a low s.
