Skip to content

DataTypes

Public structs shared by AVM control-plane, market, engine, and emitter interfaces.

Unit-typing convention. External market entry points use the branded aliases

RawTokenQuantity and ExchangeRate in place of bare uint256 whenever a

parameter’s unit is load-bearing — most importantly when two adjacent

arguments carry different units. RawTokenQuantity is an unscaled integer

count of a token’s smallest unit; it makes no assumption about decimal

precision. The engine boundary (IPricingCurve) uses Fixed18Value /

SignedFixed18Value for curve coordinates, token amounts, and ratios in

18-decimal fixed-point form; markets convert RawTokenQuantity to

Fixed18Value on the way in and back out. ExchangeRate is always an

unsigned Fixed18 ratio and is never a raw token quantity.

Token-denominated fields on the structs below are typed RawTokenQuantity:

raw integer counts in the relevant token’s native decimals, with no implicit

rescaling. Where two such fields refer to different tokens (for example AVM

collateral vs. reserve-token debt), the per-field NatSpec names the token.

Public inputs to IAvmFactory.createMarket — everything a group

admin supplies to create a market in one call. The factory lowers

this into the private MarketInitConfig (after deploying the token

set) before committing storage on the market.

struct DataTypes.CreateMarketParams

FieldType
kindMarketKind
Flavor of market being deployed.
marketIdMarketId
Stable market identifier used by off-chain systems.
groupIdGroupId
Parent market group identifier.
reserveTokenaddress
Reserve asset address for issuance, redemption, and debt.
engineInitDatabytes
Flavor-specific initialization payload for the engine.
flagsMarketFlags
Initial per-market operation flags.
dutchAuctionConfigDutchAuctionConfig
Optional launch pricing boost configuration.
avmTokenNamestring
ERC-20 name for the AVM token.
avmTokenSymbolstring
ERC-20 symbol for the AVM token.
optionTokenNamestring
ERC-20 name for the option token.
optionTokenSymbolstring
ERC-20 symbol for the option token.

Engine response for an exact-input reserve buy quote.

All amounts are 18-decimal fixed-point values at the engine boundary.

struct DataTypes.EngineBuyExactInQuote

FieldType
chargedReserveTokensInFixed18Value
Certified-HIGH curve cost of avmTokensOut; at or below the

offered reserve input. Markets may charge the full offered amount

and retain the residual as extra backing, but MUST use this value

for quoting/eventing accuracy. | | avmTokensOut | Fixed18Value
AVM tokens minted from the provided reserve input. | | nextEngineState | bytes
Engine state to commit if the market executes this quote.

Zero-length means “state unchanged” — skip the storage write. |

Engine response for an exact-output AVM buy quote.

All amounts are 18-decimal fixed-point values at the engine boundary.

struct DataTypes.EngineBuyExactOutQuote

FieldType
avmTokensOutFixed18Value
Requested AVM tokens to issue.
netCurveReserveCostFixed18Value
Certified-HIGH net reserve-token curve cost, before market-level

buy fees are grossed up. | | nextEngineState | bytes
Engine state to commit if the market executes this quote.

Zero-length means “state unchanged” — skip the storage write. |

Engine response for an exact-input AVM sell quote.

All amounts are 18-decimal fixed-point values at the engine boundary.

struct DataTypes.EngineSellExactInQuote

FieldType
avmTokensInFixed18Value
AVM tokens to burn from the seller.
grossReserveTokensOutFixed18Value
Certified-LOW gross reserve-token output before market-level fees.
nextEngineStatebytes
Engine state to commit if the market executes this quote.

Zero-length means “state unchanged” — skip the storage write. |

Engine response for an exact-output reserve sell quote.

All amounts are 18-decimal fixed-point values at the engine boundary.

struct DataTypes.EngineSellExactOutQuote

FieldType
reserveTokensOutFixed18Value
Requested reserve-token output before market-level fee handling.
avmTokensInFixed18Value
Certified-HIGH AVM tokens required to fund the reserve output.
nextEngineStatebytes
Engine state to commit if the market executes this quote.

Zero-length means “state unchanged” — skip the storage write. |

Fee-aware quote for a reserve-token cash advance (borrow).

A borrow never touches the pricing curve: grossDebtIncrease is the

caller’s exact new liability, the origination fee is carved out of it

(rounding UP, favoring the pool), and the borrower receives the net.

net + platform + group == grossDebtIncrease holds in atoms.

struct DataTypes.FeeAwareBorrowQuote

FieldType
grossDebtIncreaseRawTokenQuantity
Gross reserve-token debt the borrow opens (echoed exact input).
netBorrowReserveProceedsRawTokenQuantity
Net reserve tokens paid to the borrower after the origination fee.
feesFeeDistributionBreakdown
Reserve-token origination-fee distribution carved from the gross debt.

