CCengine
current bid ETH / pt
Docs/Contracts
Contract / Phase2BalanceTreasury

Balance module

The selected treasury converts held Statements and makes working BALANCE available to the Core.

State reads

balanceToken() → addressview

BALANCE token held by this module.

selected() → boolview

Whether this module is selected by the active Core and has not migrated.

conversionReady() → boolview

Whether the module can convert a held Statement now.

transfersReady() → boolview

Whether ordinary BALANCE transfers are open.

available() → uint256view

Working BALANCE available for the Core's Credit purchases; zero unless selected, payments enabled, and transfers open.

working() → uint256view

Custody less the separate reserve and recorded unpaid transfers.

conversionToClaimBps() → uint16view

Share of each Statement conversion receipt reserved outside working funds, in basis points.

Core calls

redeem(uint256 statementId) → uint256Core only

Convert a Statement transferred by the Core, measure the BALANCE received, and keep it in the module.

May revert: ConversionOff, NotHeld, RedeemedBelowRating

pay(address to, uint256 amount)Core only

Pay from available working funds. Undelivered amounts are recorded as owed; the Core checks a seller's receipt.

May revert: InsufficientAvailable

Events

StatementConverted(statementId, received, allocated, contributionBps, claimReserve)

A held Statement was converted and its received BALANCE was accounted for.

PaymentAccrued(to, amount)

A Core payment was recorded as owed after an incomplete transfer.

SwitchesSet(conversionEnabled, workingPaymentsEnabled, ccRedemptionEnabled)

The module's movement switches changed.