Pair
The Pair contract represents a liquidity pool for a specific token pair. It manages token balances, tracks reserves, and handles the logic for token swaps within the PumpSpace protocol.
Each Pair is uniquely created by the Factory and is responsible for maintaining the state and rules of a single trading pair.
Functions
token0
Returns the address of the first token in the pair (sorted by address).
function token0() external view returns (address);
token1
Returns the address of the second token in the pair (sorted by address).
function token1() external view returns (address);
getReserves
Returns the current reserves of
token0
andtoken1
, along with the timestamp of the last block in which the reserves were updated.
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
swap
Swaps tokens within the pair contract. Either
amount0Out
oramount1Out
must be non-zero. Used internally during trades initiated via the Router.
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;