Fee-aware quote for buying exact AVM-token output.

struct DataTypes.FeeAwareBuyExactAvmOutQuote

FieldType
avmTokensOutRawTokenQuantity
AVM tokens minted to user.
netCurveReserveCostRawTokenQuantity
Net reserve-token cost the curve must receive.
grossReserveTokensInRawTokenQuantity
Gross reserve tokens pulled from user before buy fees are removed.
feesFeeDistributionBreakdown
Reserve-token fee distribution removed from grossReserveTokensIn.
nextEngineStatebytes
Engine state preview after applying this quote.

Fee-aware quote for buying with exact reserve-token input.

struct DataTypes.FeeAwareBuyExactReserveInQuote

FieldType
grossReserveTokensInRawTokenQuantity
Gross reserve tokens pulled from user before buy fees are removed.
avmTokensOutRawTokenQuantity
AVM tokens minted to user.
netCurveReserveTokensInRawTokenQuantity
Net reserve tokens delivered to the curve after buy fees are removed.
feesFeeDistributionBreakdown
Reserve-token fee distribution removed from gross input.
nextEngineStatebytes
Engine state preview after applying this quote.

Fee-aware quote for exercising call options struck at the floor.

Market-level arithmetic against the floor (strike) and the current

marginal price (premium); never changes engine state. The exerciser

pays grossReserveTokensIn = strike + fee; only the strike

(netFloorReserveTokensIn) enters market liquidity to back the

minted shares at the floor, and the fee — charged on the option

premium (current_price - floor), so zero at the floor — is

escrowed. optionTokensIn AVM tokens are minted 1:1.

struct DataTypes.FeeAwareExerciseOptionQuote

FieldType
optionTokensInRawTokenQuantity
Option tokens exercised (burned); AVM minted 1:1.
grossReserveTokensInRawTokenQuantity
Total reserve the exerciser pays (strike + fee), rounds up.
netFloorReserveTokensInRawTokenQuantity
Strike entering market liquidity at the floor (the fee-free net).
feesFeeDistributionBreakdown
Reserve-token fee distribution: the premium fee escrowed.

Fee-aware quote for redeeming exact AVM-token input at the floor.

Floor redemption is market-level arithmetic against the floor price

and the market’s supply offset; it never changes engine state.

struct DataTypes.FeeAwareRedeemAtFloorExactAvmInQuote

FieldType
avmTokensInRawTokenQuantity
AVM tokens burned from user.
grossReserveTokensOutRawTokenQuantity
Gross floor-price reserve output before fee deduction (rounds down).
netReserveTokensOutRawTokenQuantity
Net reserve output sent to user after normal sell fees.
feesFeeDistributionBreakdown
Reserve-token fee distribution from gross output.

Fee-aware quote for selling exact AVM-token input.

struct DataTypes.FeeAwareSellExactAvmInQuote

FieldType
avmTokensInRawTokenQuantity
AVM tokens burned from user.
grossReserveTokensOutRawTokenQuantity
Gross reserve output before fee deduction.
netReserveTokensOutRawTokenQuantity
Net reserve output sent to user after fees.
feesFeeDistributionBreakdown
Reserve-token fee distribution from gross output.
nextEngineStatebytes
Engine state preview after applying this quote.

Fee-aware quote for selling for exact reserve-token output target.

struct DataTypes.FeeAwareSellExactReserveOutQuote

FieldType
avmTokensInRawTokenQuantity
AVM tokens burned from user.
grossReserveTokensOutRawTokenQuantity
Gross reserve output before fee deduction.
netReserveTokensOutRawTokenQuantity
Exact net reserve output sent to user after fees.
feesFeeDistributionBreakdown
Reserve-token fee distribution from gross output.
nextEngineStatebytes
Engine state preview after applying this quote.

Fee distribution breakdown applied by the market after an operation is quoted.

All fields are raw integer counts in the same token’s native decimals

and always refer to reserve tokens.

struct DataTypes.FeeDistributionBreakdown

FieldType
platformReserveFeeRawTokenQuantity
Platform fee allocation.
marketGroupReserveFeeRawTokenQuantity
Market-group fee allocation.

Explicit 18-decimal unsigned fixed-point transport wrapper.

Use for typed math boundaries where values are 18-decimal fixed-point

scalars rather than raw token units.

struct DataTypes.Fixed18Value

FieldType
rawuint256

Which floor-raise transition a FloorRaiseParams payload requests.

Enum DataTypes.FloorRaiseKind.

  • ExcessLiquidity — Consume reserve surplus: the floor rises and the total-area

