DEX API

XCADDEX-API

API server for XCAD DEX

The web service exposes these endpoints. You can find the sample data for each endpoint here

Where the result consists of multiple pages ( i.e. where total_pages > 1) use query parameter ?page=n where n = page number e.g. 2

Base Endpoint - /

Returns a string to indicate that the webservice is running Hello xcaddex!

https://rewards-api.xcadnetwork.com/

Get Liquidity - /liquidity

Get the liquidity for all pools at the given timestamp.

https://rewards-api.xcadnetwork.com/liquidity

Parameter
Description

address

The address of the initiator, Bech32 format - Filter by user address

timestamp

The End time, Unix time format (retrieve data from pool begining til this time ) - Filter by time range

Examples

Filter
Example Url

address

http://localhost:3010/liquidity?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/liquidity?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/liquidity?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

time range

http://localhost:3010/liquidity?timestamp=1645142739

https://rewards-api.xcadnetwork.com/liquidity?timestamp=1645142739

Sample Data

Field
Description

pool - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

pool - Zil pools

The pool identifier, TokenAddress Bech32 format

amount - XCAD Pools

When the pool field contains the XCAD pool identifier this amount is the XCAD amount

amount - Zil Pools

When the pool field contains the Zil pool identifier this amount is the ZIL amount

Get Weighted Liquidity - /weighted_liquidity

Get the liquidity for all pools in between the given timestamps weighted by duration.

https://rewards-api.xcadnetwork.com/weighted_liquidity

Parameter
Description

address

The address of the initiator, Bech32 format - Filter by user address

from

Start time, Unix time format ( default for until is now) - Filter by time range

until

End time, Unix time format ( if not specify it means now) - Filter by time range

Examples

Filter
Example Url

address

http://localhost:3010/weighted_liquidity?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/weighted_liquidity?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/weighted_liquidity?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

time range

http://localhost:3010/weighted_liquidity?from=1645142739

https://rewards-api.xcadnetwork.com/weighted_liquidity?from=1645142739

https://rewards-api.xcadnetwork.com/weighted_liquidity?from=1645142739&until=1645229139

Sample Data

Field
Description

pool - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

pool - Zil pools

The pool identifier, TokenAddress Bech32 format

amount - XCAD Pools

When the pool field contains the XCAD pool identifier this amount is the XCAD amount

amount - Zil Pools

When the pool field contains the Zil pool identifier this amount is the ZIL amount

Get Liquidity Changes - /liquidity_changes

Get all liquidity changes (addition / removal) for all pools.

http://localhost:3010/liquidity_changes

https://rewards-api.xcadnetwork.com/liquidity_changes

Parameter
Description

per_page

The number of records per page (default 10, max 50)

page

The page to retrieve - Paging

address

The address of the initiator, Bech32 format - Filter by user address

pool (ZIL)

The identifier of the pool, Bech32 address for ZIL-ZRC2 pools - Filter by pool

pool (XCAD)

The identifier of the pool, XCADHash,TokenHash for XCAD-ZRC2 pools - Filter by pool

Examples

Filter
Example Url

per_page

http://localhost:3010/liquidity_changes?per_page=50

https://rewards-api.xcadnetwork.com/liquidity_changes?per_page=50

page

http://localhost:3010/liquidity_changes?page=2

https://rewards-api.xcadnetwork.com/liquidity_changes?page=2

address

http://localhost:3010/liquidity_changes?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/liquidity_changes?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/liquidity_changes?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

pool (ZIL)

http://localhost:3010/liquidity_changes?pool=zil1zlypy5aemcs8expcrsx28jz09523j2x8l0qy4s

https://rewards-api.xcadnetwork.com/liquidity_changes?pool=zil1z5l74hwy3pc3pr3gdh3nqju4jlyp0dzkhq2f5y

pool (XCAD)

http://localhost:3010/liquidity_changes?pool=0x17c81253b9de207c98381c0ca3c84f2d151928c7,0xd534e4e0ea00d72c8ab5641e80234af531238650

https://rewards-api.xcadnetwork.com/liquidity_changes?pool=0x153feaddc48871108e286de3304b9597c817b456,0x818ca2e217e060ad17b7bd0124a483a1f66930a9

Sample Data

Field
Description

token_address - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

token_address - Zil pools

The pool identifier, TokenAddress Bech32 format

