Skip to main content

Events

This document describes events emitted by the Veax smart contract. Each event includes details about when it is emitted, the payload containing relevant information, and the method or action that triggers it.

deposit

Emitted when tokens are deposited on a user's internal (DEX) account.

Can be emitted either when directly depositing tokens or when tokens are refunded after an unsuccessful withdraw attempt.

Emitted by

  • The deposit method.
  • A refund (unsuccessful withdraw attempt).

Payload

  • user: AccountId: user.
  • token_id: TokenId: token.
  • amount: U128: deposited amount.
  • balance: U128: balance after deposit.

withdraw

Emitted when a user attempts to withdraw tokens from an internal (DEX) account. Event doesn't imply that tokens were successfully transferred to a user's account.

Emitted by

The withdraw method or action.

Payload

  • user: AccountId: user.
  • token_id: TokenId: token.
  • amount: U128: withdrawn amount.
  • balance: U128: balance after withdraw.

open_position

Emitted when a liquidity position has been opened.

Emitted by

The open_position method or action.

Payload

  • user: AccountId: the account that created the position.
  • pool: (TokenId, TokenId): the pool where the position was created.
  • amounts: (U128, U128): the amounts of tokens in the position.
  • fee_rate: U64: the fee rate (basis points).
  • position_id: U64: the position identifier.

harvest_fee

Emitted when accumulated fee tokens are moved from a position to a user's internal (DEX) account.

Emitted by

  • The withdraw_fee method or action.
  • The close_position method or action.

Payload

  • position_id: PositionId: position identifier.
  • fee_amounts: (U128, U128): amount of fee withdrawn (in the same order as tokens in open_position event).

close_position

Emitted when a position is closed (removed).

Emitted by

The close_position method or action.

Payload

  • position_id: PositionId: position identifier.
  • fee_amounts: (U128, U128): amount of tokens in position at the moment it was closed.

swap

Emitted when a swap is executed.

Emitted by

  • The swap_exact_in action or method.
  • The swap_exact_out action or method.

Payload

  • user: AccountId: user that executed swap.
  • tokens: (TokenId, TokenId): tokens that were swapped (in, out).
  • amounts: (U128, U128): amounts of swapped tokens (in, out).
  • fees not implemented.

update_pool_state

Emitted when a pool's state is changed.

Emitted by

  • The swap_exact_in method or action.
  • The swap_exact_out method or action.
  • The open_position method or action.
  • The close_position method or action.

Payload

  • type: "add_pos", "rm_pos" or "swap": action that changed the pool's state.
  • pool: (TokenId, TokenId): pool identifier.
  • amounts_a: [U128]: TVL of the first token on each fee level.
  • amounts_b: [U128]: TVL of the second token on each fee level.
  • sqrt_prices: [F64]: square root of spot prices on each fee level.
  • liquidities: [F64]: effective liquidity on each fee level.

add_verified_tokens

Emitted when tokens are added to the verified tokens list.

Emitted by

The add_verified_tokens method.

Payload

tokens: [TokenId]: list of tokens that were added to the verified list.

remove_verified_tokens

Emitted when tokens are removed from the verified tokens list.

Emitted by

The remove_verified_tokens method.

Payload

tokens: [TokenId]: a list of tokens that were removed from the verified list.

add_guard_accounts

Emitted when accounts are added to the guard accounts list.

Emitted by

The add_guard_accounts method.

Payload

accounts: [AccountId]: a list of accounts that were added to the guard accounts list.

remove_guard_accounts

Emitted when accounts are removed from the guard accounts list.

Emitted by

The remove_guard_accounts method.

Payload

accounts: [AccountId]: a list of accounts that were removed from the guard accounts list.

suspend_payable_api

Emitted when the payable API is suspended.

Emitted by

The suspend_payable_api method.

Payload

account: AccountId: an account that sent the suspend transaction.

resume_payable_api

Emitted when the payable API is resumed.

Emitted by

The resume_payable_api method.

Payload

account: AccountId: an account that sent the "resume" transaction.