SolverComponent
The following events are shared across all Solver implementations, which inherit from SolverComponent.
CreateMarket
CreateMarketThis event is emitted when a new pool / market is created. Markets are identified by market_id.CreateMarket events should be indexed to track the active markets in a solver.
pub struct CreateMarket {
#[key]
pub market_id: felt252,
pub base_token: ContractAddress,
pub quote_token: ContractAddress,
pub owner: ContractAddress,
pub is_public: bool,
pub vault_token: ContractAddress,
}market_idis the Poseidon chain hash of the market parameters below (base_token,quote_token,owner,is_public,vault_token)base_tokenis the address of the base token for the marketquote_tokenis the address of the quote token for the marketowneris the address of the market owneris_publicis a boolean indicating if the market is open to third party LPs / depositorsvault_tokenis the address of the token used to track LP shares in the market
Swap
SwapThis event is emitted when a swap is executed through a solver market. These events can be indexed along with Deposit and Withdraw events to track the total liquidity in a solver market.
pub struct Swap {
#[key]
pub market_id: felt252,
#[key]
pub caller: ContractAddress,
pub is_buy: bool,
pub exact_input: bool,
pub amount_in: u256,
pub amount_out: u256,
}market_idis the unique id of the market (seeCreateMarketabove)calleris the address of the user executing the swapis_buyis a boolean indicating if the swap is a buy or sellexact_inputis a boolean indicating if the swap amount was specified as input or outputamount_inis the amount of the input token swapped inamount_outis the amount of the output token swapped out
Deposit / Withdraw
Deposit / WithdrawThese events are emitted whenever a user / LP deposits or withdraws liquidity from a solver market. These events can be indexed along with Swap events to track the total liquidity in a solver market.
pub struct Deposit {
#[key]
pub caller: ContractAddress,
#[key]
pub market_id: felt252,
pub base_amount: u256,
pub quote_amount: u256,
pub shares: u256,
}
pub struct Withdraw {
#[key]
pub caller: ContractAddress,
#[key]
pub market_id: felt252,
pub base_amount: u256,
pub quote_amount: u256,
pub shares: u256,
}calleris the address of the user / LP depositing liquiditymarket_idis the unique id of the market (seeCreateMarketabove)base_amountis the amount of base tokens depositedquote_amountis the amount of quote tokens depositedsharesis the amount of LP shares minted or burned
Pause / Unpause
Pause / UnpauseThese events are emitted when a market is paused and unpaused. Paused markets should not accrue rewards as they will reject incoming swaps. These events can be indexed to track the paused state of solver markets.
pub struct Pause {
#[key]
pub market_id: felt252,
}
pub struct Unpause {
#[key]
pub market_id: felt252,
}Last updated