change_amount - XCAD Pools

The amount of Liquidity added or removed (negative value). For XCAD Pool this is XCAD amount

chnage_amount - Zil Pools

The amount of Liquidity added or removed (negative value). For Zil Pool this is ZIL amount

Get Volumne - /volume

Get the swap volume in XCAD / token and Zil / tokens for the given period for all pools.

https://rewards-api.xcadnetwork.com/volume

Parameter
Description

address

The address of the initiator, Bech32 format - Filter by user address

from

Start time, Unix time format ( default for until is now) - Filter by time range

until

End time, Unix time format ( if not specify it means now) - Filter by time range

Examples

Filter
Example Url

address

http://localhost:3010/volume?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/volume?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/volume?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

time range

http://localhost:3010/volume?from=1645142739

https://rewards-api.xcadnetwork.com/volume?from=1645142739

http://localhost:3010/volume?from=1645142739&until=1645229139

https://rewards-api.xcadnetwork.com/volume?from=1645142739&until=1645229139

Sample Data

Field
Description

pool - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

pool - Zil pools

The pool identifier, TokenAddress Bech32 format

in_zil_amount

The amount of XCAD or ZIL input to the swap, this field is overloaded, for XCAD pools it means XCAD, for Zils pool it means ZIL

out_token_amount

The amount of token output from the swap

out_zil_amount ls

The amount of XCAD or ZIL output from the swap, this field is overloaded, for XCAD pools it means XCAD, for Zils pool it means ZIL

in_token_amount

The amount token input to the swap

Get Swaps - /swaps

Get the swaps for all pools.

https://rewards-api.xcadnetwork.com/swaps

Parameter
Description

per_page

The number of records per page (default 10, max 50)

page

The page to retrieve - Paging

address

The address of the initiator, Bech32 format - Filter by user address

pool

The identifier of the pool, Bech32 address for ZIL-ZRC2 pools - Filter by pool

pool

The identifier of the pool, XCADHash,TokenHash for XCAD-ZRC2 pools - Filter by pool

is_incoming

The swap direction, true for Sell, false for Buy - Filter by Sell or Buy

Examples

Filter
Example Url

per_page

http://localhost:3010/swaps?per_page=50

https://rewards-api.xcadnetwork.com/swaps?per_page=50

page

http://localhost:3010/swaps?page=2

https://rewards-api.xcadnetwork.com/swaps?page=2

address

http://localhost:3010/swaps?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/swaps?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/swaps?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

pool (ZIL)

http://localhost:3010/swaps?pool=zil1zlypy5aemcs8expcrsx28jz09523j2x8l0qy4s

https://rewards-api.xcadnetwork.com/swaps?pool=zil1z5l74hwy3pc3pr3gdh3nqju4jlyp0dzkhq2f5y

pool (XCAD)

http://localhost:3010/swaps?pool=0x17c81253b9de207c98381c0ca3c84f2d151928c7,0xd534e4e0ea00d72c8ab5641e80234af531238650

https://rewards-api.xcadnetwork.com/swaps?pool=0x153feaddc48871108e286de3304b9597c817b456,0x818ca2e217e060ad17b7bd0124a483a1f66930a9

Sell

http://localhost:3010/swaps?is_incoming=true

https://rewards-api.xcadnetwork.com/swaps?is_incoming=true

Buy

http://localhost:3010/swaps?is_incoming=false

https://rewards-api.xcadnetwork.com/swaps?is_incoming=false

Sample Data

Field
Description

token_address - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

token_address - Zil pools

The pool identifier, TokenAddress Bech32 format

zil_amount

The amount of XCAD or ZIL, this field is overloaded, for XCAD pools it means XCAD, for Zils pool it means ZIL

token_amount

The amount of token

is_sending_zil

The Swap Direction true means XCAD or ZIL is the input to the swap, false means XCAD or ZIL is the output

Get Transactions - /transactions

Get transactions for all pools. Transactions include swaps and liquidity changes.

http://localhost:3010/transactions

https://rewards-api.xcadnetwork.com/transactions

Parameter
Description

per_page

The number of records per page (default 10, max 50)

page

The page to retrieve - Paging

address

The address of the initiator, Bech32 format - Filter by user address

pool

The identifier of the pool, Bech32 address for ZIL-ZRC2 pools - Filter by pool

