Skip to main content
Version: v0.19

Events

This document provides a list of events generated by the AMM module.

EventSetPool

This event occurs when a pool model is added to the store.

message EventSetPool {
Pool pool = 1 [(gogoproto.nullable) = false];
}

EventAppendPool

This event is triggered when a new pool is included in the pool set.

message EventAppendPool {
Pool pool = 1 [(gogoproto.nullable) = false];
}

EventSetPoolCount

This event fires when the pool count is either set or modified.

message EventSetPoolCount {
uint64 pool_count = 1;
}

EventSetLpTokenSupply

This event happens when the LP token supply is either set or altered.

message EventSetLpTokenSupply {
uint64 pool_id = 1;
string supply = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventSetPoolToken

This event is generated when a pool token is set or updated.

message EventSetPoolToken {
PoolToken pool_token = 1 [(gogoproto.nullable) = false];
}

EventRemovePoolToken

This event occurs when a pool token is deleted.

message EventRemovePoolToken {
uint64 pool_id = 1;
string denom = 2;
}

EventSetWeightedToken

This event takes place when a weighted token is set or modified.

message EventSetWeightedToken {
WeightedToken weighted_token = 1 [(gogoproto.nullable) = false];
}

EventRemoveWeightedToken

This event happens when a weighted token is deleted.

message EventRemoveWeightedToken {
uint64 pool_id = 1;
string denom = 2;
}

EventSetWeightUpdateTiming

This event fires when the weight update timing for a pool is set.

message EventSetWeightUpdateTiming {
WeightUpdateTiming weight_update_timing = 1 [(gogoproto.nullable) = false];
}

EventSetWhitelistedRoute

This event is triggered when a route is whitelisted or updated.

message EventSetWhitelistedRoute {
WhitelistedRoute whitelisted_route = 1 [(gogoproto.nullable) = false];
}

EventSetYammConfiguration

This event occurs when a YAMM configuration for a pool is set.

message EventSetYammConfiguration {
YammConfiguration yamm_configuration = 1 [(gogoproto.nullable) = false];
}

EventSetOrder

This event fires when an order is established.

message EventSetOrder {
Order order = 1 [(gogoproto.nullable) = false];
}

EventAppendOrder

This event happens when a new order is appended.

message EventAppendOrder {
Order order = 1 [(gogoproto.nullable) = false];
}

EventSetOrderCount

This event is triggered when the order count is set.

message EventSetOrderCount {
uint64 order_count = 1;
}

EventRemoveOrder

This event occurs when an order is deleted.

enum RemoveOrderReason {
option (gogoproto.goproto_enum_prefix) = false;
ORDER_CANCELED = 0 [(gogoproto.enumvalue_customname) = "ORDER_CANCELED"];
ORDER_DEPOSIT_FAILED = 1 [(gogoproto.enumvalue_customname) = "ORDER_DEPOSIT_FAILED"];
ORDER_FINISHED = 3 [(gogoproto.enumvalue_customname) = "ORDER_FINISHED"];
}

message EventRemoveOrder {
uint64 id = 1;
RemoveOrderReason reason = 2;
}

EventCancelOrder

This event fires when an order is canceled.

message EventCancelOrder {
uint64 id = 1;
cosmos.base.v1beta1.Coin withdrawn_amount = 2 [(gogoproto.nullable) = false];
}

EventSetScheduleOrder

This event triggers when a scheduled order joins the queue.

message EventSetScheduleOrder {
ScheduleOrder schedule_order = 1 [(gogoproto.nullable) = false];
}

EventRemoveScheduleOrder

This event triggers when a scheduled order leaves the queue.

message EventRemoveScheduleOrder {
uint64 order_id = 1;
int64 time_millis = 2;
}

EventSetExecutableOrder

This event triggers when an order enters the execution queue.

message EventSetExecutableOrder {
uint64 order_id = 1;
}

EventRemoveExecutableOrder

This event triggers when an order exits the execution queue.

message EventRemoveExecutableOrder {
uint64 order_id = 1;
}

EventSetIntroducingPoolToken

This event triggers when a virtual balance pool token is established.

message EventSetIntroducingPoolToken {
VirtualBalancePoolToken virtual_balance_token = 1 [(gogoproto.nullable) = false];
}

EventRemoveIntroducingPoolToken

This event triggers when an introducing pool token is eliminated.

message EventRemoveIntroducingPoolToken {
uint64 pool_id = 1;
string denom = 2;
}

EventSetExpiringPoolToken

This event triggers when an expiring pool token is established.

message EventSetExpiringPoolToken {
VirtualBalancePoolToken virtual_balance_token = 1 [(gogoproto.nullable) = false];
}

EventRemoveExpiringPoolToken

This event triggers when an expiring pool token is eliminated.

message EventRemoveExpiringPoolToken {
uint64 pool_id = 1;
string denom = 2;
}

EventSetYammPoolForAssetId

This event triggers when a YAMM pool is linked to an asset ID.

message EventSetYammPoolForAssetId {
uint64 pool_id = 1;
string asset_id = 2;
}

EventSetVaultPaused

This event triggers when the vault pauses or resumes.

message EventSetVaultPaused {
bool paused = 1;
}

EventExecuteOrdersForPair

This event triggers when some orders for a pair execute at a block. The pool_id, token_in, token_out, and whitelisted_route identify the pair.

Buy orders purchase the token_out. Each buy order has an EventExecuteOrder object with the order's id, its matched amount, and the amount traded against the amm pools.

The event also includes the buy and sell prices at execution time, the total amount traded against the pools for each side, and the matched amounts. The output of matching for sell orders equals the matched amount for the buy orders and vice versa. But this does not apply to trades. The actual output amounts of trades against the pools are in separate fields in the event.

message EventExecuteOrdersForPair {
uint64 pool_id = 1;
string token_in = 2;
string token_out = 3;
bool whitelisted_route = 4;

string buy_price = 5 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string sell_price = 6 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

repeated EventExecuteOrder buy_orders = 7 [(gogoproto.nullable) = false];
repeated EventExecuteOrder sell_orders = 8 [(gogoproto.nullable) = false];

string buy_trade_amount = 9 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string buy_match_amount = 10 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

string sell_trade_amount = 11 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string sell_match_amount = 12 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

string sell_trade_output = 13 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string buy_trade_output = 14 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

message EventExecuteOrder {
uint64 order_id = 1;
string trade_amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string match_amount = 3 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string output_amount = 4 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventExecuteMatchProposal

The EventExecuteMatchProposal is triggered when a match proposal is executed. The properties for each pair are similar to those in the order execution event. This event also includes the proposer and the reward amount given to the proposer.

message EventExecuteMatchProposal {
string proposer = 1;
repeated EventExecuteMatchProposalPair pairs = 2 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin proposer_reward = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
message EventExecuteMatchProposalPair {
uint64 pool_id = 1;
string token_in = 2;
string token_out = 3;
bool whitelisted_route = 4;

string buy_price = 5 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string sell_price = 6 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

repeated EventExecuteMatchProposalOrder buy_orders = 7 [(gogoproto.nullable) = false];
repeated EventExecuteMatchProposalOrder sell_orders = 8 [(gogoproto.nullable) = false];

string buy_match_amount = 9 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string sell_match_amount = 10 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

message EventExecuteMatchProposalOrder {
// Note that if virtual=true, order_id is set to zero and should be ignored,
// otherwise we still might have order_id=0 referring to an actual order
uint64 order_id = 1;
string match_amount = 3 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string output_amount = 4 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
bool virtual = 5;
}

PoolExitEvent

An event triggered when liquidity is pulled from a pool. The TokenAmount objects display the token balance post-operation, while the amount property signifies the volume of the token involved in this unique operation.

message EventExitPool {
uint64 pool_id = 1;
ExitSummary summary = 2 [(gogoproto.nullable) = false];
}

message ExitSummary {
TokenAmount lp_token = 1 [(gogoproto.nullable) = false];
repeated TokenAmount tokens_out = 2 [(gogoproto.nullable) = false];
ExitType exit_type = 3;
cosmos.base.v1beta1.Coin protocol_fee = 4 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin swap_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

enum ExitType {
option (gogoproto.goproto_enum_prefix) = false;
EXIT_TYPE_GIVEN_TOKENS_IN = 0 [(gogoproto.enumvalue_customname) = "EXIT_GIVEN_EXACT_TOKENS_OUT"];
EXIT_TYPE_TOKEN_GIVEN_LPT_OUT = 1 [(gogoproto.enumvalue_customname) = "EXIT_TOKEN_GIVEN_LPT_IN"];
EXIT_TYPE_ALL_TOKENS_GIVEN_LPT_OUT = 2 [(gogoproto.enumvalue_customname) = "EXIT_ALL_TOKENS_GIVEN_LPT_IN"];
EXIT_TYPE_ALL_TOKENS_RECOVERY_MODE = 3 [(gogoproto.enumvalue_customname) = "EXIT_ALL_TOKENS_RECOVERY_MODE"];
}

message TokenAmount {
PoolToken token = 1 [(gogoproto.nullable) = false];
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventExitPoolRequest

EventExitPoolRequest is an event fired upon the execution of an exit pool request. It carries the user's address. It is not triggered when users exit a pool without an exit pool request, e.g., batch swap with exit steps.

message EventExitPoolRequest {
string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 pool_id = 2;
cosmos.base.v1beta1.Coin lpt_in = 3 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin amounts_out = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
cosmos.base.v1beta1.Coin protocol_fee = 5 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin swap_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
ExitType exit_type = 7;
}

EventJoinPool

EventJoinPool is an event triggered when liquidity is deposited into a pool. The TokenAmount objects display the token balance post-operation, and the amount property represents the token amount in circulation for this operation.

message EventJoinPool {
uint64 pool_id = 1;
JoinSummary summary = 2 [(gogoproto.nullable) = false];
}

message JoinSummary {
TokenAmount lp_token = 1 [(gogoproto.nullable) = false];
repeated TokenAmount tokens_in = 2 [(gogoproto.nullable) = false];
JoinType join_type = 3;
repeated cosmos.base.v1beta1.Coin protocol_fee = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin swap_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

enum JoinType {
option (gogoproto.goproto_enum_prefix) = false;
JOIN_TYPE_GIVEN_TOKENS_IN = 0 [(gogoproto.enumvalue_customname) = "JOIN_GIVEN_EXACT_TOKENS_IN"];
JOIN_TYPE_TOKEN_GIVEN_LPT_OUT = 1 [(gogoproto.enumvalue_customname) = "JOIN_TOKEN_GIVEN_LPT_OUT"];
JOIN_TYPE_ALL_TOKENS_GIVEN_LPT_OUT = 2 [(gogoproto.enumvalue_customname) = "JOIN_ALL_TOKENS_GIVEN_LPT_OUT"];
JOIN_TYPE_INITIALIZE_POOL = 3 [(gogoproto.enumvalue_customname) = "JOIN_INITIALIZE_POOL"];
}

message TokenAmount {
PoolToken token = 1 [(gogoproto.nullable) = false];
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventJoinPoolRequest

This event is emitted when a join pool request is executed. It includes the user address and is only emitted when users join a pool using the join pool request. Notably, it is not emitted during batch swaps with join steps.

message EventJoinPoolRequest {
string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 pool_id = 2;
cosmos.base.v1beta1.Coin lpt_out = 3 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin amounts_in = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin protocol_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin swap_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
JoinType join_type = 7;
}

EventSwap

An event is emitted when a swap is executed against a pool. The TokenAmount objects reflect the token balance post-operation, while the amount property signifies the token circulation during this particular operation.

message EventSwap {
uint64 pool_id = 1;
SwapSummary summary = 2 [(gogoproto.nullable) = false];
}

message SwapSummary {
TokenAmount token_in = 1 [(gogoproto.nullable) = false];
TokenAmount token_out = 2 [(gogoproto.nullable) = false];
SwapType swap_type = 3;
cosmos.base.v1beta1.Coin protocol_fee = 4 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin swap_fee = 5 [(gogoproto.nullable) = false];
}

enum SwapType {
option (gogoproto.goproto_enum_prefix) = false;
SWAP_TYPE_GIVEN_IN = 0 [(gogoproto.enumvalue_customname) = "SWAP_GIVEN_IN"];
SWAP_TYPE_GIVEN_OUT = 1 [(gogoproto.enumvalue_customname) = "SWAP_GIVEN_OUT"];
}

message TokenAmount {
PoolToken token = 1 [(gogoproto.nullable) = false];
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventSingleSwapRequest

This event is emitted when a single swap request is executed. It includes the user address and is not emitted when users swap against a pool without using the single swap pool request, such as in a batch swap.

message EventSingleSwapRequest {
string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 pool_id = 2;
cosmos.base.v1beta1.Coin amount_out = 3 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin amount_in = 4 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin protocol_fee = 5 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin swap_fee = 6 [(gogoproto.nullable) = false];
SwapType swap_type = 7;
}

EventBatchSwapRequest

This event is emitted when a batch swap request is executed.

message EventBatchSwapRequest {
string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated SwapStep steps = 2 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin amounts_in = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin amounts_out = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin swap_protocol_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin join_exit_protocol_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated cosmos.base.v1beta1.Coin swap_fee = 7 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
SwapType swap_type = 8;
}

EventYAssetSwap

The EventYAssetSwap is emitted upon a yASSET swap. These swaps entail an underlying swap against the pool and a refract/redeem action. The EventSwap is also emitted for the underlying swap, with additional yASSET trade details found in this event. Note that the fee here differs from the swap fee or the swap-protocol fee, which are charged for all operations; this is detailed in the yASSET trade section.

message EventYAssetSwap {
uint64 pool_id = 1;
SwapSummary summary = 2 [(gogoproto.nullable) = false];
EventYAssetSwapRefractorAction refractor_action = 3 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin fee = 4 [(gogoproto.nullable) = true];
}

message EventYAssetSwapRefractorAction {
string y_amount = 1 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string c_amount_after_fee = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string fee_amount = 3 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

EventSetOraclePricePair

This event is emitted when an oracle price pair has been set.

message EventSetOraclePricePair {
OraclePricePair oracle_price_pair = 1 [(gogoproto.nullable) = false];
}

EventRemoveOraclePricePair

This event is emitted when an oracle price pair is removed.

message EventRemoveOraclePricePair {
string asset_id = 1;
}

EventSetPendingTokenIntroduction

This event is emitted when a pending token introduction is established.

message EventSetPendingTokenIntroduction {
PendingTokenIntroduction pending_token_introduction = 1 [(gogoproto.nullable) = false];
}

EventRemovePendingTokenIntroduction

This event is emitted upon the removal of a pending token introduction.

message EventRemovePendingTokenIntroduction {
string asset_id = 1;
uint64 target_pool_id = 2;
}

EventSetParams

This event is emitted when pool parameters are established.

message EventSetParams {
Params params = 1 [(gogoproto.nullable) = false];
}

EventSetOrderPairDisabled

This event is emitted when an order pair is disabled/enabled.

message EventSetOrderPairDisabled {
// note token_in and token_out are bi-directional
// meaning disabling token_in=x,token_out=y is
// disabling token_in=y,token_out=x at the same time.
DisabledOrderPair pair = 1 [(gogoproto.nullable) = false];
bool disabled = 2;
}