Skip to content

IAvmFactory

Deploys market proxies and market tokens, then registers them in the AVM directory.

This interface does not require the factory itself to use a proxy model. It carries no separate factory-admin surface; the current implementation is constructor-bound to its directory.

Deploy a new market proxy and register it with the directory.

The proxy is created with CREATE2 using params.marketId as the salt; see predictMarketAddress for the derivation contract.

function createMarket(struct DataTypes.CreateMarketParams params) returns (address) nonpayable

Parameters

Returns

  • marketaddress
function directory() returns (address) view

Returns

  • address

Compute the address createMarket would deploy for a given marketId.

Derivation: CREATE2 with deployer = factory address, salt = marketId, and initcode hash = keccak256(beaconProxyCreationCode || abi.encode(beacon, "")) where beacon is the single market beacon registered in the directory. The prediction is stable as long as (a) the factory address is stable, (b) IAvmDirectoryViews.marketBeacon() is stable, and (c) the BeaconProxy creation code is unchanged.

@marketId — Salt-equivalent market identifier.

@return predicted — Deterministic deployment address.

function predictMarketAddress(MarketId marketId) returns (address) view

Parameters

Returns

  • predictedaddress