pool

The identifier of the pool, XCADHash,TokenHash for XCAD-ZRC2 pools - Filter by pool

is_incoming

The swap direction, true for Sell, false for Buy - Filter by Sell or Buy

Examples

Filter
Example Url

per_page

http://localhost:3010/transactions?per_page=50

https://rewards-api.xcadnetwork.com/transactions?per_page=50

page

http://localhost:3010/transactions?page=2

https://rewards-api.xcadnetwork.com/transactions?page=2

address

http://localhost:3010/transactions?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/transactions?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/transactions?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

pool (ZIL)

http://localhost:3010/transactions?pool=zil1zlypy5aemcs8expcrsx28jz09523j2x8l0qy4s

https://rewards-api.xcadnetwork.com/transactions?pool=zil1z5l74hwy3pc3pr3gdh3nqju4jlyp0dzkhq2f5y

pool (XCAD)

http://localhost:3010/transactions?pool=0x17c81253b9de207c98381c0ca3c84f2d151928c7,0xd534e4e0ea00d72c8ab5641e80234af531238650

https://rewards-api.xcadnetwork.com/transactions?pool=0x153feaddc48871108e286de3304b9597c817b456,0x818ca2e217e060ad17b7bd0124a483a1f66930a9

Sell

http://localhost:3010/transactions?is_incoming=true

https://rewards-api.xcadnetwork.com/transactions?is_incoming=true

Buy

http://localhost:3010/transactions?is_incoming=false

https://rewards-api.xcadnetwork.com/transactions?is_incoming=false

Sample Data

Field
Description

token_address - XCAD pools

The pool identifier, XCADTokenHash,TokenHash Hex format

token_address - Zil pools

The pool identifier, TokenAddress Bech32 format

tx_type

Transaction type "liquidity" or "swap"

tx_type = liquidity

change_amount - XCAD Pools

The amount of Liquidity added or removed (negative value). For XCAD Pool this is XCAD amount

chnage_amount - Zil Pools

The amount of Liquidity added or removed (negative value). For Zil Pool this is ZIL amount

tx_type = swap

zil_amount

The amount of XCAD or ZIL, this field is overloaded, for XCAD pools it means XCAD, for Zils pool it means ZIL

token_amount

The amount of token

swap0_is_sending_zil

The Swap Direction true means XCAD or ZIL is the input to the swap, false means XCAD or ZIL is the output

Get Distribution Info - /distribution/info

Get details about all active distributions. This info is coming from the config.yml

https://rewards-api.xcadnetwork.com/distribution/info

Sample Data

Distribution Data Generation - /distribution/generate/{id}

Generate the rewards distribution data for the given Distributor.

This needs to run at the end of each epoch to generate data for that epoch and save it to the database

id: is the index into the list of distributor configurations in the config.yml file it is 0 indexed - first config is number 0

https://rewards-api.xcadnetwork.com/distribution/generate/0

Sample Data

The data returned is simply the root of the generated Merkle tree.

Get Distribution Data for Epoch - /distribution/data/{distributor_address}/{epoch_number}

Get distribution information for a given epoch

https://rewards-api.xcadnetwork.com/distribution/data/{DistributorHash}/{epoch_number}

Route Parameter
Description

distributor_address

The distribution contract address in hex.

epoch_number

