2026-03-17 18:08:53 +01:00
|
|
|
//! The AMM Program implementation.
|
|
|
|
|
|
|
|
|
|
pub use amm_core as core;
|
|
|
|
|
|
|
|
|
|
pub mod add;
|
2026-06-18 09:01:10 +02:00
|
|
|
pub mod create_price_observations;
|
feat(amm): add Initialize instruction with config-gated chained calls
Introduce a singleton AMM configuration account, a PDA derived from the
constant "CONFIG" seed, created once via a new `Initialize` instruction.
The config stores the Token Program ID the AMM issues every chained call
to, replacing the previous behavior of trusting the program owner of a
caller-supplied holding.
The config account's existence is the Program's initialization gate: the
chained-call instructions (new_definition, add_liquidity, remove_liquidity,
swap_exact_input, swap_exact_output) now take the config as their first
account, validate it against `compute_config_pda(self_program_id)`, and
read the Token Program ID from it on demand — rejecting calls until the
Program is initialized. Vaults and user holdings are asserted to match the
configured Token Program. sync_reserves is left ungated, as it cannot act
on a pool that could not have existed before initialization.
- amm_core: AmmConfig type, compute_config_pda/_seed, Initialize variant
- amm: initialize.rs + config threading through chained-call instructions
- guest: initialize instruction; config + self_program_id on gated calls
- tests: config fixtures, init-gate unit tests, end-to-end Initialize VM test
2026-06-17 16:29:30 +02:00
|
|
|
pub mod initialize;
|
2026-03-17 18:08:53 +01:00
|
|
|
pub mod new_definition;
|
|
|
|
|
pub mod remove;
|
|
|
|
|
pub mod swap;
|
2026-04-08 10:57:47 -03:00
|
|
|
pub mod sync;
|
2026-06-18 16:46:38 +02:00
|
|
|
pub mod update_config;
|
2026-03-17 18:08:53 +01:00
|
|
|
|
|
|
|
|
mod tests;
|