Crate cpamm

source · []
Expand description

Constant product automated market maker.

Modules

An Anchor generated module, providing a set of structs mirroring the structs deriving Accounts, where each field is a Pubkey. This is useful for specifying accounts for a client.

Constant product AMM.

Fees.

An Anchor generated module containing the program’s set of instructions, where each method handler in the #[program] mod is associated with a struct defining the input arguments to the method. These should be used directly, when one wants to serialize Anchor instruction data, for example, when speciying instructions on a client.

Swap historical price information. This is based on the Uniswap V2 TWAP oracle solution.

Module representing the program.

Structs

Accounts for a cpamm::deposit instruction.

Emitted on a successful crate::cpamm::deposit.

Keeps track of SwapInfos.

Token accounts for the creation of a SwapInfo.

Accounts for a cpamm::new_factory instruction.

Emitted on a successful crate::cpamm::new_swap.

Accounts for a cpamm::new_swap instruction.

Accounts for a cpamm::new_swap_meta instruction.

Accounts for a cpamm::swap instruction.

Cumulative statistics about the swap. This can be combined with recurring snapshot jobs that will store this variable periodically, giving us stuff like 24h, 7d, etc. volume, deposits, withdraws, fees.

Cumulative statistics on swaps.

Emitted on a successful crate::cpamm::swap.

Fees associated with a SwapInfo.

Stores information about a swap.

A swap with an index. Used by the Factory.

Token accounts for a ‘swap’ instruction.

Information about one of the tokens.

Token accounts for the destination of a swap instruction.

Context common to all router operations.

Accounts for a cpamm::withdraw instruction.

Emitted on a successful crate::cpamm::withdraw.

Enums

Statics

The static program ID

Functions

Confirms that a given pubkey is equivalent to the program ID

The Anchor codegen exposes a programming model where a user defines a set of methods inside of a #[program] module in a way similar to writing RPC request handlers. The macro then generates a bunch of code wrapping these user defined methods into something that can be executed on Solana.

Returns the program ID