Assessment reports>Circuit DAO>Design>The statues coin

The statues coin

The statutes coin is a standard singleton puzzle that is spent during nearly all Circuit actions. It is mainly responsible for 1) allowing governance to update protocol parameters and 2) announcing these parameters to be enforced by other puzzles.

The puzzle's mutable state primarily consists of

  • a list of statutes,

  • price data, and

  • fee and interest data.

Statutes are announced by index and value. For example, the protocol's price-delay parameter is communicated by an announcement of index 8, along with its value.

The protocol distinguishes between immutable statutes and statutes controlled by governance. Immutable statutes are announced with negative indexes baked into the contract, while governance statutes are indexed by their position in the statutes list.

In addition to the value of a statute, each entry in the statutes list additionally includes governance parameters for its next update. For instance, every statue has a proposal threshold that must be met before it can be changed. This data is set along with the value in governance proposals.

Operations

The statues coin can also be spent merely to announce the statute and price data. Additionally, it has mutation and update-price operations. The return value of these operations is formatted to include 1) the new state of the statues coin and 2) additional spend conditions.

Then, 1) is used to inform the CREATE_COIN condition that signals state changes to the parent singleton puzzle, and 2) is included in the spend conditions.

The mutation operation allows the spender to update the statutes list (or emit custom conditions) in the presence of approval by a governance coin. The update-price operation allows the spender to update the price according to the oracle's announcement. It also computes cumulative fees and interest.

Correctness and test coverage

The statutes coin needs to accurately announce protocol parameters and price data. It must only allow mutations when approved by governance and price updates from the oracle. Attempts to update statutes at out-of-bounds indexes should fail. And the statutes coin should correctly enforce its ordering rules that, among other things, prevent different values of the same statute from being used simultaneously.

Most of these properties are covered by the existing test suite. But we recommend better testing of how coins interact in the conditions they return.

Zellic © 2025Back to top ↑