Contracts
Protocol

Contracts

Four contracts on Elysium. Their functions and events are listed here.

Addresses

Elysium, chain ID 99901. Collateral is USDC with 6 decimals. Prices are 1e8, basis points are 1e4.

ContractAddress
BoxEngineOpening on Elysium
BoxVaultOpening on Elysium
BoxOracleOpening on Elysium
FeeRouterOpening on Elysium
USDC0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65
$POPOpening on Elysium

Each address is listed here once it is published on Elysium.

BoxEngine

Markets, Box lifecycle, premium accrual (per second) and the permissionless trigger.

open(uint32 coin, uint256 size, uint32 bandBps, uint16 lev,
     uint32 trailBps, uint256 budget) → uint256 id
topUp(uint256 id, uint256 amount)
close(uint256 id)                       // trader only
poke(uint256[] ids)                     // anyone; keeper reward per action
quote(uint32 coin, uint256 size, uint32 bandBps)
     → (uint256 premiumPerHour, uint256 openFee)
getBox(uint256 id) → Box
getMarket(uint32 coin) → Market
marketCount() → uint256
listedCoins() → uint32[]
nextId() → uint256
utilE18() → uint256
Turbo
setTurboMarket(uint32 coin, bool on)       // owner
setTurboPaused(uint32 coin, bool paused)    // owner or keeper
isTurbo(uint32 coin) → (bool on, bool paused)
insuranceReserve() → uint256
requestClose(uint256 id)                    // trader; Turbo legs only
settleClose(uint256 id)                     // anyone; needs a price with hlTimeMs > the request's
pendingClose(uint256 id) → uint64 requestedHlTimeMs

open accepts lev above the Standard maximum only when isTurbo(coin) is on and not paused; trailBps must then be within the Turbo range and the oracle price fresher than the Turbo limit. close() on a Turbo leg reverts with UseRequestClose.

Private Boxes
setPrivateKeeperKey(bytes uncompressedPubKey65)   // owner
privateKeeperKey() → bytes
openPrivate(uint32 coin, uint256 size, uint16 lev, bytes32 commit,
            uint256 ratePerHour, uint256 budget, bytes ciphertext) → uint256 id
collapsePrivate(uint256 id, uint32 bandBps, uint32 trailBps, bytes32 salt)  // anyone with the preimage
revealPrivate(uint256 id, uint32 bandBps, uint32 trailBps, bytes32 salt)    // trader or keeper
voidPrivate(uint256 id, uint32 bandBps, uint32 trailBps, bytes32 salt)      // anyone, if the rate was under-declared

open pulls margin (size / lev), the budget and the open fee with USDC transferFrom. Approve the engine first.

Structs
Box    { trader, coin, phase, bandBps, lev, trailBps, size, margin,
         budget, entryE8, fillE8, bestE8, lastAccrual, openedAt,
         isPrivate, commit, lockedRate, sigmaAtOpenE6, utilAtOpenE18Scaled }
         phase: 0 none · 1 open · 2 long · 3 short · 4 closed
Market { listed, paused, maxLev, weightBps, oiOpen, oiLong, oiShort, name }

BoxVault

USDC ERC-4626 vault, shares “POP-LP”. Holds all margin and premium. Only BoxEngine can pay out.

deposit(uint256 assets, address receiver) → uint256 shares
requestWithdraw(uint256 shares)
claimWithdraw() → uint256 assets
pendingWithdraw(address) → (uint256 shares, uint64 readyAt)
totalAssets() → uint256
lockedMargin() → uint256

BoxOracle

Keeper-quorum price and σ store behind IPriceSource.

push(Px[] batch, uint64 deadline, bytes[] sigs)
price(uint32 coin) → (uint64 markE8, uint32 sigmaE6,
                      uint64 hlTimeMs, uint64 updatedAt)

FeeRouter

Splits fees and premium between the vault, the buyback reserve and the treasury.

buybackReserve() → uint256
treasuryAccrued() → uint256
totalToVault() → uint256
pullBuyback(address to) → uint256      // keeper only

Events

EventFields
BoxOpenedid, trader, coin, size, bandBps, lev, trailBps, entryE8, budget
BoxCollapsedid, side (1 long, 2 short), fillE8, ts
BoxClosedid, reason (0 user, 1 trail, 2 liq, 3 tp, 4 expire), exitE8, pnl, payout
BoxToppedUpid, amount
PriceBatchn, hlTimeMs
MarketListedcoin, name, maxLev
BoxOpenedPrivateid, trader, coin, size, lev, commit, ratePerHour, budget, ciphertext
BoxRevealedid, bandBps, trailBps
CloseRequestedid, hlTimeMs
InsurancePaidid, amount (Turbo bad debt covered by the reserve)