Skip to content
All docs

Security

The claim, stated precisely

Desk code keeps pool credit inside the desk, the pool and Perpl, against a malicious trader, relayer or keeper. It assumes Perpl and AUSD behave as their published ABIs say. Admin actions by Perpl or Agora, a compromised trader device, and unaudited code risk are outside the guarantee. This code has not been audited.

Where money can go

AUSD leaves a desk only to: the Perpl account (margin), the pool (principal, fees, profit share), the protocol treasury (profit share), the trader (realized profit above the HWM net of fees, or the final residual), and a keeper (bounded bounty, once, on enforced settlement). There is no admin function on Desk and no arbitrary transfer anywhere.

The pool moves AUSD to: registered desks for themselves (fundDesk, pausable), and LPs (idle assets only). The operator cannot move desk or pool funds.

Roles

PartyCanCannot
Tradertrade inside policy, claim realized profit, close a flat deskwithdraw credit, exceed limits, trade other markets, claim unrealized PnL
Relayersubmit signed intents, pay gasalter, replay or invent orders (desk re-verifies signature, nonce, deadline)
Keepercall enforce/graduate/checkpointenforce a healthy below-fee-cap desk; take the bounty twice
Operatorpause new desks and graduations; lower caps now, raise caps after a 24 h timelock; add new immutable cohorts; set treasurymove funds; change a live desk's floor, limits or splits
Perpl adminsfreeze, force-close, deleverage, upgrade, toggle whitelist(outside Imprest's control)
Agorafreeze or pause AUSD(outside Imprest's control)

Defenses and their tests

AttackDefenseTest (contracts/test)
Off-market close into an accomplice's bid50 bps price band on every order, closes includedsecurity/Attacks.t.sol::test_attack_offMarketCloseIntoAccompliceBidRefused
Resting order fills later without a checkIOC/FOK only (no resting flag exists)unit/DeskPolicy.t.sol::test_orderType_*
Replay / held orderstrict nonce, deadline, per-desk EIP-712 domain, lastExecutionBlock stampAttacks.t.sol::test_relay_*
Signature malleability / substitutionOZ ECDSA (low-s), signer must be the desk tradertest_relay_malleableHighSRejected, test_relay_wrongSignerRejected, test_relay_signatureForAnotherDeskRejected
Leverage bypass (venue clamps instead of rejecting)desk leverage checktest_leverage_*, PerplProbe::test_probe_venueClampsLeverageAboveListing
Trading through the floorpost-fill equity re-check reverts the whole transactiontest_floor_postTradeBreachRevertsWholeTransaction
Stale marksnew risk refused; reduce-only allowed; enforce waitstest_staleMark_*
Exposure-cap bypass across deskspool records gross exposure per desk and perp, same transaction; pre-check before Perpltest_caps_*
Under-reported exposurepool requires oldGross to equal its own recordtest_unauth_deskCannotUnderReportExposure
Claim of paper profitflat-only claims of realized equity above HWMtest_claim_unrealizedProfitCannotBeWithdrawn
Double claim / double settlementHWM semantics; Closed is terminal; pool deskSettledtest_claim_hwmPreventsReclaimAfterLossAndRecovery, test_settledDeskIsInert
Keeper spam / repeated bountyDeskHealthy revert; bounty only at final settlementtest_enforce_healthyDeskRejected, test_enforce_breachSettlesWaterfallAndPaysKeeperOnce
Partial close settles earlysettlement only when flat; PartialClose pays nothingtest_enforce_partialCloseDoesNotSettleAndPaysNothing
Reentrancy via venue or tokennonReentrant on every desk entry pointsecurity/Reentrancy.t.sol (5 re-entry paths)
Unauthorized pool callsonlyDesk, factory-only registrationtest_unauth_*
Venue halted / revertingnamed errors bubble; enforce catches and recordstest_venue_*
Paired opposite desks (Sybil)no Sybil claim; measured capssecurity/PairedDesk.t.sol, DECISIONS D-009

Services

  • Keys come only from environment variables; .env is gitignored; logs never include keys

or signatures (relayer test never logs signatures).

  • The relayer and keeper simulate before sending and cap gas (Monad charges the limit).
  • The indexer and UI never authorize money movement; money screens confirm on a second RPC.

Reporting

This is hackathon software on testnet. Do not deposit real funds. Report issues privately to the maintainers before disclosure.