Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Add XST based pools support #95

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
VAL_ID = "0x0200040000000000000000000000000000000000000000000000000000000000"
PSWAP_ID = "0x0200050000000000000000000000000000000000000000000000000000000000"
XSTUSD_ID = "0x0200080000000000000000000000000000000000000000000000000000000000"
XST_ID = "0x0200090000000000000000000000000000000000000000000000000000000000"
KXOR_ID = "0x02000e0000000000000000000000000000000000000000000000000000000000"
ETH_ID="0x0200070000000000000000000000000000000000000000000000000000000000"
TECH_ACCOUNT = (
Expand Down Expand Up @@ -73,7 +74,9 @@ def is_eth_kxor_pair(input_asset_type, output_asset_type):
return (input_asset_type == KXOR_ID or output_asset_type == KXOR_ID) \
and (input_asset_type == ETH_ID or output_asset_type == ETH_ID)


def is_xst_based_pair(input_asset_type, output_asset_type):
return input_asset_type == XST_ID or output_asset_type == XST_ID

def set_max_amount(value, current_value):
if current_value is None or value > current_value:
return value
Expand Down Expand Up @@ -145,7 +148,8 @@ def process_swap_transaction(timestamp, extrinsicEvents, ex_dict, prices):

if ((dex_id == 0 and input_asset_type != XOR_ID and output_asset_type != XOR_ID) \
or (dex_id == 1 and input_asset_type != XSTUSD_ID and output_asset_type != XSTUSD_ID)) \
and (not is_eth_kxor_pair(input_asset_type, output_asset_type)):
and (not is_eth_kxor_pair(input_asset_type, output_asset_type)) \
and (not is_xst_based_pair(input_asset_type, output_asset_type)):
assert len(intermediate_amounts) > 0 , ex_dict

return Swap(
Expand Down
Loading