Skip to content
Lattice

ConstantProductInit

Git Source

Title: ConstantProductInit

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

One-shot initializer for a ConstantProduct AMM diamond — seeds AccessControl (so any admin-gated operation is DEFAULT_ADMIN_ROLE-gated) and binds the pool to its two ERC-20 reserve tokens (sorted token0 < token1), registering IConstantProduct via ERC-165 and arming the reentrancy guard. Delegatecalled by Diamond.initialize inside the initializing window (so it must NOT open its own pre/postInitializer; each __*_init guard passes because the window is already open). Companion to the ERC2981Init/VaultCoreInit patterns — a first-class production deploy artifact.

Functions

init

Runs the access-control + ConstantProduct module initializers. MUST be invoked via the diamond's initialize _init delegatecall.

function init(address admin, address tokenA, address tokenB) external;

Parameters

NameTypeDescription
adminaddressThe address granted DEFAULT_ADMIN_ROLE.
tokenAaddressOne of the two pool reserve tokens.
tokenBaddressThe other pool reserve token.