Swap

The Swap entity represents a fungible token trade on a DEX indexed from Casper smart contracts. Each swap provides the pair, tokens, amounts, and timestamp for a single trade.

Properties

The Swap entity has the following properties:

Property
Type
Description

pair_contract_package_hash

string(64)

Pair contract package hash represented as a hexadecimal string

transaction_hash

string(64)

Transaction hash represented as a hexadecimal string

transform_id

uint

Transform identifier of the swap within the transaction

block_height

uint64

Block height at which the swap occurred

sender_hash

string(64)

Sender account hash represented as a hexadecimal string

dex_id

uint16

DEX identifier

token0_contract_package_hash

string(64)

Token0 contract package hash represented as a hexadecimal string

token1_contract_package_hash

string(64)

Token1 contract package hash represented as a hexadecimal string

decimals0

uint8

Token0 decimals

decimals1

uint8

Token1 decimals

amount0_in

string

Token0 amount in (raw units). Can be null

amount1_in

string

Token1 amount in (raw units). Can be null

amount0_out

string

Token0 amount out (raw units). Can be null

amount1_out

string

Token1 amount out (raw units). Can be null

timestamp

string

Swap timestamp in the ISO 8601arrow-up-right format

Swap amounts (amount0_in, amount1_in, amount0_out, amount1_out) are returned in raw on-chain units. They are not normalized by token decimals.

Example

Optional properties

Depending on the endpoint, some of the following optional properties may be included in the Swap entity:

Property
Type
Description

sender_public_key

string(68)

Sender public key represented as a hexadecimal string

sender_account_info

Sender account info

sender_centralized_account_info

Sender account information available for known accounts provided by CSPR.cloud team

pair_contract_package

Pair contract package details

token0_contract_package

Token0 contract package details

token1_contract_package

Token1 contract package details

token0_ft_rate

float64

Token0 rate in the specified currency at the swap timestamp. It's a function includer

token1_ft_rate

float64

Token1 rate in the specified currency at the swap timestamp. It's a function includer

Relations

The Swap entity has the following relations with other entities:

Entity
Mapping property
Description

sender_hash

Sender account of the swap trade

token0_contract_package_hash, token1_contract_package_hash, pair_contract_package_hash

Swap trade token and pair contract packages

dex_id

DEX that produced the swap

Endpoints

The Swap entity has the following endpoints:

Relation endpoints

None

Last updated