requirement is allowed to grow up to the market-verified backing.

  • PreserveArea — Reshape the schedule without new liquidity: the floor rises while

total area (under defensive rounding) does not increase.

Typed engine outcome of a floor raise, for events and quoters.

struct DataTypes.FloorRaiseOutcome

FieldType
previousFloorPriceFixed18Value
Floor price before the change, as an unsigned Fixed18 y-value ratio.
newFloorPriceFixed18Value
Floor price after the change, as an unsigned Fixed18 y-value ratio.
previousTotalAreaInReserveTokenFixed18Value
Certified-HIGH total area on [0, netSupply] before the raise.
totalAreaInReserveTokenFixed18Value
Certified-HIGH total area on [0, netSupply] after the raise.

Canonical abi.encode payload for IPricingCurve.raiseFloor’s

bytes params argument.

The interface keeps params opaque so engine families can extend the

encoding; this struct is the encoding used by the built-in market

admin surface and quoter.

struct DataTypes.FloorRaiseParams

FieldType
kindFloorRaiseKind
Which raise flavor is requested.
newFloorPriceFixed18Value
Target floor price; must strictly exceed the current floor.
newRampEndSupplyFixed18Value
Target ramp-end supply for PreserveArea; ignored (pass zero) for

ExcessLiquidity. |

Fee schedule applied to market operations within a group.

struct DataTypes.GroupFees

FieldType
buyMicroBps
Fee on AVM buys, charged on gross reserve-token input. Capped by

FeePolicy.MAX_GROUP_FEE_MICRO_BPS. | | sell | MicroBps
Fee on AVM sells, charged on gross reserve-token output. Capped by

FeePolicy.MAX_GROUP_FEE_MICRO_BPS. | | borrow | MicroBps
Fee when reserve debt is opened, charged on gross debt increase.

Capped by FeePolicy.MAX_GROUP_FEE_MICRO_BPS. | | exerciseOption | MicroBps
Fee when option tokens are exercised, charged on gross reserve in.

Capped by FeePolicy.MAX_GROUP_FEE_MICRO_BPS. |

function linearCurveMarketKind() returns (MarketKind) pure

Built-in market kind for the linear-characteristic AVM engine.

bytes32 internal constant MARKET_KIND_LINEAR_CURVE_RAW

Permission and fee namespace shared by a set of markets.

struct DataTypes.MarketGroup

FieldType
tenantIdTenantId
Parent tenant namespace.
adminaddress
Current group admin.
proposedAdminaddress
Pending group admin for two-step admin transfer.
feesGroupFees
Fees inherited by markets in this group.

Post-action market runtime state suitable for logs, indexers, and UI snapshots.

This is intentionally the market’s “DNA” at the moment an event is emitted:

mutable policy, routing pointers, token supplies, accounting balances,

actual custody balances, curve state, and the full opaque engine state

that produced the derived prices/area.

struct DataTypes.MarketStateSnapshot

FieldType
marketKindMarketKind
Market kind resolved through the directory to choose engine.
groupIdGroupId
Parent market group whose policy is active for this market.
tenantIdTenantId
Parent tenant whose platform fee is active for this market.
flagsMarketFlags
Per-market operation flags active when the action completed.
tenantAdminaddress
Current tenant admin when the action completed.
proposedTenantAdminaddress
Pending tenant admin when the action completed.
platformFeeMicroBps
Tenant platform fee active when the action completed.
groupAdminaddress
Current market-group admin when the action completed.
proposedGroupAdminaddress
Pending market-group admin when the action completed.
groupFeesGroupFees
Market-group fee schedule active when the action completed.
directoryaddress
Directory that controlled runtime pointers when the action completed.
eventEmitteraddress
Event emitter proxy active when the action completed.
marketBeaconaddress
Shared market beacon address active when the action completed.
marketImplementationaddress
Implementation address behind marketBeacon when the action completed.
marketActionsImpladdress
Market-actions implementation pointer used for delegated permissionless actions.
marketLeverageActionsImpladdress
Market-leverage-actions implementation pointer used for delegated leverage actions.
engineaddress
Pricing engine proxy resolved for marketKind when the action completed.
avmPriceInReserveTokenExchangeRate
Current marginal AVM price in reserve tokens, as an 18-decimal exchange rate.
floorPriceInReserveTokenExchangeRate
Current floor price in reserve tokens, as an 18-decimal exchange rate.
avmTokenSupplyRawTokenQuantity
Total issued AVM supply (raw AVM-token count).
optionTokenSupplyRawTokenQuantity
Total issued option-token supply (raw option-token count).
totalDebtInReserveTokenRawTokenQuantity
Total open reserve-token debt (raw reserve-token count).
totalCollateralInAvmTokenRawTokenQuantity
Total AVM collateral deposited (raw AVM-token count).
reserveTokenBalanceRawTokenQuantity
Market-owned reserve-token liquidity balance, using the market’s

