CCengine
current bid ETH / pt
Docs/Contracts
Contract / custody + execution

Core

The Core holds ETH and Credits, owns the bid and pile, composes Statements, and manages the engine's settings.

Quotes and state

bidOf(uint256 id) → uint256view

Live ETH bid for a Credit ID, limited by available pot room.

bidForScore(uint256 score) → uint256view

Live ETH bid for a raw score.

ethRate() → uint256view

ETH rate for the reference score of 100 points.

RATE_START() → uint256view

Recorded opening ETH rate per 100 points; use ethRate() for the current rate.

spendState() → (uint64 bucket, uint128 budget, uint128 spent)view

Current ETH purchase bucket and spend.

pilePage(uint256 startAfter, uint256 n) → uint256[]view

Page through Credits held in the pile.

heldStatements() → uint256[]view

Statement IDs still held by the Core.

settings() → Settingsview

All current owner-controlled economic settings.

Credit doors

sellForEth(uint256[] ids, uint256 minOut)

Transfer approved Credits in and pay the caller in ETH.

May revert: ReturnLocked, SpendCapReached, PotTooSmall, Slippage

buyListing(address adapter, uint256 id, bytes params)

Buy one approved venue listing at or below the bid, subject to the ETH spend budget.

May revert: AdapterNotAllowed, AboveBid, SpendCapReached

swapCredit(uint256 inId, uint256 outId)

Swap an eligible pile Credit for a holder's Credit of equal or higher score, burning the CC fee.

Statement doors

compose() / compose(uint8 format)

Compose 80 eligible pile Credits into a Statement when the next page is ready.

composeChosen(uint256[80] ids, uint8 format)

Choose the 80 Credits when the choice switch and CC holding requirement permit it.

setHeldFormat(uint256 sid, uint8 format)

Change the format of a held Statement when the caller holds enough CC.

sellTo(uint256 sid, address buyer) payableController only

Controller-only settlement of a Statement sale.

Maintenance and authority

book() / collectEscrow() / buyback()Permissionless, guarded by readiness

Book fee income, collect escrow, and burn CC with the buyback allocation.

setSettings(Settings settings)Owner only

Replace the complete settings struct, effective immediately.

setRate(uint256 rate)Owner only

Re-anchor the mode-off ETH rate per 100 points within its bounds.

May revert: BadRate

migrate(uint256 amount)Owner only

Move the bid pot and pile to the configured successor and retire the Core.

Events to index

CreditBought(id, from, cost, toArtist)

A Credit entered the Core from a seller.

ListingBought(id, adapter, caller, cost, paid, rate, toArtist)

The Core swept an external listing.

Composed(sid, ids, format, cost, price, caller)

The pile became a Statement.

StatementSoldTo(sid, buyer, price, toBuyback, toArtist, toOperator)

The Core settled a Statement sale.

RateSet(rate)

The owner reset the ETH bid rate.

SettingsSet(settings)

Owner settings change that alters subsequent calls and quotes.