The epoch number to get data for. ( number between 0 and total_epochs

Parameter
Description

address

The address of the initiator, Bech32 format - Filter by user address

Filter
Example Url

http://localhost:3010/distribution/data/0x4a28a0b3d3fc98a52fc128e3cd40c77a88da696e/0

https://rewards-api.xcadnetwork.com/distribution/data/0x96c300ce0697e3524190943cd05681d7abe7c1ca/0

https://rewards-api.xcadnetwork.com/distribution/data/0x96c300ce0697e3524190943cd05681d7abe7c1ca/1

address

https://rewards-api.xcadnetwork.com/distribution/data/0x96c300ce0697e3524190943cd05681d7abe7c1ca/1?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/distribution/data/0x96c300ce0697e3524190943cd05681d7abe7c1ca/1?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

Sample Data

Field
Description

distributor_address

The address of the rewards distributor smart contract, Hex format

epoch_number

The epoch number that this data applies to

address_bech32

The address of the user to be rewarded, Bech32 format

address_hex

The address of the user to be rewarded, Hex format

amount

The amount of token to reward this user for this epoch, the reward token is defined Distribution Info

proof

The Merkle branch for this user's reward for this epoch. Each node is separated by a space ' '.

The first node is he hash of the users address and the rewards amount ( the leaf), the last node is the Merkle root.

Removing the leaf and the root, all the remaining nodes is the Merkle proof that can used to claim the rewards from the distributor smart contract

Get Estimated Distribution Amount - /distribution/estimated_amounts/{user_address}

Get the estimated amount of rewards for the current epochs for all distribution for the given address. Given a user address return list of Pools and Estimated reward amount for the current epoch

https://rewards-api.xcadnetwork.com/distribution/estimated_amounts/BECH32Address

Route Parameter
Description

user_address

The address of the initiator, Bech32 format - Filter by user address

Filter
Example Url

address

http://localhost:3010/distribution/estimated_amounts/zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/distribution/estimated_amounts/zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/distribution/estimated_amounts/zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

Sample Data

ObjectKey
Description

"0x96c300ce0697e3524190943cd05681d7abe7c1ca"

Adddress of the Reward Distributor Smart Contract

"zil1z5l74hwy3pc3pr3gdh3nqju4jlyp0dzkhq2f5y"

ZIL pool, in this example ZIL-XCAD pool

135535305328410623

Amount of token reward for this user from ZIL-XCAD pool

"0x153feaddc48871108e286de3304b9597c817b456,0x818ca2e217e060ad17b7bd0124a483a1f66930a9"

XCAD ppol, in this example XCAD-zUSDT pool

309029689620617248

Amount of token reward for this user from XCAD-zUSDT pool

Get Distribution Data for Address - /distribution/claimable_data/{user_address}

Get unclaimed distributions for the given address. Return data is required for making reward claims.

http://rewards-api.xcadnetwork.com/distribution/claimable_data/zil150uv303w8ttzcml8w200ptzq957637wel8p8ev

Route Parameter
Description

user_address

The address of the initiator, Bech32 format - Filter by user address

Filter
Example Url

address

http://localhost:3010/distribution/claimable_data/zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/distribution/claimable_data/zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/distribution/claimable_data/zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

Sample Data

Field
Description

distributor_address

The address of the rewards distributor smart contract, Hex format

epoch_number

The epoch number that this data applies to

address_bech32

The address of the user to be rewarded, Bech32 format

address_hex

The address of the user to be rewarded, Hex format

amount

The amount of token to reward this user for this epoch, the reward token is defined Distribution Info

proof

The Merkle branch for this user's reward for this epoch. Each node is separated by a space ' '.

The first node is he hash of the users address and the rewards amount ( the leaf), the last node is the Merkle root.

Removing the leaf and the root, all the remaining nodes is the Merkle proof that can used to claim the rewards from the distributor smart contract

TODO: get sample data

Get Claims - /claims

Get all claims, optionally filtered by address and/or distributor address

Get records of rewards claims the users made

https://rewards-api.xcadnetwork.com/claims

Parameter
Description

per_page

The number of records per page (default 10, max 50)

page

The page to retrieve - Paging

address

The address of the initiator, Bech32 format - Filter by user address

distr_address

The Reward Distribuitor address, TODO: WhichFromat? Bech32 address - Fillter by distributor address

epoch_number

The epoch number - Filter by epoch

Examples

Filter
Example Url

per_page

http://localhost:3010/claims?per_page=50

https://rewards-api.xcadnetwork.com/claims?per_page=50

page

http://localhost:3010/claims?page=2

https://rewards-api.xcadnetwork.com/claims?page=2

address

http://localhost:3010/claims?address=zil144x80aulkm468jxul3twhu2zzfzcjql6suhma5

https://rewards-api.xcadnetwork.com/claims?address=zil19e24266mg4pmxzvm24v92c53lfd4kd4cadc6xl

https://rewards-api.xcadnetwork.com/claims?address=zil1dmqtvyp3paq08m466mecuya650xhxh3jx3mmyf

distr_address

http://localhost:3010/claims?distr_address=TODO:

https://rewards-api.claims.com/liquidity_changes?distr_address=TODO:

epoch_number

http://localhost:3010/claims?epoch_number=0

https://rewards-api.xcadnetwork.com/claims?epoch_number=0

Sample Data

Last updated