internal reserve accounting rather than raw ERC-20 balance

(raw reserve-token count). | | groupRevenueEscrowInReserveToken | RawTokenQuantity
Group revenue escrow balance (raw reserve-token count). | | platformRevenueEscrowInReserveToken | RawTokenQuantity
Platform revenue escrow balance (raw reserve-token count). | | actualReserveTokenBalance | RawTokenQuantity
Actual reserve-token ERC-20 balance held by the market address. | | actualAvmTokenBalance | RawTokenQuantity
Actual AVM-token ERC-20 balance held by the market address. | | actualOptionTokenBalance | RawTokenQuantity
Actual option-token ERC-20 balance held by the market address. | | totalAreaInReserveToken | RawTokenQuantity
Total area under the active engine curve from zero to current supply,

denominated as a reserve-token integer count. Reserve surplus is the

positive excess of

reserveTokenBalance + totalDebtInReserveToken - totalAreaInReserveToken. | | engineStateHash | bytes32
keccak256 of the opaque engine state bytes used to compute this snapshot. | | engineState | bytes
Full opaque engine state bytes used to compute this snapshot. |

Directory routing record for one market kind.

kind is the stable semantic identifier; engine is the current

engine proxy every market of that kind should call.

struct DataTypes.MarketTypeConfig

FieldType
kindMarketKind
The market kind this config applies to.
engineaddress
Current pricing-engine proxy for this kind.

One user’s collateralized position in a market.

Ownership is immutable: the address keying the position storage IS the

owner. The owner field doubles as a lazy-init sentinel (zero means

uninitialized) and is set once on first interaction.

struct DataTypes.PersonalPosition

FieldType
owneraddress
Position owner. Set once on lazy creation; never reassigned.
collateralBalanceRawTokenQuantity
AVM collateral balance.
debtBalanceRawTokenQuantity
Reserve-token debt balance.

Which revenue bucket a collection event refers to.

Enum DataTypes.RevenueKind.

  • Platform
  • Group

Explicit 18-decimal signed fixed-point transport wrapper.

Use for typed math boundaries where values may be negative. Linear

curve y-intercepts (b1, b2) commonly become negative after floor

raises or contractions.

struct DataTypes.SignedFixed18Value

FieldType
rawint256

Top-level admin namespace for one tenant’s market groups.

struct DataTypes.Tenant

FieldType
adminaddress
Current tenant admin.
proposedAdminaddress
Pending tenant admin for two-step admin transfer.
platformFeeMicroBps
Platform fee share on group-fee revenue for this tenant’s markets,

expressed in MicroBps where 100_000_000 is 100%. The platform

take is a slice of group-fee revenue, not an additive surcharge on

the group fee charged to users. Capped by

FeePolicy.MAX_PLATFORM_FEE_MICRO_BPS. |

Unsigned 18-decimal Fixed18 y-value ratio, such as reserve tokens per AVM

token. Exchange rates (prices, floor levels, price deltas) are ratios, not

raw token amounts and not token-decimal-scaled quantities. This type

ABI-encodes as uint256; the integer is the Fixed18 value itself.

User-defined value type ExchangeRate wrapping uint256.

Branded identifier for a market group namespace.

User-defined value type GroupId wrapping bytes32.

Branded identifier for a market namespace.

User-defined value type MarketId wrapping bytes32.

Stable semantic identifier for an AVM market flavor. This is not an

engine address: the directory maps each kind to the current engine proxy.

User-defined value type MarketKind wrapping bytes32.

Raw integer count of micro basis points. The integer 1_00_000_000 (1e8)

represents 100%; 1_000_000 represents 1%; 1 represents one micro basis

point. Stored as a plain integer, not a fractional value.

User-defined value type MicroBps wrapping uint64.

Raw integer count of a token’s smallest indivisible unit. Carries no

assumption about how many decimal places the token uses — values

are interpreted in the token’s own decimals (which may be 6, 8, 18, or any

other value), and there is no implicit scale to 18 decimals. Used at the

external market boundary in place of bare uint256 whenever a parameter or

return value is a raw token amount. Markets convert these values to

Fixed18Value before calling an engine and convert engine results back to

raw token units before exposing them externally.

User-defined value type RawTokenQuantity wrapping uint256.

Raw integer count of seconds, used for both durations and Unix timestamps.

User-defined value type Seconds wrapping uint48.

Branded identifier for a tenant namespace.

User-defined value type TenantId wrapping bytes32.