CCengine
Docs/Contracts
Contract / sale pricing

ControllerV1

The Controller quotes and executes the engine's Statement and Credit sales.

Price reads

priceOf(uint256 sid) → uint256view

Current Statement ask in wei.

referenceOf(uint256 sid) → uint256view

Reference used by the Statement sale curve.

creditPrice(uint256 id) → uint256view

Current sale price for a held Credit.

nextPage() → (bool ready, uint256[80] ids, uint8 format)view

Whether the Core can compose the next page.

Sale calls

buy(uint256 sid) payable

Buy a held Statement; the Controller settles through Core.sellTo.

May revert: NotForSale, Underpaid, NoQuote

buyCredit(uint256 id) payable

Buy one pile Credit while the sale is enabled.

May revert: CreditSaleOff, NotForSale, Underpaid

buyCredits(uint256[] ids) payable

Buy several eligible pile Credits in one payment.

May revert: CreditSaleOff, NotForSale, Underpaid

Events to index

Bought(sid, buyer, price)

Statement purchase; pair with Core.StatementSoldTo in the same transaction.

AnchorMoved(sid, saleBps, anchorBps)

A sale changed the curve anchor.

SaleSet(sale) / CreditSaleSet(credit)

Sale policy changes that affect later quotes.