From c289b9abf581bc1c6b44d9a85f13715e83dfdb13 Mon Sep 17 00:00:00 2001 From: Cyril B Date: Fri, 21 Apr 2023 11:12:28 +0200 Subject: [PATCH 001/108] pipelines: commit to trigger cicd --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba2b4b56..adce7501 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The aim of the batch clearing dex is to enable users to deposit tokens with the After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. -## Deposit +## Deposit The deposit window is open for a finite time period. During the time period users can deposit their tokens for a BUY or SELL order on the token pair along with an offset to the future received oracle price. From 6ac33ccb94cfbdae2742d2a9db432b4e6031584e Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 21 Apr 2023 10:17:50 +0100 Subject: [PATCH 002/108] Added michelson files to repo for both mainnet and ghostnet --- batcher/Makefile | 18 +- batcher/batcher-mainnet.tz | 3962 +++++++++++++++++++++++++++ batcher/batcher-storage-ghostnet.tz | 2 +- batcher/batcher-storage-mainnet.tz | 35 + 4 files changed, 4010 insertions(+), 7 deletions(-) create mode 100644 batcher/batcher-mainnet.tz create mode 100644 batcher/batcher-storage-mainnet.tz diff --git a/batcher/Makefile b/batcher/Makefile index 4ac03bbc..cbdcfb91 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -24,19 +24,25 @@ define install_deps $(LIGO_DOCKER) install endef -define clean_files - rm -rf *.tz - rm -rf batcher/*.tz +define clean_mainnet_files + rm -rf *mainnet.tz + rm -rf batcher/*mainnet.tz +endef + +define clean_ghostnet_files + rm -rf *ghostnet.tz + rm -rf batcher/*ghostnet.tz endef clean: - $(call clean_files) + $(call clean_mainnet_files) + $(call clean_ghostnet_files) build-mainnet: - $(call clean_files) + $(call clean_mainnet_files) $(call compile_contract,batcher.mligo, batcher-mainnet.tz) $(call compile_storage,storage/initial_storage_mainnet.mligo, batcher-storage-mainnet.tz) build-ghostnet: - $(call clean_files) + $(call clean_ghostnet_files) $(call compile_contract,batcher.mligo, batcher-ghostnet.tz) $(call compile_storage,storage/initial_storage_ghostnet.mligo, batcher-storage-ghostnet.tz) build-tzBTC: diff --git a/batcher/batcher-mainnet.tz b/batcher/batcher-mainnet.tz new file mode 100644 index 00000000..3e6c61f5 --- /dev/null +++ b/batcher/batcher-mainnet.tz @@ -0,0 +1,3962 @@ +{ parameter + (or (or (or (or (pair %add_or_update_metadata (string %key) (bytes %value)) + (pair %add_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + (or (nat %amend_token_and_pair_limit) (address %change_admin_address))) + (or (or (nat %change_deposit_time_window) (mutez %change_fee)) + (or (pair %change_oracle_source_of_pair + (string %pair_name) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision)) + (nat %change_scale_factor)))) + (or (or (or (pair %deposit + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (timestamp %created_at) + (nat %side) + (nat %tolerance)) + (string %disable_swap_pair_for_deposit)) + (or (string %enable_swap_pair_for_deposit) (unit %redeem))) + (or (or (string %remove_metadata) + (pair %remove_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + (string %tick)))) ; + storage + (pair (pair (pair (pair (address %administrator) + (pair %batch_set + (map %current_batch_indices string nat) + (big_map %batches + nat + (pair (nat %batch_number) + (or %status + (or (pair %cleared + (pair (timestamp %at) + (pair %clearing + (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) + (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) + (pair %total_cleared_volumes + (nat %buy_side_total_cleared_volume) + (nat %buy_side_volume_subject_to_clearing) + (nat %sell_side_total_cleared_volume) + (nat %sell_side_volume_subject_to_clearing)) + (pair %clearing_rate + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (pair %rate (int %p) (int %q)) + (timestamp %when)))) + (pair %rate + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (pair %closed (timestamp %closing_time) (timestamp %start_time))) + (timestamp %open)) + (pair %volumes + (nat %buy_minus_volume) + (nat %buy_exact_volume) + (nat %buy_plus_volume) + (nat %buy_total_volume) + (nat %sell_minus_volume) + (nat %sell_exact_volume) + (nat %sell_plus_volume) + (nat %sell_total_volume)) + (pair %pair + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)))))) + (nat %deposit_time_window_in_seconds) + (mutez %fee_in_mutez)) + (pair (address %fee_recipient) (nat %last_order_number)) + (nat %limit_on_tokens_or_pairs) + (big_map %metadata string bytes)) + (pair (pair (big_map %rates_current + string + (pair (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (nat %scale_factor_for_oracle_staleness)) + (big_map %user_batch_ordertypes + address + (map nat + (map (pair (or %side (unit %buy) (unit %sell)) + (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) + nat))) + (map %valid_swaps + string + (pair (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits)))) + (map %valid_tokens + string + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)))) ; + code { LAMBDA + (pair nat nat) + nat + { UNPAIR ; + PUSH nat 1 ; + DUG 2 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } } ; + PUSH int 1 ; + PUSH int 10000 ; + PAIR ; + PUSH int 1 ; + PUSH int 10001 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + LAMBDA + (pair (pair (pair nat string (option address) nat (option string)) nat) + (map string (pair (pair nat string (option address) nat (option string)) nat))) + (map string (pair (pair nat string (option address) nat (option string)) nat)) + { UNPAIR ; + SWAP ; + UNIT ; + RIGHT unit ; + DIG 2 ; + DUP ; + CAR ; + GET 3 ; + DUP 4 ; + DUP 2 ; + GET ; + IF_NONE + { DIG 2 ; DROP ; SWAP ; SOME ; SWAP ; UPDATE } + { DIG 3 ; + IF_LEFT + { DROP ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + COMPARE ; + GT ; + IF { DROP ; PUSH nat 111 ; FAILWITH } + { DUP 3 ; CDR ; SWAP ; CDR ; SUB ; ABS } } + { DROP ; CDR ; DUP 3 ; CDR ; ADD } ; + DIG 3 ; + DIG 3 ; + DIG 2 ; + UPDATE 2 ; + SOME ; + DIG 2 ; + UPDATE } } ; + LAMBDA + (pair int int) + int + { UNPAIR ; + SWAP ; + PUSH int 1 ; + PAIR ; + LEFT int ; + LOOP_LEFT + { UNPAIR ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { SWAP ; DROP ; RIGHT (pair int int) } + { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; + SWAP ; + DROP } ; + DIG 4 ; + UNPAIR ; + IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + DROP 4 ; + IF_LEFT + { IF_LEFT + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DUP 6 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CAR ; + GET ; + IF_NONE + { DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CDR ; + DIG 6 ; + CAR ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DROP ; + DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CDR ; + SOME ; + DIG 6 ; + CAR ; + UPDATE } ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + PAIR } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 6 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + CAR ; + CDR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + GET 7 ; + COMPARE ; + NEQ ; + IF { DROP 2 ; PUSH nat 133 ; FAILWITH } + { DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + CAR ; + CDR ; + CDR ; + CAR ; + DUP 3 ; + CAR ; + DUP ; + CAR ; + CAR ; + DUP 2 ; + CDR ; + DUP 4 ; + PUSH nat 1 ; + DUP 7 ; + SIZE ; + ADD ; + COMPARE ; + GT ; + IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } + { PUSH bool False ; + DUP 8 ; + CDR ; + CDR ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 9 ; + CDR ; + CDR ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + AND ; + IF { PUSH nat 0 } + { PUSH bool False ; + DUP 8 ; + CDR ; + CDR ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 9 ; + CDR ; + CDR ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + OR ; + IF { PUSH nat 1 } { PUSH nat 2 } } ; + DIG 4 ; + SWAP ; + DUP 8 ; + CDR ; + CDR ; + SIZE ; + ADD ; + COMPARE ; + GT ; + IF { PUSH nat 126 ; FAILWITH } {} } ; + DUP 3 ; + CAR ; + CAR ; + GET 3 ; + DIG 3 ; + CDR ; + GET 3 ; + DUP 5 ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + GET ; + IF_NONE + { DUP 5 ; + CDR ; + CDR ; + DUP ; + DUP 4 ; + GET 3 ; + GET ; + IF_NONE + { DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 4 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 7 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DUP 2 ; DIG 2 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP 3 ; + CAR ; + DUP ; + CAR ; + CAR ; + GET 3 ; + SWAP ; + CDR ; + GET 3 ; + DIG 3 ; + DIG 4 ; + DUP 4 ; + DUP 4 ; + COMPARE ; + GT ; + IF { DIG 3 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } + { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + PAIR } + { DROP 5 ; PUSH nat 116 ; FAILWITH } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } } } } } + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 128 ; FAILWITH } + { DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 129 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } + { IF_LEFT + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 600 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 131 ; FAILWITH } + { PUSH nat 3600 ; + DUP 2 ; + COMPARE ; + GT ; + IF { DROP 2 ; PUSH nat 132 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 2 ; + GET 3 ; + UPDATE 3 ; + DUP 2 ; + GET 5 ; + UPDATE 5 ; + DUP 2 ; + GET 6 ; + UPDATE 7 ; + DUP ; + GET 3 ; + DUP 2 ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 123 ; FAILWITH } { DROP } ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 6 ; + CDR ; + CAR ; + CDR ; + CDR ; + DIG 5 ; + SOME ; + DIG 6 ; + CAR ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + PAIR } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 1 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 135 ; FAILWITH } + { PUSH nat 10 ; + DUP 2 ; + COMPARE ; + GT ; + IF { DROP 2 ; PUSH nat 136 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + PAIR } } } } } } + { IF_LEFT + { DIG 2 ; + DIG 4 ; + DROP 2 ; + IF_LEFT + { DIG 2 ; + DIG 3 ; + DROP 2 ; + IF_LEFT + { DUP ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 2 ; + CAR ; + SWAP ; + IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; + PAIR ; + NOW ; + DUP 4 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + GET 8 ; + IF { DROP 4 ; PUSH nat 125 ; FAILWITH } + { DUP 4 ; + CAR ; + CAR ; + CDR ; + CDR ; + AMOUNT ; + DUP 2 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 6 ; PUSH nat 113 ; FAILWITH } + { DUP 2 ; + SWAP ; + COMPARE ; + GT ; + IF { DROP 5 ; PUSH nat 130 ; FAILWITH } + { DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 7 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + DUP 5 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) + (pair timestamp timestamp)) ; + DIG 3 ; + PAIR 4 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + DUP 5 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) + (pair timestamp timestamp)) ; + DIG 3 ; + PAIR 4 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DROP 2 ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } + { DUP 3 ; + INT ; + ADD ; + DIG 4 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } } ; + SWAP ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DIG 3 ; DROP } + { DUP 6 ; + CDR ; + CAR ; + CDR ; + CDR ; + DIG 4 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 124 ; FAILWITH } {} ; + CAR ; + DUP 6 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + DUP 7 ; + CDR ; + CAR ; + CAR ; + CDR ; + INT ; + MUL ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP 2 ; + CAR ; + PUSH nat 1 ; + DUP 3 ; + CAR ; + CDR ; + CAR ; + CDR ; + ADD ; + DUP 7 ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 8 ; + GET 6 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; RIGHT unit ; LEFT unit } + { PUSH nat 1 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit ; LEFT unit } + { PUSH nat 2 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; + SENDER ; + DUP 6 ; + CDR ; + CDR ; + DUP 11 ; + CAR ; + DUP ; + CAR ; + CAR ; + DUP 2 ; + CDR ; + DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DUP ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 2 ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + AND ; + IF { DUP 7 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 5 ; + IF_LEFT + { DROP ; DUP 2 ; CDR ; DUP 3 ; CAR ; CAR } + { DROP ; DUP 2 ; CAR ; CAR ; DUP 3 ; CDR } ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + MEM ; + IF {} { DROP ; PUSH nat 110 ; FAILWITH } } + { DROP ; PUSH nat 110 ; FAILWITH } } } ; + PUSH bool False ; + DIG 3 ; + DIG 4 ; + DIG 11 ; + CAR ; + DIG 5 ; + DUP 8 ; + DUP 8 ; + PAIR 7 ; + SWAP ; + UPDATE 7 ; + DUP 4 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET 5 ; + GET ; + IF_NONE + { PUSH bool True } + { PUSH nat 0 ; + SWAP ; + ITER { CDR ; SIZE ; ADD } ; + PUSH nat 10 ; + SWAP ; + COMPARE ; + LE } ; + IF { DUP ; + GET 5 ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DUP 5 ; + CDR ; + CAR ; + CDR ; + CAR ; + EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DUP 6 ; + GET 11 ; + DUP 7 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DUP 7 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 2 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 6 ; + GET ; + IF_NONE + { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DUP 5 ; + GET 11 ; + DUP 6 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DUP 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP 4 ; + GET 11 ; + DUP 5 ; + GET 9 ; + PAIR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DUP 5 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 6 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; + SOME ; + DUP 6 ; + UPDATE } ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + SWAP ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP 6 ; + GET 5 ; + DUP 3 ; + GET 9 ; + IF_LEFT + { DROP ; + DUP 3 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 7 ; + ADD ; + DUP 4 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 3 ; + ADD ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + CAR ; + ADD ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 5 ; + ADD ; + UPDATE 5 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 3 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 14 ; + ADD ; + DUP 4 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 11 ; + ADD ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 9 ; + ADD ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } + { DROP ; + DUP 2 ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 13 ; + ADD ; + UPDATE 13 ; + SWAP ; + UPDATE 14 } } ; + DUP 6 ; + DUP 7 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 12 ; + DIG 12 ; + CDR ; + DIG 12 ; + DIG 7 ; + UPDATE 5 ; + SOME ; + DIG 10 ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + SELF_ADDRESS ; + DIG 4 ; + CAR ; + CDR ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { DIG 4 ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 5 ; UNIT ; TRANSFER_TOKENS } ; + DUP 5 ; + GET 7 ; + CAR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DIG 2 ; DIG 5 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 6 ; + GET 5 ; + DUP 3 ; + CAR ; + GET 8 ; + IF_NONE + { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + SWAP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 3 ; + CDR ; + DIG 5 ; + DIG 4 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { SWAP ; + CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 6 ; + CDR ; + DIG 6 ; + CAR ; + CAR ; + DIG 8 ; + PAIR 3 ; + CONS ; + DIG 4 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 6 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + DIG 2 ; + CONS ; + DIG 2 ; + CONS ; + PAIR } + { DROP 7 ; PUSH nat 112 ; FAILWITH } } + { DROP 6 ; PUSH nat 103 ; FAILWITH } } } } } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 6 ; + CDR ; + CAR ; + CDR ; + CDR ; + DIG 5 ; + PUSH bool True ; + UPDATE 8 ; + SOME ; + DIG 6 ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + PAIR } } + { IF_LEFT + { DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 6 ; + CDR ; + CAR ; + CDR ; + CDR ; + DIG 5 ; + PUSH bool False ; + UPDATE 8 ; + SOME ; + DIG 6 ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation } + { DROP ; + SENDER ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SELF_ADDRESS ; + DUP 3 ; + CDR ; + CAR ; + CDR ; + CAR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DUP 2 ; + DUP 5 ; + GET ; + IF_NONE + { DIG 5 ; DIG 6 ; DROP 2 ; SWAP } + { DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + DIG 2 ; + DUP 3 ; + PAIR ; + PAIR ; + SWAP ; + ITER { SWAP ; + UNPAIR ; + UNPAIR ; + DIG 3 ; + UNPAIR ; + DUP 5 ; + CDR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 2 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { CAR ; CDR ; SOME } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) } } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) } ; + IF_NONE + { DROP 3 } + { SWAP ; + GET 5 ; + DIG 5 ; + DIG 2 ; + PAIR ; + PAIR ; + DIG 2 ; + ITER { SWAP ; + UNPAIR ; + UNPAIR ; + DIG 3 ; + UNPAIR ; + PUSH nat 0 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { PUSH nat 0 ; + DUP 6 ; + GET 14 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { DUP ; + CDR ; + DUP 4 ; + GET 3 ; + DUP 3 ; + CAR ; + IF_LEFT + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } } + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } } } ; + IF { DUP 3 ; + GET 6 ; + CAR ; + SWAP ; + CAR ; + IF_LEFT + { DROP ; + DUP 3 ; + GET 5 ; + DUP ; + GET 5 ; + INT ; + SWAP ; + GET 3 ; + INT ; + DIG 3 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 4 ; + GET 6 ; + GET 3 ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 17 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 3 ; + CDR ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + CAR ; + CAR ; + PAIR ; + PAIR ; + DUP 11 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } + { DROP ; + DUP 3 ; + GET 5 ; + DUP ; + CAR ; + INT ; + SWAP ; + GET 6 ; + INT ; + DIG 3 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 4 ; + GET 6 ; + GET 3 ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 17 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 3 ; + CAR ; + CAR ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + CDR ; + PAIR ; + PAIR ; + DUP 11 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } } + { DIG 3 ; + DUP 4 ; + GET 6 ; + CAR ; + DIG 3 ; + DIG 3 ; + CAR ; + IF_LEFT { DROP ; SWAP ; CAR ; CAR } { DROP ; SWAP ; CDR } ; + PAIR ; + PAIR ; + DUP 11 ; + SWAP ; + EXEC } ; + DIG 2 ; + SWAP ; + DIG 2 ; + PAIR ; + PAIR } ; + CAR ; + CDR ; + DIG 3 ; + SWAP ; + DIG 3 ; + DIG 3 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; + UPDATE } } ; + PAIR ; + PAIR } ; + DIG 5 ; + DIG 6 ; + DROP 2 ; + CAR ; + UNPAIR ; + SWAP ; + DUG 2 ; + SOME ; + DUP 5 ; + UPDATE } ; + NIL operation ; + DIG 2 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 7 ; + DUP 7 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 10 ; + PAIR 3 ; + CONS ; + DUP 7 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 5 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP } ; + PAIR } } + { DIG 3 ; + DROP ; + IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DROP 3 ; + IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DIG 5 ; + NONE bytes ; + SWAP ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP ; + GET 8 ; + IF {} { PUSH nat 137 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + CAR ; + GET 3 ; + DIG 2 ; + CDR ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE + { DROP 2 ; PUSH nat 117 ; FAILWITH } + { DROP ; + DUP 3 ; + CDR ; + CDR ; + DIG 2 ; + CAR ; + DIG 2 ; + DUP 2 ; + CAR ; + CAR ; + GET 3 ; + DUP 3 ; + CDR ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + NONE (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + address + string + nat + bool) ; + SWAP ; + UPDATE ; + DUP 2 ; + CAR ; + CAR ; + DIG 2 ; + CDR ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + SWAP ; + DUP 2 ; + CAR ; + CAR ; + DUP ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DIG 2 ; + CDR ; + DUP ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP ; DIG 2 } + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP ; DIG 2 } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 3 ; + DIG 2 ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + SWAP ; + DUP 2 ; + CAR ; + CAR ; + DUP ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DIG 2 ; + CDR ; + DUP ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP } + { DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { SWAP ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 } ; + NIL operation ; + PAIR } + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 5 ; PUSH nat 117 ; FAILWITH } + { DUP ; + GET 3 ; + DUP 2 ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 122 ; FAILWITH } {} ; + UNPAIR ; + DUP 5 ; + CDR ; + CAR ; + CAR ; + CAR ; + DUP 5 ; + GET ; + IF_NONE + {} + { DUP 2 ; + SWAP ; + GET 4 ; + COMPARE ; + GE ; + IF { PUSH nat 121 ; FAILWITH } {} } ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + DUP 6 ; + CDR ; + CAR ; + CAR ; + CDR ; + INT ; + DUP 3 ; + DUG 2 ; + MUL ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } ; + DUP 3 ; + CAR ; + DIG 3 ; + GET 7 ; + DUP ; + DUP 3 ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + GET 7 ; + SUB ; + PUSH int 10 ; + PAIR ; + DUP 7 ; + SWAP ; + EXEC ; + DIG 3 ; + MUL ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 2 ; + CAR ; + CAR ; + GET 7 ; + INT ; + PUSH int 10 ; + PAIR ; + DUP 7 ; + SWAP ; + EXEC ; + SWAP } + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + INT ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DIG 2 ; + SWAP ; + DIG 2 ; + PAIR 3 ; + DUP ; + CAR ; + CAR ; + CAR ; + GET 7 ; + DUP 2 ; + CAR ; + CDR ; + GET 7 ; + SUB ; + DUP ; + ABS ; + INT ; + PUSH int 10 ; + PAIR ; + DIG 5 ; + SWAP ; + EXEC ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } + { PUSH int 0 ; + DIG 2 ; + COMPARE ; + LT ; + IF { PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + PUSH int 1 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL } + { PUSH int 1 ; SWAP } } ; + PAIR ; + DUP 2 ; + GET 3 ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + UPDATE 3 ; + DUP 3 ; + CDR ; + CAR ; + CAR ; + CAR ; + DUP 4 ; + DIG 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 5 ; + DUP 8 ; + GET ; + IF_NONE + { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } + { GET 4 ; + DUP 7 ; + GET 4 ; + COMPARE ; + GT ; + IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + DUP 2 ; + CAR ; + UNIT ; + LEFT unit ; + PAIR ; + NOW ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + DIG 2 ; + UNPAIR ; + IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; + PAIR ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CDR ; + DUP 4 ; + CAR ; + DUP 4 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP 2 ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair (pair nat string (option address) nat (option string)) + nat + string + (option address) + nat + (option string))) } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 3 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + SWAP ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) + (pair timestamp timestamp)) ; + DIG 3 ; + PAIR 4 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DROP 2 ; SWAP } } + { DIG 3 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DUP 5 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; SWAP } } ; + SWAP ; + SOME } ; + IF_NONE + { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 3 ; DROP 2 ; PUSH bool False } + { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } + { DIG 3 ; DROP 2 ; PUSH bool False } ; + IF { NOW ; + DUP 2 ; + GET 5 ; + DUP ; + GET 9 ; + INT ; + DUP 2 ; + GET 11 ; + INT ; + DUP 3 ; + GET 13 ; + INT ; + DUP 4 ; + CAR ; + INT ; + DUP 5 ; + GET 3 ; + INT ; + DUP 6 ; + GET 5 ; + INT ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR ; + PAIR ; + SWAP ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 8 ; + GET 3 ; + DUP 2 ; + CAR ; + CAR ; + DUP 4 ; + UNPAIR ; + UNPAIR ; + DUP 5 ; + DUP 15 ; + DIG 4 ; + DIG 4 ; + DIG 4 ; + ADD ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DUP 3 ; + CAR ; + UNPAIR ; + DUP 6 ; + UNPAIR ; + CDR ; + DIG 3 ; + DIG 3 ; + ADD ; + DUP 5 ; + DIG 3 ; + DIG 3 ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DIG 3 ; + UNPAIR ; + UNPAIR ; + DIG 6 ; + CDR ; + DUG 3 ; + ADD ; + ADD ; + DUP 5 ; + CDR ; + DUP 13 ; + CDR ; + MUL ; + DIG 5 ; + CAR ; + DUP 13 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 14 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 15 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 4 ; + CAR ; + DUP 7 ; + CDR ; + MUL ; + DUP 5 ; + CDR ; + DUP 8 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 8 ; + CDR ; + MUL ; + DUP 7 ; + CDR ; + DUP 9 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } + { DUP 4 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 4 ; + CDR ; + DUP 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 6 ; + CDR ; + DIG 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; + DUP 10 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 4 ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR 3 ; + PAIR 4 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + GET 3 ; + DUP 3 ; + CAR ; + ADD ; + DUP 3 ; + GET 13 ; + DIG 3 ; + GET 11 ; + ADD ; + SWAP } + { DROP ; + DUP 2 ; + GET 13 ; + DUP 3 ; + GET 11 ; + DUP 4 ; + GET 9 ; + ADD ; + ADD ; + DIG 2 ; + CAR } } + { DROP ; + DUP 2 ; + GET 5 ; + DUP 3 ; + GET 3 ; + DUP 4 ; + CAR ; + ADD ; + ADD ; + DIG 2 ; + GET 13 ; + SWAP } ; + DUP 3 ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 9 ; DROP 2 ; DUP 8 } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } ; + DUP 4 ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } + { DROP ; DUP 4 ; CAR ; GET 4 } ; + DUP 2 ; + GET 3 ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DIG 13 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 5 ; + DIG 5 ; + DIG 2 ; + DIG 5 ; + DIG 4 ; + PAIR 4 ; + UPDATE 5 ; + SWAP ; + UPDATE 6 ; + DIG 2 ; + DIG 5 ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + LEFT (pair timestamp timestamp) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DIG 3 ; + GET 6 ; + UNPAIR ; + GET 3 ; + SWAP ; + GET 3 ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } } } ; + view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; + view "get_valid_swaps" + unit + (map string + (pair (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + { CDR ; CDR ; CAR ; CDR ; CDR } ; + view "get_valid_tokens" + unit + (map string + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + { CDR ; CDR ; CDR } ; + view "get_current_batches" + unit + (list (pair (nat %batch_number) + (or %status + (or (pair %cleared + (pair (timestamp %at) + (pair %clearing + (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) + (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) + (pair %total_cleared_volumes + (nat %buy_side_total_cleared_volume) + (nat %buy_side_volume_subject_to_clearing) + (nat %sell_side_total_cleared_volume) + (nat %sell_side_volume_subject_to_clearing)) + (pair %clearing_rate + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (pair %rate (int %p) (int %q)) + (timestamp %when)))) + (pair %rate + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (pair %closed (timestamp %closing_time) (timestamp %start_time))) + (timestamp %open)) + (pair %volumes + (nat %buy_minus_volume) + (nat %buy_exact_volume) + (nat %buy_plus_volume) + (nat %buy_total_volume) + (nat %sell_minus_volume) + (nat %sell_exact_volume) + (nat %sell_plus_volume) + (nat %sell_total_volume)) + (pair %pair + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)))) + { CDR ; + NIL (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp))) + (pair (pair (pair (pair nat string (option address) nat (option string)) nat) + (pair nat string (option address) nat (option string))) + (pair int int) + timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair (pair nat string (option address) nat (option string)) + nat + string + (option address) + nat + (option string))) ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + ITER { CDR ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + SWAP ; + GET ; + IF_NONE {} { CONS } } ; + SWAP ; + DROP } } + diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index f57e2793..b837e60e 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -1,4 +1,4 @@ -(Pair (Pair (Pair (Pair "tz1ca4batAsNxMYab3mUK5H4QRjY8drV4ViL" {} {}) 600 10000) +(Pair (Pair (Pair (Pair "tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" {} {}) 600 10000) (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) 10 {}) diff --git a/batcher/batcher-storage-mainnet.tz b/batcher/batcher-storage-mainnet.tz new file mode 100644 index 00000000..395cdef0 --- /dev/null +++ b/batcher/batcher-storage-mainnet.tz @@ -0,0 +1,35 @@ +(Pair (Pair (Pair (Pair "tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" {} {}) 600 10000) + (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) + 10 + {}) + (Pair (Pair {} 1) + {} + { Elt "tzBTC/EURL" + (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) + 1) + 0 + "EURL" + (Some "KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8") + 6 + (Some "FA2 token")) + "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" + "BTC-EUR" + 6 + False) ; + Elt "tzBTC/USDT" + (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) + 1) + 0 + "USDT" + (Some "tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp") + 6 + (Some "FA2 token")) + "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" + "BTC-USDT" + 6 + False) }) + { Elt "EURL" (Pair 0 "EURL" (Some "KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8") 6 (Some "FA2 token")) ; + Elt "USDT" (Pair 0 "USDT" (Some "tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp") 6 (Some "FA2 token")) ; + Elt "tzBTC" + (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) }) + From f4c6dc57e8ec5650f0d1e565049f83402c52bfee Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 21 Apr 2023 12:45:46 +0100 Subject: [PATCH 003/108] Added metadata file --- batcher/metadata.json | 325 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 batcher/metadata.json diff --git a/batcher/metadata.json b/batcher/metadata.json new file mode 100644 index 00000000..e5d0f855 --- /dev/null +++ b/batcher/metadata.json @@ -0,0 +1,325 @@ +{ + "name": "Batcher", + "authors": [ + "Marigold.dev" + ], + "homepage": "https://marigold.dev/batcher", + "description": "Batcher - Batch Clearing DEX", + "version": "1.0.0", + "license": { + "name": "MIT", + "details": "https://github.com/marigold-dev/batcher/blob/main/LICENSE" + }, + "source": { + "tools": [ + "cameligo" + ], + "location": "https://github.com/marigold-dev/batcher/" + }, + "errors": [ + { + "error": { + "nat": "100" + }, + "expansion": { + "string": "no rate available for swap" + } + }, + { + "error": { + "nat": "101" + }, + "expansion": { + "string": "invalid token address" + } + }, + { + "error": { + "nat": "102" + }, + "expansion": { + "string": "invalid tezos address" + } + }, + { + "error": { + "nat": "103" + }, + "expansion": { + "string": "no open batch for deposits" + } + }, + { + "error": { + "nat": "104" + }, + "expansion": { + "string": "batch should be cleared" + } + }, + { + "error": { + "nat": "105" + }, + "expansion": { + "string": "trying to close batch which is not open" + } + }, + { + "error": { + "nat": "106" + }, + "expansion": { + "string": "unable to parse side from external order" + } + }, + { + "error": { + "nat": "107" + }, + "expansion": { + "string": "unable to parse tolerance from external order" + } + }, + { + "error": { + "nat": "108" + }, + "expansion": { + "string": "token standard not foundg" + } + }, + { + "error": { + "nat": "109" + }, + "expansion": { + "string": "xtz not currently supported" + } + }, + { + "error": { + "nat": "110" + }, + "expansion": { + "string": "unsupported swap type" + } + }, + { + "error": { + "nat": "111" + }, + "expansion": { + "string": "unable to reduce token amount to less than zero" + } + }, + { + "error": { + "nat": "112" + }, + "expansion": { + "string": "too many unredeemed orders" + } + }, + { + "error": { + "nat": "113" + }, + "expansion": { + "string": "insufficient swap fee" + } + }, + { + "error": { + "nat": "114" + }, + "expansion": { + "string": "sender not administrator" + } + }, + { + "error": { + "nat": "115" + }, + "expansion": { + "string": "token already exists but details are different" + } + }, + { + "error": { + "nat": "116" + }, + "expansion": { + "string": "swap already exists" + } + }, + { + "error": { + "nat": "117" + }, + "expansion": { + "string": "swap does not exist" + } + }, + { + "error": { + "nat": "118" + }, + "expansion": { + "string": "endpoint does not accept tez" + } + }, + { + "error": { + "nat": "119" + }, + "expansion": { + "string": "number is not a natg" + } + }, + { + "error": { + "nat": "120" + }, + "expansion": { + "string": "oracle price is stale" + } + }, + { + "error": { + "nat": "121" + }, + "expansion": { + "string": "oracle price is not timely" + } + }, + { + "error": { + "nat": "122" + }, + "expansion": { + "string": "unable to get price from oracle" + } + }, + { + "error": { + "nat": "123" + }, + "expansion": { + "string": "unable to get price from new oracle source" + } + }, + { + "error": { + "nat": "124" + }, + "expansion": { + "string": "oracle price should be available before deposit" + } + }, + { + "error": { + "nat": "125" + }, + "expansion": { + "string": "swap is disabled for deposits" + } + }, + { + "error": { + "nat": "126" + }, + "expansion": { + "string": "upper limit on tokens has been reached" + } + }, + { + "error": { + "nat": "127" + }, + "expansion": { + "string": "upper limit on swap pairs has been reached" + } + }, + { + "error": { + "nat": "128" + }, + "expansion": { + "string": "cannot reduce limit on tokens to less than already exists" + } + }, + { + "error": { + "nat": "129" + }, + "expansion": { + "string": "cannot reduce limit on swap pairs to less than already exists" + } + }, + { + "error": { + "nat": "130" + }, + "expansion": { + "string": "more tez sent than fee cost" + } + }, + { + "error": { + "nat": "131" + }, + "expansion": { + "string": "cannot update deposit window to less than the minimum" + } + }, + { + "error": { + "nat": "132" + }, + "expansion": { + "string": "cannot update deposit window to more than the maximum" + } + }, + { + "error": { + "nat": "133" + }, + "expansion": { + "string": "oracle must be equal to minimum precision" + } + }, + { + "error": { + "nat": "134" + }, + "expansion": { + "string": "swap precision is less than minimum" + } + }, + { + "error": { + "nat": "135" + }, + "expansion": { + "string": "cannot update scale factor to less than the minimum" + } + }, + { + "error": { + "nat": "136" + }, + "expansion": { + "string": "cannot update scale factor to more than the maximum" + } + }, + { + "error": { + "nat": "137" + }, + "expansion": { + "string": "cannot remove swap pair that is not disabled" + } + } + ] +} From b797f984d85961fdbfc84d8e4f0a59805a02696a Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Sun, 23 Apr 2023 20:22:16 +0100 Subject: [PATCH 004/108] Fixed issue with wallet disconnecting --- batcher-ui/src/app.tsx | 5 +- .../src/components/RightContent/index.tsx | 72 ++++++++++++++----- batcher-ui/src/pages/Main.tsx | 22 +----- 3 files changed, 59 insertions(+), 40 deletions(-) diff --git a/batcher-ui/src/app.tsx b/batcher-ui/src/app.tsx index 5747ad8d..10895c4f 100644 --- a/batcher-ui/src/app.tsx +++ b/batcher-ui/src/app.tsx @@ -1,6 +1,8 @@ import Footer from '@/components/Footer'; import React, { useState, useEffect } from 'react'; import RightContent from '@/components/RightContent'; +import { AccountInfo } from "@airgap/beacon-sdk"; +import { BeaconWallet } from "@taquito/beacon-wallet"; import { PageLoading } from '@ant-design/pro-components'; import type { RunTimeLayoutConfig } from 'umi'; import defaultSettings from '../config/defaultSettings'; @@ -17,7 +19,8 @@ export const initialStateConfig = { export async function getInitialState(): Promise { return { wallet: null, - storedUserAddress: null, + userAddress: null, + userAccount: null, settings: defaultSettings, }; } diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index d506d026..52543171 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -8,6 +8,7 @@ import { BeaconWallet } from '@taquito/beacon-wallet'; import { getNetworkType } from '@/extra_utils/utils'; import '@/components/RightContent/index.less'; import { connection } from '@/extra_utils/webSocketUtils'; +import { LocalStorage } from "@airgap/beacon-sdk"; export type SiderTheme = 'light' | 'dark'; @@ -25,14 +26,14 @@ const GlobalHeaderRight: React.FC = () => { className = `${styles.right} ${styles.dark}`; } - const { storedUserAddress } = initialState; + const { userAddress } = initialState; const items: MenuProps['items'] = [ { key: '1', label: ( - {!storedUserAddress ? 'Connect Wallet' : 'Disconnect Wallet'} + {!userAddress ? 'Connect Wallet' : 'Disconnect Wallet'} ), }, @@ -40,57 +41,92 @@ const GlobalHeaderRight: React.FC = () => { const menuProps = { items, - onClick: !storedUserAddress ? () => connectWallet() : () => disconnectWallet(), + onClick: !userAddress ? () => connectWallet() : () => disconnectWallet(), }; const Tezos = new TezosToolkit(REACT_APP_TEZOS_NODE_URI); const connectWallet = async () => { - if (!storedUserAddress) { - const updatedWallet = new BeaconWallet({ + console.info("=== STATE === state change check ", initialState); + if (!userAddress) { + const wallet = new BeaconWallet({ name: 'batcher', preferredNetwork: getNetworkType(), }); - await updatedWallet.requestPermissions({ + await wallet.requestPermissions({ network: { type: getNetworkType(), rpcUrl: REACT_APP_TEZOS_NODE_URI, }, }); - Tezos.setWalletProvider(updatedWallet); - const activeAccount = await updatedWallet.client.getActiveAccount(); - const userAddressFromWallet = activeAccount ? await updatedWallet.getPKH() : null; - setInitialState({ ...initialState, wallet: updatedWallet, storedUserAddress: userAddressFromWallet }); - console.log("Setting initialState", initialState); - //localStorage.setItem('storedUserAddress', userAddressFromWallet); + Tezos.setWalletProvider(wallet); + const activeAccount = await wallet.client.getActiveAccount(); + const userAddress = activeAccount ? await wallet.getPKH() : null; + let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount }; + + localStorage.setItem("state", JSON.stringify(updatedState)); + console.log("localstroage - after connect", localStorage); + setInitialState(updatedState); + console.log("Setting initialState", updatedState); } }; const disconnectWallet = async () => { await connection.stop(); - setInitialState({ ...initialState, wallet: null, storedUserAddress: null }); - localStorage.removeItem('storedUserAddress'); + let updatedState = { ...initialState, wallet: null, userAddress: null, userAccount:null }; + localStorage.setItem("state", JSON.stringify(updatedState)); + setInitialState(updatedState); }; const scrollToTop = () => { window.scrollTo(0, 0); }; + const newWallet = () => { + + return new BeaconWallet({ + name: 'batcher', + preferredNetwork: getNetworkType(), + }); + + }; + + useEffect(() => { - // connectWallet(true); - }, []); + (async () => { + let localstate = JSON.parse(localStorage.getItem("state")); + let state = localstate !== null ? localstate : initialState + let wallet = newWallet(); + + try { + + const activeAccount = await wallet.client.getActiveAccount(); + if (activeAccount) { + console.info("=== STATE === no dep check - active account ", activeAccount); + const userAddress = await wallet.getPKH(); + let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount }; + localStorage.setItem("state", JSON.stringify(updatedState)); + setInitialState(updatedState); + + } + } catch (error) { + console.error(error); + } + + })(); + }, []); return (
diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 62abcff4..a3f06732 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -50,8 +50,7 @@ const Welcome: React.FC = () => { const [bigMapsByIdUri] = useState('' + chain_api_url + '/v1/bigmaps/'); const [inversion, setInversion] = useState(true); const { initialState, setInitialState } = useModel('@@initialState'); - const { wallet, storedUserAddress } = initialState; - const [userAddress, setUsrAddress] = useState(undefined); + const { wallet, userAddress } = initialState; const [buyToken, setBuyToken] = useState({ token_id: 0, @@ -542,19 +541,6 @@ const Welcome: React.FC = () => { }).then(r => setOraclePrice(r)); }; - const persistWallet = () => { - if (!userAddress) { - // eslint-disable-next-line @typescript-eslint/no-shadow - const wallet = new BeaconWallet({ - name: 'batcher', - preferredNetwork: getNetworkType(), - }); - Tezos.setWalletProvider(wallet); - setInitialState({...initialState, wallet: wallet, storedUserAddress: userAddress}).then(r => console.log(r)); - } else { - Tezos.setWalletProvider(wallet); - } - }; const [open, setOpen] = useState(false); const [swaps, setSwaps] = useState([]); @@ -723,7 +709,6 @@ const Welcome: React.FC = () => { await getTokenBalance(); await updateHoldings(storage); await getCurrentVolume(storage); - persistWallet(); }; @@ -777,11 +762,6 @@ const Welcome: React.FC = () => { refreshStorage().then(r => console.log(r)); }, [userAddress]); - useEffect(() => { - if(userAddress != storedUserAddress) - setUsrAddress(storedUserAddress); - }, [storedUserAddress]); - return (
From 53d4cb868d9139ada3cdbd6859ca68a1f2905d80 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Sun, 23 Apr 2023 22:01:53 +0100 Subject: [PATCH 005/108] Correctly assigned wallet after reload --- batcher-ui/src/app.tsx | 8 +- batcher-ui/src/components/Exchange/index.tsx | 9 +- batcher-ui/src/components/Holdings/index.tsx | 73 +++++---- .../src/components/RightContent/index.tsx | 23 ++- batcher-ui/src/extra_utils/types.ts | 20 +-- batcher-ui/src/pages/Main.tsx | 152 +++++++++--------- 6 files changed, 152 insertions(+), 133 deletions(-) diff --git a/batcher-ui/src/app.tsx b/batcher-ui/src/app.tsx index 10895c4f..8dc75eb9 100644 --- a/batcher-ui/src/app.tsx +++ b/batcher-ui/src/app.tsx @@ -9,7 +9,7 @@ import defaultSettings from '../config/defaultSettings'; import Main from './pages/Main'; import { Spin, Image } from 'antd'; import MarigoldLogo from '../img/marigold-logo.png'; - +import { TezosToolkit } from '@taquito/taquito'; Spin.setDefaultIndicator(); export const initialStateConfig = { @@ -27,7 +27,8 @@ export async function getInitialState(): Promise { export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { return { - rightContentRender: () => , + rightContentRender: () => , disableContentMargin: false, waterMarkProps: { content: initialState?.currentUser?.name, @@ -36,7 +37,8 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = menuHeaderRender: undefined, ...initialState?.settings, childrenRender: () => { - return
; + return
; }, }; }; diff --git a/batcher-ui/src/components/Exchange/index.tsx b/batcher-ui/src/components/Exchange/index.tsx index 266a9179..6910f844 100644 --- a/batcher-ui/src/components/Exchange/index.tsx +++ b/batcher-ui/src/components/Exchange/index.tsx @@ -10,7 +10,6 @@ import { ExchangeProps, PriceType, } from '@/extra_utils/types'; import { getErrorMess, scaleAmountUp } from '@/extra_utils/utils'; import { tzip12, Tzip12Module } from "@taquito/tzip12"; import { tzip16 } from "@taquito/tzip16"; - const Exchange: React.FC = ({ userAddress, buyBalance, @@ -26,10 +25,6 @@ const Exchange: React.FC = ({ setUpdateAll }: ExchangeProps) => { -// const DollarIcon = (props: Partial) => ( -// -// ); - const [price, setPrice] = useState(PriceType.EXACT); @@ -39,7 +34,6 @@ const Exchange: React.FC = ({ const [form] = Form.useForm(); - tezos.addExtension(new Tzip12Module()); const triggerUpdate = () => { setTimeout(function () { @@ -60,7 +54,10 @@ const Exchange: React.FC = ({ if (!userAddress) { return; } + + tezos.setWalletProvider(initialState.wallet); + console.info("tezos", initialState.tezos); const tokenName = inversion ? buyToken.name : sellToken.name; const selectedToken = inversion ? buyToken : sellToken; const batcherContract = await tezos.wallet.at(REACT_APP_BATCHER_CONTRACT_HASH); diff --git a/batcher-ui/src/components/Holdings/index.tsx b/batcher-ui/src/components/Holdings/index.tsx index 3d9e1c44..1f9ee6c0 100644 --- a/batcher-ui/src/components/Holdings/index.tsx +++ b/batcher-ui/src/components/Holdings/index.tsx @@ -1,25 +1,23 @@ -import React, { useEffect } from 'react'; -import { Button, Space, Typography, Col, message } from 'antd'; +import React, { useEffect, useContext } from 'react'; +import { Button, Space, Typography, Col, message, Table } from 'antd'; import '@/components/Exchange/index.less'; import '@/components/Holdings/index.less'; import '@/global.less'; import { HoldingsProps } from '@/extra_utils/types'; +import { useModel } from 'umi'; const Holdings: React.FC = ({ tezos, contractAddress, - buyToken, - sellToken, - buyTokenHolding, - sellTokenHolding, - setBuySideAmount, - setSellSideAmount, - buyTokenOpenHolding, - sellTokenOpenHolding, + openHoldings, + clearedHoldings, + setOpenHoldings, + setClearedHoldings, updateAll, setUpdateAll, }: HoldingsProps) => { + const { initialState } = useModel('@@initialState'); const triggerUpdate = () => { setTimeout(function () { @@ -29,12 +27,35 @@ const Holdings: React.FC = ({ }; + const generateHoldings = (dict:Map) => { + var data = []; + for (const key of dict) { + + data.push({ + token: key[0], + holding: key[1], + }); + }; + return ( + <> + { + data.map((h) => + + {h.holding} {h.token} | + + )} + + ); + + + }; const redeemHoldings = async (): Promise => { let loading = function () { return undefined; }; try { + tezos.setWalletProvider(initialState.wallet); const contractWallet = await tezos.wallet.at(contractAddress); let redeem_op = await contractWallet.methods.redeem().send(); @@ -45,8 +66,8 @@ const Holdings: React.FC = ({ message.error('Failed to redeem holdings'); console.error('Failed to redeem holdings' + confirm); } else { - setSellSideAmount(0); - setBuySideAmount(0); + setOpenHoldings(new Map()); + setClearedHoldings(new Map()); loading(); message.success('Successfully redeemed holdings'); triggerUpdate(); @@ -64,28 +85,24 @@ const Holdings: React.FC = ({ return ( - Holdings in Open/Closed Batches + Open/Closed Batches - - - {buyTokenOpenHolding} {buyToken.name} - - - {sellTokenOpenHolding} {sellToken.name} - + + Holdings => + | { + generateHoldings(openHoldings) + } - Holdings in Cleared Batches (Redeemable) + Cleared Batches (Redeemable) - - - {buyTokenHolding} {buyToken.name} - - - {sellTokenHolding} {sellToken.name} - + + Holdings => + { + generateHoldings(clearedHoldings) + } diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index 52543171..bc7318e6 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -1,5 +1,5 @@ import { Space, Button, Dropdown, Typography, MenuProps } from 'antd'; -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { useModel } from 'umi'; import styles from '@/components/RightContent/index.less'; import { MenuOutlined } from '@ant-design/icons'; @@ -14,7 +14,7 @@ export type SiderTheme = 'light' | 'dark'; const GlobalHeaderRight: React.FC = () => { const { initialState, setInitialState } = useModel('@@initialState'); - + const tezos = new TezosToolkit(REACT_APP_TEZOS_NODE_URI); if (!initialState || !initialState.settings) { return null; } @@ -26,14 +26,13 @@ const GlobalHeaderRight: React.FC = () => { className = `${styles.right} ${styles.dark}`; } - const { userAddress } = initialState; const items: MenuProps['items'] = [ { key: '1', label: ( - {!userAddress ? 'Connect Wallet' : 'Disconnect Wallet'} + {!initialState.userAddress ? 'Connect Wallet' : 'Disconnect Wallet'} ), }, @@ -41,14 +40,13 @@ const GlobalHeaderRight: React.FC = () => { const menuProps = { items, - onClick: !userAddress ? () => connectWallet() : () => disconnectWallet(), + onClick: !initialState.userAddress ? () => connectWallet() : () => disconnectWallet(), }; - const Tezos = new TezosToolkit(REACT_APP_TEZOS_NODE_URI); const connectWallet = async () => { console.info("=== STATE === state change check ", initialState); - if (!userAddress) { + if (!initialState.userAddress) { const wallet = new BeaconWallet({ name: 'batcher', preferredNetwork: getNetworkType(), @@ -60,10 +58,10 @@ const GlobalHeaderRight: React.FC = () => { }, }); - Tezos.setWalletProvider(wallet); + tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); const userAddress = activeAccount ? await wallet.getPKH() : null; - let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount }; + let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount}; localStorage.setItem("state", JSON.stringify(updatedState)); console.log("localstroage - after connect", localStorage); @@ -102,11 +100,12 @@ const GlobalHeaderRight: React.FC = () => { try { + tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); if (activeAccount) { console.info("=== STATE === no dep check - active account ", activeAccount); const userAddress = await wallet.getPKH(); - let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount }; + let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount, }; localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); @@ -123,10 +122,10 @@ const GlobalHeaderRight: React.FC = () => {
diff --git a/batcher-ui/src/extra_utils/types.ts b/batcher-ui/src/extra_utils/types.ts index 3f7d20fd..a69644d7 100644 --- a/batcher-ui/src/extra_utils/types.ts +++ b/batcher-ui/src/extra_utils/types.ts @@ -233,16 +233,10 @@ export type HoldingsProps = { tezos: TezosToolkit; userAddress: string; contractAddress: string; - buyToken: token; - sellToken: token; - buyTokenHolding: number; - sellTokenHolding: number; - setBuySideAmount: Dispatch>; - setSellSideAmount: Dispatch>; - buyTokenOpenHolding: number; - sellTokenOpenHolding: number; - setBuySideOpenAmount: Dispatch>; - setSellSideOpenAmount: Dispatch>; + openHoldings: Map; + clearedHoldings: Map; + setOpenHoldings: Dispatch>>; + setClearedHoldings: Dispatch>>; updateAll: boolean; setUpdateAll: Dispatch>; @@ -262,6 +256,7 @@ export type VolumeProps = { volumes: Volumes; }; + export const BUY = 'bUY'; export const SELL = 'sELL'; export const CLEARED = 'cleared'; @@ -269,3 +264,8 @@ export const CLEARED = 'cleared'; export const MINUS = 'mINUS'; export const EXACT = 'eXACT'; export const PLUS = 'pLUS'; + +export type tokens = { + buy_token_name: string; + sell_token_name: string; +} \ No newline at end of file diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index a3f06732..af3d06fc 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -8,12 +8,10 @@ import { ContentType, token, BatcherStatus, - CLEARED, - OPEN, Volumes, swap, + tokens, } from '@/extra_utils/types'; -import { TezosToolkit } from '@taquito/taquito'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; import { Space, Col, Row, Drawer, Radio, } from 'antd'; import { DoubleRightOutlined } from '@ant-design/icons'; @@ -21,7 +19,6 @@ import type { RadioChangeEvent } from 'antd'; import { useModel } from 'umi'; import { getEmptyVolumes, - getNetworkType, setTokenAmount, setSocketTokenAmount, scaleStringAmountDown, @@ -29,13 +26,12 @@ import { import { connection, init } from '@/extra_utils/webSocketUtils'; import { scaleAmountUp } from '@/extra_utils/utils'; import Holdings from '@/components/Holdings'; -import { BeaconWallet } from '@taquito/beacon-wallet'; +import { TezosToolkit } from '@taquito/taquito'; const Welcome: React.FC = () => { - - const [content, setContent] = useState(ContentType.SWAP); const [Tezos] = useState(new TezosToolkit(REACT_APP_TEZOS_NODE_URI)); + const [content, setContent] = useState(ContentType.SWAP); const [tokenMap, setTokenMap] = useState>(new Map()); const [ratesBigMapId, setRatesBigMapId] = useState(0); const [userBatchOrderTypesBigMapId, setUserBatchOrderTypesBigMapId] = useState(0); @@ -49,8 +45,8 @@ const Welcome: React.FC = () => { }); const [bigMapsByIdUri] = useState('' + chain_api_url + '/v1/bigmaps/'); const [inversion, setInversion] = useState(true); - const { initialState, setInitialState } = useModel('@@initialState'); - const { wallet, userAddress } = initialState; + const { initialState } = useModel('@@initialState'); + const { userAddress } = initialState; const [buyToken, setBuyToken] = useState({ token_id: 0, @@ -73,11 +69,8 @@ const Welcome: React.FC = () => { const [rate, setRate] = useState(0); const [status, setStatus] = useState(BatcherStatus.NONE); const [openTime, setOpenTime] = useState(null); - const [closeTime, setCloseTime] = useState(null); - const [buySideAmount, setBuySideAmount] = useState(0); - const [sellSideAmount, setSellSideAmount] = useState(0); - const [buySideOpenAmount, setBuySideOpenAmount] = useState(0); - const [sellSideOpenAmount, setSellSideOpenAmount] = useState(0); + const [clearedHoldings, setClearedHoldings] = useState>(new Map()); + const [openHoldings, setOpenHoldings] = useState>(new Map()); const [feeInMutez, setFeeInMutez] = useState(0); const [volumes, setVolumes] = useState(getEmptyVolumes()); const [updateAll, setUpdateAll] = useState(false); @@ -271,18 +264,25 @@ const Welcome: React.FC = () => { }; - const calculateHolidingFromBatch = (batch: any, ubots: any ) => { - let initialBuySideAmount = 0; - let initialSellSideAmount = 0; - let initialBuySideOpenAmount = 0; - let initialSellSideOpenAmount = 0; - - console.log("batch", batch); - console.log("ubots", ubots); - console.log("batch_number", batch.batch_number); + + const findTokensForBatch = (batch: any) => { + + const pair = batch.pair + const tokens:tokens = { + buy_token_name : pair.name_0, + sell_token_name : pair.name_1, + + } + return tokens; + }; + + + + const calculateHoldingFromBatch = (batch: any, ubots: any, open_holdings: Map , cleared_holdings: Map ) => { + + const tokens = findTokensForBatch(batch); const depositsInBatches = ubots.value; - console.log("depositsInBatches", depositsInBatches); const userBatchLength = depositsInBatches[batch.batch_number].length; if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED){ @@ -292,27 +292,27 @@ const Welcome: React.FC = () => { const depObject = ubots.value[batch.batch_number].at(j); const side = depObject.key.side; const value = depObject.value; + let initialBuySideOpenAmount = open_holdings.get(tokens.buy_token_name); + let initialSellSideOpenAmount = open_holdings.get(tokens.sell_token_name); const updatedValues = getOriginalDepositAmounts(side,initialBuySideOpenAmount, initialSellSideOpenAmount,value); initialBuySideOpenAmount += updatedValues.at(0); initialSellSideOpenAmount += updatedValues.at(1); + open_holdings.set(tokens.buy_token_name,initialBuySideOpenAmount); + open_holdings.set(tokens.sell_token_name, initialSellSideOpenAmount); } catch (error) { console.error(error); } } } else { - console.log("batch", batch); const cleared = batch.status.cleared; - console.log("cleared", cleared); const clearing = cleared.clearing; - console.log("clearing", clearing); const buy_side_cleared_volume = clearing.total_cleared_volumes.buy_side_total_cleared_volume; const sell_side_cleared_volume = clearing.total_cleared_volumes.sell_side_total_cleared_volume; const buy_side_volume_subject_to_clearing = clearing.total_cleared_volumes.buy_side_volume_subject_to_clearing; const sell_side_volume_subject_to_clearing = clearing.total_cleared_volumes.sell_side_volume_subject_to_clearing; let rate_data = clearing.clearing_rate.rate; - console.log("rate_data", rate_data); for (let j = 0; j < userBatchLength; j++) { try{ @@ -320,36 +320,46 @@ const Welcome: React.FC = () => { const side = depObject.key.side; const tol = depObject.key.tolerance; const value = depObject.value; - console.log("Deposit Side- " + j, side); - console.log("Deposit Tolerance- " + j, tol); - console.log("Deposit Value- " + j, value); if (buy_side_cleared_volume === 0 || sell_side_cleared_volume === 0 ){ - const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); - initialBuySideAmount += updatedValues.at(0); - initialSellSideAmount += updatedValues.at(1); + let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); + const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); + initialBuySideAmount += updatedValues.at(0); + initialSellSideAmount += updatedValues.at(1); + cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); + cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); } else { const wasInClearing = wasInClearingForBatch(side, tol,clearing.clearing_tolerance); if (wasInClearing) { if (Object.keys(side).at(0) === "buy") { + let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); const payout = convertHoldingToPayout(value,buy_side_volume_subject_to_clearing,buy_side_cleared_volume, sell_side_cleared_volume,buyToken.decimals, sellToken.decimals); initialSellSideAmount += payout.at(0); initialBuySideAmount += payout.at(1); - console.info("Deposit payout",payout); + cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); + cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); } else if (Object.keys(side).at(0) === "sell"){ + let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); const payout = convertHoldingToPayout(value,sell_side_volume_subject_to_clearing, sell_side_cleared_volume, buy_side_cleared_volume, sellToken.decimals, buyToken.decimals); initialBuySideAmount += payout.at(0); initialSellSideAmount += payout.at(1); - console.info("Deposit payout",payout); + cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); + cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); } else { console.error("Unable to determine side for a deposit that was in clearing"); } - console.info("order was in clearing"); } else { + let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); initialBuySideAmount += updatedValues.at(0); initialSellSideAmount += updatedValues.at(1); + cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); + cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); } } @@ -358,45 +368,44 @@ const Welcome: React.FC = () => { } } } - return [initialBuySideAmount, initialSellSideAmount, initialBuySideOpenAmount, initialSellSideOpenAmount]; + return [open_holdings, cleared_holdings]; + + }; + const zeroHoldings = (storage:any) => { + const valid_pairs = storage.valid_tokens; + const tokens = new Map(); + Object.keys(valid_pairs).map((k,i) => { + tokens.set(k,0); + }); + setClearedHoldings(tokens); + setOpenHoldings(tokens); + }; const updateHoldings = async (storage: any) => { - console.log("Updating holdings") try{ if (!userAddress) { - console.log("No user address - won't update holdings") - setSellSideAmount(0); - setBuySideAmount(0); + zeroHoldings(storage); return; } const userBatcherURI = bigMapsByIdUri + userBatchOrderTypesBigMapId + '/keys/' + userAddress; - console.log("userBatcherURI", userBatcherURI); const userOrderBookData = await fetch(userBatcherURI, { method: 'GET' }); let userBatches = null; try { userBatches = await userOrderBookData.json(); - console.log("userBatches", userBatches); } catch (error) { console.error(error); return; } - console.info("User batches found", userBatches.value); - console.info("User batches length", Object.keys(userBatches.value).length); if (Object.keys(userBatches.value).length === 0) { return; } - - let initialBuySideAmount = 0; - let initialSellSideAmount = 0; - let initialBuySideOpenAmount = 0; - let initialSellSideOpenAmount = 0; - + for (let i = 0; i < Object.keys(userBatches.value).length; i++) { const batchId = Object.keys(userBatches.value).at(i); @@ -411,29 +420,25 @@ const Welcome: React.FC = () => { } try{ - - let batch_holdings = calculateHolidingFromBatch(batch.value,userBatches ); + zeroHoldings(storage); + let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, openHoldings, clearedHoldings); - initialBuySideAmount += batch_holdings[0]; - initialSellSideAmount += batch_holdings[1]; - initialBuySideOpenAmount += batch_holdings[2]; - initialSellSideOpenAmount += batch_holdings[3]; + setClearedHoldings(batch_holdings[0]); + setOpenHoldings(batch_holdings[1]); } catch (error) { console.error(error); } } - - setSellSideAmount(initialSellSideAmount); - setBuySideAmount(initialBuySideAmount); - setSellSideOpenAmount(initialSellSideOpenAmount); - setBuySideOpenAmount(initialBuySideOpenAmount); } catch (error) { console.error('Unable to update holdings', error); } + }; + + + - }; const getBatches = async (storage: any) => { await getCurrentVolume(storage); @@ -628,16 +633,10 @@ const Welcome: React.FC = () => { tezos={Tezos} userAddress={userAddress} contractAddress={contractAddress} - buyToken={buyToken} - sellToken={sellToken} - buyTokenHolding={buySideAmount} - sellTokenHolding={sellSideAmount} - setBuySideAmount={setBuySideAmount} - setSellSideAmount={setSellSideAmount} - buyTokenOpenHolding={buySideOpenAmount} - sellTokenOpenHolding={sellSideOpenAmount} - setBuySideOpenAmount={setBuySideOpenAmount} - setSellSideOpenAmount={setSellSideOpenAmount} + openHoldings={openHoldings} + clearedHoldings={clearedHoldings} + setOpenHoldings={setOpenHoldings} + setClearedHoldings={setClearedHoldings} updateAll={updateAll} setUpdateAll={setUpdateAll} /> @@ -753,6 +752,11 @@ const Welcome: React.FC = () => { handleWebsocket(); }, []); + useEffect(() => { + if(initialState?.wallet !== null){ + Tezos.setWalletProvider(initialState.wallet); + } + }, []); useEffect(() => { refreshStorage().then(r => console.log(r)); }, [buyToken.address, sellToken.address, updateAll]); From 61bdc02f4a97363bcf067351a61e26f6cf7875b1 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Sun, 23 Apr 2023 22:08:30 +0100 Subject: [PATCH 006/108] Corrected open and closed holdings --- batcher-ui/src/pages/Main.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index af3d06fc..5631a77c 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -423,8 +423,8 @@ const Welcome: React.FC = () => { zeroHoldings(storage); let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, openHoldings, clearedHoldings); - setClearedHoldings(batch_holdings[0]); - setOpenHoldings(batch_holdings[1]); + setOpenHoldings(batch_holdings[0]); + setClearedHoldings(batch_holdings[1]); } catch (error) { console.error(error); From e9cc614f756a930699f4dc65921a09c8b799b238 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 24 Apr 2023 13:26:05 +0100 Subject: [PATCH 007/108] Corrected Network type and mainnet token hash --- batcher-ui/src/extra_utils/utils.ts | 2 +- batcher/storage/initial_storage_mainnet.mligo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-ui/src/extra_utils/utils.ts b/batcher-ui/src/extra_utils/utils.ts index cd88e352..fbc3808d 100644 --- a/batcher-ui/src/extra_utils/utils.ts +++ b/batcher-ui/src/extra_utils/utils.ts @@ -112,7 +112,7 @@ export const getNetworkType = () => { if (network?.includes('GHOSTNET')) { return types.NetworkType.GHOSTNET; } else { - return types.NetworkType.KATHMANDUNET; + return types.NetworkType.MAINNET; } }; diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index 8c4e6ee7..16e9a44b 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -20,7 +20,7 @@ let f(_:unit) : Batcher.Storage.t = { (("USDT"),{ token_id = 0n; name = "USDT"; - address = Some(("tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp" : address)); + address = Some(("KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o" : address)); decimals = 6n; standard = Some "FA2 token" }) From c0ff6258b2d8072d3b0fb771b28ec2763f57286e Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 24 Apr 2023 13:55:15 +0100 Subject: [PATCH 008/108] Clear active account on disconnect --- batcher-ui/src/components/RightContent/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index bc7318e6..770cc4ae 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -71,7 +71,14 @@ const GlobalHeaderRight: React.FC = () => { }; const disconnectWallet = async () => { + console.info("Disconnecting wallet"); await connection.stop(); + try{ + await initialState.wallet.clearActiveAccount(); + } catch (error) { + console.error(error); + } + let updatedState = { ...initialState, wallet: null, userAddress: null, userAccount:null }; localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); From f5be65b37adf5d9d19c0515a6fd03b05fa3cb205 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 24 Apr 2023 14:40:33 +0100 Subject: [PATCH 009/108] Added interim connecting captions for wallet loading --- .../src/components/RightContent/index.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index 770cc4ae..830c0953 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -12,6 +12,8 @@ import { LocalStorage } from "@airgap/beacon-sdk"; export type SiderTheme = 'light' | 'dark'; + + const GlobalHeaderRight: React.FC = () => { const { initialState, setInitialState } = useModel('@@initialState'); const tezos = new TezosToolkit(REACT_APP_TEZOS_NODE_URI); @@ -26,13 +28,18 @@ const GlobalHeaderRight: React.FC = () => { className = `${styles.right} ${styles.dark}`; } +const connectCaption = "Connect Wallet"; +const connectingCaption = "Connecting..."; +const disconnectCaption = "Disconnect Wallet"; +const disconnectingCaption = "Disconnecting..."; +const [ caption, setCaption ] = useState(connectCaption); const items: MenuProps['items'] = [ { key: '1', label: ( - {!initialState.userAddress ? 'Connect Wallet' : 'Disconnect Wallet'} + { caption } ), }, @@ -47,6 +54,7 @@ const GlobalHeaderRight: React.FC = () => { const connectWallet = async () => { console.info("=== STATE === state change check ", initialState); if (!initialState.userAddress) { + setCaption(connectingCaption); const wallet = new BeaconWallet({ name: 'batcher', preferredNetwork: getNetworkType(), @@ -63,6 +71,7 @@ const GlobalHeaderRight: React.FC = () => { const userAddress = activeAccount ? await wallet.getPKH() : null; let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount}; + setCaption(disconnectCaption); localStorage.setItem("state", JSON.stringify(updatedState)); console.log("localstroage - after connect", localStorage); setInitialState(updatedState); @@ -72,6 +81,7 @@ const GlobalHeaderRight: React.FC = () => { const disconnectWallet = async () => { console.info("Disconnecting wallet"); + setCaption(disconnectingCaption); await connection.stop(); try{ await initialState.wallet.clearActiveAccount(); @@ -82,6 +92,7 @@ const GlobalHeaderRight: React.FC = () => { let updatedState = { ...initialState, wallet: null, userAddress: null, userAccount:null }; localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); + setCaption(connectCaption); }; const scrollToTop = () => { @@ -101,12 +112,14 @@ const GlobalHeaderRight: React.FC = () => { useEffect(() => { (async () => { + setCaption(connectCaption); let localstate = JSON.parse(localStorage.getItem("state")); let state = localstate !== null ? localstate : initialState let wallet = newWallet(); try { + setCaption(connectingCaption); tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); if (activeAccount) { @@ -115,6 +128,7 @@ const GlobalHeaderRight: React.FC = () => { let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount, }; localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); + setCaption(disconnectCaption); } } catch (error) { @@ -132,7 +146,7 @@ const GlobalHeaderRight: React.FC = () => { onClick={!initialState.userAddress ? connectWallet : disconnectWallet} danger > - {!initialState.userAddress ? 'Connect Wallet' : 'Disconnect Wallet'} + { caption }
From f5ca6834048e0f3140ae7fbdb31c8f73294bdfd1 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 24 Apr 2023 21:28:37 +0100 Subject: [PATCH 010/108] Fixed issue with button showing connecting --- .../src/components/RightContent/index.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index f8bff211..b9638c25 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -111,13 +111,14 @@ const [ caption, setCaption ] = useState(connectCaption); useEffect(() => { (async () => { - setCaption(connectCaption); - let localstate = JSON.parse(localStorage.getItem("state")); - let state = localstate !== null ? localstate : initialState - let wallet = newWallet(); - try { - + console.log("useEffect - 1", caption); + setCaption(connectCaption); + let localstate = JSON.parse(localStorage.getItem("state")); + let state = localstate !== null ? localstate : initialState + let wallet = newWallet(); + + console.log("useEffect - 2", caption); setCaption(connectingCaption); tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); @@ -129,11 +130,17 @@ const [ caption, setCaption ] = useState(connectCaption); setInitialState(updatedState); setCaption(disconnectCaption); + } else { + + setCaption(connectCaption); } } catch (error) { + setCaption(connectCaption); + console.log("useEffect - error", caption); console.error(error); } + console.log("useEffect - 3", caption); })(); }, []); return ( From 8144a3a23f24bbd2da30fc29a5032bff3a4756d0 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 24 Apr 2023 22:39:43 +0100 Subject: [PATCH 011/108] Fixed NaN issue in Holdings tab --- batcher-ui/src/components/Holdings/index.tsx | 4 +-- .../src/components/RightContent/index.tsx | 4 --- batcher-ui/src/extra_utils/utils.ts | 12 +++++++ batcher-ui/src/pages/Main.tsx | 33 ++++++++----------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/batcher-ui/src/components/Holdings/index.tsx b/batcher-ui/src/components/Holdings/index.tsx index 1f9ee6c0..35122965 100644 --- a/batcher-ui/src/components/Holdings/index.tsx +++ b/batcher-ui/src/components/Holdings/index.tsx @@ -5,7 +5,7 @@ import '@/components/Holdings/index.less'; import '@/global.less'; import { HoldingsProps } from '@/extra_utils/types'; import { useModel } from 'umi'; - +import { zeroHoldings } from '@/extra_utils/utils'; const Holdings: React.FC = ({ tezos, contractAddress, @@ -40,7 +40,7 @@ const Holdings: React.FC = ({ <> { data.map((h) => - + {h.holding} {h.token} | )} diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index b9638c25..3e42bea5 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -112,13 +112,11 @@ const [ caption, setCaption ] = useState(connectCaption); (async () => { try { - console.log("useEffect - 1", caption); setCaption(connectCaption); let localstate = JSON.parse(localStorage.getItem("state")); let state = localstate !== null ? localstate : initialState let wallet = newWallet(); - console.log("useEffect - 2", caption); setCaption(connectingCaption); tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); @@ -136,11 +134,9 @@ const [ caption, setCaption ] = useState(connectCaption); } } catch (error) { setCaption(connectCaption); - console.log("useEffect - error", caption); console.error(error); } - console.log("useEffect - 3", caption); })(); }, []); return ( diff --git a/batcher-ui/src/extra_utils/utils.ts b/batcher-ui/src/extra_utils/utils.ts index fbc3808d..3cc54b52 100644 --- a/batcher-ui/src/extra_utils/utils.ts +++ b/batcher-ui/src/extra_utils/utils.ts @@ -136,4 +136,16 @@ export const scaleStringAmountDown = (amount: string, decimals: number) => { return (Number.parseInt(amount) * scale).toString(); } }; + +export const zeroHoldings = (storage:any, setOpenHoldings: Dispatch>>, setClearedHoldings: Dispatch>>) => { + const valid_pairs = storage.valid_tokens; + const ot = new Map(); + const ct = new Map(); + Object.keys(valid_pairs).map((k,i) => { + ot.set(k,0); + ct.set(k,0); + }); + setClearedHoldings(ct); + setOpenHoldings(ot); + }; diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 5631a77c..1c66968d 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -14,7 +14,7 @@ import { } from '@/extra_utils/types'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; import { Space, Col, Row, Drawer, Radio, } from 'antd'; -import { DoubleRightOutlined } from '@ant-design/icons'; +import { CiTwoTone, DoubleRightOutlined } from '@ant-design/icons'; import type { RadioChangeEvent } from 'antd'; import { useModel } from 'umi'; import { @@ -24,7 +24,7 @@ import { scaleStringAmountDown, } from '@/extra_utils/utils'; import { connection, init } from '@/extra_utils/webSocketUtils'; -import { scaleAmountUp } from '@/extra_utils/utils'; +import { scaleAmountUp, zeroHoldings } from '@/extra_utils/utils'; import Holdings from '@/components/Holdings'; import { TezosToolkit } from '@taquito/taquito'; @@ -372,29 +372,20 @@ const Welcome: React.FC = () => { }; - const zeroHoldings = (storage:any) => { - const valid_pairs = storage.valid_tokens; - const tokens = new Map(); - Object.keys(valid_pairs).map((k,i) => { - tokens.set(k,0); - }); - setClearedHoldings(tokens); - setOpenHoldings(tokens); - - }; const updateHoldings = async (storage: any) => { + let oh = openHoldings; + let ch = clearedHoldings; try{ if (!userAddress) { - - zeroHoldings(storage); return; } + console.info("##open holdings", openHoldings); + console.info("##cleared holdings", clearedHoldings); const userBatcherURI = bigMapsByIdUri + userBatchOrderTypesBigMapId + '/keys/' + userAddress; const userOrderBookData = await fetch(userBatcherURI, { method: 'GET' }); let userBatches = null; - try { userBatches = await userOrderBookData.json(); } catch (error) { @@ -420,11 +411,12 @@ const Welcome: React.FC = () => { } try{ - zeroHoldings(storage); - let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, openHoldings, clearedHoldings); + let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, oh, ch); + + console.info("== batcher holdings " + batchId, batch_holdings); + oh = batch_holdings[0]; + ch = batch_holdings[1]; - setOpenHoldings(batch_holdings[0]); - setClearedHoldings(batch_holdings[1]); } catch (error) { console.error(error); @@ -433,6 +425,8 @@ const Welcome: React.FC = () => { } catch (error) { console.error('Unable to update holdings', error); } + setOpenHoldings(oh); + setClearedHoldings(ch); }; @@ -700,6 +694,7 @@ const Welcome: React.FC = () => { const updateFromStorage = async (storage: any) => { updateBigMapIds(storage); + zeroHoldings(storage, setOpenHoldings,setClearedHoldings); await updateTokenDetails(storage); await getBatches(storage); await updateSwapMap(storage); From 5cb41a1b3972ff2885cc7b05c75edb6e9a103fd3 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 25 Apr 2023 12:19:34 +0100 Subject: [PATCH 012/108] Fixed issue with token balances updating --- .../src/components/RightContent/index.tsx | 12 ++--- batcher-ui/src/pages/Main.tsx | 53 +++++++++++-------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index 7e10e47f..d379b2e3 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -70,9 +70,9 @@ const [ caption, setCaption ] = useState(connectCaption); const activeAccount = await wallet.client.getActiveAccount(); const userAddress = activeAccount ? await wallet.getPKH() : null; let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount}; - + setCaption(disconnectCaption); - localStorage.setItem("state", JSON.stringify(updatedState)); +// localStorage.setItem("state", JSON.stringify(updatedState)); console.log("localstroage - after connect", localStorage); setInitialState(updatedState); console.log("Setting initialState", updatedState); @@ -115,8 +115,8 @@ const [ caption, setCaption ] = useState(connectCaption); try { setCaption(connectCaption); - let localstate = JSON.parse(localStorage.getItem("state")); - let state = localstate !== null ? localstate : initialState +// let localstate = JSON.parse(localStorage.getItem("state")); + let state = initialState; let wallet = newWallet(); setCaption(connectingCaption); @@ -126,7 +126,7 @@ const [ caption, setCaption ] = useState(connectCaption); console.info("=== STATE === no dep check - active account ", activeAccount); const userAddress = await wallet.getPKH(); let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount, }; - localStorage.setItem("state", JSON.stringify(updatedState)); + // localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); setCaption(disconnectCaption); @@ -139,7 +139,7 @@ const [ caption, setCaption ] = useState(connectCaption); setCaption(connectCaption); console.error(error); } - + })(); }, []); return ( diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 1c66968d..180370d8 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -165,7 +165,7 @@ const Welcome: React.FC = () => { } return [initialBuySideAmount, initialSellSideAmount]; - }; + }; const wasInClearingForBatch = (side_obj:any, order_tolerance_obj:any, clearing_tolerance_obj:any) => { console.info("wasInClearingForBatch - side_obj", side_obj); @@ -209,7 +209,7 @@ const Welcome: React.FC = () => { console.error("Could not determine order tolerance for buy deposit"); } } else { - console.error("Unable to determine clearing tolerance for buy deposit"); + console.error("Unable to determine clearing tolerance for buy deposit"); } } else if (side == "sell") { @@ -244,7 +244,7 @@ const Welcome: React.FC = () => { console.error("Could not determine order tolerance for buy deposit"); } } else { - console.error("Unable to determine clearing tolerance for buy deposit"); + console.error("Unable to determine clearing tolerance for buy deposit"); } } else { console.error("Unable to determine side for holdings"); @@ -254,7 +254,7 @@ const Welcome: React.FC = () => { const convertHoldingToPayout = (fromAmount:any, fromVolumeSubjectToClearing:any, fromClearedVolume:any, toClearedVolume:any, fromDecimals:number, toDecimals:number) => { const prorata = fromAmount / fromVolumeSubjectToClearing; - const payout = toClearedVolume * prorata; + const payout = toClearedVolume * prorata; const payoutInFromTokens = fromClearedVolume * prorata; const remainder = fromAmount - payoutInFromTokens; const scaled_payout = Math.floor(payout) / 10 ** toDecimals; @@ -275,16 +275,16 @@ const Welcome: React.FC = () => { } return tokens; - }; + }; + - const calculateHoldingFromBatch = (batch: any, ubots: any, open_holdings: Map , cleared_holdings: Map ) => { const tokens = findTokensForBatch(batch); const depositsInBatches = ubots.value; - const userBatchLength = depositsInBatches[batch.batch_number].length; - + const userBatchLength = depositsInBatches[batch.batch_number].length; + if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED){ for (let j = 0; j < userBatchLength; j++) { @@ -293,7 +293,7 @@ const Welcome: React.FC = () => { const side = depObject.key.side; const value = depObject.value; let initialBuySideOpenAmount = open_holdings.get(tokens.buy_token_name); - let initialSellSideOpenAmount = open_holdings.get(tokens.sell_token_name); + let initialSellSideOpenAmount = open_holdings.get(tokens.sell_token_name); const updatedValues = getOriginalDepositAmounts(side,initialBuySideOpenAmount, initialSellSideOpenAmount,value); initialBuySideOpenAmount += updatedValues.at(0); initialSellSideOpenAmount += updatedValues.at(1); @@ -320,10 +320,10 @@ const Welcome: React.FC = () => { const side = depObject.key.side; const tol = depObject.key.tolerance; const value = depObject.value; - + if (buy_side_cleared_volume === 0 || sell_side_cleared_volume === 0 ){ let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); initialBuySideAmount += updatedValues.at(0); initialSellSideAmount += updatedValues.at(1); @@ -335,16 +335,16 @@ const Welcome: React.FC = () => { if (wasInClearing) { if (Object.keys(side).at(0) === "buy") { let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); - const payout = convertHoldingToPayout(value,buy_side_volume_subject_to_clearing,buy_side_cleared_volume, sell_side_cleared_volume,buyToken.decimals, sellToken.decimals); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); + const payout = convertHoldingToPayout(value,buy_side_volume_subject_to_clearing,buy_side_cleared_volume, sell_side_cleared_volume,buyToken.decimals, sellToken.decimals); initialSellSideAmount += payout.at(0); initialBuySideAmount += payout.at(1); cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); } else if (Object.keys(side).at(0) === "sell"){ let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); - const payout = convertHoldingToPayout(value,sell_side_volume_subject_to_clearing, sell_side_cleared_volume, buy_side_cleared_volume, sellToken.decimals, buyToken.decimals); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); + const payout = convertHoldingToPayout(value,sell_side_volume_subject_to_clearing, sell_side_cleared_volume, buy_side_cleared_volume, sellToken.decimals, buyToken.decimals); initialBuySideAmount += payout.at(0); initialSellSideAmount += payout.at(1); cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); @@ -354,13 +354,13 @@ const Welcome: React.FC = () => { } } else { let initialBuySideAmount = cleared_holdings.get(tokens.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); + let initialSellSideAmount = cleared_holdings.get(tokens.sell_token_name); const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); initialBuySideAmount += updatedValues.at(0); initialSellSideAmount += updatedValues.at(1); cleared_holdings.set(tokens.buy_token_name,initialBuySideAmount); cleared_holdings.set(tokens.sell_token_name, initialSellSideAmount); - } + } } } catch (error) { @@ -396,7 +396,7 @@ const Welcome: React.FC = () => { if (Object.keys(userBatches.value).length === 0) { return; } - + for (let i = 0; i < Object.keys(userBatches.value).length; i++) { const batchId = Object.keys(userBatches.value).at(i); @@ -409,15 +409,15 @@ const Welcome: React.FC = () => { console.error(error); return; } - + try{ - let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, oh, ch); + let batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, oh, ch); console.info("== batcher holdings " + batchId, batch_holdings); oh = batch_holdings[0]; ch = batch_holdings[1]; - + } catch (error) { console.error(error); } @@ -670,8 +670,15 @@ const Welcome: React.FC = () => { const getTokenBalance = async () => { try{ - console.log('getTokenBalance-userAddress',userAddress); - const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + userAddress; + let usrAddr = userAddress + if(userAddress === null){ + if(initialState.userAddress !== null){ + usrAddr = initialState.userAddress; + setUserAddress(usrAddr); + } + } + console.log('getTokenBalance-userAddress',usrAddr); + const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; console.log('getTokenBalance-balanceURI',balanceURI); const data = await fetch(balanceURI, { method: 'GET' }); await data.json().then(balance => { From e74260fb316f1d5146a71bbb03cf8b68c76ee5cd Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 25 Apr 2023 12:37:19 +0100 Subject: [PATCH 013/108] Check for null user address on token update to reduce errors to the console --- batcher-ui/src/pages/Main.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 180370d8..7e85af59 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -677,6 +677,12 @@ const Welcome: React.FC = () => { setUserAddress(usrAddr); } } + + if(usrAddr === null){ + setBuyBalance(0); + setSellBalance(0); + } else { + console.log('getTokenBalance-userAddress',usrAddr); const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; console.log('getTokenBalance-balanceURI',balanceURI); @@ -687,6 +693,7 @@ const Welcome: React.FC = () => { setTokenAmount(balance, sellBalance, sellToken.address, sellToken.decimals, setSellBalance); } }); + } } catch (error) { console.error('getTokenBalance-error',error); if(!userAddress) { From d08235da3e2c0db7655bea89feda0212af4e7248 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 25 Apr 2023 13:14:39 +0100 Subject: [PATCH 014/108] Filtered out 204 responses from tzkt for volumes --- batcher-ui/src/pages/Main.tsx | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 7e85af59..89f7b6c4 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -96,7 +96,21 @@ const Welcome: React.FC = () => { }; }; + const setStatusFromBatch = (jsonData:any) => { + try { + const status = Object.keys(jsonData.value.status)[0]; + setStatus(status); + if (status === BatcherStatus.OPEN) { + setOpenTime(jsonData.value.status.open); + } + if (status === BatcherStatus.CLOSED) { + setStatus(BatcherStatus.CLOSED); + } + } catch (error) { + console.error('Unable to set status', error); + } + } const getCurrentVolume = async (storage: any) => { try { const currentBatchIndices = storage.batch_set.current_batch_indices; @@ -111,22 +125,19 @@ const Welcome: React.FC = () => { } else { const currentBatchURI = bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; + console.log('######Volumes - URI', currentBatchURI); const data = await fetch(currentBatchURI, { method: 'GET', }); + if(data.ok && data.status !== 204) { const jsonData = await data.json(); + setStatusFromBatch(jsonData); // eslint-disable-next-line @typescript-eslint/no-shadow - const status = Object.keys(jsonData.value.status)[0]; - setStatus(status); - if (status === BatcherStatus.OPEN) { - setOpenTime(jsonData.value.status.open); - } - if (status === BatcherStatus.CLOSED) { - setStatus(BatcherStatus.CLOSED); - } - console.log('######Volumes', jsonData.value.volumes); const scaledVolumes = scaleVolumeDown(jsonData.value.volumes); setVolumes(scaledVolumes); + } else { + console.info("Response from current batch api was no ok", data); + } } } catch (error) { console.error('Unable to get current volume', error); From 64d974cc1cddbc9acab9ee552a5ec1a402851b1a Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 25 Apr 2023 13:49:29 +0100 Subject: [PATCH 015/108] Updated About page --- batcher-ui/src/components/About/index.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/batcher-ui/src/components/About/index.tsx b/batcher-ui/src/components/About/index.tsx index c4f71ca2..bc4a09fe 100644 --- a/batcher-ui/src/components/About/index.tsx +++ b/batcher-ui/src/components/About/index.tsx @@ -7,18 +7,26 @@ const About: React.FC = () => { return (
- Batcher is a batch processing orderbook DEX. Batcher’s goal is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. This means that all orders for potential swaps between two pairs of tokens are collected over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order collection period is over, the batch is closed to additions. Batcher then waits for the next Oracle price for the token pair. When this is received, the batch is terminated and then Batcher looks to match the maximum amount of orders at the fairest possible price. + + Batcher is a new type of DEX that we have named a 'batch clearing DEX'. It provides a dark pool-like trading environment without using liquidity pools or having the issue of significant slippage. Batcher’s goal is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. This means that all orders for potential swaps between two pairs of tokens are collected over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order collection period is over, the batch is closed to additions. Batcher then waits for the next Oracle price for the token pair. When this is received, the batch is terminated and then Batcher looks to match the maximum amount of orders at the fairest possible price. -For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. Only the tzBTC/USDT pair will be supported for V1. +For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. -Note: Batcher can deal with token value imbalance which means that holders of tzBTC and holders of USDT can swap different amounts as long as the market of orders is equivalent on both sides. +Note: Batcher can deal with token value imbalance which means that holders of tzBTC and holders of USDT can swap different amounts as long as there is a market for the trade on both sides. + + Batcher has been designed to be composable with other high liquidity paths in the Tezos ecosystem, specifically the Sirius DEX; thus, the two pairs that are supported in V1 are tzBTC/USDT and tzBTC/EURL. + - - + For more information including blog posts and faqs, please visit the Batche rproject page at Marigold.dev. + + + *DISCLAIMER:* All investing comes with risk and DeFi is no exception. The content in this Dapp contains no financial advice. +Please do your own thorough research and note that all users funds are traded at their own risk. No reimbursement will be made and Marigold will not assume responsibility for any losses. +
); From 8ab2d38a694070e862f1bc4c88cb4aca2aa3cf2c Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 25 Apr 2023 13:49:57 +0100 Subject: [PATCH 016/108] Updated About page --- batcher-ui/src/components/About/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-ui/src/components/About/index.tsx b/batcher-ui/src/components/About/index.tsx index bc4a09fe..0279b021 100644 --- a/batcher-ui/src/components/About/index.tsx +++ b/batcher-ui/src/components/About/index.tsx @@ -20,7 +20,7 @@ Note: Batcher can deal with token value imbalance which means that holders of - For more information including blog posts and faqs, please visit the Batche rproject page at Marigold.dev. + For more information including blog posts and faqs, please visit the Batcher project page at Marigold.dev. From 800f58345e3d22a3f89cf7b1cf1356514954aef9 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 28 Apr 2023 11:26:49 +0100 Subject: [PATCH 017/108] Added nix flake for project --- batcher-bot/flake.lock | 385 +++++++++++++++++++++++++++++++++++++++++ batcher-bot/flake.nix | 26 +++ 2 files changed, 411 insertions(+) create mode 100644 batcher-bot/flake.lock create mode 100644 batcher-bot/flake.nix diff --git a/batcher-bot/flake.lock b/batcher-bot/flake.lock new file mode 100644 index 00000000..25215bb6 --- /dev/null +++ b/batcher-bot/flake.lock @@ -0,0 +1,385 @@ +{ + "nodes": { + "all-cabal-json": { + "flake": false, + "locked": { + "lastModified": 1665552503, + "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=", + "owner": "nix-community", + "repo": "all-cabal-json", + "rev": "d7c0434eebffb305071404edcf9d5cd99703878e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "hackage", + "repo": "all-cabal-json", + "type": "github" + } + }, + "crane": { + "flake": false, + "locked": { + "lastModified": 1670900067, + "narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=", + "owner": "ipetkov", + "repo": "crane", + "rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "flake": false, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dream2nix": { + "inputs": { + "all-cabal-json": "all-cabal-json", + "crane": "crane", + "devshell": "devshell", + "drv-parts": "drv-parts", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "flake-utils-pre-commit": "flake-utils-pre-commit", + "ghc-utils": "ghc-utils", + "gomod2nix": "gomod2nix", + "mach-nix": "mach-nix", + "nix-pypi-fetcher": "nix-pypi-fetcher", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgsV1": "nixpkgsV1", + "poetry2nix": "poetry2nix", + "pre-commit-hooks": "pre-commit-hooks", + "pruned-racket-catalog": "pruned-racket-catalog" + }, + "locked": { + "lastModified": 1682586650, + "narHash": "sha256-fdVZOgqftmZog2UnIH3uIPWL8Ki6Sk+SJ+6jfMlLkQg=", + "owner": "nix-community", + "repo": "dream2nix", + "rev": "bef06f0ad8feec43997ced0489e760b4c15b4012", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "dream2nix", + "type": "github" + } + }, + "drv-parts": { + "inputs": { + "flake-compat": [ + "dream2nix", + "flake-compat" + ], + "flake-parts": [ + "dream2nix", + "flake-parts" + ], + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1680698112, + "narHash": "sha256-FgnobN/DvCjEsc0UAZEAdPLkL4IZi2ZMnu2K2bUaElc=", + "owner": "davhau", + "repo": "drv-parts", + "rev": "e8c2ec1157dc1edb002989669a0dbd935f430201", + "type": "github" + }, + "original": { + "owner": "davhau", + "repo": "drv-parts", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675933616, + "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils-pre-commit": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-utils": { + "flake": false, + "locked": { + "lastModified": 1662774800, + "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=", + "ref": "refs/heads/master", + "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea", + "revCount": 1072, + "type": "git", + "url": "https://gitlab.haskell.org/bgamari/ghc-utils" + }, + "original": { + "type": "git", + "url": "https://gitlab.haskell.org/bgamari/ghc-utils" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gomod2nix": { + "flake": false, + "locked": { + "lastModified": 1627572165, + "narHash": "sha256-MFpwnkvQpauj799b4QTBJQFEddbD02+Ln5k92QyHOSk=", + "owner": "tweag", + "repo": "gomod2nix", + "rev": "67f22dd738d092c6ba88e420350ada0ed4992ae8", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "gomod2nix", + "type": "github" + } + }, + "mach-nix": { + "flake": false, + "locked": { + "lastModified": 1634711045, + "narHash": "sha256-m5A2Ty88NChLyFhXucECj6+AuiMZPHXNbw+9Kcs7F6Y=", + "owner": "DavHau", + "repo": "mach-nix", + "rev": "4433f74a97b94b596fa6cd9b9c0402104aceef5d", + "type": "github" + }, + "original": { + "id": "mach-nix", + "type": "indirect" + } + }, + "nix-pypi-fetcher": { + "flake": false, + "locked": { + "lastModified": 1669065297, + "narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=", + "owner": "DavHau", + "repo": "nix-pypi-fetcher", + "rev": "a9885ac6a091576b5195d547ac743d45a2a615ac", + "type": "github" + }, + "original": { + "owner": "DavHau", + "repo": "nix-pypi-fetcher", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1682566018, + "narHash": "sha256-HPzPRFiy2o/7k7mtnwfM1E6NVZHiFbPdmYCMoIpkHO4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8e3b64db39f2aaa14b35ee5376bd6a2e707cadc2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgsV1": { + "locked": { + "lastModified": 1678500271, + "narHash": "sha256-tRBLElf6f02HJGG0ZR7znMNFv/Uf7b2fFInpTHiHaSE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5eb98948b66de29f899c7fe27ae112a47964baf8", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-22.11", + "type": "indirect" + } + }, + "poetry2nix": { + "flake": false, + "locked": { + "lastModified": 1666918719, + "narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "289efb187123656a116b915206e66852f038720e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "1.36.0", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "dream2nix", + "flake-utils-pre-commit" + ], + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646153636, + "narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pruned-racket-catalog": { + "flake": false, + "locked": { + "lastModified": 1672537287, + "narHash": "sha256-SuOvXVcLfakw18oJB/PuRMyvGyGG1+CQD3R+TGHIv44=", + "owner": "nix-community", + "repo": "pruned-racket-catalog", + "rev": "c8b89557fb53b36efa2ee48a769c7364df0f6262", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "catalog", + "repo": "pruned-racket-catalog", + "type": "github" + } + }, + "root": { + "inputs": { + "dream2nix": "dream2nix", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/batcher-bot/flake.nix b/batcher-bot/flake.nix new file mode 100644 index 00000000..a9847dd2 --- /dev/null +++ b/batcher-bot/flake.nix @@ -0,0 +1,26 @@ +{ + description = "Batcher Bot"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + dream2nix = { + url = "github:nix-community/dream2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, gitignore, dream2nix, ... }: + dream2nix.lib.makeFlakeOutputs { + systems = flake-utils.lib.defaultSystems; + config.projectRoot = ./.; + source = gitignore.lib.gitignoreSource ./.; + + }; +} From 0e0498f1db14bcc1fb7c24cf303f893749900b94 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 28 Apr 2023 12:30:34 +0100 Subject: [PATCH 018/108] Added skeleton ts project --- batcher-bot/.gitignore | 31 ++ batcher-bot/flake.lock | 359 +-------------------- batcher-bot/flake.nix | 55 ++-- batcher-bot/package.json | 25 ++ batcher-bot/src/index.ts | 0 batcher-bot/tsconfig.json | 6 + batcher-bot/yarn.lock | 664 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 770 insertions(+), 370 deletions(-) create mode 100644 batcher-bot/.gitignore create mode 100644 batcher-bot/package.json create mode 100644 batcher-bot/src/index.ts create mode 100644 batcher-bot/tsconfig.json create mode 100644 batcher-bot/yarn.lock diff --git a/batcher-bot/.gitignore b/batcher-bot/.gitignore new file mode 100644 index 00000000..ed064ab0 --- /dev/null +++ b/batcher-bot/.gitignore @@ -0,0 +1,31 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.exe + +pids +logs +results + +npm-debug.log +node_modules +coverage +tmp +issues/ +test/fixtures/test* + +.idea +./compile/**/*.* +out +obfuscated +dist* +release +dist +.env +dist +.env \ No newline at end of file diff --git a/batcher-bot/flake.lock b/batcher-bot/flake.lock index 25215bb6..e9efdd8f 100644 --- a/batcher-bot/flake.lock +++ b/batcher-bot/flake.lock @@ -1,268 +1,18 @@ { "nodes": { - "all-cabal-json": { + "js2nix": { "flake": false, "locked": { - "lastModified": 1665552503, - "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=", - "owner": "nix-community", - "repo": "all-cabal-json", - "rev": "d7c0434eebffb305071404edcf9d5cd99703878e", + "lastModified": 1680501697, + "narHash": "sha256-Bmv0ERVeb6vjYzy4MuCDgSiz9fSm/Bhg+Xk3AxPisBw=", + "owner": "canva-public", + "repo": "js2nix", + "rev": "d37912f6cc824e7f41bea7a481af1739ca195c8f", "type": "github" }, "original": { - "owner": "nix-community", - "ref": "hackage", - "repo": "all-cabal-json", - "type": "github" - } - }, - "crane": { - "flake": false, - "locked": { - "lastModified": 1670900067, - "narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=", - "owner": "ipetkov", - "repo": "crane", - "rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "devshell": { - "flake": false, - "locked": { - "lastModified": 1663445644, - "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", - "owner": "numtide", - "repo": "devshell", - "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "dream2nix": { - "inputs": { - "all-cabal-json": "all-cabal-json", - "crane": "crane", - "devshell": "devshell", - "drv-parts": "drv-parts", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "flake-utils-pre-commit": "flake-utils-pre-commit", - "ghc-utils": "ghc-utils", - "gomod2nix": "gomod2nix", - "mach-nix": "mach-nix", - "nix-pypi-fetcher": "nix-pypi-fetcher", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgsV1": "nixpkgsV1", - "poetry2nix": "poetry2nix", - "pre-commit-hooks": "pre-commit-hooks", - "pruned-racket-catalog": "pruned-racket-catalog" - }, - "locked": { - "lastModified": 1682586650, - "narHash": "sha256-fdVZOgqftmZog2UnIH3uIPWL8Ki6Sk+SJ+6jfMlLkQg=", - "owner": "nix-community", - "repo": "dream2nix", - "rev": "bef06f0ad8feec43997ced0489e760b4c15b4012", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "dream2nix", - "type": "github" - } - }, - "drv-parts": { - "inputs": { - "flake-compat": [ - "dream2nix", - "flake-compat" - ], - "flake-parts": [ - "dream2nix", - "flake-parts" - ], - "nixpkgs": [ - "dream2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1680698112, - "narHash": "sha256-FgnobN/DvCjEsc0UAZEAdPLkL4IZi2ZMnu2K2bUaElc=", - "owner": "davhau", - "repo": "drv-parts", - "rev": "e8c2ec1157dc1edb002989669a0dbd935f430201", - "type": "github" - }, - "original": { - "owner": "davhau", - "repo": "drv-parts", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "dream2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1675933616, - "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils-pre-commit": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "ghc-utils": { - "flake": false, - "locked": { - "lastModified": 1662774800, - "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=", - "ref": "refs/heads/master", - "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea", - "revCount": 1072, - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "gomod2nix": { - "flake": false, - "locked": { - "lastModified": 1627572165, - "narHash": "sha256-MFpwnkvQpauj799b4QTBJQFEddbD02+Ln5k92QyHOSk=", - "owner": "tweag", - "repo": "gomod2nix", - "rev": "67f22dd738d092c6ba88e420350ada0ed4992ae8", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "gomod2nix", - "type": "github" - } - }, - "mach-nix": { - "flake": false, - "locked": { - "lastModified": 1634711045, - "narHash": "sha256-m5A2Ty88NChLyFhXucECj6+AuiMZPHXNbw+9Kcs7F6Y=", - "owner": "DavHau", - "repo": "mach-nix", - "rev": "4433f74a97b94b596fa6cd9b9c0402104aceef5d", - "type": "github" - }, - "original": { - "id": "mach-nix", - "type": "indirect" - } - }, - "nix-pypi-fetcher": { - "flake": false, - "locked": { - "lastModified": 1669065297, - "narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=", - "owner": "DavHau", - "repo": "nix-pypi-fetcher", - "rev": "a9885ac6a091576b5195d547ac743d45a2a615ac", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "nix-pypi-fetcher", + "owner": "canva-public", + "repo": "js2nix", "type": "github" } }, @@ -282,102 +32,11 @@ "type": "github" } }, - "nixpkgsV1": { - "locked": { - "lastModified": 1678500271, - "narHash": "sha256-tRBLElf6f02HJGG0ZR7znMNFv/Uf7b2fFInpTHiHaSE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5eb98948b66de29f899c7fe27ae112a47964baf8", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-22.11", - "type": "indirect" - } - }, - "poetry2nix": { - "flake": false, - "locked": { - "lastModified": 1666918719, - "narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "289efb187123656a116b915206e66852f038720e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "1.36.0", - "repo": "poetry2nix", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-utils": [ - "dream2nix", - "flake-utils-pre-commit" - ], - "nixpkgs": [ - "dream2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1646153636, - "narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pruned-racket-catalog": { - "flake": false, - "locked": { - "lastModified": 1672537287, - "narHash": "sha256-SuOvXVcLfakw18oJB/PuRMyvGyGG1+CQD3R+TGHIv44=", - "owner": "nix-community", - "repo": "pruned-racket-catalog", - "rev": "c8b89557fb53b36efa2ee48a769c7364df0f6262", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "catalog", - "repo": "pruned-racket-catalog", - "type": "github" - } - }, "root": { "inputs": { - "dream2nix": "dream2nix", - "flake-utils": "flake-utils", - "gitignore": "gitignore", + "js2nix": "js2nix", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/batcher-bot/flake.nix b/batcher-bot/flake.nix index a9847dd2..3ea8048e 100644 --- a/batcher-bot/flake.nix +++ b/batcher-bot/flake.nix @@ -1,26 +1,41 @@ { - description = "Batcher Bot"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils = { - url = "github:numtide/flake-utils"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - gitignore = { - url = "github:hercules-ci/gitignore.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - dream2nix = { - url = "github:nix-community/dream2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.js2nix = { + url = "github:canva-public/js2nix"; + flake = false; }; - outputs = { self, nixpkgs, flake-utils, gitignore, dream2nix, ... }: - dream2nix.lib.makeFlakeOutputs { - systems = flake-utils.lib.defaultSystems; - config.projectRoot = ./.; - source = gitignore.lib.gitignoreSource ./.; + outputs = { self, nixpkgs, js2nix }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}.extend (self: super: { + js2nix = self.callPackage js2nix { }; + })); + in + rec { + packages = forAllSystems (system: { + default = + let + env = pkgs.${system}.js2nix { + package-json = ./package.json; + yarn-lock = ./yarn.lock; + }; + in + pkgs.${system}.buildEnv { + name = "batcher-bot"; + paths = [ + ]; + pathsToLink = [ "/bin" ]; + }; + }); + devShells = forAllSystems (system: { + default = pkgs.${system}.mkShellNoCC { + packages = with pkgs.${system}; [ + yarn + ]; + }; + }); }; } diff --git a/batcher-bot/package.json b/batcher-bot/package.json new file mode 100644 index 00000000..6fb80290 --- /dev/null +++ b/batcher-bot/package.json @@ -0,0 +1,25 @@ +{ + "name": "batcher-bot", + "version": "1.0.0", + "description": "", + "main": "dist/index.js", + "bin": { + "ts-node-nix": "dist/index.js" + }, + "scripts": { + "start": "node dist/index.js", + "build": "tsc", + "dev": "ts-node-dev --no-notify --respawn src/index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "MIT", + "dependencies": { + "@taquito/taquito": "^8.0.1", + "rxjs": "^7.4.0", + "telegraf": "^4.6.0" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } +} diff --git a/batcher-bot/src/index.ts b/batcher-bot/src/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/batcher-bot/tsconfig.json b/batcher-bot/tsconfig.json new file mode 100644 index 00000000..bd7e3594 --- /dev/null +++ b/batcher-bot/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@tsconfig/node16-strictest/tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + } +} diff --git a/batcher-bot/yarn.lock b/batcher-bot/yarn.lock new file mode 100644 index 00000000..38a84aec --- /dev/null +++ b/batcher-bot/yarn.lock @@ -0,0 +1,664 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/helper-validator-identifier@^7.18.6": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" + +"@taquito/http-utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-8.1.1.tgz#62eb983a6e9c1a2f1806327b8c7b6f6dec00024c" + integrity sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w== + dependencies: + xhr2-cookies "^1.1.0" + +"@taquito/michel-codec@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michel-codec/-/michel-codec-8.1.1.tgz#23ba8255215db72c60e0f52ff1616cf9830c6aa5" + integrity sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ== + +"@taquito/michelson-encoder@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz#153e45cb90028a13aa2f18571185e93047dcb3be" + integrity sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg== + dependencies: + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + fast-json-stable-stringify "^2.1.0" + +"@taquito/rpc@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-8.1.1.tgz#cdbf9d7ba24346034bf0f02ebf634e846801811a" + integrity sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg== + dependencies: + "@taquito/http-utils" "^8.1.0" + bignumber.js "^9.0.1" + lodash "^4.17.20" + +"@taquito/taquito@^8.0.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-8.1.1.tgz#284c760414013d9aa12343a4784c3057f62ffa8b" + integrity sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A== + dependencies: + "@taquito/http-utils" "^8.1.0" + "@taquito/michel-codec" "^8.1.1" + "@taquito/michelson-encoder" "^8.1.1" + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + rx-sandbox "^1.0.3" + rxjs "^6.6.3" + +"@taquito/utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-8.1.1.tgz#b9fbc880308ad814ae15b4f3402fd40c4ecc7c23" + integrity sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g== + dependencies: + blakejs "^1.1.0" + bs58check "^2.1.2" + buffer "^5.6.0" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/node@*", "@types/node@^18.7.14": + version "18.16.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.2.tgz#2f610ea71034b3971c312192377f8a7178eb57f1" + integrity sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg== + +"@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^15.0.0": + version "15.0.15" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.15.tgz#e609a2b1ef9e05d90489c2f5f45bbfb2be092158" + integrity sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg== + dependencies: + "@types/yargs-parser" "*" + +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bignumber.js@^9.0.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" + integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + +blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + +buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + +buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + +buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== + +buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +cipher-base@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +cookiejar@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" + integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== + +create-hash@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +diff-sequences@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" + integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +expect@^26.6.1: + version "26.6.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" + integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== + dependencies: + "@jest/types" "^26.6.2" + ansi-styles "^4.0.0" + jest-get-type "^26.3.0" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" + jest-regex-util "^26.0.0" + +fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +graceful-fs@^4.2.4: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +jest-diff@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" + integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== + dependencies: + chalk "^4.0.0" + diff-sequences "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + +jest-get-type@^26.3.0: + version "26.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" + integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== + +jest-matcher-utils@^26.6.1, jest-matcher-utils@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" + integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== + dependencies: + chalk "^4.0.0" + jest-diff "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + +jest-message-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" + integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.4" + micromatch "^4.0.2" + pretty-format "^26.6.2" + slash "^3.0.0" + stack-utils "^2.0.2" + +jest-regex-util@^26.0.0: + version "26.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +lodash@^4.17.20: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +micromatch@^4.0.2: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mri@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +node-fetch@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" + integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== + dependencies: + whatwg-url "^5.0.0" + +p-timeout@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-4.1.0.tgz#788253c0452ab0ffecf18a62dff94ff1bd09ca0a" + integrity sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw== + +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pretty-format@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" + integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== + dependencies: + "@jest/types" "^26.6.2" + ansi-regex "^5.0.0" + ansi-styles "^4.0.0" + react-is "^17.0.1" + +react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + +readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rx-sandbox@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/rx-sandbox/-/rx-sandbox-1.0.4.tgz#821a1d64e5f0d88658da7a5dbbd735b13277648b" + integrity sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA== + dependencies: + expect "^26.6.1" + jest-matcher-utils "^26.6.1" + +rxjs@^6.6.3: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + +rxjs@^7.4.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-compare@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/safe-compare/-/safe-compare-1.1.4.tgz#5e0128538a82820e2e9250cd78e45da6786ba593" + integrity sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ== + dependencies: + buffer-alloc "^1.2.0" + +sandwich-stream@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sandwich-stream/-/sandwich-stream-2.0.2.tgz#6d1feb6cf7e9fe9fadb41513459a72c2e84000fa" + integrity sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== + +sha.js@^2.4.0: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +stack-utils@^2.0.2: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +telegraf@^4.6.0: + version "4.12.2" + resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.2.tgz#1cf4f38c275e04416f1282f3581833994870f0bc" + integrity sha512-PgwqI4wD86cMqVfFtEM9JkGGnMHgvgLJbReZMmwW4z35QeOi4DvbdItONld4bPnYn3A1jcO0SRKs0BXmR+x+Ew== + dependencies: + abort-controller "^3.0.0" + debug "^4.3.4" + mri "^1.2.0" + node-fetch "^2.6.8" + p-timeout "^4.1.0" + safe-compare "^1.1.4" + sandwich-stream "^2.0.2" + typegram "^4.3.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + +typegram@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/typegram/-/typegram-4.3.0.tgz#690ec1287f771608070e149c92de4fca42e54db0" + integrity sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg== + +typescript@^4.8.2: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +xhr2-cookies@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g== + dependencies: + cookiejar "^2.1.1" From 1343a2f04c555d51024fa371966047c5810af01e Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 28 Apr 2023 16:06:58 +0100 Subject: [PATCH 019/108] Added initial skeleton for tg bot --- .ash_history | 1 + batcher-bot/.env.ghostnet | 5 + batcher-bot/config/.ghostnet.env | 5 + batcher-bot/package.json | 13 ++- batcher-bot/src/bot.ts | 43 +++++++++ batcher-bot/src/formatter.ts | 67 ++++++++++++++ batcher-bot/src/index.ts | 19 ++++ batcher-bot/tsconfig.json | 1 - batcher-bot/yarn.lock | 153 ++++++++++++++++++++++++++++++- 9 files changed, 297 insertions(+), 10 deletions(-) create mode 100644 .ash_history create mode 100644 batcher-bot/.env.ghostnet create mode 100644 batcher-bot/config/.ghostnet.env create mode 100644 batcher-bot/src/bot.ts create mode 100644 batcher-bot/src/formatter.ts diff --git a/.ash_history b/.ash_history new file mode 100644 index 00000000..a3abe509 --- /dev/null +++ b/.ash_history @@ -0,0 +1 @@ +exit diff --git a/batcher-bot/.env.ghostnet b/batcher-bot/.env.ghostnet new file mode 100644 index 00000000..c384ae26 --- /dev/null +++ b/batcher-bot/.env.ghostnet @@ -0,0 +1,5 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM +CHANNEL_ID=-1001815478811 diff --git a/batcher-bot/config/.ghostnet.env b/batcher-bot/config/.ghostnet.env new file mode 100644 index 00000000..34ae98b5 --- /dev/null +++ b/batcher-bot/config/.ghostnet.env @@ -0,0 +1,5 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM +CHANNEL_ID=batcher-dev diff --git a/batcher-bot/package.json b/batcher-bot/package.json index 6fb80290..736d9fa6 100644 --- a/batcher-bot/package.json +++ b/batcher-bot/package.json @@ -7,16 +7,21 @@ "ts-node-nix": "dist/index.js" }, "scripts": { - "start": "node dist/index.js", - "build": "tsc", - "dev": "ts-node-dev --no-notify --respawn src/index.ts", + "start": "env-cmd -f .env.ghostnet node dist/index.js", + "build": "env-cmd -f .env.ghostnet tsc", + "dev": "env-cmd -e ghostnet ts-node-dev --no-notify --respawn src/index.ts", "test": "echo \"Error: no test specified\" && exit 1" }, "license": "MIT", "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", "@taquito/taquito": "^8.0.1", + "@tsconfig/node16-strictest": "^1.0.4", + "dotenv": "^16.0.3", + "env-cmd": "^10.1.0", "rxjs": "^7.4.0", - "telegraf": "^4.6.0" + "telegraf": "^4.12.3-canary.1" }, "devDependencies": { "@types/node": "^18.7.14", diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts new file mode 100644 index 00000000..1b4557e2 --- /dev/null +++ b/batcher-bot/src/bot.ts @@ -0,0 +1,43 @@ + +import { TezosToolkit } from '@taquito/taquito'; +import { Telegraf } from 'telegraf'; +import { interval } from 'rxjs'; +import { HubConnection, HubConnectionBuilder } from '@microsoft/signalr'; +import { MessageType, format } from './formatter' +const contractAddress = process.env["BATCHER_ADDRESS"]; +const botToken = process.env["BOT_TOKEN"]; +const channelId = process.env["CHANNEL_ID"]; +const nodeUri = process.env["TEZOS_NODE_URI"]; +const tzktUri = process.env["TZKT_URI_API"]; + + + +const sendToTelegram = async (bot:Telegraf, message:string, options: any) => { + await bot.telegram.sendMessage(channelId, message, { + parse_mode: 'HTML', + disable_web_page_preview: true, + }); +}; + +const init = async (bot:Telegraf, socketConnection:HubConnection) => { + await socketConnection.start(); + + await socketConnection.invoke('SubscribeToBigMaps', { + contract: contractAddress, + }); + + + socketConnection.on('bigmaps', (msg: any) => { + if (!msg.data) return; + const formattedMessage = format(MessageType.BIGMAP, msg.data[0]); + console.info("formattedMessage", formattedMessage); + sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + }); +}; + + export const start = (bot:Telegraf, socketConnection: HubConnection) => { + // Start the web socket + init(bot, socketConnection).then(r => console.info("started socket")) +// Start the Telegram bot. + bot.launch(); +}; diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts new file mode 100644 index 00000000..93778e3b --- /dev/null +++ b/batcher-bot/src/formatter.ts @@ -0,0 +1,67 @@ +import {text} from "stream/consumers"; + + + + +export enum MessageType { + BIGMAP = 0, + OPERATION = 1 +} + + +const formatRatesCurrent = (rateMessage: any) => { + + console.info("Formatting rates_current", rateMessage); + try{ + + + const pl = rateMessage.content.value; + const numerator = pl.rate.p; + const denominator = pl.rate.q; + const name = rateMessage.content.key; + // const scaledPow = buyToken.decimals - sellToken.decimals; + const scaledRate = numerator / denominator; + + return "Oracle Update - " + name + " " + scaledRate + ""; + } catch (error) { + console.error(error); + return "" + JSON.stringify(rateMessage) + ""; + + } +} + + +const formatBigMap = (message:any) => { + console.info("Formatting bigmap", message); + if(message.path = "rate_current"){ + formatRatesCurrent(message) + } + +return message; + +} + + + +export const format = (msgType: MessageType, message:any) => { + console.info(message); + try{ + let html = ''; + if(msgType === MessageType.BIGMAP){ + html = formatBigMap(message); + } + + let htmlOptions = { + parse_mode: 'HTML', + disable_web_page_preview: true, + }; + + return [html, htmlOptions]; + } catch (error) { + console.error(error); + let textOptions = { + parse_mode: 'TEXT', + }; + return [message, textOptions]; + } +} diff --git a/batcher-bot/src/index.ts b/batcher-bot/src/index.ts index e69de29b..f1cf0d1e 100644 --- a/batcher-bot/src/index.ts +++ b/batcher-bot/src/index.ts @@ -0,0 +1,19 @@ +import { config } from 'dotenv'; +config(); + +import { TezosToolkit } from '@taquito/taquito'; +import { Telegraf } from 'telegraf'; +import { interval } from 'rxjs'; +import { start } from "./bot" +import { HubConnection, HubConnectionBuilder } from '@microsoft/signalr'; + +const contractAddress = process.env["BATCHER_ADDRESS"]; +const botToken = process.env["BOT_TOKEN"]; +const channelId = process.env["CHANNEL_ID"]; +const nodeUri = process.env["TEZOS_NODE_URI"]; +const tzktUri = process.env["TZKT_URI_API"]; + +const bot = new Telegraf(botToken); +const socketConnection = new HubConnectionBuilder().withUrl(tzktUri + '/v1/ws').build(); + +start(bot, socketConnection); diff --git a/batcher-bot/tsconfig.json b/batcher-bot/tsconfig.json index bd7e3594..a82dbdd0 100644 --- a/batcher-bot/tsconfig.json +++ b/batcher-bot/tsconfig.json @@ -1,5 +1,4 @@ { - "extends": "@tsconfig/node16-strictest/tsconfig.json", "compilerOptions": { "outDir": "./dist", } diff --git a/batcher-bot/yarn.lock b/batcher-bot/yarn.lock index 38a84aec..3441ba5a 100644 --- a/batcher-bot/yarn.lock +++ b/batcher-bot/yarn.lock @@ -23,6 +23,11 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@dipdup/tzkt-api@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz#03ba65a31cad1f2770238efe632ada7d46e0eaec" + integrity sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g== + "@jest/types@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" @@ -34,6 +39,17 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@microsoft/signalr@^7.0.5": + version "7.0.5" + resolved "https://registry.yarnpkg.com/@microsoft/signalr/-/signalr-7.0.5.tgz#e7a984ac1f1b6a488170e9cb2f2f46a5d97d5f80" + integrity sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA== + dependencies: + abort-controller "^3.0.0" + eventsource "^2.0.2" + fetch-cookie "^2.0.3" + node-fetch "^2.6.7" + ws "^7.4.5" + "@taquito/http-utils@^8.1.0": version "8.1.1" resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-8.1.1.tgz#62eb983a6e9c1a2f1806327b8c7b6f6dec00024c" @@ -88,6 +104,11 @@ bs58check "^2.1.2" buffer "^5.6.0" +"@tsconfig/node16-strictest@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz#14218b0341223d5caa692fa789fb374909690875" + integrity sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.4" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" @@ -275,6 +296,11 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + cookiejar@^2.1.1: version "2.1.4" resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" @@ -291,6 +317,15 @@ create-hash@^1.1.0: ripemd160 "^2.0.1" sha.js "^2.4.0" +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -303,6 +338,19 @@ diff-sequences@^26.6.2: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== +dotenv@^16.0.3: + version "16.0.3" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" + integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== + +env-cmd@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b" + integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA== + dependencies: + commander "^4.0.0" + cross-spawn "^7.0.0" + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -318,6 +366,11 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== +eventsource@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" + integrity sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA== + expect@^26.6.1: version "26.6.2" resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" @@ -335,6 +388,14 @@ fast-json-stable-stringify@^2.1.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +fetch-cookie@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fetch-cookie/-/fetch-cookie-2.1.0.tgz#6e127909912f9e527533b045aab555c06b33801b" + integrity sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg== + dependencies: + set-cookie-parser "^2.4.8" + tough-cookie "^4.0.0" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -381,6 +442,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + jest-diff@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" @@ -463,7 +529,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -node-fetch@^2.6.8: +node-fetch@^2.6.7, node-fetch@^2.6.8: version "2.6.9" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== @@ -475,6 +541,11 @@ p-timeout@^4.1.0: resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-4.1.0.tgz#788253c0452ab0ffecf18a62dff94ff1bd09ca0a" integrity sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw== +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -490,6 +561,21 @@ pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + +punycode@^2.1.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + react-is@^17.0.1: version "17.0.2" resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" @@ -504,6 +590,11 @@ readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -551,6 +642,11 @@ sandwich-stream@^2.0.2: resolved "https://registry.yarnpkg.com/sandwich-stream/-/sandwich-stream-2.0.2.tgz#6d1feb6cf7e9fe9fadb41513459a72c2e84000fa" integrity sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== +set-cookie-parser@^2.4.8: + version "2.6.0" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" + integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== + sha.js@^2.4.0: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" @@ -559,6 +655,18 @@ sha.js@^2.4.0: inherits "^2.0.1" safe-buffer "^5.0.1" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -592,10 +700,10 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -telegraf@^4.6.0: - version "4.12.2" - resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.2.tgz#1cf4f38c275e04416f1282f3581833994870f0bc" - integrity sha512-PgwqI4wD86cMqVfFtEM9JkGGnMHgvgLJbReZMmwW4z35QeOi4DvbdItONld4bPnYn3A1jcO0SRKs0BXmR+x+Ew== +telegraf@^4.12.3-canary.1: + version "4.12.3-canary.1" + resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.3-canary.1.tgz#01ac0ecb0b73721bbeb1052b91c036a5120727b7" + integrity sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw== dependencies: abort-controller "^3.0.0" debug "^4.3.4" @@ -613,6 +721,16 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tough-cookie@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874" + integrity sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -638,6 +756,19 @@ typescript@^4.8.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + util-deprecate@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -656,6 +787,18 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +ws@^7.4.5: + version "7.5.9" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" + integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== + xhr2-cookies@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" From 5ac163fb6eccd5a48b9098eefb0530e5fa580984 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 28 Apr 2023 18:16:40 +0100 Subject: [PATCH 020/108] Added html formatting to rates messages --- batcher-bot/src/bot.ts | 6 ++---- batcher-bot/src/formatter.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 1b4557e2..6a3cace7 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -13,10 +13,7 @@ const tzktUri = process.env["TZKT_URI_API"]; const sendToTelegram = async (bot:Telegraf, message:string, options: any) => { - await bot.telegram.sendMessage(channelId, message, { - parse_mode: 'HTML', - disable_web_page_preview: true, - }); + await bot.telegram.sendMessage(channelId, message, options); }; const init = async (bot:Telegraf, socketConnection:HubConnection) => { @@ -38,6 +35,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { export const start = (bot:Telegraf, socketConnection: HubConnection) => { // Start the web socket init(bot, socketConnection).then(r => console.info("started socket")) + socketConnection.onclose(() => init(bot,socketConnection)); // Start the Telegram bot. bot.launch(); }; diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 93778e3b..978f06e0 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -24,8 +24,9 @@ const formatRatesCurrent = (rateMessage: any) => { return "Oracle Update - " + name + " " + scaledRate + ""; } catch (error) { + console.info("Error formatting rates", error.message); console.error(error); - return "" + JSON.stringify(rateMessage) + ""; + return "error" + error.message; } } @@ -33,8 +34,8 @@ const formatRatesCurrent = (rateMessage: any) => { const formatBigMap = (message:any) => { console.info("Formatting bigmap", message); - if(message.path = "rate_current"){ - formatRatesCurrent(message) + if(message.path == "rates_current"){ + return formatRatesCurrent(message) } return message; @@ -47,9 +48,10 @@ export const format = (msgType: MessageType, message:any) => { console.info(message); try{ let html = ''; - if(msgType === MessageType.BIGMAP){ + if(msgType == MessageType.BIGMAP){ html = formatBigMap(message); } + console.info("Formatting html", html); let htmlOptions = { parse_mode: 'HTML', From d5ac7491a9c587cf4a2a4721d72f25100c0fb201 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 17:57:32 +0100 Subject: [PATCH 021/108] Added raw operation socker sub --- batcher-bot/src/bot.ts | 11 +++++++++++ batcher-bot/src/formatter.ts | 11 +++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 6a3cace7..77e4eafd 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -23,6 +23,10 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { contract: contractAddress, }); + await socketConnection.invoke('SubscribeToOperations', { + address: contractAddress, + types: 'transaction', + }); socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; @@ -30,6 +34,13 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); }); + socketConnection.on('operations', (msg: any) => { + if (!msg.data) return; + const formattedMessage = format(MessageType.OPERATION, msg.data[0]); + console.info("formattedMessage", formattedMessage); + sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + }); + }; export const start = (bot:Telegraf, socketConnection: HubConnection) => { diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 978f06e0..03bc2f1a 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -37,12 +37,14 @@ const formatBigMap = (message:any) => { if(message.path == "rates_current"){ return formatRatesCurrent(message) } - return message; - } +const formatOperation = (message:any) => { + console.info("Formatting operation", message); + return "" + JSON.stringify(message) + ""; +} export const format = (msgType: MessageType, message:any) => { console.info(message); @@ -51,6 +53,11 @@ export const format = (msgType: MessageType, message:any) => { if(msgType == MessageType.BIGMAP){ html = formatBigMap(message); } + + if(msgType == MessageType.OPERATION){ + html = formatOperation(message); + } + console.info("Formatting html", html); let htmlOptions = { From 8b05402886a2759fc23c5104e053d7c818fa40b4 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 18:27:56 +0100 Subject: [PATCH 022/108] Added deposit op to bot --- batcher-bot/src/bot.ts | 1 + batcher-bot/src/formatter.ts | 53 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 77e4eafd..9e76adca 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -36,6 +36,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; + if (msg.data[0].parameter.endpoint == tick) return; const formattedMessage = format(MessageType.OPERATION, msg.data[0]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 03bc2f1a..ec6919da 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -40,9 +40,62 @@ const formatBigMap = (message:any) => { return message; } +const getSide = (side:number) => { + if(side == 0){ + return "BUY"; + } + + return "SELL"; +} + +const getTolerance = (side:number, tolerance:number) => { + if(side == 0 ){ + if(tolerance == 0){ + return "WORST PRICE / BETTER FILL"; + } + + if(tolerance == 1) { + return "ORACLE"; + } + + return "BETTER PRICE / WORSE FILL"; + + } + + + if(tolerance == 0){ + return "BETTER PRICE / WORSE FILL"; + } + + if(tolerance == 1) { + return "ORACLE"; + } + + return "WORSE PRICE / BETTER FILL"; + + +} + + +const formatDeposit = (message:any) => { + const val = message.parameter.value; + const side = getSide(message.parameter.value.side); + const tolerance = getSide(message.parameter.value.tolerance); + const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; + const amount = message.parameter.value.swap.amount; + + return " TRADE ON " + pair + "
" + side + " - " + tolerance + "
for " + amount + " " + message.parameter.value.swap.from.token.name; + + +} + const formatOperation = (message:any) => { console.info("Formatting operation", message); + const entrypoint = message.parameter.entrypoint; + if(entrypoint == 'deposit'){ + return formatDeposit(message); + } return "" + JSON.stringify(message) + ""; } From 64b18ba47fab8da3a41770704ce2aff164caddc1 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 18:33:30 +0100 Subject: [PATCH 023/108] Corrected tick filter --- batcher-bot/src/bot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 9e76adca..6c81b50b 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -36,7 +36,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; - if (msg.data[0].parameter.endpoint == tick) return; + if (msg.data[0].parameter.endpoint == 'tick') return; const formattedMessage = format(MessageType.OPERATION, msg.data[0]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); From 711dc877d5beb2eadd6e44aec9f03ac29dfeb470 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 18:40:27 +0100 Subject: [PATCH 024/108] Corrected deposit format for TG bot --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index ec6919da..7c72337d 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -84,7 +84,7 @@ const formatDeposit = (message:any) => { const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; const amount = message.parameter.value.swap.amount; - return " TRADE ON " + pair + "
" + side + " - " + tolerance + "
for " + amount + " " + message.parameter.value.swap.from.token.name; + return " TRADE ON " + pair + " " + side + " - " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; } From 92c0ac500b550cab3395ac7a8ff2d385821508eb Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 18:44:43 +0100 Subject: [PATCH 025/108] Corrected deposit amount for TG bot --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 7c72337d..653575b6 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -82,7 +82,7 @@ const formatDeposit = (message:any) => { const side = getSide(message.parameter.value.side); const tolerance = getSide(message.parameter.value.tolerance); const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; - const amount = message.parameter.value.swap.amount; + const amount = message.parameter.value.swap.from.amount; return " TRADE ON " + pair + " " + side + " - " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; From 872fbba610afae07b6ca8a9d22b55caf2e95d64b Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 18:49:09 +0100 Subject: [PATCH 026/108] Corrected deposit amount for TG bot --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 653575b6..116992b2 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -80,7 +80,7 @@ const getTolerance = (side:number, tolerance:number) => { const formatDeposit = (message:any) => { const val = message.parameter.value; const side = getSide(message.parameter.value.side); - const tolerance = getSide(message.parameter.value.tolerance); + const tolerance = getTolerance(message.parameter.value.side, message.parameter.value.tolerance); const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; const amount = message.parameter.value.swap.from.amount; From ef910a4ba5f3c921a263e1354c011120680f068b Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:03:04 +0100 Subject: [PATCH 027/108] Scaled amount for TG bot --- batcher-bot/src/formatter.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 116992b2..191e88de 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -76,13 +76,20 @@ const getTolerance = (side:number, tolerance:number) => { } +const scaleAmount = (amount: number, tokenDecimals: number) => { + return amount * (10 ** tokenDecimals); +}; + const formatDeposit = (message:any) => { - const val = message.parameter.value; - const side = getSide(message.parameter.value.side); - const tolerance = getTolerance(message.parameter.value.side, message.parameter.value.tolerance); + const val = message.parameter.value + const storage = message.storage; + const side = getSide(val.side); + const tolerance = getTolerance(val.side, val.tolerance); const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; - const amount = message.parameter.value.swap.from.amount; + const from = message.parameter.value.swap.from; + const to = message.parameter.value.swap.to; + const amount = scaleAmount(from.amount, from.token.decimals); return " TRADE ON " + pair + " " + side + " - " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; From 6539f44dde4d4a242e4996a2e2d329fc02f436fe Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:10:39 +0100 Subject: [PATCH 028/108] Added sedning of raw big map --- batcher-bot/src/bot.ts | 4 ++++ batcher-bot/src/formatter.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 6c81b50b..cb0b8701 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -32,6 +32,10 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; const formattedMessage = format(MessageType.BIGMAP, msg.data[0]); console.info("formattedMessage", formattedMessage); + let textOptions = { + parse_mode: 'TEXT', + }; + sendToTelegram(bot, JSON.stringify(msg.data[0]),textOptions ); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); }); socketConnection.on('operations', (msg: any) => { diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 191e88de..4c9179ef 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -77,7 +77,7 @@ const getTolerance = (side:number, tolerance:number) => { } const scaleAmount = (amount: number, tokenDecimals: number) => { - return amount * (10 ** tokenDecimals); + return amount / (10 ** tokenDecimals); }; From acc8609f1ffff0620c75f04d0718126e43851516 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:23:04 +0100 Subject: [PATCH 029/108] Corrected pair naming --- batcher-bot/src/bot.ts | 4 ---- batcher-bot/src/formatter.ts | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index cb0b8701..6c81b50b 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -32,10 +32,6 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; const formattedMessage = format(MessageType.BIGMAP, msg.data[0]); console.info("formattedMessage", formattedMessage); - let textOptions = { - parse_mode: 'TEXT', - }; - sendToTelegram(bot, JSON.stringify(msg.data[0]),textOptions ); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); }); socketConnection.on('operations', (msg: any) => { diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 4c9179ef..d2f887d4 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -19,8 +19,11 @@ const formatRatesCurrent = (rateMessage: any) => { const numerator = pl.rate.p; const denominator = pl.rate.q; const name = rateMessage.content.key; - // const scaledPow = buyToken.decimals - sellToken.decimals; - const scaledRate = numerator / denominator; + const valid_swaps = rateMessage.storage.valid_swaps; + const valid_swap = valid_swaps[name]; + const scale = valid_swap.from.decimals - valid_swap.to.decimals; + const rate = numerator / denominator; + const scaledRate = rate * (10 ** scale); return "Oracle Update - " + name + " " + scaledRate + ""; } catch (error) { @@ -80,13 +83,20 @@ const scaleAmount = (amount: number, tokenDecimals: number) => { return amount / (10 ** tokenDecimals); }; +const getPairName = (fromName:string, toName:string) => { + if (fromName > toName){ + return fromName + "/" + toName; + } + + return toName + "/" + fromName; +}; const formatDeposit = (message:any) => { const val = message.parameter.value const storage = message.storage; const side = getSide(val.side); const tolerance = getTolerance(val.side, val.tolerance); - const pair = message.parameter.value.swap.from.token.name + "/" + message.parameter.value.swap.to.name; + const pair =getPairName(message.parameter.value.swap.from.token.name, message.parameter.value.swap.to.name); const from = message.parameter.value.swap.from; const to = message.parameter.value.swap.to; const amount = scaleAmount(from.amount, from.token.decimals); From ee93cacd4617f577cc3210a5533a9726d45ad856 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:29:46 +0100 Subject: [PATCH 030/108] Corrected scaling from rates message --- batcher-bot/src/formatter.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index d2f887d4..5f3c4699 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -19,9 +19,7 @@ const formatRatesCurrent = (rateMessage: any) => { const numerator = pl.rate.p; const denominator = pl.rate.q; const name = rateMessage.content.key; - const valid_swaps = rateMessage.storage.valid_swaps; - const valid_swap = valid_swaps[name]; - const scale = valid_swap.from.decimals - valid_swap.to.decimals; + const scale = pl.swap.from.token.decimals - pl.swap.to.decimals; const rate = numerator / denominator; const scaledRate = rate * (10 ** scale); @@ -113,7 +111,7 @@ const formatOperation = (message:any) => { if(entrypoint == 'deposit'){ return formatDeposit(message); } - return "" + JSON.stringify(message) + ""; + return "" + JSON.stringify(message.parameter) + ""; } export const format = (msgType: MessageType, message:any) => { From 903ad45292dab7dd0fd11bd2aaa93f5626a0dd8d Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:48:39 +0100 Subject: [PATCH 031/108] Use all socket messages --- batcher-bot/src/bot.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 6c81b50b..56112b00 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -30,16 +30,20 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; - const formattedMessage = format(MessageType.BIGMAP, msg.data[0]); + for (let i = 0; i < Object.keys(msg.data).length; i++) { + const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + } }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; - if (msg.data[0].parameter.endpoint == 'tick') return; - const formattedMessage = format(MessageType.OPERATION, msg.data[0]); + for (let i = 0; i < Object.keys(msg.data).length; i++) { + if (msg.data[i].parameter.endpoint == 'tick') return; + const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + } }); }; From 3ce0d77f2e9674213abc492374d1bd7900d3f707 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 19:53:29 +0100 Subject: [PATCH 032/108] PArse non formated big maps to json --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 5f3c4699..ae6a358b 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -38,7 +38,7 @@ const formatBigMap = (message:any) => { if(message.path == "rates_current"){ return formatRatesCurrent(message) } -return message; +return "" + JSON.stringify(message.content.value) + ""; } const getSide = (side:number) => { From 1079617e70a16dc43e78719cdb5a7fced8b17ad4 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:02:06 +0100 Subject: [PATCH 033/108] Filtered user_batch_ordertypes from big_map updates --- batcher-bot/src/bot.ts | 5 ++++- batcher-bot/src/formatter.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 56112b00..5c49b3d7 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -31,18 +31,21 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { + if (msg.data[i].path != 'user_batch_ordertypes') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + }; } }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - if (msg.data[i].parameter.endpoint == 'tick') return; + if (msg.data[i].parameter.endpoint != 'tick') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + }; } }); diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index ae6a358b..bb25b92a 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -99,7 +99,7 @@ const formatDeposit = (message:any) => { const to = message.parameter.value.swap.to; const amount = scaleAmount(from.amount, from.token.decimals); - return " TRADE ON " + pair + " " + side + " - " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; + return " TRADE ON " + pair + " " + side + " @ " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; } From 212cda6a1ce0f50c23d2051c8cb2e62192f6ec35 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:05:24 +0100 Subject: [PATCH 034/108] Expanded log message --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index bb25b92a..c7140f60 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -38,7 +38,7 @@ const formatBigMap = (message:any) => { if(message.path == "rates_current"){ return formatRatesCurrent(message) } -return "" + JSON.stringify(message.content.value) + ""; +return "" + JSON.stringify(message.content) + ""; } const getSide = (side:number) => { From c82a53cc43e12d96958054666c90ecef334cb6d0 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:14:49 +0100 Subject: [PATCH 035/108] Added additional logging for bot --- batcher-bot/src/bot.ts | 2 ++ batcher-bot/src/formatter.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 5c49b3d7..7b79eaa5 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -32,6 +32,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { if (msg.data[i].path != 'user_batch_ordertypes') { + console.info("++++ BIGMAPS +++", msg.data[i]); const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); @@ -42,6 +43,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { if (msg.data[i].parameter.endpoint != 'tick') { + console.info("++++ OPERATIONS +++", msg.data[i]); const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index c7140f60..27020eed 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -111,7 +111,8 @@ const formatOperation = (message:any) => { if(entrypoint == 'deposit'){ return formatDeposit(message); } - return "" + JSON.stringify(message.parameter) + ""; + return " OP:" + JSON.stringify(message.parameter) + ""; + } export const format = (msgType: MessageType, message:any) => { From a9ebc4faa27823c9b850670f5e5608c696fa817a Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:20:00 +0100 Subject: [PATCH 036/108] Changed filters on socket messages --- batcher-bot/src/bot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 7b79eaa5..153ba482 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -31,7 +31,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - if (msg.data[i].path != 'user_batch_ordertypes') { + if (msg.data[i].path === 'rates_current') { console.info("++++ BIGMAPS +++", msg.data[i]); const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); @@ -42,7 +42,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - if (msg.data[i].parameter.endpoint != 'tick') { + if (msg.data[i].parameter.endpoint === 'deposit') { console.info("++++ OPERATIONS +++", msg.data[i]); const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); From ce4c8eb3dfe7431074f95e50295a5635be8bf745 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:24:25 +0100 Subject: [PATCH 037/108] Changed filters on socket messages --- batcher-bot/src/bot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 153ba482..2a48efb4 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -31,8 +31,8 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - if (msg.data[i].path === 'rates_current') { console.info("++++ BIGMAPS +++", msg.data[i]); + if (msg.data[i].path === 'rates_current') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); @@ -42,8 +42,8 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - if (msg.data[i].parameter.endpoint === 'deposit') { console.info("++++ OPERATIONS +++", msg.data[i]); + if (msg.data[i].parameter.endpoint === 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); From 815473c01f5361d0b9c65a15ce30bd1bf01ad116 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:26:54 +0100 Subject: [PATCH 038/108] Changed filters on socket messages --- batcher-bot/src/bot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 2a48efb4..aef6cd67 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -32,7 +32,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { console.info("++++ BIGMAPS +++", msg.data[i]); - if (msg.data[i].path === 'rates_current') { + if (msg.data[i].path == 'rates_current') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); @@ -43,7 +43,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { console.info("++++ OPERATIONS +++", msg.data[i]); - if (msg.data[i].parameter.endpoint === 'deposit') { + if (msg.data[i].parameter.endpoint == 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); From 55921b2e0a24d7d3bacb8d1fca86f01fe56accf9 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:40:45 +0100 Subject: [PATCH 039/108] Changed filters on socket messages --- batcher-bot/src/bot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index aef6cd67..7c6a540c 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -42,7 +42,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - console.info("++++ OPERATIONS +++", msg.data[i]); + console.info("++++ OPERATIONS +++", msg.data[i].parameter); if (msg.data[i].parameter.endpoint == 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); From e9e9aaf1850df324b68dd3e9b3ac6ddd166f5a86 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:44:51 +0100 Subject: [PATCH 040/108] Filter for transaction that are contract calls --- batcher-bot/src/bot.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 7c6a540c..058a50a4 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -36,18 +36,20 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); - }; + } } }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { console.info("++++ OPERATIONS +++", msg.data[i].parameter); + if (msg.data[i].parameter) { if (msg.data[i].parameter.endpoint == 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); - }; + } + } } }); From 089ccc7aec9b660bf664e6b9f25920481b2e1f00 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:48:03 +0100 Subject: [PATCH 041/108] Filter for transaction that are contract calls --- batcher-bot/src/bot.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 058a50a4..c0c20deb 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -32,16 +32,21 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { console.info("++++ BIGMAPS +++", msg.data[i]); + try{ if (msg.data[i].path == 'rates_current') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + }} catch (error) { + console.info("Error parsing bigmap", error.message); + console.error(error); } } }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { + try{ console.info("++++ OPERATIONS +++", msg.data[i].parameter); if (msg.data[i].parameter) { if (msg.data[i].parameter.endpoint == 'deposit') { @@ -50,6 +55,10 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); } } + } catch (error) { + console.info("Error parsing operation", error.message); + console.error(error); + } } }); From 1664f5951f1b5962db04cad79376b15cde5196f4 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 1 May 2023 20:51:20 +0100 Subject: [PATCH 042/108] Log ops received from socket --- batcher-bot/src/bot.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index c0c20deb..7e9be20c 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -45,6 +45,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; + console.info("++++ OPERATIONS (RECEIVED) +++", msg.data); for (let i = 0; i < Object.keys(msg.data).length; i++) { try{ console.info("++++ OPERATIONS +++", msg.data[i].parameter); From 73eeefe1af1d720afcc8813c70c3dbb265abe64d Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 09:21:30 +0100 Subject: [PATCH 043/108] Corrected filter --- batcher-bot/src/bot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 7e9be20c..37e491e8 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -50,7 +50,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { try{ console.info("++++ OPERATIONS +++", msg.data[i].parameter); if (msg.data[i].parameter) { - if (msg.data[i].parameter.endpoint == 'deposit') { + if (msg.data[i].parameter.entrypoint == 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); From 70eee417e2e388fe9c478e6fec12da337d42549c Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 09:37:06 +0100 Subject: [PATCH 044/108] Added skeleton for batch updates --- batcher-bot/src/bot.ts | 2 +- batcher-bot/src/formatter.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 37e491e8..4bd8be0a 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -33,7 +33,7 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { for (let i = 0; i < Object.keys(msg.data).length; i++) { console.info("++++ BIGMAPS +++", msg.data[i]); try{ - if (msg.data[i].path == 'rates_current') { + if (msg.data[i].path == 'rates_current' || msg.data[i].path == 'batch_set.batches') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 27020eed..2b1d1851 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -32,12 +32,19 @@ const formatRatesCurrent = (rateMessage: any) => { } } +const formatBatchChange = (message:any) => { +return "" + JSON.stringify(message.content) + ""; + +} const formatBigMap = (message:any) => { console.info("Formatting bigmap", message); if(message.path == "rates_current"){ return formatRatesCurrent(message) } + if (message.path == 'batch_set.batches') { + return formatBatchChange(message); + } return "" + JSON.stringify(message.content) + ""; } From 4fd085e7bf0352b7471e8800a88a85098dae7faf Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:05:32 +0100 Subject: [PATCH 045/108] Added batch update formatter showing volumes --- batcher-bot/src/formatter.ts | 75 ++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 2b1d1851..37a4de2e 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -8,20 +8,37 @@ export enum MessageType { OPERATION = 1 } +const getPairName = (fromName:string, toName:string) => { + if (fromName > toName){ + return fromName + "/" + toName; + } -const formatRatesCurrent = (rateMessage: any) => { + return toName + "/" + fromName; +}; - console.info("Formatting rates_current", rateMessage); +const getScaledRate= (rate:any, swap:any) => { try{ + const numerator = rate.p; + const denominator = rate.q; + const scale = swap.from.token.decimals - swap.to.decimals; + const rate = numerator / denominator; + return rate * (10 ** scale); + } catch (error) { + console.info("Error scaling rate", error.message); + console.error(error); + return 0; + } + +} - const pl = rateMessage.content.value; - const numerator = pl.rate.p; - const denominator = pl.rate.q; +const formatRatesCurrent = (rateMessage: any) => { + + console.info("Formatting rates_current", rateMessage); + try{ const name = rateMessage.content.key; - const scale = pl.swap.from.token.decimals - pl.swap.to.decimals; - const rate = numerator / denominator; - const scaledRate = rate * (10 ** scale); + const pl = rateMessage.content.value; + const scaledRate = getScaledRate(pl.rate, pl.swap); return "Oracle Update - " + name + " " + scaledRate + ""; } catch (error) { @@ -33,8 +50,41 @@ const formatRatesCurrent = (rateMessage: any) => { } const formatBatchChange = (message:any) => { -return "" + JSON.stringify(message.content) + ""; + try{ + const val = message.value; + const batch_number = val.batch_number; + const buy_decimals = val.pair.decimals_0; + const sell_decimals = val.pair.decimals_1; + const buy_name = val.pair.name_0; + const sell_name = val.pair.name_1; + const status = Object.keys(val.status)[0]; + const raw_buy_volume = val.volumes.buy_total_volume; + const raw_sell_volume = val.volumes.sell_total_volume; + const buy_volume = raw_buy_volume / (10 ** buy_decimals); + const sell_volume = raw_sell_volume / (10 ** sell_decimals); + + let status_message = status; + + if(status == 'open'){ + status_message = "Open (" + val.status.open + ")"; + } + if(status == 'closed'){ + status_message = "Closed (" + val.status.open + ")"; + } + if(status == 'cleared'){ + let rate = getScaledRate(val.status.cleared.rate, val.status.cleared.swap); + let rate_name = getPairName(val.status.cleared.swap.from.token.name, val.status.cleared.to.token.name); + status_message = "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate ; + } + + return " BATCH UPDATE " + batch_number + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name; + + } catch (error) { + console.info("Error formatting batch change"); + console.error(error); + return "" + JSON.stringify(message.content) + ""; + } } const formatBigMap = (message:any) => { @@ -88,13 +138,6 @@ const scaleAmount = (amount: number, tokenDecimals: number) => { return amount / (10 ** tokenDecimals); }; -const getPairName = (fromName:string, toName:string) => { - if (fromName > toName){ - return fromName + "/" + toName; - } - - return toName + "/" + fromName; -}; const formatDeposit = (message:any) => { const val = message.parameter.value From 2b75fbd2de28884a6746774216e3dd4379b95412 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:07:46 +0100 Subject: [PATCH 046/108] Assisting compiler --- batcher-bot/src/formatter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 37a4de2e..8e56fae5 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -16,11 +16,10 @@ const getPairName = (fromName:string, toName:string) => { return toName + "/" + fromName; }; -const getScaledRate= (rate:any, swap:any) => { +const getScaledRate = (rate_obj:any, swap:any) => { try{ - - const numerator = rate.p; - const denominator = rate.q; + const numerator = rate_obj.p; + const denominator = rate_obj.q; const scale = swap.from.token.decimals - swap.to.decimals; const rate = numerator / denominator; return rate * (10 ** scale); From bf4f02f0d6d7acc8c33b5310cec85e72cb7fd4ef Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:15:49 +0100 Subject: [PATCH 047/108] Corrected json path in batch change --- batcher-bot/src/formatter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 8e56fae5..2570f65b 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -50,7 +50,8 @@ const formatRatesCurrent = (rateMessage: any) => { const formatBatchChange = (message:any) => { try{ - const val = message.value; + console.info("Formatting batch change", message); + const val = message.content.value; const batch_number = val.batch_number; const buy_decimals = val.pair.decimals_0; const sell_decimals = val.pair.decimals_1; From ecfe4ea5907e8976ef91d777d71832e731dd6537 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:17:56 +0100 Subject: [PATCH 048/108] Corrected html encoding for batch change --- batcher-bot/src/formatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 2570f65b..f55f3f4c 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -69,7 +69,7 @@ const formatBatchChange = (message:any) => { status_message = "Open (" + val.status.open + ")"; } if(status == 'closed'){ - status_message = "Closed (" + val.status.open + ")"; + status_message = "Closed (" + val.status.closed + ")"; } if(status == 'cleared'){ let rate = getScaledRate(val.status.cleared.rate, val.status.cleared.swap); @@ -77,7 +77,7 @@ const formatBatchChange = (message:any) => { status_message = "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate ; } - return " BATCH UPDATE " + batch_number + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name; + return " BATCH UPDATE " + batch_number + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name + ""; } catch (error) { From 305fea7f8a4c47041b9ed0db0a3b197915d68759 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:25:50 +0100 Subject: [PATCH 049/108] Tidy up on logging --- batcher-bot/src/bot.ts | 4 ---- batcher-bot/src/formatter.ts | 6 ------ 2 files changed, 10 deletions(-) diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts index 4bd8be0a..b26edf9e 100644 --- a/batcher-bot/src/bot.ts +++ b/batcher-bot/src/bot.ts @@ -31,11 +31,9 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { socketConnection.on('bigmaps', (msg: any) => { if (!msg.data) return; for (let i = 0; i < Object.keys(msg.data).length; i++) { - console.info("++++ BIGMAPS +++", msg.data[i]); try{ if (msg.data[i].path == 'rates_current' || msg.data[i].path == 'batch_set.batches') { const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); - console.info("formattedMessage", formattedMessage); sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); }} catch (error) { console.info("Error parsing bigmap", error.message); @@ -45,10 +43,8 @@ const init = async (bot:Telegraf, socketConnection:HubConnection) => { }); socketConnection.on('operations', (msg: any) => { if (!msg.data) return; - console.info("++++ OPERATIONS (RECEIVED) +++", msg.data); for (let i = 0; i < Object.keys(msg.data).length; i++) { try{ - console.info("++++ OPERATIONS +++", msg.data[i].parameter); if (msg.data[i].parameter) { if (msg.data[i].parameter.entrypoint == 'deposit') { const formattedMessage = format(MessageType.OPERATION, msg.data[i]); diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index f55f3f4c..9618e037 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -33,7 +33,6 @@ const getScaledRate = (rate_obj:any, swap:any) => { const formatRatesCurrent = (rateMessage: any) => { - console.info("Formatting rates_current", rateMessage); try{ const name = rateMessage.content.key; const pl = rateMessage.content.value; @@ -50,7 +49,6 @@ const formatRatesCurrent = (rateMessage: any) => { const formatBatchChange = (message:any) => { try{ - console.info("Formatting batch change", message); const val = message.content.value; const batch_number = val.batch_number; const buy_decimals = val.pair.decimals_0; @@ -88,7 +86,6 @@ const formatBatchChange = (message:any) => { } const formatBigMap = (message:any) => { - console.info("Formatting bigmap", message); if(message.path == "rates_current"){ return formatRatesCurrent(message) } @@ -141,7 +138,6 @@ const scaleAmount = (amount: number, tokenDecimals: number) => { const formatDeposit = (message:any) => { const val = message.parameter.value - const storage = message.storage; const side = getSide(val.side); const tolerance = getTolerance(val.side, val.tolerance); const pair =getPairName(message.parameter.value.swap.from.token.name, message.parameter.value.swap.to.name); @@ -156,7 +152,6 @@ const formatDeposit = (message:any) => { const formatOperation = (message:any) => { - console.info("Formatting operation", message); const entrypoint = message.parameter.entrypoint; if(entrypoint == 'deposit'){ return formatDeposit(message); @@ -166,7 +161,6 @@ const formatOperation = (message:any) => { } export const format = (msgType: MessageType, message:any) => { - console.info(message); try{ let html = ''; if(msgType == MessageType.BIGMAP){ From eb66a1825144a9b8f3b0ceff7e14025acfee31ae Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:31:55 +0100 Subject: [PATCH 050/108] Corrected object path for cleared message --- batcher-bot/src/formatter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 9618e037..b9578961 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -67,11 +67,11 @@ const formatBatchChange = (message:any) => { status_message = "Open (" + val.status.open + ")"; } if(status == 'closed'){ - status_message = "Closed (" + val.status.closed + ")"; + status_message = "Closed (" + val.status.closed.at + ")"; } if(status == 'cleared'){ - let rate = getScaledRate(val.status.cleared.rate, val.status.cleared.swap); - let rate_name = getPairName(val.status.cleared.swap.from.token.name, val.status.cleared.to.token.name); + let rate = getScaledRate(val.status.cleared.rate.rate, val.status.cleared.rate.swap); + let rate_name = getPairName(buy_name, sell_name); status_message = "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate ; } @@ -171,7 +171,6 @@ export const format = (msgType: MessageType, message:any) => { html = formatOperation(message); } - console.info("Formatting html", html); let htmlOptions = { parse_mode: 'HTML', From 07f14e36a135abb4fc433c25611193df12710744 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:34:24 +0100 Subject: [PATCH 051/108] Added rate name into batch status message --- batcher-bot/src/formatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index b9578961..073794b8 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -61,6 +61,7 @@ const formatBatchChange = (message:any) => { const buy_volume = raw_buy_volume / (10 ** buy_decimals); const sell_volume = raw_sell_volume / (10 ** sell_decimals); + let rate_name = getPairName(buy_name, sell_name); let status_message = status; if(status == 'open'){ @@ -71,11 +72,10 @@ const formatBatchChange = (message:any) => { } if(status == 'cleared'){ let rate = getScaledRate(val.status.cleared.rate.rate, val.status.cleared.rate.swap); - let rate_name = getPairName(buy_name, sell_name); status_message = "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate ; } - return " BATCH UPDATE " + batch_number + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name + ""; + return " BATCH UPDATE " + batch_number + " " + rate_name + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name + ""; } catch (error) { From f7058161a537224fdf7726e0fa7e02270f6661eb Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 2 May 2023 10:47:04 +0100 Subject: [PATCH 052/108] Corrected closing message detail --- batcher-bot/src/formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts index 073794b8..a5bd7614 100644 --- a/batcher-bot/src/formatter.ts +++ b/batcher-bot/src/formatter.ts @@ -68,7 +68,7 @@ const formatBatchChange = (message:any) => { status_message = "Open (" + val.status.open + ")"; } if(status == 'closed'){ - status_message = "Closed (" + val.status.closed.at + ")"; + status_message = "Closed (" + val.status.closed.closing_time + ")"; } if(status == 'cleared'){ let rate = getScaledRate(val.status.cleared.rate.rate, val.status.cleared.rate.swap); From 706dd9f1bb2adde802f3498becf841414417f67d Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 9 May 2023 19:05:10 +0100 Subject: [PATCH 053/108] Added filter on messages --- batcher-bot/{ => notifications}/.env.ghostnet | 0 batcher-bot/{ => notifications}/.gitignore | 0 .../Dockerfile.bot.notifications | 0 .../{ => notifications}/config/.ghostnet.env | 1 + batcher-bot/notifications/config/.mainnet.env | 6 + batcher-bot/{ => notifications}/flake.lock | 0 batcher-bot/{ => notifications}/flake.nix | 0 batcher-bot/notifications/package-lock.json | 2114 +++++++++++++++++ batcher-bot/{ => notifications}/package.json | 7 +- batcher-bot/notifications/src/bot.ts | 101 + batcher-bot/notifications/src/formatter.ts | 234 ++ batcher-bot/notifications/src/index.ts | 30 + batcher-bot/notifications/src/types.ts | 15 + batcher-bot/{ => notifications}/tsconfig.json | 0 batcher-bot/notifications/yarn.lock | 825 +++++++ batcher-bot/src/bot.ts | 70 - batcher-bot/src/formatter.ts | 188 -- batcher-bot/src/index.ts | 19 - batcher-bot/yarn.lock | 807 ------- 19 files changed, 3331 insertions(+), 1086 deletions(-) rename batcher-bot/{ => notifications}/.env.ghostnet (100%) rename batcher-bot/{ => notifications}/.gitignore (100%) create mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications rename batcher-bot/{ => notifications}/config/.ghostnet.env (83%) create mode 100644 batcher-bot/notifications/config/.mainnet.env rename batcher-bot/{ => notifications}/flake.lock (100%) rename batcher-bot/{ => notifications}/flake.nix (100%) create mode 100644 batcher-bot/notifications/package-lock.json rename batcher-bot/{ => notifications}/package.json (72%) create mode 100644 batcher-bot/notifications/src/bot.ts create mode 100644 batcher-bot/notifications/src/formatter.ts create mode 100644 batcher-bot/notifications/src/index.ts create mode 100644 batcher-bot/notifications/src/types.ts rename batcher-bot/{ => notifications}/tsconfig.json (100%) create mode 100644 batcher-bot/notifications/yarn.lock delete mode 100644 batcher-bot/src/bot.ts delete mode 100644 batcher-bot/src/formatter.ts delete mode 100644 batcher-bot/src/index.ts delete mode 100644 batcher-bot/yarn.lock diff --git a/batcher-bot/.env.ghostnet b/batcher-bot/notifications/.env.ghostnet similarity index 100% rename from batcher-bot/.env.ghostnet rename to batcher-bot/notifications/.env.ghostnet diff --git a/batcher-bot/.gitignore b/batcher-bot/notifications/.gitignore similarity index 100% rename from batcher-bot/.gitignore rename to batcher-bot/notifications/.gitignore diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications b/batcher-bot/notifications/Dockerfile.bot.notifications new file mode 100644 index 00000000..e69de29b diff --git a/batcher-bot/config/.ghostnet.env b/batcher-bot/notifications/config/.ghostnet.env similarity index 83% rename from batcher-bot/config/.ghostnet.env rename to batcher-bot/notifications/config/.ghostnet.env index 34ae98b5..f0b694a7 100644 --- a/batcher-bot/config/.ghostnet.env +++ b/batcher-bot/notifications/config/.ghostnet.env @@ -3,3 +3,4 @@ TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev TZKT_URI_API=https://api.ghostnet.tzkt.io BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM CHANNEL_ID=batcher-dev +NOTIFICATIONS=deposits,rates,status_updates diff --git a/batcher-bot/notifications/config/.mainnet.env b/batcher-bot/notifications/config/.mainnet.env new file mode 100644 index 00000000..a8367a54 --- /dev/null +++ b/batcher-bot/notifications/config/.mainnet.env @@ -0,0 +1,6 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM +CHANNEL_ID=batcher-dev +NOTIFICATIONS=deposits diff --git a/batcher-bot/flake.lock b/batcher-bot/notifications/flake.lock similarity index 100% rename from batcher-bot/flake.lock rename to batcher-bot/notifications/flake.lock diff --git a/batcher-bot/flake.nix b/batcher-bot/notifications/flake.nix similarity index 100% rename from batcher-bot/flake.nix rename to batcher-bot/notifications/flake.nix diff --git a/batcher-bot/notifications/package-lock.json b/batcher-bot/notifications/package-lock.json new file mode 100644 index 00000000..9d7dcb8f --- /dev/null +++ b/batcher-bot/notifications/package-lock.json @@ -0,0 +1,2114 @@ +{ + "name": "batcher-bot", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "batcher-bot", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", + "@taquito/taquito": "^8.0.1", + "@tsconfig/node16-strictest": "^1.0.4", + "dotenv": "^16.0.3", + "env-cmd": "^10.1.0", + "prelude-ts": "^1.0.6", + "rxjs": "^7.4.0", + "telegraf": "^4.12.3-canary.1" + }, + "bin": { + "ts-node-nix": "dist/index.js" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "dependencies": { + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "dependencies": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "node_modules/@taquito/http-utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz", + "integrity": "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==", + "dependencies": { + "xhr2-cookies": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michel-codec": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz", + "integrity": "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michelson-encoder": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz", + "integrity": "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==", + "dependencies": { + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/rpc": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz", + "integrity": "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==", + "dependencies": { + "@taquito/http-utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "lodash": "^4.17.20" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz", + "integrity": "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==", + "hasInstallScript": true, + "dependencies": { + "@taquito/http-utils": "^8.1.0", + "@taquito/michel-codec": "^8.1.1", + "@taquito/michelson-encoder": "^8.1.1", + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "rx-sandbox": "^1.0.3", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", + "dependencies": { + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" + }, + "engines": { + "node": ">=4.2.4", + "npm": ">=3.0.0" + }, + "peerDependencies": { + "rxjs": "6.x" + } + }, + "node_modules/@taquito/taquito/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@taquito/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==", + "dependencies": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.6.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@tsconfig/node16-strictest": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz", + "integrity": "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==", + "deprecated": "TypeScript 5.0 supports combining TSConfigs using array syntax in extends" + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/node": { + "version": "18.16.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz", + "integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "node_modules/@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "dependencies": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + }, + "bin": { + "env-cmd": "bin/env-cmd.js" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/expect": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", + "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "dependencies": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-matcher-utils": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", + "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-message-util": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", + "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-regex-util": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", + "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/p-timeout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", + "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "dependencies": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "dependencies": { + "buffer-alloc": "^1.2.0" + } + }, + "node_modules/sandwich-stream": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", + "integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/telegraf": { + "version": "4.12.3-canary.1", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz", + "integrity": "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==", + "dependencies": { + "abort-controller": "^3.0.0", + "debug": "^4.3.4", + "mri": "^1.2.0", + "node-fetch": "^2.6.8", + "p-timeout": "^4.1.0", + "safe-compare": "^1.1.4", + "sandwich-stream": "^2.0.2", + "typegram": "^4.3.0" + }, + "bin": { + "telegraf": "lib/cli.mjs" + }, + "engines": { + "node": "^12.20.0 || >=14.13.1" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/typegram": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz", + "integrity": "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", + "dependencies": { + "cookiejar": "^2.1.1" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "requires": { + "@babel/highlight": "^7.18.6" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==" + }, + "@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + } + }, + "@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "requires": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "@taquito/http-utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz", + "integrity": "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==", + "requires": { + "xhr2-cookies": "^1.1.0" + } + }, + "@taquito/michel-codec": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz", + "integrity": "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==" + }, + "@taquito/michelson-encoder": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz", + "integrity": "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==", + "requires": { + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "fast-json-stable-stringify": "^2.1.0" + } + }, + "@taquito/rpc": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz", + "integrity": "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==", + "requires": { + "@taquito/http-utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "lodash": "^4.17.20" + } + }, + "@taquito/taquito": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz", + "integrity": "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==", + "requires": { + "@taquito/http-utils": "^8.1.0", + "@taquito/michel-codec": "^8.1.1", + "@taquito/michelson-encoder": "^8.1.1", + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "rx-sandbox": "^1.0.3", + "rxjs": "^6.6.3" + }, + "dependencies": { + "rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", + "requires": { + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" + } + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@taquito/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==", + "requires": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.6.0" + } + }, + "@tsconfig/node16-strictest": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz", + "integrity": "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==" + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/node": { + "version": "18.16.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz", + "integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + }, + "cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==" + }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, + "env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "requires": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + } + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + }, + "expect": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", + "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", + "requires": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "requires": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==" + }, + "jest-matcher-utils": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", + "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-message-util": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", + "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", + "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "p-timeout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", + "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "requires": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "requires": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + } + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "requires": { + "tslib": "^2.1.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "sandwich-stream": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", + "integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==" + }, + "set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "telegraf": { + "version": "4.12.3-canary.1", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz", + "integrity": "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==", + "requires": { + "abort-controller": "^3.0.0", + "debug": "^4.3.4", + "mri": "^1.2.0", + "node-fetch": "^2.6.8", + "p-timeout": "^4.1.0", + "safe-compare": "^1.1.4", + "sandwich-stream": "^2.0.2", + "typegram": "^4.3.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "typegram": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz", + "integrity": "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", + "requires": { + "cookiejar": "^2.1.1" + } + } + } +} diff --git a/batcher-bot/package.json b/batcher-bot/notifications/package.json similarity index 72% rename from batcher-bot/package.json rename to batcher-bot/notifications/package.json index 736d9fa6..7e68fa47 100644 --- a/batcher-bot/package.json +++ b/batcher-bot/notifications/package.json @@ -7,8 +7,10 @@ "ts-node-nix": "dist/index.js" }, "scripts": { - "start": "env-cmd -f .env.ghostnet node dist/index.js", - "build": "env-cmd -f .env.ghostnet tsc", + "start-ghostnet": "env-cmd -f .env.ghostnet node dist/index.js", + "build-ghostnet": "env-cmd -f .env.ghostnet tsc", + "start-mainnet": "env-cmd -f .env.mainnet node dist/index.js", + "build-mainnet": "env-cmd -f .env.mainnet tsc", "dev": "env-cmd -e ghostnet ts-node-dev --no-notify --respawn src/index.ts", "test": "echo \"Error: no test specified\" && exit 1" }, @@ -20,6 +22,7 @@ "@tsconfig/node16-strictest": "^1.0.4", "dotenv": "^16.0.3", "env-cmd": "^10.1.0", + "prelude-ts": "^1.0.6", "rxjs": "^7.4.0", "telegraf": "^4.12.3-canary.1" }, diff --git a/batcher-bot/notifications/src/bot.ts b/batcher-bot/notifications/src/bot.ts new file mode 100644 index 00000000..2946785d --- /dev/null +++ b/batcher-bot/notifications/src/bot.ts @@ -0,0 +1,101 @@ +import { TezosToolkit } from "@taquito/taquito"; +import { Telegraf } from "telegraf"; +import { interval } from "rxjs"; +import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; +import { format } from "./formatter"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; +import { Option } from "prelude-ts"; + +const contractAddress = process.env["BATCHER_ADDRESS"]; +const channelId = process.env["CHANNEL_ID"]; +const tzktUri = process.env["TZKT_URI_API"]; + +const sendToTelegram = async (bot: Telegraf, message: string, options: any) => { + await bot.telegram.sendMessage(channelId, message, options); +}; + +const init = async ( + bot: Telegraf, + socketConnection: HubConnection, + notifications_enabled: NotificationsEnabled +) => { + await socketConnection.start(); + + await socketConnection.invoke("SubscribeToBigMaps", { + contract: contractAddress, + }); + + await socketConnection.invoke("SubscribeToOperations", { + address: contractAddress, + types: "transaction", + }); + + socketConnection.on("bigmaps", (msg: any) => { + if (!msg.data) return; + for (let i = 0; i < Object.keys(msg.data).length; i++) { + try { + if ( + msg.data[i].path == "rates_current" || + msg.data[i].path == "batch_set.batches" + ) { + const formattedMessageOpt = format( + MessageType.BIGMAP, + msg.data[i], + notifications_enabled + ); + if (formattedMessageOpt.isSome()) { + const formattedMessage = formattedMessageOpt.get(); + sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + } + } + } catch (error) { + console.info("Error parsing bigmap", error.message); + console.error(error); + } + } + }); + socketConnection.on("operations", (msg: any) => { + if (!msg.data) return; + for (let i = 0; i < Object.keys(msg.data).length; i++) { + try { + if (msg.data[i].parameter) { + if (msg.data[i].parameter.entrypoint == "deposit") { + const formattedMessageOpt = format( + MessageType.OPERATION, + msg.data[i], + notifications_enabled + ); + if (formattedMessageOpt.isSome()) { + const formattedMessage = formattedMessageOpt.get(); + console.info("formattedMessage", formattedMessage); + sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + } + } + } + } catch (error) { + console.info("Error parsing operation", error.message); + console.error(error); + } + } + }); +}; + +export const start = ( + bot: Telegraf, + socketConnection: HubConnection, + notifications_enabled: NotificationsEnabled +) => { + // Start the web socket + init(bot, socketConnection, notifications_enabled).then((r) => + console.info("started socket") + ); + socketConnection.onclose(() => + init(bot, socketConnection, notifications_enabled) + ); + // Start the Telegram bot. + bot.launch(); +}; diff --git a/batcher-bot/notifications/src/formatter.ts b/batcher-bot/notifications/src/formatter.ts new file mode 100644 index 00000000..a4e9b38a --- /dev/null +++ b/batcher-bot/notifications/src/formatter.ts @@ -0,0 +1,234 @@ +import { text } from "stream/consumers"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; +import { Option, None } from "prelude-ts"; + +const getPairName = (fromName: string, toName: string) => { + if (fromName > toName) { + return fromName + "/" + toName; + } + + return toName + "/" + fromName; +}; + +const getScaledRate = (rate_obj: any, swap: any) => { + try { + const numerator = rate_obj.p; + const denominator = rate_obj.q; + const scale = swap.from.token.decimals - swap.to.decimals; + const rate = numerator / denominator; + return rate * 10 ** scale; + } catch (error) { + console.info("Error scaling rate", error.message); + console.error(error); + return 0; + } +}; + +const formatRatesCurrent = (rateMessage: any) => { + try { + const name = rateMessage.content.key; + const pl = rateMessage.content.value; + const scaledRate = getScaledRate(pl.rate, pl.swap); + + return ( + "Oracle Update - " + name + " " + scaledRate + "" + ); + } catch (error) { + console.info("Error formatting rates", error.message); + console.error(error); + return "error" + error.message; + } +}; + +const formatBatchChange = (message: any) => { + try { + const val = message.content.value; + const batch_number = val.batch_number; + const buy_decimals = val.pair.decimals_0; + const sell_decimals = val.pair.decimals_1; + const buy_name = val.pair.name_0; + const sell_name = val.pair.name_1; + const status = Object.keys(val.status)[0]; + const raw_buy_volume = val.volumes.buy_total_volume; + const raw_sell_volume = val.volumes.sell_total_volume; + const buy_volume = raw_buy_volume / 10 ** buy_decimals; + const sell_volume = raw_sell_volume / 10 ** sell_decimals; + + let rate_name = getPairName(buy_name, sell_name); + let status_message = status; + + if (status == "open") { + status_message = "Open (" + val.status.open + ")"; + } + if (status == "closed") { + status_message = "Closed (" + val.status.closed.closing_time + ")"; + } + if (status == "cleared") { + let rate = getScaledRate( + val.status.cleared.rate.rate, + val.status.cleared.rate.swap + ); + status_message = + "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate; + } + + return ( + " BATCH UPDATE " + + batch_number + + " " + + rate_name + + " " + + status_message + + " - BUY VOLUME " + + buy_volume + + " " + + buy_name + + " | SELL VOLUME " + + sell_volume + + " " + + sell_name + + "" + ); + } catch (error) { + console.info("Error formatting batch change"); + console.error(error); + return "" + JSON.stringify(message.content) + ""; + } +}; + +const formatBigMap = ( + message: any, + notifications_enabled: NotificationsEnabled +) : Option => { + if (message.path == "rates_current" && notifications_enabled.rates) { + return Option.of(formatRatesCurrent(message)); + } + if ( + message.path == "batch_set.batches" && + notifications_enabled.batch_status + ) { + return Option.of(formatBatchChange(message)); + } + + return Option.none(); +}; + +const getSide = (side: number) => { + if (side == 0) { + return "BUY"; + } + + return "SELL"; +}; + +const getTolerance = (side: number, tolerance: number) => { + if (side == 0) { + if (tolerance == 0) { + return "WORST PRICE / BETTER FILL"; + } + + if (tolerance == 1) { + return "ORACLE"; + } + + return "BETTER PRICE / WORSE FILL"; + } + + if (tolerance == 0) { + return "BETTER PRICE / WORSE FILL"; + } + + if (tolerance == 1) { + return "ORACLE"; + } + + return "WORSE PRICE / BETTER FILL"; +}; + +const scaleAmount = (amount: number, tokenDecimals: number) => { + return amount / 10 ** tokenDecimals; +}; + +const formatDeposit = (message: any) => { + const val = message.parameter.value; + const side = getSide(val.side); + const tolerance = getTolerance(val.side, val.tolerance); + const pair = getPairName( + message.parameter.value.swap.from.token.name, + message.parameter.value.swap.to.name + ); + const from = message.parameter.value.swap.from; + const to = message.parameter.value.swap.to; + const amount = scaleAmount(from.amount, from.token.decimals); + + return ( + " TRADE ON " + + pair + + " " + + side + + " @ " + + tolerance + + " for " + + amount + + " " + + message.parameter.value.swap.from.token.name + ); +}; + +const formatOperation = ( + message: any, + notifications_enabled: NotificationsEnabled +): Option => { + const entrypoint = message.parameter.entrypoint; + if (entrypoint == "deposit" && notifications_enabled.deposits) { + return Option.of(formatDeposit(message)); + } + return Option.none(); +}; + +export const format = ( + msgType: MessageType, + message: any, + notifications_enabled: NotificationsEnabled +): Option => { + try { + let htmlOptions: any = { + parse_mode: "HTML", + disable_web_page_preview: true, + }; + + if (msgType == MessageType.BIGMAP) { + const html: Option = formatBigMap(message, notifications_enabled); + if (html.isSome()) { + const htmlMessage: string = html.get(); + return Option.of({ + message: htmlMessage, + message_options: htmlOptions, + }); + } + } + + if (msgType == MessageType.OPERATION) { + const html = formatOperation(message, notifications_enabled); + if (html.isSome()) { + const htmlMessage = html.get(); + return Option.of({ + message: htmlMessage, + message_options: htmlOptions, + }); + } + } + + return Option.none(); + } catch (error) { + console.error(error); + let textOptions = { + parse_mode: "TEXT", + }; + return Option.none(); + } +}; diff --git a/batcher-bot/notifications/src/index.ts b/batcher-bot/notifications/src/index.ts new file mode 100644 index 00000000..03fd52db --- /dev/null +++ b/batcher-bot/notifications/src/index.ts @@ -0,0 +1,30 @@ +import { config } from "dotenv"; +import { TezosToolkit } from "@taquito/taquito"; +import { Telegraf } from "telegraf"; +import { interval } from "rxjs"; +import { start } from "./bot"; +import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; + +config(); + +const botToken = process.env["BOT_TOKEN"]; +const tzktUri = process.env["TZKT_URI_API"]; +const notifications = process.env["NOTIFICATIONS"]; + +const bot = new Telegraf(botToken); +const socketConnection = new HubConnectionBuilder() + .withUrl(tzktUri + "/v1/ws") + .build(); + +let notifications_enabled: NotificationsEnabled = { + deposits: notifications.includes("deposits"), + rates: notifications.includes("rates"), + batch_status: notifications.includes("batch_status"), +}; + +start(bot, socketConnection, notifications_enabled); diff --git a/batcher-bot/notifications/src/types.ts b/batcher-bot/notifications/src/types.ts new file mode 100644 index 00000000..7a8c0faf --- /dev/null +++ b/batcher-bot/notifications/src/types.ts @@ -0,0 +1,15 @@ +export type NotificationsEnabled = { + rates: boolean; + deposits: boolean; + batch_status: boolean; +}; + +export type TelegramMessageContents = { + message: string; + message_options: any; +}; + +export enum MessageType { + BIGMAP = 0, + OPERATION = 1, +} diff --git a/batcher-bot/tsconfig.json b/batcher-bot/notifications/tsconfig.json similarity index 100% rename from batcher-bot/tsconfig.json rename to batcher-bot/notifications/tsconfig.json diff --git a/batcher-bot/notifications/yarn.lock b/batcher-bot/notifications/yarn.lock new file mode 100644 index 00000000..6f47f069 --- /dev/null +++ b/batcher-bot/notifications/yarn.lock @@ -0,0 +1,825 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + "integrity" "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==" + "resolved" "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz" + "version" "7.21.4" + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/helper-validator-identifier@^7.18.6": + "integrity" "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" + "resolved" "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz" + "version" "7.19.1" + +"@babel/highlight@^7.18.6": + "integrity" "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==" + "resolved" "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz" + "version" "7.18.6" + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + "chalk" "^2.0.0" + "js-tokens" "^4.0.0" + +"@dipdup/tzkt-api@^0.0.1": + "integrity" "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==" + "resolved" "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz" + "version" "0.0.1" + +"@jest/types@^26.6.2": + "integrity" "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==" + "resolved" "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + "chalk" "^4.0.0" + +"@microsoft/signalr@^7.0.5": + "integrity" "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==" + "resolved" "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz" + "version" "7.0.5" + dependencies: + "abort-controller" "^3.0.0" + "eventsource" "^2.0.2" + "fetch-cookie" "^2.0.3" + "node-fetch" "^2.6.7" + "ws" "^7.4.5" + +"@taquito/http-utils@^8.1.0": + "integrity" "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==" + "resolved" "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "xhr2-cookies" "^1.1.0" + +"@taquito/michel-codec@^8.1.1": + "integrity" "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==" + "resolved" "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz" + "version" "8.1.1" + +"@taquito/michelson-encoder@^8.1.1": + "integrity" "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==" + "resolved" "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "fast-json-stable-stringify" "^2.1.0" + +"@taquito/rpc@^8.1.1": + "integrity" "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==" + "resolved" "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/http-utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "lodash" "^4.17.20" + +"@taquito/taquito@^8.0.1": + "integrity" "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==" + "resolved" "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/http-utils" "^8.1.0" + "@taquito/michel-codec" "^8.1.1" + "@taquito/michelson-encoder" "^8.1.1" + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "rx-sandbox" "^1.0.3" + "rxjs" "^6.6.3" + +"@taquito/utils@^8.1.0": + "integrity" "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==" + "resolved" "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "blakejs" "^1.1.0" + "bs58check" "^2.1.2" + "buffer" "^5.6.0" + +"@tsconfig/node16-strictest@^1.0.4": + "integrity" "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==" + "resolved" "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz" + "version" "1.0.4" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + "integrity" "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + "resolved" "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" + "version" "2.0.4" + +"@types/istanbul-lib-report@*": + "integrity" "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==" + "resolved" "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + "integrity" "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==" + "resolved" "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz" + "version" "3.0.1" + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/node@*", "@types/node@^18.7.14": + "integrity" "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + "resolved" "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz" + "version" "18.16.2" + +"@types/stack-utils@^2.0.0": + "integrity" "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + "resolved" "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz" + "version" "2.0.1" + +"@types/yargs-parser@*": + "integrity" "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + "resolved" "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" + "version" "21.0.0" + +"@types/yargs@^15.0.0": + "integrity" "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==" + "resolved" "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz" + "version" "15.0.15" + dependencies: + "@types/yargs-parser" "*" + +"abort-controller@^3.0.0": + "integrity" "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==" + "resolved" "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "event-target-shim" "^5.0.0" + +"ansi-regex@^5.0.0": + "integrity" "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + "version" "5.0.1" + +"ansi-styles@^3.2.1": + "integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" + "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" + "version" "3.2.1" + dependencies: + "color-convert" "^1.9.0" + +"ansi-styles@^4.0.0", "ansi-styles@^4.1.0": + "integrity" "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==" + "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + "version" "4.3.0" + dependencies: + "color-convert" "^2.0.1" + +"base-x@^3.0.2": + "integrity" "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==" + "resolved" "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz" + "version" "3.0.9" + dependencies: + "safe-buffer" "^5.0.1" + +"base64-js@^1.3.1": + "integrity" "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "resolved" "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" + "version" "1.5.1" + +"bignumber.js@^9.0.1": + "integrity" "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + "resolved" "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz" + "version" "9.1.1" + +"blakejs@^1.1.0": + "integrity" "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + "resolved" "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" + "version" "1.2.1" + +"braces@^3.0.2": + "integrity" "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==" + "resolved" "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" + "version" "3.0.2" + dependencies: + "fill-range" "^7.0.1" + +"bs58@^4.0.0": + "integrity" "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==" + "resolved" "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz" + "version" "4.0.1" + dependencies: + "base-x" "^3.0.2" + +"bs58check@^2.1.2": + "integrity" "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==" + "resolved" "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz" + "version" "2.1.2" + dependencies: + "bs58" "^4.0.0" + "create-hash" "^1.1.0" + "safe-buffer" "^5.1.2" + +"buffer-alloc-unsafe@^1.1.0": + "integrity" "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + "resolved" "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz" + "version" "1.1.0" + +"buffer-alloc@^1.2.0": + "integrity" "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==" + "resolved" "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz" + "version" "1.2.0" + dependencies: + "buffer-alloc-unsafe" "^1.1.0" + "buffer-fill" "^1.0.0" + +"buffer-fill@^1.0.0": + "integrity" "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + "resolved" "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz" + "version" "1.0.0" + +"buffer@^5.6.0": + "integrity" "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==" + "resolved" "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" + "version" "5.7.1" + dependencies: + "base64-js" "^1.3.1" + "ieee754" "^1.1.13" + +"chalk@^2.0.0": + "integrity" "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + "version" "2.4.2" + dependencies: + "ansi-styles" "^3.2.1" + "escape-string-regexp" "^1.0.5" + "supports-color" "^5.3.0" + +"chalk@^4.0.0": + "integrity" "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + +"cipher-base@^1.0.1": + "integrity" "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==" + "resolved" "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz" + "version" "1.0.4" + dependencies: + "inherits" "^2.0.1" + "safe-buffer" "^5.0.1" + +"color-convert@^1.9.0": + "integrity" "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==" + "resolved" "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" + "version" "1.9.3" + dependencies: + "color-name" "1.1.3" + +"color-convert@^2.0.1": + "integrity" "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==" + "resolved" "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" + "version" "2.0.1" + dependencies: + "color-name" "~1.1.4" + +"color-name@~1.1.4": + "integrity" "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "resolved" "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + "version" "1.1.4" + +"color-name@1.1.3": + "integrity" "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "resolved" "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + "version" "1.1.3" + +"commander@^4.0.0": + "integrity" "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + "resolved" "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz" + "version" "4.1.1" + +"cookiejar@^2.1.1": + "integrity" "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + "resolved" "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz" + "version" "2.1.4" + +"create-hash@^1.1.0": + "integrity" "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==" + "resolved" "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz" + "version" "1.2.0" + dependencies: + "cipher-base" "^1.0.1" + "inherits" "^2.0.1" + "md5.js" "^1.3.4" + "ripemd160" "^2.0.1" + "sha.js" "^2.4.0" + +"cross-spawn@^7.0.0": + "integrity" "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==" + "resolved" "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" + "version" "7.0.3" + dependencies: + "path-key" "^3.1.0" + "shebang-command" "^2.0.0" + "which" "^2.0.1" + +"debug@^4.3.4": + "integrity" "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==" + "resolved" "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + "version" "4.3.4" + dependencies: + "ms" "2.1.2" + +"diff-sequences@^26.6.2": + "integrity" "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==" + "resolved" "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz" + "version" "26.6.2" + +"dotenv@^16.0.3": + "integrity" "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + "resolved" "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz" + "version" "16.0.3" + +"env-cmd@^10.1.0": + "integrity" "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==" + "resolved" "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz" + "version" "10.1.0" + dependencies: + "commander" "^4.0.0" + "cross-spawn" "^7.0.0" + +"escape-string-regexp@^1.0.5": + "integrity" "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + "resolved" "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + "version" "1.0.5" + +"escape-string-regexp@^2.0.0": + "integrity" "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + "resolved" "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" + "version" "2.0.0" + +"event-target-shim@^5.0.0": + "integrity" "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + "resolved" "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" + "version" "5.0.1" + +"eventsource@^2.0.2": + "integrity" "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + "resolved" "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz" + "version" "2.0.2" + +"expect@^26.6.1": + "integrity" "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==" + "resolved" "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@jest/types" "^26.6.2" + "ansi-styles" "^4.0.0" + "jest-get-type" "^26.3.0" + "jest-matcher-utils" "^26.6.2" + "jest-message-util" "^26.6.2" + "jest-regex-util" "^26.0.0" + +"fast-json-stable-stringify@^2.1.0": + "integrity" "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "resolved" "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + "version" "2.1.0" + +"fetch-cookie@^2.0.3": + "integrity" "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==" + "resolved" "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz" + "version" "2.1.0" + dependencies: + "set-cookie-parser" "^2.4.8" + "tough-cookie" "^4.0.0" + +"fill-range@^7.0.1": + "integrity" "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==" + "resolved" "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz" + "version" "7.0.1" + dependencies: + "to-regex-range" "^5.0.1" + +"graceful-fs@^4.2.4": + "integrity" "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "resolved" "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" + "version" "4.2.11" + +"hamt_plus@1.0.2": + "integrity" "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + "resolved" "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz" + "version" "1.0.2" + +"has-flag@^3.0.0": + "integrity" "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + "resolved" "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" + "version" "3.0.0" + +"has-flag@^4.0.0": + "integrity" "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "resolved" "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" + "version" "4.0.0" + +"hash-base@^3.0.0": + "integrity" "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==" + "resolved" "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "inherits" "^2.0.4" + "readable-stream" "^3.6.0" + "safe-buffer" "^5.2.0" + +"ieee754@^1.1.13": + "integrity" "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "resolved" "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" + "version" "1.2.1" + +"inherits@^2.0.1", "inherits@^2.0.3", "inherits@^2.0.4": + "integrity" "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" + "version" "2.0.4" + +"is-number@^7.0.0": + "integrity" "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "resolved" "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" + "version" "7.0.0" + +"isexe@^2.0.0": + "integrity" "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "resolved" "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + "version" "2.0.0" + +"jest-diff@^26.6.2": + "integrity" "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==" + "resolved" "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "chalk" "^4.0.0" + "diff-sequences" "^26.6.2" + "jest-get-type" "^26.3.0" + "pretty-format" "^26.6.2" + +"jest-get-type@^26.3.0": + "integrity" "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==" + "resolved" "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz" + "version" "26.3.0" + +"jest-matcher-utils@^26.6.1", "jest-matcher-utils@^26.6.2": + "integrity" "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==" + "resolved" "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "chalk" "^4.0.0" + "jest-diff" "^26.6.2" + "jest-get-type" "^26.3.0" + "pretty-format" "^26.6.2" + +"jest-message-util@^26.6.2": + "integrity" "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==" + "resolved" "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" + "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" + "micromatch" "^4.0.2" + "pretty-format" "^26.6.2" + "slash" "^3.0.0" + "stack-utils" "^2.0.2" + +"jest-regex-util@^26.0.0": + "integrity" "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==" + "resolved" "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz" + "version" "26.0.0" + +"js-tokens@^4.0.0": + "integrity" "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "resolved" "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + "version" "4.0.0" + +"list@2.0.19": + "integrity" "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + "resolved" "https://registry.npmjs.org/list/-/list-2.0.19.tgz" + "version" "2.0.19" + +"lodash@^4.17.20": + "integrity" "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "resolved" "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + "version" "4.17.21" + +"md5.js@^1.3.4": + "integrity" "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==" + "resolved" "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz" + "version" "1.3.5" + dependencies: + "hash-base" "^3.0.0" + "inherits" "^2.0.1" + "safe-buffer" "^5.1.2" + +"micromatch@^4.0.2": + "integrity" "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==" + "resolved" "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" + "version" "4.0.5" + dependencies: + "braces" "^3.0.2" + "picomatch" "^2.3.1" + +"mri@^1.2.0": + "integrity" "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + "resolved" "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz" + "version" "1.2.0" + +"ms@2.1.2": + "integrity" "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "resolved" "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + "version" "2.1.2" + +"node-fetch@^2.6.7", "node-fetch@^2.6.8": + "integrity" "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==" + "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz" + "version" "2.6.9" + dependencies: + "whatwg-url" "^5.0.0" + +"p-timeout@^4.1.0": + "integrity" "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==" + "resolved" "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz" + "version" "4.1.0" + +"path-key@^3.1.0": + "integrity" "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + "resolved" "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + "version" "3.1.1" + +"picomatch@^2.3.1": + "integrity" "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + "resolved" "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + "version" "2.3.1" + +"prelude-ts@^1.0.6": + "integrity" "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==" + "resolved" "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz" + "version" "1.0.6" + dependencies: + "hamt_plus" "1.0.2" + "list" "2.0.19" + +"pretty-format@^26.6.2": + "integrity" "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==" + "resolved" "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@jest/types" "^26.6.2" + "ansi-regex" "^5.0.0" + "ansi-styles" "^4.0.0" + "react-is" "^17.0.1" + +"psl@^1.1.33": + "integrity" "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + "resolved" "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz" + "version" "1.9.0" + +"punycode@^2.1.1": + "integrity" "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + "resolved" "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" + "version" "2.3.0" + +"querystringify@^2.1.1": + "integrity" "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + "resolved" "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz" + "version" "2.2.0" + +"react-is@^17.0.1": + "integrity" "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + "resolved" "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" + "version" "17.0.2" + +"readable-stream@^3.6.0": + "integrity" "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==" + "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" + "version" "3.6.2" + dependencies: + "inherits" "^2.0.3" + "string_decoder" "^1.1.1" + "util-deprecate" "^1.0.1" + +"requires-port@^1.0.0": + "integrity" "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + "resolved" "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" + "version" "1.0.0" + +"ripemd160@^2.0.1": + "integrity" "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==" + "resolved" "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz" + "version" "2.0.2" + dependencies: + "hash-base" "^3.0.0" + "inherits" "^2.0.1" + +"rx-sandbox@^1.0.3": + "integrity" "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==" + "resolved" "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz" + "version" "1.0.4" + dependencies: + "expect" "^26.6.1" + "jest-matcher-utils" "^26.6.1" + +"rxjs@^6.6.3", "rxjs@6.x": + "integrity" "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==" + "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz" + "version" "6.6.7" + dependencies: + "tslib" "^1.9.0" + +"rxjs@^7.4.0": + "integrity" "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==" + "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz" + "version" "7.8.1" + dependencies: + "tslib" "^2.1.0" + +"safe-buffer@^5.0.1", "safe-buffer@^5.1.2", "safe-buffer@^5.2.0", "safe-buffer@~5.2.0": + "integrity" "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "resolved" "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + "version" "5.2.1" + +"safe-compare@^1.1.4": + "integrity" "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==" + "resolved" "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz" + "version" "1.1.4" + dependencies: + "buffer-alloc" "^1.2.0" + +"sandwich-stream@^2.0.2": + "integrity" "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==" + "resolved" "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz" + "version" "2.0.2" + +"set-cookie-parser@^2.4.8": + "integrity" "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + "resolved" "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz" + "version" "2.6.0" + +"sha.js@^2.4.0": + "integrity" "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==" + "resolved" "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz" + "version" "2.4.11" + dependencies: + "inherits" "^2.0.1" + "safe-buffer" "^5.0.1" + +"shebang-command@^2.0.0": + "integrity" "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==" + "resolved" "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + "version" "2.0.0" + dependencies: + "shebang-regex" "^3.0.0" + +"shebang-regex@^3.0.0": + "integrity" "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + "resolved" "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + "version" "3.0.0" + +"slash@^3.0.0": + "integrity" "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + "resolved" "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" + "version" "3.0.0" + +"stack-utils@^2.0.2": + "integrity" "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==" + "resolved" "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" + "version" "2.0.6" + dependencies: + "escape-string-regexp" "^2.0.0" + +"string_decoder@^1.1.1": + "integrity" "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==" + "resolved" "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + "version" "1.3.0" + dependencies: + "safe-buffer" "~5.2.0" + +"supports-color@^5.3.0": + "integrity" "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==" + "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" + "version" "5.5.0" + dependencies: + "has-flag" "^3.0.0" + +"supports-color@^7.1.0": + "integrity" "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==" + "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" + "version" "7.2.0" + dependencies: + "has-flag" "^4.0.0" + +"telegraf@^4.12.3-canary.1": + "integrity" "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==" + "resolved" "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz" + "version" "4.12.3-canary.1" + dependencies: + "abort-controller" "^3.0.0" + "debug" "^4.3.4" + "mri" "^1.2.0" + "node-fetch" "^2.6.8" + "p-timeout" "^4.1.0" + "safe-compare" "^1.1.4" + "sandwich-stream" "^2.0.2" + "typegram" "^4.3.0" + +"to-regex-range@^5.0.1": + "integrity" "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==" + "resolved" "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" + "version" "5.0.1" + dependencies: + "is-number" "^7.0.0" + +"tough-cookie@^4.0.0": + "integrity" "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==" + "resolved" "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "psl" "^1.1.33" + "punycode" "^2.1.1" + "universalify" "^0.2.0" + "url-parse" "^1.5.3" + +"tr46@~0.0.3": + "integrity" "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + "version" "0.0.3" + +"tslib@^1.9.0": + "integrity" "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "resolved" "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" + "version" "1.14.1" + +"tslib@^2.1.0": + "integrity" "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz" + "version" "2.5.0" + +"typegram@^4.3.0": + "integrity" "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + "resolved" "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz" + "version" "4.3.0" + +"typescript@^4.8.2": + "integrity" "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" + "version" "4.9.5" + +"universalify@^0.2.0": + "integrity" "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + "resolved" "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz" + "version" "0.2.0" + +"url-parse@^1.5.3": + "integrity" "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==" + "resolved" "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz" + "version" "1.5.10" + dependencies: + "querystringify" "^2.1.1" + "requires-port" "^1.0.0" + +"util-deprecate@^1.0.1": + "integrity" "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "resolved" "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "version" "1.0.2" + +"webidl-conversions@^3.0.0": + "integrity" "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + "version" "3.0.1" + +"whatwg-url@^5.0.0": + "integrity" "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==" + "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + "version" "5.0.0" + dependencies: + "tr46" "~0.0.3" + "webidl-conversions" "^3.0.0" + +"which@^2.0.1": + "integrity" "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==" + "resolved" "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + "version" "2.0.2" + dependencies: + "isexe" "^2.0.0" + +"ws@^7.4.5": + "integrity" "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==" + "resolved" "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz" + "version" "7.5.9" + +"xhr2-cookies@^1.1.0": + "integrity" "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==" + "resolved" "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz" + "version" "1.1.0" + dependencies: + "cookiejar" "^2.1.1" diff --git a/batcher-bot/src/bot.ts b/batcher-bot/src/bot.ts deleted file mode 100644 index b26edf9e..00000000 --- a/batcher-bot/src/bot.ts +++ /dev/null @@ -1,70 +0,0 @@ - -import { TezosToolkit } from '@taquito/taquito'; -import { Telegraf } from 'telegraf'; -import { interval } from 'rxjs'; -import { HubConnection, HubConnectionBuilder } from '@microsoft/signalr'; -import { MessageType, format } from './formatter' -const contractAddress = process.env["BATCHER_ADDRESS"]; -const botToken = process.env["BOT_TOKEN"]; -const channelId = process.env["CHANNEL_ID"]; -const nodeUri = process.env["TEZOS_NODE_URI"]; -const tzktUri = process.env["TZKT_URI_API"]; - - - -const sendToTelegram = async (bot:Telegraf, message:string, options: any) => { - await bot.telegram.sendMessage(channelId, message, options); -}; - -const init = async (bot:Telegraf, socketConnection:HubConnection) => { - await socketConnection.start(); - - await socketConnection.invoke('SubscribeToBigMaps', { - contract: contractAddress, - }); - - await socketConnection.invoke('SubscribeToOperations', { - address: contractAddress, - types: 'transaction', - }); - - socketConnection.on('bigmaps', (msg: any) => { - if (!msg.data) return; - for (let i = 0; i < Object.keys(msg.data).length; i++) { - try{ - if (msg.data[i].path == 'rates_current' || msg.data[i].path == 'batch_set.batches') { - const formattedMessage = format(MessageType.BIGMAP, msg.data[i]); - sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); - }} catch (error) { - console.info("Error parsing bigmap", error.message); - console.error(error); - } - } - }); - socketConnection.on('operations', (msg: any) => { - if (!msg.data) return; - for (let i = 0; i < Object.keys(msg.data).length; i++) { - try{ - if (msg.data[i].parameter) { - if (msg.data[i].parameter.entrypoint == 'deposit') { - const formattedMessage = format(MessageType.OPERATION, msg.data[i]); - console.info("formattedMessage", formattedMessage); - sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); - } - } - } catch (error) { - console.info("Error parsing operation", error.message); - console.error(error); - } - } - }); - -}; - - export const start = (bot:Telegraf, socketConnection: HubConnection) => { - // Start the web socket - init(bot, socketConnection).then(r => console.info("started socket")) - socketConnection.onclose(() => init(bot,socketConnection)); -// Start the Telegram bot. - bot.launch(); -}; diff --git a/batcher-bot/src/formatter.ts b/batcher-bot/src/formatter.ts deleted file mode 100644 index a5bd7614..00000000 --- a/batcher-bot/src/formatter.ts +++ /dev/null @@ -1,188 +0,0 @@ -import {text} from "stream/consumers"; - - - - -export enum MessageType { - BIGMAP = 0, - OPERATION = 1 -} - -const getPairName = (fromName:string, toName:string) => { - if (fromName > toName){ - return fromName + "/" + toName; - } - - return toName + "/" + fromName; -}; - -const getScaledRate = (rate_obj:any, swap:any) => { - try{ - const numerator = rate_obj.p; - const denominator = rate_obj.q; - const scale = swap.from.token.decimals - swap.to.decimals; - const rate = numerator / denominator; - return rate * (10 ** scale); - } catch (error) { - console.info("Error scaling rate", error.message); - console.error(error); - return 0; - } - -} - -const formatRatesCurrent = (rateMessage: any) => { - - try{ - const name = rateMessage.content.key; - const pl = rateMessage.content.value; - const scaledRate = getScaledRate(pl.rate, pl.swap); - - return "Oracle Update - " + name + " " + scaledRate + ""; - } catch (error) { - console.info("Error formatting rates", error.message); - console.error(error); - return "error" + error.message; - - } -} - -const formatBatchChange = (message:any) => { - try{ - const val = message.content.value; - const batch_number = val.batch_number; - const buy_decimals = val.pair.decimals_0; - const sell_decimals = val.pair.decimals_1; - const buy_name = val.pair.name_0; - const sell_name = val.pair.name_1; - const status = Object.keys(val.status)[0]; - const raw_buy_volume = val.volumes.buy_total_volume; - const raw_sell_volume = val.volumes.sell_total_volume; - const buy_volume = raw_buy_volume / (10 ** buy_decimals); - const sell_volume = raw_sell_volume / (10 ** sell_decimals); - - let rate_name = getPairName(buy_name, sell_name); - let status_message = status; - - if(status == 'open'){ - status_message = "Open (" + val.status.open + ")"; - } - if(status == 'closed'){ - status_message = "Closed (" + val.status.closed.closing_time + ")"; - } - if(status == 'cleared'){ - let rate = getScaledRate(val.status.cleared.rate.rate, val.status.cleared.rate.swap); - status_message = "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate ; - } - - return " BATCH UPDATE " + batch_number + " " + rate_name + " " + status_message + " - BUY VOLUME " + buy_volume + " " + buy_name + " | SELL VOLUME " + sell_volume + " " + sell_name + ""; - - - } catch (error) { - console.info("Error formatting batch change"); - console.error(error); - return "" + JSON.stringify(message.content) + ""; - } -} - -const formatBigMap = (message:any) => { - if(message.path == "rates_current"){ - return formatRatesCurrent(message) - } - if (message.path == 'batch_set.batches') { - return formatBatchChange(message); - } -return "" + JSON.stringify(message.content) + ""; -} - -const getSide = (side:number) => { - if(side == 0){ - return "BUY"; - } - - return "SELL"; -} - -const getTolerance = (side:number, tolerance:number) => { - if(side == 0 ){ - if(tolerance == 0){ - return "WORST PRICE / BETTER FILL"; - } - - if(tolerance == 1) { - return "ORACLE"; - } - - return "BETTER PRICE / WORSE FILL"; - - } - - - if(tolerance == 0){ - return "BETTER PRICE / WORSE FILL"; - } - - if(tolerance == 1) { - return "ORACLE"; - } - - return "WORSE PRICE / BETTER FILL"; - - -} - -const scaleAmount = (amount: number, tokenDecimals: number) => { - return amount / (10 ** tokenDecimals); -}; - - -const formatDeposit = (message:any) => { - const val = message.parameter.value - const side = getSide(val.side); - const tolerance = getTolerance(val.side, val.tolerance); - const pair =getPairName(message.parameter.value.swap.from.token.name, message.parameter.value.swap.to.name); - const from = message.parameter.value.swap.from; - const to = message.parameter.value.swap.to; - const amount = scaleAmount(from.amount, from.token.decimals); - - return " TRADE ON " + pair + " " + side + " @ " + tolerance + " for " + amount + " " + message.parameter.value.swap.from.token.name; - - -} - - -const formatOperation = (message:any) => { - const entrypoint = message.parameter.entrypoint; - if(entrypoint == 'deposit'){ - return formatDeposit(message); - } - return " OP:" + JSON.stringify(message.parameter) + ""; - -} - -export const format = (msgType: MessageType, message:any) => { - try{ - let html = ''; - if(msgType == MessageType.BIGMAP){ - html = formatBigMap(message); - } - - if(msgType == MessageType.OPERATION){ - html = formatOperation(message); - } - - - let htmlOptions = { - parse_mode: 'HTML', - disable_web_page_preview: true, - }; - - return [html, htmlOptions]; - } catch (error) { - console.error(error); - let textOptions = { - parse_mode: 'TEXT', - }; - return [message, textOptions]; - } -} diff --git a/batcher-bot/src/index.ts b/batcher-bot/src/index.ts deleted file mode 100644 index f1cf0d1e..00000000 --- a/batcher-bot/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { config } from 'dotenv'; -config(); - -import { TezosToolkit } from '@taquito/taquito'; -import { Telegraf } from 'telegraf'; -import { interval } from 'rxjs'; -import { start } from "./bot" -import { HubConnection, HubConnectionBuilder } from '@microsoft/signalr'; - -const contractAddress = process.env["BATCHER_ADDRESS"]; -const botToken = process.env["BOT_TOKEN"]; -const channelId = process.env["CHANNEL_ID"]; -const nodeUri = process.env["TEZOS_NODE_URI"]; -const tzktUri = process.env["TZKT_URI_API"]; - -const bot = new Telegraf(botToken); -const socketConnection = new HubConnectionBuilder().withUrl(tzktUri + '/v1/ws').build(); - -start(bot, socketConnection); diff --git a/batcher-bot/yarn.lock b/batcher-bot/yarn.lock deleted file mode 100644 index 3441ba5a..00000000 --- a/batcher-bot/yarn.lock +++ /dev/null @@ -1,807 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0": - version "7.21.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" - integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== - dependencies: - "@babel/highlight" "^7.18.6" - -"@babel/helper-validator-identifier@^7.18.6": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" - integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== - -"@babel/highlight@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" - integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== - dependencies: - "@babel/helper-validator-identifier" "^7.18.6" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@dipdup/tzkt-api@^0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz#03ba65a31cad1f2770238efe632ada7d46e0eaec" - integrity sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g== - -"@jest/types@^26.6.2": - version "26.6.2" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" - integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^15.0.0" - chalk "^4.0.0" - -"@microsoft/signalr@^7.0.5": - version "7.0.5" - resolved "https://registry.yarnpkg.com/@microsoft/signalr/-/signalr-7.0.5.tgz#e7a984ac1f1b6a488170e9cb2f2f46a5d97d5f80" - integrity sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA== - dependencies: - abort-controller "^3.0.0" - eventsource "^2.0.2" - fetch-cookie "^2.0.3" - node-fetch "^2.6.7" - ws "^7.4.5" - -"@taquito/http-utils@^8.1.0": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-8.1.1.tgz#62eb983a6e9c1a2f1806327b8c7b6f6dec00024c" - integrity sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w== - dependencies: - xhr2-cookies "^1.1.0" - -"@taquito/michel-codec@^8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/michel-codec/-/michel-codec-8.1.1.tgz#23ba8255215db72c60e0f52ff1616cf9830c6aa5" - integrity sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ== - -"@taquito/michelson-encoder@^8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz#153e45cb90028a13aa2f18571185e93047dcb3be" - integrity sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg== - dependencies: - "@taquito/rpc" "^8.1.1" - "@taquito/utils" "^8.1.0" - bignumber.js "^9.0.1" - fast-json-stable-stringify "^2.1.0" - -"@taquito/rpc@^8.1.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-8.1.1.tgz#cdbf9d7ba24346034bf0f02ebf634e846801811a" - integrity sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg== - dependencies: - "@taquito/http-utils" "^8.1.0" - bignumber.js "^9.0.1" - lodash "^4.17.20" - -"@taquito/taquito@^8.0.1": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-8.1.1.tgz#284c760414013d9aa12343a4784c3057f62ffa8b" - integrity sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A== - dependencies: - "@taquito/http-utils" "^8.1.0" - "@taquito/michel-codec" "^8.1.1" - "@taquito/michelson-encoder" "^8.1.1" - "@taquito/rpc" "^8.1.1" - "@taquito/utils" "^8.1.0" - bignumber.js "^9.0.1" - rx-sandbox "^1.0.3" - rxjs "^6.6.3" - -"@taquito/utils@^8.1.0": - version "8.1.1" - resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-8.1.1.tgz#b9fbc880308ad814ae15b4f3402fd40c4ecc7c23" - integrity sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g== - dependencies: - blakejs "^1.1.0" - bs58check "^2.1.2" - buffer "^5.6.0" - -"@tsconfig/node16-strictest@^1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz#14218b0341223d5caa692fa789fb374909690875" - integrity sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ== - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" - integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== - -"@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" - integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/node@*", "@types/node@^18.7.14": - version "18.16.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.2.tgz#2f610ea71034b3971c312192377f8a7178eb57f1" - integrity sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg== - -"@types/stack-utils@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" - integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== - -"@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== - -"@types/yargs@^15.0.0": - version "15.0.15" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.15.tgz#e609a2b1ef9e05d90489c2f5f45bbfb2be092158" - integrity sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg== - dependencies: - "@types/yargs-parser" "*" - -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -ansi-regex@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -base-x@^3.0.2: - version "3.0.9" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" - integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== - dependencies: - safe-buffer "^5.0.1" - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bignumber.js@^9.0.1: - version "9.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" - integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== - -blakejs@^1.1.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" - integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== - -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -bs58@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" - integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== - dependencies: - base-x "^3.0.2" - -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" - integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== - dependencies: - bs58 "^4.0.0" - create-hash "^1.1.0" - safe-buffer "^5.1.2" - -buffer-alloc-unsafe@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" - integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== - -buffer-alloc@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" - integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== - dependencies: - buffer-alloc-unsafe "^1.1.0" - buffer-fill "^1.0.0" - -buffer-fill@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" - integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== - -buffer@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -cipher-base@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -commander@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - -cookiejar@^2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" - integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== - -create-hash@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -cross-spawn@^7.0.0: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -diff-sequences@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" - integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== - -dotenv@^16.0.3: - version "16.0.3" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" - integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== - -env-cmd@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b" - integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA== - dependencies: - commander "^4.0.0" - cross-spawn "^7.0.0" - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - -eventsource@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" - integrity sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA== - -expect@^26.6.1: - version "26.6.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" - integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== - dependencies: - "@jest/types" "^26.6.2" - ansi-styles "^4.0.0" - jest-get-type "^26.3.0" - jest-matcher-utils "^26.6.2" - jest-message-util "^26.6.2" - jest-regex-util "^26.0.0" - -fast-json-stable-stringify@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fetch-cookie@^2.0.3: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fetch-cookie/-/fetch-cookie-2.1.0.tgz#6e127909912f9e527533b045aab555c06b33801b" - integrity sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg== - dependencies: - set-cookie-parser "^2.4.8" - tough-cookie "^4.0.0" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -graceful-fs@^4.2.4: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== - dependencies: - inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - -ieee754@^1.1.13: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -jest-diff@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" - integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== - dependencies: - chalk "^4.0.0" - diff-sequences "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" - -jest-get-type@^26.3.0: - version "26.3.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" - integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== - -jest-matcher-utils@^26.6.1, jest-matcher-utils@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" - integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== - dependencies: - chalk "^4.0.0" - jest-diff "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" - -jest-message-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" - integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== - dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.6.2" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.4" - micromatch "^4.0.2" - pretty-format "^26.6.2" - slash "^3.0.0" - stack-utils "^2.0.2" - -jest-regex-util@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" - integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -lodash@^4.17.20: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -micromatch@^4.0.2: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mri@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" - integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -node-fetch@^2.6.7, node-fetch@^2.6.8: - version "2.6.9" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" - integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== - dependencies: - whatwg-url "^5.0.0" - -p-timeout@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-4.1.0.tgz#788253c0452ab0ffecf18a62dff94ff1bd09ca0a" - integrity sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw== - -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pretty-format@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" - integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== - dependencies: - "@jest/types" "^26.6.2" - ansi-regex "^5.0.0" - ansi-styles "^4.0.0" - react-is "^17.0.1" - -psl@^1.1.33: - version "1.9.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" - integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== - -punycode@^2.1.1: - version "2.3.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" - integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -react-is@^17.0.1: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" - integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== - -readable-stream@^3.6.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -rx-sandbox@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/rx-sandbox/-/rx-sandbox-1.0.4.tgz#821a1d64e5f0d88658da7a5dbbd735b13277648b" - integrity sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA== - dependencies: - expect "^26.6.1" - jest-matcher-utils "^26.6.1" - -rxjs@^6.6.3: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - -rxjs@^7.4.0: - version "7.8.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" - integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== - dependencies: - tslib "^2.1.0" - -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-compare@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/safe-compare/-/safe-compare-1.1.4.tgz#5e0128538a82820e2e9250cd78e45da6786ba593" - integrity sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ== - dependencies: - buffer-alloc "^1.2.0" - -sandwich-stream@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sandwich-stream/-/sandwich-stream-2.0.2.tgz#6d1feb6cf7e9fe9fadb41513459a72c2e84000fa" - integrity sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== - -set-cookie-parser@^2.4.8: - version "2.6.0" - resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" - integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== - -sha.js@^2.4.0: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -stack-utils@^2.0.2: - version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" - integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== - dependencies: - escape-string-regexp "^2.0.0" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -telegraf@^4.12.3-canary.1: - version "4.12.3-canary.1" - resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.3-canary.1.tgz#01ac0ecb0b73721bbeb1052b91c036a5120727b7" - integrity sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw== - dependencies: - abort-controller "^3.0.0" - debug "^4.3.4" - mri "^1.2.0" - node-fetch "^2.6.8" - p-timeout "^4.1.0" - safe-compare "^1.1.4" - sandwich-stream "^2.0.2" - typegram "^4.3.0" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874" - integrity sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -tslib@^1.9.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tslib@^2.1.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== - -typegram@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/typegram/-/typegram-4.3.0.tgz#690ec1287f771608070e149c92de4fca42e54db0" - integrity sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg== - -typescript@^4.8.2: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -util-deprecate@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -ws@^7.4.5: - version "7.5.9" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" - integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== - -xhr2-cookies@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" - integrity sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g== - dependencies: - cookiejar "^2.1.1" From c06fd21ff943048e0985f6358297e6b57b78afeb Mon Sep 17 00:00:00 2001 From: Cyril B Date: Thu, 11 May 2023 11:46:08 +0200 Subject: [PATCH 054/108] remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot --- .github/workflows/docker-ghostnet.yml | 18 +- .github/workflows/docker-mainnet.yml | 18 +- .gitignore | 2 + batcher-bot/notifications/.env.ghostnet | 3 +- .../{config/.ghostnet.env => .env.mainnet} | 4 +- batcher-bot/notifications/.gitignore | 31 - .../Dockerfile.bot.notifications | 0 .../Dockerfile.bot.notifications.ghostnet | 19 + .../Dockerfile.bot.notifications.mainnet | 19 + batcher-bot/notifications/package.json | 8 +- .../{config/.mainnet.env => src/.env} | 3 +- batcher-bot/notifications/src/bot.ts | 16 +- batcher-bot/notifications/src/formatter.ts | 90 ++- batcher-bot/notifications/src/index.ts | 2 +- batcher-bot/notifications/yarn-error.log | 723 ++++++++++++++++++ batcher-ui/src/pages/Main.tsx | 18 +- 16 files changed, 879 insertions(+), 95 deletions(-) rename batcher-bot/notifications/{config/.ghostnet.env => .env.mainnet} (54%) delete mode 100644 batcher-bot/notifications/.gitignore delete mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications create mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet create mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications.mainnet rename batcher-bot/notifications/{config/.mainnet.env => src/.env} (81%) create mode 100644 batcher-bot/notifications/yarn-error.log diff --git a/.github/workflows/docker-ghostnet.yml b/.github/workflows/docker-ghostnet.yml index 32a32057..ca03c4b2 100644 --- a/.github/workflows/docker-ghostnet.yml +++ b/.github/workflows/docker-ghostnet.yml @@ -19,14 +19,14 @@ jobs: - name: Set outputs id: vars run: | - echo "::set-output name=date::$(date +%Y-%m-%dT%H-%M-%S)" - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "date=$(date +%Y-%m-%dT%H-%M-%S)" >> "${GITHUB_OUTPUT}" + echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}" - name: Set up Docker Buildx uses: docker/Setup-buildx-action@v2 - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -43,3 +43,15 @@ jobs: ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release cache-from: type=gha cache-to: type=gha,mode=max + + - name: Build and push release version of notification bot + uses: docker/build-push-action@v3 + with: + file: ./batcher-bot/Dockerfile.bot.notifications.${{ matrix.network }} + context: ./batcher-bot/notifications + push: true + tags: | + ghcr.io/marigold-dev/batcher-bot-notification-${{ matrix.network }}:stable + ghcr.io/marigold-dev/batcher-bot-notifications-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker-mainnet.yml b/.github/workflows/docker-mainnet.yml index 6fbf153f..00f3a3d2 100644 --- a/.github/workflows/docker-mainnet.yml +++ b/.github/workflows/docker-mainnet.yml @@ -21,14 +21,14 @@ jobs: - name: Set outputs id: vars run: | - echo "::set-output name=date::$(date +%Y-%m-%dT%H-%M-%S)" - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "date=$(date +%Y-%m-%dT%H-%M-%S)" >> "${GITHUB_OUTPUT}" + echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}" - name: Set up Docker Buildx uses: docker/Setup-buildx-action@v2 - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -46,3 +46,15 @@ jobs: ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release cache-from: type=gha cache-to: type=gha,mode=max + + - name: Build and push release version of notification bot + uses: docker/build-push-action@v3 + with: + file: ./batcher-bot/Dockerfile.bot.notifications.${{ matrix.network }} + context: ./batcher-bot/notifications + push: true + tags: | + ghcr.io/marigold-dev/batcher-bot-notification-${{ matrix.network }}:stable + ghcr.io/marigold-dev/batcher-bot-notifications-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore index d3b3bcd4..c9eb4589 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ USDT_token_storage.tz # Tezos client artefacts .tezos-client/ +./*/node_modules/ +batcher-bot/notifications/node_modules/ diff --git a/batcher-bot/notifications/.env.ghostnet b/batcher-bot/notifications/.env.ghostnet index c384ae26..dc650e0e 100644 --- a/batcher-bot/notifications/.env.ghostnet +++ b/batcher-bot/notifications/.env.ghostnet @@ -1,5 +1,4 @@ BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev TZKT_URI_API=https://api.ghostnet.tzkt.io -BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM -CHANNEL_ID=-1001815478811 +NOTIFICATIONS=deposits,rates,status_updates diff --git a/batcher-bot/notifications/config/.ghostnet.env b/batcher-bot/notifications/.env.mainnet similarity index 54% rename from batcher-bot/notifications/config/.ghostnet.env rename to batcher-bot/notifications/.env.mainnet index f0b694a7..81d9255c 100644 --- a/batcher-bot/notifications/config/.ghostnet.env +++ b/batcher-bot/notifications/.env.mainnet @@ -1,6 +1,4 @@ BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev TZKT_URI_API=https://api.ghostnet.tzkt.io -BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM -CHANNEL_ID=batcher-dev -NOTIFICATIONS=deposits,rates,status_updates +NOTIFICATIONS=deposits diff --git a/batcher-bot/notifications/.gitignore b/batcher-bot/notifications/.gitignore deleted file mode 100644 index ed064ab0..00000000 --- a/batcher-bot/notifications/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz -*.exe - -pids -logs -results - -npm-debug.log -node_modules -coverage -tmp -issues/ -test/fixtures/test* - -.idea -./compile/**/*.* -out -obfuscated -dist* -release -dist -.env -dist -.env \ No newline at end of file diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications b/batcher-bot/notifications/Dockerfile.bot.notifications deleted file mode 100644 index e69de29b..00000000 diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet b/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet new file mode 100644 index 00000000..e2352575 --- /dev/null +++ b/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet @@ -0,0 +1,19 @@ +FROM node:latest as builder + +WORKDIR /app + +COPY ./package.json ./ + +RUN npm install + +COPY ./tsconfig.json ./ +COPY ./src ./src +COPY ./.env.ghostnet ./.env.ghostnet + +RUN npm run build:ghostnet + + +FROM node:latest +COPY --from=builder /app /usr/share/batcher/bot +WORKDIR /usr/share/batcher/bot +CMD [ "npm", "run", "start:ghostnet" ] diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet b/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet new file mode 100644 index 00000000..947e271b --- /dev/null +++ b/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet @@ -0,0 +1,19 @@ +FROM node:latest as builder + +WORKDIR /app + +COPY ./package.json ./ + +RUN npm install + +COPY ./tsconfig.json ./ +COPY ./src ./src +COPY ./.env.mainnet ./.env.mainnet + +RUN npm run build:mainnet + + +FROM node:latest +COPY --from=builder /app /usr/share/batcher/bot +WORKDIR /usr/share/batcher/bot +CMD [ "npm", "run", "start:mainnet" ] diff --git a/batcher-bot/notifications/package.json b/batcher-bot/notifications/package.json index 7e68fa47..56c0faf0 100644 --- a/batcher-bot/notifications/package.json +++ b/batcher-bot/notifications/package.json @@ -7,10 +7,10 @@ "ts-node-nix": "dist/index.js" }, "scripts": { - "start-ghostnet": "env-cmd -f .env.ghostnet node dist/index.js", - "build-ghostnet": "env-cmd -f .env.ghostnet tsc", - "start-mainnet": "env-cmd -f .env.mainnet node dist/index.js", - "build-mainnet": "env-cmd -f .env.mainnet tsc", + "start:ghostnet": "env-cmd -f .env.ghostnet node dist/index.js", + "build:ghostnet": "env-cmd -f .env.ghostnet tsc", + "start:mainnet": "env-cmd -f .env.mainnet node dist/index.js", + "build:mainnet": "env-cmd -f .env.mainnet tsc", "dev": "env-cmd -e ghostnet ts-node-dev --no-notify --respawn src/index.ts", "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/batcher-bot/notifications/config/.mainnet.env b/batcher-bot/notifications/src/.env similarity index 81% rename from batcher-bot/notifications/config/.mainnet.env rename to batcher-bot/notifications/src/.env index a8367a54..f6394955 100644 --- a/batcher-bot/notifications/config/.mainnet.env +++ b/batcher-bot/notifications/src/.env @@ -2,5 +2,4 @@ BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev TZKT_URI_API=https://api.ghostnet.tzkt.io BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM -CHANNEL_ID=batcher-dev -NOTIFICATIONS=deposits +CHANNEL_ID=batcher-bot-dev-test diff --git a/batcher-bot/notifications/src/bot.ts b/batcher-bot/notifications/src/bot.ts index 2946785d..fc294714 100644 --- a/batcher-bot/notifications/src/bot.ts +++ b/batcher-bot/notifications/src/bot.ts @@ -15,6 +15,8 @@ const channelId = process.env["CHANNEL_ID"]; const tzktUri = process.env["TZKT_URI_API"]; const sendToTelegram = async (bot: Telegraf, message: string, options: any) => { + console.info("Sending message:", message); + console.info("With options", options); await bot.telegram.sendMessage(channelId, message, options); }; @@ -36,6 +38,7 @@ const init = async ( socketConnection.on("bigmaps", (msg: any) => { if (!msg.data) return; + console.info("----->>>>> Bigmap recevied ", msg.data); for (let i = 0; i < Object.keys(msg.data).length; i++) { try { if ( @@ -49,7 +52,12 @@ const init = async ( ); if (formattedMessageOpt.isSome()) { const formattedMessage = formattedMessageOpt.get(); - sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + console.info("Bigmap formatted contents", formattedMessage); + sendToTelegram( + bot, + formattedMessage.message, + formattedMessage.message_options + ); } } } catch (error) { @@ -72,7 +80,11 @@ const init = async ( if (formattedMessageOpt.isSome()) { const formattedMessage = formattedMessageOpt.get(); console.info("formattedMessage", formattedMessage); - sendToTelegram(bot, formattedMessage[0], formattedMessage[1]); + sendToTelegram( + bot, + formattedMessage.message, + formattedMessage.message_options + ); } } } diff --git a/batcher-bot/notifications/src/formatter.ts b/batcher-bot/notifications/src/formatter.ts index a4e9b38a..fb5f8780 100644 --- a/batcher-bot/notifications/src/formatter.ts +++ b/batcher-bot/notifications/src/formatter.ts @@ -6,6 +6,9 @@ import { } from "./types"; import { Option, None } from "prelude-ts"; +const tzktUri = process.env["TZKT_URI_API"]; + +// eslint-disable-next-line @typescript-eslint/no-shadow const getPairName = (fromName: string, toName: string) => { if (fromName > toName) { return fromName + "/" + toName; @@ -44,7 +47,7 @@ const formatRatesCurrent = (rateMessage: any) => { } }; -const formatBatchChange = (message: any) => { +const formatBatchChange = (message: any): Option => { try { const val = message.content.value; const batch_number = val.batch_number; @@ -76,34 +79,38 @@ const formatBatchChange = (message: any) => { "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate; } - return ( - " BATCH UPDATE " + - batch_number + - " " + - rate_name + - " " + - status_message + - " - BUY VOLUME " + - buy_volume + - " " + - buy_name + - " | SELL VOLUME " + - sell_volume + - " " + - sell_name + - "" - ); + if (buy_volume == 0 || sell_volume == 0) { + return Option.none(); + } else { + return Option.of( + " BATCH UPDATE " + + batch_number + + " " + + rate_name + + " " + + status_message + + " - BUY VOLUME " + + buy_volume + + " " + + buy_name + + " | SELL VOLUME " + + sell_volume + + " " + + sell_name + + "" + ); + } } catch (error) { console.info("Error formatting batch change"); console.error(error); - return "" + JSON.stringify(message.content) + ""; + return Option.none(); } }; const formatBigMap = ( message: any, notifications_enabled: NotificationsEnabled -) : Option => { +): Option => { if (message.path == "rates_current" && notifications_enabled.rates) { return Option.of(formatRatesCurrent(message)); } @@ -111,7 +118,7 @@ const formatBigMap = ( message.path == "batch_set.batches" && notifications_enabled.batch_status ) { - return Option.of(formatBatchChange(message)); + return formatBatchChange(message); } return Option.none(); @@ -154,6 +161,7 @@ const scaleAmount = (amount: number, tokenDecimals: number) => { }; const formatDeposit = (message: any) => { + console.info("Formatting deposit message", JSON.stringify(message)); const val = message.parameter.value; const side = getSide(val.side); const tolerance = getTolerance(val.side, val.tolerance); @@ -165,18 +173,20 @@ const formatDeposit = (message: any) => { const to = message.parameter.value.swap.to; const amount = scaleAmount(from.amount, from.token.decimals); - return ( - " TRADE ON " + - pair + - " " + - side + - " @ " + - tolerance + - " for " + - amount + - " " + - message.parameter.value.swap.from.token.name - ); + let batch_id = ""; + let volumes = ""; + try { + console.info("Message storage", message.storage); + const storage = message.storage; + const current_batch_ids = storage.batch_set.current_batch_indices; + console.info("Current batch ids", current_batch_ids); + const pair_batch_id = current_batch_ids[pair]; + batch_id = `Batch ${pair_batch_id}`; + } catch (error) { + console.error(error); + } + + return `${batch_id} TRADE ON ${pair} ${side}@${tolerance} for ${amount} ${message.parameter.value.swap.from.token.name}`; }; const formatOperation = ( @@ -203,13 +213,13 @@ export const format = ( if (msgType == MessageType.BIGMAP) { const html: Option = formatBigMap(message, notifications_enabled); - if (html.isSome()) { - const htmlMessage: string = html.get(); - return Option.of({ - message: htmlMessage, - message_options: htmlOptions, + if (html.isSome()) { + const htmlMessage: string = html.get(); + return Option.of({ + message: htmlMessage, + message_options: htmlOptions, }); - } + } } if (msgType == MessageType.OPERATION) { @@ -223,7 +233,7 @@ export const format = ( } } - return Option.none(); + return Option.none(); } catch (error) { console.error(error); let textOptions = { diff --git a/batcher-bot/notifications/src/index.ts b/batcher-bot/notifications/src/index.ts index 03fd52db..f24b82ba 100644 --- a/batcher-bot/notifications/src/index.ts +++ b/batcher-bot/notifications/src/index.ts @@ -24,7 +24,7 @@ const socketConnection = new HubConnectionBuilder() let notifications_enabled: NotificationsEnabled = { deposits: notifications.includes("deposits"), rates: notifications.includes("rates"), - batch_status: notifications.includes("batch_status"), + batch_status: notifications.includes("status_updates"), }; start(bot, socketConnection, notifications_enabled); diff --git a/batcher-bot/notifications/yarn-error.log b/batcher-bot/notifications/yarn-error.log new file mode 100644 index 00000000..f4abec5f --- /dev/null +++ b/batcher-bot/notifications/yarn-error.log @@ -0,0 +1,723 @@ +Arguments: + /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin/node /home/jason/.nix-profile/bin/yarn add dontenv + +PATH: + /nix/store/i1ybm7a1sg6231q6g900dbckdx1frd60-kitty-0.26.2/bin:/nix/store/8s3ykb2m0z1bbbnc7mk5qawvfx9fzg7g-imagemagick-7.1.0-52/bin:/nix/store/66l0ncimnsjpg791an7bbh6z3k8sxvn5-ncurses-6.3-p20220507-dev/bin:/run/wrappers/bin:/home/jason/.nix-profile/bin:/etc/profiles/per-user/jason/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin + +Yarn version: + 1.22.19 + +Node version: + 18.12.1 + +Platform: + linux x64 + +Trace: + Error: https://registry.yarnpkg.com/dontenv: Not found + at params.callback [as _callback] (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:66145:18) + at self.callback (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:140890:22) + at Request.emit (node:events:513:28) + at Request. (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:141862:10) + at Request.emit (node:events:513:28) + at IncomingMessage. (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:141784:12) + at Object.onceWrapper (node:events:627:28) + at IncomingMessage.emit (node:events:525:35) + at endReadableNT (node:internal/streams/readable:1359:12) + at process.processTicksAndRejections (node:internal/process/task_queues:82:21) + +npm manifest: + { + "name": "batcher-bot", + "version": "1.0.0", + "description": "", + "main": "dist/index.js", + "bin": { + "ts-node-nix": "dist/index.js" + }, + "scripts": { + "start": "node dist/index.js", + "build": "tsc", + "dev": "ts-node-dev --no-notify --respawn src/index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "MIT", + "dependencies": { + "@taquito/taquito": "^8.0.1", + "rxjs": "^7.4.0", + "telegraf": "^4.6.0" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } + } + +yarn manifest: + No manifest + +Lockfile: + # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + # yarn lockfile v1 + + + "@babel/code-frame@^7.0.0": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + + "@babel/helper-validator-identifier@^7.18.6": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + + "@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + + "@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" + + "@taquito/http-utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-8.1.1.tgz#62eb983a6e9c1a2f1806327b8c7b6f6dec00024c" + integrity sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w== + dependencies: + xhr2-cookies "^1.1.0" + + "@taquito/michel-codec@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michel-codec/-/michel-codec-8.1.1.tgz#23ba8255215db72c60e0f52ff1616cf9830c6aa5" + integrity sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ== + + "@taquito/michelson-encoder@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz#153e45cb90028a13aa2f18571185e93047dcb3be" + integrity sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg== + dependencies: + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + fast-json-stable-stringify "^2.1.0" + + "@taquito/rpc@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-8.1.1.tgz#cdbf9d7ba24346034bf0f02ebf634e846801811a" + integrity sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg== + dependencies: + "@taquito/http-utils" "^8.1.0" + bignumber.js "^9.0.1" + lodash "^4.17.20" + + "@taquito/taquito@^8.0.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-8.1.1.tgz#284c760414013d9aa12343a4784c3057f62ffa8b" + integrity sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A== + dependencies: + "@taquito/http-utils" "^8.1.0" + "@taquito/michel-codec" "^8.1.1" + "@taquito/michelson-encoder" "^8.1.1" + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + rx-sandbox "^1.0.3" + rxjs "^6.6.3" + + "@taquito/utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-8.1.1.tgz#b9fbc880308ad814ae15b4f3402fd40c4ecc7c23" + integrity sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g== + dependencies: + blakejs "^1.1.0" + bs58check "^2.1.2" + buffer "^5.6.0" + + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + + "@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + + "@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + + "@types/node@*", "@types/node@^18.7.14": + version "18.16.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.2.tgz#2f610ea71034b3971c312192377f8a7178eb57f1" + integrity sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg== + + "@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + + "@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + + "@types/yargs@^15.0.0": + version "15.0.15" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.15.tgz#e609a2b1ef9e05d90489c2f5f45bbfb2be092158" + integrity sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg== + dependencies: + "@types/yargs-parser" "*" + + abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + + ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + + ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + + ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + + base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + + base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + + bignumber.js@^9.0.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" + integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + + blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + + braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + + bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + + bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + + buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + + buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + + buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== + + buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + + chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + + chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + + cipher-base@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + + color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + + color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + + color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + + color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + + cookiejar@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" + integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== + + create-hash@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + + debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + + diff-sequences@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" + integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== + + escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + + escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + + event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + + expect@^26.6.1: + version "26.6.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" + integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== + dependencies: + "@jest/types" "^26.6.2" + ansi-styles "^4.0.0" + jest-get-type "^26.3.0" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" + jest-regex-util "^26.0.0" + + fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + + fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + + graceful-fs@^4.2.4: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + + has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + + has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + + hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + + ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + + inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + + is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + + jest-diff@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" + integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== + dependencies: + chalk "^4.0.0" + diff-sequences "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + + jest-get-type@^26.3.0: + version "26.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" + integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== + + jest-matcher-utils@^26.6.1, jest-matcher-utils@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" + integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== + dependencies: + chalk "^4.0.0" + jest-diff "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + + jest-message-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" + integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.4" + micromatch "^4.0.2" + pretty-format "^26.6.2" + slash "^3.0.0" + stack-utils "^2.0.2" + + jest-regex-util@^26.0.0: + version "26.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== + + js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + + lodash@^4.17.20: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + + md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + + micromatch@^4.0.2: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + + mri@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + + ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + + node-fetch@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" + integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== + dependencies: + whatwg-url "^5.0.0" + + p-timeout@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-4.1.0.tgz#788253c0452ab0ffecf18a62dff94ff1bd09ca0a" + integrity sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw== + + picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + + pretty-format@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" + integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== + dependencies: + "@jest/types" "^26.6.2" + ansi-regex "^5.0.0" + ansi-styles "^4.0.0" + react-is "^17.0.1" + + react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + + readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + + ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + + rx-sandbox@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/rx-sandbox/-/rx-sandbox-1.0.4.tgz#821a1d64e5f0d88658da7a5dbbd735b13277648b" + integrity sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA== + dependencies: + expect "^26.6.1" + jest-matcher-utils "^26.6.1" + + rxjs@^6.6.3: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + + rxjs@^7.4.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + + safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + + safe-compare@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/safe-compare/-/safe-compare-1.1.4.tgz#5e0128538a82820e2e9250cd78e45da6786ba593" + integrity sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ== + dependencies: + buffer-alloc "^1.2.0" + + sandwich-stream@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sandwich-stream/-/sandwich-stream-2.0.2.tgz#6d1feb6cf7e9fe9fadb41513459a72c2e84000fa" + integrity sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== + + sha.js@^2.4.0: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + + slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + + stack-utils@^2.0.2: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + + string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + + supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + + supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + + telegraf@^4.6.0: + version "4.12.2" + resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.2.tgz#1cf4f38c275e04416f1282f3581833994870f0bc" + integrity sha512-PgwqI4wD86cMqVfFtEM9JkGGnMHgvgLJbReZMmwW4z35QeOi4DvbdItONld4bPnYn3A1jcO0SRKs0BXmR+x+Ew== + dependencies: + abort-controller "^3.0.0" + debug "^4.3.4" + mri "^1.2.0" + node-fetch "^2.6.8" + p-timeout "^4.1.0" + safe-compare "^1.1.4" + sandwich-stream "^2.0.2" + typegram "^4.3.0" + + to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + + tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + + tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + + tslib@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + + typegram@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/typegram/-/typegram-4.3.0.tgz#690ec1287f771608070e149c92de4fca42e54db0" + integrity sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg== + + typescript@^4.8.2: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + + util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + + webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + + whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + + xhr2-cookies@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g== + dependencies: + cookiejar "^2.1.1" diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index ea7a0364..895deb26 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -14,7 +14,7 @@ import { } from '@/extra_utils/types'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; import { Space, Col, Row, Drawer, Radio, } from 'antd'; -import { CiTwoTone, DoubleRightOutlined } from '@ant-design/icons'; +import { CiTwoTone, ConsoleSqlOutlined, DoubleRightOutlined } from '@ant-design/icons'; import type { RadioChangeEvent } from 'antd'; import { useModel } from 'umi'; import { @@ -684,7 +684,6 @@ const Welcome: React.FC = () => { if(userAddress === null){ if(initialState.userAddress !== null){ usrAddr = initialState.userAddress; - setUserAddress(usrAddr); } } @@ -696,10 +695,21 @@ const Welcome: React.FC = () => { console.log('getTokenBalance-userAddress',usrAddr); const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; console.log('getTokenBalance-balanceURI',balanceURI); - const data = await fetch(balanceURI, { method: 'GET' }); - await data.json().then(balance => { + + const buyTokenData = await fetch(balanceURI + '&token.contract=' + buyToken.address, { method: 'GET' }); + const sellTokenData = await fetch(balanceURI + '&token.contract=' + sellToken.address, { method: 'GET' }); + + try{ + await buyTokenData.json().then(balance => { if (Array.isArray(balance)) { setTokenAmount(balance, buyBalance, buyToken.address, buyToken.decimals, setBuyBalance); + } + }); + } catch (error){ + console.error(error); + } + await sellTokenData.json().then(balance => { + if (Array.isArray(balance)) { setTokenAmount(balance, sellBalance, sellToken.address, sellToken.decimals, setSellBalance); } }); From 557f615079f454fc02990660b1543e4465f77606 Mon Sep 17 00:00:00 2001 From: Cyril B Date: Thu, 11 May 2023 13:59:15 +0200 Subject: [PATCH 055/108] telegram bot for mainnet version (#333) * pipelines: rework docker build process * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Release - Ghostnet (#316) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Release - Ghostnet (#318) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating --------- Co-authored-by: Cyril B * pipelines: patch deprecated set-output commands and actions [skip ci] * telegram bot for ghostnet version (#332) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Release - Mainnet (#317) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot --------- Co-authored-by: Jason Ridgway-Taylor Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> * pipelines: fix ci of bot notif --------- Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> Co-authored-by: Jason Ridgway-Taylor --- .ash_history | 1 + .github/workflows/docker-ghostnet.yml | 12 + .github/workflows/docker-mainnet.yml | 12 + .gitignore | 2 + batcher-bot/notifications/.env.ghostnet | 4 + batcher-bot/notifications/.env.mainnet | 4 + .../Dockerfile.bot.notifications.ghostnet | 19 + .../Dockerfile.bot.notifications.mainnet | 19 + batcher-bot/notifications/flake.lock | 44 + batcher-bot/notifications/flake.nix | 41 + batcher-bot/notifications/package-lock.json | 2114 +++++++++++++++++ batcher-bot/notifications/package.json | 33 + batcher-bot/notifications/src/.env | 5 + batcher-bot/notifications/src/bot.ts | 113 + batcher-bot/notifications/src/formatter.ts | 244 ++ batcher-bot/notifications/src/index.ts | 30 + batcher-bot/notifications/src/types.ts | 15 + batcher-bot/notifications/tsconfig.json | 5 + batcher-bot/notifications/yarn-error.log | 723 ++++++ batcher-bot/notifications/yarn.lock | 825 +++++++ batcher-ui/src/components/About/index.tsx | 18 +- batcher-ui/src/pages/Main.tsx | 56 +- 22 files changed, 4321 insertions(+), 18 deletions(-) create mode 100644 .ash_history create mode 100644 batcher-bot/notifications/.env.ghostnet create mode 100644 batcher-bot/notifications/.env.mainnet create mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet create mode 100644 batcher-bot/notifications/Dockerfile.bot.notifications.mainnet create mode 100644 batcher-bot/notifications/flake.lock create mode 100644 batcher-bot/notifications/flake.nix create mode 100644 batcher-bot/notifications/package-lock.json create mode 100644 batcher-bot/notifications/package.json create mode 100644 batcher-bot/notifications/src/.env create mode 100644 batcher-bot/notifications/src/bot.ts create mode 100644 batcher-bot/notifications/src/formatter.ts create mode 100644 batcher-bot/notifications/src/index.ts create mode 100644 batcher-bot/notifications/src/types.ts create mode 100644 batcher-bot/notifications/tsconfig.json create mode 100644 batcher-bot/notifications/yarn-error.log create mode 100644 batcher-bot/notifications/yarn.lock diff --git a/.ash_history b/.ash_history new file mode 100644 index 00000000..a3abe509 --- /dev/null +++ b/.ash_history @@ -0,0 +1 @@ +exit diff --git a/.github/workflows/docker-ghostnet.yml b/.github/workflows/docker-ghostnet.yml index adcbf785..156eb1bb 100644 --- a/.github/workflows/docker-ghostnet.yml +++ b/.github/workflows/docker-ghostnet.yml @@ -43,3 +43,15 @@ jobs: ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release cache-from: type=gha cache-to: type=gha,mode=max + + - name: Build and push release version of notification bot + uses: docker/build-push-action@v3 + with: + file: ./batcher-bot/notifications/Dockerfile.bot.notifications.${{ matrix.network }} + context: ./batcher-bot/notifications + push: true + tags: | + ghcr.io/marigold-dev/batcher-bot-notifs-${{ matrix.network }}:stable + ghcr.io/marigold-dev/batcher-bot-notifs-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker-mainnet.yml b/.github/workflows/docker-mainnet.yml index 02f74fc8..4abc5ce5 100644 --- a/.github/workflows/docker-mainnet.yml +++ b/.github/workflows/docker-mainnet.yml @@ -46,3 +46,15 @@ jobs: ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release cache-from: type=gha cache-to: type=gha,mode=max + + - name: Build and push release version of notification bot + uses: docker/build-push-action@v3 + with: + file: ./batcher-bot/notifications/Dockerfile.bot.notifications.${{ matrix.network }} + context: ./batcher-bot/notifications + push: true + tags: | + ghcr.io/marigold-dev/batcher-bot-notifs-${{ matrix.network }}:stable + ghcr.io/marigold-dev/batcher-bot-notifs-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore index d3b3bcd4..c9eb4589 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ USDT_token_storage.tz # Tezos client artefacts .tezos-client/ +./*/node_modules/ +batcher-bot/notifications/node_modules/ diff --git a/batcher-bot/notifications/.env.ghostnet b/batcher-bot/notifications/.env.ghostnet new file mode 100644 index 00000000..dc650e0e --- /dev/null +++ b/batcher-bot/notifications/.env.ghostnet @@ -0,0 +1,4 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +NOTIFICATIONS=deposits,rates,status_updates diff --git a/batcher-bot/notifications/.env.mainnet b/batcher-bot/notifications/.env.mainnet new file mode 100644 index 00000000..81d9255c --- /dev/null +++ b/batcher-bot/notifications/.env.mainnet @@ -0,0 +1,4 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +NOTIFICATIONS=deposits diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet b/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet new file mode 100644 index 00000000..e2352575 --- /dev/null +++ b/batcher-bot/notifications/Dockerfile.bot.notifications.ghostnet @@ -0,0 +1,19 @@ +FROM node:latest as builder + +WORKDIR /app + +COPY ./package.json ./ + +RUN npm install + +COPY ./tsconfig.json ./ +COPY ./src ./src +COPY ./.env.ghostnet ./.env.ghostnet + +RUN npm run build:ghostnet + + +FROM node:latest +COPY --from=builder /app /usr/share/batcher/bot +WORKDIR /usr/share/batcher/bot +CMD [ "npm", "run", "start:ghostnet" ] diff --git a/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet b/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet new file mode 100644 index 00000000..947e271b --- /dev/null +++ b/batcher-bot/notifications/Dockerfile.bot.notifications.mainnet @@ -0,0 +1,19 @@ +FROM node:latest as builder + +WORKDIR /app + +COPY ./package.json ./ + +RUN npm install + +COPY ./tsconfig.json ./ +COPY ./src ./src +COPY ./.env.mainnet ./.env.mainnet + +RUN npm run build:mainnet + + +FROM node:latest +COPY --from=builder /app /usr/share/batcher/bot +WORKDIR /usr/share/batcher/bot +CMD [ "npm", "run", "start:mainnet" ] diff --git a/batcher-bot/notifications/flake.lock b/batcher-bot/notifications/flake.lock new file mode 100644 index 00000000..e9efdd8f --- /dev/null +++ b/batcher-bot/notifications/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "js2nix": { + "flake": false, + "locked": { + "lastModified": 1680501697, + "narHash": "sha256-Bmv0ERVeb6vjYzy4MuCDgSiz9fSm/Bhg+Xk3AxPisBw=", + "owner": "canva-public", + "repo": "js2nix", + "rev": "d37912f6cc824e7f41bea7a481af1739ca195c8f", + "type": "github" + }, + "original": { + "owner": "canva-public", + "repo": "js2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1682566018, + "narHash": "sha256-HPzPRFiy2o/7k7mtnwfM1E6NVZHiFbPdmYCMoIpkHO4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8e3b64db39f2aaa14b35ee5376bd6a2e707cadc2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "js2nix": "js2nix", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/batcher-bot/notifications/flake.nix b/batcher-bot/notifications/flake.nix new file mode 100644 index 00000000..3ea8048e --- /dev/null +++ b/batcher-bot/notifications/flake.nix @@ -0,0 +1,41 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.js2nix = { + url = "github:canva-public/js2nix"; + flake = false; + }; + + outputs = { self, nixpkgs, js2nix }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}.extend (self: super: { + js2nix = self.callPackage js2nix { }; + })); + in + rec { + packages = forAllSystems (system: { + default = + let + env = pkgs.${system}.js2nix { + package-json = ./package.json; + yarn-lock = ./yarn.lock; + }; + in + pkgs.${system}.buildEnv { + name = "batcher-bot"; + paths = [ + ]; + pathsToLink = [ "/bin" ]; + }; + }); + + devShells = forAllSystems (system: { + default = pkgs.${system}.mkShellNoCC { + packages = with pkgs.${system}; [ + yarn + ]; + }; + }); + }; +} diff --git a/batcher-bot/notifications/package-lock.json b/batcher-bot/notifications/package-lock.json new file mode 100644 index 00000000..9d7dcb8f --- /dev/null +++ b/batcher-bot/notifications/package-lock.json @@ -0,0 +1,2114 @@ +{ + "name": "batcher-bot", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "batcher-bot", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", + "@taquito/taquito": "^8.0.1", + "@tsconfig/node16-strictest": "^1.0.4", + "dotenv": "^16.0.3", + "env-cmd": "^10.1.0", + "prelude-ts": "^1.0.6", + "rxjs": "^7.4.0", + "telegraf": "^4.12.3-canary.1" + }, + "bin": { + "ts-node-nix": "dist/index.js" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "dependencies": { + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "dependencies": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "node_modules/@taquito/http-utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz", + "integrity": "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==", + "dependencies": { + "xhr2-cookies": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michel-codec": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz", + "integrity": "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michelson-encoder": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz", + "integrity": "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==", + "dependencies": { + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/rpc": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz", + "integrity": "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==", + "dependencies": { + "@taquito/http-utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "lodash": "^4.17.20" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz", + "integrity": "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==", + "hasInstallScript": true, + "dependencies": { + "@taquito/http-utils": "^8.1.0", + "@taquito/michel-codec": "^8.1.1", + "@taquito/michelson-encoder": "^8.1.1", + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "rx-sandbox": "^1.0.3", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", + "dependencies": { + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" + }, + "engines": { + "node": ">=4.2.4", + "npm": ">=3.0.0" + }, + "peerDependencies": { + "rxjs": "6.x" + } + }, + "node_modules/@taquito/taquito/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@taquito/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==", + "dependencies": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.6.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@tsconfig/node16-strictest": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz", + "integrity": "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==", + "deprecated": "TypeScript 5.0 supports combining TSConfigs using array syntax in extends" + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/node": { + "version": "18.16.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz", + "integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "node_modules/@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "dependencies": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + }, + "bin": { + "env-cmd": "bin/env-cmd.js" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/expect": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", + "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "dependencies": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-matcher-utils": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", + "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-message-util": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", + "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-regex-util": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", + "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/p-timeout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", + "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "dependencies": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "dependencies": { + "buffer-alloc": "^1.2.0" + } + }, + "node_modules/sandwich-stream": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", + "integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/telegraf": { + "version": "4.12.3-canary.1", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz", + "integrity": "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==", + "dependencies": { + "abort-controller": "^3.0.0", + "debug": "^4.3.4", + "mri": "^1.2.0", + "node-fetch": "^2.6.8", + "p-timeout": "^4.1.0", + "safe-compare": "^1.1.4", + "sandwich-stream": "^2.0.2", + "typegram": "^4.3.0" + }, + "bin": { + "telegraf": "lib/cli.mjs" + }, + "engines": { + "node": "^12.20.0 || >=14.13.1" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/typegram": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz", + "integrity": "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", + "dependencies": { + "cookiejar": "^2.1.1" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "requires": { + "@babel/highlight": "^7.18.6" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==" + }, + "@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + } + }, + "@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "requires": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "@taquito/http-utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz", + "integrity": "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==", + "requires": { + "xhr2-cookies": "^1.1.0" + } + }, + "@taquito/michel-codec": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz", + "integrity": "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==" + }, + "@taquito/michelson-encoder": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz", + "integrity": "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==", + "requires": { + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "fast-json-stable-stringify": "^2.1.0" + } + }, + "@taquito/rpc": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz", + "integrity": "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==", + "requires": { + "@taquito/http-utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "lodash": "^4.17.20" + } + }, + "@taquito/taquito": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz", + "integrity": "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==", + "requires": { + "@taquito/http-utils": "^8.1.0", + "@taquito/michel-codec": "^8.1.1", + "@taquito/michelson-encoder": "^8.1.1", + "@taquito/rpc": "^8.1.1", + "@taquito/utils": "^8.1.0", + "bignumber.js": "^9.0.1", + "rx-sandbox": "^1.0.3", + "rxjs": "^6.6.3" + }, + "dependencies": { + "rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", + "requires": { + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" + } + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@taquito/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==", + "requires": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.6.0" + } + }, + "@tsconfig/node16-strictest": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz", + "integrity": "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==" + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/node": { + "version": "18.16.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz", + "integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + }, + "cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==" + }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, + "env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "requires": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + } + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + }, + "expect": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", + "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", + "requires": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "requires": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==" + }, + "jest-matcher-utils": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", + "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-message-util": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", + "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", + "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "p-timeout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", + "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "requires": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "requires": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + } + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "requires": { + "tslib": "^2.1.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "sandwich-stream": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz", + "integrity": "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==" + }, + "set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "telegraf": { + "version": "4.12.3-canary.1", + "resolved": "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz", + "integrity": "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==", + "requires": { + "abort-controller": "^3.0.0", + "debug": "^4.3.4", + "mri": "^1.2.0", + "node-fetch": "^2.6.8", + "p-timeout": "^4.1.0", + "safe-compare": "^1.1.4", + "sandwich-stream": "^2.0.2", + "typegram": "^4.3.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "typegram": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz", + "integrity": "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", + "requires": { + "cookiejar": "^2.1.1" + } + } + } +} diff --git a/batcher-bot/notifications/package.json b/batcher-bot/notifications/package.json new file mode 100644 index 00000000..56c0faf0 --- /dev/null +++ b/batcher-bot/notifications/package.json @@ -0,0 +1,33 @@ +{ + "name": "batcher-bot", + "version": "1.0.0", + "description": "", + "main": "dist/index.js", + "bin": { + "ts-node-nix": "dist/index.js" + }, + "scripts": { + "start:ghostnet": "env-cmd -f .env.ghostnet node dist/index.js", + "build:ghostnet": "env-cmd -f .env.ghostnet tsc", + "start:mainnet": "env-cmd -f .env.mainnet node dist/index.js", + "build:mainnet": "env-cmd -f .env.mainnet tsc", + "dev": "env-cmd -e ghostnet ts-node-dev --no-notify --respawn src/index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "MIT", + "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", + "@taquito/taquito": "^8.0.1", + "@tsconfig/node16-strictest": "^1.0.4", + "dotenv": "^16.0.3", + "env-cmd": "^10.1.0", + "prelude-ts": "^1.0.6", + "rxjs": "^7.4.0", + "telegraf": "^4.12.3-canary.1" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } +} diff --git a/batcher-bot/notifications/src/.env b/batcher-bot/notifications/src/.env new file mode 100644 index 00000000..f6394955 --- /dev/null +++ b/batcher-bot/notifications/src/.env @@ -0,0 +1,5 @@ +BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 +TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev +TZKT_URI_API=https://api.ghostnet.tzkt.io +BOT_TOKEN=5975300789:AAFHrmKNGNggxod4Z_kADdomGIj2ffl76NM +CHANNEL_ID=batcher-bot-dev-test diff --git a/batcher-bot/notifications/src/bot.ts b/batcher-bot/notifications/src/bot.ts new file mode 100644 index 00000000..fc294714 --- /dev/null +++ b/batcher-bot/notifications/src/bot.ts @@ -0,0 +1,113 @@ +import { TezosToolkit } from "@taquito/taquito"; +import { Telegraf } from "telegraf"; +import { interval } from "rxjs"; +import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; +import { format } from "./formatter"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; +import { Option } from "prelude-ts"; + +const contractAddress = process.env["BATCHER_ADDRESS"]; +const channelId = process.env["CHANNEL_ID"]; +const tzktUri = process.env["TZKT_URI_API"]; + +const sendToTelegram = async (bot: Telegraf, message: string, options: any) => { + console.info("Sending message:", message); + console.info("With options", options); + await bot.telegram.sendMessage(channelId, message, options); +}; + +const init = async ( + bot: Telegraf, + socketConnection: HubConnection, + notifications_enabled: NotificationsEnabled +) => { + await socketConnection.start(); + + await socketConnection.invoke("SubscribeToBigMaps", { + contract: contractAddress, + }); + + await socketConnection.invoke("SubscribeToOperations", { + address: contractAddress, + types: "transaction", + }); + + socketConnection.on("bigmaps", (msg: any) => { + if (!msg.data) return; + console.info("----->>>>> Bigmap recevied ", msg.data); + for (let i = 0; i < Object.keys(msg.data).length; i++) { + try { + if ( + msg.data[i].path == "rates_current" || + msg.data[i].path == "batch_set.batches" + ) { + const formattedMessageOpt = format( + MessageType.BIGMAP, + msg.data[i], + notifications_enabled + ); + if (formattedMessageOpt.isSome()) { + const formattedMessage = formattedMessageOpt.get(); + console.info("Bigmap formatted contents", formattedMessage); + sendToTelegram( + bot, + formattedMessage.message, + formattedMessage.message_options + ); + } + } + } catch (error) { + console.info("Error parsing bigmap", error.message); + console.error(error); + } + } + }); + socketConnection.on("operations", (msg: any) => { + if (!msg.data) return; + for (let i = 0; i < Object.keys(msg.data).length; i++) { + try { + if (msg.data[i].parameter) { + if (msg.data[i].parameter.entrypoint == "deposit") { + const formattedMessageOpt = format( + MessageType.OPERATION, + msg.data[i], + notifications_enabled + ); + if (formattedMessageOpt.isSome()) { + const formattedMessage = formattedMessageOpt.get(); + console.info("formattedMessage", formattedMessage); + sendToTelegram( + bot, + formattedMessage.message, + formattedMessage.message_options + ); + } + } + } + } catch (error) { + console.info("Error parsing operation", error.message); + console.error(error); + } + } + }); +}; + +export const start = ( + bot: Telegraf, + socketConnection: HubConnection, + notifications_enabled: NotificationsEnabled +) => { + // Start the web socket + init(bot, socketConnection, notifications_enabled).then((r) => + console.info("started socket") + ); + socketConnection.onclose(() => + init(bot, socketConnection, notifications_enabled) + ); + // Start the Telegram bot. + bot.launch(); +}; diff --git a/batcher-bot/notifications/src/formatter.ts b/batcher-bot/notifications/src/formatter.ts new file mode 100644 index 00000000..fb5f8780 --- /dev/null +++ b/batcher-bot/notifications/src/formatter.ts @@ -0,0 +1,244 @@ +import { text } from "stream/consumers"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; +import { Option, None } from "prelude-ts"; + +const tzktUri = process.env["TZKT_URI_API"]; + +// eslint-disable-next-line @typescript-eslint/no-shadow +const getPairName = (fromName: string, toName: string) => { + if (fromName > toName) { + return fromName + "/" + toName; + } + + return toName + "/" + fromName; +}; + +const getScaledRate = (rate_obj: any, swap: any) => { + try { + const numerator = rate_obj.p; + const denominator = rate_obj.q; + const scale = swap.from.token.decimals - swap.to.decimals; + const rate = numerator / denominator; + return rate * 10 ** scale; + } catch (error) { + console.info("Error scaling rate", error.message); + console.error(error); + return 0; + } +}; + +const formatRatesCurrent = (rateMessage: any) => { + try { + const name = rateMessage.content.key; + const pl = rateMessage.content.value; + const scaledRate = getScaledRate(pl.rate, pl.swap); + + return ( + "Oracle Update - " + name + " " + scaledRate + "" + ); + } catch (error) { + console.info("Error formatting rates", error.message); + console.error(error); + return "error" + error.message; + } +}; + +const formatBatchChange = (message: any): Option => { + try { + const val = message.content.value; + const batch_number = val.batch_number; + const buy_decimals = val.pair.decimals_0; + const sell_decimals = val.pair.decimals_1; + const buy_name = val.pair.name_0; + const sell_name = val.pair.name_1; + const status = Object.keys(val.status)[0]; + const raw_buy_volume = val.volumes.buy_total_volume; + const raw_sell_volume = val.volumes.sell_total_volume; + const buy_volume = raw_buy_volume / 10 ** buy_decimals; + const sell_volume = raw_sell_volume / 10 ** sell_decimals; + + let rate_name = getPairName(buy_name, sell_name); + let status_message = status; + + if (status == "open") { + status_message = "Open (" + val.status.open + ")"; + } + if (status == "closed") { + status_message = "Closed (" + val.status.closed.closing_time + ")"; + } + if (status == "cleared") { + let rate = getScaledRate( + val.status.cleared.rate.rate, + val.status.cleared.rate.swap + ); + status_message = + "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate; + } + + if (buy_volume == 0 || sell_volume == 0) { + return Option.none(); + } else { + return Option.of( + " BATCH UPDATE " + + batch_number + + " " + + rate_name + + " " + + status_message + + " - BUY VOLUME " + + buy_volume + + " " + + buy_name + + " | SELL VOLUME " + + sell_volume + + " " + + sell_name + + "" + ); + } + } catch (error) { + console.info("Error formatting batch change"); + console.error(error); + return Option.none(); + } +}; + +const formatBigMap = ( + message: any, + notifications_enabled: NotificationsEnabled +): Option => { + if (message.path == "rates_current" && notifications_enabled.rates) { + return Option.of(formatRatesCurrent(message)); + } + if ( + message.path == "batch_set.batches" && + notifications_enabled.batch_status + ) { + return formatBatchChange(message); + } + + return Option.none(); +}; + +const getSide = (side: number) => { + if (side == 0) { + return "BUY"; + } + + return "SELL"; +}; + +const getTolerance = (side: number, tolerance: number) => { + if (side == 0) { + if (tolerance == 0) { + return "WORST PRICE / BETTER FILL"; + } + + if (tolerance == 1) { + return "ORACLE"; + } + + return "BETTER PRICE / WORSE FILL"; + } + + if (tolerance == 0) { + return "BETTER PRICE / WORSE FILL"; + } + + if (tolerance == 1) { + return "ORACLE"; + } + + return "WORSE PRICE / BETTER FILL"; +}; + +const scaleAmount = (amount: number, tokenDecimals: number) => { + return amount / 10 ** tokenDecimals; +}; + +const formatDeposit = (message: any) => { + console.info("Formatting deposit message", JSON.stringify(message)); + const val = message.parameter.value; + const side = getSide(val.side); + const tolerance = getTolerance(val.side, val.tolerance); + const pair = getPairName( + message.parameter.value.swap.from.token.name, + message.parameter.value.swap.to.name + ); + const from = message.parameter.value.swap.from; + const to = message.parameter.value.swap.to; + const amount = scaleAmount(from.amount, from.token.decimals); + + let batch_id = ""; + let volumes = ""; + try { + console.info("Message storage", message.storage); + const storage = message.storage; + const current_batch_ids = storage.batch_set.current_batch_indices; + console.info("Current batch ids", current_batch_ids); + const pair_batch_id = current_batch_ids[pair]; + batch_id = `Batch ${pair_batch_id}`; + } catch (error) { + console.error(error); + } + + return `${batch_id} TRADE ON ${pair} ${side}@${tolerance} for ${amount} ${message.parameter.value.swap.from.token.name}`; +}; + +const formatOperation = ( + message: any, + notifications_enabled: NotificationsEnabled +): Option => { + const entrypoint = message.parameter.entrypoint; + if (entrypoint == "deposit" && notifications_enabled.deposits) { + return Option.of(formatDeposit(message)); + } + return Option.none(); +}; + +export const format = ( + msgType: MessageType, + message: any, + notifications_enabled: NotificationsEnabled +): Option => { + try { + let htmlOptions: any = { + parse_mode: "HTML", + disable_web_page_preview: true, + }; + + if (msgType == MessageType.BIGMAP) { + const html: Option = formatBigMap(message, notifications_enabled); + if (html.isSome()) { + const htmlMessage: string = html.get(); + return Option.of({ + message: htmlMessage, + message_options: htmlOptions, + }); + } + } + + if (msgType == MessageType.OPERATION) { + const html = formatOperation(message, notifications_enabled); + if (html.isSome()) { + const htmlMessage = html.get(); + return Option.of({ + message: htmlMessage, + message_options: htmlOptions, + }); + } + } + + return Option.none(); + } catch (error) { + console.error(error); + let textOptions = { + parse_mode: "TEXT", + }; + return Option.none(); + } +}; diff --git a/batcher-bot/notifications/src/index.ts b/batcher-bot/notifications/src/index.ts new file mode 100644 index 00000000..f24b82ba --- /dev/null +++ b/batcher-bot/notifications/src/index.ts @@ -0,0 +1,30 @@ +import { config } from "dotenv"; +import { TezosToolkit } from "@taquito/taquito"; +import { Telegraf } from "telegraf"; +import { interval } from "rxjs"; +import { start } from "./bot"; +import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; +import { + NotificationsEnabled, + TelegramMessageContents, + MessageType, +} from "./types"; + +config(); + +const botToken = process.env["BOT_TOKEN"]; +const tzktUri = process.env["TZKT_URI_API"]; +const notifications = process.env["NOTIFICATIONS"]; + +const bot = new Telegraf(botToken); +const socketConnection = new HubConnectionBuilder() + .withUrl(tzktUri + "/v1/ws") + .build(); + +let notifications_enabled: NotificationsEnabled = { + deposits: notifications.includes("deposits"), + rates: notifications.includes("rates"), + batch_status: notifications.includes("status_updates"), +}; + +start(bot, socketConnection, notifications_enabled); diff --git a/batcher-bot/notifications/src/types.ts b/batcher-bot/notifications/src/types.ts new file mode 100644 index 00000000..7a8c0faf --- /dev/null +++ b/batcher-bot/notifications/src/types.ts @@ -0,0 +1,15 @@ +export type NotificationsEnabled = { + rates: boolean; + deposits: boolean; + batch_status: boolean; +}; + +export type TelegramMessageContents = { + message: string; + message_options: any; +}; + +export enum MessageType { + BIGMAP = 0, + OPERATION = 1, +} diff --git a/batcher-bot/notifications/tsconfig.json b/batcher-bot/notifications/tsconfig.json new file mode 100644 index 00000000..a82dbdd0 --- /dev/null +++ b/batcher-bot/notifications/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "outDir": "./dist", + } +} diff --git a/batcher-bot/notifications/yarn-error.log b/batcher-bot/notifications/yarn-error.log new file mode 100644 index 00000000..f4abec5f --- /dev/null +++ b/batcher-bot/notifications/yarn-error.log @@ -0,0 +1,723 @@ +Arguments: + /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin/node /home/jason/.nix-profile/bin/yarn add dontenv + +PATH: + /nix/store/i1ybm7a1sg6231q6g900dbckdx1frd60-kitty-0.26.2/bin:/nix/store/8s3ykb2m0z1bbbnc7mk5qawvfx9fzg7g-imagemagick-7.1.0-52/bin:/nix/store/66l0ncimnsjpg791an7bbh6z3k8sxvn5-ncurses-6.3-p20220507-dev/bin:/run/wrappers/bin:/home/jason/.nix-profile/bin:/etc/profiles/per-user/jason/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin + +Yarn version: + 1.22.19 + +Node version: + 18.12.1 + +Platform: + linux x64 + +Trace: + Error: https://registry.yarnpkg.com/dontenv: Not found + at params.callback [as _callback] (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:66145:18) + at self.callback (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:140890:22) + at Request.emit (node:events:513:28) + at Request. (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:141862:10) + at Request.emit (node:events:513:28) + at IncomingMessage. (/nix/store/almamk9fkbr6vb9433zvmpbcwxrlzn27-yarn-1.22.19/lib/node_modules/yarn/lib/cli.js:141784:12) + at Object.onceWrapper (node:events:627:28) + at IncomingMessage.emit (node:events:525:35) + at endReadableNT (node:internal/streams/readable:1359:12) + at process.processTicksAndRejections (node:internal/process/task_queues:82:21) + +npm manifest: + { + "name": "batcher-bot", + "version": "1.0.0", + "description": "", + "main": "dist/index.js", + "bin": { + "ts-node-nix": "dist/index.js" + }, + "scripts": { + "start": "node dist/index.js", + "build": "tsc", + "dev": "ts-node-dev --no-notify --respawn src/index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "MIT", + "dependencies": { + "@taquito/taquito": "^8.0.1", + "rxjs": "^7.4.0", + "telegraf": "^4.6.0" + }, + "devDependencies": { + "@types/node": "^18.7.14", + "typescript": "^4.8.2" + } + } + +yarn manifest: + No manifest + +Lockfile: + # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + # yarn lockfile v1 + + + "@babel/code-frame@^7.0.0": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + + "@babel/helper-validator-identifier@^7.18.6": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + + "@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + + "@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" + + "@taquito/http-utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-8.1.1.tgz#62eb983a6e9c1a2f1806327b8c7b6f6dec00024c" + integrity sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w== + dependencies: + xhr2-cookies "^1.1.0" + + "@taquito/michel-codec@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michel-codec/-/michel-codec-8.1.1.tgz#23ba8255215db72c60e0f52ff1616cf9830c6aa5" + integrity sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ== + + "@taquito/michelson-encoder@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz#153e45cb90028a13aa2f18571185e93047dcb3be" + integrity sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg== + dependencies: + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + fast-json-stable-stringify "^2.1.0" + + "@taquito/rpc@^8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-8.1.1.tgz#cdbf9d7ba24346034bf0f02ebf634e846801811a" + integrity sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg== + dependencies: + "@taquito/http-utils" "^8.1.0" + bignumber.js "^9.0.1" + lodash "^4.17.20" + + "@taquito/taquito@^8.0.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-8.1.1.tgz#284c760414013d9aa12343a4784c3057f62ffa8b" + integrity sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A== + dependencies: + "@taquito/http-utils" "^8.1.0" + "@taquito/michel-codec" "^8.1.1" + "@taquito/michelson-encoder" "^8.1.1" + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + bignumber.js "^9.0.1" + rx-sandbox "^1.0.3" + rxjs "^6.6.3" + + "@taquito/utils@^8.1.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-8.1.1.tgz#b9fbc880308ad814ae15b4f3402fd40c4ecc7c23" + integrity sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g== + dependencies: + blakejs "^1.1.0" + bs58check "^2.1.2" + buffer "^5.6.0" + + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + + "@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + + "@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + + "@types/node@*", "@types/node@^18.7.14": + version "18.16.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.2.tgz#2f610ea71034b3971c312192377f8a7178eb57f1" + integrity sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg== + + "@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + + "@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + + "@types/yargs@^15.0.0": + version "15.0.15" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.15.tgz#e609a2b1ef9e05d90489c2f5f45bbfb2be092158" + integrity sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg== + dependencies: + "@types/yargs-parser" "*" + + abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + + ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + + ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + + ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + + base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + + base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + + bignumber.js@^9.0.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" + integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + + blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + + braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + + bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + + bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + + buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + + buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + + buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== + + buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + + chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + + chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + + cipher-base@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + + color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + + color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + + color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + + color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + + cookiejar@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" + integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== + + create-hash@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + + debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + + diff-sequences@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" + integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== + + escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + + escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + + event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + + expect@^26.6.1: + version "26.6.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" + integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== + dependencies: + "@jest/types" "^26.6.2" + ansi-styles "^4.0.0" + jest-get-type "^26.3.0" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" + jest-regex-util "^26.0.0" + + fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + + fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + + graceful-fs@^4.2.4: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + + has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + + has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + + hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + + ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + + inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + + is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + + jest-diff@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" + integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== + dependencies: + chalk "^4.0.0" + diff-sequences "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + + jest-get-type@^26.3.0: + version "26.3.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" + integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== + + jest-matcher-utils@^26.6.1, jest-matcher-utils@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" + integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== + dependencies: + chalk "^4.0.0" + jest-diff "^26.6.2" + jest-get-type "^26.3.0" + pretty-format "^26.6.2" + + jest-message-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" + integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.4" + micromatch "^4.0.2" + pretty-format "^26.6.2" + slash "^3.0.0" + stack-utils "^2.0.2" + + jest-regex-util@^26.0.0: + version "26.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== + + js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + + lodash@^4.17.20: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + + md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + + micromatch@^4.0.2: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + + mri@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + + ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + + node-fetch@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" + integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== + dependencies: + whatwg-url "^5.0.0" + + p-timeout@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-4.1.0.tgz#788253c0452ab0ffecf18a62dff94ff1bd09ca0a" + integrity sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw== + + picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + + pretty-format@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" + integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== + dependencies: + "@jest/types" "^26.6.2" + ansi-regex "^5.0.0" + ansi-styles "^4.0.0" + react-is "^17.0.1" + + react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + + readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + + ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + + rx-sandbox@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/rx-sandbox/-/rx-sandbox-1.0.4.tgz#821a1d64e5f0d88658da7a5dbbd735b13277648b" + integrity sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA== + dependencies: + expect "^26.6.1" + jest-matcher-utils "^26.6.1" + + rxjs@^6.6.3: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + + rxjs@^7.4.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + + safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + + safe-compare@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/safe-compare/-/safe-compare-1.1.4.tgz#5e0128538a82820e2e9250cd78e45da6786ba593" + integrity sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ== + dependencies: + buffer-alloc "^1.2.0" + + sandwich-stream@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sandwich-stream/-/sandwich-stream-2.0.2.tgz#6d1feb6cf7e9fe9fadb41513459a72c2e84000fa" + integrity sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== + + sha.js@^2.4.0: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + + slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + + stack-utils@^2.0.2: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + + string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + + supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + + supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + + telegraf@^4.6.0: + version "4.12.2" + resolved "https://registry.yarnpkg.com/telegraf/-/telegraf-4.12.2.tgz#1cf4f38c275e04416f1282f3581833994870f0bc" + integrity sha512-PgwqI4wD86cMqVfFtEM9JkGGnMHgvgLJbReZMmwW4z35QeOi4DvbdItONld4bPnYn3A1jcO0SRKs0BXmR+x+Ew== + dependencies: + abort-controller "^3.0.0" + debug "^4.3.4" + mri "^1.2.0" + node-fetch "^2.6.8" + p-timeout "^4.1.0" + safe-compare "^1.1.4" + sandwich-stream "^2.0.2" + typegram "^4.3.0" + + to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + + tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + + tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + + tslib@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + + typegram@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/typegram/-/typegram-4.3.0.tgz#690ec1287f771608070e149c92de4fca42e54db0" + integrity sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg== + + typescript@^4.8.2: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + + util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + + webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + + whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + + xhr2-cookies@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g== + dependencies: + cookiejar "^2.1.1" diff --git a/batcher-bot/notifications/yarn.lock b/batcher-bot/notifications/yarn.lock new file mode 100644 index 00000000..6f47f069 --- /dev/null +++ b/batcher-bot/notifications/yarn.lock @@ -0,0 +1,825 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + "integrity" "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==" + "resolved" "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz" + "version" "7.21.4" + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/helper-validator-identifier@^7.18.6": + "integrity" "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" + "resolved" "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz" + "version" "7.19.1" + +"@babel/highlight@^7.18.6": + "integrity" "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==" + "resolved" "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz" + "version" "7.18.6" + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + "chalk" "^2.0.0" + "js-tokens" "^4.0.0" + +"@dipdup/tzkt-api@^0.0.1": + "integrity" "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==" + "resolved" "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz" + "version" "0.0.1" + +"@jest/types@^26.6.2": + "integrity" "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==" + "resolved" "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + "chalk" "^4.0.0" + +"@microsoft/signalr@^7.0.5": + "integrity" "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==" + "resolved" "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz" + "version" "7.0.5" + dependencies: + "abort-controller" "^3.0.0" + "eventsource" "^2.0.2" + "fetch-cookie" "^2.0.3" + "node-fetch" "^2.6.7" + "ws" "^7.4.5" + +"@taquito/http-utils@^8.1.0": + "integrity" "sha512-fSoi1hW2rFMeyjTMm3lGaKpWmtlWK+vbXocgPS7aSZGmTon67aE2RRjjc1ZlfBORWxvbLYuttDW5GypLSxkf7w==" + "resolved" "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "xhr2-cookies" "^1.1.0" + +"@taquito/michel-codec@^8.1.1": + "integrity" "sha512-Clp6LfFVxXuLIUTdMi0XK7lnPBhrj9p8XIismf1Gobg/nxqMCW5idWAprl4f3ickpOzlNLm8UHjCs4aUee1GiQ==" + "resolved" "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-8.1.1.tgz" + "version" "8.1.1" + +"@taquito/michelson-encoder@^8.1.1": + "integrity" "sha512-5axhQr82wkM4J1YHf1nQ8jx7gp45kJFk6D/CcfNeIWHSrGFxQCzHCYkXhYOViCnmhsgJgKrNfqB8UyPeNfFsVg==" + "resolved" "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "fast-json-stable-stringify" "^2.1.0" + +"@taquito/rpc@^8.1.1": + "integrity" "sha512-NS1aoVy+co5xCe41wM67PEMZHt88RtxpsGPvsYs0TO1sJN6JFgwkZYE/ZQULRHPb6JXNxY/KOCVnYahFM+a8pg==" + "resolved" "https://registry.npmjs.org/@taquito/rpc/-/rpc-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/http-utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "lodash" "^4.17.20" + +"@taquito/taquito@^8.0.1": + "integrity" "sha512-A8aOYaaAxiwcdGhftdg8lgiX1ZivtrLoqvhWow+JGfvAyAsVabAvckpEgEHgBUvmFClSFVbuM/TOAarnHUfd3A==" + "resolved" "https://registry.npmjs.org/@taquito/taquito/-/taquito-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "@taquito/http-utils" "^8.1.0" + "@taquito/michel-codec" "^8.1.1" + "@taquito/michelson-encoder" "^8.1.1" + "@taquito/rpc" "^8.1.1" + "@taquito/utils" "^8.1.0" + "bignumber.js" "^9.0.1" + "rx-sandbox" "^1.0.3" + "rxjs" "^6.6.3" + +"@taquito/utils@^8.1.0": + "integrity" "sha512-ZsHYxEZ+voTjnFZM/iQXeCDUSa2eH5n9PMSX0DNq85hN6S5Q0ZP/4CGznOf+RJj7p1GF2cbKf9wUJrOMFdN+0g==" + "resolved" "https://registry.npmjs.org/@taquito/utils/-/utils-8.1.1.tgz" + "version" "8.1.1" + dependencies: + "blakejs" "^1.1.0" + "bs58check" "^2.1.2" + "buffer" "^5.6.0" + +"@tsconfig/node16-strictest@^1.0.4": + "integrity" "sha512-kp6/DuAoKzHVv5U+p0uOesYbjrEvrYVNdQMl163a+yXXUv9twabvkCGEn3pmVxKXB45JU5MPGolDDWnONZL5ZQ==" + "resolved" "https://registry.npmjs.org/@tsconfig/node16-strictest/-/node16-strictest-1.0.4.tgz" + "version" "1.0.4" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + "integrity" "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + "resolved" "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" + "version" "2.0.4" + +"@types/istanbul-lib-report@*": + "integrity" "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==" + "resolved" "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + "integrity" "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==" + "resolved" "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz" + "version" "3.0.1" + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/node@*", "@types/node@^18.7.14": + "integrity" "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==" + "resolved" "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz" + "version" "18.16.2" + +"@types/stack-utils@^2.0.0": + "integrity" "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + "resolved" "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz" + "version" "2.0.1" + +"@types/yargs-parser@*": + "integrity" "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + "resolved" "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" + "version" "21.0.0" + +"@types/yargs@^15.0.0": + "integrity" "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==" + "resolved" "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz" + "version" "15.0.15" + dependencies: + "@types/yargs-parser" "*" + +"abort-controller@^3.0.0": + "integrity" "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==" + "resolved" "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "event-target-shim" "^5.0.0" + +"ansi-regex@^5.0.0": + "integrity" "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + "version" "5.0.1" + +"ansi-styles@^3.2.1": + "integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" + "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" + "version" "3.2.1" + dependencies: + "color-convert" "^1.9.0" + +"ansi-styles@^4.0.0", "ansi-styles@^4.1.0": + "integrity" "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==" + "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + "version" "4.3.0" + dependencies: + "color-convert" "^2.0.1" + +"base-x@^3.0.2": + "integrity" "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==" + "resolved" "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz" + "version" "3.0.9" + dependencies: + "safe-buffer" "^5.0.1" + +"base64-js@^1.3.1": + "integrity" "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "resolved" "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" + "version" "1.5.1" + +"bignumber.js@^9.0.1": + "integrity" "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + "resolved" "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz" + "version" "9.1.1" + +"blakejs@^1.1.0": + "integrity" "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + "resolved" "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" + "version" "1.2.1" + +"braces@^3.0.2": + "integrity" "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==" + "resolved" "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" + "version" "3.0.2" + dependencies: + "fill-range" "^7.0.1" + +"bs58@^4.0.0": + "integrity" "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==" + "resolved" "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz" + "version" "4.0.1" + dependencies: + "base-x" "^3.0.2" + +"bs58check@^2.1.2": + "integrity" "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==" + "resolved" "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz" + "version" "2.1.2" + dependencies: + "bs58" "^4.0.0" + "create-hash" "^1.1.0" + "safe-buffer" "^5.1.2" + +"buffer-alloc-unsafe@^1.1.0": + "integrity" "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + "resolved" "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz" + "version" "1.1.0" + +"buffer-alloc@^1.2.0": + "integrity" "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==" + "resolved" "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz" + "version" "1.2.0" + dependencies: + "buffer-alloc-unsafe" "^1.1.0" + "buffer-fill" "^1.0.0" + +"buffer-fill@^1.0.0": + "integrity" "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + "resolved" "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz" + "version" "1.0.0" + +"buffer@^5.6.0": + "integrity" "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==" + "resolved" "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" + "version" "5.7.1" + dependencies: + "base64-js" "^1.3.1" + "ieee754" "^1.1.13" + +"chalk@^2.0.0": + "integrity" "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + "version" "2.4.2" + dependencies: + "ansi-styles" "^3.2.1" + "escape-string-regexp" "^1.0.5" + "supports-color" "^5.3.0" + +"chalk@^4.0.0": + "integrity" "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + +"cipher-base@^1.0.1": + "integrity" "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==" + "resolved" "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz" + "version" "1.0.4" + dependencies: + "inherits" "^2.0.1" + "safe-buffer" "^5.0.1" + +"color-convert@^1.9.0": + "integrity" "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==" + "resolved" "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" + "version" "1.9.3" + dependencies: + "color-name" "1.1.3" + +"color-convert@^2.0.1": + "integrity" "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==" + "resolved" "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" + "version" "2.0.1" + dependencies: + "color-name" "~1.1.4" + +"color-name@~1.1.4": + "integrity" "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "resolved" "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + "version" "1.1.4" + +"color-name@1.1.3": + "integrity" "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "resolved" "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + "version" "1.1.3" + +"commander@^4.0.0": + "integrity" "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + "resolved" "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz" + "version" "4.1.1" + +"cookiejar@^2.1.1": + "integrity" "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" + "resolved" "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz" + "version" "2.1.4" + +"create-hash@^1.1.0": + "integrity" "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==" + "resolved" "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz" + "version" "1.2.0" + dependencies: + "cipher-base" "^1.0.1" + "inherits" "^2.0.1" + "md5.js" "^1.3.4" + "ripemd160" "^2.0.1" + "sha.js" "^2.4.0" + +"cross-spawn@^7.0.0": + "integrity" "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==" + "resolved" "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" + "version" "7.0.3" + dependencies: + "path-key" "^3.1.0" + "shebang-command" "^2.0.0" + "which" "^2.0.1" + +"debug@^4.3.4": + "integrity" "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==" + "resolved" "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + "version" "4.3.4" + dependencies: + "ms" "2.1.2" + +"diff-sequences@^26.6.2": + "integrity" "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==" + "resolved" "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz" + "version" "26.6.2" + +"dotenv@^16.0.3": + "integrity" "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + "resolved" "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz" + "version" "16.0.3" + +"env-cmd@^10.1.0": + "integrity" "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==" + "resolved" "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz" + "version" "10.1.0" + dependencies: + "commander" "^4.0.0" + "cross-spawn" "^7.0.0" + +"escape-string-regexp@^1.0.5": + "integrity" "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + "resolved" "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + "version" "1.0.5" + +"escape-string-regexp@^2.0.0": + "integrity" "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + "resolved" "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" + "version" "2.0.0" + +"event-target-shim@^5.0.0": + "integrity" "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + "resolved" "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" + "version" "5.0.1" + +"eventsource@^2.0.2": + "integrity" "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + "resolved" "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz" + "version" "2.0.2" + +"expect@^26.6.1": + "integrity" "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==" + "resolved" "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@jest/types" "^26.6.2" + "ansi-styles" "^4.0.0" + "jest-get-type" "^26.3.0" + "jest-matcher-utils" "^26.6.2" + "jest-message-util" "^26.6.2" + "jest-regex-util" "^26.0.0" + +"fast-json-stable-stringify@^2.1.0": + "integrity" "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "resolved" "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + "version" "2.1.0" + +"fetch-cookie@^2.0.3": + "integrity" "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==" + "resolved" "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz" + "version" "2.1.0" + dependencies: + "set-cookie-parser" "^2.4.8" + "tough-cookie" "^4.0.0" + +"fill-range@^7.0.1": + "integrity" "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==" + "resolved" "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz" + "version" "7.0.1" + dependencies: + "to-regex-range" "^5.0.1" + +"graceful-fs@^4.2.4": + "integrity" "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "resolved" "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" + "version" "4.2.11" + +"hamt_plus@1.0.2": + "integrity" "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + "resolved" "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz" + "version" "1.0.2" + +"has-flag@^3.0.0": + "integrity" "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + "resolved" "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" + "version" "3.0.0" + +"has-flag@^4.0.0": + "integrity" "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "resolved" "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" + "version" "4.0.0" + +"hash-base@^3.0.0": + "integrity" "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==" + "resolved" "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "inherits" "^2.0.4" + "readable-stream" "^3.6.0" + "safe-buffer" "^5.2.0" + +"ieee754@^1.1.13": + "integrity" "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "resolved" "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" + "version" "1.2.1" + +"inherits@^2.0.1", "inherits@^2.0.3", "inherits@^2.0.4": + "integrity" "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" + "version" "2.0.4" + +"is-number@^7.0.0": + "integrity" "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "resolved" "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" + "version" "7.0.0" + +"isexe@^2.0.0": + "integrity" "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "resolved" "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + "version" "2.0.0" + +"jest-diff@^26.6.2": + "integrity" "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==" + "resolved" "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "chalk" "^4.0.0" + "diff-sequences" "^26.6.2" + "jest-get-type" "^26.3.0" + "pretty-format" "^26.6.2" + +"jest-get-type@^26.3.0": + "integrity" "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==" + "resolved" "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz" + "version" "26.3.0" + +"jest-matcher-utils@^26.6.1", "jest-matcher-utils@^26.6.2": + "integrity" "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==" + "resolved" "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "chalk" "^4.0.0" + "jest-diff" "^26.6.2" + "jest-get-type" "^26.3.0" + "pretty-format" "^26.6.2" + +"jest-message-util@^26.6.2": + "integrity" "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==" + "resolved" "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/types" "^26.6.2" + "@types/stack-utils" "^2.0.0" + "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" + "micromatch" "^4.0.2" + "pretty-format" "^26.6.2" + "slash" "^3.0.0" + "stack-utils" "^2.0.2" + +"jest-regex-util@^26.0.0": + "integrity" "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==" + "resolved" "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz" + "version" "26.0.0" + +"js-tokens@^4.0.0": + "integrity" "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "resolved" "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + "version" "4.0.0" + +"list@2.0.19": + "integrity" "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + "resolved" "https://registry.npmjs.org/list/-/list-2.0.19.tgz" + "version" "2.0.19" + +"lodash@^4.17.20": + "integrity" "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "resolved" "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + "version" "4.17.21" + +"md5.js@^1.3.4": + "integrity" "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==" + "resolved" "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz" + "version" "1.3.5" + dependencies: + "hash-base" "^3.0.0" + "inherits" "^2.0.1" + "safe-buffer" "^5.1.2" + +"micromatch@^4.0.2": + "integrity" "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==" + "resolved" "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" + "version" "4.0.5" + dependencies: + "braces" "^3.0.2" + "picomatch" "^2.3.1" + +"mri@^1.2.0": + "integrity" "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + "resolved" "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz" + "version" "1.2.0" + +"ms@2.1.2": + "integrity" "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "resolved" "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + "version" "2.1.2" + +"node-fetch@^2.6.7", "node-fetch@^2.6.8": + "integrity" "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==" + "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz" + "version" "2.6.9" + dependencies: + "whatwg-url" "^5.0.0" + +"p-timeout@^4.1.0": + "integrity" "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==" + "resolved" "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz" + "version" "4.1.0" + +"path-key@^3.1.0": + "integrity" "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + "resolved" "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + "version" "3.1.1" + +"picomatch@^2.3.1": + "integrity" "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + "resolved" "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + "version" "2.3.1" + +"prelude-ts@^1.0.6": + "integrity" "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==" + "resolved" "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz" + "version" "1.0.6" + dependencies: + "hamt_plus" "1.0.2" + "list" "2.0.19" + +"pretty-format@^26.6.2": + "integrity" "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==" + "resolved" "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@jest/types" "^26.6.2" + "ansi-regex" "^5.0.0" + "ansi-styles" "^4.0.0" + "react-is" "^17.0.1" + +"psl@^1.1.33": + "integrity" "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + "resolved" "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz" + "version" "1.9.0" + +"punycode@^2.1.1": + "integrity" "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + "resolved" "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" + "version" "2.3.0" + +"querystringify@^2.1.1": + "integrity" "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + "resolved" "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz" + "version" "2.2.0" + +"react-is@^17.0.1": + "integrity" "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + "resolved" "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" + "version" "17.0.2" + +"readable-stream@^3.6.0": + "integrity" "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==" + "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" + "version" "3.6.2" + dependencies: + "inherits" "^2.0.3" + "string_decoder" "^1.1.1" + "util-deprecate" "^1.0.1" + +"requires-port@^1.0.0": + "integrity" "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + "resolved" "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" + "version" "1.0.0" + +"ripemd160@^2.0.1": + "integrity" "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==" + "resolved" "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz" + "version" "2.0.2" + dependencies: + "hash-base" "^3.0.0" + "inherits" "^2.0.1" + +"rx-sandbox@^1.0.3": + "integrity" "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==" + "resolved" "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz" + "version" "1.0.4" + dependencies: + "expect" "^26.6.1" + "jest-matcher-utils" "^26.6.1" + +"rxjs@^6.6.3", "rxjs@6.x": + "integrity" "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==" + "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz" + "version" "6.6.7" + dependencies: + "tslib" "^1.9.0" + +"rxjs@^7.4.0": + "integrity" "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==" + "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz" + "version" "7.8.1" + dependencies: + "tslib" "^2.1.0" + +"safe-buffer@^5.0.1", "safe-buffer@^5.1.2", "safe-buffer@^5.2.0", "safe-buffer@~5.2.0": + "integrity" "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "resolved" "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + "version" "5.2.1" + +"safe-compare@^1.1.4": + "integrity" "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==" + "resolved" "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz" + "version" "1.1.4" + dependencies: + "buffer-alloc" "^1.2.0" + +"sandwich-stream@^2.0.2": + "integrity" "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ==" + "resolved" "https://registry.npmjs.org/sandwich-stream/-/sandwich-stream-2.0.2.tgz" + "version" "2.0.2" + +"set-cookie-parser@^2.4.8": + "integrity" "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + "resolved" "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz" + "version" "2.6.0" + +"sha.js@^2.4.0": + "integrity" "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==" + "resolved" "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz" + "version" "2.4.11" + dependencies: + "inherits" "^2.0.1" + "safe-buffer" "^5.0.1" + +"shebang-command@^2.0.0": + "integrity" "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==" + "resolved" "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + "version" "2.0.0" + dependencies: + "shebang-regex" "^3.0.0" + +"shebang-regex@^3.0.0": + "integrity" "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + "resolved" "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + "version" "3.0.0" + +"slash@^3.0.0": + "integrity" "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + "resolved" "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" + "version" "3.0.0" + +"stack-utils@^2.0.2": + "integrity" "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==" + "resolved" "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" + "version" "2.0.6" + dependencies: + "escape-string-regexp" "^2.0.0" + +"string_decoder@^1.1.1": + "integrity" "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==" + "resolved" "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + "version" "1.3.0" + dependencies: + "safe-buffer" "~5.2.0" + +"supports-color@^5.3.0": + "integrity" "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==" + "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" + "version" "5.5.0" + dependencies: + "has-flag" "^3.0.0" + +"supports-color@^7.1.0": + "integrity" "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==" + "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" + "version" "7.2.0" + dependencies: + "has-flag" "^4.0.0" + +"telegraf@^4.12.3-canary.1": + "integrity" "sha512-U+NUALfpFhkMoCvZrx2llaZyoJRsY8EL9zu8rg1aZn4YX3lNbsIGC3GeXRDq+vyotyxnnC9xm5EDXs7znppuMw==" + "resolved" "https://registry.npmjs.org/telegraf/-/telegraf-4.12.3-canary.1.tgz" + "version" "4.12.3-canary.1" + dependencies: + "abort-controller" "^3.0.0" + "debug" "^4.3.4" + "mri" "^1.2.0" + "node-fetch" "^2.6.8" + "p-timeout" "^4.1.0" + "safe-compare" "^1.1.4" + "sandwich-stream" "^2.0.2" + "typegram" "^4.3.0" + +"to-regex-range@^5.0.1": + "integrity" "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==" + "resolved" "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" + "version" "5.0.1" + dependencies: + "is-number" "^7.0.0" + +"tough-cookie@^4.0.0": + "integrity" "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==" + "resolved" "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "psl" "^1.1.33" + "punycode" "^2.1.1" + "universalify" "^0.2.0" + "url-parse" "^1.5.3" + +"tr46@~0.0.3": + "integrity" "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + "version" "0.0.3" + +"tslib@^1.9.0": + "integrity" "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "resolved" "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" + "version" "1.14.1" + +"tslib@^2.1.0": + "integrity" "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz" + "version" "2.5.0" + +"typegram@^4.3.0": + "integrity" "sha512-pS4STyOZoJ++Mwa9GPMTNjOwEzMkxFfFt1By6IbMOJfheP0utMP/H1ga6J9R4DTjAYBr0UDn4eQg++LpWBvcAg==" + "resolved" "https://registry.npmjs.org/typegram/-/typegram-4.3.0.tgz" + "version" "4.3.0" + +"typescript@^4.8.2": + "integrity" "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" + "version" "4.9.5" + +"universalify@^0.2.0": + "integrity" "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + "resolved" "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz" + "version" "0.2.0" + +"url-parse@^1.5.3": + "integrity" "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==" + "resolved" "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz" + "version" "1.5.10" + dependencies: + "querystringify" "^2.1.1" + "requires-port" "^1.0.0" + +"util-deprecate@^1.0.1": + "integrity" "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "resolved" "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "version" "1.0.2" + +"webidl-conversions@^3.0.0": + "integrity" "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + "version" "3.0.1" + +"whatwg-url@^5.0.0": + "integrity" "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==" + "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + "version" "5.0.0" + dependencies: + "tr46" "~0.0.3" + "webidl-conversions" "^3.0.0" + +"which@^2.0.1": + "integrity" "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==" + "resolved" "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + "version" "2.0.2" + dependencies: + "isexe" "^2.0.0" + +"ws@^7.4.5": + "integrity" "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==" + "resolved" "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz" + "version" "7.5.9" + +"xhr2-cookies@^1.1.0": + "integrity" "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==" + "resolved" "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz" + "version" "1.1.0" + dependencies: + "cookiejar" "^2.1.1" diff --git a/batcher-ui/src/components/About/index.tsx b/batcher-ui/src/components/About/index.tsx index c4f71ca2..0279b021 100644 --- a/batcher-ui/src/components/About/index.tsx +++ b/batcher-ui/src/components/About/index.tsx @@ -7,18 +7,26 @@ const About: React.FC = () => { return (
- Batcher is a batch processing orderbook DEX. Batcher’s goal is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. This means that all orders for potential swaps between two pairs of tokens are collected over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order collection period is over, the batch is closed to additions. Batcher then waits for the next Oracle price for the token pair. When this is received, the batch is terminated and then Batcher looks to match the maximum amount of orders at the fairest possible price. + + Batcher is a new type of DEX that we have named a 'batch clearing DEX'. It provides a dark pool-like trading environment without using liquidity pools or having the issue of significant slippage. Batcher’s goal is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. This means that all orders for potential swaps between two pairs of tokens are collected over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order collection period is over, the batch is closed to additions. Batcher then waits for the next Oracle price for the token pair. When this is received, the batch is terminated and then Batcher looks to match the maximum amount of orders at the fairest possible price. -For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. Only the tzBTC/USDT pair will be supported for V1. +For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. -Note: Batcher can deal with token value imbalance which means that holders of tzBTC and holders of USDT can swap different amounts as long as the market of orders is equivalent on both sides. +Note: Batcher can deal with token value imbalance which means that holders of tzBTC and holders of USDT can swap different amounts as long as there is a market for the trade on both sides. + + Batcher has been designed to be composable with other high liquidity paths in the Tezos ecosystem, specifically the Sirius DEX; thus, the two pairs that are supported in V1 are tzBTC/USDT and tzBTC/EURL. + - - + For more information including blog posts and faqs, please visit the Batcher project page at Marigold.dev. + + + *DISCLAIMER:* All investing comes with risk and DeFi is no exception. The content in this Dapp contains no financial advice. +Please do your own thorough research and note that all users funds are traded at their own risk. No reimbursement will be made and Marigold will not assume responsibility for any losses. +
); diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 442b38cc..19b9b98f 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -14,7 +14,8 @@ import { } from '@/extra_utils/types'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; import { Space, Col, Row, Drawer, Radio, } from 'antd'; -import { CiTwoTone, DoubleRightOutlined } from '@ant-design/icons'; +import { CiTwoTone, ConsoleSqlOutlined, DoubleRightOutlined } from '@ant-design/icons'; + import type { RadioChangeEvent } from 'antd'; import { useModel } from 'umi'; import { @@ -96,7 +97,21 @@ const Welcome: React.FC = () => { }; }; + const setStatusFromBatch = (jsonData:any) => { + try { + const status = Object.keys(jsonData.value.status)[0]; + setStatus(status); + if (status === BatcherStatus.OPEN) { + setOpenTime(jsonData.value.status.open); + } + if (status === BatcherStatus.CLOSED) { + setStatus(BatcherStatus.CLOSED); + } + } catch (error) { + console.error('Unable to set status', error); + } + } const getCurrentVolume = async (storage: any) => { try { const currentBatchIndices = storage.batch_set.current_batch_indices; @@ -111,22 +126,19 @@ const Welcome: React.FC = () => { } else { const currentBatchURI = bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; + console.log('######Volumes - URI', currentBatchURI); const data = await fetch(currentBatchURI, { method: 'GET', }); + if(data.ok && data.status !== 204) { const jsonData = await data.json(); + setStatusFromBatch(jsonData); // eslint-disable-next-line @typescript-eslint/no-shadow - const status = Object.keys(jsonData.value.status)[0]; - setStatus(status); - if (status === BatcherStatus.OPEN) { - setOpenTime(jsonData.value.status.open); - } - if (status === BatcherStatus.CLOSED) { - setStatus(BatcherStatus.CLOSED); - } - console.log('######Volumes', jsonData.value.volumes); const scaledVolumes = scaleVolumeDown(jsonData.value.volumes); setVolumes(scaledVolumes); + } else { + console.info("Response from current batch api was no ok", data); + } } } catch (error) { console.error('Unable to get current volume', error); @@ -673,19 +685,37 @@ const Welcome: React.FC = () => { if(userAddress === null){ if(initialState.userAddress !== null){ usrAddr = initialState.userAddress; - setUserAddress(usrAddr); } } + + if(usrAddr === null){ + setBuyBalance(0); + setSellBalance(0); + } else { + + console.log('getTokenBalance-userAddress',usrAddr); const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; console.log('getTokenBalance-balanceURI',balanceURI); - const data = await fetch(balanceURI, { method: 'GET' }); - await data.json().then(balance => { + + const buyTokenData = await fetch(balanceURI + '&token.contract=' + buyToken.address, { method: 'GET' }); + const sellTokenData = await fetch(balanceURI + '&token.contract=' + sellToken.address, { method: 'GET' }); + + try{ + await buyTokenData.json().then(balance => { if (Array.isArray(balance)) { setTokenAmount(balance, buyBalance, buyToken.address, buyToken.decimals, setBuyBalance); + } + }); + } catch (error){ + console.error(error); + } + await sellTokenData.json().then(balance => { + if (Array.isArray(balance)) { setTokenAmount(balance, sellBalance, sellToken.address, sellToken.decimals, setSellBalance); } }); + } } catch (error) { console.error('getTokenBalance-error',error); if(!userAddress) { From 41a7a5edd7deb5890a1570404f9ead7f68f27e01 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 12 May 2023 13:26:48 +0100 Subject: [PATCH 056/108] Corrected mainnet variables --- batcher-bot/notifications/.env.mainnet | 8 ++++---- batcher-bot/notifications/src/formatter.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/batcher-bot/notifications/.env.mainnet b/batcher-bot/notifications/.env.mainnet index 81d9255c..22234c80 100644 --- a/batcher-bot/notifications/.env.mainnet +++ b/batcher-bot/notifications/.env.mainnet @@ -1,4 +1,4 @@ -BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 -TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev -TZKT_URI_API=https://api.ghostnet.tzkt.io -NOTIFICATIONS=deposits +BATCHER_ADDRESS=KT1CoTu4CXcWoVk69Ukbgwx2iDK7ZA4FMSpJ +TEZOS_NODE_URI=https://mainnet.tezos.marigold.dev +TZKT_URI_API=https://api.tzkt.io +NOTIFICATIONS=deposits,status_updates diff --git a/batcher-bot/notifications/src/formatter.ts b/batcher-bot/notifications/src/formatter.ts index fb5f8780..c0042c31 100644 --- a/batcher-bot/notifications/src/formatter.ts +++ b/batcher-bot/notifications/src/formatter.ts @@ -79,7 +79,7 @@ const formatBatchChange = (message: any): Option => { "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate; } - if (buy_volume == 0 || sell_volume == 0) { + if (buy_volume == 0 && sell_volume == 0) { return Option.none(); } else { return Option.of( From 9adb8ccb2140dcf1e12255e5ded838281ab8be7d Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Fri, 12 May 2023 16:35:35 +0100 Subject: [PATCH 057/108] Corrections for batcher notifications bot (mainnet) (#335) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Release - Ghostnet (#316) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Fixed issue with token balances updating * Release - Ghostnet (#318) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating --------- Co-authored-by: Cyril B * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * pipelines: patch deprecated set-output commands and actions [skip ci] * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot * telegram bot for ghostnet version (#332) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Release - Mainnet (#317) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot --------- Co-authored-by: Jason Ridgway-Taylor Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> * pipelines: fix ci of bot notif * Corrected mainnet variables --------- Co-authored-by: Cyril B --- batcher-bot/notifications/.env.mainnet | 8 ++++---- batcher-bot/notifications/src/formatter.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/batcher-bot/notifications/.env.mainnet b/batcher-bot/notifications/.env.mainnet index 81d9255c..22234c80 100644 --- a/batcher-bot/notifications/.env.mainnet +++ b/batcher-bot/notifications/.env.mainnet @@ -1,4 +1,4 @@ -BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 -TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev -TZKT_URI_API=https://api.ghostnet.tzkt.io -NOTIFICATIONS=deposits +BATCHER_ADDRESS=KT1CoTu4CXcWoVk69Ukbgwx2iDK7ZA4FMSpJ +TEZOS_NODE_URI=https://mainnet.tezos.marigold.dev +TZKT_URI_API=https://api.tzkt.io +NOTIFICATIONS=deposits,status_updates diff --git a/batcher-bot/notifications/src/formatter.ts b/batcher-bot/notifications/src/formatter.ts index fb5f8780..c0042c31 100644 --- a/batcher-bot/notifications/src/formatter.ts +++ b/batcher-bot/notifications/src/formatter.ts @@ -79,7 +79,7 @@ const formatBatchChange = (message: any): Option => { "Cleared (" + val.status.cleared.at + ") @ " + rate_name + " " + rate; } - if (buy_volume == 0 || sell_volume == 0) { + if (buy_volume == 0 && sell_volume == 0) { return Option.none(); } else { return Option.of( From 296abab5ed1b7bca32d67da9865071bccc8a28a1 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Thu, 18 May 2023 11:21:34 +0100 Subject: [PATCH 058/108] Removed rate notifications from ghostnet nbot --- batcher-bot/notifications/.env.ghostnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batcher-bot/notifications/.env.ghostnet b/batcher-bot/notifications/.env.ghostnet index dc650e0e..fac1b3d3 100644 --- a/batcher-bot/notifications/.env.ghostnet +++ b/batcher-bot/notifications/.env.ghostnet @@ -1,4 +1,4 @@ BATCHER_ADDRESS=KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1 TEZOS_NODE_URI=https://ghostnet.tezos.marigold.dev TZKT_URI_API=https://api.ghostnet.tzkt.io -NOTIFICATIONS=deposits,rates,status_updates +NOTIFICATIONS=deposits,status_updates From 23470b1a1bd53e15ceb3db38b382713df48b19e7 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Fri, 19 May 2023 13:37:37 +0100 Subject: [PATCH 059/108] 325 bot jit liquidity (#337) * Added skeleton for liquidity cli * Added initial start of jit implementation * Added buy side jit provisioning rules to bot * Added initial always on provision * Corrected path in message for always-on * Tidy up * Tidy up * Add interaction with batcher contract on ghostnet (#336) * gitignore for javascript compiled files * Add a dependency to Taquito * Add interaction with Batcher contract: deposit and redeem. Also, wallets. * Working versions for both liquidity bots * Packaged build to single file and add release action * Added working sub dir to build and manual trigger for testing * Added example config files into build file and expanded ghostnet example * Corrected release pathing * Corrected release pathing * Compress and hash release artefacts * corrected compression * Added zip compression to release artefacts * Added zip compression to release artefacts * Removed pre-release clause * Removed bundled compilation * Package node modules with liq bots * Updated packaging to prune modules * Always on only submits once per batch * Tidied bot status message * Tidied bot status message * Correctly parse status * Update batcher-bot/liquidity/src/utils.ts Co-authored-by: Ulrik Strid * PRC: Throw if no private key in environment * Added usage README content for liq bot * PRC: Use if in structure rather than getting all keys * PRC: Change lets to consts where applicable in provisioning * PRC: Change lets to consts where applicable in provisioning * PRC: Declare events prior to subscription --------- Co-authored-by: aguillon Co-authored-by: Ulrik Strid --- .github/workflows/release-bots.yml | 44 + .gitignore | 3 + batcher-bot/liquidity/.gitignore | 2 + batcher-bot/liquidity/README.md | 126 + batcher-bot/liquidity/assets/fonts/Larry3D.js | 925 +++++ batcher-bot/liquidity/package-lock.json | 3109 +++++++++++++++++ batcher-bot/liquidity/package.json | 41 + batcher-bot/liquidity/src/bot.ts | 229 ++ batcher-bot/liquidity/src/index.ts | 84 + .../liquidity-config-example-ghostnet.json | 25 + .../src/liquidity-config-example-mainnet.json | 15 + batcher-bot/liquidity/src/provision.ts | 240 ++ batcher-bot/liquidity/src/settings.ts | 36 + batcher-bot/liquidity/src/submitter.ts | 172 + batcher-bot/liquidity/src/types.ts | 54 + batcher-bot/liquidity/src/utils.ts | 75 + batcher-bot/liquidity/tsconfig.json | 16 + batcher-bot/notifications/flake.lock | 44 - batcher-bot/notifications/flake.nix | 41 - flake.nix | 11 +- 20 files changed, 5198 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/release-bots.yml create mode 100644 batcher-bot/liquidity/.gitignore create mode 100644 batcher-bot/liquidity/README.md create mode 100644 batcher-bot/liquidity/assets/fonts/Larry3D.js create mode 100644 batcher-bot/liquidity/package-lock.json create mode 100644 batcher-bot/liquidity/package.json create mode 100644 batcher-bot/liquidity/src/bot.ts create mode 100644 batcher-bot/liquidity/src/index.ts create mode 100644 batcher-bot/liquidity/src/liquidity-config-example-ghostnet.json create mode 100644 batcher-bot/liquidity/src/liquidity-config-example-mainnet.json create mode 100644 batcher-bot/liquidity/src/provision.ts create mode 100644 batcher-bot/liquidity/src/settings.ts create mode 100644 batcher-bot/liquidity/src/submitter.ts create mode 100644 batcher-bot/liquidity/src/types.ts create mode 100644 batcher-bot/liquidity/src/utils.ts create mode 100644 batcher-bot/liquidity/tsconfig.json delete mode 100644 batcher-bot/notifications/flake.lock delete mode 100644 batcher-bot/notifications/flake.nix diff --git a/.github/workflows/release-bots.yml b/.github/workflows/release-bots.yml new file mode 100644 index 00000000..1cbcf3e0 --- /dev/null +++ b/.github/workflows/release-bots.yml @@ -0,0 +1,44 @@ +name: Release Liquidity Bots + +on: + workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually + push: + tags: + - 'bots-v*' + +defaults: + run: + working-directory: batcher-bot/liquidity +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '18.x' + - name: Install modules + run: npm install + - name: Build + run: npm run build + - name: Package + run: npm run package + - name: Tar compress + run: tar -cvf batcher-liquidity-bot.tar.xz dist/* + - name: Hash Tar + run: echo $(md5sum batcher-liquidity-bot.tar.xz) > batcher-liquidity-bot.tar.hash.md + - name: Zip compress + run: zip -r batcher-liquidity-bot.zip dist/* + - name: Hash Tar + run: echo $(md5sum batcher-liquidity-bot.zip) > batcher-liquidity-bot.zip.hash.md + - name: Release + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + files: | + ./batcher-bot/liquidity/batcher-liquidity-bot.tar.xz + ./batcher-bot/liquidity/batcher-liquidity-bot.tar.hash.md + ./batcher-bot/liquidity/batcher-liquidity-bot.zip + ./batcher-bot/liquidity/batcher-liquidity-bot.zip.hash.md diff --git a/.gitignore b/.gitignore index c9eb4589..3b9562a2 100644 --- a/.gitignore +++ b/.gitignore @@ -57,5 +57,8 @@ USDT_token_storage.tz # Tezos client artefacts .tezos-client/ +node_modules ./*/node_modules/ +dist batcher-bot/notifications/node_modules/ +batcher-bot/liquidity/node_modules/ diff --git a/batcher-bot/liquidity/.gitignore b/batcher-bot/liquidity/.gitignore new file mode 100644 index 00000000..77271620 --- /dev/null +++ b/batcher-bot/liquidity/.gitignore @@ -0,0 +1,2 @@ +lib/*.js +lib/*.d.ts diff --git a/batcher-bot/liquidity/README.md b/batcher-bot/liquidity/README.md new file mode 100644 index 00000000..d45c2e98 --- /dev/null +++ b/batcher-bot/liquidity/README.md @@ -0,0 +1,126 @@ +# Liquidity Bot + +## Pre-requisites + +To run the bot you will need to have an environment that has Node.js installed. + +> The releases were developed and tested with v18.14.0 of Node. + +## Installation + +The release package can be downloaded from the releases pages of the repo in either zip or tar.xz formats. A hash.md for each format is supplied so that the contents of the file can be verified. + +## Operation + +Once the release has been downloaded and unpacked it can be run from the command line. + +### Liquidity Modes + +The liquidity bot allows deposits to be made automatically based on configuration. There are two specific modes of liquidity: + +- JIT (just-in-time): This mode listens for trades in each batch and places an opposing deposit. +- ALWAYS-ON : This mode supplies a given deposit at batch open. + +To run the bot simply specify the mode as the first argument. The second argument should be the path to the configuration file: + +Jit mode: +```bash +node index.js jit +``` + +Alwys-on mode: +```bash +node index.js always-on +``` + +### Liquidity configuration + +Both modes use a configuration file that supplies rules for the deposits for one or more pairs. Examples of config files for mainnet and ghostnet are bundled with the release; they include the variables for the Batcher contract address, the address of a Tezos node and the relevant tzkt api address. + +Example of ghostnet config file. + +```json +{ + "batcher_address": "KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1", + "tezos_node_uri": "https://ghostnet.tezos.marigold.dev", + "tzkt_uri_api": "https://api.ghostnet.tzkt.io", + "token_pairs": [ + { + "name": "tzBTC/USDT", + "side": "both", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "worse", + "sell_limit_per_batch": 200, + "sell_tolerance": "oracle" + }, + { + "name": "tzBTC/EURL", + "side": "either", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "oracle", + "sell_limit_per_batch": 220, + "sell_tolerance": "better" + } + ] + + +} + +``` + +More importantly, they contain the configuration of the liquidity provision for the token pairs. + +```json + "token_pairs": [ + { + "name": "tzBTC/USDT", + "side": "both", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "worse", + "sell_limit_per_batch": 200, + "sell_tolerance": "oracle" + }, + { + "name": "tzBTC/EURL", + "side": "either", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "oracle", + "sell_limit_per_batch": 220, + "sell_tolerance": "better" + } + ] + +``` + +When running the bot, a user is free to only include the pairs they are interested in. For each pair, the configuration should include the name of the pair, the side one wishes to supply liquidity for, and the amount limit per batch and tolerance for each side. + +### Name + +The name of the pair should be the same as that specified in the `valid_swap` item in the Batcher contract storage. At the time of writing this is either *tzBTC/USDT* or *tzBTC/EURL*. + +### Side + +The 'side' configuration is the side that a user is interested in trading. These can be: + +- both - one can supply liquidity to both sides of a trade if one should choose. +- either - one can supply either side of a trade; *this is only a valid option for the 'jit' mode*. +- buy - only supply liquidity for the buy side of a given pair +- sell - only supply liquidity for the sell side of a given pair + +### Limit Per Batch + +The `buy_limit_per_batch` and `sell_limit_per_batch` configurations define the deposit size that will occur in any given batch. + +### Tolerance + +With the `buy_tolerance` and `sell_tolerance`, one can set their choice of price level for a given batch that one is willing to trade at. These follow the usual Batcher conventions: + +- worse - A worse price but a better chance of the order being filled +- oracle - Trade at the Oracle price accepted after the batch has closed +- better - A better price but less chance of being filled. + +> The tolerances are ten basis points off a given future Oracle price. + +## Redemption + +In either mode the bot will redeem any holdings once a batch is cleared. diff --git a/batcher-bot/liquidity/assets/fonts/Larry3D.js b/batcher-bot/liquidity/assets/fonts/Larry3D.js new file mode 100644 index 00000000..3c5b0780 --- /dev/null +++ b/batcher-bot/liquidity/assets/fonts/Larry3D.js @@ -0,0 +1,925 @@ +export default `flf2a$ 9 6 30 1 5 +larry3d.flf by Larry Gelberg (larryg@avs.com) +(stolen liberally from Juan Car's puffy.flf) +tweaked by Glenn Chappell +Version 1.2 2/24/94 + +$$$ @ + $$$ @ + $$$ @ + $$$ @ + $$$ @ + $$$ @ + $$$ @ + $$$ @ + $$$@@ + __ @ +/\\ \\ @ +\\ \\ \\ @ + \\ \\ \\ @ + \\ \\_\\ @ + \\/\\_\\@ + \\/_/@ + @ + @@ + __ __ @ +/\\ \\\\ \\ @ +\\ \\_\\\\_\\ @ + \\/_//_/$ @ + $ $ @ + $ $@ + @ + @ + @@ + __ __ @ + _\\ \\\\ \\__ @ +/\\__ _ _\\ @ +\\/_L\\ \\\\ \\L_ @ + /\\_ _ _\\@ + \\/_/\\_\\\\_\\/@ + \\/_//_/ @ + @ + @@ + __ @ +/\\ \\_ @ +\\/'__\`\\ @ +/\\ \\_\\_\\ @ +\\ \\____ \\ @ + \\/\\ \\_\\ \\@ + \\ \`\\_ _/@ + \`\\_/\\_\\@ + \\/_/@@ + __ __ @ +/\\_\\ / / @ +\\/_/ / / @ + / / @ + / / __ @ + /_/ /\\_\\@ + /_/ \\/_/@ + @ + @@ + ____ @ +/| _ \\ @ +|/\\ | @ + \\// __\`\\/\\ @ + /| \\L> <_@ + | \\_____/\\/@ + \\/____/\\/ @ + @ + @@ + __ @ +/\\ \\ @ +\\ \\/$ @ + \\/ $ @ + $ $ @ + $ $@ + @ + @ + @@ + _ @ + /' \\ @ +/\\ ,/' @ +\\ \\ \\ @ + \\ \\ \`\\ @ + \\ \`\\__\\@ + \`\\/_/ @ + @ + @@ + __ @ +/\\ \`\\ @ +\\\`\\ \\ @ + \`\\\`\\ \\ @ + \`\\/' \\@ + /\\__/@ + \\/_/ @ + @ + @@ + __ @ + _\\ \\ _ @ +/\\_\` ' \\ @ +\\/_> <_ @ + /\\_, ,_\\@ + \\/_/\\_\\/@ + \\/_/ @ + @ + @@ + __ @ + /\\ \\ @ + \\_\\ \\___ @ +/\\___ __\\@ +\\/__/\\ \\_/@ + \\ \\_\\ @ + \\/_/ @ + @ + @@ + @ + @ + @ + @ + __ @ +/\\ \\@ +\\ \\/@ + \\/ @ + @@ + @ + @ + @ + _______ @ +/\\______\\@ +\\/______/@ + @ + @ + @@ + @ + @ + @ + @ + __ @ +/\\_\\@ +\\/_/@ + @ + @@ + __@ + / /@ + / / @ + / / @ + / / @ + /_/ @ +/_/ @ + @ + @@ + __ @ + /'__\`\\ @ +/\\ \\/\\ \\ @ +\\ \\ \\ \\ \\ @ + \\ \\ \\_\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + _ @ + /' \\ @ +/\\_, \\ @ +\\/_/\\ \\ @ + \\ \\ \\ @ + \\ \\_\\@ + \\/_/@ + @ + @@ + ___ @ + /'___\`\\ @ +/\\_\\ /\\ \\ @ +\\/_/// /__ @ + // /_\\ \\@ + /\\______/@ + \\/_____/ @ + @ + @@ + __ @ + /'__\`\\ @ +/\\_\\L\\ \\ @ +\\/_/_\\_<_ @ + /\\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + __ __ @ +/\\ \\\\ \\ @ +\\ \\ \\\\ \\ @ + \\ \\ \\\\ \\_ @ + \\ \\__ ,__\\@ + \\/_/\\_\\_/@ + \\/_/ @ + @ + @@ + ______ @ +/\\ ___\\ @ +\\ \\ \\__/ @ + \\ \\___\`\`\\ @ + \\/\\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ____ @ + /'___\\ @ +/\\ \\__/ @ +\\ \\ _\`\`\\ @ + \\ \\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ________ @ +/\\_____ \\@ +\\/___//'/'@ + /' /' @ + /' /' @ + /\\_/ @ + \\// @ + @ + @@ + __ @ + /'_ \`\\ @ +/\\ \\L\\ \\ @ +\\/_> _ <_ @ + /\\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + __ @ + /'_ \`\\ @ +/\\ \\L\\ \\ @ +\\ \\___, \\ @ + \\/__,/\\ \\ @ + \\ \\_\\@ + \\/_/@ + @ + @@ + @ + @ + __ @ +/\\_\\ @ +\\/_/_ @ + /\\_\\@ + \\/_/@ + @ + @@ + @ + @ + __ @ +/\\_\\ @ +\\/_/_ @ + /\\ \\@ + \\ \\/@ + \\/ @ + @@ + ___ @ + / / @ + / / @ +/< < @ +\\ \`\\ \`\\ @ + \`\\ \`\\_|@ + \`\\// @ + @ + @@ + @ + _______ @ +/\\______\\ @ +\\/______/_ @ + /\\______\\@ + \\/______/@ + @ + @ + @@ + __ @ +/\\ \`\\ @ +\\ \`\\ \`\\ @ + \`\\ > >@ + / / @ + /\\_/ @ + \\// @ + @ + @@ + _ @ + /'_\`\\ @ +/\\_\\/\\\`\\@ +\\/_//'/'@ + /\\_\\ @ + \\/\\_\\@ + \\/_/@ + @ + @@ + @ + __ @ + /'_\`\\_ @ + /'/'_\` \\ @ +/\\ \\ \\L\\ \\ @ +\\ \\ \`\\__,_\\@ + \\ \`\\_____\\@ + \`\\/_____/@ + @@ + ______ @ +/\\ _ \\ @ +\\ \\ \\L\\ \\ @ + \\ \\ __ \\ @ + \\ \\ \\/\\ \\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\ \\ @ + \\ \\ _ <' @ + \\ \\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\/\\_\\ @ + \\ \\ \\/_/_ @ + \\ \\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\/\\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\_\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\_\\ @ + \\ \\ _\\L @ + \\ \\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\_\\@ + \\ \\ _\\/@ + \\ \\ \\/ @ + \\ \\_\\ @ + \\/_/ @ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\_\\ @ + \\ \\ \\L_L @ + \\ \\ \\/, \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\_\\ \\ @ + \\ \\ _ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + ______ @ +/\\__ _\\ @ +\\/_/\\ \\/ @ + \\ \\ \\ @ + \\_\\ \\__ @ + /\\_____\\@ + \\/_____/@ + @ + @@ + _____ @ +/\\___ \\ @ +\\/__/\\ \\ @ + _\\ \\ \\ @ + /\\ \\_\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\/'/' @ + \\ \\ , < @ + \\ \\ \\\\\`\\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + __ @ +/\\ \\ @ +\\ \\ \\ @ + \\ \\ \\ __ @ + \\ \\ \\L\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + @ + /'\\_/\`\\ @ +/\\ \\ @ +\\ \\ \\__\\ \\ @ + \\ \\ \\_/\\ \\ @ + \\ \\_\\\\ \\_\\@ + \\/_/ \\/_/@ + @ + @@ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \`\\\\ \\ @ + \\ \\ , \` \\ @ + \\ \\ \\\`\\ \\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + _____ @ +/\\ __\`\\ @ +\\ \\ \\/\\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\_\\ \\ @ + \\ \\_____\\@ + \\/_____/@ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\ \\@ + \\ \\ ,__/@ + \\ \\ \\/ @ + \\ \\_\\ @ + \\/_/ @ + @ + @@ + _____ @ +/\\ __\`\\ @ +\\ \\ \\/\\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\\\'\\\\ @ + \\ \\___\\_\\@ + \\/__//_/@ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\ \\L\\ \\ @ + \\ \\ , / @ + \\ \\ \\\\ \\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/ /@ + @ + @@ + ____ @ +/\\ _\`\\ @ +\\ \\,\\L\\_\\ @ + \\/_\\__ \\ @ + /\\ \\L\\ \\ @ + \\ \`\\____\\@ + \\/_____/@ + @ + @@ + ______ @ +/\\__ _\\ @ +\\/_/\\ \\/ @ + \\ \\ \\ @ + \\ \\ \\ @ + \\ \\_\\@ + \\/_/@ + @ + @@ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\ \\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\_\\ \\ @ + \\ \\_____\\@ + \\/_____/@ + @ + @@ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\ \\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\_/ \\@ + \\ \`\\___/@ + \`\\/__/ @ + @ + @@ + __ __ @ +/\\ \\ __/\\ \\ @ +\\ \\ \\/\\ \\ \\ \\ @ + \\ \\ \\ \\ \\ \\ \\ @ + \\ \\ \\_/ \\_\\ \\@ + \\ \`\\___x___/@ + '\\/__//__/ @ + @ + @@ + __ __ @ +/\\ \\ /\\ \\ @ +\\ \`\\\`\\/'/' @ + \`\\/ > < @ + \\/'/\\\`\\ @ + /\\_\\\\ \\_\\@ + \\/_/ \\/_/@ + @ + @@ + __ __ @ +/\\ \\ /\\ \\@ +\\ \`\\\`\\\\/'/@ + \`\\ \`\\ /' @ + \`\\ \\ \\ @ + \\ \\_\\@ + \\/_/@ + @ + @@ + ________ @ +/\\_____ \\ @ +\\/____//'/' @ + //'/' @ + //'/'___ @ + /\\_______\\@ + \\/_______/@ + @ + @@ + ____ @ +/\\ _\\ @ +\\ \\ \\/ @ + \\ \\ \\ @ + \\ \\ \\_ @ + \\ \\___\\@ + \\/___/@ + @ + @@ + __ @ +/\\ \`\\ @ +\\\`\\ \`\\ @ +\`\\\`\\ \`\\ @ + \`\\\`\\ \`\\ @ + \`\\\`\\__\\@ + \`\\/__/@ + @ + @@ + ____ @ +/\\__ \\ @ +\\/_/\\ \\ @ + \\ \\ \\ @ + \\_\\ \\ @ + /\\___\\@ + \\/___/@ + @ + @@ + __ @ + / \`\\ @ +/\\_/\\_\\ @ +\\//\\// $ @ + $ $ @ + $ $@ + @ + @ + @@ + @ + @ + @ + @ + @ +$ $ @ + $_______ @ + /\\______\\@ + \\/______/@@ + __ @ +/\\ \\ @ +\\ \\\\$ @ + \\// $ @ + $ $ @ + $ $@ + @ + @ + @@ + @ + @ + __ @ + /'__\`\\ @ +/\\ \\L\\.\\_ @ +\\ \\__/.\\_\\@ + \\/__/\\/_/@ + @ + @@ + __ @ +/\\ \\ @ +\\ \\ \\____ @ + \\ \\ '__\`\\ @ + \\ \\ \\L\\ \\@ + \\ \\_,__/@ + \\/___/ @ + @ + @@ + @ + @ + ___ @ + /'___\\ @ +/\\ \\__/ @ +\\ \\____\\@ + \\/____/@ + @ + @@ + __ @ + /\\ \\ @ + \\_\\ \\ @ + /'_\` \\ @ +/\\ \\L\\ \\ @ +\\ \\___,_\\@ + \\/__,_ /@ + @ + @@ + @ + @ + __ @ + /'__\`\\ @ +/\\ __/ @ +\\ \\____\\@ + \\/____/@ + @ + @@ + ___ @ + /'___\\ @ +/\\ \\__/ @ +\\ \\ ,__\\@ + \\ \\ \\_/@ + \\ \\_\\ @ + \\/_/ @ + @ + @@ + @ + @ + __ @ + /'_ \`\\ @ +/\\ \\L\\ \\ @ +\\ \\____ \\ @ + \\/___L\\ \\@ + /\\____/@ + \\_/__/ @@ + __ @ +/\\ \\ @ +\\ \\ \\___ @ + \\ \\ _ \`\\ @ + \\ \\ \\ \\ \\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + @ + __ @ +/\\_\\ @ +\\/\\ \\ @ + \\ \\ \\ @ + \\ \\_\\@ + \\/_/@ + @ + @@ + @ + __ @ +/\\_\\ @ +\\/\\ \\ @ + \\ \\ \\ @ + _\\ \\ \\ @ +/\\ \\_\\ \\@ +\\ \\____/@ + \\/___/ @@ + __ @ +/\\ \\ @ +\\ \\ \\/'\\ @ + \\ \\ , < @ + \\ \\ \\\\\`\\ @ + \\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + ___ @ +/\\_ \\ @ +\\//\\ \\ @ + \\ \\ \\ @ + \\_\\ \\_ @ + /\\____\\@ + \\/____/@ + @ + @@ + @ + @ + ___ ___ @ +/' __\` __\`\\ @ +/\\ \\/\\ \\/\\ \\ @ +\\ \\_\\ \\_\\ \\_\\@ + \\/_/\\/_/\\/_/@ + @ + @@ + @ + @ + ___ @ +/' _ \`\\ @ +/\\ \\/\\ \\ @ +\\ \\_\\ \\_\\@ + \\/_/\\/_/@ + @ + @@ + @ + @ + ___ @ + / __\`\\ @ +/\\ \\L\\ \\@ +\\ \\____/@ + \\/___/ @ + @ + @@ + @ + @ + _____ @ +/\\ '__\`\\ @ +\\ \\ \\L\\ \\@ + \\ \\ ,__/@ + \\ \\ \\/ @ + \\ \\_\\ @ + \\/_/ @@ + @ + @ + __ @ + /'__\`\\ @ +/\\ \\L\\ \\ @ +\\ \\___, \\ @ + \\/___/\\ \\ @ + \\ \\_\\@ + \\/_/@@ + @ + @ + _ __ @ +/\\\`'__\\@ +\\ \\ \\/ @ + \\ \\_\\ @ + \\/_/ @ + @ + @@ + @ + @ + ____ @ + /',__\\ @ +/\\__, \`\\@ +\\/\\____/@ + \\/___/ @ + @ + @@ + __ @ +/\\ \\__ @ +\\ \\ ,_\\ @ + \\ \\ \\/ @ + \\ \\ \\_ @ + \\ \\__\\@ + \\/__/@ + @ + @@ + @ + @ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\_\\ \\@ + \\ \\____/@ + \\/___/ @ + @ + @@ + @ + @ + __ __ @ +/\\ \\/\\ \\ @ +\\ \\ \\_/ |@ + \\ \\___/ @ + \\/__/ @ + @ + @@ + @ + @ + __ __ __ @ +/\\ \\/\\ \\/\\ \\ @ +\\ \\ \\_/ \\_/ \\@ + \\ \\___x___/'@ + \\/__//__/ @ + @ + @@ + @ + @ + __ _ @ +/\\ \\/'\\ @ +\\/> \\@ + /\\___/@ + \\/__/ @@ + @ + @ + ____ @ +/\\_ ,\`\\ @ +\\/_/ /_ @ + /\\____\\@ + \\/____/@ + @ + @@ + _ @ + /' \\@ + \\ ,/'@ + <' \\ @ +< \\ \`\\ @ + \\\`\\__\\@ + \\/__/@ + @ + @@ + __ @ +/\\ \\ @ +\\ \\ \\ @ + \\ \\ \\ @ + \\ \\ \\ @ + \\ \\ \\ @ + \\ \\ \\ @ + \\ \\_\\@ + \\/_/@@ + __ @ +/\\ \`\\ @ +\\\`\\ \\ @ + \\ \\ \`>@ + //' \\ @ +/\\__/' @ +\\/_/ @ + @ + @@ + _ _ @ + /' \\/' \\ @ +/\\_/\\__//$ @ +\\//\\/__/ $ @ + $ $@ + @ + @ + @ + @@ + __ __ @ +/\\_\\/\\_\\ @ +\\/\\ _ \\ @ + \\ \\ \\L\\ \\ @ + \\ \\ __ \\ @ + \\ \\_\\/\\_\\@ + \\/_/\\/_/@ + @ + @@ + __ __ @ +/\\_\\/\\_\\ @ +\\/\\ __ \\ @ + \\ \\ \\/\\ \\ @ + \\ \\ \\_\\ \\ @ + \\ \\_____\\@ + \\/_____/@ + @ + @@ + __ __ @ +/\\_\\/\\_\\ @ +\\/\\ \\/\\ \\ @ + \\ \\ \\ \\ \\ @ + \\ \\ \\_\\ \\ @ + \\ \\_____\\@ + \\/_____/@ + @ + @@ + __ __ @ +/\\_\\/\\_\\ @ +\\/_/\\/_/_ @ + /'_\` \\ @ + /\\ \\L\\ \\ @ + \\ \`\\__,_\\@ + \`\\/_,__/@ + @ + @@ + __ __ @ +/\\_\\/\\_\\ @ +\\/_/\\/_/ @ + /'_\`\\ @ + /\\ \\L\\ \\@ + \\ \`\\___/@ + \`\\/__/ @ + @ + @@ + __ __ @ +/\\_\\ \\_\\ @ +\\/_/\\/_/_ @ + /\\ \\/\\ \\ @ + \\ \\ \\_\\ \\@ + \\ \`\\___/@ + \`\\/__/ @ + @ + @@ + ______ @ +/\\ __ \\ @ +\\ \\ \\/\\ \\ @ + \\ \\ \\<_<_ @ + \\ \\ \\ \\ \\@ + \\ \\ \\\\_/@ + \\ \\_\\/ @ + \\/_/ @ + @@ +` diff --git a/batcher-bot/liquidity/package-lock.json b/batcher-bot/liquidity/package-lock.json new file mode 100644 index 00000000..779a6bf0 --- /dev/null +++ b/batcher-bot/liquidity/package-lock.json @@ -0,0 +1,3109 @@ +{ + "name": "batcher-liquidity-bot", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "batcher-liquidity-bot", + "version": "0.0.1", + "license": "ISC", + "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", + "@taquito/signer": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/tzip12": "^16.1.2", + "@taquito/tzip16": "^16.1.2", + "chalk": "^4.1.2", + "clear": "^0.1.0", + "commander": "^10.0.1", + "env-cmd": "^10.1.0", + "figlet": "^1.6.0", + "fs-extra": "^11.1.1", + "path": "^0.12.7", + "prelude-ts": "^1.0.6" + }, + "devDependencies": { + "@types/commander": "^2.12.2", + "@types/elliptic": "^6.4.14", + "@types/figlet": "^1.5.6", + "@types/node": "^20.1.3", + "nodemon": "^2.0.22", + "ts-node": "^10.9.1", + "typescript": "^5.0.4" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "dependencies": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", + "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@stablelib/binary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", + "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", + "dependencies": { + "@stablelib/int": "^1.0.1" + } + }, + "node_modules/@stablelib/blake2b": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", + "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/bytes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", + "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==" + }, + "node_modules/@stablelib/constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", + "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==" + }, + "node_modules/@stablelib/ed25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", + "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "dependencies": { + "@stablelib/random": "^1.0.2", + "@stablelib/sha512": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/hash": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" + }, + "node_modules/@stablelib/hmac": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hmac/-/hmac-1.0.1.tgz", + "integrity": "sha512-V2APD9NSnhVpV/QMYgCVMIYKiYG6LSqw1S65wxVoirhU/51ACio6D4yDVSwMzuTJXWZoVHbDdINioBwKy5kVmA==", + "dependencies": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/int": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" + }, + "node_modules/@stablelib/keyagreement": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", + "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", + "dependencies": { + "@stablelib/bytes": "^1.0.1" + } + }, + "node_modules/@stablelib/nacl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@stablelib/nacl/-/nacl-1.0.4.tgz", + "integrity": "sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw==", + "dependencies": { + "@stablelib/poly1305": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3", + "@stablelib/xsalsa20": "^1.0.2" + } + }, + "node_modules/@stablelib/pbkdf2": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/pbkdf2/-/pbkdf2-1.0.1.tgz", + "integrity": "sha512-d5jwK6jW1DkMyzqY8D1Io+fRXcsUVr95lk5LKX9ghaUdAITTc1ZL0bff+R0IrwSixbHluxhnivG7vDw59AZ/Nw==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/hmac": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/poly1305": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", + "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", + "dependencies": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/random": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", + "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/salsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/salsa20/-/salsa20-1.0.2.tgz", + "integrity": "sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/sha512": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", + "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/wipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" + }, + "node_modules/@stablelib/x25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", + "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", + "dependencies": { + "@stablelib/keyagreement": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/xsalsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz", + "integrity": "sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/salsa20": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@taquito/axios-fetch-adapter": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@taquito/axios-fetch-adapter/-/axios-fetch-adapter-0.3.1.tgz", + "integrity": "sha512-emPSsrYQumiUcZsDcTAP68gLJpKoJmbzwyy2D2h2/Zm3Q1TbAJJS1kbnwvQZfq0FjYyYCWYSITtAS3w0EUAG4g==", + "peerDependencies": { + "axios": ">=0.26.0" + } + }, + "node_modules/@taquito/http-utils": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-16.1.2.tgz", + "integrity": "sha512-02J9Q744ZEs0wbjBpm6NFzJCtjscuSOeQ3LaWfS1wx7XfMiNMLCOiWZt1RtjlIbcXKEYcOgvjfIy/A/tYl6cqQ==", + "dependencies": { + "@taquito/axios-fetch-adapter": "^0.3.1", + "axios": "^0.26.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/local-forging": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-16.1.2.tgz", + "integrity": "sha512-KSJMO7xo4mdM7cU2iTCNcWNn/vaABaCMXa2ONvb5TD0o3MHizqCP0M2rEfkP48eajlcBLF1RcOExSVWj+5+v/Q==", + "dependencies": { + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/michel-codec": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-16.1.2.tgz", + "integrity": "sha512-kpVpfFQo96SZhHHUQUq7lNvZM44CTJnBk2sN6pIIxMaQiLXHshkE0KTqSUl3ocp/7ssd/Q7v4MsW/NSt3dthJQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/michelson-encoder": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-16.1.2.tgz", + "integrity": "sha512-9gD4sgLgkuy4cTcp9eZ4DCasic3Ymi5BGCCVGXzNzzimbvdBPrMtDQMgBRu07mlTm9/4OENdDTuMk4QtIYfOqQ==", + "dependencies": { + "@taquito/rpc": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/rpc": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-16.1.2.tgz", + "integrity": "sha512-r2cwT3tnvofBtytDCP/P8G8i9gw2hgw73hiGhYw4CkYaRyVYcuBMwmr8soy/e3B8U2sHSsiyoUmBC9Z0AfkApQ==", + "dependencies": { + "@taquito/http-utils": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/signer": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-16.1.2.tgz", + "integrity": "sha512-0gh/Hbz86d4343sEefNDyMjR8jnxtjxvCRR3/aMIN+IvhJTNC1LCsNfENgGIHjLr2R68YbPDRq2wpyq6+z/8nA==", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/hmac": "^1.0.1", + "@stablelib/nacl": "^1.0.4", + "@stablelib/pbkdf2": "^1.0.1", + "@stablelib/sha512": "^1.0.1", + "@taquito/taquito": "^16.1.2", + "@taquito/utils": "^16.1.2", + "@types/bn.js": "^5.1.1", + "bip39": "^3.0.4", + "elliptic": "^6.5.4", + "pbkdf2": "^3.1.2", + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/taquito": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-16.1.2.tgz", + "integrity": "sha512-0yjQRIjr1ZcVzTQ9QvtwZl4QAH2jM21vXTCOcHLxEuxjk052vr4OuS3WI+lk7hACtJXfwlA9DZ3zyNt9WdKFHA==", + "hasInstallScript": true, + "dependencies": { + "@taquito/http-utils": "^16.1.2", + "@taquito/local-forging": "^16.1.2", + "@taquito/michel-codec": "^16.1.2", + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/rpc": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/tzip12": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/tzip12/-/tzip12-16.1.2.tgz", + "integrity": "sha512-6BcDrY7l7noxIioMUFb5nBYW+Q8AGG7JkrNeQACqNzroNm31yRva6SM5fypSX9xbEkimcOaxostcNFWvZ3U0EQ==", + "dependencies": { + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/tzip16": "^16.1.2" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/tzip16": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/tzip16/-/tzip16-16.1.2.tgz", + "integrity": "sha512-3wsCpusiMi4nXJtaH8O3nYgjrNzY2Xb8Ep6jVOmZCAQrSm7P5Rn6FZzYM9T69+QtAmAEDCAyOF2jzM7QF/hrlg==", + "dependencies": { + "@taquito/http-utils": "^16.1.2", + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/rpc": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "crypto-js": "^4.1.1" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/utils": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-16.1.2.tgz", + "integrity": "sha512-CIs/qu8aFzetuo4B6EuGMD1JN5F+fxj+RYYpg69gTunzGiq8hx3D8BpRqidK4esiiNtUu1UrGiI5k1fr8myezQ==", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.3", + "@types/bs58check": "^2.1.0", + "bignumber.js": "^9.1.0", + "blakejs": "^1.2.1", + "bs58check": "^2.1.2", + "buffer": "^6.0.3", + "elliptic": "^6.5.4", + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/bs58check": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.0.tgz", + "integrity": "sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/commander": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", + "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", + "deprecated": "This is a stub types definition for commander (https://github.com/tj/commander.js). commander provides its own type definitions, so you don't need @types/commander installed!", + "dev": true, + "dependencies": { + "commander": "*" + } + }, + "node_modules/@types/elliptic": { + "version": "6.4.14", + "resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.14.tgz", + "integrity": "sha512-z4OBcDAU0GVwDTuwJzQCiL6188QvZMkvoERgcVjq0/mPM8jCfdwZ3x5zQEVoL9WCAru3aG5wl3Z5Ww5wBWn7ZQ==", + "dev": true, + "dependencies": { + "@types/bn.js": "*" + } + }, + "node_modules/@types/figlet": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/@types/figlet/-/figlet-1.5.6.tgz", + "integrity": "sha512-AOdn9cKJGXpqfHeif16xeGMwWefB4nsOyxkdRMpc+PEP3nUxzu3psJfIqhjrCNW4Sejt5i6rISWmEwK0sw03mA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.1.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", + "integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==" + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bip39": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", + "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", + "dependencies": { + "@noble/hashes": "^1.2.0" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/clear": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/clear/-/clear-0.1.0.tgz", + "integrity": "sha512-qMjRnoL+JDPJHeLePZJuao6+8orzHMGP04A8CdwCNsKhRbOnKRjefxONR7bwILT3MHecxKBjHkKL/tkZ8r4Uzw==", + "engines": { + "node": "*" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "engines": { + "node": ">=14" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "dependencies": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + }, + "bin": { + "env-cmd": "bin/env-cmd.js" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/env-cmd/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "dependencies": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "node_modules/figlet": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.6.0.tgz", + "integrity": "sha512-31EQGhCEITv6+hi2ORRPyn3bulaV9Fl4xOdR169cBzH/n1UqcxsiSB/noo6SJdD7Kfb1Ljit+IgR1USvF/XbdA==", + "bin": { + "figlet": "bin/index.js" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs-extra/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash-base/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonfile/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "dependencies": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "dependencies": { + "semver": "~7.0.0" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/typedarray-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + } + }, + "@dipdup/tzkt-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dipdup/tzkt-api/-/tzkt-api-0.0.1.tgz", + "integrity": "sha512-d+2KSK+aumrKl21rccYOfU4gQMNWf2MNi/rQL2Ibp/JzlYfuGpsQH5HaA8kYtpquOgFXjTRhNO95RYj5trYw/g==" + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@microsoft/signalr": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz", + "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==", + "requires": { + "abort-controller": "^3.0.0", + "eventsource": "^2.0.2", + "fetch-cookie": "^2.0.3", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "@noble/hashes": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", + "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==" + }, + "@stablelib/binary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", + "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", + "requires": { + "@stablelib/int": "^1.0.1" + } + }, + "@stablelib/blake2b": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", + "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/bytes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", + "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==" + }, + "@stablelib/constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", + "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==" + }, + "@stablelib/ed25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", + "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "requires": { + "@stablelib/random": "^1.0.2", + "@stablelib/sha512": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/hash": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" + }, + "@stablelib/hmac": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hmac/-/hmac-1.0.1.tgz", + "integrity": "sha512-V2APD9NSnhVpV/QMYgCVMIYKiYG6LSqw1S65wxVoirhU/51ACio6D4yDVSwMzuTJXWZoVHbDdINioBwKy5kVmA==", + "requires": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/int": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" + }, + "@stablelib/keyagreement": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", + "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", + "requires": { + "@stablelib/bytes": "^1.0.1" + } + }, + "@stablelib/nacl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@stablelib/nacl/-/nacl-1.0.4.tgz", + "integrity": "sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw==", + "requires": { + "@stablelib/poly1305": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3", + "@stablelib/xsalsa20": "^1.0.2" + } + }, + "@stablelib/pbkdf2": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/pbkdf2/-/pbkdf2-1.0.1.tgz", + "integrity": "sha512-d5jwK6jW1DkMyzqY8D1Io+fRXcsUVr95lk5LKX9ghaUdAITTc1ZL0bff+R0IrwSixbHluxhnivG7vDw59AZ/Nw==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/hmac": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/poly1305": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", + "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", + "requires": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/random": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", + "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/salsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/salsa20/-/salsa20-1.0.2.tgz", + "integrity": "sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/sha512": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", + "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/wipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" + }, + "@stablelib/x25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", + "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", + "requires": { + "@stablelib/keyagreement": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "@stablelib/xsalsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz", + "integrity": "sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog==", + "requires": { + "@stablelib/binary": "^1.0.1", + "@stablelib/salsa20": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "@taquito/axios-fetch-adapter": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@taquito/axios-fetch-adapter/-/axios-fetch-adapter-0.3.1.tgz", + "integrity": "sha512-emPSsrYQumiUcZsDcTAP68gLJpKoJmbzwyy2D2h2/Zm3Q1TbAJJS1kbnwvQZfq0FjYyYCWYSITtAS3w0EUAG4g==", + "requires": {} + }, + "@taquito/http-utils": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-16.1.2.tgz", + "integrity": "sha512-02J9Q744ZEs0wbjBpm6NFzJCtjscuSOeQ3LaWfS1wx7XfMiNMLCOiWZt1RtjlIbcXKEYcOgvjfIy/A/tYl6cqQ==", + "requires": { + "@taquito/axios-fetch-adapter": "^0.3.1", + "axios": "^0.26.0" + } + }, + "@taquito/local-forging": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-16.1.2.tgz", + "integrity": "sha512-KSJMO7xo4mdM7cU2iTCNcWNn/vaABaCMXa2ONvb5TD0o3MHizqCP0M2rEfkP48eajlcBLF1RcOExSVWj+5+v/Q==", + "requires": { + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0" + } + }, + "@taquito/michel-codec": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-16.1.2.tgz", + "integrity": "sha512-kpVpfFQo96SZhHHUQUq7lNvZM44CTJnBk2sN6pIIxMaQiLXHshkE0KTqSUl3ocp/7ssd/Q7v4MsW/NSt3dthJQ==" + }, + "@taquito/michelson-encoder": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-16.1.2.tgz", + "integrity": "sha512-9gD4sgLgkuy4cTcp9eZ4DCasic3Ymi5BGCCVGXzNzzimbvdBPrMtDQMgBRu07mlTm9/4OENdDTuMk4QtIYfOqQ==", + "requires": { + "@taquito/rpc": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "fast-json-stable-stringify": "^2.1.0" + } + }, + "@taquito/rpc": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-16.1.2.tgz", + "integrity": "sha512-r2cwT3tnvofBtytDCP/P8G8i9gw2hgw73hiGhYw4CkYaRyVYcuBMwmr8soy/e3B8U2sHSsiyoUmBC9Z0AfkApQ==", + "requires": { + "@taquito/http-utils": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0" + } + }, + "@taquito/signer": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-16.1.2.tgz", + "integrity": "sha512-0gh/Hbz86d4343sEefNDyMjR8jnxtjxvCRR3/aMIN+IvhJTNC1LCsNfENgGIHjLr2R68YbPDRq2wpyq6+z/8nA==", + "requires": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/hmac": "^1.0.1", + "@stablelib/nacl": "^1.0.4", + "@stablelib/pbkdf2": "^1.0.1", + "@stablelib/sha512": "^1.0.1", + "@taquito/taquito": "^16.1.2", + "@taquito/utils": "^16.1.2", + "@types/bn.js": "^5.1.1", + "bip39": "^3.0.4", + "elliptic": "^6.5.4", + "pbkdf2": "^3.1.2", + "typedarray-to-buffer": "^4.0.0" + } + }, + "@taquito/taquito": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-16.1.2.tgz", + "integrity": "sha512-0yjQRIjr1ZcVzTQ9QvtwZl4QAH2jM21vXTCOcHLxEuxjk052vr4OuS3WI+lk7hACtJXfwlA9DZ3zyNt9WdKFHA==", + "requires": { + "@taquito/http-utils": "^16.1.2", + "@taquito/local-forging": "^16.1.2", + "@taquito/michel-codec": "^16.1.2", + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/rpc": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "rxjs": "^6.6.3" + } + }, + "@taquito/tzip12": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/tzip12/-/tzip12-16.1.2.tgz", + "integrity": "sha512-6BcDrY7l7noxIioMUFb5nBYW+Q8AGG7JkrNeQACqNzroNm31yRva6SM5fypSX9xbEkimcOaxostcNFWvZ3U0EQ==", + "requires": { + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/tzip16": "^16.1.2" + } + }, + "@taquito/tzip16": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/tzip16/-/tzip16-16.1.2.tgz", + "integrity": "sha512-3wsCpusiMi4nXJtaH8O3nYgjrNzY2Xb8Ep6jVOmZCAQrSm7P5Rn6FZzYM9T69+QtAmAEDCAyOF2jzM7QF/hrlg==", + "requires": { + "@taquito/http-utils": "^16.1.2", + "@taquito/michelson-encoder": "^16.1.2", + "@taquito/rpc": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/utils": "^16.1.2", + "bignumber.js": "^9.1.0", + "crypto-js": "^4.1.1" + } + }, + "@taquito/utils": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-16.1.2.tgz", + "integrity": "sha512-CIs/qu8aFzetuo4B6EuGMD1JN5F+fxj+RYYpg69gTunzGiq8hx3D8BpRqidK4esiiNtUu1UrGiI5k1fr8myezQ==", + "requires": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.3", + "@types/bs58check": "^2.1.0", + "bignumber.js": "^9.1.0", + "blakejs": "^1.2.1", + "bs58check": "^2.1.2", + "buffer": "^6.0.3", + "elliptic": "^6.5.4", + "typedarray-to-buffer": "^4.0.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "requires": { + "@types/node": "*" + } + }, + "@types/bs58check": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.0.tgz", + "integrity": "sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/commander": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", + "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", + "dev": true, + "requires": { + "commander": "*" + } + }, + "@types/elliptic": { + "version": "6.4.14", + "resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.14.tgz", + "integrity": "sha512-z4OBcDAU0GVwDTuwJzQCiL6188QvZMkvoERgcVjq0/mPM8jCfdwZ3x5zQEVoL9WCAru3aG5wl3Z5Ww5wBWn7ZQ==", + "dev": true, + "requires": { + "@types/bn.js": "*" + } + }, + "@types/figlet": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/@types/figlet/-/figlet-1.5.6.tgz", + "integrity": "sha512-AOdn9cKJGXpqfHeif16xeGMwWefB4nsOyxkdRMpc+PEP3nUxzu3psJfIqhjrCNW4Sejt5i6rISWmEwK0sw03mA==", + "dev": true + }, + "@types/node": { + "version": "20.1.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", + "integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==" + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "bip39": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", + "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", + "requires": { + "@noble/hashes": "^1.2.0" + } + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "clear": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/clear/-/clear-0.1.0.tgz", + "integrity": "sha512-qMjRnoL+JDPJHeLePZJuao6+8orzHMGP04A8CdwCNsKhRbOnKRjefxONR7bwILT3MHecxKBjHkKL/tkZ8r4Uzw==" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } + } + }, + "env-cmd": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz", + "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==", + "requires": { + "commander": "^4.0.0", + "cross-spawn": "^7.0.0" + }, + "dependencies": { + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + } + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fetch-cookie": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz", + "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==", + "requires": { + "set-cookie-parser": "^2.4.8", + "tough-cookie": "^4.0.0" + } + }, + "figlet": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.6.0.tgz", + "integrity": "sha512-31EQGhCEITv6+hi2ORRPyn3bulaV9Fl4xOdR169cBzH/n1UqcxsiSB/noo6SJdD7Kfb1Ljit+IgR1USvF/XbdA==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "hamt_plus": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz", + "integrity": "sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, + "list": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/list/-/list-2.0.19.tgz", + "integrity": "sha512-nnVaRp4RaMAQkCpypTThsdxKqgPMiSwJq93eAm2/IbpUa8sd04XKBhkKu+bMk63HmdjK8b8Cuh4xARHWX2ye/Q==" + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prelude-ts": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/prelude-ts/-/prelude-ts-1.0.6.tgz", + "integrity": "sha512-AESHLCJ7psPqtj69LEJlZ2ENTnYeI2IJyxpWz459Ag556O/4u41JLOK11ZHTsMeUrRJQ+xWA6ulw/hGycXgEkA==", + "requires": { + "hamt_plus": "1.0.2", + "list": "2.0.19" + } + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "requires": { + "semver": "~7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } + }, + "tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "typedarray-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==" + }, + "typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true + }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + } + } +} diff --git a/batcher-bot/liquidity/package.json b/batcher-bot/liquidity/package.json new file mode 100644 index 00000000..4e274efa --- /dev/null +++ b/batcher-bot/liquidity/package.json @@ -0,0 +1,41 @@ +{ + "name": "batcher-liquidity-bot", + "version": "0.0.1", + "description": "Just in time and always on liquidity bot for the Batcher DEX", + "main": "index.js", + "scripts": { + "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts", + "create": "npm run build", + "build": "rm -rf ./dist && tsc -p .", + "package": "npm prune --production && cp README.md dist/ && cp src/liquidity-config-* dist/ && cp -rf node_modules dist/", + "local": "sudo npm i -g && npm run start", + "refresh": "rm -rf ./node_modules ./package-lock.json && npm install" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@dipdup/tzkt-api": "^0.0.1", + "@microsoft/signalr": "^7.0.5", + "@taquito/signer": "^16.1.2", + "@taquito/taquito": "^16.1.2", + "@taquito/tzip12": "^16.1.2", + "@taquito/tzip16": "^16.1.2", + "chalk": "^4.1.2", + "clear": "^0.1.0", + "commander": "^10.0.1", + "env-cmd": "^10.1.0", + "figlet": "^1.6.0", + "fs-extra": "^11.1.1", + "path": "^0.12.7", + "prelude-ts": "^1.0.6" + }, + "devDependencies": { + "@types/commander": "^2.12.2", + "@types/elliptic": "^6.4.14", + "@types/figlet": "^1.5.6", + "@types/node": "^20.1.3", + "nodemon": "^2.0.22", + "ts-node": "^10.9.1", + "typescript": "^5.0.4" + } +} diff --git a/batcher-bot/liquidity/src/bot.ts b/batcher-bot/liquidity/src/bot.ts new file mode 100644 index 00000000..b063d7cb --- /dev/null +++ b/batcher-bot/liquidity/src/bot.ts @@ -0,0 +1,229 @@ +import { HubConnection } from "@microsoft/signalr"; +import { + contract_details, + liquidity_settings, + batch_provision, + token_pair, +} from "./types"; +import { parse_deposit } from "./utils"; +import { submit_deposit, submit_redemption } from "./submitter"; +import { can_provision_always_on, can_provision_jit } from "./provision"; +import { TezosToolkit } from "@taquito/taquito"; + +const redeem_on_cleared = ( + batcher_contract: string, + msg: any, + tezos: TezosToolkit +) => { + for (let i = 0; i < Object.keys(msg.data).length; i++) { + try { + const message = msg.data[i]; + if (message.path == "batch_set.batches") { + const val = message.content.value; + const batch_number = val.batch_number; + const status = Object.keys(val.status)[0]; + if (status == "cleared") { + console.info(`Batch ${batch_number} was cleared. Redeeming `); + submit_redemption(batcher_contract, tezos).then(() => { + console.info(`Redeemed holdings `); + }); + } + } + } catch (error: any) { + console.info("Error parsing bigmap for redemption", error); + console.error(error); + } + } +}; +const getPairName = (fromName: string, toName: string) => { + if (fromName > toName) { + return fromName + "/" + toName; + } + + return toName + "/" + fromName; +}; + +const parse_status = (status:any) => { + + try{ + if ('cleared' in status){ + return `cleared @ ${status.cleared.at}`; + } + + if ('closed' in status){ + return `closed @ ${status.closed.closing_time}`; + } + return `opened @ ${status.open}`; + } catch (error:any) + { + console.info("Error parsing status"); + console.error(error); + } + + +} + +const always_on_provision = ( + tezos: TezosToolkit, + message: any, + details: contract_details, + settings: liquidity_settings +) => { + for (let i = 0; i < Object.keys(message.data).length; i++) { + try { + const msg = message.data[i]; + if (msg.path == "batch_set.batches") { + const val = msg.content.value; + const batch_number = val.batch_number; + const status = Object.keys(val.status)[0]; + const raw_pair = val.pair; + const pair: string = getPairName(raw_pair.name_0, raw_pair.name_1); + const parsed_status = parse_status(val.status); + console.info("Batch change",`${batch_number} ${pair} was ${parsed_status}`); + if (status == "open") { + if (settings.token_pairs.has(pair)) { + const setting = settings.token_pairs.get(pair); + if (setting) { + console.info( + `Batch ${batch_number} is open. Provisioning liquidity` + ); + let buy_token = { + token_id: raw_pair.token_id_0, + name: raw_pair.name_0, + decimals: raw_pair.decimals_0, + standard: raw_pair.standard_0, + address: raw_pair.address_0, + }; + let sell_token = { + token_id: raw_pair.token_id_1, + name: raw_pair.name_1, + decimals: raw_pair.decimals_1, + standard: raw_pair.standard_1, + address: raw_pair.address_1, + }; + + const order_list_opt = can_provision_always_on( + batch_number, + setting, + buy_token, + sell_token, + details + ); + + if (order_list_opt.isSome()) { + const ords = order_list_opt.get(); + for (let j = 0; j < ords.length; j++) { + let ord = ords[i]; + console.info("Provisioning -> ", ord); + submit_deposit(details, ord, tezos).then(() => { + console.info("Provisioned order."); + }); + } + } + } + } + } + } + } catch (error: any) { + console.error(error); + } + } +}; + +const jit_provision = ( + tezos: TezosToolkit, + message: any, + details: contract_details, + settings: liquidity_settings +) => { + for (let i = 0; i < Object.keys(message.data).length; i++) { + try { + const msg = message.data[i]; + if (msg.parameter) { + const entrypoint = msg.parameter.entrypoint; + const sender = msg.sender.address; + if (entrypoint == "deposit" && sender != details.user_address) { + console.info("Deposit msg", msg); + const val = msg.parameter.value; + const pair: string = getPairName( + val.swap.from.token.name, + val.swap.to.name + ); + + const current_batch_indices = + msg.storage.batch_set.current_batch_indices; + const batch_number = current_batch_indices[pair]; + + if (settings.token_pairs.has(pair)) { + const jit_setting = settings.token_pairs.get(pair); + if (jit_setting) { + const order = parse_deposit(val); + const order_opt = can_provision_jit( + batch_number, + jit_setting, + order + ); + if (order_opt.isSome()) { + const ord = order_opt.get(); + console.info("Provisioning -> ", JSON.stringify(ord)); + submit_deposit(details, ord, tezos).then(() => { + console.info("Provisioned order."); + }); + } + } + } + } + } + } catch (error: any) { + console.error(error); + } + } +}; + +export const run_jit = async ( + tezos: TezosToolkit, + details: contract_details, + settings: liquidity_settings, + socket_connection: HubConnection +) => { + await socket_connection.start(); + + socket_connection.on("operations", (msg: any) => { + if (!msg.data) return; + jit_provision(tezos, msg, details, settings); + }); + + socket_connection.on("bigmaps", (msg: any) => { + if (!msg.data) return; + redeem_on_cleared(details.address, msg, tezos); + }); + + await socket_connection.invoke("SubscribeToOperations", { + address: details.address, + types: "transaction", + }); + + await socket_connection.invoke("SubscribeToBigMaps", { + contract: details.address, + }); + +}; + +export const run_always_on = async ( + tezos: TezosToolkit, + details: contract_details, + settings: liquidity_settings, + socket_connection: HubConnection +) => { + await socket_connection.start(); + + await socket_connection.invoke("SubscribeToBigMaps", { + contract: details.address, + }); + + socket_connection.on("bigmaps", (msg: any) => { + if (!msg.data) return; + always_on_provision(tezos, msg, details, settings); + redeem_on_cleared(details.address, msg, tezos); + }); +}; diff --git a/batcher-bot/liquidity/src/index.ts b/batcher-bot/liquidity/src/index.ts new file mode 100644 index 00000000..64c35d4b --- /dev/null +++ b/batcher-bot/liquidity/src/index.ts @@ -0,0 +1,84 @@ +#!/usr/bin/env node +import { TezosToolkit } from "@taquito/taquito"; +import { InMemorySigner } from "@taquito/signer"; +import { run_jit, run_always_on } from "./bot"; +import { contract_details, liquidity_settings } from "./types"; +import { load_settings } from "./settings"; +import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; +import { get_contract_detail_from_storage, echo_terminal } from "./utils"; +import { Option } from "prelude-ts"; +const clear = require("clear"); +const { Command } = require("commander"); +const cli = new Command(); + +clear(); + +echo_terminal("Batcher Bot", Option.none()); + +const get_connection = (uri: string): HubConnection => { + return new HubConnectionBuilder().withUrl(uri + "/v1/ws").build(); +}; +const preload = async ( + tezos: TezosToolkit, + settings: liquidity_settings +): Promise => { + const contract_uri: string = `${settings.tzkt_uri_api}/v1/contracts/${settings.batcher_address}/storage`; + console.info("contract_uri", contract_uri); + const priv_key = process.env["TEZOS_PRIV_KEY"]; + if(!priv_key){ + throw new Error("A Tezos private key is required to run the liquidity bot"); + } + tezos.setProvider({ + signer: await InMemorySigner.fromSecretKey(priv_key), + }); + + const user_address = await tezos.signer.publicKeyHash(); + return fetch(contract_uri) + .then((response) => response.json()) + .then((json) => { + return get_contract_detail_from_storage( + user_address, + settings.batcher_address, + json + ); + }); +}; + +cli + .name("batcher-liquidity-bot") + .version("0.0.1") + .description("Batcher Liquidity Bot CLI"); + +cli + .command("jit") + .description("Run Jit liquidity for Batcher") + .argument("", "Path to settings file") + .action((p: string) => { + const sett = load_settings(p); + const socket_connection = get_connection(sett.tzkt_uri_api); + const Tezos = new TezosToolkit(sett.tezos_node_uri); + preload(Tezos, sett).then((contract_config: contract_details) => { + echo_terminal("Just-In-Time-Liquidity", Option.of("Mnemonic")); + run_jit(Tezos, contract_config, sett, socket_connection); + }); + }); + +cli + .command("always-on") + .description("Run always-on liquidity for Batcher") + .argument("", "Path to settings file") + .action((p: string) => { + const sett = load_settings(p); + const socket_connection = get_connection(sett.tzkt_uri_api); + const Tezos = new TezosToolkit(sett.tezos_node_uri); + preload(Tezos, sett).then((contract_config: contract_details) => { + echo_terminal("Always-On-Liquidity", Option.of("Mnemonic")); + run_always_on(Tezos, contract_config, sett, socket_connection); + }); + }); + +cli.parse(process.argv); + +if (!process.argv.slice(2).length) { + cli.outputHelp(); +} diff --git a/batcher-bot/liquidity/src/liquidity-config-example-ghostnet.json b/batcher-bot/liquidity/src/liquidity-config-example-ghostnet.json new file mode 100644 index 00000000..ec9db860 --- /dev/null +++ b/batcher-bot/liquidity/src/liquidity-config-example-ghostnet.json @@ -0,0 +1,25 @@ +{ + "batcher_address": "KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1", + "tezos_node_uri": "https://ghostnet.tezos.marigold.dev", + "tzkt_uri_api": "https://api.ghostnet.tzkt.io", + "token_pairs": [ + { + "name": "tzBTC/USDT", + "side": "both", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "worse", + "sell_limit_per_batch": 200, + "sell_tolerance": "oracle" + }, + { + "name": "tzBTC/EURL", + "side": "either", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "oracle", + "sell_limit_per_batch": 220, + "sell_tolerance": "better" + } + ] + + +} diff --git a/batcher-bot/liquidity/src/liquidity-config-example-mainnet.json b/batcher-bot/liquidity/src/liquidity-config-example-mainnet.json new file mode 100644 index 00000000..e868eb5e --- /dev/null +++ b/batcher-bot/liquidity/src/liquidity-config-example-mainnet.json @@ -0,0 +1,15 @@ +{ + "batcher_address": "KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1", + "tezos_node_uri": "https://ghostnet.tezos.marigold.dev", + "tzkt_uri_api": "https://api.ghostnet.tzkt.io", + "token_pairs": [ + { + "name": "tzBTC/USDT", + "side": "both", + "buy_limit_per_batch": 0.02, + "buy_tolerance": "oracle", + "sell_limit_per_batch": 200, + "sell_tolerance": "oracle" + } + ] +} diff --git a/batcher-bot/liquidity/src/provision.ts b/batcher-bot/liquidity/src/provision.ts new file mode 100644 index 00000000..f5dff39d --- /dev/null +++ b/batcher-bot/liquidity/src/provision.ts @@ -0,0 +1,240 @@ +import { + batch_provision, + order, + token_pair, + contract_details, + token, +} from "./types"; +import { Option } from "prelude-ts"; + +const provision = new Map(); + +const parse_tolerance = (side: number, tol: string): number => { + if (side == 0) { + if (tol == "worse") { + return 0; + } + + if (tol == "better") { + return 2; + } + + return 1; + } else { + if (tol == "worse") { + return 2; + } + + if (tol == "better") { + return 0; + } + + return 1; + } +}; + +const provision_sell = ( + batch_number: number, + token_pair: token_pair, + order: order +): Option => { + let existing_buy_provision = 0; + let existing_sell_provision = 0; + + const existing_provision = provision.get(batch_number); + try { + if (existing_provision) { + existing_buy_provision = existing_provision.buy_side_provision; + existing_sell_provision = existing_provision.sell_side_provision; + } + } catch {} + + if (token_pair.side == "either" && existing_buy_provision > 0) { + return Option.none(); + } + + const upper_provision_bound = token_pair.sell_limit_per_batch; + const remaining = upper_provision_bound - existing_sell_provision; + + if (remaining <= 0) { + return Option.none(); + } + + const sell_decimals = order.swap.to.decimals; + const scaled_amount = remaining * 10 ** sell_decimals; + + const prov_order: order = { + swap: { + from: { + token: order.swap.to, + amount: scaled_amount, + }, + to: order.swap.from.token, + }, + side: 1, + tolerance: parse_tolerance(1, token_pair.sell_tolerance), + }; + const updated_provision: batch_provision = { + batch_number: batch_number, + buy_side_provision: existing_buy_provision, + sell_side_provision: existing_sell_provision + remaining, + }; + + provision.set(batch_number, updated_provision); + + return Option.of(prov_order); +}; + +const provision_buy = ( + batch_number: number, + token_pair: token_pair, + order: order +): Option => { + let existing_buy_provision = 0; + let existing_sell_provision = 0; + + const existing_provision = provision.get(batch_number); + try { + if (existing_provision) { + existing_buy_provision = existing_provision.buy_side_provision; + existing_sell_provision = existing_provision.sell_side_provision; + } + } catch {} + + if (token_pair.side == "either" && existing_sell_provision > 0) { + return Option.none(); + } + + const upper_provision_bound = token_pair.buy_limit_per_batch; + const remaining = upper_provision_bound - existing_buy_provision; + + if (remaining <= 0) { + return Option.none(); + } + + const buy_decimals = order.swap.to.decimals; + const scaled_amount = remaining * 10 ** buy_decimals; + + let prov_order: order = { + swap: { + from: { + token: order.swap.to, + amount: scaled_amount, + }, + to: order.swap.from.token, + }, + side: 0, + tolerance: parse_tolerance(0, token_pair.sell_tolerance), + }; + const updated_provision: batch_provision = { + batch_number: batch_number, + buy_side_provision: existing_buy_provision + remaining, + sell_side_provision: existing_sell_provision, + }; + + provision.set(batch_number, updated_provision); + + return Option.of(prov_order); +}; + +export const can_provision_always_on = ( + batch_number: number, + token_pair: token_pair, + buy_token: token, + sell_token: token, + details: contract_details +): Option> => { + let orders = new Array(); + const s = token_pair.side; + + try { + const already_provisioned = provision.has(batch_number) + console.info("Already provisioned", already_provisioned); + if(!already_provisioned) { + + let updated_provision: batch_provision = { + batch_number: batch_number, + buy_side_provision: 0, + sell_side_provision: 0, + }; + + + const buy_decimals = buy_token.decimals; + const buy_scaled_amount = + token_pair.buy_limit_per_batch * 10 ** buy_decimals; + + const buy_order = { + swap: { + from: { + token: buy_token, + amount: buy_scaled_amount, + }, + to: sell_token, + }, + side: 0, + tolerance: parse_tolerance(0, token_pair.buy_tolerance), + }; + + let sell_decimals = sell_token.decimals; + let sell_scaled_amount = + token_pair.sell_limit_per_batch * 10 ** sell_decimals; + + const sell_order = { + swap: { + from: { + token: sell_token, + amount: sell_scaled_amount, + }, + to: buy_token, + }, + side: 1, + tolerance: parse_tolerance(1, token_pair.buy_tolerance), + }; + + if ((s == "sell")) { + orders.push(sell_order); + updated_provision = { ...updated_provision, sell_side_provision: token_pair.sell_limit_per_batch } + } + if ((s == "buy")) { + orders.push(buy_order); + updated_provision = { ...updated_provision, buy_side_provision: token_pair.buy_limit_per_batch } + } + if ((s == "both")) { + orders.push(buy_order); + orders.push(sell_order); + updated_provision = { ...updated_provision, sell_side_provision: token_pair.sell_limit_per_batch, buy_side_provision: token_pair.buy_limit_per_batch } + } + provision.set(batch_number, updated_provision); + } + } catch (error: any) { + console.error(error); + } + + if (orders.length > 0) { + return Option.of(orders); + } else { + return Option.none(); + } +}; + +export const can_provision_jit = ( + batch_number: number, + token_pair: token_pair, + order: order +): Option => { + const s = token_pair.side; + + if (order.side == 0) { + if (s == "both" || s == "either" || s == "sell") { + return provision_sell(batch_number, token_pair, order); + } + } + + if (order.side == 1) { + if (s == "both" || s == "either" || s == "buy") { + return provision_buy(batch_number, token_pair, order); + } + } + + return Option.none(); +}; diff --git a/batcher-bot/liquidity/src/settings.ts b/batcher-bot/liquidity/src/settings.ts new file mode 100644 index 00000000..c002716c --- /dev/null +++ b/batcher-bot/liquidity/src/settings.ts @@ -0,0 +1,36 @@ +import { liquidity_settings } from "./types"; + +const path = require("path"); +const fs = require("fs-extra"); + +export const load_settings = (settings_path: string): liquidity_settings => { + let resolved_path = path.parse(settings_path); + if (!path.isAbsolute(settings_path)) { + resolved_path = path.join(path.dirname(__filename), settings_path); + } + resolved_path = path.normalize(resolved_path); + const settings = fs.readJsonSync(resolved_path); + + const tpm = new Map(); + + for (let i = 0; i < Object.keys(settings.token_pairs).length; i++) { + const tp = settings.token_pairs[i]; + const tsett = { + name: tp.name, + side: tp.side, + buy_limit_per_batch: tp.buy_limit_per_batch, + buy_tolerance: tp.buy_tolerance, + sell_limit_per_batch: tp.sell_limit_per_batch, + sell_tolerance: tp.sell_tolerance, + }; + tpm.set(tp.name, tsett); + } + console.info("Liquidity Settings", tpm); + + return { + batcher_address: settings.batcher_address, + tezos_node_uri: settings.tezos_node_uri, + tzkt_uri_api: settings.tzkt_uri_api, + token_pairs: tpm, + }; +}; diff --git a/batcher-bot/liquidity/src/submitter.ts b/batcher-bot/liquidity/src/submitter.ts new file mode 100644 index 00000000..d574f2f5 --- /dev/null +++ b/batcher-bot/liquidity/src/submitter.ts @@ -0,0 +1,172 @@ +import { + compose, + OpKind, + TezosToolkit, + WalletContract, +} from "@taquito/taquito"; +import { contract_details, order, token } from "./types"; +import { tzip12 } from "@taquito/tzip12"; +import { tzip16 } from "@taquito/tzip16"; + +export async function submit_fa2_deposit( + user_address: string, + batcher_contract: string, + order: order, + tezos: TezosToolkit, + swap_params: any +) { + let token_address = order.swap.from.token.address; + let token_id: number = order.swap.from.token.token_id; + if (token_address) { + const fa2_add_operator_params = [ + { + add_operator: { + owner: user_address, + operator: batcher_contract, + token_id: token_id, + }, + }, + ]; + + const fa2_remove_operator_params = [ + { + remove_operator: { + owner: user_address, + operator: batcher_contract, + token_id: token_id, + }, + }, + ]; + try { + const batcherContract = await tezos.wallet.at(batcher_contract); + const tokenfa2Contract: WalletContract = await tezos.wallet.at( + token_address, + compose(tzip12, tzip16) + ); + const deposit_op = await tezos.wallet + .batch([ + { + kind: OpKind.TRANSACTION, + ...tokenfa2Contract.methods + .update_operators(fa2_add_operator_params) + .toTransferParams(), + }, + { + kind: OpKind.TRANSACTION, + ...batcherContract.methodsObject + .deposit(swap_params) + .toTransferParams(), + to: batcher_contract, + amount: 10000, + mutez: true, + }, + { + kind: OpKind.TRANSACTION, + ...tokenfa2Contract.methods + .update_operators(fa2_remove_operator_params) + .toTransferParams(), + }, + ]) + .send(); + + await deposit_op.confirmation(); + } catch (error: any) { + console.error(error); + } + } else { + throw new Error("No valid token address for fa12 token"); + } +} + +export async function submit_fa12_deposit( + batcher_contract: string, + order: order, + tezos: TezosToolkit, + swap_params: any +) { + let token_address = order.swap.from.token.address; + let amount = order.swap.from.amount; + if (token_address) { + try { + const batcherContract = await tezos.wallet.at(batcher_contract); + const tokenfa12Contract: WalletContract = await tezos.wallet.at( + token_address, + compose(tzip12, tzip16) + ); + const deposit_op = await tezos.wallet + .batch([ + { + kind: OpKind.TRANSACTION, + ...tokenfa12Contract.methods + .approve(batcher_contract, amount) + .toTransferParams(), + }, + { + kind: OpKind.TRANSACTION, + ...batcherContract.methodsObject + .deposit(swap_params) + .toTransferParams(), + to: batcher_contract, + amount: 10000, + mutez: true, + }, + ]) + .send(); + const confirmation = await deposit_op.confirmation(); + } catch (error: any) { + console.error(error); + } + } else { + throw new Error("No valid token address for fa12 token"); + } +} + +export async function submit_deposit( + contract_details: contract_details, + order: order, + tezos: TezosToolkit +) { + let fromToken: token = order.swap.from.token; + let user_address = contract_details.user_address; + let batcher_address = contract_details.address; + if (fromToken.standard) { + const swap_params = { + swap: order.swap, + created_at: Math.floor(Date.now() / 1000), + side: order.side, + tolerance: order.tolerance, + }; + + if (fromToken.standard == "FA2 token") { + return await submit_fa2_deposit( + user_address, + batcher_address, + order, + tezos, + swap_params + ); + } else { + return await submit_fa12_deposit( + batcher_address, + order, + tezos, + swap_params + ); + } + } +} + +export async function submit_redemption( + batcher_contract: string, + tezos: TezosToolkit +) { + try { + const batcher = await tezos.contract.at(batcher_contract); + const redeemOp = batcher.methods.redeem(); + const op = await redeemOp.send(); + await op.confirmation(); + console.log("Successfully redeemed!"); + } catch (error: any) { + console.error(error); + } +} diff --git a/batcher-bot/liquidity/src/types.ts b/batcher-bot/liquidity/src/types.ts new file mode 100644 index 00000000..96751c99 --- /dev/null +++ b/batcher-bot/liquidity/src/types.ts @@ -0,0 +1,54 @@ +import { Option, None } from "prelude-ts"; +export type liquidity_type = "jit" | "alwayson"; + +export type token_pair = { + name: string; + side: string; + buy_limit_per_batch: number; + buy_tolerance: string; + sell_limit_per_batch: number; + sell_tolerance: string; +}; + +export type liquidity_settings = { + batcher_address: string; + tezos_node_uri: string; + tzkt_uri_api: string; + token_pairs: Map; +}; + +export type token = { + token_id: number; + name: string; + address: string; + decimals: number; + standard: string; +}; + +export type token_amount = { + token: token; + amount: number; +}; + +export type swap = { + from: token_amount; + to: token; +}; + +export type contract_details = { + user_address: string; + address: string; + valid_tokens: Map; +}; + +export type batch_provision = { + batch_number: number; + buy_side_provision: number; + sell_side_provision: number; +}; + +export type order = { + side: number; + tolerance: number; + swap: swap; +}; diff --git a/batcher-bot/liquidity/src/utils.ts b/batcher-bot/liquidity/src/utils.ts new file mode 100644 index 00000000..e84a49fb --- /dev/null +++ b/batcher-bot/liquidity/src/utils.ts @@ -0,0 +1,75 @@ +import { token, swap, contract_details, order } from "./types"; +import { Option, None } from "prelude-ts"; +const chalk = require("chalk"); +const figlet = require("figlet"); + +export const echo_terminal = (msg: string, font: Option) => { + let font_to_use = "Larry 3D"; + if (font.isSome()) { + font_to_use = font.get(); + } + console.log( + chalk.bold.bgBlack.redBright( + figlet.textSync(msg, { + horizontalLayout: "fitted", + verticalLayout: "fitted", + font: font_to_use, + }) + ) + ); +}; + +export const parse_token = (jt: any): token => { + return { + token_id: jt.token_id, + name: jt.name, + address: jt.address, + decimals: jt.decimals, + standard: jt.standard, + }; +}; + +export const parse_tokens_from_storage = (storage: any): Map => { + const map = new Map(); + if (storage.valid_tokens) { + let vt = storage.valid_tokens; + Object.keys(vt).forEach(key => { + let token = parse_token(vt[key]); + map.set(key, token); + }); + } + return map; +}; + +export const get_contract_detail_from_storage = ( + user_address: string, + address: string, + storage: any +): contract_details => { + let tokens = parse_tokens_from_storage(storage); + return { + user_address: user_address, + address: address, + valid_tokens: tokens, + }; +}; + +export const parse_deposit = (o: any): order => { + let side = o.side; + let tol = o.tolerance; + let to_token = parse_token(o.swap.to); + let from_token = parse_token(o.swap.from.token); + let amount = o.swap.from.amount; + + return { + side: side, + tolerance: tol, + swap: { + to: to_token, + from: { + token: from_token, + amount: amount, + }, + }, + }; +}; diff --git a/batcher-bot/liquidity/tsconfig.json b/batcher-bot/liquidity/tsconfig.json new file mode 100644 index 00000000..a48a25eb --- /dev/null +++ b/batcher-bot/liquidity/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": ["es2020", "dom"], + "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "strict": false, + "types": ["node"], + "esModuleInterop": true, + "inlineSourceMap": true, + "inlineSources": true, + "moduleResolution": "nodenext" + } +} diff --git a/batcher-bot/notifications/flake.lock b/batcher-bot/notifications/flake.lock deleted file mode 100644 index e9efdd8f..00000000 --- a/batcher-bot/notifications/flake.lock +++ /dev/null @@ -1,44 +0,0 @@ -{ - "nodes": { - "js2nix": { - "flake": false, - "locked": { - "lastModified": 1680501697, - "narHash": "sha256-Bmv0ERVeb6vjYzy4MuCDgSiz9fSm/Bhg+Xk3AxPisBw=", - "owner": "canva-public", - "repo": "js2nix", - "rev": "d37912f6cc824e7f41bea7a481af1739ca195c8f", - "type": "github" - }, - "original": { - "owner": "canva-public", - "repo": "js2nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1682566018, - "narHash": "sha256-HPzPRFiy2o/7k7mtnwfM1E6NVZHiFbPdmYCMoIpkHO4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "8e3b64db39f2aaa14b35ee5376bd6a2e707cadc2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "js2nix": "js2nix", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/batcher-bot/notifications/flake.nix b/batcher-bot/notifications/flake.nix deleted file mode 100644 index 3ea8048e..00000000 --- a/batcher-bot/notifications/flake.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.js2nix = { - url = "github:canva-public/js2nix"; - flake = false; - }; - - outputs = { self, nixpkgs, js2nix }: - let - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}.extend (self: super: { - js2nix = self.callPackage js2nix { }; - })); - in - rec { - packages = forAllSystems (system: { - default = - let - env = pkgs.${system}.js2nix { - package-json = ./package.json; - yarn-lock = ./yarn.lock; - }; - in - pkgs.${system}.buildEnv { - name = "batcher-bot"; - paths = [ - ]; - pathsToLink = [ "/bin" ]; - }; - }); - - devShells = forAllSystems (system: { - default = pkgs.${system}.mkShellNoCC { - packages = with pkgs.${system}; [ - yarn - ]; - }; - }); - }; -} diff --git a/flake.nix b/flake.nix index 2653cac2..bbf8da2e 100644 --- a/flake.nix +++ b/flake.nix @@ -11,8 +11,7 @@ outputs = { self, nixpkgs, flake-utils, nix-filter }@inputs: flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { inherit system; }; + let pkgs = import nixpkgs { inherit system; }; in { devShells.${system}.default = pkgs.mkShell { name = "batcher"; @@ -48,13 +47,7 @@ name = "batcher"; src = ./.; - buildInputs = with pkgs; - with ocamlPackages; [ - cmake - glibc - nixfmt - ]; - + buildInputs = with pkgs; with ocamlPackages; [ cmake glibc nixfmt ]; buildPhase = '' mkdir -p $out From 69c80b2ff383762592224a9dcd092d3875f3fa4e Mon Sep 17 00:00:00 2001 From: Cyril B Date: Mon, 22 May 2023 11:48:05 +0200 Subject: [PATCH 060/108] pipelines: use more recent versions of action blocks before deprecation --- .github/workflows/release-bots.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-bots.yml b/.github/workflows/release-bots.yml index 1cbcf3e0..46703c63 100644 --- a/.github/workflows/release-bots.yml +++ b/.github/workflows/release-bots.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: '18.x' - name: Install modules From 39716fe351864e0d95369d2df1f6b0070473b848 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Wed, 24 May 2023 15:43:47 +0100 Subject: [PATCH 061/108] Disabled swap button if the batch is closed. Additionally added a wait for socket connection (#339) --- batcher-ui/src/app.tsx | 10 +- batcher-ui/src/components/Exchange/index.tsx | 26 +++- batcher-ui/src/extra_utils/types.ts | 18 +-- batcher-ui/src/extra_utils/utils.ts | 135 ++++++++++--------- batcher-ui/src/extra_utils/webSocketUtils.ts | 97 +++++++++---- batcher-ui/src/pages/Main.tsx | 134 ++++++++++-------- 6 files changed, 250 insertions(+), 170 deletions(-) diff --git a/batcher-ui/src/app.tsx b/batcher-ui/src/app.tsx index 8dc75eb9..80f14337 100644 --- a/batcher-ui/src/app.tsx +++ b/batcher-ui/src/app.tsx @@ -1,8 +1,8 @@ import Footer from '@/components/Footer'; import React, { useState, useEffect } from 'react'; import RightContent from '@/components/RightContent'; -import { AccountInfo } from "@airgap/beacon-sdk"; -import { BeaconWallet } from "@taquito/beacon-wallet"; +import { AccountInfo } from '@airgap/beacon-sdk'; +import { BeaconWallet } from '@taquito/beacon-wallet'; import { PageLoading } from '@ant-design/pro-components'; import type { RunTimeLayoutConfig } from 'umi'; import defaultSettings from '../config/defaultSettings'; @@ -27,8 +27,7 @@ export async function getInitialState(): Promise { export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { return { - rightContentRender: () => , + rightContentRender: () => , disableContentMargin: false, waterMarkProps: { content: initialState?.currentUser?.name, @@ -37,8 +36,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = menuHeaderRender: undefined, ...initialState?.settings, childrenRender: () => { - return
; + return
; }, }; }; diff --git a/batcher-ui/src/components/Exchange/index.tsx b/batcher-ui/src/components/Exchange/index.tsx index 6910f844..c450a077 100644 --- a/batcher-ui/src/components/Exchange/index.tsx +++ b/batcher-ui/src/components/Exchange/index.tsx @@ -5,7 +5,7 @@ import { compose, OpKind, WalletContract, } from "@taquito/taquito"; import { useModel } from 'umi'; import '@/components/Exchange/index.less'; import '@/global.less'; -import { ExchangeProps, PriceType, } from '@/extra_utils/types'; +import { ExchangeProps, PriceType, BatcherStatus } from '@/extra_utils/types'; // import { ReactComponent as ExchangeDollarSvg } from '../../../img/exchange-dollar.svg'; import { getErrorMess, scaleAmountUp } from '@/extra_utils/utils'; import { tzip12, Tzip12Module } from "@taquito/tzip12"; @@ -22,7 +22,8 @@ const Exchange: React.FC = ({ sellToken, showDrawer, updateAll, - setUpdateAll + setUpdateAll, + status }: ExchangeProps) => { @@ -31,6 +32,7 @@ const Exchange: React.FC = ({ const [side, setSide] = useState(0); const [amount, setAmount] = useState(0); const { initialState } = useModel('@@initialState'); + const [batchClosed, setBatchClosed] = useState(false); const [form] = Form.useForm(); @@ -54,7 +56,7 @@ const Exchange: React.FC = ({ if (!userAddress) { return; } - + tezos.setWalletProvider(initialState.wallet); console.info("tezos", initialState.tezos); @@ -90,7 +92,7 @@ const Exchange: React.FC = ({ tolerance = 0; } } - + // This is for fa2 token standard. I.e, USDT token @@ -224,6 +226,20 @@ const Exchange: React.FC = ({ } }; + + const isBatchClosed = () => { + console.info("EXCHANGE: isBatchClosed", status); + if (status === BatcherStatus.CLOSED) { + setBatchClosed(true); + } else { + setBatchClosed(false); + } + + }; + + useEffect(() => { + isBatchClosed(); + }, [status]); return (
@@ -323,7 +339,7 @@ const Exchange: React.FC = ({ To {inversion ? sellToken.name : buyToken.name} - {userAddress ? ( + {userAddress && (!batchClosed) ? (
+ ) : ( +
+ )} diff --git a/batcher-ui/src/extra_utils/types.ts b/batcher-ui/src/extra_utils/types.ts index df3914c9..885f3c05 100644 --- a/batcher-ui/src/extra_utils/types.ts +++ b/batcher-ui/src/extra_utils/types.ts @@ -238,6 +238,7 @@ export type HoldingsProps = { setClearedHoldings: Dispatch>>; updateAll: boolean; setUpdateAll: Dispatch>; + hasClearedHoldings: boolean; }; export type Volumes = { @@ -265,3 +266,4 @@ export type tokens = { buy_token_name: string; sell_token_name: string; }; + diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index ec7a7598..f49f032a 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -4,19 +4,12 @@ import About from '@/components/About'; import Volume from '@/components/Volume'; import BatcherInfo from '@/components/BatcherInfo'; import BatcherAction from '@/components/BatcherAction'; -import { - ContentType, - token, - BatcherStatus, - Volumes, - swap, - tokens, -} from '@/extra_utils/types'; +import { ContentType, token, BatcherStatus, Volumes, swap, tokens } from '@/extra_utils/types'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; -import { Space, Col, Row, Drawer, Radio, } from 'antd'; +import { Space, Col, Row, Drawer, Radio } from 'antd'; import { CiTwoTone, ConsoleSqlOutlined, DoubleRightOutlined } from '@ant-design/icons'; -import type { RadioChangeEvent } from 'antd'; +import type { RadioChangeEvent } from 'antd'; import { useModel } from 'umi'; import { getEmptyVolumes, @@ -30,10 +23,9 @@ import Holdings from '@/components/Holdings'; import { TezosToolkit } from '@taquito/taquito'; const Welcome: React.FC = () => { - const [Tezos] = useState(new TezosToolkit(REACT_APP_TEZOS_NODE_URI)); const [content, setContent] = useState(ContentType.SWAP); - const [tokenMap, setTokenMap] = useState>(new Map()); + const [tokenMap, setTokenMap] = useState>(new Map()); const [ratesBigMapId, setRatesBigMapId] = useState(0); const [userBatchOrderTypesBigMapId, setUserBatchOrderTypesBigMapId] = useState(0); const [batchesBigMapId, setBatchesBigMapId] = useState(0); @@ -50,19 +42,19 @@ const Welcome: React.FC = () => { const { userAddress } = initialState; const [buyToken, setBuyToken] = useState({ - token_id: 0, - name: 'tzBTC', - address: undefined, - decimals: 8, - standard: 'FA1.2 token', - }); + token_id: 0, + name: 'tzBTC', + address: undefined, + decimals: 8, + standard: 'FA1.2 token', + }); const [sellToken, setSellToken] = useState({ - token_id: 0, - name: 'USDT', - address: undefined, - decimals: 6, - standard: 'FA2 token', - }); + token_id: 0, + name: 'USDT', + address: undefined, + decimals: 6, + standard: 'FA2 token', + }); const [tokenPair, setTokenPair] = useState(buyToken.name + '/' + sellToken.name); const [buyBalance, setBuyBalance] = useState(0); const [sellBalance, setSellBalance] = useState(0); @@ -70,11 +62,14 @@ const Welcome: React.FC = () => { const [rate, setRate] = useState(0); const [status, setStatus] = useState(BatcherStatus.NONE); const [openTime, setOpenTime] = useState(null); - const [clearedHoldings, setClearedHoldings] = useState>(new Map()); + const [clearedHoldings, setClearedHoldings] = useState>( + new Map(), + ); const [openHoldings, setOpenHoldings] = useState>(new Map()); const [feeInMutez, setFeeInMutez] = useState(0); const [volumes, setVolumes] = useState(getEmptyVolumes()); const [updateAll, setUpdateAll] = useState(false); + const [hasClearedHoldings, setHasClearedHoldings] = useState(false); const pullStorage = async () => { const storage = await contractsService.getStorage({ @@ -96,6 +91,7 @@ const Welcome: React.FC = () => { }; }; + const setStatusFromBatch = (sts:string, jsonData:any) => { try { if (sts === BatcherStatus.OPEN) { @@ -108,26 +104,25 @@ const Welcome: React.FC = () => { } else { console.error('Unable to set status', sts); } - } catch (error) { - console.error('Unable to set status', error); } - } + }; const getCurrentVolume = async (storage: any) => { try { - const currentBatchIndices = storage.batch_set.current_batch_indices; - const index_map = new Map(Object.keys(currentBatchIndices).map(k => [k, currentBatchIndices[k] as number])); - const currentBatchNumber = index_map.get(tokenPair); - console.log('current_batch_number', currentBatchNumber); + const currentBatchIndices = storage.batch_set.current_batch_indices; + const index_map = new Map( + Object.keys(currentBatchIndices).map((k) => [k, currentBatchIndices[k] as number]), + ); + const currentBatchNumber = index_map.get(tokenPair); + console.log('current_batch_number', currentBatchNumber); if (currentBatchNumber === 0) { setStatus(BatcherStatus.NONE); const vols: Volumes = getEmptyVolumes(); setVolumes(vols); } else { - const currentBatchURI = - bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; + const currentBatchURI = bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; console.log('######Volumes - URI', currentBatchURI); const data = await fetch(currentBatchURI, { method: 'GET', @@ -140,7 +135,7 @@ const Welcome: React.FC = () => { const scaledVolumes = scaleVolumeDown(jsonData.value.volumes); setVolumes(scaledVolumes); } else { - console.info("Response from current batch api was no ok", data); + console.info('Response from current batch api was no ok', data); } } } catch (error) { @@ -150,36 +145,37 @@ const Welcome: React.FC = () => { // eslint-disable-next-line @typescript-eslint/no-shadow const setFee = async (storage: any) => { - try{ - const fee = storage.fee_in_mutez; - setFeeInMutez(fee); + try { + const fee = storage.fee_in_mutez; + setFeeInMutez(fee); } catch (error) { console.error('Unable to set fee', error); } }; - - const updateSwapMap = async (storage: any) => { - try{ - const valid_swaps = storage.valid_swaps; - console.info('Valid Swaps', valid_swaps); - const swap_map = new Map(Object.keys(valid_swaps).filter(k => !valid_swaps[k].is_disabled_for_desposits).map(k => [k, valid_swaps[k]])); - setTokenMap(swap_map); + const updateSwapMap = async (storage: any) => { + try { + const valid_swaps = storage.valid_swaps; + console.info('Valid Swaps', valid_swaps); + const swap_map = new Map( + Object.keys(valid_swaps) + .filter((k) => !valid_swaps[k].is_disabled_for_desposits) + .map((k) => [k, valid_swaps[k]]), + ); + setTokenMap(swap_map); } catch (error) { console.error('Unable to update swap map', error); } - }; - + }; const getOriginalDepositAmounts = (side: any, initialBuySideAmount: number, initialSellSideAmount: number, depositValue: number) => { if (Object.keys(side).at(0) === "buy"){ initialBuySideAmount += Math.floor(depositValue) / 10 ** buyToken.decimals; } else if (Object.keys(side).at(0) === "sell") { initialSellSideAmount += Math.floor(depositValue) / 10 ** sellToken.decimals; } else { - console.error("Couldn't understand which side the deposit was on"); + console.error("Couldn't understand which side the deposit was on"); } return [initialBuySideAmount, initialSellSideAmount]; - }; const wasInClearingForBatch = (side_obj: any, order_tolerance_obj: any, clearing_tolerance_obj: any) => { @@ -224,260 +220,301 @@ const Welcome: React.FC = () => { console.error("Could not determine order tolerance for buy deposit"); } } else { - console.error("Unable to determine clearing tolerance for buy deposit"); + console.error('Could not determine order tolerance for buy deposit'); } - } else if (side == "sell") { - - if (clearing_tolerance === "minus") { - if (order_tolerance === "minus"){ - return true; - } else if (order_tolerance === "exact") { - return true; - } else if (order_tolerance === "plus") { - return true; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } - } else if (clearing_tolerance === "exact") { - if (order_tolerance === "minus"){ - return false; - } else if (order_tolerance === "exact") { - return true; - } else if (order_tolerance === "plus") { - return true; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } - } else if (clearing_tolerance === "plus") { - if (order_tolerance === "minus"){ - return false; - } else if (order_tolerance === "exact") { - return false; - } else if (order_tolerance === "plus") { - return true; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } + } else if (clearing_tolerance === 'exact') { + if (order_tolerance === 'minus') { + return true; + } else if (order_tolerance === 'exact') { + return true; + } else if (order_tolerance === 'plus') { + return false; + } else { + console.error('Could not determine order tolerance for buy deposit'); + } + } else if (clearing_tolerance === 'plus') { + if (order_tolerance === 'minus') { + return true; + } else if (order_tolerance === 'exact') { + return true; + } else if (order_tolerance === 'plus') { + return true; + } else { + console.error('Could not determine order tolerance for buy deposit'); + } + } else { + console.error('Unable to determine clearing tolerance for buy deposit'); + } + } else if (side == 'sell') { + if (clearing_tolerance === 'minus') { + if (order_tolerance === 'minus') { + return true; + } else if (order_tolerance === 'exact') { + return true; + } else if (order_tolerance === 'plus') { + return true; + } else { + console.error('Could not determine order tolerance for buy deposit'); + } + } else if (clearing_tolerance === 'exact') { + if (order_tolerance === 'minus') { + return false; + } else if (order_tolerance === 'exact') { + return true; + } else if (order_tolerance === 'plus') { + return true; + } else { + console.error('Could not determine order tolerance for buy deposit'); + } + } else if (clearing_tolerance === 'plus') { + if (order_tolerance === 'minus') { + return false; + } else if (order_tolerance === 'exact') { + return false; + } else if (order_tolerance === 'plus') { + return true; } else { - console.error("Unable to determine clearing tolerance for buy deposit"); + console.error('Could not determine order tolerance for buy deposit'); } } else { - console.error("Unable to determine side for holdings"); + console.error('Unable to determine clearing tolerance for buy deposit'); } + } else { + console.error('Unable to determine side for holdings'); + } }; - const convertHoldingToPayout = (fromAmount:any, fromVolumeSubjectToClearing:any, fromClearedVolume:any, toClearedVolume:any, fromDecimals:number, toDecimals:number) => { - - const prorata = fromAmount / fromVolumeSubjectToClearing; - const payout = toClearedVolume * prorata; - const payoutInFromTokens = fromClearedVolume * prorata; - const remainder = fromAmount - payoutInFromTokens; - const scaled_payout = Math.floor(payout) / 10 ** toDecimals; - const scaled_remainder = Math.floor(remainder) / 10 ** fromDecimals; - - return [scaled_payout, scaled_remainder]; + const convertHoldingToPayout = ( + fromAmount: any, + fromVolumeSubjectToClearing: any, + fromClearedVolume: any, + toClearedVolume: any, + fromDecimals: number, + toDecimals: number, + ) => { + const prorata = fromAmount / fromVolumeSubjectToClearing; + const payout = toClearedVolume * prorata; + const payoutInFromTokens = fromClearedVolume * prorata; + const remainder = fromAmount - payoutInFromTokens; + const scaled_payout = Math.floor(payout) / 10 ** toDecimals; + const scaled_remainder = Math.floor(remainder) / 10 ** fromDecimals; + + return [scaled_payout, scaled_remainder]; }; - - - const findTokensForBatch = (batch: any) => { - - const pair = batch.pair - const tokns: tokens = { - buy_token_name : pair.name_0, - sell_token_name : pair.name_1, - - } - return tokns; + const pair = batch.pair; + const tkns: tokens = { + buy_token_name: pair.name_0, + sell_token_name: pair.name_1, + }; + return tkns; }; - - - const calculateHoldingFromBatch = (batch: any, ubots: any, open_holdings: Map , cleared_holdings: Map ) => { - - const tokns = findTokensForBatch(batch); + const calculateHoldingFromBatch = ( + batch: any, + ubots: any, + open_holdings: Map, + cleared_holdings: Map, + ) => { + const tkns = findTokensForBatch(batch); const depositsInBatches = ubots.value; const userBatchLength = depositsInBatches[batch.batch_number].length; - if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED){ - + if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED) { for (let j = 0; j < userBatchLength; j++) { - try{ - const depObject = ubots.value[batch.batch_number].at(j); - const side = depObject.key.side; - const value = depObject.value; - let initialBuySideOpenAmount = open_holdings.get(tokns.buy_token_name); - let initialSellSideOpenAmount = open_holdings.get(tokns.sell_token_name); - const updatedValues = getOriginalDepositAmounts(side,initialBuySideOpenAmount, initialSellSideOpenAmount,value); - initialBuySideOpenAmount += updatedValues.at(0); - initialSellSideOpenAmount += updatedValues.at(1); - open_holdings.set(tokns.buy_token_name,initialBuySideOpenAmount); - open_holdings.set(tokns.sell_token_name, initialSellSideOpenAmount); + try { + const depObject = ubots.value[batch.batch_number].at(j); + const side = depObject.key.side; + const value = depObject.value; + let initialBuySideOpenAmount = open_holdings.get(tkns.buy_token_name); + let initialSellSideOpenAmount = open_holdings.get(tkns.sell_token_name); + const updatedValues = getOriginalDepositAmounts( + side, + initialBuySideOpenAmount, + initialSellSideOpenAmount, + value, + ); + initialBuySideOpenAmount += updatedValues.at(0); + initialSellSideOpenAmount += updatedValues.at(1); + open_holdings.set(tkns.buy_token_name, initialBuySideOpenAmount); + open_holdings.set(tkns.sell_token_name, initialSellSideOpenAmount); } catch (error) { console.error(error); } } } else { - const cleared = batch.status.cleared; const clearing = cleared.clearing; const buy_side_cleared_volume = clearing.total_cleared_volumes.buy_side_total_cleared_volume; - const sell_side_cleared_volume = clearing.total_cleared_volumes.sell_side_total_cleared_volume; - const buy_side_volume_subject_to_clearing = clearing.total_cleared_volumes.buy_side_volume_subject_to_clearing; - const sell_side_volume_subject_to_clearing = clearing.total_cleared_volumes.sell_side_volume_subject_to_clearing; + const sell_side_cleared_volume = + clearing.total_cleared_volumes.sell_side_total_cleared_volume; + const buy_side_volume_subject_to_clearing = + clearing.total_cleared_volumes.buy_side_volume_subject_to_clearing; + const sell_side_volume_subject_to_clearing = + clearing.total_cleared_volumes.sell_side_volume_subject_to_clearing; for (let j = 0; j < userBatchLength; j++) { - try{ - const depObject = ubots.value[batch.batch_number].at(j); - const side = depObject.key.side; - const tol = depObject.key.tolerance; - const value = depObject.value; - - if (buy_side_cleared_volume === 0 || sell_side_cleared_volume === 0 ){ - let initialBuySideAmount = cleared_holdings.get(tokns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokns.sell_token_name); - const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); - initialBuySideAmount += updatedValues.at(0); - initialSellSideAmount += updatedValues.at(1); - cleared_holdings.set(tokns.buy_token_name,initialBuySideAmount); - cleared_holdings.set(tokns.sell_token_name, initialSellSideAmount); - } else - { - const wasInClearing = wasInClearingForBatch(side, tol,clearing.clearing_tolerance); - if (wasInClearing) { - if (Object.keys(side).at(0) === "buy") { - let initialBuySideAmount = cleared_holdings.get(tokns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokns.sell_token_name); - const payout = convertHoldingToPayout(value,buy_side_volume_subject_to_clearing,buy_side_cleared_volume, sell_side_cleared_volume,buyToken.decimals, sellToken.decimals); - initialSellSideAmount += payout.at(0); - initialBuySideAmount += payout.at(1); - cleared_holdings.set(tokns.buy_token_name,initialBuySideAmount); - cleared_holdings.set(tokns.sell_token_name, initialSellSideAmount); - } else if (Object.keys(side).at(0) === "sell"){ - let initialBuySideAmount = cleared_holdings.get(tokns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokns.sell_token_name); - const payout = convertHoldingToPayout(value,sell_side_volume_subject_to_clearing, sell_side_cleared_volume, buy_side_cleared_volume, sellToken.decimals, buyToken.decimals); - initialBuySideAmount += payout.at(0); - initialSellSideAmount += payout.at(1); - cleared_holdings.set(tokns.buy_token_name,initialBuySideAmount); - cleared_holdings.set(tokns.sell_token_name, initialSellSideAmount); + try { + const depObject = ubots.value[batch.batch_number].at(j); + const side = depObject.key.side; + const tol = depObject.key.tolerance; + const value = depObject.value; + + if (buy_side_cleared_volume === 0 || sell_side_cleared_volume === 0) { + let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); + const updatedValues = getOriginalDepositAmounts( + side, + initialBuySideAmount, + initialSellSideAmount, + value, + ); + initialBuySideAmount += updatedValues.at(0); + initialSellSideAmount += updatedValues.at(1); + cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); + cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + } else { + const wasInClearing = wasInClearingForBatch(side, tol, clearing.clearing_tolerance); + if (wasInClearing) { + if (Object.keys(side).at(0) === 'buy') { + let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); + const payout = convertHoldingToPayout( + value, + buy_side_volume_subject_to_clearing, + buy_side_cleared_volume, + sell_side_cleared_volume, + buyToken.decimals, + sellToken.decimals, + ); + initialSellSideAmount += payout.at(0); + initialBuySideAmount += payout.at(1); + cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); + cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + } else if (Object.keys(side).at(0) === 'sell') { + let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); + const payout = convertHoldingToPayout( + value, + sell_side_volume_subject_to_clearing, + sell_side_cleared_volume, + buy_side_cleared_volume, + sellToken.decimals, + buyToken.decimals, + ); + initialBuySideAmount += payout.at(0); + initialSellSideAmount += payout.at(1); + cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); + cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + } else { + console.error('Unable to determine side for a deposit that was in clearing'); + } } else { - console.error("Unable to determine side for a deposit that was in clearing"); + let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); + let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); + const updatedValues = getOriginalDepositAmounts( + side, + initialBuySideAmount, + initialSellSideAmount, + value, + ); + initialBuySideAmount += updatedValues.at(0); + initialSellSideAmount += updatedValues.at(1); + cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); + cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); } - } else { - let initialBuySideAmount = cleared_holdings.get(tokns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tokns.sell_token_name); - const updatedValues = getOriginalDepositAmounts(side,initialBuySideAmount, initialSellSideAmount,value); - initialBuySideAmount += updatedValues.at(0); - initialSellSideAmount += updatedValues.at(1); - cleared_holdings.set(tokns.buy_token_name,initialBuySideAmount); - cleared_holdings.set(tokns.sell_token_name, initialSellSideAmount); } - } - } catch (error) { console.error(error); } } } return [open_holdings, cleared_holdings]; - }; - const updateHoldings = async (storage: any) => { let oh = openHoldings; let ch = clearedHoldings; - try{ - if (!userAddress) { - return; - } - - console.info("##open holdings", openHoldings); - console.info("##cleared holdings", clearedHoldings); - const userBatcherURI = bigMapsByIdUri + userBatchOrderTypesBigMapId + '/keys/' + userAddress; - const userOrderBookData = await fetch(userBatcherURI, { method: 'GET' }); - let userBatches = null; try { - userBatches = await userOrderBookData.json(); - } catch (error) { - console.error(error); - return; - } - - if (Object.keys(userBatches.value).length === 0) { - return; - } - - for (let i = 0; i < Object.keys(userBatches.value).length; i++) { - const batchId = Object.keys(userBatches.value).at(i); + if (!userAddress) { + return; + } - const batchURI = bigMapsByIdUri + storage.batch_set.batches + '/keys/' + batchId; - const batchData = await fetch(batchURI, { method: 'GET' }); - let batch = null; + console.info('##open holdings', openHoldings); + console.info('##cleared holdings', clearedHoldings); + const userBatcherURI = bigMapsByIdUri + userBatchOrderTypesBigMapId + '/keys/' + userAddress; + const userOrderBookData = await fetch(userBatcherURI, { method: 'GET' }); + let userBatches = null; try { - batch = await batchData.json(); + userBatches = await userOrderBookData.json(); } catch (error) { console.error(error); return; } - try{ - const batch_holdings = calculateHoldingFromBatch(batch.value,userBatches, oh, ch); + if (Object.keys(userBatches.value).length === 0) { + return; + } - console.info("== batcher holdings " + batchId, batch_holdings); - oh = batch_holdings[0]; - ch = batch_holdings[1]; - } catch (error) { - console.error(error); + for (let i = 0; i < Object.keys(userBatches.value).length; i++) { + const batchId = Object.keys(userBatches.value).at(i); + + const batchURI = bigMapsByIdUri + storage.batch_set.batches + '/keys/' + batchId; + const batchData = await fetch(batchURI, { method: 'GET' }); + let batch = null; + try { + batch = await batchData.json(); + } catch (error) { + console.error(error); + return; + } + + try { + const batch_holdings = calculateHoldingFromBatch(batch.value, userBatches, oh, ch); + + console.info('== batcher holdings ' + batchId, batch_holdings); + oh = batch_holdings[0]; + ch = batch_holdings[1]; + } catch (error) { + console.error(error); + } } - } } catch (error) { console.error('Unable to update holdings', error); } setOpenHoldings(oh); setClearedHoldings(ch); - }; - - - + let sum_of_holdings = 0; + for (const value of ch.values()) { + sum_of_holdings = sum_of_holdings + value; + } + setHasClearedHoldings(sum_of_holdings > 0); + }; const getBatches = async (storage: any) => { await getCurrentVolume(storage); }; - const updateTokenBalances = (tokenBalances: any) => { - try{ - console.log('tokenbalances', tokenBalances); - setSocketTokenAmount( - tokenBalances, - userAddress, - buyToken, - setBuyBalance, - ); - console.log('updateBuyBalance', buyBalance); - - setSocketTokenAmount( - tokenBalances, - userAddress, - sellToken, - setSellBalance, - ); - console.log('updateSellBalance', sellBalance); - - } catch (error) { - console.error('Unable to update token balances', error); - } - }; - - - const updateRate= (bigmaps: any) => { - try{ - console.log('bigmaps', bigmaps); + const updateTokenBalances = (tokenBalances: any) => { + try { + console.log('tokenbalances', tokenBalances); + setSocketTokenAmount(tokenBalances, userAddress, buyToken, setBuyBalance); + console.log('updateBuyBalance', buyBalance); + + setSocketTokenAmount(tokenBalances, userAddress, sellToken, setSellBalance); + console.log('updateSellBalance', sellBalance); + } catch (error) { + console.error('Unable to update token balances', error); + } + }; + + const updateRate = (bigmaps: any) => { + try { + console.log('bigmaps', bigmaps); const numerator = bigmaps.content.value.rate.p; const denominator = bigmaps.content.value.rate.q; @@ -487,21 +524,18 @@ const Welcome: React.FC = () => { } catch (error) { console.error('Unable to update rate', error); } - }; - - const updateTokenDetails = async (storage: any) => { - try{ - setTokenPair(buyToken.name + '/' + sellToken.name); + try { + setTokenPair(buyToken.name + '/' + sellToken.name); const valid_tokens = storage.valid_tokens; - const token_map = new Map(Object.keys(valid_tokens).map(k => [k, valid_tokens[k]])); + const token_map = new Map(Object.keys(valid_tokens).map((k) => [k, valid_tokens[k]])); const buyTokenData = token_map.get(buyToken.name); - console.log("buyTokenAddress",buyToken.address); + console.log('buyTokenAddress', buyToken.address); const sellTokenData = token_map.get(sellToken.name); - console.log("sellTokenAddress",sellToken.address); + console.log('sellTokenAddress', sellToken.address); const bToken: token = { token_id: buyTokenData.token_id, @@ -518,13 +552,9 @@ const Welcome: React.FC = () => { standard: sellTokenData.standard, }; + if (buyToken != bToken) setBuyToken(bToken); - if(buyToken != bToken) - setBuyToken(bToken); - - if(sellToken != sToken) - setSellToken(sToken); - + if (sellToken != sToken) setSellToken(sToken); } catch (error) { console.error('Unable to update token details', error); } @@ -533,11 +563,12 @@ const Welcome: React.FC = () => { const setOraclePrice = async (rates: any) => { if (rates.length != 0) { // eslint-disable-next-line @typescript-eslint/no-shadow - console.info("rates",rates); - console.info("tokenPair",tokenPair); - const rte = rates.filter((r) => r.key == tokenPair)[0].value; - const numerator = rte.rate.p; - const denominator = rte.rate.q; + console.info('rates', rates); + console.info('tokenPair', tokenPair); + const rate = rates.filter((r) => r.key == tokenPair)[0].value; + const numerator = rate.rate.p; + const denominator = rate.rate.q; + const scaledPow = buyToken.decimals - sellToken.decimals; const scaledRate = scaleAmountUp(numerator / denominator, scaledPow); setRate(scaledRate); @@ -545,14 +576,15 @@ const Welcome: React.FC = () => { }; const getOraclePrice = async () => { - await contractsService.getBigMapByNameKeys({ - address: REACT_APP_BATCHER_CONTRACT_HASH, - name: 'rates_current', - micheline: MichelineFormat.JSON, - }).then(r => setOraclePrice(r)); + await contractsService + .getBigMapByNameKeys({ + address: REACT_APP_BATCHER_CONTRACT_HASH, + name: 'rates_current', + micheline: MichelineFormat.JSON, + }) + .then((r) => setOraclePrice(r)); }; - const [open, setOpen] = useState(false); const [swaps, setSwaps] = useState([]); const showDrawer = () => { @@ -563,21 +595,19 @@ const Welcome: React.FC = () => { setOpen(false); }; - - const getPairs = () => { const swps = []; - console.log('swap_map', tokenMap); - for (const keyvalue of tokenMap) { - console.log(keyvalue); - swps.push(keyvalue[0]); - } + console.log('swap_map', tokenMap); + for (const keyvalue of tokenMap) { + console.log(keyvalue); + swps.push(keyvalue[0]); + } setSwaps(swps); console.log('swps', swps); console.log('swaps', swaps); }; - const changeTokenPair = (e: RadioChangeEvent) => { + const changeTokenPair = (e: RadioChangeEvent) => { const pair = e.target.value; console.log('pair changed', pair); setTokenPair(pair); @@ -602,11 +632,8 @@ const Welcome: React.FC = () => { )} ); - - }; - useEffect(() => { getPairs(); }, [tokenMap]); @@ -647,6 +674,7 @@ const Welcome: React.FC = () => { setClearedHoldings={setClearedHoldings} updateAll={updateAll} setUpdateAll={setUpdateAll} + hasClearedHoldings={hasClearedHoldings} /> ); case ContentType.ABOUT: @@ -673,30 +701,38 @@ const Welcome: React.FC = () => { }; const updateBigMapIds = (storage: any) => { - try{ - setRatesBigMapId(storage.rates_current); - setUserBatchOrderTypesBigMapId(storage.user_batch_ordertypes); - setBatchesBigMapId(storage.batch_set.batches); + try { + setRatesBigMapId(storage.rates_current); + setUserBatchOrderTypesBigMapId(storage.user_batch_ordertypes); + setBatchesBigMapId(storage.batch_set.batches); } catch (error) { console.error('Unable to update bigmap ids', error); } - }; const getTokenBalance = async () => { - try{ - let usrAddr = userAddress - if(userAddress === null){ - if(initialState.userAddress !== null){ + try { + let usrAddr = userAddress; + if (userAddress === null) { + if (initialState.userAddress !== null) { usrAddr = initialState.userAddress; } } - if(usrAddr === null){ + if (usrAddr === null) { setBuyBalance(0); setSellBalance(0); } else { + console.log('getTokenBalance-userAddress', usrAddr); + const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; + console.log('getTokenBalance-balanceURI', balanceURI); + const buyTokenData = await fetch(balanceURI + '&token.contract=' + buyToken.address, { + method: 'GET', + }); + const sellTokenData = await fetch(balanceURI + '&token.contract=' + sellToken.address, { + method: 'GET', + }); console.log('getTokenBalance-userAddress',usrAddr); const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; @@ -721,20 +757,20 @@ const Welcome: React.FC = () => { }); } } catch (error) { - console.error('getTokenBalance-error',error); - if(!userAddress) { - setBuyBalance(0); - setSellBalance(0); + console.error('getTokenBalance-error', error); + if (!userAddress) { + setBuyBalance(0); + setSellBalance(0); } else { - setBuyBalance(-1); - setSellBalance(-1); + setBuyBalance(-1); + setSellBalance(-1); } } }; const updateFromStorage = async (storage: any) => { updateBigMapIds(storage); - zeroHoldings(storage, setOpenHoldings,setClearedHoldings); + zeroHoldings(storage, setOpenHoldings, setClearedHoldings); await updateTokenDetails(storage); await getBatches(storage); await updateSwapMap(storage); @@ -743,10 +779,8 @@ const Welcome: React.FC = () => { await getTokenBalance(); await updateHoldings(storage); await getCurrentVolume(storage); - }; - const handleWebsocket = () => { connection.on('token_balances', (msg: any) => { if (!msg.data) return; @@ -757,8 +791,8 @@ const Welcome: React.FC = () => { connection.on('operations', (msg: any) => { if (!msg.data) return; if (!msg.data[0].storage) return; - console.info("#######WS###### - operations", msg.data[0].storage) - updateFromStorage(msg.data[0].storage).then(r => console.log(r)); + console.info('#######WS###### - operations', msg.data[0].storage); + updateFromStorage(msg.data[0].storage).then((r) => console.log(r)); }); connection.on('bigmaps', (msg: any) => { @@ -789,7 +823,7 @@ const Welcome: React.FC = () => { }; const refreshStorage = async () => { - pullStorage().then(s => updateFromStorage(s)) + pullStorage().then((s) => updateFromStorage(s)); }; useEffect(() => { @@ -799,12 +833,12 @@ const Welcome: React.FC = () => { }, []); useEffect(() => { - if(initialState?.wallet !== null){ + if (initialState?.wallet !== null) { Tezos.setWalletProvider(initialState.wallet); } }, []); useEffect(() => { - refreshStorage().then(r => console.log(r)); + refreshStorage().then((r) => console.log(r)); }, [buyToken.address, sellToken.address, updateAll]); useEffect(() => { @@ -813,7 +847,6 @@ const Welcome: React.FC = () => { init_user(userAddress).then(r => console.log(r)); }, [userAddress]); - return (
{ updateAll={updateAll} setUpdateAll={setUpdateAll} /> - +
- } - > - - - { - generatePairs() - } - - - + } + > + + {generatePairs()} + + {renderRightContent(content)} From b74705407d799de385705801ba9ff626d5e0eed1 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Wed, 24 May 2023 17:26:07 +0100 Subject: [PATCH 063/108] Fix merge issues and tidy up --- batcher-ui/src/components/About/index.tsx | 51 ++-- .../src/components/BatcherAction/index.tsx | 9 +- .../src/components/BatcherInfo/index.tsx | 26 +- batcher-ui/src/components/Exchange/index.tsx | 147 ++++++----- batcher-ui/src/components/Footer/index.tsx | 16 +- batcher-ui/src/components/Holdings/index.tsx | 72 +++--- .../src/components/RightContent/index.tsx | 83 +++---- batcher-ui/src/extra_utils/types.ts | 1 - batcher-ui/src/pages/Main.tsx | 235 ++++++++---------- 9 files changed, 308 insertions(+), 332 deletions(-) diff --git a/batcher-ui/src/components/About/index.tsx b/batcher-ui/src/components/About/index.tsx index 0279b021..a879c267 100644 --- a/batcher-ui/src/components/About/index.tsx +++ b/batcher-ui/src/components/About/index.tsx @@ -6,28 +6,49 @@ const { Link } = Anchor; const About: React.FC = () => { return (
- - - Batcher is a new type of DEX that we have named a 'batch clearing DEX'. It provides a dark pool-like trading environment without using liquidity pools or having the issue of significant slippage. Batcher’s goal is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. This means that all orders for potential swaps between two pairs of tokens are collected over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order collection period is over, the batch is closed to additions. Batcher then waits for the next Oracle price for the token pair. When this is received, the batch is terminated and then Batcher looks to match the maximum amount of orders at the fairest possible price. - + -For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. + Batcher is a new type of DEX that we have named a 'batch clearing DEX'. It provides a dark + pool-like trading environment without using liquidity pools or having the issue of + significant slippage. Batcher’s goal is to enable users to deposit tokens with the aim of + being swapped at a fair price with{' '} + bounded slippage and almost no impermanent loss. + This means that all orders for potential swaps between two pairs of tokens are collected + over a finite period (currently 10 minutes). This is deemed the 'batch'. After the order + collection period is over, the batch is closed to additions. Batcher then waits for the + next Oracle price for the token pair. When this is received, the batch is terminated and + then Batcher looks to match the maximum amount of orders at the fairest possible price. -Note: Batcher can deal with token value imbalance which means that holders of tzBTC and holders of USDT can swap different amounts as long as there is a market for the trade on both sides. - + For V1, the deposit window will be 10 mins and then a wait time of 2 + minutes before awaiting the oracle price. + + + Note: Batcher can deal with token value imbalance which means that holders of{' '} + tzBTC and holders of USDT can swap different + amounts as long as there is a market for the trade on both sides. + + + Batcher has been designed to be composable with other high liquidity paths in the Tezos + ecosystem, specifically the Sirius DEX; thus, the two pairs that are supported in V1 are + tzBTC/USDT and tzBTC/EURL. + - Batcher has been designed to be composable with other high liquidity paths in the Tezos ecosystem, specifically the Sirius DEX; thus, the two pairs that are supported in V1 are tzBTC/USDT and tzBTC/EURL. + For more information including blog posts and faqs, please visit the Batcher project page + at Marigold.dev. + - - For more information including blog posts and faqs, please visit the Batcher project page at Marigold.dev. - - - *DISCLAIMER:* All investing comes with risk and DeFi is no exception. The content in this Dapp contains no financial advice. -Please do your own thorough research and note that all users funds are traded at their own risk. No reimbursement will be made and Marigold will not assume responsibility for any losses. + *DISCLAIMER:* + + {' '} + All investing comes with risk and DeFi is no exception. The content in this Dapp + contains no financial advice. Please do your own thorough research and note that all + users funds are traded at their own risk. No reimbursement will be made and Marigold + will not assume responsibility for any losses.{' '} + - +
); }; diff --git a/batcher-ui/src/components/BatcherAction/index.tsx b/batcher-ui/src/components/BatcherAction/index.tsx index b1e39151..f3e770f7 100644 --- a/batcher-ui/src/components/BatcherAction/index.tsx +++ b/batcher-ui/src/components/BatcherAction/index.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useState } from 'react'; import '@/components/BatcherAction/index.less'; import '@/global.less'; -import type { RadioChangeEvent } from 'antd'; -import { Button, Col, Space, Row, Typography, Drawer, Radio, } from 'antd'; +import type { RadioChangeEvent } from 'antd'; +import { Button, Col, Space, Row, Typography, Drawer, Radio } from 'antd'; import { BatcherActionProps, ContentType } from '@/extra_utils/types'; const { Text } = Typography; @@ -10,8 +10,7 @@ const { Text } = Typography; const BatcherAction: React.FC = ({ content, setContent, - }: BatcherActionProps) => { - +}: BatcherActionProps) => { return (
@@ -21,7 +20,7 @@ const BatcherAction: React.FC = ({ - - ) : ( -
- )} + {hasClearedHoldings ? ( + + ) : ( +
+ )}
diff --git a/batcher-ui/src/components/RightContent/index.tsx b/batcher-ui/src/components/RightContent/index.tsx index 5189c514..3a6db61d 100644 --- a/batcher-ui/src/components/RightContent/index.tsx +++ b/batcher-ui/src/components/RightContent/index.tsx @@ -8,12 +8,10 @@ import { BeaconWallet } from '@taquito/beacon-wallet'; import { getNetworkType } from '@/extra_utils/utils'; import '@/components/RightContent/index.less'; import { connection } from '@/extra_utils/webSocketUtils'; -import { LocalStorage } from "@airgap/beacon-sdk"; +import { LocalStorage } from '@airgap/beacon-sdk'; export type SiderTheme = 'light' | 'dark'; - - const GlobalHeaderRight: React.FC = () => { const { initialState, setInitialState } = useModel('@@initialState'); const tezos = new TezosToolkit(REACT_APP_TEZOS_NODE_URI); @@ -28,20 +26,16 @@ const GlobalHeaderRight: React.FC = () => { className = `${styles.right} ${styles.dark}`; } -const connectCaption = "Connect Wallet"; -const connectingCaption = "Connecting..."; -const disconnectCaption = "Disconnect Wallet"; -const disconnectingCaption = "Disconnecting..."; -const [ caption, setCaption ] = useState(connectCaption); + const connectCaption = 'Connect Wallet'; + const connectingCaption = 'Connecting...'; + const disconnectCaption = 'Disconnect Wallet'; + const disconnectingCaption = 'Disconnecting...'; + const [caption, setCaption] = useState(connectCaption); const items: MenuProps['items'] = [ { key: '1', - label: ( - - { caption } - - ), + label: {caption}, }, ]; @@ -50,9 +44,8 @@ const [ caption, setCaption ] = useState(connectCaption); onClick: !initialState.userAddress ? () => connectWallet() : () => disconnectWallet(), }; - const connectWallet = async () => { - console.info("=== STATE === state change check ", initialState); + console.info('=== STATE === state change check ', initialState); if (!initialState.userAddress) { setCaption(connectingCaption); const wallet = new BeaconWallet({ @@ -69,27 +62,32 @@ const [ caption, setCaption ] = useState(connectCaption); tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); const userAddress = activeAccount ? await wallet.getPKH() : null; - let updatedState = { ...initialState, wallet: wallet, userAddress: userAddress, userAccount: activeAccount}; + let updatedState = { + ...initialState, + wallet: wallet, + userAddress: userAddress, + userAccount: activeAccount, + }; setCaption(disconnectCaption); -// localStorage.setItem("state", JSON.stringify(updatedState)); - console.log("localstroage - after connect", localStorage); + // localStorage.setItem("state", JSON.stringify(updatedState)); + console.log('localstroage - after connect', localStorage); setInitialState(updatedState); - console.log("Setting initialState", updatedState); + console.log('Setting initialState', updatedState); } }; const disconnectWallet = async () => { - console.info("Disconnecting wallet"); + console.info('Disconnecting wallet'); setCaption(disconnectingCaption); await connection.stop(); - try{ - await initialState.wallet.clearActiveAccount(); + try { + await initialState.wallet.clearActiveAccount(); } catch (error) { console.error(error); } - let updatedState = { ...initialState, wallet: null, userAddress: null, userAccount:null }; - localStorage.setItem("state", JSON.stringify(updatedState)); + let updatedState = { ...initialState, wallet: null, userAddress: null, userAccount: null }; + localStorage.setItem('state', JSON.stringify(updatedState)); setInitialState(updatedState); setCaption(connectCaption); }; @@ -98,44 +96,43 @@ const [ caption, setCaption ] = useState(connectCaption); window.scrollTo(0, 0); }; - const newWallet = () => { - + const newWallet = () => { return new BeaconWallet({ - name: 'batcher', - preferredNetwork: getNetworkType(), - }); - - }; - + name: 'batcher', + preferredNetwork: getNetworkType(), + }); + }; useEffect(() => { (async () => { try { setCaption(connectCaption); -// let localstate = JSON.parse(localStorage.getItem("state")); - let state = initialState; + // let localstate = JSON.parse(localStorage.getItem("state")); + let state = initialState; let wallet = newWallet(); setCaption(connectingCaption); tezos.setWalletProvider(wallet); const activeAccount = await wallet.client.getActiveAccount(); if (activeAccount) { - console.info("=== STATE === no dep check - active account ", activeAccount); + console.info('=== STATE === no dep check - active account ', activeAccount); const userAddress = await wallet.getPKH(); - let updatedState = { ...state, wallet: wallet, userAddress: userAddress, userAccount: activeAccount, }; + let updatedState = { + ...state, + wallet: wallet, + userAddress: userAddress, + userAccount: activeAccount, + }; // localStorage.setItem("state", JSON.stringify(updatedState)); setInitialState(updatedState); setCaption(disconnectCaption); } else { - - - setCaption(connectCaption); + setCaption(connectCaption); } } catch (error) { - setCaption(connectCaption); - console.error(error); + setCaption(connectCaption); + console.error(error); } - })(); }, []); return ( @@ -147,7 +144,7 @@ const [ caption, setCaption ] = useState(connectCaption); onClick={!initialState.userAddress ? connectWallet : disconnectWallet} danger > - { caption } + {caption}
diff --git a/batcher-ui/src/extra_utils/types.ts b/batcher-ui/src/extra_utils/types.ts index 885f3c05..967b9672 100644 --- a/batcher-ui/src/extra_utils/types.ts +++ b/batcher-ui/src/extra_utils/types.ts @@ -266,4 +266,3 @@ export type tokens = { buy_token_name: string; sell_token_name: string; }; - diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index f49f032a..07dfa434 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -91,19 +91,18 @@ const Welcome: React.FC = () => { }; }; - - const setStatusFromBatch = (sts:string, jsonData:any) => { + const setStatusFromBatch = (sts: string, jsonData: any) => { try { - if (sts === BatcherStatus.OPEN) { - setOpenTime(jsonData.value.status.open); - setStatus(BatcherStatus.OPEN); - } else if (sts === BatcherStatus.CLOSED) { - setStatus(BatcherStatus.CLOSED); - } else if (sts === BatcherStatus.CLEARED) { - setStatus(BatcherStatus.CLEARED); - } else { - console.error('Unable to set status', sts); - } + if (sts === BatcherStatus.OPEN) { + setOpenTime(jsonData.value.status.open); + setStatus(BatcherStatus.OPEN); + } else if (sts === BatcherStatus.CLOSED) { + setStatus(BatcherStatus.CLOSED); + } else if (sts === BatcherStatus.CLEARED) { + setStatus(BatcherStatus.CLEARED); + } else { + console.error('Unable to set status', sts); + } } catch (error) { console.error('Unable to set status', error); } @@ -127,13 +126,13 @@ const Welcome: React.FC = () => { const data = await fetch(currentBatchURI, { method: 'GET', }); - if(data.ok && data.status !== 204) { - const jsonData = await data.json(); - const sts = Object.keys(jsonData.value.status)[0]; - setStatusFromBatch(sts, jsonData); - // eslint-disable-next-line @typescript-eslint/no-shadow - const scaledVolumes = scaleVolumeDown(jsonData.value.volumes); - setVolumes(scaledVolumes); + if (data.ok && data.status !== 204) { + const jsonData = await data.json(); + const sts = Object.keys(jsonData.value.status)[0]; + setStatusFromBatch(sts, jsonData); + // eslint-disable-next-line @typescript-eslint/no-shadow + const scaledVolumes = scaleVolumeDown(jsonData.value.volumes); + setVolumes(scaledVolumes); } else { console.info('Response from current batch api was no ok', data); } @@ -167,58 +166,38 @@ const Welcome: React.FC = () => { console.error('Unable to update swap map', error); } }; - const getOriginalDepositAmounts = (side: any, initialBuySideAmount: number, initialSellSideAmount: number, depositValue: number) => { - if (Object.keys(side).at(0) === "buy"){ - initialBuySideAmount += Math.floor(depositValue) / 10 ** buyToken.decimals; - } else if (Object.keys(side).at(0) === "sell") { - initialSellSideAmount += Math.floor(depositValue) / 10 ** sellToken.decimals; + const getOriginalDepositAmounts = ( + side: any, + initialBuySideAmount: number, + initialSellSideAmount: number, + depositValue: number, + ) => { + if (Object.keys(side).at(0) === 'buy') { + initialBuySideAmount += Math.floor(depositValue) / 10 ** buyToken.decimals; + } else if (Object.keys(side).at(0) === 'sell') { + initialSellSideAmount += Math.floor(depositValue) / 10 ** sellToken.decimals; } else { console.error("Couldn't understand which side the deposit was on"); } return [initialBuySideAmount, initialSellSideAmount]; }; - const wasInClearingForBatch = (side_obj: any, order_tolerance_obj: any, clearing_tolerance_obj: any) => { - console.info("wasInClearingForBatch - side_obj", side_obj); - console.info("wasInClearingForBatch - order_tolerance_obj", order_tolerance_obj); - console.info("wasInClearingForBatch - clearing_tolerance_obj", clearing_tolerance_obj); - const side = Object.keys(side_obj).at(0); - const order_tolerance = Object.keys(order_tolerance_obj).at(0); - const clearing_tolerance = Object.keys(clearing_tolerance_obj).at(0); - console.info("wasInClearingForBatch - side", side); - console.info("wasInClearingForBatch - order_tolerance", order_tolerance); - console.info("wasInClearingForBatch - clearing_tolerance", clearing_tolerance); - if (side == "buy") { - if (clearing_tolerance === "minus") { - if (order_tolerance === "minus"){ - return true; - } else if (order_tolerance === "exact") { - return false; - } else if (order_tolerance === "plus") { - return false; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } - } else if (clearing_tolerance === "exact") { - if (order_tolerance === "minus"){ - return true; - } else if (order_tolerance === "exact") { - return true; - } else if (order_tolerance === "plus") { - return false; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } - } else if (clearing_tolerance === "plus") { - if (order_tolerance === "minus"){ - return true; - } else if (order_tolerance === "exact") { - return true; - } else if (order_tolerance === "plus") { - return true; - } else { - console.error("Could not determine order tolerance for buy deposit"); - } + const wasInClearingForBatch = ( + side_obj: any, + order_tolerance_obj: any, + clearing_tolerance_obj: any, + ) => { + const side = Object.keys(side_obj).at(0); + const order_tolerance = Object.keys(order_tolerance_obj).at(0); + const clearing_tolerance = Object.keys(clearing_tolerance_obj).at(0); + if (side == 'buy') { + if (clearing_tolerance === 'minus') { + if (order_tolerance === 'minus') { + return true; + } else if (order_tolerance === 'exact') { + return false; + } else if (order_tolerance === 'plus') { + return false; } else { console.error('Could not determine order tolerance for buy deposit'); } @@ -323,7 +302,7 @@ const Welcome: React.FC = () => { if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED) { for (let j = 0; j < userBatchLength; j++) { - try { + try { const depObject = ubots.value[batch.batch_number].at(j); const side = depObject.key.side; const value = depObject.value; @@ -457,7 +436,6 @@ const Welcome: React.FC = () => { return; } - for (let i = 0; i < Object.keys(userBatches.value).length; i++) { const batchId = Object.keys(userBatches.value).at(i); @@ -492,7 +470,6 @@ const Welcome: React.FC = () => { sum_of_holdings = sum_of_holdings + value; } setHasClearedHoldings(sum_of_holdings > 0); - }; const getBatches = async (storage: any) => { @@ -565,9 +542,9 @@ const Welcome: React.FC = () => { // eslint-disable-next-line @typescript-eslint/no-shadow console.info('rates', rates); console.info('tokenPair', tokenPair); - const rate = rates.filter((r) => r.key == tokenPair)[0].value; - const numerator = rate.rate.p; - const denominator = rate.rate.q; + const rt = rates.filter((r) => r.key == tokenPair)[0].value; + const numerator = rt.rate.p; + const denominator = rt.rate.q; const scaledPow = buyToken.decimals - sellToken.decimals; const scaledRate = scaleAmountUp(numerator / denominator, scaledPow); @@ -597,14 +574,11 @@ const Welcome: React.FC = () => { const getPairs = () => { const swps = []; - console.log('swap_map', tokenMap); for (const keyvalue of tokenMap) { console.log(keyvalue); swps.push(keyvalue[0]); } setSwaps(swps); - console.log('swps', swps); - console.log('swaps', swaps); }; const changeTokenPair = (e: RadioChangeEvent) => { @@ -618,19 +592,19 @@ const Welcome: React.FC = () => { // Set Sell Token Details setSellToken(swp.swap.to); - - }; + }; const generatePairs = () => { - return ( - <> - { - swaps.map((swp) => - - {swp} - - )} - + return ( + <> + {swaps.map((swp) => ( + + + {swp} + + + ))} + ); }; @@ -734,27 +708,32 @@ const Welcome: React.FC = () => { method: 'GET', }); - console.log('getTokenBalance-userAddress',usrAddr); - const balanceURI = REACT_APP_TZKT_URI_API + '/v1/tokens/balances?account=' + usrAddr; - console.log('getTokenBalance-balanceURI',balanceURI); - - const buyTokenData = await fetch(balanceURI + '&token.contract=' + buyToken.address, { method: 'GET' }); - const sellTokenData = await fetch(balanceURI + '&token.contract=' + sellToken.address, { method: 'GET' }); - - try{ - await buyTokenData.json().then(balance => { - if (Array.isArray(balance)) { - setTokenAmount(balance, buyBalance, buyToken.address, buyToken.decimals, setBuyBalance); - } - }); - } catch (error){ - console.error(error); - } - await sellTokenData.json().then(balance => { - if (Array.isArray(balance)) { - setTokenAmount(balance, sellBalance, sellToken.address, sellToken.decimals, setSellBalance); - } - }); + try { + await buyTokenData.json().then((balance) => { + if (Array.isArray(balance)) { + setTokenAmount( + balance, + buyBalance, + buyToken.address, + buyToken.decimals, + setBuyBalance, + ); + } + }); + } catch (error) { + console.error(error); + } + await sellTokenData.json().then((balance) => { + if (Array.isArray(balance)) { + setTokenAmount( + balance, + sellBalance, + sellToken.address, + sellToken.decimals, + setSellBalance, + ); + } + }); } } catch (error) { console.error('getTokenBalance-error', error); @@ -797,29 +776,25 @@ const Welcome: React.FC = () => { connection.on('bigmaps', (msg: any) => { if (!msg.data) return; - console.info("#######WS###### - bigmap", msg) + console.info('#######WS###### - bigmap', msg); for (let i = 0; i < Object.keys(msg.data).length; i++) { - try { - const m = msg.data[i]; - if (m.path == "batch_set.batches") { - const val = m.content.value; - const batch_number = val.batch_number; - const sts = Object.keys(val.status)[0]; - setStatusFromBatch(sts,m.content); - }; - - - if (m.path == "rates_current" ){ - updateRate(m); - }; + try { + const m = msg.data[i]; + if (m.path == 'batch_set.batches') { + const val = m.content.value; + const batch_number = val.batch_number; + const sts = Object.keys(val.status)[0]; + setStatusFromBatch(sts, m.content); + } + + if (m.path == 'rates_current') { + updateRate(m); + } } catch (error: any) { - console.error(error); + console.error(error); } } - } - ); - - + }); }; const refreshStorage = async () => { @@ -827,8 +802,8 @@ const Welcome: React.FC = () => { }; useEffect(() => { - refreshStorage().then(r => console.log(r)); - init_contract().then(r => console.log(r)); + refreshStorage().then((r) => console.log(r)); + init_contract().then((r) => console.log(r)); handleWebsocket(); }, []); @@ -842,9 +817,9 @@ const Welcome: React.FC = () => { }, [buyToken.address, sellToken.address, updateAll]); useEffect(() => { - console.log("User address changed - refreshing from storage") - refreshStorage().then(r => console.log(r)); - init_user(userAddress).then(r => console.log(r)); + console.log('User address changed - refreshing from storage'); + refreshStorage().then((r) => console.log(r)); + init_user(userAddress).then((r) => console.log(r)); }, [userAddress]); return ( From b080a25e6ece72e93c767cf0c5f6cc45f5250869 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Wed, 24 May 2023 17:34:24 +0100 Subject: [PATCH 064/108] Added batch number in info panel (#342) --- batcher-ui/src/components/BatcherInfo/index.tsx | 8 ++++++++ batcher-ui/src/extra_utils/types.ts | 1 + batcher-ui/src/pages/Main.tsx | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/batcher-ui/src/components/BatcherInfo/index.tsx b/batcher-ui/src/components/BatcherInfo/index.tsx index 57b958ec..b52aebde 100644 --- a/batcher-ui/src/components/BatcherInfo/index.tsx +++ b/batcher-ui/src/components/BatcherInfo/index.tsx @@ -22,6 +22,7 @@ const BatcherInfo: React.FC = ({ openTime, updateAll, setUpdateAll, + batchNumber, }: BatcherInfoProps) => { const { initialState } = useModel('@@initialState'); @@ -74,6 +75,13 @@ const BatcherInfo: React.FC = ({ ) : (
)} + { (batchNumber > 0) ? ( +
+ { 'Batch #' + batchNumber } +
+ ) : ( +
+ )} diff --git a/batcher-ui/src/extra_utils/types.ts b/batcher-ui/src/extra_utils/types.ts index 967b9672..35a710c7 100644 --- a/batcher-ui/src/extra_utils/types.ts +++ b/batcher-ui/src/extra_utils/types.ts @@ -201,6 +201,7 @@ export type BatcherInfoProps = { openTime: string; updateAll: boolean; setUpdateAll: Dispatch>; + batchNumber: number; }; export type BatcherActionProps = { diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 07dfa434..2a73f5bd 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -69,8 +69,10 @@ const Welcome: React.FC = () => { const [feeInMutez, setFeeInMutez] = useState(0); const [volumes, setVolumes] = useState(getEmptyVolumes()); const [updateAll, setUpdateAll] = useState(false); + const [batchNumber, setBatchNumber] = useState(0); const [hasClearedHoldings, setHasClearedHoldings] = useState(false); + const pullStorage = async () => { const storage = await contractsService.getStorage({ address: contractAddress, @@ -91,6 +93,7 @@ const Welcome: React.FC = () => { }; }; + const setStatusFromBatch = (sts: string, jsonData: any) => { try { if (sts === BatcherStatus.OPEN) { @@ -117,11 +120,14 @@ const Welcome: React.FC = () => { console.log('current_batch_number', currentBatchNumber); if (currentBatchNumber === 0) { + setBatchNumber(0); setStatus(BatcherStatus.NONE); const vols: Volumes = getEmptyVolumes(); setVolumes(vols); } else { - const currentBatchURI = bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; + setBatchNumber(currentBatchNumber); + const currentBatchURI = + bigMapsByIdUri + batchesBigMapId + '/keys/' + currentBatchNumber; console.log('######Volumes - URI', currentBatchURI); const data = await fetch(currentBatchURI, { method: 'GET', @@ -837,6 +843,7 @@ const Welcome: React.FC = () => { openTime={openTime} updateAll={updateAll} setUpdateAll={setUpdateAll} + batchNumber={batchNumber} />
From 01f758e0c351ef195d417cbb130c6bf9547919a6 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 26 May 2023 09:40:06 +0100 Subject: [PATCH 065/108] Added current and last to batch prefix --- batcher-ui/src/components/BatcherInfo/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/batcher-ui/src/components/BatcherInfo/index.tsx b/batcher-ui/src/components/BatcherInfo/index.tsx index b52aebde..a1d7e5f6 100644 --- a/batcher-ui/src/components/BatcherInfo/index.tsx +++ b/batcher-ui/src/components/BatcherInfo/index.tsx @@ -39,6 +39,15 @@ const BatcherInfo: React.FC = ({ triggerUpdate(); }, [status]); +const get_batch_prefix = () => { + + if(status == BatcherStatus.CLEARED){ + return "Last Batch "; + } + return "Current Batch "; + +}; + const get_time_difference = () => { if (status === BatcherStatus.OPEN && openTime) { const now = new Date(); @@ -77,7 +86,7 @@ const BatcherInfo: React.FC = ({ )} { (batchNumber > 0) ? (
- { 'Batch #' + batchNumber } + { get_batch_prefix() + '#' + batchNumber }
) : (
From 6173b67836e9e8a16d535e659b6fc00779beb11e Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Thu, 8 Jun 2023 13:05:56 +0300 Subject: [PATCH 066/108] Changed to use a reduced swap structure (name only) to reduce duplication in storage (#350) --- batcher/Makefile | 8 +- batcher/batcher-ghostnet.tz | 683 ++++++++++-------- batcher/batcher-mainnet.tz | 683 ++++++++++-------- batcher/batcher-storage-ghostnet.tz | 24 +- batcher/batcher-storage-mainnet.tz | 26 +- batcher/batcher.mligo | 340 ++++++--- .../storage/initial_storage_ghostnet.mligo | 40 +- batcher/storage/initial_storage_mainnet.mligo | 40 +- 8 files changed, 968 insertions(+), 876 deletions(-) diff --git a/batcher/Makefile b/batcher/Makefile index cbdcfb91..7c5478eb 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -1,11 +1,11 @@ .PHONY: test -LIGO_COMPILER_VERSION:=next -TEZOS_PROTOCOL:=lima +LIGO_COMPILER_VERSION:=0.66.0 +TEZOS_PROTOCOL:=mumbai LIGO_DOCKER := docker run --rm -v $(PWD):$(PWD) -w $(PWD) ligolang/ligo:$(LIGO_COMPILER_VERSION) define test_ligo - $(LIGO_DOCKER) run test $(1) + $(LIGO_DOCKER) run test $(1) endef define compile_contract @@ -74,4 +74,4 @@ test: measure: $(call measure_contract,batcher.mligo) install: - $(call install_deps) \ No newline at end of file + $(call install_deps) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 3e6c61f5..90d3b8b1 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -90,39 +90,11 @@ (nat %sell_side_total_cleared_volume) (nat %sell_side_volume_subject_to_clearing)) (pair %clearing_rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when)))) (pair %rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (pair %closed (timestamp %closing_time) (timestamp %start_time))) @@ -154,21 +126,7 @@ (big_map %metadata string bytes)) (pair (pair (big_map %rates_current string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (nat %scale_factor_for_oracle_staleness)) @@ -180,21 +138,7 @@ nat))) (map %valid_swaps string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision) @@ -623,12 +567,13 @@ GT ; IF { PUSH nat 126 ; FAILWITH } {} } ; DUP 3 ; - CAR ; - CAR ; + CDR ; GET 3 ; DIG 3 ; - CDR ; + CAR ; + CAR ; GET 3 ; + SWAP ; DUP 5 ; DUP 3 ; DUP 3 ; @@ -726,14 +671,38 @@ DUP 3 ; CAR ; DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; + PAIR ; SWAP ; + DUP 2 ; + CAR ; + DIG 2 ; CDR ; - GET 3 ; DIG 3 ; - DIG 4 ; + DUP 5 ; + GET 8 ; + DUP 6 ; + GET 7 ; + DUP 7 ; + GET 5 ; + DUP 8 ; + GET 3 ; + DIG 8 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; DUP 4 ; DUP 4 ; COMPARE ; @@ -933,15 +902,6 @@ CAR ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 2 ; - GET 3 ; - UPDATE 3 ; - DUP 2 ; - GET 5 ; - UPDATE 5 ; - DUP 2 ; - GET 6 ; - UPDATE 7 ; DUP ; GET 3 ; DUP 2 ; @@ -961,6 +921,15 @@ CDR ; CDR ; DIG 5 ; + DUP 7 ; + GET 3 ; + UPDATE 3 ; + DUP 7 ; + GET 5 ; + UPDATE 5 ; + DUP 7 ; + GET 6 ; + UPDATE 7 ; SOME ; DIG 6 ; CAR ; @@ -1030,10 +999,31 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 3 ; + CDR ; + CDR ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 2 ; DUP 2 ; CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + IF_LEFT { DROP } { DROP ; SWAP } ; SWAP ; - IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; PAIR ; NOW ; DUP 4 ; @@ -1132,14 +1122,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -1205,14 +1189,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -1270,14 +1248,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) ; + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; DUP 5 ; @@ -1443,12 +1415,12 @@ GET ; IF_NONE { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 4 ; + { DUP 5 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DROP 5 ; PUSH nat 110 ; FAILWITH } { DUP ; GET 8 ; DUP 4 ; @@ -1518,15 +1490,31 @@ AND ; AND ; AND ; - IF { DUP 7 ; + IF { DUP ; CDR ; + GET 3 ; + SWAP ; CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 8 ; CDR ; - DUP 5 ; - IF_LEFT - { DROP ; DUP 2 ; CDR ; DUP 3 ; CAR ; CAR } - { DROP ; DUP 2 ; CAR ; CAR ; DUP 3 ; CDR } ; + CAR ; + CDR ; + CDR ; + DUP 6 ; + IF_LEFT { DROP ; SWAP } { DROP ; DIG 2 } ; + DIG 2 ; GET 3 ; SWAP ; GET 3 ; @@ -1537,19 +1525,17 @@ IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; MEM ; - IF {} { DROP ; PUSH nat 110 ; FAILWITH } } - { DROP ; PUSH nat 110 ; FAILWITH } } } ; + IF {} { PUSH nat 110 ; FAILWITH } } + { DROP 2 ; PUSH nat 110 ; FAILWITH } } } ; PUSH bool False ; + DIG 2 ; DIG 3 ; - DIG 4 ; - DIG 11 ; + DIG 10 ; CAR ; - DIG 5 ; - DUP 8 ; - DUP 8 ; + DIG 4 ; + DUP 7 ; + DUP 7 ; PAIR 7 ; - SWAP ; - UPDATE 7 ; DUP 4 ; CDR ; CAR ; @@ -1978,18 +1964,25 @@ CAR ; CDR ; CAR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 2 ; - DUP 5 ; + DUP ; + DUP 4 ; GET ; IF_NONE - { DIG 5 ; DIG 6 ; DROP 2 ; SWAP } - { DUP 6 ; + { DIG 4 ; + DIG 5 ; + DROP 2 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + SWAP } + { DUP 5 ; + CDR ; + CDR ; + DUP 6 ; CAR ; CAR ; CAR ; CDR ; - DIG 2 ; + PAIR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 3 ; PAIR ; PAIR ; @@ -1997,14 +1990,16 @@ ITER { SWAP ; UNPAIR ; UNPAIR ; - DIG 3 ; + DIG 2 ; UNPAIR ; - DUP 5 ; + DIG 4 ; + UNPAIR ; + DUP 3 ; CDR ; DUP 2 ; GET ; IF_NONE - { DROP 2 } + { DROP 2 ; PAIR ; DUG 2 } { DUP ; GET 3 ; IF_LEFT @@ -2014,23 +2009,19 @@ NONE (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) } } + (pair (pair string string) (pair int int) timestamp)) } } { DROP ; NONE (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) } ; + (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 3 } - { SWAP ; + { DROP 3 ; PAIR ; DUG 2 } + { DUP 6 ; + DIG 2 ; GET 5 ; - DIG 5 ; + PAIR ; + DIG 7 ; DIG 2 ; PAIR ; PAIR ; @@ -2038,23 +2029,25 @@ ITER { SWAP ; UNPAIR ; UNPAIR ; - DIG 3 ; + DIG 2 ; + UNPAIR ; + DIG 4 ; UNPAIR ; PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 7 ; COMPARE ; EQ ; IF { PUSH bool False } { PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 14 ; COMPARE ; EQ ; IF { PUSH bool False } { DUP ; CDR ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 3 ; CAR ; @@ -2091,14 +2084,24 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } { DROP ; PUSH bool True } } } } } ; - IF { DUP 3 ; + IF { DUP 5 ; GET 6 ; CAR ; - SWAP ; + DUP 5 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 6 ; + DIG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; CAR ; IF_LEFT { DROP ; - DUP 3 ; + DUP 6 ; GET 5 ; DUP ; GET 5 ; @@ -2106,7 +2109,7 @@ SWAP ; GET 3 ; INT ; - DIG 3 ; + DIG 4 ; INT ; PUSH int 1 ; SWAP ; @@ -2139,7 +2142,7 @@ CAR ; MUL ; PAIR ; - DUP 4 ; + DUP 7 ; GET 6 ; GET 3 ; DUP ; @@ -2182,7 +2185,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 17 ; + DUP 20 ; SWAP ; EXEC ; DIG 2 ; @@ -2193,15 +2196,14 @@ CAR ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 3 ; - CDR ; + DIG 2 ; PAIR ; PUSH nat 0 ; DUP 2 ; CDR ; COMPARE ; GT ; - IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2230,7 +2232,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC ; DIG 2 ; @@ -2242,16 +2244,14 @@ ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; DIG 2 ; - CAR ; - CAR ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } { DROP ; - DUP 3 ; + DUP 6 ; GET 5 ; DUP ; CAR ; @@ -2259,7 +2259,7 @@ SWAP ; GET 6 ; INT ; - DIG 3 ; + DIG 4 ; INT ; PUSH int 1 ; SWAP ; @@ -2292,7 +2292,7 @@ CAR ; MUL ; PAIR ; - DUP 4 ; + DUP 7 ; GET 6 ; GET 3 ; DUP ; @@ -2335,7 +2335,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 17 ; + DUP 20 ; SWAP ; EXEC ; DIG 2 ; @@ -2346,16 +2346,14 @@ CAR ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 3 ; - CAR ; - CAR ; + DIG 3 ; PAIR ; PUSH nat 0 ; DUP 2 ; CDR ; COMPARE ; GT ; - IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2384,7 +2382,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC ; DIG 2 ; @@ -2396,27 +2394,39 @@ ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; DIG 2 ; - CDR ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } } - { DIG 3 ; - DUP 4 ; + { DUP 5 ; GET 6 ; CAR ; - DIG 3 ; - DIG 3 ; + SWAP ; CAR ; - IF_LEFT { DROP ; SWAP ; CAR ; CAR } { DROP ; SWAP ; CDR } ; + IF_LEFT + { DROP ; + DUP 4 ; + SWAP ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } + { DROP ; + DUP 4 ; + SWAP ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; + DIG 5 ; + DUG 2 ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } ; - DIG 2 ; + DUG 2 ; + PAIR ; SWAP ; DIG 2 ; PAIR ; @@ -2424,6 +2434,8 @@ CAR ; CDR ; DIG 3 ; + DIG 3 ; + PAIR ; SWAP ; DIG 3 ; DIG 3 ; @@ -2576,14 +2588,19 @@ CDR ; DUP 2 ; CAR ; - DUP 2 ; - DUP 2 ; + DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; + PAIR ; + DUP 2 ; + DUP 2 ; + CAR ; DIG 2 ; CDR ; - GET 3 ; DUP 2 ; DUP 2 ; COMPARE ; @@ -2599,66 +2616,78 @@ CDR ; DIG 2 ; CAR ; - DIG 2 ; - DUP 2 ; + DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; - DUP 3 ; - CDR ; - GET 3 ; - DUP 2 ; + PAIR ; + DUP ; + CAR ; DUP 2 ; + CDR ; + DIG 4 ; + DUP 3 ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - NONE (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - address - string - nat - bool) ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + NONE (pair (pair string string) address string nat bool) ; SWAP ; UPDATE ; - DUP 2 ; - CAR ; + DUP 3 ; + DUP 3 ; CAR ; - DIG 2 ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 3 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; PUSH bool False ; DUP 4 ; ITER { CDR ; CAR ; - SWAP ; + DUP 6 ; DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 7 ; + DIG 2 ; CAR ; - CAR ; - DUP ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 3 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 4 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 5 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 5 ; CAR ; DUP 9 ; CAR ; @@ -2668,33 +2697,31 @@ AND ; AND ; AND ; - DIG 2 ; - CDR ; - DUP ; + DUP 3 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 4 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 5 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 6 ; CAR ; DUP 9 ; CAR ; @@ -2758,35 +2785,42 @@ DUP 4 ; ITER { CDR ; CAR ; - SWAP ; + DUP 3 ; DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 2 ; CAR ; - CAR ; - DUP ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 3 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 4 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 5 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 5 ; CAR ; DUP 9 ; CAR ; @@ -2796,33 +2830,31 @@ AND ; AND ; AND ; - DIG 2 ; - CDR ; - DUP ; + DUP 3 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 4 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 5 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 6 ; CAR ; DUP 9 ; CAR ; @@ -2917,9 +2949,56 @@ GET ; IF_NONE { DROP 5 ; PUSH nat 117 ; FAILWITH } - { DUP ; + { DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; GET 5 ; VIEW "getPrice" (pair timestamp nat) ; IF_NONE { PUSH nat 122 ; FAILWITH } {} ; @@ -2959,9 +3038,12 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; + DUP 5 ; + CDR ; + CDR ; + DUP 4 ; CAR ; - DIG 3 ; + DIG 4 ; GET 7 ; DUP ; DUP 3 ; @@ -2977,10 +3059,10 @@ SUB ; PUSH int 10 ; PAIR ; - DUP 7 ; + DUP 8 ; SWAP ; EXEC ; - DIG 3 ; + DIG 4 ; MUL ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; @@ -2991,11 +3073,11 @@ INT ; PUSH int 10 ; PAIR ; - DUP 7 ; + DUP 8 ; SWAP ; EXEC ; SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + { INT ; PUSH int 10 ; PAIR ; DUP 8 ; SWAP ; EXEC ; DIG 4 } ; INT ; PUSH int 1 ; DIG 2 ; @@ -3014,18 +3096,32 @@ CAR ; MUL ; PAIR ; - DIG 2 ; + DIG 3 ; SWAP ; - DIG 2 ; - PAIR 3 ; - DUP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; CAR ; CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP ; CAR ; - GET 7 ; + DUP 3 ; DUP 2 ; CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 3 ; + DIG 2 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; GET 7 ; SUB ; DUP ; @@ -3104,10 +3200,26 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 2 ; - DUP 2 ; + DUP ; + CDR ; + CDR ; + DUP 3 ; CAR ; UNIT ; LEFT unit ; + DUP 3 ; + DUP 3 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 3 ; + DIG 3 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + IF_LEFT { DROP } { DROP ; SWAP } ; + SWAP ; PAIR ; NOW ; DUP 3 ; @@ -3115,20 +3227,16 @@ CAR ; CAR ; CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; - PAIR ; DUP 4 ; CAR ; CAR ; CDR ; CAR ; - DUP 3 ; + DUP 2 ; CDR ; - DUP 4 ; + DUP 3 ; CAR ; - DUP 4 ; + DUP 6 ; UNPAIR ; GET 3 ; SWAP ; @@ -3143,20 +3251,15 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DROP 2 ; + { DIG 3 ; + DROP 2 ; NONE (pair nat (or (or (pair (pair timestamp (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) @@ -3174,12 +3277,12 @@ IF_LEFT { DROP 2 ; PUSH nat 0 ; - DUP 3 ; + DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - SWAP ; + DIG 3 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -3195,14 +3298,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -3234,8 +3331,8 @@ { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; + { DIG 4 ; DROP 2 ; SWAP } } + { DIG 5 ; DROP ; DUP 3 ; INT ; @@ -3262,14 +3359,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) ; + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; DUP 2 ; @@ -3817,21 +3908,7 @@ view "get_valid_swaps" unit (map string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision) @@ -3861,39 +3938,11 @@ (nat %sell_side_total_cleared_volume) (nat %sell_side_volume_subject_to_clearing)) (pair %clearing_rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when)))) (pair %rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (pair %closed (timestamp %closing_time) (timestamp %start_time))) @@ -3924,14 +3973,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) diff --git a/batcher/batcher-mainnet.tz b/batcher/batcher-mainnet.tz index 3e6c61f5..90d3b8b1 100644 --- a/batcher/batcher-mainnet.tz +++ b/batcher/batcher-mainnet.tz @@ -90,39 +90,11 @@ (nat %sell_side_total_cleared_volume) (nat %sell_side_volume_subject_to_clearing)) (pair %clearing_rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when)))) (pair %rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (pair %closed (timestamp %closing_time) (timestamp %start_time))) @@ -154,21 +126,7 @@ (big_map %metadata string bytes)) (pair (pair (big_map %rates_current string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (nat %scale_factor_for_oracle_staleness)) @@ -180,21 +138,7 @@ nat))) (map %valid_swaps string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision) @@ -623,12 +567,13 @@ GT ; IF { PUSH nat 126 ; FAILWITH } {} } ; DUP 3 ; - CAR ; - CAR ; + CDR ; GET 3 ; DIG 3 ; - CDR ; + CAR ; + CAR ; GET 3 ; + SWAP ; DUP 5 ; DUP 3 ; DUP 3 ; @@ -726,14 +671,38 @@ DUP 3 ; CAR ; DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; + PAIR ; SWAP ; + DUP 2 ; + CAR ; + DIG 2 ; CDR ; - GET 3 ; DIG 3 ; - DIG 4 ; + DUP 5 ; + GET 8 ; + DUP 6 ; + GET 7 ; + DUP 7 ; + GET 5 ; + DUP 8 ; + GET 3 ; + DIG 8 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; DUP 4 ; DUP 4 ; COMPARE ; @@ -933,15 +902,6 @@ CAR ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 2 ; - GET 3 ; - UPDATE 3 ; - DUP 2 ; - GET 5 ; - UPDATE 5 ; - DUP 2 ; - GET 6 ; - UPDATE 7 ; DUP ; GET 3 ; DUP 2 ; @@ -961,6 +921,15 @@ CDR ; CDR ; DIG 5 ; + DUP 7 ; + GET 3 ; + UPDATE 3 ; + DUP 7 ; + GET 5 ; + UPDATE 5 ; + DUP 7 ; + GET 6 ; + UPDATE 7 ; SOME ; DIG 6 ; CAR ; @@ -1030,10 +999,31 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 3 ; + CDR ; + CDR ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 2 ; DUP 2 ; CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + IF_LEFT { DROP } { DROP ; SWAP } ; SWAP ; - IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; PAIR ; NOW ; DUP 4 ; @@ -1132,14 +1122,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -1205,14 +1189,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -1270,14 +1248,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) ; + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; DUP 5 ; @@ -1443,12 +1415,12 @@ GET ; IF_NONE { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 4 ; + { DUP 5 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DROP 5 ; PUSH nat 110 ; FAILWITH } { DUP ; GET 8 ; DUP 4 ; @@ -1518,15 +1490,31 @@ AND ; AND ; AND ; - IF { DUP 7 ; + IF { DUP ; CDR ; + GET 3 ; + SWAP ; CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 8 ; CDR ; - DUP 5 ; - IF_LEFT - { DROP ; DUP 2 ; CDR ; DUP 3 ; CAR ; CAR } - { DROP ; DUP 2 ; CAR ; CAR ; DUP 3 ; CDR } ; + CAR ; + CDR ; + CDR ; + DUP 6 ; + IF_LEFT { DROP ; SWAP } { DROP ; DIG 2 } ; + DIG 2 ; GET 3 ; SWAP ; GET 3 ; @@ -1537,19 +1525,17 @@ IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; MEM ; - IF {} { DROP ; PUSH nat 110 ; FAILWITH } } - { DROP ; PUSH nat 110 ; FAILWITH } } } ; + IF {} { PUSH nat 110 ; FAILWITH } } + { DROP 2 ; PUSH nat 110 ; FAILWITH } } } ; PUSH bool False ; + DIG 2 ; DIG 3 ; - DIG 4 ; - DIG 11 ; + DIG 10 ; CAR ; - DIG 5 ; - DUP 8 ; - DUP 8 ; + DIG 4 ; + DUP 7 ; + DUP 7 ; PAIR 7 ; - SWAP ; - UPDATE 7 ; DUP 4 ; CDR ; CAR ; @@ -1978,18 +1964,25 @@ CAR ; CDR ; CAR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 2 ; - DUP 5 ; + DUP ; + DUP 4 ; GET ; IF_NONE - { DIG 5 ; DIG 6 ; DROP 2 ; SWAP } - { DUP 6 ; + { DIG 4 ; + DIG 5 ; + DROP 2 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + SWAP } + { DUP 5 ; + CDR ; + CDR ; + DUP 6 ; CAR ; CAR ; CAR ; CDR ; - DIG 2 ; + PAIR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 3 ; PAIR ; PAIR ; @@ -1997,14 +1990,16 @@ ITER { SWAP ; UNPAIR ; UNPAIR ; - DIG 3 ; + DIG 2 ; UNPAIR ; - DUP 5 ; + DIG 4 ; + UNPAIR ; + DUP 3 ; CDR ; DUP 2 ; GET ; IF_NONE - { DROP 2 } + { DROP 2 ; PAIR ; DUG 2 } { DUP ; GET 3 ; IF_LEFT @@ -2014,23 +2009,19 @@ NONE (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) } } + (pair (pair string string) (pair int int) timestamp)) } } { DROP ; NONE (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) } ; + (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 3 } - { SWAP ; + { DROP 3 ; PAIR ; DUG 2 } + { DUP 6 ; + DIG 2 ; GET 5 ; - DIG 5 ; + PAIR ; + DIG 7 ; DIG 2 ; PAIR ; PAIR ; @@ -2038,23 +2029,25 @@ ITER { SWAP ; UNPAIR ; UNPAIR ; - DIG 3 ; + DIG 2 ; + UNPAIR ; + DIG 4 ; UNPAIR ; PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 7 ; COMPARE ; EQ ; IF { PUSH bool False } { PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 14 ; COMPARE ; EQ ; IF { PUSH bool False } { DUP ; CDR ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 3 ; CAR ; @@ -2091,14 +2084,24 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } { DROP ; PUSH bool True } } } } } ; - IF { DUP 3 ; + IF { DUP 5 ; GET 6 ; CAR ; - SWAP ; + DUP 5 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 6 ; + DIG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; CAR ; IF_LEFT { DROP ; - DUP 3 ; + DUP 6 ; GET 5 ; DUP ; GET 5 ; @@ -2106,7 +2109,7 @@ SWAP ; GET 3 ; INT ; - DIG 3 ; + DIG 4 ; INT ; PUSH int 1 ; SWAP ; @@ -2139,7 +2142,7 @@ CAR ; MUL ; PAIR ; - DUP 4 ; + DUP 7 ; GET 6 ; GET 3 ; DUP ; @@ -2182,7 +2185,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 17 ; + DUP 20 ; SWAP ; EXEC ; DIG 2 ; @@ -2193,15 +2196,14 @@ CAR ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 3 ; - CDR ; + DIG 2 ; PAIR ; PUSH nat 0 ; DUP 2 ; CDR ; COMPARE ; GT ; - IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2230,7 +2232,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC ; DIG 2 ; @@ -2242,16 +2244,14 @@ ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; DIG 2 ; - CAR ; - CAR ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } { DROP ; - DUP 3 ; + DUP 6 ; GET 5 ; DUP ; CAR ; @@ -2259,7 +2259,7 @@ SWAP ; GET 6 ; INT ; - DIG 3 ; + DIG 4 ; INT ; PUSH int 1 ; SWAP ; @@ -2292,7 +2292,7 @@ CAR ; MUL ; PAIR ; - DUP 4 ; + DUP 7 ; GET 6 ; GET 3 ; DUP ; @@ -2335,7 +2335,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 17 ; + DUP 20 ; SWAP ; EXEC ; DIG 2 ; @@ -2346,16 +2346,14 @@ CAR ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 3 ; - CAR ; - CAR ; + DIG 3 ; PAIR ; PUSH nat 0 ; DUP 2 ; CDR ; COMPARE ; GT ; - IF { DIG 4 ; SWAP ; PAIR ; DUP 13 ; SWAP ; EXEC } { DROP ; DIG 3 } ; + IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2384,7 +2382,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC ; DIG 2 ; @@ -2396,27 +2394,39 @@ ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; DIG 2 ; - CDR ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } } - { DIG 3 ; - DUP 4 ; + { DUP 5 ; GET 6 ; CAR ; - DIG 3 ; - DIG 3 ; + SWAP ; CAR ; - IF_LEFT { DROP ; SWAP ; CAR ; CAR } { DROP ; SWAP ; CDR } ; + IF_LEFT + { DROP ; + DUP 4 ; + SWAP ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } + { DROP ; + DUP 4 ; + SWAP ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; + DIG 5 ; + DUG 2 ; PAIR ; PAIR ; - DUP 11 ; + DUP 13 ; SWAP ; EXEC } ; - DIG 2 ; + DUG 2 ; + PAIR ; SWAP ; DIG 2 ; PAIR ; @@ -2424,6 +2434,8 @@ CAR ; CDR ; DIG 3 ; + DIG 3 ; + PAIR ; SWAP ; DIG 3 ; DIG 3 ; @@ -2576,14 +2588,19 @@ CDR ; DUP 2 ; CAR ; - DUP 2 ; - DUP 2 ; + DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; + PAIR ; + DUP 2 ; + DUP 2 ; + CAR ; DIG 2 ; CDR ; - GET 3 ; DUP 2 ; DUP 2 ; COMPARE ; @@ -2599,66 +2616,78 @@ CDR ; DIG 2 ; CAR ; - DIG 2 ; - DUP 2 ; + DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; GET 3 ; - DUP 3 ; - CDR ; - GET 3 ; - DUP 2 ; + PAIR ; + DUP ; + CAR ; DUP 2 ; + CDR ; + DIG 4 ; + DUP 3 ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - NONE (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - address - string - nat - bool) ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + NONE (pair (pair string string) address string nat bool) ; SWAP ; UPDATE ; - DUP 2 ; - CAR ; + DUP 3 ; + DUP 3 ; CAR ; - DIG 2 ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 3 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; PUSH bool False ; DUP 4 ; ITER { CDR ; CAR ; - SWAP ; + DUP 6 ; DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 7 ; + DIG 2 ; CAR ; - CAR ; - DUP ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 3 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 4 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 5 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 5 ; CAR ; DUP 9 ; CAR ; @@ -2668,33 +2697,31 @@ AND ; AND ; AND ; - DIG 2 ; - CDR ; - DUP ; + DUP 3 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 4 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 5 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 6 ; CAR ; DUP 9 ; CAR ; @@ -2758,35 +2785,42 @@ DUP 4 ; ITER { CDR ; CAR ; - SWAP ; + DUP 3 ; DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 2 ; CAR ; - CAR ; - DUP ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 3 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 4 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 5 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 5 ; CAR ; DUP 9 ; CAR ; @@ -2796,33 +2830,31 @@ AND ; AND ; AND ; - DIG 2 ; - CDR ; - DUP ; + DUP 3 ; GET 8 ; DUP 6 ; GET 8 ; COMPARE ; EQ ; - DUP 2 ; + DUP 4 ; GET 7 ; DUP 7 ; GET 7 ; COMPARE ; EQ ; - DUP 3 ; + DUP 5 ; GET 5 ; DUP 8 ; GET 5 ; COMPARE ; EQ ; - DUP 4 ; + DUP 6 ; GET 3 ; DUP 9 ; GET 3 ; COMPARE ; EQ ; - DIG 4 ; + DIG 6 ; CAR ; DUP 9 ; CAR ; @@ -2917,9 +2949,56 @@ GET ; IF_NONE { DROP 5 ; PUSH nat 117 ; FAILWITH } - { DUP ; + { DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; GET 5 ; VIEW "getPrice" (pair timestamp nat) ; IF_NONE { PUSH nat 122 ; FAILWITH } {} ; @@ -2959,9 +3038,12 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; + DUP 5 ; + CDR ; + CDR ; + DUP 4 ; CAR ; - DIG 3 ; + DIG 4 ; GET 7 ; DUP ; DUP 3 ; @@ -2977,10 +3059,10 @@ SUB ; PUSH int 10 ; PAIR ; - DUP 7 ; + DUP 8 ; SWAP ; EXEC ; - DIG 3 ; + DIG 4 ; MUL ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; @@ -2991,11 +3073,11 @@ INT ; PUSH int 10 ; PAIR ; - DUP 7 ; + DUP 8 ; SWAP ; EXEC ; SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + { INT ; PUSH int 10 ; PAIR ; DUP 8 ; SWAP ; EXEC ; DIG 4 } ; INT ; PUSH int 1 ; DIG 2 ; @@ -3014,18 +3096,32 @@ CAR ; MUL ; PAIR ; - DIG 2 ; + DIG 3 ; SWAP ; - DIG 2 ; - PAIR 3 ; - DUP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; CAR ; CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP ; CAR ; - GET 7 ; + DUP 3 ; DUP 2 ; CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 3 ; + DIG 2 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; GET 7 ; SUB ; DUP ; @@ -3104,10 +3200,26 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 2 ; - DUP 2 ; + DUP ; + CDR ; + CDR ; + DUP 3 ; CAR ; UNIT ; LEFT unit ; + DUP 3 ; + DUP 3 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 3 ; + DIG 3 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + IF_LEFT { DROP } { DROP ; SWAP } ; + SWAP ; PAIR ; NOW ; DUP 3 ; @@ -3115,20 +3227,16 @@ CAR ; CAR ; CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP ; UNPAIR ; CAR } { DROP ; DUP ; CAR ; CAR ; SWAP ; CDR } ; - PAIR ; DUP 4 ; CAR ; CAR ; CDR ; CAR ; - DUP 3 ; + DUP 2 ; CDR ; - DUP 4 ; + DUP 3 ; CAR ; - DUP 4 ; + DUP 6 ; UNPAIR ; GET 3 ; SWAP ; @@ -3143,20 +3251,15 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DROP 2 ; + { DIG 3 ; + DROP 2 ; NONE (pair nat (or (or (pair (pair timestamp (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) @@ -3174,12 +3277,12 @@ IF_LEFT { DROP 2 ; PUSH nat 0 ; - DUP 3 ; + DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - SWAP ; + DIG 3 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -3195,14 +3298,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; DIG 3 ; PAIR 4 ; @@ -3234,8 +3331,8 @@ { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; + { DIG 4 ; DROP 2 ; SWAP } } + { DIG 5 ; DROP ; DUP 3 ; INT ; @@ -3262,14 +3359,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) ; + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; DUP 2 ; @@ -3817,21 +3908,7 @@ view "get_valid_swaps" unit (map string - (pair (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair (pair %swap (string %from) (string %to)) (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision) @@ -3861,39 +3938,11 @@ (nat %sell_side_total_cleared_volume) (nat %sell_side_volume_subject_to_clearing)) (pair %clearing_rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when)))) (pair %rate - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) + (pair %swap (string %from) (string %to)) (pair %rate (int %p) (int %q)) (timestamp %when))) (pair %closed (timestamp %closing_time) (timestamp %start_time))) @@ -3924,14 +3973,8 @@ (pair (pair nat nat nat) (or (or unit unit) unit) (pair nat nat nat nat) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp))) - (pair (pair (pair (pair nat string (option address) nat (option string)) nat) - (pair nat string (option address) nat (option string))) - (pair int int) - timestamp)) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index b837e60e..7b272f77 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -5,29 +5,9 @@ (Pair (Pair {} 1) {} { Elt "tzBTC/EURL" - (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) - 1) - 0 - "EURL" - (Some "KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5") - 6 - (Some "FA2 token")) - "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" - "BTC-EUR" - 6 - False) ; + (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; Elt "tzBTC/USDT" - (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) - 1) - 0 - "USDT" - (Some "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm") - 6 - (Some "FA2 token")) - "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" - "BTC-USDT" - 6 - False) }) + (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) }) { Elt "EURL" (Pair 0 "EURL" (Some "KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5") 6 (Some "FA2 token")) ; Elt "USDT" (Pair 0 "USDT" (Some "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm") 6 (Some "FA2 token")) ; Elt "tzBTC" diff --git a/batcher/batcher-storage-mainnet.tz b/batcher/batcher-storage-mainnet.tz index 395cdef0..b59361b9 100644 --- a/batcher/batcher-storage-mainnet.tz +++ b/batcher/batcher-storage-mainnet.tz @@ -5,31 +5,11 @@ (Pair (Pair {} 1) {} { Elt "tzBTC/EURL" - (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) - 1) - 0 - "EURL" - (Some "KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8") - 6 - (Some "FA2 token")) - "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" - "BTC-EUR" - 6 - False) ; + (Pair (Pair "tzBTC" "EURL") "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" "BTC-EUR" 6 False) ; Elt "tzBTC/USDT" - (Pair (Pair (Pair (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) - 1) - 0 - "USDT" - (Some "tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp") - 6 - (Some "FA2 token")) - "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" - "BTC-USDT" - 6 - False) }) + (Pair (Pair "tzBTC" "USDT") "KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG" "BTC-USDT" 6 False) }) { Elt "EURL" (Pair 0 "EURL" (Some "KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8") 6 (Some "FA2 token")) ; - Elt "USDT" (Pair 0 "USDT" (Some "tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp") 6 (Some "FA2 token")) ; + Elt "USDT" (Pair 0 "USDT" (Some "KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o") 6 (Some "FA2 token")) ; Elt "tzBTC" (Pair 0 "tzBTC" (Some "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn") 8 (Some "FA1.2 token")) }) diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index ebba391f..4e7102a6 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -39,6 +39,7 @@ [@inline] let cannot_update_scale_factor_to_less_than_the_minimum : nat = 135n [@inline] let cannot_update_scale_factor_to_more_than_the_maximum : nat = 136n [@inline] let cannot_remove_swap_pair_that_is_not_disabled : nat = 137n +[@inline] let token_name_not_in_list_of_valid_tokens : nat = 138n (* Constants *) @@ -114,6 +115,19 @@ type swap = [@layout:comb] { to : token; } +type swap_reduced = [@layout:comb] { + from: string; + to: string; +} + +(* A valid swap is a swap pair that has a source of pricing from an oracle. *) +type valid_swap_reduced = [@layout:comb] { + swap: swap_reduced; + oracle_address: address; + oracle_asset_name: string; + oracle_precision: nat; + is_disabled_for_deposits: bool; +} (* A valid swap is a swap pair that has a source of pricing from an oracle. *) type valid_swap = [@layout:comb] { swap: swap; @@ -123,10 +137,14 @@ type valid_swap = [@layout:comb] { is_disabled_for_deposits: bool; } +type exchange_rate_full = [@layout:comb] { + swap : swap; + rate: Rational.t; + when : timestamp; +} -(*I change the type of the rate from tez to nat for sake of simplicity*) type exchange_rate = [@layout:comb] { - swap : swap; + swap : swap_reduced; rate: Rational.t; when : timestamp; } @@ -257,24 +275,40 @@ type oracle_source_change = [@layout:comb] { oracle_precision: nat; } -module TokenAmount = struct +(* The tokens that are valid within the contract *) +type valid_tokens = (string, token) map + +(* The swaps of valid tokens that are accepted by the contract *) +type valid_swaps = (string, valid_swap_reduced) map +(* The current, most up to date exchange rates between tokens *) +type rates_current = (string, exchange_rate) big_map + +[@inline] +let get_token + (token_name: string) + (tokens: valid_tokens): token = + let tok_opt = Map.find_opt token_name tokens in + match tok_opt with + | Some t -> t + | None -> failwith unable_to_reduce_token_amount_to_less_than_zero + +module TokenAmount = struct let recover (ot: ordertype) (amt: nat) - (c: clearing): token_amount = + (c: clearing) + (tokens: valid_tokens): token_amount = let swap = c.clearing_rate.swap in let token = match ot.side with - | Buy -> swap.from.token - | Sell -> swap.to + | Buy -> get_token swap.from tokens + | Sell -> get_token swap.to tokens in { token = token; amount = amt; } - - end module TokenAmountMap = struct @@ -306,14 +340,6 @@ module TokenAmountMap = struct end module Storage = struct - (* The tokens that are valid within the contract *) - type valid_tokens = (string, token) map - - (* The swaps of valid tokens that are accepted by the contract *) - type valid_swaps = (string, valid_swap) map - - (* The current, most up to date exchange rates between tokens *) - type rates_current = (string, exchange_rate) big_map type t = { @@ -338,6 +364,57 @@ end module Utils = struct +[@inline] +let swap_to_swap_reduced + (swap: swap): swap_reduced = + { + from = swap.from.token.name; + to = swap.to.name; + } + +[@inline] +let valid_swap_to_valid_swap_reduced + (valid_swap: valid_swap) : valid_swap_reduced = + let swap_reduced = swap_to_swap_reduced valid_swap.swap in + { + swap = swap_reduced; + oracle_address = valid_swap.oracle_address; + oracle_asset_name = valid_swap.oracle_asset_name; + oracle_precision = valid_swap.oracle_precision; + is_disabled_for_deposits = valid_swap.is_disabled_for_deposits; + } + +[@inline] +let swap_reduced_to_swap + (swap_reduced: swap_reduced) + (from_amount: nat) + (tokens: valid_tokens) : swap = + let from = get_token swap_reduced.from tokens in + let to = get_token swap_reduced.to tokens in + { + from = { + token = from; + amount = from_amount; + }; + to = to; + } + + +[@inline] +let valid_swap_reduced_to_valid_swap + (valid_swap_reduced: valid_swap_reduced) + (from_amount: nat) + (tokens: valid_tokens) : valid_swap = + let swap = swap_reduced_to_swap valid_swap_reduced.swap from_amount tokens in + { + swap = swap; + oracle_address = valid_swap_reduced.oracle_address; + oracle_precision = valid_swap_reduced.oracle_precision; + oracle_asset_name = valid_swap_reduced.oracle_asset_name; + is_disabled_for_deposits = valid_swap_reduced.is_disabled_for_deposits; + } + + [@inline] let empty_total_cleared_volumes : total_cleared_volumes = { buy_side_total_cleared_volume = 0n; @@ -345,6 +422,7 @@ let empty_total_cleared_volumes : total_cleared_volumes = { sell_side_total_cleared_volume = 0n; sell_side_volume_subject_to_clearing = 0n; } + [@inline] let to_nat (i:int): nat = match is_nat i with @@ -373,18 +451,18 @@ let get_min_number (a : Rational.t) (b : Rational.t) = else b [@inline] -let get_clearing_tolerance - (cp_minus : Rational.t) - (cp_exact : Rational.t) +let get_clearing_tolerance + (cp_minus : Rational.t) + (cp_exact : Rational.t) (cp_plus : Rational.t) : tolerance = if gte cp_minus cp_exact && gte cp_minus cp_plus then Minus else if gte cp_exact cp_minus && gte cp_exact cp_plus then Exact else Plus [@inline] -let get_cp_minus - (rate : Rational.t) - (buy_side : buy_side) +let get_cp_minus + (rate : Rational.t) + (buy_side : buy_side) (sell_side : sell_side) : Rational.t = let buy_minus_token, _, _ = buy_side in let sell_minus_token, sell_exact_token, sell_plus_token = sell_side in @@ -394,9 +472,9 @@ let get_cp_minus min_number [@inline] -let get_cp_exact - (rate : Rational.t) - (buy_side : buy_side) +let get_cp_exact + (rate : Rational.t) + (buy_side : buy_side) (sell_side : sell_side) : Rational.t = let buy_minus_token, buy_exact_token, _ = buy_side in let _, sell_exact_token, sell_plus_token = sell_side in @@ -406,9 +484,9 @@ let get_cp_exact min_number [@inline] -let get_cp_plus - (rate : Rational.t) - (buy_side : buy_side) +let get_cp_plus + (rate : Rational.t) + (buy_side : buy_side) (sell_side : sell_side) : Rational.t = let buy_minus_token, buy_exact_token, buy_plus_token = buy_side in let _, _, sell_plus_token = sell_side in @@ -466,9 +544,9 @@ let find_lexicographical_pair_name token_two_name ^ "/" ^ token_one_name [@inline] -let get_rate_name_from_swap (s : swap) : string = - let base_name = s.from.token.name in - let quote_name = s.to.name in +let get_rate_name_from_swap (s : swap_reduced) : string = + let base_name = s.from in + let quote_name = s.to in find_lexicographical_pair_name quote_name base_name [@inline] @@ -486,28 +564,37 @@ let get_inverse_rate_name_from_pair (s : token * token) : string = find_lexicographical_pair_name quote_name base_name [@inline] -let get_rate_name (r : exchange_rate) : string = - let base_name = r.swap.from.token.name in - let quote_name = r.swap.to.name in +let get_rate_name + (r : exchange_rate): string = + let base_name = r.swap.from in + let quote_name = r.swap.to in find_lexicographical_pair_name quote_name base_name [@inline] let pair_of_swap (side: side) - (swap: swap): (token * token) = + (swap: swap_reduced) + (tokens: valid_tokens): (token * token) = + let from_token = get_token swap.from tokens in + let to_token = get_token swap.to tokens in match side with - | Buy -> swap.from.token, swap.to - | Sell -> swap.to, swap.from.token + | Buy -> from_token, to_token + | Sell -> to_token, from_token [@inline] -let pair_of_rate (r : exchange_rate) : (token * token) = pair_of_swap Buy r.swap +let pair_of_rate + (r : exchange_rate) + (tokens: valid_tokens): (token * token) = pair_of_swap Buy r.swap tokens [@inline] -let pair_of_external_swap (order : external_swap_order) : (token * token) = +let pair_of_external_swap + (order : external_swap_order) + (tokens: valid_tokens): (token * token) = (* Note: we assume left-handedness - i.e. direction is buy side*) let swap = order.swap in let side = nat_to_side order.side in - pair_of_swap side swap + let swap_reduced = swap_to_swap_reduced swap in + pair_of_swap side swap_reduced tokens [@inline] let get_current_batch_index @@ -541,7 +628,7 @@ let rev1 (type a) (list: a list) : a list = let update_if_more_recent (rate_name: string) (rate: exchange_rate) - (rates_current: Storage.rates_current) : Storage.rates_current = + (rates_current: rates_current) : rates_current = match Big_map.find_opt rate_name rates_current with | None -> Big_map.add rate_name rate rates_current | Some lr -> if rate.when > lr.when then @@ -555,9 +642,14 @@ let update_current_rate (rate_name : string) (rate : exchange_rate) (storage : S { storage with rates_current = updated_rates } [@inline] -let get_rate_scaling_power_of_10 (rate : exchange_rate) : Rational.t = - let from_decimals = rate.swap.from.token.decimals in - let to_decimals = rate.swap.to.decimals in +let get_rate_scaling_power_of_10 + (rate : exchange_rate) + (tokens: valid_tokens): Rational.t = + let swap = rate.swap in + let from_token = get_token swap.from tokens in + let to_token = get_token swap.to tokens in + let from_decimals = from_token.decimals in + let to_decimals = to_token.decimals in let diff = to_decimals - from_decimals in let abs_diff = int (abs diff) in let power10 = pow 10 abs_diff in @@ -570,8 +662,10 @@ let get_rate_scaling_power_of_10 (rate : exchange_rate) : Rational.t = (Rational.new power10) [@inline] -let scale_on_receive_for_token_precision_difference (rate : exchange_rate) : exchange_rate = - let scaling_rate = get_rate_scaling_power_of_10 (rate) in +let scale_on_receive_for_token_precision_difference + (rate : exchange_rate) + (tokens: valid_tokens): exchange_rate = + let scaling_rate = get_rate_scaling_power_of_10 rate tokens in let adjusted_rate = Rational.mul rate.rate scaling_rate in { rate with rate = adjusted_rate } @@ -716,7 +810,7 @@ let get_cleared_sell_side_payout (amount: nat) (clearing: clearing) (tam: token_amount_map ): token_amount_map = - let tc = clearing.total_cleared_volumes in + let tc = clearing.total_cleared_volumes in (* Find the buy side volume in buy token units that was cleared. This doesn't include all the volume that was subject to clearing, but just that which can be cleared on both sides of the trade *) let f_buy_side_cleared_volume = Rational.new (int tc.buy_side_total_cleared_volume) in (* Find the sell side volume in sell token units that was included in the clearing. This doesn't not include the volume of any orders that were outside the price *) @@ -756,7 +850,7 @@ let get_cleared_buy_side_payout (amount: nat) (clearing:clearing) (tam: token_amount_map): token_amount_map = - let tc = clearing.total_cleared_volumes in + let tc = clearing.total_cleared_volumes in (* Find the sell side volume in sell token units that was cleared. This doesn't include all the volume that was subject to clearing, but just that which can be cleared on both sides of the trade *) let f_sell_side_cleared_volume = Rational.new (int tc.sell_side_total_cleared_volume) in (* Find the buy side volume that was included in the clearing. This doesn't not include the volume of any orders that were outside the price *) @@ -793,24 +887,27 @@ let get_cleared_payout (ot: ordertype) (amt: nat) (clearing: clearing) - (tam: token_amount_map): token_amount_map = + (tam: token_amount_map) + (tokens: valid_tokens): token_amount_map = let s = ot.side in let swap = clearing.clearing_rate.swap in + let from_token = get_token swap.from tokens in + let to_token = get_token swap.to tokens in match s with - | Buy -> get_cleared_buy_side_payout swap.from.token swap.to amt clearing tam - | Sell -> get_cleared_sell_side_payout swap.to swap.from.token amt clearing tam + | Buy -> get_cleared_buy_side_payout from_token to_token amt clearing tam + | Sell -> get_cleared_sell_side_payout to_token from_token amt clearing tam [@inline] let collect_order_payout_from_clearing - ((c, tam, vols), (ot, amt): (clearing * token_amount_map * volumes) * (ordertype * nat)) : (clearing * token_amount_map * volumes) = + ((c, tam, vols, tokens), (ot, amt): (clearing * token_amount_map * volumes * valid_tokens) * (ordertype * nat)) : (clearing * token_amount_map * volumes * valid_tokens) = let u_tam: token_amount_map = if was_in_clearing vols ot c then - get_cleared_payout ot amt c tam + get_cleared_payout ot amt c tam tokens else - let ta: token_amount = TokenAmount.recover ot amt c in + let ta: token_amount = TokenAmount.recover ot amt c tokens in TokenAmountMap.increase ta tam in - (c, u_tam, vols) + (c, u_tam, vols, tokens) end @@ -835,27 +932,29 @@ let get_clearing | Cleared ci -> Some ci.clearing | _ -> None + [@inline] let collect_redemptions - ((bots, tam, bts),(batch_number,otps) : (batch_ordertypes * token_amount_map * batch_set) * (nat * ordertypes)) : (batch_ordertypes * token_amount_map * batch_set) = + ((bots, tam, bts, tokens),(batch_number,otps) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens) * (nat * ordertypes)) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens) = let batches = bts.batches in match Big_map.find_opt batch_number batches with - | None -> bots, tam, bts + | None -> bots, tam, bts, tokens | Some batch -> (match get_clearing batch with - | None -> bots, tam, bts - | Some c -> let _c, u_tam, _vols = Map.fold Redemption_Utils.collect_order_payout_from_clearing otps (c, tam, batch.volumes ) in + | None -> bots, tam, bts, tokens + | Some c -> let _c, u_tam, _vols, _tokns = Map.fold Redemption_Utils.collect_order_payout_from_clearing otps (c, tam, batch.volumes, tokens ) in let u_bots = Map.remove batch_number bots in - u_bots,u_tam, bts) + u_bots,u_tam, bts, tokens) [@inline] let collect_redemption_payouts (holder: address) (batch_set: batch_set) - (ubots: user_batch_ordertypes) : (user_batch_ordertypes * token_amount_map) = + (ubots: user_batch_ordertypes) + (tokens: valid_tokens): (user_batch_ordertypes * token_amount_map) = let empty_tam = (Map.empty : token_amount_map) in match Big_map.find_opt holder ubots with | None -> ubots, empty_tam - | Some bots -> let u_bots, u_tam, _bs = Map.fold collect_redemptions bots (bots, empty_tam, batch_set) in + | Some bots -> let u_bots, u_tam, _bs, _tkns = Map.fold collect_redemptions bots (bots, empty_tam, batch_set, tokens) in let updated_ubots = Big_map.update holder (Some u_bots) ubots in updated_ubots, u_tam @@ -948,10 +1047,10 @@ let transfer_fa2_token (* Transfer the tokens to the appropriate address. This is based on the FA12 and FA2 token standard *) [@inline] -let transfer_token - (sender : address) - (receiver : address) - (token_address : address) +let transfer_token + (sender : address) + (receiver : address) + (token_address : address) (token_amount : token_amount) : operation = match token_amount.token.standard with | Some standard -> @@ -1013,7 +1112,7 @@ let redeem (redeem_address : address) (storage : storage) : operation list * storage = let treasury_vault = get_treasury_vault () in - let updated_ubots, payout_token_map = Ubots.collect_redemption_payouts redeem_address storage.batch_set storage.user_batch_ordertypes in + let updated_ubots, payout_token_map = Ubots.collect_redemption_payouts redeem_address storage.batch_set storage.user_batch_ordertypes storage.valid_tokens in let operations = Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in let updated_storage = { storage with user_batch_ordertypes = updated_ubots; } in (operations, updated_storage) @@ -1022,9 +1121,6 @@ end module Token_Utils = struct -type valid_swaps = Storage.valid_swaps -type valid_tokens = Storage.valid_tokens - [@inline] let are_equivalent_tokens (given: token) @@ -1038,9 +1134,10 @@ let are_equivalent_tokens [@inline] let is_valid_swap_pair (side: side) - (swap: swap) - (valid_swaps: valid_swaps): swap = - let token_pair = Utils.pair_of_swap side swap in + (swap: swap_reduced) + (valid_swaps: valid_swaps) + (tokens: valid_tokens): swap_reduced = + let token_pair = Utils.pair_of_swap side swap tokens in let rate_name = Utils.get_rate_name_from_pair token_pair in if Map.mem rate_name valid_swaps then swap else failwith unsupported_swap_type @@ -1079,11 +1176,14 @@ let is_token_used [@inline] let is_token_used_in_swaps (token: token) - (valid_swaps: valid_swaps) : bool = - let is_token_used_in_swap (acc, (_i, valid_swap) : bool * (string * valid_swap)) : bool = + (valid_swaps: valid_swaps) + (tokens: valid_tokens): bool = + let is_token_used_in_swap (acc, (_i, valid_swap) : bool * (string * valid_swap_reduced)) : bool = let swap = valid_swap.swap in - are_equivalent_tokens token swap.to || - are_equivalent_tokens token swap.from.token || + let to_token = get_token swap.to tokens in + let from_token = get_token swap.from tokens in + are_equivalent_tokens token to_token || + are_equivalent_tokens token from_token || acc in Map.fold is_token_used_in_swap valid_swaps false @@ -1093,8 +1193,10 @@ let add_swap (valid_swap: valid_swap) (valid_swaps: valid_swaps) : valid_swaps = let swap = valid_swap.swap in - let rate_name = Utils.get_rate_name_from_swap swap in - Map.add rate_name valid_swap valid_swaps + let swap_reduced = Utils.swap_to_swap_reduced(swap) in + let rate_name = Utils.get_rate_name_from_swap swap_reduced in + let valid_swap_reduced = Utils.valid_swap_to_valid_swap_reduced valid_swap in + Map.add rate_name valid_swap_reduced valid_swaps [@inline] let remove_swap @@ -1102,16 +1204,17 @@ let remove_swap (valid_tokens: valid_tokens) (valid_swaps: valid_swaps) : (valid_swaps * valid_tokens) = let swap = valid_swap.swap in - let rate_name = Utils.get_rate_name_from_swap swap in + let swap_reduced = Utils.swap_to_swap_reduced(swap) in + let rate_name = Utils.get_rate_name_from_swap swap_reduced in let valid_swaps = Map.remove rate_name valid_swaps in - let from = swap.from.token in - let to = swap.to in - let valid_tokens = if is_token_used_in_swaps from valid_swaps then + let from = get_token swap_reduced.from valid_tokens in + let to = get_token swap_reduced.to valid_tokens in + let valid_tokens = if is_token_used_in_swaps from valid_swaps valid_tokens then valid_tokens else remove_token from valid_tokens in - let valid_tokens = if is_token_used_in_swaps to valid_swaps then + let valid_tokens = if is_token_used_in_swaps to valid_swaps valid_tokens then valid_tokens else remove_token to valid_tokens @@ -1122,15 +1225,13 @@ end module Tokens = struct -type valid_swaps = Storage.valid_swaps -type valid_tokens = Storage.valid_tokens [@inline] let validate (side: side) (swap: swap) (valid_tokens: valid_tokens) - (valid_swaps: valid_swaps): swap = + (valid_swaps: valid_swaps): swap_reduced = let from = swap.from.token in let to = swap.to in match Map.find_opt from.name valid_tokens with @@ -1138,7 +1239,8 @@ let validate | Some ft -> (match Map.find_opt to.name valid_tokens with | None -> failwith unsupported_swap_type | Some tt -> if (Token_Utils.are_equivalent_tokens from ft) && (Token_Utils.are_equivalent_tokens to tt) then - Token_Utils.is_valid_swap_pair side swap valid_swaps + let sr = Utils.swap_to_swap_reduced swap in + Token_Utils.is_valid_swap_pair side sr valid_swaps valid_tokens else failwith unsupported_swap_type) @@ -1168,10 +1270,11 @@ let can_add [@inline] let remove_pair (valid_swap: valid_swap) - (valid_swaps: Storage.valid_swaps) - (valid_tokens: Storage.valid_tokens) : Storage.valid_swaps * Storage.valid_tokens = + (valid_swaps: valid_swaps) + (valid_tokens: valid_tokens) : valid_swaps * valid_tokens = let swap = valid_swap.swap in - let rate_name = Utils.get_rate_name_from_swap swap in + let swap_reduced = Utils.swap_to_swap_reduced swap in + let rate_name = Utils.get_rate_name_from_swap swap_reduced in let rate_found = Map.find_opt rate_name valid_swaps in match rate_found with | Some _ -> Token_Utils.remove_swap valid_swap valid_tokens valid_swaps @@ -1187,7 +1290,8 @@ let add_pair let from = swap.from.token in let to = swap.to in let () = can_add to from limit_on_tokens_or_pairs valid_tokens valid_swaps in - let rate_name = Utils.get_rate_name_from_swap swap in + let swap_reduced = Utils.swap_to_swap_reduced swap in + let rate_name = Utils.get_rate_name_from_swap swap_reduced in let rate_found = Map.find_opt rate_name valid_swaps in match rate_found with | Some _ -> failwith swap_already_exists @@ -1404,7 +1508,7 @@ let filter_volumes (clearing: clearing) : (nat * nat) = match clearing.clearing_tolerance with | Minus -> let sell_vol = volumes.sell_minus_volume + volumes.sell_exact_volume + volumes.sell_plus_volume in - volumes.buy_minus_volume , sell_vol + volumes.buy_minus_volume , sell_vol | Exact -> let buy_vol = volumes.buy_minus_volume + volumes.buy_exact_volume in let sell_vol = volumes.sell_exact_volume + volumes.sell_plus_volume in buy_vol, sell_vol @@ -1470,8 +1574,6 @@ end type storage = Storage.t type result = (operation list) * storage -type valid_swaps = Storage.valid_swaps -type valid_tokens = Storage.valid_tokens [@inline] let no_op (s : storage) : result = (([] : operation list), s) @@ -1496,7 +1598,7 @@ type entrypoint = [@inline] let get_oracle_price (failure_code: nat) - (valid_swap: valid_swap) : orace_price_update = + (valid_swap: valid_swap_reduced) : orace_price_update = match Tezos.call_view "getPrice" valid_swap.oracle_asset_name valid_swap.oracle_address with | Some opu -> opu | None -> failwith failure_code @@ -1543,13 +1645,13 @@ let external_to_order tolerance = tolerance; redeemed = false; } in - let validated_swap = Tokens.validate side order.swap valid_tokens valid_swaps in - { converted_order with swap = validated_swap; } + let _ = Tokens.validate side order.swap valid_tokens valid_swaps in + converted_order [@inline] -let get_valid_swap +let get_valid_swap_reduced (pair_name: string) - (storage : storage) : valid_swap = + (storage : storage) : valid_swap_reduced = match Map.find_opt pair_name storage.valid_swaps with | Some vswp -> vswp | None -> failwith swap_does_not_exist @@ -1576,7 +1678,7 @@ let is_oracle_price_newer_than_current [@inline] let is_batch_open - (batch:batch): bool = + (batch:batch): bool = match batch.status with | Open _ -> true | _ -> false @@ -1588,8 +1690,8 @@ let confirm_oracle_price_is_available_before_deposit (storage:storage) : unit = if is_batch_open batch then () else let pair_name = Utils.get_rate_name_from_pair pair in - let valid_swap = get_valid_swap pair_name storage in - let (lastupdated, _price) = get_oracle_price oracle_price_should_be_available_before_deposit valid_swap in + let valid_swap_reduced = get_valid_swap_reduced pair_name storage in + let (lastupdated, _price) = get_oracle_price oracle_price_should_be_available_before_deposit valid_swap_reduced in oracle_price_is_not_stale storage.deposit_time_window_in_seconds storage.scale_factor_for_oracle_staleness lastupdated [@inline] @@ -1601,10 +1703,10 @@ let confirm_swap_pair_is_disabled_prior_to_removal Updates the current_batch if the time is valid but the new batch was not initialized. *) [@inline] let deposit (external_order: external_swap_order) (storage : storage) : result = - let pair = Utils.pair_of_external_swap external_order in + let pair = Utils.pair_of_external_swap external_order storage.valid_tokens in let current_time = Tezos.get_now () in let pair_name = Utils.get_rate_name_from_pair pair in - let valid_swap = get_valid_swap pair_name storage in + let valid_swap = get_valid_swap_reduced pair_name storage in if valid_swap.is_disabled_for_deposits then failwith swap_is_disabled_for_deposits else let fee_amount_in_mutez = storage.fee_in_mutez in let fee_provided = Tezos.get_amount () in @@ -1612,7 +1714,7 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = if fee_provided > fee_amount_in_mutez then failwith more_tez_sent_than_fee_cost else let (current_batch, current_batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in if Batch_Utils.can_deposit current_batch then - let () = confirm_oracle_price_is_available_before_deposit pair current_batch storage in + let () = confirm_oracle_price_is_available_before_deposit pair current_batch storage in let storage = { storage with batch_set = current_batch_set } in let current_batch_number = current_batch.batch_number in let next_order_number = storage.last_order_number + 1n in @@ -1649,7 +1751,8 @@ let convert_oracle_price (precision: nat) (swap: swap) (lastupdated: timestamp) - (price: nat) : exchange_rate = + (price: nat) + (tokens: valid_tokens): exchange_rate = let prc,den : nat * int = if swap.from.token.decimals > precision then let diff:int = swap.from.token.decimals - precision in let diff_pow = Utils.pow 10 diff in @@ -1663,12 +1766,13 @@ let convert_oracle_price let rational_price = Rational.new (int prc) in let rational_denom = Rational.new den in let rational_rate: Rational.t = Rational.div rational_price rational_denom in + let swap_reduced: swap_reduced = Utils.swap_to_swap_reduced swap in let rate = { - swap = swap; + swap = swap_reduced; rate = rational_rate; when = lastupdated; } in - Utils.scale_on_receive_for_token_precision_difference rate + Utils.scale_on_receive_for_token_precision_difference rate tokens [@inline] let change_oracle_price_source @@ -1676,9 +1780,9 @@ let change_oracle_price_source (storage: storage) : result = let _ = is_administrator storage in let () = reject_if_tez_supplied () in - let valid_swap = get_valid_swap source_change.pair_name storage in - let valid_swap = { valid_swap with oracle_address = source_change.oracle_address; oracle_asset_name = source_change.oracle_asset_name; oracle_precision = source_change.oracle_precision; } in - let _ = get_oracle_price unable_to_get_price_from_new_oracle_source valid_swap in + let valid_swap_reduced = get_valid_swap_reduced source_change.pair_name storage in + let valid_swap = { valid_swap_reduced with oracle_address = source_change.oracle_address; oracle_asset_name = source_change.oracle_asset_name; oracle_precision = source_change.oracle_precision; } in + let _ = get_oracle_price unable_to_get_price_from_new_oracle_source valid_swap_reduced in let updated_swaps = Map.update source_change.pair_name (Some valid_swap) storage.valid_swaps in let storage = { storage with valid_swaps = updated_swaps} in no_op (storage) @@ -1688,12 +1792,13 @@ let tick_price (rate_name: string) (valid_swap : valid_swap) (storage : storage) : storage = - let (lastupdated, price) = get_oracle_price unable_to_get_price_from_oracle valid_swap in + let valid_swap_reduced = Utils.valid_swap_to_valid_swap_reduced valid_swap in + let (lastupdated, price) = get_oracle_price unable_to_get_price_from_oracle valid_swap_reduced in let () = is_oracle_price_newer_than_current rate_name lastupdated storage in let () = oracle_price_is_not_stale storage.deposit_time_window_in_seconds storage.scale_factor_for_oracle_staleness lastupdated in - let oracle_rate = convert_oracle_price valid_swap.oracle_precision valid_swap.swap lastupdated price in + let oracle_rate = convert_oracle_price valid_swap.oracle_precision valid_swap.swap lastupdated price storage.valid_tokens in let storage = Utils.update_current_rate (rate_name) (oracle_rate) (storage) in - let pair = Utils.pair_of_rate oracle_rate in + let pair = Utils.pair_of_rate oracle_rate storage.valid_tokens in let current_time = Tezos.get_now () in let batch_set = storage.batch_set in let (batch_opt, batch_set) = Batch_Utils.get_current_batch_without_opening storage.deposit_time_window_in_seconds pair current_time batch_set in @@ -1710,7 +1815,8 @@ let tick (storage : storage) : result = let () = reject_if_tez_supplied () in match Map.find_opt rate_name storage.valid_swaps with - | Some vswp -> let storage = tick_price rate_name vswp storage in + | Some vswpr -> let vswp = Utils.valid_swap_reduced_to_valid_swap vswpr 1n storage.valid_tokens in + let storage = tick_price rate_name vswp storage in no_op (storage) | None -> failwith swap_does_not_exist @@ -1786,7 +1892,7 @@ let set_deposit_status (storage: storage) : result = let () = is_administrator storage in let () = reject_if_tez_supplied () in - let valid_swap = get_valid_swap pair_name storage in + let valid_swap = get_valid_swap_reduced pair_name storage in let valid_swap = { valid_swap with is_disabled_for_deposits = disabled; } in let valid_swaps = Map.update pair_name (Some valid_swap) storage.valid_swaps in let storage = { storage with valid_swaps = valid_swaps; } in diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index 52beb04d..90cfdb8d 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -28,23 +28,8 @@ let f(_:unit) : Batcher.Storage.t = { valid_swaps = Map.literal [ ("tzBTC/USDT", { swap = { - from = { - amount = 1n; - token = { - token_id = 0n; - name = "tzBTC"; - address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); - decimals = 8n; - standard = Some "FA1.2 token" - } - }; - to = { - token_id = 0n; - name = "USDT"; - address = Some(("KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } + from = "tzBTC"; + to = "USDT"; }; oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); oracle_asset_name = "BTC-USDT"; @@ -54,23 +39,8 @@ let f(_:unit) : Batcher.Storage.t = { ); ("tzBTC/EURL", { swap = { - from = { - amount = 1n; - token = { - token_id = 0n; - name = "tzBTC"; - address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); - decimals = 8n; - standard = Some "FA1.2 token"; - } - }; - to = { - token_id = 0n; - name = "EURL"; - address = Some(("KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } + from = "tzBTC"; + to = "EURL"; }; oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); oracle_asset_name = "BTC-EUR"; @@ -79,7 +49,7 @@ let f(_:unit) : Batcher.Storage.t = { } ) ]; - rates_current = (Big_map.empty : Batcher.Storage.rates_current); + rates_current = (Big_map.empty : Batcher.rates_current); batch_set = { current_batch_indices = (Map.empty : (string,nat) map); batches = (Big_map.empty : (nat,Batcher.batch) big_map); diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index 16e9a44b..1085b217 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -28,23 +28,8 @@ let f(_:unit) : Batcher.Storage.t = { valid_swaps = Map.literal [ ("tzBTC/USDT", { swap = { - from = { - amount = 1n; - token = { - token_id = 0n; - name = "tzBTC"; - address = Some(("KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn" : address)); - decimals = 8n; - standard = Some "FA1.2 token" - } - }; - to = { - token_id = 0n; - name = "USDT"; - address = Some(("tz1N47UGiVScUUvHemXd2kGwJi44h7qZMUzp" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } + from = "tzBTC"; + to = "USDT"; }; oracle_address = ("KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG": address); oracle_asset_name = "BTC-USDT"; @@ -54,23 +39,8 @@ let f(_:unit) : Batcher.Storage.t = { ); ("tzBTC/EURL", { swap = { - from = { - amount = 1n; - token = { - token_id = 0n; - name = "tzBTC"; - address = Some(("KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn" : address)); - decimals = 8n; - standard = Some "FA1.2 token"; - } - }; - to = { - token_id = 0n; - name = "EURL"; - address = Some(("KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } + from = "tzBTC"; + to = "EURL"; }; oracle_address = ("KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG": address); oracle_asset_name = "BTC-EUR"; @@ -79,7 +49,7 @@ let f(_:unit) : Batcher.Storage.t = { } ) ]; - rates_current = (Big_map.empty : Batcher.Storage.rates_current); + rates_current = (Big_map.empty : Batcher.rates_current); batch_set = { current_batch_indices = (Map.empty : (string,nat) map); batches = (Big_map.empty : (nat,Batcher.batch) big_map); From 8495a5d4686aee8d504c268a6aa699ed6e7d0677 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Fri, 9 Jun 2023 12:35:52 +0300 Subject: [PATCH 067/108] 344 reduce duplication in contract storage (#351) * Changed to use a reduced swap structure (name only) to reduce duplication in storage * Changed pair type to string * string --- batcher-ui/config/config.ghostnet.ts | 2 +- batcher/batcher-ghostnet.tz | 195 ++++++++++----------------- batcher/batcher.mligo | 40 +++--- 3 files changed, 86 insertions(+), 151 deletions(-) diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index a6a55455..14216a00 100644 --- a/batcher-ui/config/config.ghostnet.ts +++ b/batcher-ui/config/config.ghostnet.ts @@ -54,7 +54,7 @@ export default defineConfig({ REACT_APP_PATH_TO_BATCHER_LOGO: BATCHER_LOGO, REACT_APP_TEZOS_NODE_URI: 'https://ghostnet.tezos.marigold.dev', REACT_APP_TZKT_URI_API: 'https://api.ghostnet.tzkt.io', - REACT_APP_BATCHER_CONTRACT_HASH: 'KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1', + REACT_APP_BATCHER_CONTRACT_HASH: 'KT1WtSiEANQWu4HTcA3o2QxGbX4u3NqScXoR', }, metas: [ { diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 90d3b8b1..da0e8b11 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -108,17 +108,7 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)))))) + (pair %pair string string))))) (nat %deposit_time_window_in_seconds) (mutez %fee_in_mutez)) (pair (address %fee_recipient) (nat %last_order_number)) @@ -1015,16 +1005,16 @@ DUP 2 ; DUP 2 ; CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; + DUP ; CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - IF_LEFT { DROP } { DROP ; SWAP } ; + GET 3 ; SWAP ; + CAR ; + CAR ; + GET 3 ; PAIR ; + SWAP ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; NOW ; DUP 4 ; CDR ; @@ -1033,15 +1023,12 @@ CDR ; DUP 3 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; GET 8 ; @@ -1081,15 +1068,12 @@ CAR ; DUP 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 0 } {} ; GET ; @@ -1144,15 +1128,12 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { DUP ; @@ -1211,15 +1192,12 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { DIG 3 ; DROP 2 ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } @@ -1281,15 +1259,12 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { SWAP ; DROP ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } } ; @@ -1312,15 +1287,12 @@ CDR ; DIG 4 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; DUP ; @@ -1491,6 +1463,14 @@ AND ; AND ; IF { DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 7 ; CDR ; GET 3 ; SWAP ; @@ -1509,24 +1489,18 @@ IF_NONE { PUSH nat 111 ; FAILWITH } {} ; DUP 8 ; CDR ; - CAR ; - CDR ; - CDR ; - DUP 6 ; - IF_LEFT { DROP ; SWAP } { DROP ; DIG 2 } ; - DIG 2 ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP 5 ; + IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; + UNPAIR ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; MEM ; IF {} { PUSH nat 110 ; FAILWITH } } - { DROP 2 ; PUSH nat 110 ; FAILWITH } } } ; + { DROP ; PUSH nat 110 ; FAILWITH } } } ; PUSH bool False ; DIG 2 ; DIG 3 ; @@ -3227,6 +3201,9 @@ CAR ; CAR ; CDR ; + DIG 2 ; + UNPAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; DUP 4 ; CAR ; CAR ; @@ -3238,15 +3215,12 @@ CAR ; DUP 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 0 } {} ; GET ; @@ -3263,12 +3237,7 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair (pair nat string (option address) nat (option string)) - nat - string - (option address) - nat - (option string))) } + (pair string string)) } { DUP ; GET 3 ; IF_LEFT @@ -3320,15 +3289,12 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { DIG 4 ; DROP 2 ; SWAP } } @@ -3380,15 +3346,12 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { SWAP ; DROP ; SWAP } } ; @@ -3878,15 +3841,12 @@ DIG 3 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; @@ -3956,17 +3916,7 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)))) + (pair %pair string string))) { CDR ; NIL (pair nat (or (or (pair (pair timestamp @@ -3978,12 +3928,7 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair (pair nat string (option address) nat (option string)) - nat - string - (option address) - nat - (option string))) ; + (pair string string)) ; DUP 2 ; CAR ; CAR ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 4e7102a6..7bcdc39f 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -220,7 +220,7 @@ type volumes = [@layout:comb] { sell_total_volume : nat; } -type pair = token * token +type pair = string * string (* This represents the type of order. I.e. buy/sell and which level*) type ordertype = [@layout:comb] { @@ -550,17 +550,13 @@ let get_rate_name_from_swap (s : swap_reduced) : string = find_lexicographical_pair_name quote_name base_name [@inline] -let get_rate_name_from_pair (s : token * token) : string = - let base, quote = s in - let base_name = base.name in - let quote_name = quote.name in +let get_rate_name_from_pair (s : pair) : string = + let base_name, quote_name = s in find_lexicographical_pair_name quote_name base_name [@inline] -let get_inverse_rate_name_from_pair (s : token * token) : string = - let base, quote = s in - let quote_name = quote.name in - let base_name = base.name in +let get_inverse_rate_name_from_pair (s : pair) : string = + let base_name, quote_name = s in find_lexicographical_pair_name quote_name base_name [@inline] @@ -573,28 +569,23 @@ let get_rate_name [@inline] let pair_of_swap (side: side) - (swap: swap_reduced) - (tokens: valid_tokens): (token * token) = - let from_token = get_token swap.from tokens in - let to_token = get_token swap.to tokens in + (swap: swap_reduced): (pair) = match side with - | Buy -> from_token, to_token - | Sell -> to_token, from_token + | Buy -> swap.from, swap.to + | Sell -> swap.to, swap.from [@inline] let pair_of_rate - (r : exchange_rate) - (tokens: valid_tokens): (token * token) = pair_of_swap Buy r.swap tokens + (r : exchange_rate): pair = pair_of_swap Buy r.swap [@inline] let pair_of_external_swap - (order : external_swap_order) - (tokens: valid_tokens): (token * token) = + (order : external_swap_order): pair = (* Note: we assume left-handedness - i.e. direction is buy side*) let swap = order.swap in let side = nat_to_side order.side in let swap_reduced = swap_to_swap_reduced swap in - pair_of_swap side swap_reduced tokens + pair_of_swap side swap_reduced [@inline] let get_current_batch_index @@ -1135,9 +1126,8 @@ let are_equivalent_tokens let is_valid_swap_pair (side: side) (swap: swap_reduced) - (valid_swaps: valid_swaps) - (tokens: valid_tokens): swap_reduced = - let token_pair = Utils.pair_of_swap side swap tokens in + (valid_swaps: valid_swaps): swap_reduced = + let token_pair = Utils.pair_of_swap side swap in let rate_name = Utils.get_rate_name_from_pair token_pair in if Map.mem rate_name valid_swaps then swap else failwith unsupported_swap_type @@ -1240,7 +1230,7 @@ let validate | None -> failwith unsupported_swap_type | Some tt -> if (Token_Utils.are_equivalent_tokens from ft) && (Token_Utils.are_equivalent_tokens to tt) then let sr = Utils.swap_to_swap_reduced swap in - Token_Utils.is_valid_swap_pair side sr valid_swaps valid_tokens + Token_Utils.is_valid_swap_pair side sr valid_swaps else failwith unsupported_swap_type) @@ -1334,7 +1324,7 @@ let set_sell_side_volume let make (batch_number: nat) (timestamp: timestamp) - (pair: token * token) : batch = + (pair: pair) : batch = let volumes: volumes = { buy_minus_volume = 0n; buy_exact_volume = 0n; From d8950763dccf496a83d5dba927be864d104c5441 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 9 Jun 2023 15:28:59 +0300 Subject: [PATCH 068/108] Fixed merge issues --- batcher/batcher-ghostnet.tz | 67 ++++++------------------------------- batcher/batcher.mligo | 4 +-- 2 files changed, 13 insertions(+), 58 deletions(-) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index da0e8b11..5fcd12af 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -989,20 +989,6 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 3 ; - CDR ; - CDR ; - DUP 3 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP 2 ; DUP 2 ; CAR ; DUP ; @@ -1387,12 +1373,12 @@ GET ; IF_NONE { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DUP 5 ; + { DIG 4 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 5 ; PUSH nat 110 ; FAILWITH } + { DROP 4 ; PUSH nat 110 ; FAILWITH } { DUP ; GET 8 ; DUP 4 ; @@ -1472,22 +1458,8 @@ PAIR ; DUP 7 ; CDR ; - GET 3 ; - SWAP ; - CAR ; CAR ; - GET 3 ; - PAIR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 8 ; CDR ; DUP 5 ; IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; @@ -3174,26 +3146,10 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 2 ; - DUP ; - CDR ; - CDR ; - DUP 3 ; + DUP 2 ; CAR ; UNIT ; LEFT unit ; - DUP 3 ; - DUP 3 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 3 ; - DIG 3 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - IF_LEFT { DROP } { DROP ; SWAP } ; - SWAP ; PAIR ; NOW ; DUP 3 ; @@ -3209,11 +3165,11 @@ CAR ; CDR ; CAR ; - DUP 2 ; - CDR ; DUP 3 ; + CDR ; + DUP 4 ; CAR ; - DUP 6 ; + DUP 4 ; UNPAIR ; DUP ; DUP 3 ; @@ -3225,8 +3181,7 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DIG 3 ; - DROP 2 ; + { DROP 2 ; NONE (pair nat (or (or (pair (pair timestamp (pair (pair nat nat nat) @@ -3246,12 +3201,12 @@ IF_LEFT { DROP 2 ; PUSH nat 0 ; - DUP 2 ; + DUP 3 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DIG 3 ; + SWAP ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -3297,8 +3252,8 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 4 ; DROP 2 ; SWAP } } - { DIG 5 ; + { DIG 2 ; DROP 2 ; SWAP } } + { DIG 3 ; DROP ; DUP 3 ; INT ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 7bcdc39f..2f1bd621 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1693,7 +1693,7 @@ let confirm_swap_pair_is_disabled_prior_to_removal Updates the current_batch if the time is valid but the new batch was not initialized. *) [@inline] let deposit (external_order: external_swap_order) (storage : storage) : result = - let pair = Utils.pair_of_external_swap external_order storage.valid_tokens in + let pair = Utils.pair_of_external_swap external_order in let current_time = Tezos.get_now () in let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap = get_valid_swap_reduced pair_name storage in @@ -1788,7 +1788,7 @@ let tick_price let () = oracle_price_is_not_stale storage.deposit_time_window_in_seconds storage.scale_factor_for_oracle_staleness lastupdated in let oracle_rate = convert_oracle_price valid_swap.oracle_precision valid_swap.swap lastupdated price storage.valid_tokens in let storage = Utils.update_current_rate (rate_name) (oracle_rate) (storage) in - let pair = Utils.pair_of_rate oracle_rate storage.valid_tokens in + let pair = Utils.pair_of_rate oracle_rate in let current_time = Tezos.get_now () in let batch_set = storage.batch_set in let (batch_opt, batch_set) = Batch_Utils.get_current_batch_without_opening storage.deposit_time_window_in_seconds pair current_time batch_set in From a71b585f61e2998bde7a0b7deaf1e4ae65fe5ab8 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Tue, 20 Jun 2023 08:25:45 +0300 Subject: [PATCH 069/108] 346 only open batches on first trade (#371) * Batch will not progress via tick on finalized * Added new contact hash for ghostnet --- batcher-ui/config/config.ghostnet.ts | 2 +- batcher/batcher-ghostnet.tz | 357 +++++++++++++-------------- batcher/batcher.mligo | 16 +- 3 files changed, 190 insertions(+), 185 deletions(-) diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index 14216a00..e6ea1b7a 100644 --- a/batcher-ui/config/config.ghostnet.ts +++ b/batcher-ui/config/config.ghostnet.ts @@ -54,7 +54,7 @@ export default defineConfig({ REACT_APP_PATH_TO_BATCHER_LOGO: BATCHER_LOGO, REACT_APP_TEZOS_NODE_URI: 'https://ghostnet.tezos.marigold.dev', REACT_APP_TZKT_URI_API: 'https://api.ghostnet.tzkt.io', - REACT_APP_BATCHER_CONTRACT_HASH: 'KT1WtSiEANQWu4HTcA3o2QxGbX4u3NqScXoR', + REACT_APP_BATCHER_CONTRACT_HASH: 'KT1CV6uF7pGNz4SSn7FLpbw7z2AND8dKzk4G', }, metas: [ { diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 5fcd12af..863dcf91 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -1036,21 +1036,13 @@ GT ; IF { DROP 5 ; PUSH nat 130 ; FAILWITH } { DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 6 ; CAR ; CAR ; CAR ; CDR ; + DUP ; CDR ; - DUP 7 ; - CAR ; - CAR ; - CAR ; - CDR ; + DUP 2 ; CAR ; DUP 6 ; UNPAIR ; @@ -1064,13 +1056,7 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DROP ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - PUSH nat 0 ; + { PUSH nat 0 ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; @@ -1122,18 +1108,18 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DUP ; + { DUP 7 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; GET 3 ; IF_LEFT - { DIG 2 ; + { SWAP ; DROP ; IF_LEFT { DROP 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; PUSH nat 0 ; DUP 2 ; CAR ; @@ -1186,14 +1172,14 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 3 ; DROP 2 ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } - { DUP 3 ; + { DIG 4 ; DROP 2 ; SWAP } } + { DUP 2 ; INT ; ADD ; - DIG 4 ; + DIG 5 ; COMPARE ; GE ; - IF { DUP ; + IF { DUP 2 ; GET 3 ; IF_LEFT { SWAP ; @@ -1202,7 +1188,7 @@ IF_LEFT { DROP ; PUSH nat 105 ; FAILWITH } { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; + { SWAP ; INT ; DUP 2 ; ADD ; @@ -1216,16 +1202,8 @@ (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; + DUP 2 ; + DUP 3 ; CDR ; DUP 3 ; SOME ; @@ -1233,11 +1211,7 @@ CAR ; UPDATE ; UPDATE 2 ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; + DIG 2 ; CAR ; DUP 3 ; CAR ; @@ -1253,7 +1227,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { SWAP ; DROP ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } } ; + { DROP ; SWAP } } } ; SWAP ; DUP ; GET 3 ; @@ -1327,7 +1301,10 @@ CAR ; CDR ; ADD ; - DUP 7 ; + DUP 3 ; + CDR ; + CDR ; + DUP 8 ; GET 5 ; PUSH nat 0 ; DUP 2 ; @@ -1339,7 +1316,7 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 8 ; + DUP 9 ; GET 6 ; PUSH nat 0 ; DUP 2 ; @@ -1357,9 +1334,6 @@ EQ ; IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; SENDER ; - DUP 6 ; - CDR ; - CDR ; DUP 11 ; CAR ; DUP ; @@ -1367,13 +1341,13 @@ CAR ; DUP 2 ; CDR ; - DUP 4 ; + DUP 7 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 4 ; + { SWAP ; DIG 2 ; DIG 6 ; DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 7 ; DUP 3 ; GET 3 ; GET ; @@ -2984,12 +2958,9 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 5 ; - CDR ; - CDR ; - DUP 4 ; + DUP 3 ; CAR ; - DIG 4 ; + DIG 3 ; GET 7 ; DUP ; DUP 3 ; @@ -3005,10 +2976,10 @@ SUB ; PUSH int 10 ; PAIR ; - DUP 8 ; + DUP 7 ; SWAP ; EXEC ; - DIG 4 ; + DIG 3 ; MUL ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; @@ -3019,11 +2990,11 @@ INT ; PUSH int 10 ; PAIR ; - DUP 8 ; + DUP 7 ; SWAP ; EXEC ; SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 8 ; SWAP ; EXEC ; DIG 4 } ; + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; INT ; PUSH int 1 ; DIG 2 ; @@ -3042,7 +3013,7 @@ CAR ; MUL ; PAIR ; - DIG 3 ; + DIG 2 ; SWAP ; DUP 3 ; CDR ; @@ -3053,15 +3024,17 @@ GET 3 ; PAIR ; PAIR 3 ; - DUP ; - CAR ; DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; DUP 2 ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 3 ; - DIG 2 ; + DUG 2 ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; @@ -3150,24 +3123,19 @@ CAR ; UNIT ; LEFT unit ; - PAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; NOW ; DUP 3 ; CAR ; CAR ; CAR ; CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + CDR ; DUP 4 ; CAR ; CAR ; - CDR ; CAR ; - DUP 3 ; CDR ; - DUP 4 ; CAR ; DUP 4 ; UNPAIR ; @@ -3181,7 +3149,13 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DROP 2 ; + { SWAP ; + DROP ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CDR ; NONE (pair nat (or (or (pair (pair timestamp (pair (pair nat nat nat) @@ -3196,120 +3170,139 @@ { DUP ; GET 3 ; IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 3 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - SWAP ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; - DROP ; - DUP 3 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool False } ; + IF { DIG 2 ; DROP ; DUP 3 ; CAR ; CAR ; CAR ; CDR } + { DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + GET 3 ; + IF_LEFT + { SWAP ; + DROP ; IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } { DIG 2 ; - INT ; + DROP 2 ; + PUSH nat 0 ; DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; ADD ; - PAIR ; + DIG 3 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 5 ; RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 3 ; + PAIR 4 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 4 ; DROP 2 } } + { DIG 5 ; + DROP ; DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; + INT ; + ADD ; + DUP 5 ; COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; SWAP } } ; + GE ; + IF { DUP 3 ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 3 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { SWAP ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + DIG 2 ; + SWAP ; + UPDATE 3 } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DROP } } } ; SWAP ; SOME } ; IF_NONE diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 2f1bd621..9f6966fb 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1360,6 +1360,14 @@ let should_be_cleared current_time > closing_time + price_wait_window_in_seconds | _ -> false + +[@inline] +let is_cleared + (batch: batch) : bool = + match batch.status with + | Cleared _ -> true + | _ -> false + [@inline] let start_period (pair : pair) @@ -1458,8 +1466,12 @@ let get_current_batch_without_opening let current_batch_index = Utils.get_current_batch_index pair batch_set.current_batch_indices in match Big_map.find_opt current_batch_index batch_set.batches with | None -> None, batch_set - | Some cb -> let batch, batch_set = progress_batch deposit_time_window pair cb batch_set current_time in - Some batch, batch_set + | Some cb -> let is_cleared = is_cleared cb in + if is_cleared then + Some cb, batch_set + else + let batch, batch_set = progress_batch deposit_time_window pair cb batch_set current_time in + Some batch, batch_set [@inline] let get_current_batch From 80eea912caf1b76fec711a706614785bab40257b Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Tue, 20 Jun 2023 08:33:18 +0300 Subject: [PATCH 070/108] Moved burn from deposit. Allowed redemption to calculate how much of the fees should be burned or refunded based on if the amount was in clearing (#372) --- batcher/batcher-ghostnet.tz | 571 ++++++++++++++++++++---------------- batcher/batcher.mligo | 87 ++++-- 2 files changed, 382 insertions(+), 276 deletions(-) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 863dcf91..3ffe9728 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -354,16 +354,19 @@ NEQ ; IF { DROP 2 ; PUSH nat 133 ; FAILWITH } { DUP 2 ; + CDR ; + CDR ; + DUP 3 ; CDR ; CAR ; CDR ; CDR ; - DUP 3 ; + DUP 4 ; CAR ; CDR ; CDR ; CAR ; - DUP 3 ; + DUP 4 ; CAR ; DUP ; CAR ; @@ -379,9 +382,7 @@ GT ; IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } { PUSH bool False ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -420,9 +421,7 @@ AND ; OR } ; PUSH bool False ; - DUP 9 ; - CDR ; - CDR ; + DUP 8 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -463,9 +462,7 @@ AND ; IF { PUSH nat 0 } { PUSH bool False ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -504,9 +501,7 @@ AND ; OR } ; PUSH bool False ; - DUP 9 ; - CDR ; - CDR ; + DUP 8 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -548,9 +543,7 @@ IF { PUSH nat 1 } { PUSH nat 2 } } ; DIG 4 ; SWAP ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; SIZE ; ADD ; COMPARE ; @@ -573,40 +566,37 @@ { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE - { DUP 5 ; - CDR ; - CDR ; - DUP ; - DUP 4 ; + { DUP 4 ; + DUP 3 ; GET 3 ; GET ; IF_NONE - { DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 4 ; + { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; GET 8 ; DUP 2 ; GET 8 ; COMPARE ; EQ ; - DUP 5 ; + DUP 4 ; GET 7 ; DUP 3 ; GET 7 ; COMPARE ; EQ ; - DUP 6 ; + DUP 5 ; GET 5 ; DUP 4 ; GET 5 ; COMPARE ; EQ ; - DUP 7 ; + DUP 6 ; GET 3 ; DUP 5 ; GET 3 ; COMPARE ; EQ ; - DIG 7 ; + DIG 6 ; CAR ; DIG 5 ; CAR ; @@ -616,7 +606,7 @@ AND ; AND ; AND ; - IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; DUP ; DUP 3 ; GET 3 ; @@ -667,12 +657,7 @@ CAR ; CAR ; GET 3 ; - PAIR ; SWAP ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; DIG 3 ; DUP 5 ; GET 8 ; @@ -704,7 +689,7 @@ SWAP ; UPDATE ; PAIR } - { DROP 5 ; PUSH nat 116 ; FAILWITH } ; + { DROP 6 ; PUSH nat 116 ; FAILWITH } ; UNPAIR ; DUP 3 ; DIG 3 ; @@ -1030,12 +1015,10 @@ COMPARE ; LT ; IF { DROP 6 ; PUSH nat 113 ; FAILWITH } - { DUP 2 ; - SWAP ; - COMPARE ; + { COMPARE ; GT ; - IF { DROP 5 ; PUSH nat 130 ; FAILWITH } - { DUP 5 ; + IF { DROP 4 ; PUSH nat 130 ; FAILWITH } + { DUP 4 ; CAR ; CAR ; CAR ; @@ -1044,7 +1027,7 @@ CDR ; DUP 2 ; CAR ; - DUP 6 ; + DUP 5 ; UNPAIR ; DUP ; DUP 3 ; @@ -1062,7 +1045,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 5 ; + DUP 4 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1072,7 +1055,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1108,7 +1091,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DUP 7 ; + { DUP 6 ; CAR ; CAR ; CDR ; @@ -1126,7 +1109,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 5 ; + DUP 4 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1136,7 +1119,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1172,7 +1155,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 4 ; DROP 2 ; SWAP } } + { DIG 3 ; DROP 2 ; SWAP } } { DUP 2 ; INT ; ADD ; @@ -1239,13 +1222,13 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } { DROP ; PUSH bool True } ; - IF { DIG 3 ; DROP } - { DUP 6 ; + IF { DIG 2 ; DROP } + { DUP 5 ; CDR ; CAR ; CDR ; CDR ; - DIG 4 ; + DIG 3 ; UNPAIR ; DUP ; DUP 3 ; @@ -1262,13 +1245,13 @@ VIEW "getPrice" (pair timestamp nat) ; IF_NONE { PUSH nat 124 ; FAILWITH } {} ; CAR ; - DUP 6 ; + DUP 5 ; CAR ; CAR ; CDR ; CAR ; INT ; - DUP 7 ; + DUP 6 ; CDR ; CAR ; CAR ; @@ -1280,8 +1263,8 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } } ; - DUP 5 ; - DIG 5 ; + DUP 4 ; + DIG 4 ; CAR ; DUP ; CAR ; @@ -1304,7 +1287,7 @@ DUP 3 ; CDR ; CDR ; - DUP 8 ; + DUP 7 ; GET 5 ; PUSH nat 0 ; DUP 2 ; @@ -1334,7 +1317,7 @@ EQ ; IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; SENDER ; - DUP 11 ; + DUP 10 ; CAR ; DUP ; CAR ; @@ -1450,7 +1433,7 @@ PUSH bool False ; DIG 2 ; DIG 3 ; - DIG 10 ; + DIG 9 ; CAR ; DIG 4 ; DUP 7 ; @@ -1661,16 +1644,16 @@ SWAP ; UPDATE 14 } } ; DUP 6 ; - DUP 7 ; + DIG 6 ; CAR ; DUP ; CAR ; DUP ; CAR ; - DUP 12 ; - DIG 12 ; + DUP 11 ; + DIG 11 ; CDR ; - DIG 12 ; + DIG 11 ; DIG 7 ; UPDATE 5 ; SOME ; @@ -1692,31 +1675,22 @@ UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; - SELF_ADDRESS ; - DIG 4 ; - CAR ; - CDR ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { DIG 4 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 5 ; UNIT ; TRANSFER_TOKENS } ; - DUP 5 ; + DUP 3 ; GET 7 ; CAR ; - DUP ; + SELF_ADDRESS ; + DUP 2 ; CAR ; GET 5 ; IF_NONE - { DIG 2 ; DIG 5 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 6 ; + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; GET 5 ; - DUP 3 ; + DUP 4 ; CAR ; GET 8 ; IF_NONE - { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } + { DROP 4 ; PUSH nat 108 ; FAILWITH } { PUSH string "FA1.2 token" ; DUP 2 ; COMPARE ; @@ -1726,9 +1700,9 @@ CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH mutez 0 ; - DIG 3 ; + DIG 4 ; CDR ; - DIG 5 ; + DIG 4 ; DIG 4 ; PAIR 3 ; TRANSFER_TOKENS } @@ -1743,27 +1717,27 @@ PUSH mutez 0 ; NIL (pair address (list (pair address nat nat))) ; NIL (pair address nat nat) ; - DUP 6 ; + DUP 7 ; CDR ; - DIG 6 ; + DIG 7 ; CAR ; CAR ; - DIG 8 ; + DIG 7 ; PAIR 3 ; CONS ; DIG 4 ; PAIR ; CONS ; TRANSFER_TOKENS } - { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 3 ; - DIG 3 ; + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 2 ; + DIG 2 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; @@ -1771,11 +1745,9 @@ NIL operation ; DIG 2 ; CONS ; - DIG 2 ; - CONS ; PAIR } - { DROP 7 ; PUSH nat 112 ; FAILWITH } } - { DROP 6 ; PUSH nat 103 ; FAILWITH } } } } } + { DROP 6 ; PUSH nat 112 ; FAILWITH } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } { DUP 2 ; CAR ; CAR ; @@ -1879,47 +1851,69 @@ LT ; IF {} { PUSH nat 118 ; FAILWITH } ; SELF_ADDRESS ; + PUSH mutez 0 ; + PUSH mutez 0 ; + PAIR ; DUP 3 ; + DUP 5 ; + CAR ; + CDR ; + CAR ; + CAR ; + PAIR ; + PAIR ; + DUP 4 ; CDR ; CAR ; CDR ; CAR ; DUP ; - DUP 4 ; + DUP 5 ; GET ; IF_NONE - { DIG 4 ; - DIG 5 ; + { DIG 5 ; + DIG 6 ; DROP 2 ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; SWAP } - { DUP 5 ; + { DUP 6 ; + CAR ; + CAR ; CDR ; CDR ; + DIG 3 ; + PAIR ; DUP 6 ; + CDR ; + CDR ; + DUP 7 ; CAR ; CAR ; CAR ; CDR ; PAIR ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 3 ; + DUP 4 ; + PAIR ; PAIR ; PAIR ; SWAP ; ITER { SWAP ; + UNPAIR ; UNPAIR ; UNPAIR ; DIG 2 ; UNPAIR ; DIG 4 ; UNPAIR ; - DUP 3 ; + DIG 6 ; + UNPAIR ; + DUP 5 ; CDR ; DUP 2 ; GET ; IF_NONE - { DROP 2 ; PAIR ; DUG 2 } + { DROP 2 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP ; GET 3 ; IF_LEFT @@ -1936,38 +1930,45 @@ (pair nat nat nat nat) (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 3 ; PAIR ; DUG 2 } + { DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP 6 ; - DIG 2 ; + DIG 5 ; + PAIR ; + DUP 8 ; + DIG 3 ; GET 5 ; PAIR ; - DIG 7 ; - DIG 2 ; + DIG 9 ; + DIG 3 ; + PAIR ; PAIR ; PAIR ; DIG 2 ; ITER { SWAP ; + UNPAIR ; UNPAIR ; UNPAIR ; DIG 2 ; UNPAIR ; DIG 4 ; UNPAIR ; + DIG 6 ; + UNPAIR ; PUSH nat 0 ; - DUP 4 ; + DUP 6 ; GET 7 ; COMPARE ; EQ ; IF { PUSH bool False } { PUSH nat 0 ; - DUP 4 ; + DUP 6 ; GET 14 ; COMPARE ; EQ ; IF { PUSH bool False } { DUP ; CDR ; - DUP 6 ; + DUP 8 ; GET 3 ; DUP 3 ; CAR ; @@ -2004,15 +2005,15 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } { DROP ; PUSH bool True } } } } } ; - IF { DUP 5 ; + IF { DUP 7 ; GET 6 ; CAR ; - DUP 5 ; + DUP 7 ; DUP 2 ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 6 ; + DUP 8 ; DIG 2 ; CDR ; GET ; @@ -2021,7 +2022,7 @@ CAR ; IF_LEFT { DROP ; - DUP 6 ; + DUP 8 ; GET 5 ; DUP ; GET 5 ; @@ -2062,7 +2063,7 @@ CAR ; MUL ; PAIR ; - DUP 7 ; + DUP 9 ; GET 6 ; GET 3 ; DUP ; @@ -2105,7 +2106,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 20 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2123,7 +2124,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2152,7 +2153,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 18 ; + DUP 21 ; SWAP ; EXEC ; DIG 2 ; @@ -2166,12 +2167,12 @@ DIG 2 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } { DROP ; - DUP 6 ; + DUP 8 ; GET 5 ; DUP ; CAR ; @@ -2212,7 +2213,7 @@ CAR ; MUL ; PAIR ; - DUP 7 ; + DUP 9 ; GET 6 ; GET 3 ; DUP ; @@ -2255,7 +2256,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 20 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2273,7 +2274,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2302,7 +2303,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 18 ; + DUP 21 ; SWAP ; EXEC ; DIG 2 ; @@ -2316,66 +2317,106 @@ DIG 2 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } - { SWAP ; DIG 2 ; DROP 2 } } } - { DUP 5 ; + { SWAP ; DIG 2 ; DROP 2 } } ; + DUP 3 ; + DUP 3 ; + CDR ; + CAR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP } + { DUP 7 ; GET 6 ; CAR ; SWAP ; CAR ; IF_LEFT { DROP ; - DUP 4 ; + DUP 6 ; SWAP ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } { DROP ; - DUP 4 ; + DUP 6 ; SWAP ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; - DIG 5 ; - DUG 2 ; + DUP 4 ; + DUP 4 ; + CDR ; + CDR ; + ADD ; + DUP 4 ; + DIG 4 ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 ; + DIG 7 ; + DIG 3 ; + DIG 3 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } ; DUG 2 ; PAIR ; - SWAP ; + DIG 3 ; + DIG 3 ; + PAIR ; DIG 2 ; + DIG 3 ; + PAIR ; PAIR ; PAIR } ; + UNPAIR ; CAR ; CDR ; - DIG 3 ; - DIG 3 ; - PAIR ; SWAP ; + CAR ; DIG 3 ; - DIG 3 ; + SWAP ; + PAIR ; + DIG 4 ; + DIG 4 ; + PAIR ; + DIG 2 ; + DIG 4 ; + DIG 4 ; NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; SWAP ; UPDATE } } ; PAIR ; + PAIR ; PAIR } ; DIG 5 ; DIG 6 ; DROP 2 ; + UNPAIR ; CAR ; UNPAIR ; - SWAP ; - DUG 2 ; + DIG 2 ; + CAR ; + DIG 2 ; + DIG 3 ; + DIG 3 ; SOME ; - DUP 5 ; + DUP 6 ; UPDATE } ; - NIL operation ; DIG 2 ; + NIL operation ; + DIG 3 ; ITER { CDR ; DUP ; CAR ; @@ -2397,8 +2438,8 @@ PUSH mutez 0 ; DIG 2 ; CDR ; - DUP 7 ; - DUP 7 ; + DUP 8 ; + DUP 8 ; PAIR 3 ; TRANSFER_TOKENS } { PUSH string "FA2 token" ; @@ -2416,31 +2457,65 @@ DIG 5 ; CAR ; CAR ; - DUP 10 ; + DUP 11 ; PAIR 3 ; CONS ; - DUP 7 ; + DUP 8 ; PAIR ; CONS ; TRANSFER_TOKENS } { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; CONS } ; - DIG 2 ; DIG 3 ; + DIG 4 ; DROP 2 ; + PUSH mutez 0 ; DUP 3 ; - DIG 3 ; + CDR ; + CAR ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { PUSH nat 102 ; FAILWITH } + { DUP 3 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + SOME } + { NONE operation } ; + PUSH mutez 0 ; + DUP 4 ; + CDR ; + CDR ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CDR ; + CONTRACT unit ; + IF_NONE + { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + SOME } + { DIG 2 ; DROP ; NONE operation } ; + DUP 5 ; + DIG 5 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 5 ; + DIG 7 ; UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; - SWAP } ; + DIG 2 ; + IF_NONE + { SWAP ; + IF_NONE { SWAP ; DROP ; NIL operation } { DIG 2 ; SWAP ; CONS } } + { DIG 2 ; IF_NONE { DIG 2 } { DIG 3 ; SWAP ; CONS } ; SWAP ; CONS } } ; PAIR } } { DIG 3 ; DROP ; @@ -3167,31 +3242,96 @@ timestamp) (pair nat nat nat nat nat nat nat nat) (pair string string)) } - { DUP ; + { DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; GET 3 ; IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool False } ; - IF { DIG 2 ; DROP ; DUP 3 ; CAR ; CAR ; CAR ; CDR } - { DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - GET 3 ; - IF_LEFT - { SWAP ; - DROP ; + { SWAP ; + DROP ; + IF_LEFT + { DIG 2 ; + DROP 2 ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + DIG 3 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 3 ; + PAIR 4 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 6 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 4 ; DROP 2 } } + { DIG 5 ; + DROP ; + DUP 2 ; + INT ; + ADD ; + DUP 5 ; + COMPARE ; + GE ; + IF { DUP 3 ; + GET 3 ; IF_LEFT - { DIG 2 ; + { SWAP ; + DIG 3 ; DROP 2 ; - PUSH nat 0 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { SWAP ; + INT ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; @@ -3209,100 +3349,27 @@ PAIR 8 ; DUP 5 ; RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 4 ; DROP 2 } } - { DIG 5 ; - DROP ; + SWAP ; + UPDATE 3 } ; DUP 2 ; INT ; ADD ; DUP 5 ; COMPARE ; - GE ; - IF { DUP 3 ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 3 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { SWAP ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - DIG 2 ; - SWAP ; - UPDATE 3 } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DROP } } } ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DROP } } ; SWAP ; SOME } ; IF_NONE diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 9f6966fb..c818ab1e 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -284,6 +284,14 @@ type valid_swaps = (string, valid_swap_reduced) map (* The current, most up to date exchange rates between tokens *) type rates_current = (string, exchange_rate) big_map +type fees = { + to_burn: tez; + to_refund: tez; + payer: address; + burner: address; +} + + [@inline] let get_token (token_name: string) @@ -891,14 +899,19 @@ let get_cleared_payout [@inline] let collect_order_payout_from_clearing - ((c, tam, vols, tokens), (ot, amt): (clearing * token_amount_map * volumes * valid_tokens) * (ordertype * nat)) : (clearing * token_amount_map * volumes * valid_tokens) = - let u_tam: token_amount_map = if was_in_clearing vols ot c then - get_cleared_payout ot amt c tam tokens - else - let ta: token_amount = TokenAmount.recover ot amt c tokens in - TokenAmountMap.increase ta tam + ((c, tam, vols, tokens, fees, fee_in_mutez), (ot, amt): (clearing * token_amount_map * volumes * valid_tokens * fees * tez) * (ordertype * nat)) : (clearing * token_amount_map * volumes * valid_tokens * fees * tez) = + let (u_tam, u_fees) = if was_in_clearing vols ot c then + let tm = get_cleared_payout ot amt c tam tokens in + let f = fees.to_burn + fee_in_mutez in + let uf = { fees with to_burn = f; } in + (tm, uf) + else + let ta: token_amount = TokenAmount.recover ot amt c tokens in + let f = fees.to_refund + fee_in_mutez in + let uf = { fees with to_refund = f; } in + (TokenAmountMap.increase ta tam, uf) in - (c, u_tam, vols, tokens) + (c, u_tam, vols, tokens, u_fees, fee_in_mutez) end @@ -926,28 +939,30 @@ let get_clearing [@inline] let collect_redemptions - ((bots, tam, bts, tokens),(batch_number,otps) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens) * (nat * ordertypes)) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens) = + ((bots, tam, bts, tokens, fees, fee_in_mutez),(batch_number,otps) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens * fees * tez) * (nat * ordertypes)) : (batch_ordertypes * token_amount_map * batch_set * valid_tokens * fees * tez) = let batches = bts.batches in match Big_map.find_opt batch_number batches with - | None -> bots, tam, bts, tokens + | None -> bots, tam, bts, tokens, fees, fee_in_mutez | Some batch -> (match get_clearing batch with - | None -> bots, tam, bts, tokens - | Some c -> let _c, u_tam, _vols, _tokns = Map.fold Redemption_Utils.collect_order_payout_from_clearing otps (c, tam, batch.volumes, tokens ) in + | None -> bots, tam, bts, tokens, fees, fee_in_mutez + | Some c -> let _c, u_tam, _vols, _tokns, fs, _fim = Map.fold Redemption_Utils.collect_order_payout_from_clearing otps (c, tam, batch.volumes, tokens, fees, fee_in_mutez) in let u_bots = Map.remove batch_number bots in - u_bots,u_tam, bts, tokens) + u_bots,u_tam, bts, tokens, fs, fee_in_mutez) [@inline] let collect_redemption_payouts (holder: address) (batch_set: batch_set) (ubots: user_batch_ordertypes) - (tokens: valid_tokens): (user_batch_ordertypes * token_amount_map) = + (tokens: valid_tokens) + (fees: fees) + (fee_in_mutez: tez): (fees * user_batch_ordertypes * token_amount_map) = let empty_tam = (Map.empty : token_amount_map) in match Big_map.find_opt holder ubots with - | None -> ubots, empty_tam - | Some bots -> let u_bots, u_tam, _bs, _tkns = Map.fold collect_redemptions bots (bots, empty_tam, batch_set, tokens) in + | None -> fees, ubots, empty_tam + | Some bots -> let u_bots, u_tam, _bs, _tkns, u_fees, _fim = Map.fold collect_redemptions bots (bots, empty_tam, batch_set, tokens, fees, fee_in_mutez) in let updated_ubots = Big_map.update holder (Some u_bots) ubots in - updated_ubots, u_tam + u_fees, updated_ubots, u_tam [@inline] @@ -1087,24 +1102,49 @@ type storage = Storage.t [@inline] let get_treasury_vault () : address = Tezos.get_self_address () +[@inline] +let resolve_fees + (fees: fees) + (token_ops: operation list): operation list = + let fee_burn_op = if fees.to_burn > 0mutez then + Some (Treasury_Utils.transfer_fee fees.burner fees.to_burn) + else + None + in + let fee_refund_op = if fees.to_refund > 0mutez then + Some (Treasury_Utils.transfer_fee fees.payer fees.to_refund) + else + None + in + match (fee_burn_op, fee_refund_op) with + | Some fbo, Some fro -> fbo :: fro :: token_ops + | Some fbo, None -> fbo :: token_ops + | None, Some fro -> fro :: token_ops + | None, None -> [] + + [@inline] let deposit (deposit_address : address) - (deposited_token : token_amount) - (fee_recipient: address) - (fee_amount: tez) : operation list = + (deposited_token : token_amount) : operation list = let treasury_vault = get_treasury_vault () in - let fee_transfer_op = Treasury_Utils.transfer_fee fee_recipient fee_amount in let deposit_op = Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in - [ fee_transfer_op ; deposit_op] + [ deposit_op] [@inline] let redeem (redeem_address : address) (storage : storage) : operation list * storage = let treasury_vault = get_treasury_vault () in - let updated_ubots, payout_token_map = Ubots.collect_redemption_payouts redeem_address storage.batch_set storage.user_batch_ordertypes storage.valid_tokens in + let fees = { + to_burn = 0mutez; + to_refund = 0mutez; + payer = redeem_address; + burner = storage.fee_recipient; + } in + let fees, updated_ubots, payout_token_map = Ubots.collect_redemption_payouts redeem_address storage.batch_set storage.user_batch_ordertypes storage.valid_tokens fees storage.fee_in_mutez in let operations = Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in + let operations = resolve_fees fees operations in let updated_storage = { storage with user_batch_ordertypes = updated_ubots; } in (operations, updated_storage) @@ -1731,8 +1771,7 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = storage with batch_set = updated_batch_set; last_order_number = next_order_number; user_batch_ordertypes = new_ubot; } in - let fee_recipient = storage.fee_recipient in - let treasury_ops = Treasury.deposit order.trader order.swap.from fee_recipient fee_amount_in_mutez in + let treasury_ops = Treasury.deposit order.trader order.swap.from in (treasury_ops, updated_storage) else From d6ccd0aba97f00d5eef5336ddec64bb09b087179 Mon Sep 17 00:00:00 2001 From: aguillon Date: Tue, 20 Jun 2023 07:35:50 +0200 Subject: [PATCH 071/108] 327-move-fees style suggestion (#373) * Moved burn from deposit. Allowed redemption to calculate how much of the fees should be burned or refunded based on if the amount was in clearing * Small style suggestion --------- Co-authored-by: Jason Ridgway-Taylor Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> --- batcher/batcher-ghostnet.tz | 29 ++ batcher/batcher-mainnet.tz | 710 +++++++++++++++++------------------- batcher/batcher.mligo | 24 +- 3 files changed, 372 insertions(+), 391 deletions(-) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 3ffe9728..caff4ef6 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -2472,6 +2472,35 @@ PUSH mutez 0 ; DUP 3 ; CDR ; + CDR ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CDR ; + CONTRACT unit ; + IF_NONE + { PUSH nat 102 ; FAILWITH } + { DUP 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + {} ; + PUSH mutez 0 ; + DUP 3 ; + CDR ; + CAR ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 2 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { SWAP ; DROP } ; + DUP 3 ; + CDR ; CAR ; COMPARE ; GT ; diff --git a/batcher/batcher-mainnet.tz b/batcher/batcher-mainnet.tz index 90d3b8b1..2b1608a3 100644 --- a/batcher/batcher-mainnet.tz +++ b/batcher/batcher-mainnet.tz @@ -108,17 +108,7 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)))))) + (pair %pair string string))))) (nat %deposit_time_window_in_seconds) (mutez %fee_in_mutez)) (pair (address %fee_recipient) (nat %last_order_number)) @@ -364,16 +354,19 @@ NEQ ; IF { DROP 2 ; PUSH nat 133 ; FAILWITH } { DUP 2 ; + CDR ; + CDR ; + DUP 3 ; CDR ; CAR ; CDR ; CDR ; - DUP 3 ; + DUP 4 ; CAR ; CDR ; CDR ; CAR ; - DUP 3 ; + DUP 4 ; CAR ; DUP ; CAR ; @@ -389,9 +382,7 @@ GT ; IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } { PUSH bool False ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -430,9 +421,7 @@ AND ; OR } ; PUSH bool False ; - DUP 9 ; - CDR ; - CDR ; + DUP 8 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -473,9 +462,7 @@ AND ; IF { PUSH nat 0 } { PUSH bool False ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -514,9 +501,7 @@ AND ; OR } ; PUSH bool False ; - DUP 9 ; - CDR ; - CDR ; + DUP 8 ; ITER { CDR ; SWAP ; DUP 2 ; @@ -558,9 +543,7 @@ IF { PUSH nat 1 } { PUSH nat 2 } } ; DIG 4 ; SWAP ; - DUP 8 ; - CDR ; - CDR ; + DUP 7 ; SIZE ; ADD ; COMPARE ; @@ -583,40 +566,37 @@ { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE - { DUP 5 ; - CDR ; - CDR ; - DUP ; - DUP 4 ; + { DUP 4 ; + DUP 3 ; GET 3 ; GET ; IF_NONE - { DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 4 ; + { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; GET 8 ; DUP 2 ; GET 8 ; COMPARE ; EQ ; - DUP 5 ; + DUP 4 ; GET 7 ; DUP 3 ; GET 7 ; COMPARE ; EQ ; - DUP 6 ; + DUP 5 ; GET 5 ; DUP 4 ; GET 5 ; COMPARE ; EQ ; - DUP 7 ; + DUP 6 ; GET 3 ; DUP 5 ; GET 3 ; COMPARE ; EQ ; - DIG 7 ; + DIG 6 ; CAR ; DIG 5 ; CAR ; @@ -626,7 +606,7 @@ AND ; AND ; AND ; - IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; DUP ; DUP 3 ; GET 3 ; @@ -677,12 +657,7 @@ CAR ; CAR ; GET 3 ; - PAIR ; SWAP ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; DIG 3 ; DUP 5 ; GET 8 ; @@ -714,7 +689,7 @@ SWAP ; UPDATE ; PAIR } - { DROP 5 ; PUSH nat 116 ; FAILWITH } ; + { DROP 6 ; PUSH nat 116 ; FAILWITH } ; UNPAIR ; DUP 3 ; DIG 3 ; @@ -999,10 +974,7 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 3 ; - CDR ; - CDR ; - DUP 3 ; + DUP 2 ; CAR ; DUP ; CDR ; @@ -1012,19 +984,8 @@ CAR ; GET 3 ; PAIR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - IF_LEFT { DROP } { DROP ; SWAP } ; SWAP ; - PAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; NOW ; DUP 4 ; CDR ; @@ -1033,15 +994,12 @@ CDR ; DUP 3 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; GET 8 ; @@ -1057,56 +1015,37 @@ COMPARE ; LT ; IF { DROP 6 ; PUSH nat 113 ; FAILWITH } - { DUP 2 ; - SWAP ; - COMPARE ; + { COMPARE ; GT ; - IF { DROP 5 ; PUSH nat 130 ; FAILWITH } - { DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 6 ; + IF { DROP 4 ; PUSH nat 130 ; FAILWITH } + { DUP 4 ; CAR ; CAR ; CAR ; CDR ; + DUP ; CDR ; - DUP 7 ; - CAR ; - CAR ; - CAR ; - CDR ; + DUP 2 ; CAR ; - DUP 6 ; + DUP 5 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DROP ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - PUSH nat 0 ; + { PUSH nat 0 ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 5 ; + DUP 4 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1116,7 +1055,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1144,36 +1083,33 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DUP ; + { DUP 6 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; GET 3 ; IF_LEFT - { DIG 2 ; + { SWAP ; DROP ; IF_LEFT { DROP 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; PUSH nat 0 ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 5 ; + DUP 4 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1183,7 +1119,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1211,25 +1147,22 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 3 ; DROP 2 ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } - { DUP 3 ; + { DIG 3 ; DROP 2 ; SWAP } } + { DUP 2 ; INT ; ADD ; DIG 4 ; COMPARE ; GE ; - IF { DUP ; + IF { DUP 2 ; GET 3 ; IF_LEFT { SWAP ; @@ -1238,7 +1171,7 @@ IF_LEFT { DROP ; PUSH nat 105 ; FAILWITH } { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; + { SWAP ; INT ; DUP 2 ; ADD ; @@ -1252,16 +1185,8 @@ (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; + DUP 2 ; + DUP 3 ; CDR ; DUP 3 ; SOME ; @@ -1269,11 +1194,7 @@ CAR ; UPDATE ; UPDATE 2 ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; + DIG 2 ; CAR ; DUP 3 ; CAR ; @@ -1281,18 +1202,15 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { SWAP ; DROP ; DUP 5 ; CAR ; CAR ; CAR ; CDR } } } ; + { DROP ; SWAP } } } ; SWAP ; DUP ; GET 3 ; @@ -1304,23 +1222,20 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } { DROP ; PUSH bool True } ; - IF { DIG 3 ; DROP } - { DUP 6 ; + IF { DIG 2 ; DROP } + { DUP 5 ; CDR ; CAR ; CDR ; CDR ; - DIG 4 ; + DIG 3 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; DUP ; @@ -1330,13 +1245,13 @@ VIEW "getPrice" (pair timestamp nat) ; IF_NONE { PUSH nat 124 ; FAILWITH } {} ; CAR ; - DUP 6 ; + DUP 5 ; CAR ; CAR ; CDR ; CAR ; INT ; - DUP 7 ; + DUP 6 ; CDR ; CAR ; CAR ; @@ -1348,8 +1263,8 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } } ; - DUP 5 ; - DIG 5 ; + DUP 4 ; + DIG 4 ; CAR ; DUP ; CAR ; @@ -1369,6 +1284,9 @@ CAR ; CDR ; ADD ; + DUP 3 ; + CDR ; + CDR ; DUP 7 ; GET 5 ; PUSH nat 0 ; @@ -1399,28 +1317,25 @@ EQ ; IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; SENDER ; - DUP 6 ; - CDR ; - CDR ; - DUP 11 ; + DUP 10 ; CAR ; DUP ; CAR ; CAR ; DUP 2 ; CDR ; - DUP 4 ; + DUP 7 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DUP 5 ; + { SWAP ; DIG 2 ; DIG 6 ; DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 7 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { DROP 5 ; PUSH nat 110 ; FAILWITH } + { DROP 4 ; PUSH nat 110 ; FAILWITH } { DUP ; GET 8 ; DUP 4 ; @@ -1498,39 +1413,27 @@ CAR ; GET 3 ; PAIR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 8 ; + DUP 7 ; CDR ; CAR ; CDR ; CDR ; - DUP 6 ; - IF_LEFT { DROP ; SWAP } { DROP ; DIG 2 } ; - DIG 2 ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP 5 ; + IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; + UNPAIR ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; MEM ; IF {} { PUSH nat 110 ; FAILWITH } } - { DROP 2 ; PUSH nat 110 ; FAILWITH } } } ; + { DROP ; PUSH nat 110 ; FAILWITH } } } ; PUSH bool False ; DIG 2 ; DIG 3 ; - DIG 10 ; + DIG 9 ; CAR ; DIG 4 ; DUP 7 ; @@ -1741,16 +1644,16 @@ SWAP ; UPDATE 14 } } ; DUP 6 ; - DUP 7 ; + DIG 6 ; CAR ; DUP ; CAR ; DUP ; CAR ; - DUP 12 ; - DIG 12 ; + DUP 11 ; + DIG 11 ; CDR ; - DIG 12 ; + DIG 11 ; DIG 7 ; UPDATE 5 ; SOME ; @@ -1772,31 +1675,22 @@ UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; - SELF_ADDRESS ; - DIG 4 ; - CAR ; - CDR ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { DIG 4 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 5 ; UNIT ; TRANSFER_TOKENS } ; - DUP 5 ; + DUP 3 ; GET 7 ; CAR ; - DUP ; + SELF_ADDRESS ; + DUP 2 ; CAR ; GET 5 ; IF_NONE - { DIG 2 ; DIG 5 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 6 ; + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; GET 5 ; - DUP 3 ; + DUP 4 ; CAR ; GET 8 ; IF_NONE - { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } + { DROP 4 ; PUSH nat 108 ; FAILWITH } { PUSH string "FA1.2 token" ; DUP 2 ; COMPARE ; @@ -1806,9 +1700,9 @@ CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH mutez 0 ; - DIG 3 ; + DIG 4 ; CDR ; - DIG 5 ; + DIG 4 ; DIG 4 ; PAIR 3 ; TRANSFER_TOKENS } @@ -1823,27 +1717,27 @@ PUSH mutez 0 ; NIL (pair address (list (pair address nat nat))) ; NIL (pair address nat nat) ; - DUP 6 ; + DUP 7 ; CDR ; - DIG 6 ; + DIG 7 ; CAR ; CAR ; - DIG 8 ; + DIG 7 ; PAIR 3 ; CONS ; DIG 4 ; PAIR ; CONS ; TRANSFER_TOKENS } - { SWAP ; DIG 2 ; DIG 4 ; DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 3 ; - DIG 3 ; + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 2 ; + DIG 2 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; @@ -1851,11 +1745,9 @@ NIL operation ; DIG 2 ; CONS ; - DIG 2 ; - CONS ; PAIR } - { DROP 7 ; PUSH nat 112 ; FAILWITH } } - { DROP 6 ; PUSH nat 103 ; FAILWITH } } } } } + { DROP 6 ; PUSH nat 112 ; FAILWITH } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } { DUP 2 ; CAR ; CAR ; @@ -1959,47 +1851,69 @@ LT ; IF {} { PUSH nat 118 ; FAILWITH } ; SELF_ADDRESS ; + PUSH mutez 0 ; + PUSH mutez 0 ; + PAIR ; DUP 3 ; + DUP 5 ; + CAR ; + CDR ; + CAR ; + CAR ; + PAIR ; + PAIR ; + DUP 4 ; CDR ; CAR ; CDR ; CAR ; DUP ; - DUP 4 ; + DUP 5 ; GET ; IF_NONE - { DIG 4 ; - DIG 5 ; + { DIG 5 ; + DIG 6 ; DROP 2 ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; SWAP } - { DUP 5 ; + { DUP 6 ; + CAR ; + CAR ; CDR ; CDR ; + DIG 3 ; + PAIR ; DUP 6 ; + CDR ; + CDR ; + DUP 7 ; CAR ; CAR ; CAR ; CDR ; PAIR ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 3 ; + DUP 4 ; + PAIR ; PAIR ; PAIR ; SWAP ; ITER { SWAP ; + UNPAIR ; UNPAIR ; UNPAIR ; DIG 2 ; UNPAIR ; DIG 4 ; UNPAIR ; - DUP 3 ; + DIG 6 ; + UNPAIR ; + DUP 5 ; CDR ; DUP 2 ; GET ; IF_NONE - { DROP 2 ; PAIR ; DUG 2 } + { DROP 2 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP ; GET 3 ; IF_LEFT @@ -2016,38 +1930,45 @@ (pair nat nat nat nat) (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 3 ; PAIR ; DUG 2 } + { DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP 6 ; - DIG 2 ; + DIG 5 ; + PAIR ; + DUP 8 ; + DIG 3 ; GET 5 ; PAIR ; - DIG 7 ; - DIG 2 ; + DIG 9 ; + DIG 3 ; + PAIR ; PAIR ; PAIR ; DIG 2 ; ITER { SWAP ; + UNPAIR ; UNPAIR ; UNPAIR ; DIG 2 ; UNPAIR ; DIG 4 ; UNPAIR ; + DIG 6 ; + UNPAIR ; PUSH nat 0 ; - DUP 4 ; + DUP 6 ; GET 7 ; COMPARE ; EQ ; IF { PUSH bool False } { PUSH nat 0 ; - DUP 4 ; + DUP 6 ; GET 14 ; COMPARE ; EQ ; IF { PUSH bool False } { DUP ; CDR ; - DUP 6 ; + DUP 8 ; GET 3 ; DUP 3 ; CAR ; @@ -2084,15 +2005,15 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } { DROP ; PUSH bool True } } } } } ; - IF { DUP 5 ; + IF { DUP 7 ; GET 6 ; CAR ; - DUP 5 ; + DUP 7 ; DUP 2 ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 6 ; + DUP 8 ; DIG 2 ; CDR ; GET ; @@ -2101,7 +2022,7 @@ CAR ; IF_LEFT { DROP ; - DUP 6 ; + DUP 8 ; GET 5 ; DUP ; GET 5 ; @@ -2142,7 +2063,7 @@ CAR ; MUL ; PAIR ; - DUP 7 ; + DUP 9 ; GET 6 ; GET 3 ; DUP ; @@ -2185,7 +2106,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 20 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2203,7 +2124,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2232,7 +2153,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 18 ; + DUP 21 ; SWAP ; EXEC ; DIG 2 ; @@ -2246,12 +2167,12 @@ DIG 2 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } { DROP ; - DUP 6 ; + DUP 8 ; GET 5 ; DUP ; CAR ; @@ -2292,7 +2213,7 @@ CAR ; MUL ; PAIR ; - DUP 7 ; + DUP 9 ; GET 6 ; GET 3 ; DUP ; @@ -2335,7 +2256,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 20 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2353,7 +2274,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 6 ; SWAP ; PAIR ; DUP 15 ; SWAP ; EXEC } { DROP ; DIG 5 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2382,7 +2303,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 18 ; + DUP 21 ; SWAP ; EXEC ; DIG 2 ; @@ -2396,66 +2317,106 @@ DIG 2 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } - { SWAP ; DIG 2 ; DROP 2 } } } - { DUP 5 ; + { SWAP ; DIG 2 ; DROP 2 } } ; + DUP 3 ; + DUP 3 ; + CDR ; + CAR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP } + { DUP 7 ; GET 6 ; CAR ; SWAP ; CAR ; IF_LEFT { DROP ; - DUP 4 ; + DUP 6 ; SWAP ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } { DROP ; - DUP 4 ; + DUP 6 ; SWAP ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; - DIG 5 ; - DUG 2 ; + DUP 4 ; + DUP 4 ; + CDR ; + CDR ; + ADD ; + DUP 4 ; + DIG 4 ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 ; + DIG 7 ; + DIG 3 ; + DIG 3 ; PAIR ; PAIR ; - DUP 13 ; + DUP 16 ; SWAP ; EXEC } ; DUG 2 ; PAIR ; - SWAP ; + DIG 3 ; + DIG 3 ; + PAIR ; DIG 2 ; + DIG 3 ; + PAIR ; PAIR ; PAIR } ; + UNPAIR ; CAR ; CDR ; - DIG 3 ; - DIG 3 ; - PAIR ; SWAP ; + CAR ; DIG 3 ; - DIG 3 ; + SWAP ; + PAIR ; + DIG 4 ; + DIG 4 ; + PAIR ; + DIG 2 ; + DIG 4 ; + DIG 4 ; NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; SWAP ; UPDATE } } ; PAIR ; + PAIR ; PAIR } ; DIG 5 ; DIG 6 ; DROP 2 ; + UNPAIR ; CAR ; UNPAIR ; - SWAP ; - DUG 2 ; + DIG 2 ; + CAR ; + DIG 2 ; + DIG 3 ; + DIG 3 ; SOME ; - DUP 5 ; + DUP 6 ; UPDATE } ; - NIL operation ; DIG 2 ; + NIL operation ; + DIG 3 ; ITER { CDR ; DUP ; CAR ; @@ -2477,8 +2438,8 @@ PUSH mutez 0 ; DIG 2 ; CDR ; - DUP 7 ; - DUP 7 ; + DUP 8 ; + DUP 8 ; PAIR 3 ; TRANSFER_TOKENS } { PUSH string "FA2 token" ; @@ -2496,18 +2457,48 @@ DIG 5 ; CAR ; CAR ; - DUP 10 ; + DUP 11 ; PAIR 3 ; CONS ; - DUP 7 ; + DUP 8 ; PAIR ; CONS ; TRANSFER_TOKENS } { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; CONS } ; - DIG 2 ; DIG 3 ; + DIG 4 ; DROP 2 ; + PUSH mutez 0 ; + DUP 3 ; + CDR ; + CDR ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CDR ; + CONTRACT unit ; + IF_NONE + { PUSH nat 102 ; FAILWITH } + { DUP 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + {} ; + PUSH mutez 0 ; + DUP 3 ; + CDR ; + CAR ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 2 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { SWAP ; DROP } ; DUP 3 ; DIG 3 ; CDR ; @@ -3038,12 +3029,9 @@ COMPARE ; LT ; IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 5 ; - CDR ; - CDR ; - DUP 4 ; + DUP 3 ; CAR ; - DIG 4 ; + DIG 3 ; GET 7 ; DUP ; DUP 3 ; @@ -3059,10 +3047,10 @@ SUB ; PUSH int 10 ; PAIR ; - DUP 8 ; + DUP 7 ; SWAP ; EXEC ; - DIG 4 ; + DIG 3 ; MUL ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; @@ -3073,11 +3061,11 @@ INT ; PUSH int 10 ; PAIR ; - DUP 8 ; + DUP 7 ; SWAP ; EXEC ; SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 8 ; SWAP ; EXEC ; DIG 4 } ; + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; INT ; PUSH int 1 ; DIG 2 ; @@ -3096,7 +3084,7 @@ CAR ; MUL ; PAIR ; - DIG 3 ; + DIG 2 ; SWAP ; DUP 3 ; CDR ; @@ -3107,15 +3095,17 @@ GET 3 ; PAIR ; PAIR 3 ; - DUP ; - CAR ; DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; DUP 2 ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 3 ; - DIG 2 ; + DUG 2 ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; @@ -3200,59 +3190,43 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 2 ; - DUP ; - CDR ; - CDR ; - DUP 3 ; + DUP 2 ; CAR ; UNIT ; LEFT unit ; - DUP 3 ; - DUP 3 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 3 ; - DIG 3 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - IF_LEFT { DROP } { DROP ; SWAP } ; - SWAP ; - PAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; NOW ; DUP 3 ; CAR ; CAR ; CAR ; CDR ; + CDR ; DUP 4 ; CAR ; CAR ; - CDR ; CAR ; - DUP 2 ; CDR ; - DUP 3 ; CAR ; - DUP 6 ; + DUP 4 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { DIG 3 ; - DROP 2 ; + { SWAP ; + DROP ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CDR ; NONE (pair nat (or (or (pair (pair timestamp (pair (pair nat nat nat) @@ -3263,19 +3237,25 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair (pair nat string (option address) nat (option string)) - nat - string - (option address) - nat - (option string))) } - { DUP ; + (pair string string)) } + { DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; GET 3 ; IF_LEFT - { DIG 2 ; + { SWAP ; DROP ; IF_LEFT - { DROP 2 ; + { DIG 2 ; + DROP 2 ; PUSH nat 0 ; DUP 2 ; CAR ; @@ -3320,36 +3300,33 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 4 ; DROP 2 ; SWAP } } + { DIG 4 ; DROP 2 } } { DIG 5 ; DROP ; - DUP 3 ; + DUP 2 ; INT ; ADD ; DUP 5 ; COMPARE ; GE ; - IF { DUP ; + IF { DUP 3 ; GET 3 ; IF_LEFT { SWAP ; - DIG 2 ; + DIG 3 ; DROP 2 ; IF_LEFT { DROP ; PUSH nat 105 ; FAILWITH } { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; + { SWAP ; INT ; DUP 2 ; ADD ; @@ -3362,6 +3339,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; + DIG 2 ; + SWAP ; UPDATE 3 } ; DUP 2 ; DUP 3 ; @@ -3380,18 +3359,15 @@ DUP 4 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { SWAP ; DROP ; SWAP } } ; + { DROP } } ; SWAP ; SOME } ; IF_NONE @@ -3878,15 +3854,12 @@ DIG 3 ; GET 6 ; UNPAIR ; - GET 3 ; - SWAP ; - GET 3 ; - DUP 2 ; - DUP 2 ; + DUP ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; @@ -3956,17 +3929,7 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)))) + (pair %pair string string))) { CDR ; NIL (pair nat (or (or (pair (pair timestamp @@ -3978,12 +3941,7 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair (pair nat string (option address) nat (option string)) - nat - string - (option address) - nat - (option string))) ; + (pair string string)) ; DUP 2 ; CAR ; CAR ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index c818ab1e..4d3d8a8f 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1106,22 +1106,16 @@ let get_treasury_vault () : address = Tezos.get_self_address () let resolve_fees (fees: fees) (token_ops: operation list): operation list = - let fee_burn_op = if fees.to_burn > 0mutez then - Some (Treasury_Utils.transfer_fee fees.burner fees.to_burn) - else - None - in - let fee_refund_op = if fees.to_refund > 0mutez then - Some (Treasury_Utils.transfer_fee fees.payer fees.to_refund) - else - None + let token_ops = + if fees.to_refund > 0mutez then + Treasury_Utils.transfer_fee fees.payer fees.to_refund :: token_ops + else + token_ops in - match (fee_burn_op, fee_refund_op) with - | Some fbo, Some fro -> fbo :: fro :: token_ops - | Some fbo, None -> fbo :: token_ops - | None, Some fro -> fro :: token_ops - | None, None -> [] - + if fees.to_burn > 0mutez then + Treasury_Utils.transfer_fee fees.burner fees.to_burn :: token_ops + else + token_ops [@inline] let deposit From 9cba481427235d5bb644feceb9e7dbcf25eb2f9a Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:07:54 +0300 Subject: [PATCH 072/108] 345 remove batches from bigmap imp2 (#377) * Added refunds of tokens and fess on cancelation * Added check that batch is open in order to cancel * Added batch_holdings object, utils and adjusted storage * Remove holdings and remove batch is completely cleared * Corrected can_batch_be_removed * Added alternative implementation of batch holdings --- batcher/batcher-ghostnet.tz | 3111 +++++++++++++++++++++-------------- batcher/batcher.mligo | 225 ++- 2 files changed, 2060 insertions(+), 1276 deletions(-) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index caff4ef6..a27ebf5f 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -20,15 +20,16 @@ (string %oracle_asset_name) (nat %oracle_precision) (bool %is_disabled_for_deposits))) - (or (nat %amend_token_and_pair_limit) (address %change_admin_address))) - (or (or (nat %change_deposit_time_window) (mutez %change_fee)) - (or (pair %change_oracle_source_of_pair + (or (nat %amend_token_and_pair_limit) (pair %cancel string string))) + (or (or (address %change_admin_address) (nat %change_deposit_time_window)) + (or (mutez %change_fee) + (pair %change_oracle_source_of_pair (string %pair_name) (address %oracle_address) (string %oracle_asset_name) - (nat %oracle_precision)) - (nat %change_scale_factor)))) - (or (or (or (pair %deposit + (nat %oracle_precision))))) + (or (or (or (nat %change_scale_factor) + (pair %deposit (pair %swap (pair %from (pair %token @@ -46,11 +47,10 @@ (option %standard string))) (timestamp %created_at) (nat %side) - (nat %tolerance)) - (string %disable_swap_pair_for_deposit)) - (or (string %enable_swap_pair_for_deposit) (unit %redeem))) - (or (or (string %remove_metadata) - (pair %remove_token_swap_pair + (nat %tolerance))) + (or (string %disable_swap_pair_for_deposit) (string %enable_swap_pair_for_deposit))) + (or (or (unit %redeem) (string %remove_metadata)) + (or (pair %remove_token_swap_pair (pair %swap (pair %from (pair %token @@ -69,8 +69,8 @@ (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision) - (bool %is_disabled_for_deposits))) - (string %tick)))) ; + (bool %is_disabled_for_deposits)) + (string %tick))))) ; storage (pair (pair (pair (pair (address %administrator) (pair %batch_set @@ -108,7 +108,8 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair string string))))) + (pair %pair string string) + (nat %holdings))))) (nat %deposit_time_window_in_seconds) (mutez %fee_in_mutez)) (pair (address %fee_recipient) (nat %last_order_number)) @@ -248,13 +249,14 @@ UNPAIR ; IF_LEFT { DIG 2 ; - DIG 3 ; DIG 4 ; DIG 5 ; - DROP 4 ; + DROP 3 ; IF_LEFT { IF_LEFT - { IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -711,7 +713,9 @@ NIL operation ; PAIR } } } } } { IF_LEFT - { DUP 2 ; + { DIG 2 ; + DROP ; + DUP 2 ; CAR ; CAR ; CAR ; @@ -757,6 +761,529 @@ UPDATE 1 ; NIL operation ; PAIR } } } + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SENDER ; + DUP 2 ; + UNPAIR ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 117 ; FAILWITH } + { DUP 4 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + NOW ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 7 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH nat 0 ; + DIG 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 4 ; + PAIR 5 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH nat 0 ; + DIG 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 5 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 4 ; + PAIR 5 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } + { DIG 6 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DIG 3 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP ; + DUP 2 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; + SWAP ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + NOT ; + IF { PUSH nat 140 ; FAILWITH } {} ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 5 ; + GET ; + IF_NONE + { DROP 6 ; PUSH nat 139 ; FAILWITH } + { DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } + { DUP 8 ; + DUP 9 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 11 ; + CDR ; + CAR ; + CDR ; + CAR ; + DIG 7 ; + DIG 7 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; + UPDATE ; + SOME ; + DUP 11 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + GET 5 ; + DUP 2 ; + ITER { UNPAIR ; + UNPAIR ; + IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + SUB ; + ABS ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 3 ; + SUB ; + ABS ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + CAR ; + SUB ; + ABS ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 5 ; + SUB ; + ABS ; + UPDATE 5 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 14 ; + SUB ; + ABS ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 11 ; + SUB ; + ABS ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 9 ; + SUB ; + ABS ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 13 ; + SUB ; + ABS ; + UPDATE 13 ; + SWAP ; + UPDATE 14 } } } ; + DIG 3 ; + SWAP ; + UPDATE 5 ; + DUP 3 ; + DIG 3 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 7 ; + DIG 7 ; + CDR ; + DUP 7 ; + SOME ; + DIG 7 ; + CAR ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + PUSH mutez 0 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + PAIR ; + DIG 2 ; + ITER { SWAP ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + CAR ; + IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; + PAIR ; + PAIR ; + DUP 6 ; + SWAP ; + EXEC ; + DUP 3 ; + CAR ; + CAR ; + CDR ; + CDR ; + DIG 2 ; + ADD ; + SWAP ; + PAIR } ; + DIG 2 ; + DIG 4 ; + DROP 2 ; + UNPAIR ; + SELF_ADDRESS ; + NIL operation ; + DIG 2 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 8 ; + DUP 6 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 11 ; + PAIR 3 ; + CONS ; + DUP 6 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + SWAP ; + DROP ; + PUSH mutez 0 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 3 ; + CONTRACT unit ; + IF_NONE + { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { SWAP ; DIG 3 ; DROP 2 } ; + PAIR } } } } } + { DIG 2 ; + DROP ; + IF_LEFT + { IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -784,9 +1311,7 @@ UPDATE 1 ; UPDATE 1 ; NIL operation ; - PAIR } } } - { IF_LEFT - { IF_LEFT + PAIR } { DUP 2 ; CAR ; CAR ; @@ -824,7 +1349,8 @@ UPDATE 1 ; UPDATE 1 ; NIL operation ; - PAIR } } } + PAIR } } } } + { IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -850,10 +1376,7 @@ UPDATE 2 ; UPDATE 2 ; UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } } - { IF_LEFT + UPDATE 1 } { DUP 2 ; CAR ; CAR ; @@ -912,9 +1435,17 @@ UPDATE 2 ; UPDATE 2 ; UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - PAIR } + UPDATE 2 } ; + NIL operation ; + PAIR } } } + { IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + DROP 4 ; + IF_LEFT + { IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -952,16 +1483,7 @@ UPDATE 1 ; UPDATE 2 ; NIL operation ; - PAIR } } } } } } - { IF_LEFT - { DIG 2 ; - DIG 4 ; - DROP 2 ; - IF_LEFT - { DIG 2 ; - DIG 3 ; - DROP 2 ; - IF_LEFT + PAIR } } } { DUP ; GET 5 ; PUSH nat 0 ; @@ -1019,13 +1541,21 @@ GT ; IF { DROP 4 ; PUSH nat 130 ; FAILWITH } { DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 5 ; CAR ; CAR ; CAR ; CDR ; - DUP ; CDR ; - DUP 2 ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; CAR ; DUP 5 ; UNPAIR ; @@ -1039,13 +1569,20 @@ IF_NONE { PUSH nat 0 } {} ; GET ; IF_NONE - { PUSH nat 0 ; + { DROP ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 4 ; + PUSH nat 0 ; + DUP 5 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1055,7 +1592,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 4 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1064,8 +1601,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; + DIG 4 ; + PAIR 5 ; DUP 2 ; DUP 3 ; CDR ; @@ -1081,7 +1618,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -1091,25 +1628,26 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DUP 6 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 2 ; + { DUP ; GET 3 ; IF_LEFT - { SWAP ; + { DIG 2 ; DROP ; IF_LEFT { DROP 2 ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; PUSH nat 0 ; DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DUP 4 ; + PUSH nat 0 ; + DUP 5 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1119,7 +1657,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 4 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1128,8 +1666,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; + DIG 4 ; + PAIR 5 ; DUP 2 ; DUP 3 ; CDR ; @@ -1145,7 +1683,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -1155,14 +1693,14 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 3 ; DROP 2 ; SWAP } } - { DUP 2 ; + { DIG 2 ; DROP 2 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } + { DUP 3 ; INT ; ADD ; - DIG 5 ; + DIG 3 ; COMPARE ; GE ; - IF { DUP 2 ; + IF { DUP ; GET 3 ; IF_LEFT { SWAP ; @@ -1171,7 +1709,7 @@ IF_LEFT { DROP ; PUSH nat 105 ; FAILWITH } { DROP ; PUSH nat 105 ; FAILWITH } } - { SWAP ; + { DIG 2 ; INT ; DUP 2 ; ADD ; @@ -1185,22 +1723,27 @@ (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP ; DUP 2 ; - DUP 3 ; CDR ; - DUP 3 ; - SOME ; DUP 4 ; + SOME ; + DUP 5 ; CAR ; UPDATE ; UPDATE 2 ; - DIG 2 ; + SWAP ; CAR ; DUP 3 ; CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -1210,7 +1753,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DROP ; SWAP } } } ; + { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; SWAP ; DUP ; GET 3 ; @@ -1284,10 +1827,7 @@ CAR ; CDR ; ADD ; - DUP 3 ; - CDR ; - CDR ; - DUP 7 ; + DUP 6 ; GET 5 ; PUSH nat 0 ; DUP 2 ; @@ -1299,7 +1839,7 @@ COMPARE ; EQ ; IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 9 ; + DUP 7 ; GET 6 ; PUSH nat 0 ; DUP 2 ; @@ -1317,6 +1857,9 @@ EQ ; IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; SENDER ; + DUP 6 ; + CDR ; + CDR ; DUP 10 ; CAR ; DUP ; @@ -1324,13 +1867,13 @@ CAR ; DUP 2 ; CDR ; - DUP 7 ; + DUP 4 ; DUP 3 ; GET 3 ; GET ; IF_NONE - { SWAP ; DIG 2 ; DIG 6 ; DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 7 ; + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 4 ; DUP 3 ; GET 3 ; GET ; @@ -1456,112 +1999,26 @@ SWAP ; COMPARE ; LE } ; - IF { DUP ; + IF { DUP 5 ; GET 5 ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - CAR ; DUP 2 ; - GET ; - IF_NONE - { DUP 5 ; - CDR ; - CAR ; - CDR ; - CAR ; - EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 5 ; - GET 7 ; - CAR ; - CDR ; - DUP 6 ; - GET 11 ; - DUP 7 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DUP 7 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 2 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP ; - DUP 6 ; - GET ; - IF_NONE - { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DUP 5 ; - GET 11 ; - DUP 6 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DUP 6 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP 4 ; - GET 11 ; - DUP 5 ; - GET 9 ; - PAIR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DUP 5 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 6 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; - SOME ; - DUP 6 ; - UPDATE } ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - SWAP ; - SOME ; - DIG 2 ; - UPDATE } ; - DUP 6 ; - GET 5 ; - DUP 3 ; GET 9 ; IF_LEFT { DROP ; - DUP 3 ; + DUP 2 ; GET 7 ; CAR ; CDR ; DUP 2 ; GET 7 ; ADD ; - DUP 4 ; + DUP 3 ; GET 11 ; IF_LEFT { IF_LEFT { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1573,7 +2030,7 @@ UPDATE 7 } { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1585,7 +2042,7 @@ UPDATE 7 } } { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1596,20 +2053,20 @@ SWAP ; UPDATE 7 } } { DROP ; - DUP 3 ; + DUP 2 ; GET 7 ; CAR ; CDR ; DUP 2 ; GET 14 ; ADD ; - DUP 4 ; + DUP 3 ; GET 11 ; IF_LEFT { IF_LEFT { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1621,7 +2078,7 @@ UPDATE 14 } { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1633,7 +2090,7 @@ UPDATE 14 } } { DROP ; DUP 2 ; - DUP 5 ; + DUP 4 ; GET 7 ; CAR ; CDR ; @@ -1643,117 +2100,230 @@ UPDATE 13 ; SWAP ; UPDATE 14 } } ; - DUP 6 ; - DIG 6 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 11 ; - DIG 11 ; + DUP 7 ; CDR ; - DIG 11 ; - DIG 7 ; + DIG 6 ; + DIG 2 ; UPDATE 5 ; SOME ; - DIG 10 ; + DUP 5 ; UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP ; + DUP 5 ; + CDR ; CAR ; - DUP ; CDR ; - DUP ; CAR ; - DIG 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; DUP 3 ; - GET 7 ; - CAR ; - SELF_ADDRESS ; - DUP 2 ; - CAR ; GET 5 ; + GET ; IF_NONE - { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 5 ; - GET 5 ; - DUP 4 ; - CAR ; - GET 8 ; + { DUP ; + DUP 5 ; + GET ; IF_NONE - { DROP 4 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - SWAP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 4 ; - CDR ; - DIG 4 ; - DIG 4 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { SWAP ; - CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 7 ; - CDR ; - DIG 7 ; - CAR ; - CAR ; - DIG 7 ; - PAIR 3 ; - CONS ; - DIG 4 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 8 ; ADD ; UPDATE 8 ; SOME ; DUP 5 ; UPDATE } } + { DUP 5 ; + GET ; + IF_NONE + { DUP ; + DUP 5 ; + GET ; + IF_NONE + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 8 ; ADD ; UPDATE 8 ; SOME ; DUP 5 ; UPDATE } } + { DROP } } ; DUP 2 ; - DIG 2 ; + GET 5 ; + DUP 6 ; CDR ; - DUP ; CAR ; - DUP ; CDR ; - DIG 5 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - DIG 2 ; - CONS ; - PAIR } - { DROP 6 ; PUSH nat 112 ; FAILWITH } } - { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 6 ; + GET 7 ; + CAR ; + CDR ; + DUP 7 ; + GET 11 ; + DUP 8 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 7 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 2 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 7 ; + GET ; + IF_NONE + { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DUP 6 ; + GET 11 ; + DUP 7 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP 5 ; + GET 11 ; + DUP 6 ; + GET 9 ; + PAIR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; + SOME ; + DIG 6 ; + UPDATE } ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + SWAP ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 8 ; + DIG 6 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP 3 ; + GET 7 ; + CAR ; + SELF_ADDRESS ; + DUP 2 ; + CAR ; + GET 5 ; + IF_NONE + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; + GET 5 ; + DUP 4 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 4 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + SWAP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 4 ; + CDR ; + DIG 4 ; + DIG 4 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { SWAP ; + CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 7 ; + CDR ; + DIG 7 ; + CAR ; + CAR ; + DIG 7 ; + PAIR 3 ; + CONS ; + DIG 4 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 2 ; + DIG 2 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 5 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + DIG 2 ; + CONS ; + PAIR } + { DROP 6 ; PUSH nat 112 ; FAILWITH } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } } + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; COMPARE ; EQ ; IF {} { PUSH nat 114 ; FAILWITH } ; @@ -1791,14 +2361,8 @@ UPDATE 2 ; UPDATE 2 ; UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - PAIR } } - { IF_LEFT - { DIG 2 ; - DIG 3 ; - DROP 2 ; - DUP 2 ; + UPDATE 2 } + { DUP 2 ; CAR ; CAR ; CAR ; @@ -1841,8 +2405,14 @@ UPDATE 2 ; UPDATE 2 ; UPDATE 1 ; - UPDATE 2 ; - NIL operation } + UPDATE 2 } ; + NIL operation ; + PAIR } } + { IF_LEFT + { DIG 2 ; + DIG 4 ; + DROP 2 ; + IF_LEFT { DROP ; SENDER ; PUSH mutez 1 ; @@ -1863,36 +2433,34 @@ PAIR ; PAIR ; DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; CDR ; CAR ; CDR ; CAR ; - DUP ; - DUP 5 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DUP 2 ; + DUP 7 ; GET ; IF_NONE - { DIG 5 ; - DIG 6 ; - DROP 2 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - SWAP } - { DUP 6 ; + { DIG 7 ; DIG 8 ; DROP 2 ; DIG 2 ; PAIR ; SWAP } + { DUP 8 ; CAR ; CAR ; CDR ; CDR ; - DIG 3 ; + DIG 5 ; PAIR ; - DUP 6 ; - CDR ; + DUP 8 ; CDR ; - DUP 7 ; - CAR ; - CAR ; - CAR ; CDR ; + DIG 5 ; PAIR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DIG 3 ; DUP 4 ; PAIR ; PAIR ; @@ -1910,10 +2478,11 @@ UNPAIR ; DUP 5 ; CDR ; - DUP 2 ; + DUP ; + DUP 3 ; GET ; IF_NONE - { DROP 2 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP ; GET 3 ; IF_LEFT @@ -1930,20 +2499,20 @@ (pair nat nat nat nat) (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP 6 ; - DIG 5 ; + { DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP 7 ; + DIG 6 ; PAIR ; - DUP 8 ; - DIG 3 ; + DUP 9 ; + DUP 4 ; GET 5 ; PAIR ; - DIG 9 ; + DIG 11 ; DIG 3 ; PAIR ; PAIR ; PAIR ; - DIG 2 ; + DIG 4 ; ITER { SWAP ; UNPAIR ; UNPAIR ; @@ -2106,7 +2675,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 23 ; + DUP 25 ; SWAP ; EXEC ; DIG 2 ; @@ -2124,7 +2693,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2153,7 +2722,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 21 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2167,7 +2736,7 @@ DIG 2 ; PAIR ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } @@ -2256,7 +2825,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 23 ; + DUP 25 ; SWAP ; EXEC ; DIG 2 ; @@ -2274,7 +2843,7 @@ CDR ; COMPARE ; GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 18 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; PUSH int 1 ; PUSH int 0 ; PAIR ; @@ -2303,7 +2872,7 @@ PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 21 ; + DUP 23 ; SWAP ; EXEC ; DIG 2 ; @@ -2317,7 +2886,7 @@ DIG 2 ; PAIR ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC } { SWAP ; DIG 2 ; DROP 2 } } ; @@ -2367,7 +2936,7 @@ DIG 3 ; PAIR ; PAIR ; - DUP 16 ; + DUP 18 ; SWAP ; EXEC } ; DUG 2 ; @@ -2385,11 +2954,59 @@ CDR ; SWAP ; CAR ; + DUP 3 ; + CAR ; + DUP 5 ; + DUP 2 ; + GET ; + IF_NONE + { DIG 4 ; DROP 2 ; PUSH nat 141 ; FAILWITH } + { PUSH nat 1 ; + DUP 2 ; + GET 8 ; + SUB ; + ABS ; + DIG 6 ; + DUG 2 ; + UPDATE 8 ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP ; + DUP 5 ; + CAR ; + GET ; + IF_NONE + { PUSH nat 141 ; FAILWITH } + { PUSH nat 0 ; SWAP ; GET 8 ; COMPARE ; LE } ; + DIG 6 ; DIG 3 ; - SWAP ; PAIR ; - DIG 4 ; - DIG 4 ; + DIG 7 ; + DIG 2 ; + IF { DIG 2 ; + DROP ; + DUP 6 ; + DIG 6 ; + CDR ; + DIG 5 ; + CAR ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat) ; + SWAP ; + UPDATE ; + UPDATE 2 } + { DIG 4 ; DROP ; DIG 5 ; DIG 3 ; UPDATE 2 } ; PAIR ; DIG 2 ; DIG 4 ; @@ -2404,19 +3021,24 @@ DIG 6 ; DROP 2 ; UNPAIR ; - CAR ; + UNPAIR ; UNPAIR ; DIG 2 ; CAR ; + DIG 3 ; + CAR ; + DIG 3 ; DIG 2 ; + PAIR ; DIG 3 ; DIG 3 ; SOME ; DUP 6 ; UPDATE } ; - DIG 2 ; + DUG 2 ; + UNPAIR ; NIL operation ; - DIG 3 ; + DIG 2 ; ITER { CDR ; DUP ; CAR ; @@ -2438,8 +3060,8 @@ PUSH mutez 0 ; DIG 2 ; CDR ; - DUP 8 ; - DUP 8 ; + DUP 9 ; + DUP 9 ; PAIR 3 ; TRANSFER_TOKENS } { PUSH string "FA2 token" ; @@ -2457,104 +3079,76 @@ DIG 5 ; CAR ; CAR ; - DUP 11 ; + DUP 12 ; PAIR 3 ; CONS ; - DUP 8 ; + DUP 9 ; PAIR ; CONS ; TRANSFER_TOKENS } { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; CONS } ; - DIG 3 ; DIG 4 ; + DIG 5 ; DROP 2 ; PUSH mutez 0 ; - DUP 3 ; + DUP 4 ; CDR ; CDR ; COMPARE ; GT ; - IF { DUP 2 ; + IF { DUP 3 ; CAR ; CDR ; CONTRACT unit ; IF_NONE { PUSH nat 102 ; FAILWITH } - { DUP 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + { DUP 4 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; CONS } {} ; PUSH mutez 0 ; - DUP 3 ; + DUP 4 ; CDR ; CAR ; COMPARE ; GT ; - IF { DUP 2 ; + IF { DUP 3 ; CAR ; CAR ; CONTRACT unit ; IF_NONE - { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 2 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 3 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; CONS } - { SWAP ; DROP } ; - DUP 3 ; - CDR ; - CAR ; - COMPARE ; - GT ; - IF { DUP 2 ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { PUSH nat 102 ; FAILWITH } - { DUP 3 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; - SOME } - { NONE operation } ; - PUSH mutez 0 ; + { DIG 2 ; DROP } ; DUP 4 ; - CDR ; - CDR ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CDR ; - CONTRACT unit ; - IF_NONE - { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; - SOME } - { DIG 2 ; DROP ; NONE operation } ; - DUP 5 ; - DIG 5 ; + DIG 4 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 7 ; + DIG 6 ; UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; - DIG 2 ; - IF_NONE - { SWAP ; - IF_NONE { SWAP ; DROP ; NIL operation } { DIG 2 ; SWAP ; CONS } } - { DIG 2 ; IF_NONE { DIG 2 } { DIG 3 ; SWAP ; CONS } ; SWAP ; CONS } } ; - PAIR } } - { DIG 3 ; - DROP ; - IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DROP 3 ; - IF_LEFT - { DUP 2 ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + SWAP } + { DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; CAR ; CAR ; CAR ; @@ -2587,8 +3181,17 @@ UPDATE 2 ; UPDATE 2 ; UPDATE 2 ; - UPDATE 1 } - { DUP 2 ; + UPDATE 1 ; + NIL operation } ; + PAIR } + { DIG 3 ; + DROP ; + IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DROP 3 ; + DUP 2 ; CAR ; CAR ; CAR ; @@ -2956,958 +3559,954 @@ CDR ; DIG 2 ; UPDATE 2 ; - UPDATE 2 } ; - NIL operation ; - PAIR } - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE - { DROP 5 ; PUSH nat 117 ; FAILWITH } - { DUP 3 ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - DUP ; - GET 8 ; - DUP 2 ; - GET 7 ; - DUP 3 ; - GET 5 ; - DUP 4 ; - GET 3 ; - DUP 5 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; - DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 122 ; FAILWITH } {} ; - UNPAIR ; - DUP 5 ; - CDR ; - CAR ; - CAR ; - CAR ; - DUP 5 ; - GET ; - IF_NONE - {} - { DUP 2 ; - SWAP ; - GET 4 ; - COMPARE ; - GE ; - IF { PUSH nat 121 ; FAILWITH } {} } ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - INT ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CDR ; - INT ; - DUP 3 ; - DUG 2 ; - MUL ; - NOW ; - SUB ; + UPDATE 2 ; + NIL operation ; + PAIR } + { PUSH mutez 1 ; + AMOUNT ; COMPARE ; LT ; - IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; - CAR ; - DIG 3 ; - GET 7 ; - DUP ; - DUP 3 ; - CAR ; - CAR ; - GET 7 ; - COMPARE ; - GT ; - IF { DUP 2 ; - CAR ; - CAR ; - GET 7 ; - SUB ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - DIG 3 ; - MUL ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 2 ; - CAR ; - CAR ; - GET 7 ; - INT ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; - INT ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; + IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DIG 2 ; - SWAP ; - DUP 3 ; - CDR ; - GET 3 ; - DIG 3 ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 3 ; - DUP 3 ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - SWAP ; - GET 7 ; - SWAP ; - GET 7 ; - SUB ; - DUP ; - ABS ; - INT ; - PUSH int 10 ; - PAIR ; - DIG 5 ; - SWAP ; - EXEC ; - PUSH int 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } - { PUSH int 0 ; - DIG 2 ; - COMPARE ; - LT ; - IF { PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - PUSH int 1 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL } - { PUSH int 1 ; SWAP } } ; - PAIR ; - DUP 2 ; - GET 3 ; - DUP 2 ; CDR ; DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - UPDATE 3 ; - DUP 3 ; - CDR ; - CAR ; - CAR ; - CAR ; - DUP 4 ; - DIG 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 5 ; - DUP 8 ; GET ; IF_NONE - { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } - { GET 4 ; - DUP 7 ; - GET 4 ; - COMPARE ; - GT ; - IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - DUP 2 ; - CAR ; - UNIT ; - LEFT unit ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - NOW ; - DUP 3 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 4 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { SWAP ; - DROP ; + { DROP 5 ; PUSH nat 117 ; FAILWITH } + { DUP 3 ; + CDR ; + CDR ; DUP 2 ; CAR ; + DUP 2 ; + DUP 2 ; CAR ; - CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; CDR ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string)) } - { DUP 4 ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; + DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; CAR ; CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 122 ; FAILWITH } {} ; + UNPAIR ; + DUP 5 ; CDR ; + CAR ; + CAR ; + CAR ; + DUP 5 ; + GET ; + IF_NONE + {} + { DUP 2 ; + SWAP ; + GET 4 ; + COMPARE ; + GE ; + IF { PUSH nat 121 ; FAILWITH } {} } ; DUP 5 ; CAR ; CAR ; CDR ; CAR ; + INT ; + DUP 6 ; + CDR ; + CAR ; + CAR ; + CDR ; + INT ; DUP 3 ; - GET 3 ; - IF_LEFT - { SWAP ; - DROP ; - IF_LEFT - { DIG 2 ; - DROP 2 ; - PUSH nat 0 ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - DIG 3 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 4 ; DROP 2 } } - { DIG 5 ; - DROP ; - DUP 2 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GE ; - IF { DUP 3 ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 3 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { SWAP ; - INT ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - DIG 3 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 5 ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - DIG 2 ; - SWAP ; - UPDATE 3 } ; - DUP 2 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DROP } } ; - SWAP ; - SOME } ; - IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 3 ; DROP 2 ; PUSH bool False } - { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } - { DIG 3 ; DROP 2 ; PUSH bool False } ; - IF { NOW ; - DUP 2 ; - GET 5 ; - DUP ; - GET 9 ; - INT ; - DUP 2 ; - GET 11 ; - INT ; - DUP 3 ; - GET 13 ; - INT ; - DUP 4 ; - CAR ; - INT ; - DUP 5 ; - GET 3 ; - INT ; - DUP 6 ; - GET 5 ; - INT ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR ; - PAIR ; - SWAP ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 8 ; - GET 3 ; - DUP 2 ; - CAR ; - CAR ; - DUP 4 ; - UNPAIR ; - UNPAIR ; - DUP 5 ; - DUP 15 ; - DIG 4 ; - DIG 4 ; - DIG 4 ; - ADD ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DUP 3 ; - CAR ; - UNPAIR ; - DUP 6 ; - UNPAIR ; - CDR ; - DIG 3 ; - DIG 3 ; - ADD ; - DUP 5 ; - DIG 3 ; - DIG 3 ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DIG 3 ; - UNPAIR ; - UNPAIR ; - DIG 6 ; - CDR ; - DUG 3 ; - ADD ; - ADD ; - DUP 5 ; - CDR ; - DUP 13 ; - CDR ; - MUL ; - DIG 5 ; - CAR ; - DUP 13 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; + DUG 2 ; + MUL ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } ; + DUP 3 ; + CAR ; + DIG 3 ; + GET 7 ; + DUP ; + DUP 3 ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + GT ; + IF { DUP 2 ; CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - PUSH int 0 ; - DUP 4 ; CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; + GET 7 ; + SUB ; + PUSH int 10 ; PAIR ; - DUP 14 ; + DUP 7 ; SWAP ; EXEC ; - DIG 2 ; - CAR ; + DIG 3 ; MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; ISNAT ; IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 15 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + DUP 2 ; CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; + GET 7 ; + INT ; + PUSH int 10 ; PAIR ; - DUP 16 ; + DUP 7 ; SWAP ; EXEC ; + SWAP } + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + INT ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DIG 2 ; + SWAP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; + GET 7 ; + SUB ; + DUP ; + ABS ; + INT ; + PUSH int 10 ; + PAIR ; + DIG 5 ; + SWAP ; + EXEC ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } + { PUSH int 0 ; DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 4 ; - CAR ; - DUP 7 ; - CDR ; - MUL ; - DUP 5 ; - CDR ; - DUP 8 ; - CAR ; - MUL ; COMPARE ; LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 8 ; - CDR ; - MUL ; - DUP 7 ; - CDR ; - DUP 9 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } - { DUP 4 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 4 ; - CDR ; - DUP 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; + IF { PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + PUSH int 1 ; + PAIR ; + DUP 2 ; CAR ; - DUP 6 ; + DUP 2 ; CDR ; MUL ; - DIG 6 ; + DIG 2 ; CDR ; - DIG 6 ; + DIG 2 ; CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; - DUP 10 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 4 ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR 3 ; - PAIR 4 ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - GET 3 ; - DUP 3 ; - CAR ; - ADD ; + MUL } + { PUSH int 1 ; SWAP } } ; + PAIR ; + DUP 2 ; + GET 3 ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + UPDATE 3 ; + DUP 3 ; + CDR ; + CAR ; + CAR ; + CAR ; + DUP 4 ; + DIG 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 5 ; + DUP 8 ; + GET ; + IF_NONE + { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } + { GET 4 ; + DUP 7 ; + GET 4 ; + COMPARE ; + GT ; + IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + DUP 2 ; + CAR ; + UNIT ; + LEFT unit ; + PAIR ; + NOW ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + DIG 2 ; + UNPAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CDR ; + DUP 4 ; + CAR ; + DUP 4 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP 2 ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat) } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool False } ; + IF { SWAP ; DIG 2 ; DROP 2 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 3 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH nat 0 ; + DIG 2 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 4 ; + PAIR 5 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DROP 2 ; SWAP } } + { DIG 3 ; + DROP ; DUP 3 ; - GET 13 ; - DIG 3 ; - GET 11 ; + INT ; ADD ; - SWAP } + DUP 5 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; SWAP } } ; + SWAP } ; + SOME } ; + IF_NONE + { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 3 ; DROP 2 ; PUSH bool False } + { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } + { DIG 3 ; DROP 2 ; PUSH bool False } ; + IF { NOW ; + DUP 2 ; + GET 5 ; + DUP ; + GET 9 ; + INT ; + DUP 2 ; + GET 11 ; + INT ; + DUP 3 ; + GET 13 ; + INT ; + DUP 4 ; + CAR ; + INT ; + DUP 5 ; + GET 3 ; + INT ; + DUP 6 ; + GET 5 ; + INT ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR ; + PAIR ; + SWAP ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 8 ; + GET 3 ; + DUP 2 ; + CAR ; + CAR ; + DUP 4 ; + UNPAIR ; + UNPAIR ; + DUP 5 ; + DUP 15 ; + DIG 4 ; + DIG 4 ; + DIG 4 ; + ADD ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DUP 3 ; + CAR ; + UNPAIR ; + DUP 6 ; + UNPAIR ; + CDR ; + DIG 3 ; + DIG 3 ; + ADD ; + DUP 5 ; + DIG 3 ; + DIG 3 ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DIG 3 ; + UNPAIR ; + UNPAIR ; + DIG 6 ; + CDR ; + DUG 3 ; + ADD ; + ADD ; + DUP 5 ; + CDR ; + DUP 13 ; + CDR ; + MUL ; + DIG 5 ; + CAR ; + DUP 13 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 14 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 15 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 4 ; + CAR ; + DUP 7 ; + CDR ; + MUL ; + DUP 5 ; + CDR ; + DUP 8 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 8 ; + CDR ; + MUL ; + DUP 7 ; + CDR ; + DUP 9 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } + { DUP 4 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 4 ; + CDR ; + DUP 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 6 ; + CDR ; + DIG 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; + DUP 10 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 4 ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR 3 ; + PAIR 4 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + GET 3 ; + DUP 3 ; + CAR ; + ADD ; + DUP 3 ; + GET 13 ; + DIG 3 ; + GET 11 ; + ADD ; + SWAP } + { DROP ; + DUP 2 ; + GET 13 ; + DUP 3 ; + GET 11 ; + DUP 4 ; + GET 9 ; + ADD ; + ADD ; + DIG 2 ; + CAR } } { DROP ; DUP 2 ; - GET 13 ; + GET 5 ; DUP 3 ; - GET 11 ; + GET 3 ; DUP 4 ; - GET 9 ; + CAR ; ADD ; ADD ; DIG 2 ; - CAR } } - { DROP ; - DUP 2 ; - GET 5 ; + GET 13 ; + SWAP } ; DUP 3 ; GET 3 ; - DUP 4 ; - CAR ; - ADD ; - ADD ; - DIG 2 ; - GET 13 ; - SWAP } ; - DUP 3 ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 9 ; DROP 2 ; DUP 8 } + IF_LEFT + { IF_LEFT + { DIG 9 ; DROP 2 ; DUP 8 } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } } { DROP ; DUP 8 ; GET 3 ; DUP 10 ; - CAR ; + CDR ; DUP 2 ; CDR ; MUL ; DIG 10 ; - CDR ; + CAR ; DIG 2 ; CAR ; MUL ; PAIR ; DUP 9 ; SWAP ; - UPDATE 3 } } - { DROP ; - DUP 8 ; + UPDATE 3 } ; + DUP 4 ; GET 3 ; - DUP 10 ; + IF_LEFT + { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } + { DROP ; DUP 4 ; CAR ; GET 4 } ; + DUP 2 ; + GET 3 ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; CDR ; DUP 2 ; CDR ; MUL ; - DIG 10 ; + DIG 2 ; CAR ; DIG 2 ; CAR ; MUL ; PAIR ; - DUP 9 ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DIG 13 ; SWAP ; - UPDATE 3 } ; - DUP 4 ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } - { DROP ; DUP 4 ; CAR ; GET 4 } ; - DUP 2 ; - GET 3 ; - DUP 2 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 0 ; - DUP 2 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } - {} ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DIG 13 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 5 ; - DIG 5 ; - DIG 2 ; - DIG 5 ; - DIG 4 ; - PAIR 4 ; - UPDATE 5 ; - SWAP ; - UPDATE 6 ; - DIG 2 ; - DIG 5 ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - LEFT (pair timestamp timestamp) ; - LEFT timestamp ; - UPDATE 3 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DIG 3 ; - GET 6 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 } ; - NIL operation ; - PAIR } } } } } ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 5 ; + DIG 5 ; + DIG 2 ; + DIG 5 ; + DIG 4 ; + PAIR 4 ; + UPDATE 5 ; + SWAP ; + UPDATE 6 ; + DIG 2 ; + DIG 5 ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + LEFT (pair timestamp timestamp) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DIG 3 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } } } } ; view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; view "get_valid_swaps" unit @@ -3960,7 +4559,8 @@ (nat %sell_exact_volume) (nat %sell_plus_volume) (nat %sell_total_volume)) - (pair %pair string string))) + (pair %pair string string) + (nat %holdings))) { CDR ; NIL (pair nat (or (or (pair (pair timestamp @@ -3972,7 +4572,8 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair string string)) ; + (pair string string) + nat) ; DUP 2 ; CAR ; CAR ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 4d3d8a8f..9f680746 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -4,7 +4,7 @@ [@inline] let no_rate_available_for_swap : nat = 100n [@inline] let invalid_token_address : nat = 101n [@inline] let invalid_tezos_address : nat = 102n -[@inline] let no_open_batch_for_deposits : nat = 103n +[@inline] let no_open_batch : nat = 103n [@inline] let batch_should_be_cleared : nat = 104n [@inline] let trying_to_close_batch_which_is_not_open : nat = 105n [@inline] let unable_to_parse_side_from_external_order : nat = 106n @@ -40,6 +40,11 @@ [@inline] let cannot_update_scale_factor_to_more_than_the_maximum : nat = 136n [@inline] let cannot_remove_swap_pair_that_is_not_disabled : nat = 137n [@inline] let token_name_not_in_list_of_valid_tokens : nat = 138n +[@inline] let no_orders_for_user_address : nat = 139n +[@inline] let cannot_cancel_orders_for_a_batch_that_isn_not_open : nat = 140n +[@inline] let cannot_decrease_holdings_of_removed_batch : nat = 141n +[@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n +[@inline] let batch_already_removed : nat = 143n (* Constants *) @@ -237,13 +242,13 @@ type batch_ordertypes = (nat, ordertypes) map (* Associated user address to a given set of batches and ordertypes *) type user_batch_ordertypes = (address, batch_ordertypes) big_map - (* Batch of orders for the same pair of tokens *) type batch = [@layout:comb] { batch_number: nat; status : batch_status; volumes : volumes; pair : pair; + holdings : nat; } type batch_indices = (string, nat) map @@ -347,8 +352,54 @@ module TokenAmountMap = struct end -module Storage = struct +module BatchHoldings_Utils = struct + + +[@inline] +let increase_holding + (batch_number: nat) + (batches: batches): batches = + match Big_map.find_opt batch_number batches with + | None -> failwith cannot_increase_holdings_of_batch_that_does_not_exist + | Some b -> let bh = b.holdings + 1n in + let b = { b with holdings = bh; } in + Big_map.update batch_number (Some b) batches +[@inline] +let add_batch_holding + (batch_number: nat) + (address: address) + (ubots: user_batch_ordertypes) + (batches: batches): batches = + match Big_map.find_opt address ubots with + | Some bots -> (match Map.find_opt batch_number bots with + | Some _ -> batches + | None -> increase_holding batch_number batches) + | None -> increase_holding batch_number batches + +[@inline] +let remove_batch_holding + (batch_number: nat) + (batches: batches): batches = + match Big_map.find_opt batch_number batches with + | None -> failwith cannot_decrease_holdings_of_removed_batch + | Some b -> let nh = abs(b.holdings - 1n) in + let b = { b with holdings = nh; } in + Big_map.update batch_number (Some b) batches + + +[@inline] +let can_batch_be_removed + (batch_number: nat) + (batches: batches): bool = + match Big_map.find_opt batch_number batches with + | None -> failwith cannot_decrease_holdings_of_removed_batch + | Some b -> b.holdings <= 0n + +end + + +module Storage = struct type t = { metadata: metadata; @@ -574,6 +625,7 @@ let get_rate_name let quote_name = r.swap.to in find_lexicographical_pair_name quote_name base_name + [@inline] let pair_of_swap (side: side) @@ -946,23 +998,31 @@ let collect_redemptions | Some batch -> (match get_clearing batch with | None -> bots, tam, bts, tokens, fees, fee_in_mutez | Some c -> let _c, u_tam, _vols, _tokns, fs, _fim = Map.fold Redemption_Utils.collect_order_payout_from_clearing otps (c, tam, batch.volumes, tokens, fees, fee_in_mutez) in + let batches = BatchHoldings_Utils.remove_batch_holding batch.batch_number batches in + let bts = if BatchHoldings_Utils.can_batch_be_removed batch.batch_number batches then + let batches = Big_map.remove batch.batch_number bts.batches in + { bts with batches = batches; } + else + { bts with batches = batches; } + in let u_bots = Map.remove batch_number bots in u_bots,u_tam, bts, tokens, fs, fee_in_mutez) [@inline] let collect_redemption_payouts (holder: address) - (batch_set: batch_set) - (ubots: user_batch_ordertypes) - (tokens: valid_tokens) (fees: fees) - (fee_in_mutez: tez): (fees * user_batch_ordertypes * token_amount_map) = + (storage: Storage.t): (fees * user_batch_ordertypes * batch_set * token_amount_map) = + let fee_in_mutez = storage.fee_in_mutez in + let batch_set = storage.batch_set in + let ubots = storage.user_batch_ordertypes in + let tokens = storage.valid_tokens in let empty_tam = (Map.empty : token_amount_map) in match Big_map.find_opt holder ubots with - | None -> fees, ubots, empty_tam - | Some bots -> let u_bots, u_tam, _bs, _tkns, u_fees, _fim = Map.fold collect_redemptions bots (bots, empty_tam, batch_set, tokens, fees, fee_in_mutez) in + | None -> fees, ubots, batch_set, empty_tam + | Some bots -> let u_bots, u_tam, bs, _tkns, u_fees, _fim = Map.fold collect_redemptions bots (bots, empty_tam, batch_set, tokens, fees, fee_in_mutez) in let updated_ubots = Big_map.update holder (Some u_bots) ubots in - u_fees, updated_ubots, u_tam + u_fees, updated_ubots, bs, u_tam [@inline] @@ -1125,6 +1185,7 @@ let deposit let deposit_op = Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in [ deposit_op] + [@inline] let redeem (redeem_address : address) @@ -1136,10 +1197,10 @@ let redeem payer = redeem_address; burner = storage.fee_recipient; } in - let fees, updated_ubots, payout_token_map = Ubots.collect_redemption_payouts redeem_address storage.batch_set storage.user_batch_ordertypes storage.valid_tokens fees storage.fee_in_mutez in + let fees, updated_ubots, updated_batch_set, payout_token_map = Ubots.collect_redemption_payouts redeem_address fees storage in let operations = Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in let operations = resolve_fees fees operations in - let updated_storage = { storage with user_batch_ordertypes = updated_ubots; } in + let updated_storage = { storage with user_batch_ordertypes = updated_ubots; batch_set = updated_batch_set; } in (operations, updated_storage) end @@ -1334,6 +1395,39 @@ type batch_status = | Closed of { start_time : timestamp ; closing_time : timestamp } | Cleared of { at : timestamp; clearing : clearing; rate : exchange_rate } + +[@inline] +let is_batch_open + (batch:batch): bool = + match batch.status with + | Open _ -> true + | _ -> false + + +[@inline] +let reduce_volumes + (ots: ordertypes) + (volumes:volumes): volumes = + let reduce_volume_for_ot (vols, (ot, amt) : volumes * (ordertype * nat)) : volumes = + let side = ot.side in + let tolerance = ot.tolerance in + match side with + | Buy -> let total_buy_side_volume = abs(vols.buy_total_volume - amt) + in + (match tolerance with + | Minus -> { vols with buy_minus_volume = abs(vols.buy_minus_volume - amt); buy_total_volume = total_buy_side_volume; } + | Exact -> { vols with buy_exact_volume = abs(vols.buy_exact_volume - amt); buy_total_volume = total_buy_side_volume; } + | Plus -> { vols with buy_plus_volume = abs(vols.buy_plus_volume - amt); buy_total_volume = total_buy_side_volume; }) + | Sell -> let total_sell_side_volume = abs(vols.sell_total_volume - amt) + in + (match tolerance with + | Minus -> { vols with sell_minus_volume = abs(vols.sell_minus_volume - amt); sell_total_volume = total_sell_side_volume; } + | Exact -> { vols with sell_exact_volume = abs(vols.sell_exact_volume - amt); sell_total_volume = total_sell_side_volume; } + | Plus -> { vols with sell_plus_volume = abs(vols.sell_plus_volume - amt); sell_total_volume = total_sell_side_volume; }) + in + Map.fold reduce_volume_for_ot ots volumes + + [@inline] let set_buy_side_volume (order: swap_order) @@ -1374,6 +1468,7 @@ let make status = Open { start_time = timestamp } ; pair = pair; volumes = volumes; + holdings = 0n; } [@inline] @@ -1461,6 +1556,7 @@ let update_volumes in { batch with volumes = updated_vols; } + [@inline] let can_deposit (batch:batch) : bool = @@ -1618,6 +1714,7 @@ type entrypoint = | Deposit of external_swap_order | Tick of string | Redeem + | Cancel of pair | Change_fee of tez | Change_admin_address of address | Add_token_swap_pair of valid_swap @@ -1648,6 +1745,8 @@ let is_administrator (storage : storage) : unit = if Tezos.get_sender () = storage.administrator then () else failwith sender_not_administrator + + [@inline] let finalize (batch : batch) @@ -1692,6 +1791,94 @@ let get_valid_swap_reduced | Some vswp -> vswp | None -> failwith swap_does_not_exist +[@inline] +let refund_orders + (refund_address: address) + (ots: ordertypes) + (valid_swap:valid_swap) + (storage: storage): result = + let fee = storage.fee_in_mutez in + let collect_refunds ((tam,mutez_to_ref), (ot, amt): ((token_amount_map * tez) * (ordertype * nat))) : (token_amount_map * tez) = + let token = match ot.side with + | Buy -> valid_swap.swap.from.token + | Sell -> valid_swap.swap.to + in + let ta = { + token = token; + amount = amt; + } in + let tam = TokenAmountMap.increase ta tam in + let mutez_to_ref = mutez_to_ref + fee in + tam, mutez_to_ref + in + let token_refunds, tez_refunds= Map.fold collect_refunds ots ((Map.empty: token_amount_map), 0mutez) in + let treasury_vault = Treasury.get_treasury_vault () in + let operations = Treasury_Utils.transfer_holdings treasury_vault refund_address token_refunds in + let operations = if tez_refunds > 0mutez then Treasury_Utils.transfer_fee refund_address tez_refunds :: operations else operations in + operations, storage + +[@inline] +let remove_orders_from_batch + (ots: ordertypes) + (batch: batch): batch = + let volumes = Batch_Utils.reduce_volumes ots batch.volumes in + { batch with volumes = volumes} + +[@inline] +let remove_orders + (ot: ordertypes) + (batch:batch) + (batch_set: batch_set) + (storage: storage) = + let batch = remove_orders_from_batch ot batch in + let batches = Big_map.update batch.batch_number (Some batch) batch_set.batches in + let batch_set = { batch_set with batches = batches } in + let storage = {storage with batch_set = batch_set} in + storage + +[@inline] +let remove_order_types + (batch_number: nat) + (holder: address) + (bot: batch_ordertypes) + (storage:storage) : ordertypes * storage = + match Map.find_opt batch_number bot with + | None -> failwith no_orders_for_user_address + | Some ots -> let bot = Map.remove batch_number bot in + let ubots = Big_map.update holder (Some bot) storage.user_batch_ordertypes in + let storage = { storage with user_batch_ordertypes = ubots;} in + (ots,storage) + +[@inline] +let cancel_order + (pair: pair) + (holder: address) + (valid_swap: valid_swap) + (storage: storage) : result = + let ubots = storage.user_batch_ordertypes in + let current_time = Tezos.get_now () in + let (batch, batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in + let () = if not (Batch_Utils.is_batch_open batch) then + failwith cannot_cancel_orders_for_a_batch_that_isn_not_open + in + match Big_map.find_opt holder ubots with + | None -> failwith no_orders_for_user_address + | Some bot -> let orders_to_remove, storage = remove_order_types batch.batch_number holder bot storage in + let storage = remove_orders orders_to_remove batch batch_set storage in + refund_orders holder orders_to_remove valid_swap storage + +[@inline] +let cancel + (pair: pair) + (storage: storage): result = + let () = reject_if_tez_supplied () in + let sender = Tezos.get_sender () in + let token_one, token_two = pair in + let pair_name = Utils.find_lexicographical_pair_name token_one token_two in + match Map.find_opt pair_name storage.valid_swaps with + | None -> failwith swap_does_not_exist + | Some vswpr -> let vswp = Utils.valid_swap_reduced_to_valid_swap vswpr 1n storage.valid_tokens in + cancel_order pair sender vswp storage [@inline] let oracle_price_is_not_stale @@ -1712,19 +1899,13 @@ let is_oracle_price_newer_than_current | Some r -> if r.when >=oracle_price_timestamp then failwith oracle_price_is_not_timely | None -> () -[@inline] -let is_batch_open - (batch:batch): bool = - match batch.status with - | Open _ -> true - | _ -> false [@inline] let confirm_oracle_price_is_available_before_deposit (pair:pair) (batch:batch) (storage:storage) : unit = - if is_batch_open batch then () else + if Batch_Utils.is_batch_open batch then () else let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap_reduced = get_valid_swap_reduced pair_name storage in let (lastupdated, _price) = get_oracle_price oracle_price_should_be_available_before_deposit valid_swap_reduced in @@ -1757,9 +1938,10 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = let order : swap_order = external_to_order external_order next_order_number current_batch_number storage.valid_tokens storage.valid_swaps in (* We intentionally limit the amount of distinct orders that can be placed whilst unredeemed orders exist for a given user *) if Ubots.is_within_limit order.trader storage.user_batch_ordertypes then - let new_ubot = Ubots.add_order order.trader current_batch_number order storage.user_batch_ordertypes in let updated_volumes = Batch_Utils.update_volumes order current_batch in let updated_batches = Big_map.update current_batch_number (Some updated_volumes) current_batch_set.batches in + let updated_batches = BatchHoldings_Utils.add_batch_holding current_batch_number order.trader storage.user_batch_ordertypes updated_batches in + let new_ubot = Ubots.add_order order.trader current_batch_number order storage.user_batch_ordertypes in let updated_batch_set = { current_batch_set with batches = updated_batches } in let updated_storage = { storage with batch_set = updated_batch_set; @@ -1771,7 +1953,7 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = else failwith too_many_unredeemed_orders else - failwith no_open_batch_for_deposits + failwith no_open_batch [@inline] let redeem @@ -1993,6 +2175,7 @@ let main (* User endpoints *) | Deposit order -> deposit order storage | Redeem -> redeem storage + | Cancel pair -> cancel pair storage (* Maintenance endpoint *) | Tick r -> tick r storage (* Admin endpoints *) From 60cf52fd9006331f9031744864010c429df0e92e Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:17:53 +0300 Subject: [PATCH 073/108] 380 add documentation (#381) * Release to Ghostnet (#349) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash * Clear active account on disconnect * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot * telegram bot for mainnet version (#333) * pipelines: rework docker build process * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Release - Ghostnet (#316) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Release - Ghostnet (#318) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating --------- Co-authored-by: Cyril B * pipelines: patch deprecated set-output commands and actions [skip ci] * telegram bot for ghostnet version (#332) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Release - Mainnet (#317) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot --------- Co-authored-by: Jason Ridgway-Taylor Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> * pipelines: fix ci of bot notif --------- Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> Co-authored-by: Jason Ridgway-Taylor * Corrected mainnet variables * Removed rate notifications from ghostnet nbot * 325 bot jit liquidity (#337) * Added skeleton for liquidity cli * Added initial start of jit implementation * Added buy side jit provisioning rules to bot * Added initial always on provision * Corrected path in message for always-on * Tidy up * Tidy up * Add interaction with batcher contract on ghostnet (#336) * gitignore for javascript compiled files * Add a dependency to Taquito * Add interaction with Batcher contract: deposit and redeem. Also, wallets. * Working versions for both liquidity bots * Packaged build to single file and add release action * Added working sub dir to build and manual trigger for testing * Added example config files into build file and expanded ghostnet example * Corrected release pathing * Corrected release pathing * Compress and hash release artefacts * corrected compression * Added zip compression to release artefacts * Added zip compression to release artefacts * Removed pre-release clause * Removed bundled compilation * Package node modules with liq bots * Updated packaging to prune modules * Always on only submits once per batch * Tidied bot status message * Tidied bot status message * Correctly parse status * Update batcher-bot/liquidity/src/utils.ts Co-authored-by: Ulrik Strid * PRC: Throw if no private key in environment * Added usage README content for liq bot * PRC: Use if in structure rather than getting all keys * PRC: Change lets to consts where applicable in provisioning * PRC: Change lets to consts where applicable in provisioning * PRC: Declare events prior to subscription --------- Co-authored-by: aguillon Co-authored-by: Ulrik Strid * pipelines: use more recent versions of action blocks before deprecation * Disabled swap button if the batch is closed. Additionally added a wait for socket connection (#339) * Disabled redeem button if there are no cleared holdings (#341) * Fix merge issues and tidy up * Added batch number in info panel (#342) * Added current and last to batch prefix --------- Co-authored-by: Cyril B Co-authored-by: aguillon Co-authored-by: Ulrik Strid * pipelines: add trigger when pr is merged on ghost branch * Changed token hashes in ghostnet contract to match faucet * Switched ghostnet UI to new contract hash * Re-adjusted token hashes on Ghostnet * Re-pointed UI to new contract on ghostnet * Added skeleton docs --------- Co-authored-by: Cyril B Co-authored-by: aguillon Co-authored-by: Ulrik Strid --- .github/workflows/docker-ghostnet.yml | 5 + .github/workflows/docs.yml | 27 ++++ .gitignore | 2 + .gitmodules | 4 + .../storage/initial_storage_ghostnet.mligo | 4 +- docs/book.toml | 25 ++++ docs/src/README.md | 135 ++++++++++++++++++ docs/src/SUMMARY.md | 0 docs/theme/favicon.png | Bin 0 -> 494 bytes docs/theme/marigold.css | 17 +++ docs/theme/marigold.js | 0 11 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .gitmodules create mode 100644 docs/book.toml create mode 100644 docs/src/README.md create mode 100644 docs/src/SUMMARY.md create mode 100644 docs/theme/favicon.png create mode 100644 docs/theme/marigold.css create mode 100644 docs/theme/marigold.js diff --git a/.github/workflows/docker-ghostnet.yml b/.github/workflows/docker-ghostnet.yml index 3020d106..a923952b 100644 --- a/.github/workflows/docker-ghostnet.yml +++ b/.github/workflows/docker-ghostnet.yml @@ -4,6 +4,11 @@ on: push: branches: - 'release-ghostnet' + pull_request: + branches: + - 'release-ghostnet' + types: + - closed workflow_dispatch: jobs: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..68bcca6a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,27 @@ +on: + push: + paths: + - docs/** +jobs: + deploy: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: 'true' + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: 'latest' + - run: mdbook build docs/ + - name: store Artefact + uses: actions/upload-artifact@v2 + with: + name: "batcher-docs" + path: ./docs/book + retention-days: 1 + - name: deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/book diff --git a/.gitignore b/.gitignore index 3b9562a2..4ccdd2b8 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ node_modules dist batcher-bot/notifications/node_modules/ batcher-bot/liquidity/node_modules/ + +book diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..06101072 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "docs/theme"] + path = docs/theme + url = https://github.com/marigold-dev/marigold-docs-theme.git + branch = main diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index 90cfdb8d..28e33428 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -13,14 +13,14 @@ let f(_:unit) : Batcher.Storage.t = { (("EURL"),{ token_id = 0n; name = "EURL"; - address = Some(("KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5" : address)); + address = Some(("KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS" : address)); decimals = 6n; standard = Some "FA2 token" }); (("USDT"),{ token_id = 0n; name = "USDT"; - address = Some(("KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm" : address)); + address = Some(("KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR" : address)); decimals = 6n; standard = Some "FA2 token" }) diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 00000000..ae34b547 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,25 @@ +[book] +authors = ["Marigold.dev"] +language = "en" +multilingual = true +src = "src" +title = "Batcher Documentation" + +[output.html] +mathjax-support = true +additional-css = ["theme/marigold.css"] +additional-js = ["theme/marigold.js"] +git-repository-url = "https://github.com/marigold-dev/batcher" + +[output.html.playground] +editable = true +line-numbers = true + +[output.html.search] +limit-results = 20 +use-boolean-and = true +boost-title = 2 +boost-hierarchy = 2 +boost-paragraph = 1 +expand = true +heading-split-level = 2 diff --git a/docs/src/README.md b/docs/src/README.md new file mode 100644 index 00000000..adce7501 --- /dev/null +++ b/docs/src/README.md @@ -0,0 +1,135 @@ +# Design document for the Batch Clearing DEX POC + +The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. + +> For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. +> Only the XTZ/USDT pair will be supported for V1 + +After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. + + +## Deposit + +The deposit window is open for a finite time period. During the time period users can deposit their tokens for a BUY or SELL order on the token pair along with an offset to the future received oracle price. + +> For V1, deposit windows won't run sequentially, in that as soon as a deposit window closes another will open straight away. Once the deposit window closes, users will need to wait for that batch to be cleared before another deposit window opens. + +## Waiting + +Once the deposit window has closed there will be a period of 2 minutes prior to awaiting an oracle price. Once that period has elapsed the first received oracle price will close the batch and clearing will start. + +## Clearing + +The clearing process is the process of matching the orders to ensure that all users can trade at the fairest possible price. Upon deposit there will be six categories of order. + +### Side + +Depending on whether you are buying or selling the pair you will either be on the BUY side or the SELL side. For the pair XTZ/USDT, XTZ is the base and USDT is the quote. So if the XTZ/USDT rate was 1.9 you would get 1 unit of XTZ for 1.9 of USDT if I am buying the pair, i.e. on the BUY side. If I am selling the pair, the inverse would be true. The side of the trade is important to understand which token needs to be deposited in a given swap order. + + +### Tolerance + +For any deposit, the user can specify the tolerance to the oracle price that they are willing to trade at. This means that each side can further be segregated into their tolerance levels; $Price_{oracle}-10bps$, $Price_{oracle}$ , $Price_{oracle}+10bps$. + + +### Clearing Level + +Given the three tolerance levels, we need to find the level at which we will clear the most orders; the clearing level. + +Considering that the amount of deposits for each category is different then we have six categories with a differing amount of tokens deposited for each tolerance. + + +| Deposits | P-10bps | P | P+10bps | +|----------|:---------:|----------:|----------:| +| *BUY* | X of USDT | Y of USDT | Z of USDT | +| *SELL* | R of XTZ | S of XTZ | T of XTZ | + + +An added complexity is that if I am will to buy at $Price_{oracle}+10bps$ then I will also be implicitly interested in buying at $Price_{oracle}$ and $Price_{oracle}-10bps$ as they are both cheaper levels if I am on the BUY side. The converse is true for the sell side in that if I sell for $Price_{oracle}-10bps$, then I would be willing to sell for the higher prices of $Price_{oracle}$ and $Price_{oracle}+10bps$. + +#### Determining the clearing level + +| Prices | P-10bps | P | P+10bps | +|----------|:----------------:|----------:|-----------------:| +| *BUY* | P / 1.0001 | P | P * 1.0001 | +| *SELL* | 1.0001 / P | 1/P | 1/ (1.0001 * P) | + + +##### P-10bps level + +Lets take the P-10bps sell level first. All of the buy levels would be interested in buying at that price, so the clearing volume at that level would be: + +$$ CP_{P-10bps} = \min(X + Y + Z, R * \dfrac{ 1.0001 }{P}) $$ + + +##### P level + +Lets take the P sell level first. Only the upper 2 buy levels would be interested in buying at that price, but the lower two SELL levels would be interested in selling so the clearing volume at that level would be: + +$$ CP_{P} = \min(Y + Z, (R+S) * \dfrac{1}{P}) $$ + +##### P+10bps level + +Lets take the P+10bps sell level first. All of the sell levels would be interested in selling at that price, but only the upper BUY level would be interested in buying so the clearing volume at that level would be: + +$$ CP_{P+10bps} = \min(Z, (R+S+T) * \dfrac{1}{(P * 1.0001)}) $$ + +#### Illustrative Examples + +If the Oracle price for XTZ/USDT is 1.9 and the tolerance is +/- 10 basis points, then the six price levels are: + +| Price Levels | BUY | SELL | +|--------------|:------:|:-------:| +|Price + 10bps |1.90019 | 0.52626 | +|Price | 1.9 | 0.52631 | +|Price - 10bps | 1.89981| 0.52636 | + +Assuming these levels we can determine some very basic illustrative examples of different market scenarios: + + +| MARKET | AMOUNTS SKEW | BUY X @ (P-) | BUY Y @ (P) | BUY Z @ (P+) | SELL R @ (P-) | SELL @ S (P) | SELL T @ (P+) | Orders cleared @ P-10bps | Orders cleared @ P | Orders cleared @ P+10bps | Clearance Level | +|---|---|---|---|---|---|---|---|---|---|---|---| +|SELL PRESSUE |CENTERED |55 |100 |45 |1000 |1900 |900 |200 |155 |55 |P-10bps| +|SELL PRESSUE |NEG |100 |55 |45 |1900 |1000 |900 |200 |155 |100 |P-10bps| +|SELL PRESSUE |POS |45 |55 |100 |900 |1000 |1900 |200 |100 |45 |P-10bps| +|BUY PRESSURE |CENTERED |250 |100 |250 |95 |190 |95 |50 |150 |200 |P+10bps| +|BUY PRESSURE |NEG |250 |100 |250 |190 |95 |95 |100 |150 |200 |P+10bps| +|BUY PRESSURE |POS |250 |100 |250 |95 |95 |190 |50 |100 |200 |P+10bps| +|BALANCED |CENTERED |50 |101 |50 |95 |190 |95 |50 |150 |50| P| +|BALANCED |NEG |101| 50| 50| 190|95| 95 |100|150| 101| P| +|BALANCED |POS |50 |50 |101| 95| 95| 190 |50 |100| 50| P| +|BALANCED |OPPOSING (NEG) |50 |50| 101| 190| 95| 95| 100| 100| 50| P-10bps| +|BALANCED |OPPOSING (POS) |101 |50| 50| 95| 95| 190| 50| 100 |101| P+10bps| + +Once we know the clearing level and the volume that can be cleared at that level, we will know how many can be matched (some partially) and those will receive pro-rata execution of their orders. For those that bid outside of the clearing level they will receive their deposits back when they claim. + +> A Google [Sheet](https://docs.google.com/spreadsheets/d/1tWIQEVi2COW3UOH7BPbcNrqe77SsPqZVFqN7nfLe6mc/edit?usp=sharing) with these calculations in is available. +> +## Claiming + +After clearing, users can claim their 'results', whether that be their original deposits, a partially matched order result or a fully filled order for the opposing token. + +# Timelines + + +```mermaid +gantt + dateFormat YYYY-MM-DD + title Timelines for Batcher going to mainnet + excludes weekends + + section Development + End of internal audit :ia, 2023-01-09, 4d + Fee Burning :fb, 2023-01-09, 4d + Oracle :or, 2023-01-09, 10d + Multiple Token Pools (incl. contract management and multisig) :mtp, after fb, 3w + Stabilisation / Final Testing :ft, after mtp, 5d + Mainnet launch :mn, after ft, 3d + + section Engagement + Blog post for fee burning :bpfb, 2023-01-20, 5d + Blog post for token pools :bptp, 2023-01-27, 5d + Blog post for oracle :bpor, 2023-02-10, 5d + Blog post for mainnet :bpmn, 2023-02-20, 5d + +``` diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/theme/favicon.png b/docs/theme/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..07bc77b2c3ec7fba33bc1436cddc521e91e12be3 GIT binary patch literal 494 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyegQrqu0Z;=iN|vThu6mLK*lQ& z+vAmy2Z#+60U-|{`Nr7uHCPbDHuZR8;{M9m^M#4$bD(+)kGH1o@2$LmTGFC!s{l=u zED7=pX1Fi#et&~Pf`dW8{0-|1&QF;CenNqRLcaW|IeQuy7#PhwT^vI!PM;0BIq9$h zkFnV^F9rAhwg3OSi%(V*UiS9&xmT*fD%>~O{>e8@)vQYuoU9@Ce`m$r!+N}bYWCc8 z(RPxSR;+Uic0Jb1Wb4f^`C^d!*L*qNEz67+l{PMID&Q!XQXv|7Yg>%$Pptx{Dud_M zC$_QbIEmj|&;5yIL!tM<%)Z_u5l~3C@2nHV%+|2MX<+#mETh~%KAN@;lU$q{C(-qGYp~IK&VodwnLsd(>BWyyRAKk5L|A0lP^6$ShW}8yqW=~HP-#)A8-kKM(Q~GYKFO2MJ zD$wEaNGV~seVgz1-ngsFOcbO-k1QzvxGntNUfW$C)~q>XV0cKqVzG^@%a1mLmEYwb ai=Y22l)c^QxC}6u89ZJ6T-G@yGywo6rPhf6 literal 0 HcmV?d00001 diff --git a/docs/theme/marigold.css b/docs/theme/marigold.css new file mode 100644 index 00000000..7a93e79f --- /dev/null +++ b/docs/theme/marigold.css @@ -0,0 +1,17 @@ +:root { + /* Browser default font-size is 16px, this way 1 rem = 10px */ + font-size: 80%; + --sidebar-width: 250px; + --page-padding: 15px; + --content-max-width: 1200px; + --menu-bar-height: 50px; + --mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace; +} + +html { + font-family: "Open Sans", sans-serif; + color: var(--fg); + background-color: var(--bg); + text-size-adjust: none; + -webkit-text-size-adjust: none; +} diff --git a/docs/theme/marigold.js b/docs/theme/marigold.js new file mode 100644 index 00000000..e69de29b From fa6bd9ace60800464c1edaccfd5ac85a6d90184c Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:11:43 +0300 Subject: [PATCH 074/108] 380 add documentation (#382) * Release to Ghostnet (#349) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash * Clear active account on disconnect * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot * telegram bot for mainnet version (#333) * pipelines: rework docker build process * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Release - Ghostnet (#316) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Release - Ghostnet (#318) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Fixed issue with token balances updating --------- Co-authored-by: Cyril B * pipelines: patch deprecated set-output commands and actions [skip ci] * telegram bot for ghostnet version (#332) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Mainnet (#314) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab * Release - Mainnet (#317) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Ghostnet (#312) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading * Release - Ghostnet (#315) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Mainnet - Release (#308) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Mainnet (#311) * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect * Release - Mainnet (#313) * pipelines: rework docker build process * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Ghostnet - Release (#307) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings --------- Co-authored-by: Cyril B * Corrected Network type and mainnet token hash * Release to Ghostnet (#310) * Added mainnet admin and oracle address * Correct mainnet build * Pointed to mainnet contract * Corrected UI error code parsing * pipelines: rework docker build process * pipelines: rework docker build process * Corrected pair name on mainnet and admin address on both nets * Added new mainnet contract hash * pipelines: commit to trigger cicd * pipelines: commit to trigger cicd (#306) * Added michelson files to repo for both mainnet and ghostnet * Added metadata file * Fixed issue with wallet disconnecting * Correctly assigned wallet after reload * Corrected open and closed holdings * Corrected Network type and mainnet token hash --------- Co-authored-by: Cyril B * Clear active account on disconnect --------- Co-authored-by: Cyril B * Added interim connecting captions for wallet loading --------- Co-authored-by: Cyril B * Fixed issue with button showing connecting * Fixed NaN issue in Holdings tab --------- Co-authored-by: Cyril B * Fixed issue with token balances updating * Check for null user address on token update to reduce errors to the console * Filtered out 204 responses from tzkt for volumes * Updated About page * Updated About page * Added nix flake for project * Added skeleton ts project * Added initial skeleton for tg bot * Added html formatting to rates messages * Added raw operation socker sub * Added deposit op to bot * Corrected tick filter * Corrected deposit format for TG bot * Corrected deposit amount for TG bot * Corrected deposit amount for TG bot * Scaled amount for TG bot * Added sedning of raw big map * Corrected pair naming * Corrected scaling from rates message * Use all socket messages * PArse non formated big maps to json * Filtered user_batch_ordertypes from big_map updates * Expanded log message * Added additional logging for bot * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Changed filters on socket messages * Filter for transaction that are contract calls * Filter for transaction that are contract calls * Log ops received from socket * Corrected filter * Added skeleton for batch updates * Added batch update formatter showing volumes * Assisting compiler * Corrected json path in batch change * Corrected html encoding for batch change * Tidy up on logging * Corrected object path for cleared message * Added rate name into batch status message * Corrected closing message detail * Added filter on messages * remove node_modules folder from repo by rewriting history (squash things from commit 706dd9 to 5c5816) List of squashed commits: Amended token update urls to include token addresses (#323) Filtered out 0 vol status updates and added docker bot image builds Corrected entrypoint commands for bot images Added node_modules in sub dirs to gitignore Merge branch 'main' of github.com:marigold-dev/batcher Added mainnet and ghostnet docker files for telegram bot --------- Co-authored-by: Jason Ridgway-Taylor Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> * pipelines: fix ci of bot notif --------- Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> Co-authored-by: Jason Ridgway-Taylor * Corrected mainnet variables * Removed rate notifications from ghostnet nbot * 325 bot jit liquidity (#337) * Added skeleton for liquidity cli * Added initial start of jit implementation * Added buy side jit provisioning rules to bot * Added initial always on provision * Corrected path in message for always-on * Tidy up * Tidy up * Add interaction with batcher contract on ghostnet (#336) * gitignore for javascript compiled files * Add a dependency to Taquito * Add interaction with Batcher contract: deposit and redeem. Also, wallets. * Working versions for both liquidity bots * Packaged build to single file and add release action * Added working sub dir to build and manual trigger for testing * Added example config files into build file and expanded ghostnet example * Corrected release pathing * Corrected release pathing * Compress and hash release artefacts * corrected compression * Added zip compression to release artefacts * Added zip compression to release artefacts * Removed pre-release clause * Removed bundled compilation * Package node modules with liq bots * Updated packaging to prune modules * Always on only submits once per batch * Tidied bot status message * Tidied bot status message * Correctly parse status * Update batcher-bot/liquidity/src/utils.ts Co-authored-by: Ulrik Strid * PRC: Throw if no private key in environment * Added usage README content for liq bot * PRC: Use if in structure rather than getting all keys * PRC: Change lets to consts where applicable in provisioning * PRC: Change lets to consts where applicable in provisioning * PRC: Declare events prior to subscription --------- Co-authored-by: aguillon Co-authored-by: Ulrik Strid * pipelines: use more recent versions of action blocks before deprecation * Disabled swap button if the batch is closed. Additionally added a wait for socket connection (#339) * Disabled redeem button if there are no cleared holdings (#341) * Fix merge issues and tidy up * Added batch number in info panel (#342) * Added current and last to batch prefix --------- Co-authored-by: Cyril B Co-authored-by: aguillon Co-authored-by: Ulrik Strid * pipelines: add trigger when pr is merged on ghost branch * Changed token hashes in ghostnet contract to match faucet * Switched ghostnet UI to new contract hash * Re-adjusted token hashes on Ghostnet * Re-pointed UI to new contract on ghostnet * Added skeleton docs --------- Co-authored-by: Cyril B Co-authored-by: aguillon Co-authored-by: Ulrik Strid From d1f67d4ef3c0e55924f624841267ee18d0cd2ee1 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Mon, 17 Jul 2023 11:48:08 +0300 Subject: [PATCH 075/108] Cancellations (#375) * Added refunds of tokens and fess on cancelation * Added check that batch is open in order to cancel * Built contract * Added UI changes for cancellations * Added refund of tokens back in, along with burning fee --- batcher-ui/config/config.ghostnet.ts | 2 +- batcher-ui/src/components/Holdings/index.tsx | 200 +++++- batcher-ui/src/extra_utils/types.ts | 21 +- batcher-ui/src/extra_utils/utils.ts | 9 + batcher-ui/src/pages/Main.tsx | 213 +++--- batcher/batcher-ghostnet.tz | 689 +++++++++---------- batcher/batcher.mligo | 57 +- 7 files changed, 696 insertions(+), 495 deletions(-) diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index e6ea1b7a..febcb408 100644 --- a/batcher-ui/config/config.ghostnet.ts +++ b/batcher-ui/config/config.ghostnet.ts @@ -54,7 +54,7 @@ export default defineConfig({ REACT_APP_PATH_TO_BATCHER_LOGO: BATCHER_LOGO, REACT_APP_TEZOS_NODE_URI: 'https://ghostnet.tezos.marigold.dev', REACT_APP_TZKT_URI_API: 'https://api.ghostnet.tzkt.io', - REACT_APP_BATCHER_CONTRACT_HASH: 'KT1CV6uF7pGNz4SSn7FLpbw7z2AND8dKzk4G', + REACT_APP_BATCHER_CONTRACT_HASH: 'KT1KDhj8AVi38YxGQAEGLY618iHQNaKuqQ7e', }, metas: [ { diff --git a/batcher-ui/src/components/Holdings/index.tsx b/batcher-ui/src/components/Holdings/index.tsx index faa23776..78776648 100644 --- a/batcher-ui/src/components/Holdings/index.tsx +++ b/batcher-ui/src/components/Holdings/index.tsx @@ -3,19 +3,23 @@ import { Button, Space, Typography, Col, message, Table } from 'antd'; import '@/components/Exchange/index.less'; import '@/components/Holdings/index.less'; import '@/global.less'; -import { HoldingsProps } from '@/extra_utils/types'; +import { HoldingsProps, holding } from '@/extra_utils/types'; import { useModel } from 'umi'; import { zeroHoldings } from '@/extra_utils/utils'; const Holdings: React.FC = ({ tezos, contractAddress, openHoldings, + closedHoldings, clearedHoldings, setOpenHoldings, setClearedHoldings, updateAll, setUpdateAll, hasClearedHoldings, + hasClosedHoldings, + hasOpenHoldings, + tokenMap, }: HoldingsProps) => { const { initialState } = useModel('@@initialState'); @@ -26,27 +30,135 @@ const Holdings: React.FC = ({ }, 5000); }; - const generateHoldings = (dict: Map) => { + const generateHoldings = (dict: Map) => { var data = []; + for (const key of dict) { + let buyHolding = key[1].buy_token_holding; + let sellHolding = key[1].sell_token_holding; + if(buyHolding > 0 || sellHolding > 0 ){ data.push({ - token: key[0], - holding: key[1], + pair: key[0], + buySideHolding: buyHolding, + sellSideHolding: sellHolding, }); + }; } + + return data; + }; + + const listOfColumnsWithCancel = [ + { + title: 'Pair', + key: 'pair', + dataIndex: 'pair', + }, + { + title: 'Buy Side Holding', + key: 'buySideHolding', + dataIndex: 'buySideHolding', + }, + { + title: 'Sell Side Holding', + key: 'sellSideHolding', + dataIndex: 'sellSideHolding', + }, + { + title: 'Cancel Orders?', + key: 'cancel', + dataIndex: 'cancel', + }, + ]; + const listOfColumns = [ + { + title: 'Pair', + key: 'pair', + dataIndex: 'pair', + }, + { + title: 'Buy Side Holding', + key: 'buySideHolding', + dataIndex: 'buySideHolding', + }, + { + title: 'Sell Side Holding', + key: 'sellSideHolding', + dataIndex: 'sellSideHolding', + }, + ]; + + const generateCancelButton = (pair: string) => { return ( <> - {data.map((h) => ( - - - {' '} - {h.holding} {h.token} |{' '} - + + - ))} ); }; + + const generateOpenHoldings = (dict: Map) => { + var data = []; + + for (const key of dict) { + let buyHolding = key[1].buy_token_holding; + let sellHolding = key[1].sell_token_holding; + if(buyHolding > 0 || sellHolding > 0 ){ + data.push({ + pair: key[0], + buySideHolding: buyHolding, + sellSideHolding: sellHolding, + cancel: generateCancelButton(key[0]) + }); + }; + } + + return data; + }; + + + const cancelHoldings = async (pair: string): Promise => { + + let loading = function () { + return undefined; + }; + + try { + tezos.setWalletProvider(initialState.wallet); + const contractWallet = await tezos.wallet.at(contractAddress); + let methods = contractWallet.parameterSchema.ExtractSignatures(); + console.info("Methods", methods); + + const holding = openHoldings.get(pair); + console.info("Holding", holding); + + let cancel_op = await contractWallet.methodsObject.cancel([holding.buy_token_name, holding.sell_token_name]).send(); + + + if (cancel_op) { + loading = message.loading('Attempting to cancel open holdings...', 0); + const confirm = await cancel_op.confirmation(); + if (!confirm.completed) { + message.error('Failed to cancel open holdings'); + console.error('Failed to cancel open holdings' + confirm); + } else { + setOpenHoldings(new Map()); + loading(); + message.success('Successfully cancelled open holdings'); + triggerUpdate(); + } + } else { + throw new Error('Failed to cancel open holdings'); + } + } catch (error: any) { + loading(); + message.error('Unable to redeem holdings : ' + error.message); + console.error('Unable to redeem holdings' + error); + }; + }; + + const redeemHoldings = async (): Promise => { let loading = function () { return undefined; @@ -83,32 +195,76 @@ const Holdings: React.FC = ({ return ( - Open/Closed Batches + Open Batches (Cancellable) + { hasOpenHoldings ? + ( - Holdings => | {generateHoldings(openHoldings)} + + ) : ( + + No closed holdings + + )} - Cleared Batches (Redeemable) - + Closed Batches + { hasClosedHoldings ? + ( - Holdings => - {generateHoldings(clearedHoldings)} +
- + ) : + + ( + + No closed holdings + + ) + } + + Cleared Batches (Redeemable) + { hasClearedHoldings ? + ( + +
+ - {hasClearedHoldings ? ( - ) : ( -
- )} + + + ) : + ( + + No cleared holdings + + ) + } ); diff --git a/batcher-ui/src/extra_utils/types.ts b/batcher-ui/src/extra_utils/types.ts index 35a710c7..dd0254c0 100644 --- a/batcher-ui/src/extra_utils/types.ts +++ b/batcher-ui/src/extra_utils/types.ts @@ -233,13 +233,17 @@ export type HoldingsProps = { tezos: TezosToolkit; userAddress: string; contractAddress: string; - openHoldings: Map; - clearedHoldings: Map; - setOpenHoldings: Dispatch>>; - setClearedHoldings: Dispatch>>; + openHoldings: Map; + closedHoldings: Map; + clearedHoldings: Map; + setOpenHoldings: Dispatch>>; + setClearedHoldings: Dispatch>>; updateAll: boolean; setUpdateAll: Dispatch>; hasClearedHoldings: boolean; + hasClosedHoldings: boolean; + hasOpenHoldings: boolean; + tokenMap: Map; }; export type Volumes = { @@ -267,3 +271,12 @@ export type tokens = { buy_token_name: string; sell_token_name: string; }; + +export type holding = { + pair: string; + buy_token_name: string; + sell_token_name: string; + buy_token_holding: number; + sell_token_holding: number; + +} diff --git a/batcher-ui/src/extra_utils/utils.ts b/batcher-ui/src/extra_utils/utils.ts index af7597c7..1b8aab9d 100644 --- a/batcher-ui/src/extra_utils/utils.ts +++ b/batcher-ui/src/extra_utils/utils.ts @@ -17,6 +17,15 @@ export const setTokenAmount = ( setBalance(tokAmount); }; +export const getLexicographicalPairName = (token1: string, token2: string) => { + if (token1 > token2) { + return token1 + '/' + token2; + } else { + return token2 + '/' + token1; + } + +}; + export const scaleAmountDown = (amount: number, decimals: number) => { const scale = 10 ** -decimals; return amount * scale; diff --git a/batcher-ui/src/pages/Main.tsx b/batcher-ui/src/pages/Main.tsx index 2a73f5bd..3ac279c6 100644 --- a/batcher-ui/src/pages/Main.tsx +++ b/batcher-ui/src/pages/Main.tsx @@ -4,7 +4,7 @@ import About from '@/components/About'; import Volume from '@/components/Volume'; import BatcherInfo from '@/components/BatcherInfo'; import BatcherAction from '@/components/BatcherAction'; -import { ContentType, token, BatcherStatus, Volumes, swap, tokens } from '@/extra_utils/types'; +import { ContentType, token, BatcherStatus, Volumes, swap, tokens, holding, token_holding } from '@/extra_utils/types'; import { ContractsService, MichelineFormat } from '@dipdup/tzkt-api'; import { Space, Col, Row, Drawer, Radio } from 'antd'; import { CiTwoTone, ConsoleSqlOutlined, DoubleRightOutlined } from '@ant-design/icons'; @@ -16,6 +16,7 @@ import { setTokenAmount, setSocketTokenAmount, scaleStringAmountDown, + getLexicographicalPairName, } from '@/extra_utils/utils'; import { connection, init_contract, init_user } from '@/extra_utils/webSocketUtils'; import { scaleAmountUp, zeroHoldings } from '@/extra_utils/utils'; @@ -55,22 +56,27 @@ const Welcome: React.FC = () => { decimals: 6, standard: 'FA2 token', }); - const [tokenPair, setTokenPair] = useState(buyToken.name + '/' + sellToken.name); + const [tokenPair, setTokenPair] = useState(getLexicographicalPairName(buyToken.name, sellToken.name)); const [buyBalance, setBuyBalance] = useState(0); const [sellBalance, setSellBalance] = useState(0); const [rate, setRate] = useState(0); const [status, setStatus] = useState(BatcherStatus.NONE); const [openTime, setOpenTime] = useState(null); - const [clearedHoldings, setClearedHoldings] = useState>( - new Map(), + const [clearedHoldings, setClearedHoldings] = useState>( + new Map(), ); - const [openHoldings, setOpenHoldings] = useState>(new Map()); + const [closedHoldings, setClosedHoldings] = useState>( + new Map(), + ); + const [openHoldings, setOpenHoldings] = useState>(new Map()); const [feeInMutez, setFeeInMutez] = useState(0); const [volumes, setVolumes] = useState(getEmptyVolumes()); const [updateAll, setUpdateAll] = useState(false); const [batchNumber, setBatchNumber] = useState(0); const [hasClearedHoldings, setHasClearedHoldings] = useState(false); + const [hasClosedHoldings, setHasClosedHoldings] = useState(false); + const [hasOpenHoldings, setHasOpenHoldings] = useState(false); const pullStorage = async () => { @@ -290,30 +296,27 @@ const Welcome: React.FC = () => { const findTokensForBatch = (batch: any) => { const pair = batch.pair; const tkns: tokens = { - buy_token_name: pair.name_0, - sell_token_name: pair.name_1, + buy_token_name: pair.string_0, + sell_token_name: pair.string_1, }; return tkns; }; - const calculateHoldingFromBatch = ( - batch: any, - ubots: any, - open_holdings: Map, - cleared_holdings: Map, - ) => { - const tkns = findTokensForBatch(batch); - const depositsInBatches = ubots.value; - const userBatchLength = depositsInBatches[batch.batch_number].length; - - if (Object.keys(batch.status)[0] !== BatcherStatus.CLEARED) { - for (let j = 0; j < userBatchLength; j++) { - try { - const depObject = ubots.value[batch.batch_number].at(j); - const side = depObject.key.side; - const value = depObject.value; - let initialBuySideOpenAmount = open_holdings.get(tkns.buy_token_name); - let initialSellSideOpenAmount = open_holdings.get(tkns.sell_token_name); + const setHolding = (tkns: any, side: any, value: number, holdings: Map) => { + + const pair = getLexicographicalPairName(tkns.buy_token_name, tkns.sell_token_name); + let hdgs = holdings.get(pair) + if (!hdgs){ + hdgs = { + pair: pair, + buy_token_name: tkns.buy_token_name, + sell_token_name: tkns.sell_token_name, + buy_token_holding: 0, + sell_token_holding:0, + }; + } + let initialBuySideOpenAmount = hdgs.buy_token_holding; + let initialSellSideOpenAmount = hdgs.sell_token_holding; const updatedValues = getOriginalDepositAmounts( side, initialBuySideOpenAmount, @@ -322,12 +325,82 @@ const Welcome: React.FC = () => { ); initialBuySideOpenAmount += updatedValues.at(0); initialSellSideOpenAmount += updatedValues.at(1); - open_holdings.set(tkns.buy_token_name, initialBuySideOpenAmount); - open_holdings.set(tkns.sell_token_name, initialSellSideOpenAmount); + + const new_holdings = { + ...hdgs, + buy_token_holding: initialBuySideOpenAmount, + sell_token_holding: initialSellSideOpenAmount, + }; + holdings.set(pair, new_holdings); + return holdings; + + }; + const setHoldingInClearing = (tkns: any, value: number, holdings: Map, volume_subject_to_clearing: number, cleared_volume: number, opposite_volume:number, left_decimals: number, right_decimals: number) => { + + const pair = getLexicographicalPairName(tkns.buy_token_name, tkns.sell_token_name); + let hdgs = holdings.get(pair) + if (!hdgs){ + hdgs = { + pair: pair, + buy_token_name: tkns.buy_token_name, + sell_token_name: tkns.sell_token_name, + buy_token_holding: 0, + sell_token_holding:0, + }; + } + let initialBuySideOpenAmount = hdgs.buy_token_holding; + let initialSellSideOpenAmount = hdgs.sell_token_holding; + const updatedValues = convertHoldingToPayout( + value, + volume_subject_to_clearing, + cleared_volume, + opposite_volume, + left_decimals, + right_decimals, + ); + initialBuySideOpenAmount += updatedValues.at(0); + initialSellSideOpenAmount += updatedValues.at(1); + + const new_holdings = { + ...hdgs, + buy_token_holding: initialBuySideOpenAmount, + sell_token_holding: initialSellSideOpenAmount, + }; + holdings.set(pair, new_holdings); + return holdings; + + }; + + const assignHoldings = (batch_length: number,batch_number: number, ubots: any, tkns: tokens, holdings: Map ) => { + for (let j = 0; j < batch_length; j++) { + try { + const depObject = ubots.value[batch_number].at(j); + const side = depObject.key.side; + const value = depObject.value; + holdings = setHolding(tkns, side, value, holdings); } catch (error) { console.error(error); } } + return holdings; + }; + + const calculateHoldingFromBatch = ( + batch: any, + ubots: any, + open_holdings: Map, + closed_holdings: Map, + cleared_holdings: Map, + ) => { + + const tkns = findTokensForBatch(batch); + const depositsInBatches = ubots.value; + const userBatchLength = depositsInBatches[batch.batch_number].length; + + if (Object.keys(batch.status)[0]=== BatcherStatus.OPEN) { + open_holdings = assignHoldings(userBatchLength, batch.batch_number, ubots, tkns, open_holdings); + } else if (Object.keys(batch.status)[0] === BatcherStatus.CLOSED) { + closed_holdings = assignHoldings(userBatchLength, batch.batch_number, ubots, tkns, closed_holdings); } else { const cleared = batch.status.cleared; const clearing = cleared.clearing; @@ -347,67 +420,19 @@ const Welcome: React.FC = () => { const value = depObject.value; if (buy_side_cleared_volume === 0 || sell_side_cleared_volume === 0) { - let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); - const updatedValues = getOriginalDepositAmounts( - side, - initialBuySideAmount, - initialSellSideAmount, - value, - ); - initialBuySideAmount += updatedValues.at(0); - initialSellSideAmount += updatedValues.at(1); - cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); - cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + cleared_holdings = setHolding(tkns, side, value, cleared_holdings); } else { const wasInClearing = wasInClearingForBatch(side, tol, clearing.clearing_tolerance); if (wasInClearing) { if (Object.keys(side).at(0) === 'buy') { - let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); - const payout = convertHoldingToPayout( - value, - buy_side_volume_subject_to_clearing, - buy_side_cleared_volume, - sell_side_cleared_volume, - buyToken.decimals, - sellToken.decimals, - ); - initialSellSideAmount += payout.at(0); - initialBuySideAmount += payout.at(1); - cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); - cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + cleared_holdings = setHoldingInClearing(tkns, value, cleared_holdings, buy_side_volume_subject_to_clearing, buy_side_cleared_volume, sell_side_cleared_volume, buyToken.decimals,sellToken.decimals); } else if (Object.keys(side).at(0) === 'sell') { - let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); - const payout = convertHoldingToPayout( - value, - sell_side_volume_subject_to_clearing, - sell_side_cleared_volume, - buy_side_cleared_volume, - sellToken.decimals, - buyToken.decimals, - ); - initialBuySideAmount += payout.at(0); - initialSellSideAmount += payout.at(1); - cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); - cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + cleared_holdings = setHoldingInClearing(tkns, value, cleared_holdings, sell_side_volume_subject_to_clearing, sell_side_cleared_volume, buy_side_cleared_volume, sellToken.decimals,buyToken.decimals); } else { console.error('Unable to determine side for a deposit that was in clearing'); } } else { - let initialBuySideAmount = cleared_holdings.get(tkns.buy_token_name); - let initialSellSideAmount = cleared_holdings.get(tkns.sell_token_name); - const updatedValues = getOriginalDepositAmounts( - side, - initialBuySideAmount, - initialSellSideAmount, - value, - ); - initialBuySideAmount += updatedValues.at(0); - initialSellSideAmount += updatedValues.at(1); - cleared_holdings.set(tkns.buy_token_name, initialBuySideAmount); - cleared_holdings.set(tkns.sell_token_name, initialSellSideAmount); + cleared_holdings = setHolding(tkns, side, value, cleared_holdings); } } } catch (error) { @@ -415,19 +440,18 @@ const Welcome: React.FC = () => { } } } - return [open_holdings, cleared_holdings]; + return [open_holdings, closed_holdings, cleared_holdings]; }; const updateHoldings = async (storage: any) => { let oh = openHoldings; let ch = clearedHoldings; + let clh = closedHoldings; try { if (!userAddress) { return; } - console.info('##open holdings', openHoldings); - console.info('##cleared holdings', clearedHoldings); const userBatcherURI = bigMapsByIdUri + userBatchOrderTypesBigMapId + '/keys/' + userAddress; const userOrderBookData = await fetch(userBatcherURI, { method: 'GET' }); let userBatches = null; @@ -456,11 +480,12 @@ const Welcome: React.FC = () => { } try { - const batch_holdings = calculateHoldingFromBatch(batch.value, userBatches, oh, ch); + const batch_holdings = calculateHoldingFromBatch(batch.value, userBatches, oh,clh, ch); console.info('== batcher holdings ' + batchId, batch_holdings); oh = batch_holdings[0]; - ch = batch_holdings[1]; + clh = batch_holdings[1]; + ch = batch_holdings[2]; } catch (error) { console.error(error); } @@ -471,11 +496,21 @@ const Welcome: React.FC = () => { setOpenHoldings(oh); setClearedHoldings(ch); - let sum_of_holdings = 0; + let has_holdings = false; for (const value of ch.values()) { - sum_of_holdings = sum_of_holdings + value; + if (value.buy_token_holding > 0 || value.sell_token_holding >0) { + has_holdings = true; + } + } + setHasClearedHoldings(has_holdings); + + let has_open_holdings = false; + for (const value of oh.values()) { + if (value.buy_token_holding > 0 || value.sell_token_holding >0) { + has_open_holdings = true; + } } - setHasClearedHoldings(sum_of_holdings > 0); + setHasOpenHoldings(has_open_holdings); }; const getBatches = async (storage: any) => { @@ -649,12 +684,16 @@ const Welcome: React.FC = () => { userAddress={userAddress} contractAddress={contractAddress} openHoldings={openHoldings} + closedHoldings={closedHoldings} clearedHoldings={clearedHoldings} setOpenHoldings={setOpenHoldings} setClearedHoldings={setClearedHoldings} updateAll={updateAll} setUpdateAll={setUpdateAll} hasClearedHoldings={hasClearedHoldings} + hasClosedHoldings={hasClosedHoldings} + hasOpenHoldings={hasOpenHoldings} + tokenMap={tokenMap} /> ); case ContentType.ABOUT: diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index a27ebf5f..f462cc8c 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -141,40 +141,7 @@ (option %address address) (nat %decimals) (option %standard string)))) ; - code { LAMBDA - (pair nat nat) - nat - { UNPAIR ; - PUSH nat 1 ; - DUG 2 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } } ; - PUSH int 1 ; + code { PUSH int 1 ; PUSH int 10000 ; PAIR ; PUSH int 1 ; @@ -245,13 +212,12 @@ { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; SWAP ; DROP } ; - DIG 4 ; + DIG 3 ; UNPAIR ; IF_LEFT { DIG 2 ; DIG 4 ; - DIG 5 ; - DROP 3 ; + DROP 2 ; IF_LEFT { IF_LEFT { DIG 2 ; @@ -558,14 +524,18 @@ CAR ; CAR ; GET 3 ; - SWAP ; - DUP 5 ; - DUP 3 ; - DUP 3 ; + PAIR ; + DUP 4 ; + DUP 2 ; + CAR ; + DIG 2 ; + CDR ; + DUP 2 ; + DUP 2 ; COMPARE ; GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { DUP 4 ; @@ -797,39 +767,25 @@ CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; NOW ; - DUP 5 ; + DUP 7 ; CAR ; CAR ; CDR ; CAR ; - DUP 6 ; + DUP 8 ; CAR ; CAR ; CAR ; CDR ; CDR ; - DUP 7 ; + DUP 9 ; CAR ; CAR ; CAR ; CDR ; CAR ; - DUP 7 ; + DUP 9 ; UNPAIR ; DUP ; DUP 3 ; @@ -842,7 +798,7 @@ GET ; IF_NONE { DROP ; - DUP 5 ; + DUP 7 ; CAR ; CAR ; CAR ; @@ -853,8 +809,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH nat 0 ; - DIG 6 ; + DIG 7 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -864,7 +819,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -873,8 +828,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; + DIG 3 ; + PAIR 4 ; DUP 2 ; DUP 3 ; CDR ; @@ -890,7 +845,7 @@ CAR ; SOME ; DUP 4 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -907,7 +862,7 @@ DROP ; IF_LEFT { DROP 2 ; - DUP 5 ; + DUP 7 ; CAR ; CAR ; CAR ; @@ -918,8 +873,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH nat 0 ; - DIG 6 ; + DIG 7 PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -929,7 +883,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 5 ; + DIG 4 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -938,8 +892,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; + DIG 3 ; + PAIR 4 ; DUP 2 ; DUP 3 ; CDR ; @@ -955,7 +909,7 @@ CAR ; SOME ; DUP 4 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -965,8 +919,8 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } - { DIG 6 ; + { DIG 2 ; DIG 7 ; DROP 3 ; DUP 6 ; CAR ; CAR ; CAR ; CDR } } + { DIG 8 ; DROP ; DUP 3 ; INT ; @@ -997,7 +951,7 @@ (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; - DUP 4 ; + DUP 6 ; CAR ; CAR ; CAR ; @@ -1017,7 +971,7 @@ CAR ; SOME ; DUP 4 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -1027,7 +981,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; + { SWAP ; DROP ; DUP 6 ; CAR ; CAR ; CAR ; CDR } } } ; SWAP ; DUP ; GET 3 ; @@ -1036,30 +990,30 @@ { DROP ; PUSH bool True } ; NOT ; IF { PUSH nat 140 ; FAILWITH } {} ; - DUP 5 ; + DUP 7 ; CDR ; CAR ; CDR ; CAR ; - DUP 5 ; + DUP 7 ; GET ; IF_NONE - { DROP 6 ; PUSH nat 139 ; FAILWITH } + { DROP 8 ; PUSH nat 139 ; FAILWITH } { DUP 2 ; CAR ; DUP 2 ; DUP 2 ; GET ; IF_NONE - { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } - { DUP 8 ; - DUP 9 ; + { SWAP ; DIG 8 ; DROP 3 ; PUSH nat 139 ; FAILWITH } + { DUP 10 ; + DUP 11 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 11 ; + DIG 13 ; CDR ; CAR ; CDR ; @@ -1070,7 +1024,7 @@ SWAP ; UPDATE ; SOME ; - DUP 11 ; + DUP 13 ; UPDATE ; UPDATE 1 ; UPDATE 2 ; @@ -1186,22 +1140,37 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 1 ; + DUP 5 ; + GET 8 ; + DUP 6 ; + GET 7 ; + DUP 7 ; + GET 5 ; + DIG 7 ; + GET 3 ; + DIG 6 ; + PUSH nat 1 ; + DIG 8 ; + PAIR ; + PAIR ; + PAIR 5 ; PUSH mutez 0 ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; PAIR ; - DIG 2 ; + DIG 3 ; ITER { SWAP ; UNPAIR ; DIG 2 ; UNPAIR ; CAR ; - IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; + IF_LEFT { DROP ; DUP 4 ; CAR ; CAR ; CAR } { DROP ; DUP 4 ; CAR ; CDR } ; PAIR ; PAIR ; DUP 6 ; SWAP ; EXEC ; - DUP 3 ; + DUP 4 ; + CAR ; CAR ; CDR ; @@ -1210,7 +1179,7 @@ ADD ; SWAP ; PAIR } ; - DIG 2 ; + SWAP ; DIG 4 ; DROP 2 ; UNPAIR ; @@ -1267,18 +1236,23 @@ { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; CONS } ; SWAP ; - DROP ; + DIG 4 ; + DROP 2 ; PUSH mutez 0 ; DUP 3 ; COMPARE ; GT ; - IF { DIG 3 ; + IF { DUP 3 ; + CAR ; + CDR ; + CAR ; + CAR ; CONTRACT unit ; IF_NONE { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; CONS } - { SWAP ; DIG 3 ; DROP 2 } ; + { SWAP ; DROP } ; PAIR } } } } } { DIG 2 ; DROP ; @@ -1442,8 +1416,7 @@ { DIG 2 ; DIG 3 ; DIG 4 ; - DIG 5 ; - DROP 4 ; + DROP 3 ; IF_LEFT { IF_LEFT { DUP 2 ; @@ -2139,173 +2112,6 @@ CDR ; CAR ; CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE - { DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 6 ; - GET 7 ; - CAR ; - CDR ; - DUP 7 ; - GET 11 ; - DUP 8 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 7 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 2 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP ; - DUP 7 ; - GET ; - IF_NONE - { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 5 ; - GET 7 ; - CAR ; - CDR ; - DUP 6 ; - GET 11 ; - DUP 7 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 6 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP 5 ; - GET 11 ; - DUP 6 ; - GET 9 ; - PAIR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; - SOME ; - DIG 6 ; - UPDATE } ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - SWAP ; - SOME ; - DIG 2 ; - UPDATE } ; - DUP 5 ; - DIG 5 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 8 ; - DIG 6 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP ; - CAR ; - DUP ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - DUP 3 ; - GET 7 ; - CAR ; - SELF_ADDRESS ; - DUP 2 ; - CAR ; - GET 5 ; - IF_NONE - { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 5 ; - GET 5 ; - DUP 4 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 4 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - SWAP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 4 ; - CDR ; - DIG 4 ; - DIG 4 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { SWAP ; - CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 7 ; - CDR ; - DIG 7 ; - CAR ; - CAR ; - DIG 7 ; - PAIR 3 ; - CONS ; - DIG 4 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 2 ; - DIG 2 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; DIG 5 ; UPDATE 1 ; UPDATE 2 ; @@ -2444,20 +2250,25 @@ CAR ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 2 ; - DUP 7 ; + DUP 6 ; GET ; IF_NONE - { DIG 7 ; DIG 8 ; DROP 2 ; DIG 2 ; PAIR ; SWAP } - { DUP 8 ; + { DIG 6 ; DROP ; SWAP } + { DUP 7 ; CAR ; CAR ; CDR ; CDR ; - DIG 5 ; + DIG 4 ; PAIR ; - DUP 8 ; + DUP 7 ; CDR ; CDR ; + DUP 8 ; + CAR ; + CAR ; + CAR ; + CDR ; DIG 5 ; PAIR ; DIG 3 ; @@ -2599,20 +2410,20 @@ SWAP ; GET 3 ; INT ; - DIG 4 ; - INT ; PUSH int 1 ; SWAP ; PAIR ; + DIG 4 ; + INT ; PUSH int 1 ; - DIG 2 ; + SWAP ; PAIR ; - DUP ; + DUP 2 ; CAR ; - DUP 3 ; + DUP 2 ; CDR ; MUL ; - SWAP ; + DIG 2 ; CDR ; DUP 3 ; CAR ; @@ -2672,12 +2483,36 @@ { SWAP } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 25 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -2719,12 +2554,36 @@ { SWAP } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 23 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -2749,20 +2608,20 @@ SWAP ; GET 6 ; INT ; - DIG 4 ; - INT ; PUSH int 1 ; SWAP ; PAIR ; + DIG 4 ; + INT ; PUSH int 1 ; - DIG 2 ; + SWAP ; PAIR ; - DUP ; + DUP 2 ; CAR ; - DUP 3 ; + DUP 2 ; CDR ; MUL ; - SWAP ; + DIG 2 ; CDR ; DUP 3 ; CAR ; @@ -2822,12 +2681,36 @@ { SWAP } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 25 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -2869,12 +2752,36 @@ { SWAP } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 23 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -3018,8 +2925,7 @@ PAIR ; PAIR } ; DIG 5 ; - DIG 6 ; - DROP 2 ; + DROP ; UNPAIR ; UNPAIR ; UNPAIR ; @@ -3120,34 +3026,22 @@ { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 3 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; CONS } - { DIG 2 ; DROP } ; - DUP 4 ; - DIG 4 ; + { SWAP ; DROP } ; + DUP 3 ; + DIG 3 ; CDR ; DUP ; CAR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 5 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; SWAP } { DIG 2 ; - DIG 3 ; - DROP 2 ; + DROP ; DUP 2 ; CAR ; CAR ; @@ -3189,8 +3083,7 @@ IF_LEFT { DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; CAR ; CAR ; @@ -3222,18 +3115,14 @@ CAR ; CAR ; GET 3 ; - PAIR ; - DUP 2 ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; - DUP 2 ; - DUP 2 ; + SWAP ; + DUP 3 ; + DUP 3 ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE { DROP 2 ; PUSH nat 117 ; FAILWITH } @@ -3575,7 +3464,7 @@ DUP 2 ; GET ; IF_NONE - { DROP 5 ; PUSH nat 117 ; FAILWITH } + { DROP 4 ; PUSH nat 117 ; FAILWITH } { DUP 3 ; CDR ; CDR ; @@ -3704,17 +3593,17 @@ { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; INT ; PUSH int 1 ; - DIG 2 ; + SWAP ; PAIR ; PUSH int 1 ; DIG 2 ; PAIR ; - DUP 2 ; + DUP ; CAR ; - DUP 2 ; + DUP 3 ; CDR ; MUL ; - DIG 2 ; + SWAP ; CDR ; DIG 2 ; CAR ; @@ -3872,8 +3761,7 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat) } + (pair string string)) } { DUP ; GET 3 ; IF_LEFT @@ -3893,8 +3781,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH nat 0 ; - DIG 2 ; + SWAP ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -3904,7 +3791,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DUP 6 ; + DUP 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -3913,8 +3800,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; + DIG 3 ; + PAIR 4 ; DUP 2 ; DUP 3 ; CDR ; @@ -3930,7 +3817,7 @@ CAR ; SOME ; DUP 4 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -3987,7 +3874,7 @@ CAR ; SOME ; DUP 4 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -4001,7 +3888,7 @@ SWAP } ; SOME } ; IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } + { SWAP ; DIG 3 ; DIG 4 ; DROP 4 } { DUP ; GET 3 ; IF_LEFT @@ -4197,12 +4084,36 @@ { DUP 3 } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 14 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -4220,12 +4131,36 @@ { DUP 3 } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 15 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -4243,12 +4178,36 @@ { DUP 3 } ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DUP 16 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -4435,12 +4394,36 @@ {} ; DUP ; CDR ; + PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - DIG 13 ; - SWAP ; - EXEC ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; DIG 2 ; CAR ; MUL ; @@ -4482,7 +4465,7 @@ CAR ; SOME ; DIG 3 ; - GET 7 ; + GET 6 ; UNPAIR ; DUP ; DUP 3 ; @@ -4492,7 +4475,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; + { DIG 3 ; DIG 4 ; DROP 3 } ; DUP 2 ; DIG 2 ; CAR ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 9f680746..17897e5d 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -41,7 +41,7 @@ [@inline] let cannot_remove_swap_pair_that_is_not_disabled : nat = 137n [@inline] let token_name_not_in_list_of_valid_tokens : nat = 138n [@inline] let no_orders_for_user_address : nat = 139n -[@inline] let cannot_cancel_orders_for_a_batch_that_isn_not_open : nat = 140n +[@inline] let cannot_cancel_orders_for_a_batch_that_is_not_open : nat = 140n [@inline] let cannot_decrease_holdings_of_removed_batch : nat = 141n [@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n [@inline] let batch_already_removed : nat = 143n @@ -1152,6 +1152,7 @@ let transfer_fee (receiver : address) (amount : tez) : operation = | None -> failwith invalid_tezos_address | Some rec_address -> Tezos.transaction () amount rec_address + end @@ -1792,32 +1793,7 @@ let get_valid_swap_reduced | None -> failwith swap_does_not_exist [@inline] -let refund_orders - (refund_address: address) - (ots: ordertypes) - (valid_swap:valid_swap) - (storage: storage): result = - let fee = storage.fee_in_mutez in - let collect_refunds ((tam,mutez_to_ref), (ot, amt): ((token_amount_map * tez) * (ordertype * nat))) : (token_amount_map * tez) = - let token = match ot.side with - | Buy -> valid_swap.swap.from.token - | Sell -> valid_swap.swap.to - in - let ta = { - token = token; - amount = amt; - } in - let tam = TokenAmountMap.increase ta tam in - let mutez_to_ref = mutez_to_ref + fee in - tam, mutez_to_ref - in - let token_refunds, tez_refunds= Map.fold collect_refunds ots ((Map.empty: token_amount_map), 0mutez) in - let treasury_vault = Treasury.get_treasury_vault () in - let operations = Treasury_Utils.transfer_holdings treasury_vault refund_address token_refunds in - let operations = if tez_refunds > 0mutez then Treasury_Utils.transfer_fee refund_address tez_refunds :: operations else operations in - operations, storage -[@inline] let remove_orders_from_batch (ots: ordertypes) (batch: batch): batch = @@ -1849,6 +1825,32 @@ let remove_order_types let storage = { storage with user_batch_ordertypes = ubots;} in (ots,storage) +[@inline] +let refund_orders + (refund_address: address) + (ots: ordertypes) + (valid_swap:valid_swap) + (storage: storage): result = + let fee = storage.fee_in_mutez in + let collect_refunds ((tam,mutez_to_ref), (ot, amt): ((token_amount_map * tez) * (ordertype * nat))) : (token_amount_map * tez) = + let token = match ot.side with + | Buy -> valid_swap.swap.from.token + | Sell -> valid_swap.swap.to + in + let ta = { + token = token; + amount = amt; + } in + let tam = TokenAmountMap.increase ta tam in + let mutez_to_ref = mutez_to_ref + fee in + tam, mutez_to_ref + in + let token_refunds, tez_refunds= Map.fold collect_refunds ots ((Map.empty: token_amount_map), 0mutez) in + let treasury_vault = Treasury.get_treasury_vault () in + let operations = Treasury_Utils.transfer_holdings treasury_vault refund_address token_refunds in + let operations = if tez_refunds > 0mutez then Treasury_Utils.transfer_fee storage.fee_recipient tez_refunds :: operations else operations in + operations, storage + [@inline] let cancel_order (pair: pair) @@ -1859,8 +1861,7 @@ let cancel_order let current_time = Tezos.get_now () in let (batch, batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in let () = if not (Batch_Utils.is_batch_open batch) then - failwith cannot_cancel_orders_for_a_batch_that_isn_not_open - in + failwith cannot_cancel_orders_for_a_batch_that_is_not_open match Big_map.find_opt holder ubots with | None -> failwith no_orders_for_user_address | Some bot -> let orders_to_remove, storage = remove_order_types batch.batch_number holder bot storage in From f6cc4097a8c2c731c4e40cc4637e8517eff15e8c Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:57:56 +0300 Subject: [PATCH 076/108] Revive tests (#384) * Restructured tests. Oracle mock plus origination of test token contracts * Added tests for change_fee * Added tests for change_fee * Added test context type to reduce test code duplication * Adjusted clause to assure burn and fee recipient aren't the same. Additionally added a test * Removed references to burn and burn address as it will not always be a burn address * Added tests for enabling and disabling swap pairs * Added tests for adding, updating and removing metadata * Added tests for token pair limit * Uncommented failing oracle source change test for PR review * Added workflow for testing using github action * rolled action version * rolled action version * Added explicit path variable for workspace * Added explicit path variable for workspace * Added path listing to debug action * Added path listing to debug action * Set directory in workflow file * Adeed explicit working directory * Fixed issue with 0.70 of ligo compiler * Working Oracle test * Attempt to make gh action work * use release of ligo-version * Manage ligo version manually in ligo gh action * Covered add and remove swap pairs * Manage ligo version manually in ligo gh action * Added deposit tests * Amended typos in tests * Switched Expect.fail_with_value for Breath.Expect.fail_with_value * Added cancellation tests * Removed manual ubots construction --------- Co-authored-by: Laurent Canis --- .github/workflows/test.yml | 32 + batcher/Makefile | 42 +- batcher/batcher-ghostnet.tz | 1113 ++++++++--------- batcher/batcher-storage-ghostnet.tz | 15 +- batcher/batcher.mligo | 74 +- batcher/package.json | 4 +- .../storage/initial_storage_ghostnet.mligo | 1 - batcher/storage/initial_storage_mainnet.mligo | 1 - batcher/test/common/batch.mligo | 251 ++++ batcher/test/common/helpers.mligo | 269 ++++ batcher/test/common/storage.mligo | 143 +++ batcher/test/common/utils.mligo | 127 ++ batcher/test/economics/test_clearing.mligo | 61 + .../test_add_remove_token_swap_pair.mligo | 240 ++++ .../test_add_update_remove_metadata.mligo | 114 ++ .../admin/test_amend_token_pair_limit.mligo | 85 ++ .../admin/test_change_admin_address.mligo | 86 ++ .../test_change_deposit_time_window.mligo | 104 ++ .../endpoints/admin/test_change_fee.mligo | 72 ++ .../test_change_fee_recipient_address.mligo | 85 ++ .../test_change_oracle_source_of_pair.mligo | 104 ++ ...enable_disable_swap_pair_for_deposit.mligo | 79 ++ .../endpoints/maintenance/test_tick.mligo | 27 + .../endpoints/user/test_cancellations.mligo | 77 ++ .../test/endpoints/user/test_deposits.mligo | 99 ++ .../endpoints/user/test_redemptions.mligo | 36 + .../oracle.mligo} | 19 +- batcher/test/test.mligo | 61 + batcher/test/test_batcher_sc.mligo | 68 - batcher/test/test_contract.mligo | 26 + batcher/test/test_storage.mligo | 125 -- batcher/test/test_utils.mligo | 90 -- batcher/{ => test}/tokens/README.md | 0 batcher/{ => test}/tokens/fa12/main.mligo | 6 +- .../{ => test}/tokens/fa12/storage/CTEZ.json | 0 .../tokens/fa12/storage/CTEZ_storage.mligo | 0 .../{ => test}/tokens/fa12/storage/KUSD.json | 0 .../tokens/fa12/storage/KUSD_storage.mligo | 0 .../{ => test}/tokens/fa12/storage/TZBTC.json | 0 .../tokens/fa12/storage/tzBTC_storage.mligo | 0 batcher/{ => test}/tokens/fa2/errors.mligo | 0 batcher/{ => test}/tokens/fa2/main.mligo | 0 .../{ => test}/tokens/fa2/storage/EURL.json | 0 .../tokens/fa2/storage/EURL_storage.mligo | 0 .../{ => test}/tokens/fa2/storage/USDT.json | 0 .../tokens/fa2/storage/USDT_storage.mligo | 0 46 files changed, 2820 insertions(+), 916 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 batcher/test/common/batch.mligo create mode 100644 batcher/test/common/helpers.mligo create mode 100644 batcher/test/common/storage.mligo create mode 100644 batcher/test/common/utils.mligo create mode 100644 batcher/test/economics/test_clearing.mligo create mode 100644 batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo create mode 100644 batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo create mode 100644 batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo create mode 100644 batcher/test/endpoints/admin/test_change_admin_address.mligo create mode 100644 batcher/test/endpoints/admin/test_change_deposit_time_window.mligo create mode 100644 batcher/test/endpoints/admin/test_change_fee.mligo create mode 100644 batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo create mode 100644 batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo create mode 100644 batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo create mode 100644 batcher/test/endpoints/maintenance/test_tick.mligo create mode 100644 batcher/test/endpoints/user/test_cancellations.mligo create mode 100644 batcher/test/endpoints/user/test_deposits.mligo create mode 100644 batcher/test/endpoints/user/test_redemptions.mligo rename batcher/test/{test_mock_oracle.mligo => mocks/oracle.mligo} (50%) create mode 100644 batcher/test/test.mligo delete mode 100644 batcher/test/test_batcher_sc.mligo create mode 100644 batcher/test/test_contract.mligo delete mode 100644 batcher/test/test_storage.mligo delete mode 100644 batcher/test/test_utils.mligo rename batcher/{ => test}/tokens/README.md (100%) rename batcher/{ => test}/tokens/fa12/main.mligo (98%) rename batcher/{ => test}/tokens/fa12/storage/CTEZ.json (100%) rename batcher/{ => test}/tokens/fa12/storage/CTEZ_storage.mligo (100%) rename batcher/{ => test}/tokens/fa12/storage/KUSD.json (100%) rename batcher/{ => test}/tokens/fa12/storage/KUSD_storage.mligo (100%) rename batcher/{ => test}/tokens/fa12/storage/TZBTC.json (100%) rename batcher/{ => test}/tokens/fa12/storage/tzBTC_storage.mligo (100%) rename batcher/{ => test}/tokens/fa2/errors.mligo (100%) rename batcher/{ => test}/tokens/fa2/main.mligo (100%) rename batcher/{ => test}/tokens/fa2/storage/EURL.json (100%) rename batcher/{ => test}/tokens/fa2/storage/EURL_storage.mligo (100%) rename batcher/{ => test}/tokens/fa2/storage/USDT.json (100%) rename batcher/{ => test}/tokens/fa2/storage/USDT_storage.mligo (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..ef2c9a20 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Run Ligo Tests + +on: + workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually + push: + + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Ligo version + uses: marigold-dev/ligo-action@v1.0.0 + with: + ligo_version: 0.69.0 + command: version + working_directory: batcher + - name: Install deps + uses: marigold-dev/ligo-action@v1.0.0 + with: + ligo_version: 0.70.1 + command: install + working_directory: batcher + - name: Run test + uses: marigold-dev/ligo-action@v1.0.0 + with: + ligo_version: 0.70.1 + command: run test test/test.mligo + working_directory: batcher + diff --git a/batcher/Makefile b/batcher/Makefile index 7c5478eb..49ab7d7f 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -1,9 +1,17 @@ .PHONY: test -LIGO_COMPILER_VERSION:=0.66.0 +LIGO_COMPILER_VERSION:=0.70.0 TEZOS_PROTOCOL:=mumbai LIGO_DOCKER := docker run --rm -v $(PWD):$(PWD) -w $(PWD) ligolang/ligo:$(LIGO_COMPILER_VERSION) +TEST_DIRECTORY:=test +STORAGE_DIRECTORY:=storage +TOKENS_DIRECTORY:=$(BATCHER_TEST_DIRECTORY)/tokens +FA12_DIRECTORY:=$(TOKENS_DIRECTORY)/fa12 +FA12_STORAGE_DIRECTORY:=$(FA12_DIRECTORY)/storage +FA2_DIRECTORY:=$(TOKENS_DIRECTORY)/fa2 +FA2_STORAGE_DIRECTORY:=$(FA2_DIRECTORY)/storage + define test_ligo $(LIGO_DOCKER) run test $(1) endef @@ -26,12 +34,10 @@ endef define clean_mainnet_files rm -rf *mainnet.tz - rm -rf batcher/*mainnet.tz endef define clean_ghostnet_files rm -rf *ghostnet.tz - rm -rf batcher/*ghostnet.tz endef clean: @@ -40,37 +46,37 @@ clean: build-mainnet: $(call clean_mainnet_files) $(call compile_contract,batcher.mligo, batcher-mainnet.tz) - $(call compile_storage,storage/initial_storage_mainnet.mligo, batcher-storage-mainnet.tz) + $(call compile_storage,$(STORAGE_DIRECTORY)/initial_storage_mainnet.mligo, batcher-storage-mainnet.tz) build-ghostnet: $(call clean_ghostnet_files) $(call compile_contract,batcher.mligo, batcher-ghostnet.tz) - $(call compile_storage,storage/initial_storage_ghostnet.mligo, batcher-storage-ghostnet.tz) + $(call compile_storage,$(STORAGE_DIRECTORY)/initial_storage_ghostnet.mligo, batcher-storage-ghostnet.tz) build-tzBTC: $(call clean_files) - $(call compile_contract,tokens/fa12/main.mligo, tzBTC_token.tz) - $(call compile_storage,tokens/fa12/storage/tzBTC_storage.mligo, tzBTC_token_storage.tz) + $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, tzBTC_token.tz) + $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/tzBTC_storage.mligo, tzBTC_token_storage.tz) build-USDT: $(call clean_files) - $(call compile_contract,tokens/fa2/main.mligo, USDT_token.tz) - $(call compile_storage,tokens/fa2/storage/USDT_storage.mligo, USDT_token_storage.tz) + $(call compile_contract,$(FA2_DIRECTORY)/main.mligo, USDT_token.tz) + $(call compile_storage,$(FA2_STORAGE_DIRECTORY)/USDT_storage.mligo, USDT_token_storage.tz) build-CTEZ: $(call clean_files) - $(call compile_contract,tokens/fa12/main.mligo, CTEZ_token.tz) - $(call compile_storage,tokens/fa12/storage/CTEZ_storage.mligo, CTEZ_token_storage.tz) + $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, CTEZ_token.tz) + $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/CTEZ_storage.mligo, CTEZ_token_storage.tz) build-KUSD: $(call clean_files) - $(call compile_contract,tokens/fa12/main.mligo, KUSD_token.tz) - $(call compile_storage,tokens/fa12/storage/KUSD_storage.mligo, KUSD_token_storage.tz) + $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, KUSD_token.tz) + $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/KUSD_storage.mligo, KUSD_token_storage.tz) build-EURL: $(call clean_files) - $(call compile_contract,tokens/fa2/main.mligo, EURL_token.tz) - $(call compile_storage,tokens/fa2/storage/EURL_storage.mligo, EURL_token_storage.tz) + $(call compile_contract, $(FA2_DIRECTORY)/main.mligo, EURL_token.tz) + $(call compile_storage, $(FA2_STORAGE_DIRECTORY)/EURL_storage.mligo, EURL_token_storage.tz) build-fa12-tzBTC: $(call clean_files) - $(call compile_contract,tokens/fa12/main.mligo, tzBTC_fa12_token.tz) - $(call compile_storage,tokens/fa12/storage/tzBTC_storage.mligo, tzBTC_fa12_token_storage.tz) + $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, tzBTC_fa12_token.tz) + $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/tzBTC_storage.mligo, tzBTC_fa12_token_storage.tz) test: - $(call test_ligo,test/test_batcher_sc.mligo) + $(call test_ligo,$(TEST_DIRECTORY)/test.mligo) measure: $(call measure_contract,batcher.mligo) install: diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index f462cc8c..f78414ab 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -22,13 +22,12 @@ (bool %is_disabled_for_deposits))) (or (nat %amend_token_and_pair_limit) (pair %cancel string string))) (or (or (address %change_admin_address) (nat %change_deposit_time_window)) - (or (mutez %change_fee) - (pair %change_oracle_source_of_pair + (or (mutez %change_fee) (address %change_fee_recipient_address)))) + (or (or (or (pair %change_oracle_source_of_pair (string %pair_name) (address %oracle_address) (string %oracle_asset_name) - (nat %oracle_precision))))) - (or (or (or (nat %change_scale_factor) + (nat %oracle_precision)) (pair %deposit (pair %swap (pair %from @@ -115,25 +114,24 @@ (pair (address %fee_recipient) (nat %last_order_number)) (nat %limit_on_tokens_or_pairs) (big_map %metadata string bytes)) - (pair (pair (big_map %rates_current - string - (pair (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when))) - (nat %scale_factor_for_oracle_staleness)) + (pair (big_map %rates_current + string + (pair (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when))) (big_map %user_batch_ordertypes address (map nat (map (pair (or %side (unit %buy) (unit %sell)) (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) - nat))) - (map %valid_swaps - string - (pair (pair %swap (string %from) (string %to)) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits)))) + nat)))) + (map %valid_swaps + string + (pair (pair %swap (string %from) (string %to)) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) (map %valid_tokens string (pair (nat %token_id) @@ -141,7 +139,40 @@ (option %address address) (nat %decimals) (option %standard string)))) ; - code { PUSH int 1 ; + code { LAMBDA + (pair nat nat) + nat + { UNPAIR ; + PUSH nat 1 ; + DUG 2 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } } ; + PUSH int 1 ; PUSH int 10000 ; PAIR ; PUSH int 1 ; @@ -212,12 +243,13 @@ { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; SWAP ; DROP } ; - DIG 3 ; + DIG 4 ; UNPAIR ; IF_LEFT { DIG 2 ; DIG 4 ; - DROP 2 ; + DIG 5 ; + DROP 3 ; IF_LEFT { IF_LEFT { DIG 2 ; @@ -324,11 +356,11 @@ { DUP 2 ; CDR ; CDR ; - DUP 3 ; CDR ; - CAR ; + DUP 3 ; CDR ; CDR ; + CAR ; DUP 4 ; CAR ; CDR ; @@ -629,17 +661,17 @@ CAR ; CAR ; GET 3 ; - SWAP ; - DIG 3 ; - DUP 5 ; + PAIR ; + DIG 2 ; + DUP 4 ; GET 8 ; - DUP 6 ; + DUP 5 ; GET 7 ; - DUP 7 ; + DUP 6 ; GET 5 ; - DUP 8 ; + DUP 7 ; GET 3 ; - DIG 8 ; + DIG 7 ; CAR ; DUP ; CDR ; @@ -650,12 +682,16 @@ GET 3 ; PAIR ; PAIR 5 ; - DUP 4 ; - DUP 4 ; + DUP 3 ; + CAR ; + DIG 3 ; + CDR ; + DUP 2 ; + DUP 2 ; COMPARE ; GT ; - IF { DIG 3 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } - { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; SWAP ; SOME ; SWAP ; @@ -667,17 +703,17 @@ DIG 3 ; CDR ; DUP ; - CAR ; - DUP ; CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; + DIG 3 ; UPDATE 1 ; UPDATE 2 ; + UPDATE 2 ; DUP ; CDR ; - DIG 2 ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; UPDATE 2 ; UPDATE 2 ; NIL operation ; @@ -702,16 +738,16 @@ DUP 2 ; CDR ; CDR ; + CDR ; SIZE ; DUP 2 ; COMPARE ; LT ; IF { DROP 2 ; PUSH nat 128 ; FAILWITH } { DUP 2 ; - CDR ; - CAR ; CDR ; CDR ; + CAR ; SIZE ; DUP 2 ; COMPARE ; @@ -741,9 +777,8 @@ UNPAIR ; DUP 5 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 3 ; DUP 3 ; COMPARE ; @@ -754,6 +789,7 @@ IF_NONE { DROP 4 ; PUSH nat 117 ; FAILWITH } { DUP 4 ; + CDR ; CDR ; CDR ; DUP 2 ; @@ -767,25 +803,39 @@ CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; NOW ; - DUP 7 ; + DUP 5 ; CAR ; CAR ; CDR ; CAR ; - DUP 8 ; + DUP 6 ; CAR ; CAR ; CAR ; CDR ; CDR ; - DUP 9 ; + DUP 7 ; CAR ; CAR ; CAR ; CDR ; CAR ; - DUP 9 ; + DUP 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -798,7 +848,7 @@ GET ; IF_NONE { DROP ; - DUP 7 ; + DUP 5 ; CAR ; CAR ; CAR ; @@ -809,7 +859,8 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DIG 7 ; + PUSH nat 0 ; + DIG 6 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -819,7 +870,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 4 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -828,8 +879,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; + DIG 4 ; + PAIR 5 ; DUP 2 ; DUP 3 ; CDR ; @@ -845,7 +896,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -862,7 +913,7 @@ DROP ; IF_LEFT { DROP 2 ; - DUP 7 ; + DUP 5 ; CAR ; CAR ; CAR ; @@ -873,7 +924,8 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - DIG 7 + PUSH nat 0 ; + DIG 6 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -883,7 +935,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 4 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -892,8 +944,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; + DIG 4 ; + PAIR 5 ; DUP 2 ; DUP 3 ; CDR ; @@ -909,7 +961,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -919,8 +971,8 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 2 ; DIG 7 ; DROP 3 ; DUP 6 ; CAR ; CAR ; CAR ; CDR } } - { DIG 8 ; + { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } + { DIG 6 ; DROP ; DUP 3 ; INT ; @@ -951,27 +1003,34 @@ (pair (pair string string) (pair int int) timestamp)) ; LEFT timestamp ; UPDATE 3 } ; - DUP 6 ; + DUP 4 ; CAR ; CAR ; CAR ; CDR ; - DUP ; - DUP 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; CDR ; - DUP 4 ; + CDR ; + DUP 3 ; SOME ; - DUP 5 ; + DUP 4 ; CAR ; UPDATE ; UPDATE 2 ; - SWAP ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CAR ; DUP 3 ; CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -981,7 +1040,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { SWAP ; DROP ; DUP 6 ; CAR ; CAR ; CAR ; CDR } } } ; + { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; SWAP ; DUP ; GET 3 ; @@ -990,43 +1049,38 @@ { DROP ; PUSH bool True } ; NOT ; IF { PUSH nat 140 ; FAILWITH } {} ; - DUP 7 ; + DUP 5 ; CDR ; CAR ; CDR ; - CAR ; - DUP 7 ; + DUP 5 ; GET ; IF_NONE - { DROP 8 ; PUSH nat 139 ; FAILWITH } + { DROP 6 ; PUSH nat 139 ; FAILWITH } { DUP 2 ; CAR ; DUP 2 ; DUP 2 ; GET ; IF_NONE - { SWAP ; DIG 8 ; DROP 3 ; PUSH nat 139 ; FAILWITH } - { DUP 10 ; - DUP 11 ; + { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } + { DUP 8 ; + DUP 9 ; CDR ; DUP ; CAR ; - DUP ; - CDR ; - DIG 13 ; + DIG 10 ; CDR ; CAR ; CDR ; - CAR ; - DIG 7 ; - DIG 7 ; + DIG 6 ; + DIG 6 ; NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; SWAP ; UPDATE ; SOME ; - DUP 13 ; + DUP 10 ; UPDATE ; - UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; @@ -1140,37 +1194,23 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 1 ; - DUP 5 ; - GET 8 ; - DUP 6 ; - GET 7 ; - DUP 7 ; - GET 5 ; - DIG 7 ; - GET 3 ; - DIG 6 ; - PUSH nat 1 ; - DIG 8 ; - PAIR ; - PAIR ; - PAIR 5 ; PUSH mutez 0 ; EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; PAIR ; - DIG 3 ; - ITER { SWAP ; - UNPAIR ; + DIG 2 ; + ITER { UNPAIR ; DIG 2 ; UNPAIR ; + DIG 3 ; + DIG 3 ; CAR ; - IF_LEFT { DROP ; DUP 4 ; CAR ; CAR ; CAR } { DROP ; DUP 4 ; CAR ; CDR } ; + IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; PAIR ; PAIR ; DUP 6 ; SWAP ; EXEC ; - DUP 4 ; - + DUP 3 ; CAR ; CAR ; CDR ; @@ -1179,7 +1219,7 @@ ADD ; SWAP ; PAIR } ; - SWAP ; + DIG 2 ; DIG 4 ; DROP 2 ; UNPAIR ; @@ -1273,6 +1313,15 @@ LT ; IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; + CAR ; + CDR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; DIG 2 ; CAR ; DUP ; @@ -1366,10 +1415,54 @@ LT ; IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; CDR ; + DUP ; CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } + { IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + DROP 4 ; + IF_LEFT + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; CDR ; CDR ; + CAR ; DUP 2 ; CAR ; GET ; @@ -1384,79 +1477,30 @@ DUP 4 ; CDR ; DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; CDR ; - CAR ; + DIG 5 ; CDR ; CDR ; - DIG 5 ; - DUP 7 ; + CAR ; + DIG 4 ; + DUP 6 ; GET 3 ; UPDATE 3 ; - DUP 7 ; + DUP 6 ; GET 5 ; UPDATE 5 ; - DUP 7 ; + DUP 6 ; GET 6 ; UPDATE 7 ; SOME ; - DIG 6 ; + DIG 5 ; CAR ; UPDATE ; + UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 } ; - NIL operation ; - PAIR } } } - { IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DROP 3 ; - IF_LEFT - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - PUSH nat 1 ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 135 ; FAILWITH } - { PUSH nat 10 ; - DUP 2 ; - COMPARE ; - GT ; - IF { DROP 2 ; PUSH nat 136 ; FAILWITH } - { DUP 2 ; - DIG 2 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - PAIR } } } + NIL operation ; + PAIR } { DUP ; GET 5 ; PUSH nat 0 ; @@ -1484,9 +1528,8 @@ NOW ; DUP 4 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 3 ; UNPAIR ; DUP ; @@ -1701,16 +1744,23 @@ CAR ; CAR ; CDR ; - DUP ; - DUP 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; CDR ; - DUP 4 ; + CDR ; + DUP 3 ; SOME ; - DUP 5 ; + DUP 4 ; CAR ; UPDATE ; UPDATE 2 ; - SWAP ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CAR ; DUP 3 ; CAR ; @@ -1740,10 +1790,9 @@ { DROP ; PUSH bool True } ; IF { DIG 2 ; DROP } { DUP 5 ; - CDR ; - CAR ; CDR ; CDR ; + CAR ; DIG 3 ; UNPAIR ; DUP ; @@ -1767,13 +1816,6 @@ CDR ; CAR ; INT ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CDR ; - INT ; - MUL ; NOW ; SUB ; COMPARE ; @@ -1833,6 +1875,7 @@ DUP 6 ; CDR ; CDR ; + CDR ; DUP 10 ; CAR ; DUP ; @@ -1931,9 +1974,8 @@ PAIR ; DUP 7 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 5 ; IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; UNPAIR ; @@ -1959,7 +2001,6 @@ CDR ; CAR ; CDR ; - CAR ; DUP 2 ; GET 5 ; GET ; @@ -2085,7 +2126,6 @@ CDR ; CAR ; CDR ; - CAR ; DUP 3 ; GET 5 ; GET ; @@ -2108,12 +2148,173 @@ { DROP } } ; DUP 2 ; GET 5 ; - DUP 6 ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + CAR ; + CDR ; + EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 6 ; + GET 7 ; + CAR ; + CDR ; + DUP 7 ; + GET 11 ; + DUP 8 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 7 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 2 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 7 ; + GET ; + IF_NONE + { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DUP 6 ; + GET 11 ; + DUP 7 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP 5 ; + GET 11 ; + DUP 6 ; + GET 9 ; + PAIR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; + SOME ; + DIG 6 ; + UPDATE } ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + SWAP ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 8 ; + DIG 6 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP 3 ; + GET 7 ; + CAR ; + SELF_ADDRESS ; + DUP 2 ; + CAR ; + GET 5 ; + IF_NONE + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; + GET 5 ; + DUP 4 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 4 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + SWAP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 4 ; + CDR ; + DIG 4 ; + DIG 4 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { SWAP ; + CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 7 ; + CDR ; + DIG 7 ; + CAR ; + CAR ; + DIG 7 ; + PAIR 3 ; + CONS ; + DIG 4 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 2 ; + DIG 2 ; CDR ; + DUP ; CAR ; - CDR ; - DIG 5 ; - UPDATE 1 ; + DIG 4 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; @@ -2140,9 +2341,8 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 2 ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; @@ -2150,23 +2350,19 @@ DUP 4 ; CDR ; DUP ; - CAR ; - DUP ; CDR ; - DIG 6 ; - CDR ; - CAR ; + DIG 5 ; CDR ; CDR ; - DIG 5 ; + CAR ; + DIG 4 ; PUSH bool True ; UPDATE 8 ; SOME ; - DIG 6 ; + DIG 5 ; UPDATE ; - UPDATE 2 ; - UPDATE 2 ; UPDATE 1 ; + UPDATE 2 ; UPDATE 2 } { DUP 2 ; CAR ; @@ -2184,9 +2380,8 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 2 ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; @@ -2194,23 +2389,19 @@ DUP 4 ; CDR ; DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; CDR ; - CAR ; + DIG 5 ; CDR ; CDR ; - DIG 5 ; + CAR ; + DIG 4 ; PUSH bool False ; UPDATE 8 ; SOME ; - DIG 6 ; + DIG 5 ; UPDATE ; - UPDATE 2 ; - UPDATE 2 ; UPDATE 1 ; + UPDATE 2 ; UPDATE 2 } ; NIL operation ; PAIR } } @@ -2230,12 +2421,12 @@ PUSH mutez 0 ; PUSH mutez 0 ; PAIR ; - DUP 3 ; - DUP 5 ; + DUP 4 ; CAR ; CDR ; CAR ; CAR ; + DUP 4 ; PAIR ; PAIR ; DUP 4 ; @@ -2247,13 +2438,17 @@ CDR ; CAR ; CDR ; - CAR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 2 ; + DUP ; DUP 6 ; GET ; IF_NONE - { DIG 6 ; DROP ; SWAP } + { DIG 6 ; + DIG 7 ; + DROP 2 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DIG 2 ; + PAIR ; + SWAP } { DUP 7 ; CAR ; CAR ; @@ -2264,20 +2459,17 @@ DUP 7 ; CDR ; CDR ; - DUP 8 ; - CAR ; - CAR ; - CAR ; CDR ; - DIG 5 ; + DIG 4 ; PAIR ; - DIG 3 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 4 ; PAIR ; PAIR ; PAIR ; SWAP ; - ITER { SWAP ; + ITER { UNPAIR ; + DIG 2 ; UNPAIR ; UNPAIR ; UNPAIR ; @@ -2285,15 +2477,13 @@ UNPAIR ; DIG 4 ; UNPAIR ; - DIG 6 ; - UNPAIR ; - DUP 5 ; + DUP 3 ; CDR ; DUP ; - DUP 3 ; + DUP 9 ; GET ; IF_NONE - { DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DIG 7 ; DIG 8 ; DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } { DUP ; GET 3 ; IF_LEFT @@ -2310,21 +2500,22 @@ (pair nat nat nat nat) (pair (pair string string) (pair int int) timestamp)) } ; IF_NONE - { DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP 7 ; - DIG 6 ; + { SWAP ; DIG 8 ; DIG 9 ; DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP 5 ; + DIG 4 ; PAIR ; - DUP 9 ; + DUP 7 ; DUP 4 ; GET 5 ; PAIR ; - DIG 11 ; + DIG 9 ; DIG 3 ; PAIR ; PAIR ; PAIR ; - DIG 4 ; - ITER { SWAP ; + DIG 8 ; + ITER { UNPAIR ; + DIG 2 ; UNPAIR ; UNPAIR ; UNPAIR ; @@ -2332,25 +2523,23 @@ UNPAIR ; DIG 4 ; UNPAIR ; - DIG 6 ; - UNPAIR ; PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 7 ; COMPARE ; EQ ; IF { PUSH bool False } { PUSH nat 0 ; - DUP 6 ; + DUP 4 ; GET 14 ; COMPARE ; EQ ; IF { PUSH bool False } - { DUP ; + { DUP 7 ; CDR ; - DUP 8 ; + DUP 6 ; GET 3 ; - DUP 3 ; + DUP 9 ; CAR ; IF_LEFT { DROP ; @@ -2385,24 +2574,24 @@ IF_LEFT { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } { DROP ; PUSH bool True } } } } } ; - IF { DUP 7 ; + IF { DUP 5 ; GET 6 ; CAR ; - DUP 7 ; + DUP 5 ; DUP 2 ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 8 ; + DUP 6 ; DIG 2 ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; + DIG 8 ; CAR ; IF_LEFT { DROP ; - DUP 8 ; + DUP 7 ; GET 5 ; DUP ; GET 5 ; @@ -2410,20 +2599,20 @@ SWAP ; GET 3 ; INT ; + DIG 10 ; + INT ; PUSH int 1 ; SWAP ; PAIR ; - DIG 4 ; - INT ; PUSH int 1 ; - SWAP ; + DIG 2 ; PAIR ; - DUP 2 ; + DUP ; CAR ; - DUP 2 ; + DUP 3 ; CDR ; MUL ; - DIG 2 ; + SWAP ; CDR ; DUP 3 ; CAR ; @@ -2483,36 +2672,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 25 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2554,36 +2719,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 23 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2600,7 +2741,7 @@ EXEC } { SWAP ; DIG 2 ; DROP 2 } } { DROP ; - DUP 8 ; + DUP 7 ; GET 5 ; DUP ; CAR ; @@ -2608,20 +2749,20 @@ SWAP ; GET 6 ; INT ; + DIG 10 ; + INT ; PUSH int 1 ; SWAP ; PAIR ; - DIG 4 ; - INT ; PUSH int 1 ; - SWAP ; + DIG 2 ; PAIR ; - DUP 2 ; + DUP ; CAR ; - DUP 2 ; + DUP 3 ; CDR ; MUL ; - DIG 2 ; + SWAP ; CDR ; DUP 3 ; CAR ; @@ -2681,36 +2822,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 25 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2752,36 +2869,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 23 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2800,47 +2893,47 @@ DUP 3 ; DUP 3 ; CDR ; - CAR ; + CDR ; ADD ; DUP 3 ; DIG 3 ; CDR ; DIG 2 ; - UPDATE 1 ; + UPDATE 2 ; UPDATE 2 ; SWAP } - { DUP 7 ; + { DUP 5 ; GET 6 ; CAR ; - SWAP ; + DIG 7 ; CAR ; IF_LEFT { DROP ; - DUP 6 ; + DUP 5 ; SWAP ; CAR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } { DROP ; - DUP 6 ; + DUP 5 ; SWAP ; CDR ; GET ; IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; - DUP 4 ; - DUP 4 ; - CDR ; + DUP 3 ; + DUP 3 ; CDR ; + CAR ; ADD ; - DUP 4 ; - DIG 4 ; + DUP 3 ; + DIG 3 ; CDR ; DIG 2 ; + UPDATE 1 ; UPDATE 2 ; - UPDATE 2 ; + DIG 6 ; DIG 7 ; DIG 3 ; - DIG 3 ; PAIR ; PAIR ; DUP 18 ; @@ -2886,15 +2979,15 @@ IF_NONE { PUSH nat 141 ; FAILWITH } { PUSH nat 0 ; SWAP ; GET 8 ; COMPARE ; LE } ; - DIG 6 ; + DIG 5 ; DIG 3 ; PAIR ; - DIG 7 ; + DIG 6 ; DIG 2 ; IF { DIG 2 ; DROP ; - DUP 6 ; - DIG 6 ; + DUP 5 ; + DIG 5 ; CDR ; DIG 5 ; CAR ; @@ -2913,10 +3006,10 @@ SWAP ; UPDATE ; UPDATE 2 } - { DIG 4 ; DROP ; DIG 5 ; DIG 3 ; UPDATE 2 } ; + { DIG 4 ; DROP ; DIG 4 ; DIG 3 ; UPDATE 2 } ; PAIR ; DIG 2 ; - DIG 4 ; + DIG 3 ; DIG 4 ; NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; SWAP ; @@ -2925,7 +3018,8 @@ PAIR ; PAIR } ; DIG 5 ; - DROP ; + DIG 6 ; + DROP 2 ; UNPAIR ; UNPAIR ; UNPAIR ; @@ -3000,48 +3094,57 @@ PUSH mutez 0 ; DUP 4 ; CDR ; - CDR ; + CAR ; COMPARE ; GT ; IF { DUP 3 ; CAR ; - CDR ; + CAR ; CONTRACT unit ; IF_NONE { PUSH nat 102 ; FAILWITH } - { DUP 4 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + { DUP 4 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; CONS } {} ; PUSH mutez 0 ; DUP 4 ; CDR ; - CAR ; + CDR ; COMPARE ; GT ; IF { DUP 3 ; CAR ; - CAR ; + CDR ; CONTRACT unit ; IF_NONE { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 3 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; CONS } - { SWAP ; DROP } ; - DUP 3 ; - DIG 3 ; + { DIG 2 ; DROP } ; + DUP 4 ; + DIG 4 ; CDR ; DUP ; CAR ; - DUP ; - CDR ; DIG 5 ; - UPDATE 1 ; UPDATE 2 ; UPDATE 1 ; UPDATE 2 ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; SWAP } { DIG 2 ; - DROP ; + DIG 3 ; + DROP 2 ; DUP 2 ; CAR ; CAR ; @@ -3083,7 +3186,8 @@ IF_LEFT { DIG 2 ; DIG 3 ; - DROP 2 ; + DIG 4 ; + DROP 3 ; DUP 2 ; CAR ; CAR ; @@ -3103,9 +3207,8 @@ IF {} { PUSH nat 137 ; FAILWITH } ; DUP 2 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 2 ; CAR ; DUP ; @@ -3130,6 +3233,7 @@ DUP 3 ; CDR ; CDR ; + CDR ; DIG 2 ; CAR ; DUP ; @@ -3436,17 +3540,17 @@ DIG 3 ; CDR ; DUP ; - CAR ; - DUP ; CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; + DIG 3 ; UPDATE 1 ; UPDATE 2 ; + UPDATE 2 ; DUP ; CDR ; - DIG 2 ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; UPDATE 2 ; UPDATE 2 ; NIL operation ; @@ -3458,14 +3562,14 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CAR ; - CDR ; CDR ; + CAR ; DUP 2 ; GET ; IF_NONE - { DROP 4 ; PUSH nat 117 ; FAILWITH } + { DROP 5 ; PUSH nat 117 ; FAILWITH } { DUP 3 ; + CDR ; CDR ; CDR ; DUP 2 ; @@ -3523,7 +3627,6 @@ CDR ; CAR ; CAR ; - CAR ; DUP 5 ; GET ; IF_NONE @@ -3540,15 +3643,8 @@ CDR ; CAR ; INT ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CDR ; - INT ; - DUP 3 ; - DUG 2 ; - MUL ; + DUP 2 ; + SWAP ; NOW ; SUB ; COMPARE ; @@ -3593,17 +3689,17 @@ { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; INT ; PUSH int 1 ; - SWAP ; + DIG 2 ; PAIR ; PUSH int 1 ; DIG 2 ; PAIR ; - DUP ; + DUP 2 ; CAR ; - DUP 3 ; + DUP 2 ; CDR ; MUL ; - SWAP ; + DIG 2 ; CDR ; DIG 2 ; CAR ; @@ -3623,6 +3719,7 @@ DUP 3 ; CDR ; CDR ; + CDR ; DUP 2 ; CAR ; DUP 2 ; @@ -3692,26 +3789,22 @@ CDR ; CAR ; CAR ; - CAR ; DUP 4 ; DIG 4 ; CDR ; DUP ; CAR ; - DUP ; - CAR ; - DUP 5 ; - DUP 8 ; + DUP 4 ; + DUP 7 ; GET ; IF_NONE - { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } + { DIG 3 ; DUP 5 ; DIG 6 ; SWAP ; SOME ; SWAP ; UPDATE } { GET 4 ; - DUP 7 ; + DUP 6 ; GET 4 ; COMPARE ; GT ; - IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; - UPDATE 1 ; + IF { DIG 3 ; DUP 5 ; SOME ; DIG 6 ; UPDATE } { DIG 5 ; DROP ; DIG 3 } } ; UPDATE 1 ; UPDATE 1 ; UPDATE 2 ; @@ -3761,7 +3854,8 @@ (pair timestamp timestamp)) timestamp) (pair nat nat nat nat nat nat nat nat) - (pair string string)) } + (pair string string) + nat) } { DUP ; GET 3 ; IF_LEFT @@ -3781,7 +3875,8 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - SWAP ; + PUSH nat 0 ; + DIG 2 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -3791,7 +3886,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DUP 5 ; + DUP 6 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -3800,8 +3895,8 @@ (pair (pair string string) (pair int int) timestamp))) (pair (pair string string) (pair int int) timestamp)) (pair timestamp timestamp)) ; - DIG 3 ; - PAIR 4 ; + DIG 4 ; + PAIR 5 ; DUP 2 ; DUP 3 ; CDR ; @@ -3817,7 +3912,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -3874,7 +3969,7 @@ CAR ; SOME ; DUP 4 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -3888,7 +3983,7 @@ SWAP } ; SOME } ; IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DROP 4 } + { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } { DUP ; GET 3 ; IF_LEFT @@ -4084,36 +4179,12 @@ { DUP 3 } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 14 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -4131,36 +4202,12 @@ { DUP 3 } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 15 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -4178,36 +4225,12 @@ { DUP 3 } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 16 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -4394,36 +4417,12 @@ {} ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DIG 13 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -4465,7 +4464,7 @@ CAR ; SOME ; DIG 3 ; - GET 6 ; + GET 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -4475,7 +4474,7 @@ { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; UPDATE ; UPDATE 1 } - { DIG 3 ; DIG 4 ; DROP 3 } ; + { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; DUP 2 ; DIG 2 ; CAR ; @@ -4499,7 +4498,7 @@ (string %oracle_asset_name) (nat %oracle_precision) (bool %is_disabled_for_deposits))) - { CDR ; CDR ; CAR ; CDR ; CDR } ; + { CDR ; CDR ; CDR ; CAR } ; view "get_valid_tokens" unit (map string @@ -4508,7 +4507,7 @@ (option %address address) (nat %decimals) (option %standard string))) - { CDR ; CDR ; CDR } ; + { CDR ; CDR ; CDR ; CDR } ; view "get_current_batches" unit (list (pair (nat %batch_number) diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index 7b272f77..f6d2973c 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -2,14 +2,13 @@ (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) 10 {}) - (Pair (Pair {} 1) - {} - { Elt "tzBTC/EURL" - (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; - Elt "tzBTC/USDT" - (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) }) - { Elt "EURL" (Pair 0 "EURL" (Some "KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5") 6 (Some "FA2 token")) ; - Elt "USDT" (Pair 0 "USDT" (Some "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm") 6 (Some "FA2 token")) ; + (Pair {} {}) + { Elt "tzBTC/EURL" + (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; + Elt "tzBTC/USDT" + (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) } + { Elt "EURL" (Pair 0 "EURL" (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") 6 (Some "FA2 token")) ; + Elt "USDT" (Pair 0 "USDT" (Some "KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR") 6 (Some "FA2 token")) ; Elt "tzBTC" (Pair 0 "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) }) diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 17897e5d..e47713ad 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -45,6 +45,7 @@ [@inline] let cannot_decrease_holdings_of_removed_batch : nat = 141n [@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n [@inline] let batch_already_removed : nat = 143n +[@inline] let admin_and_fee_recipient_address_cannot_be_the_same = 144n (* Constants *) @@ -290,10 +291,10 @@ type valid_swaps = (string, valid_swap_reduced) map type rates_current = (string, exchange_rate) big_map type fees = { - to_burn: tez; + to_send: tez; to_refund: tez; payer: address; - burner: address; + recipient: address; } @@ -414,8 +415,6 @@ module Storage = struct administrator : address; limit_on_tokens_or_pairs : nat; deposit_time_window_in_seconds : nat; - scale_factor_for_oracle_staleness: nat - } end @@ -954,8 +953,8 @@ let collect_order_payout_from_clearing ((c, tam, vols, tokens, fees, fee_in_mutez), (ot, amt): (clearing * token_amount_map * volumes * valid_tokens * fees * tez) * (ordertype * nat)) : (clearing * token_amount_map * volumes * valid_tokens * fees * tez) = let (u_tam, u_fees) = if was_in_clearing vols ot c then let tm = get_cleared_payout ot amt c tam tokens in - let f = fees.to_burn + fee_in_mutez in - let uf = { fees with to_burn = f; } in + let f = fees.to_send + fee_in_mutez in + let uf = { fees with to_send = f; } in (tm, uf) else let ta: token_amount = TokenAmount.recover ot amt c tokens in @@ -1173,8 +1172,8 @@ let resolve_fees else token_ops in - if fees.to_burn > 0mutez then - Treasury_Utils.transfer_fee fees.burner fees.to_burn :: token_ops + if fees.to_send > 0mutez then + Treasury_Utils.transfer_fee fees.recipient fees.to_send :: token_ops else token_ops @@ -1193,10 +1192,10 @@ let redeem (storage : storage) : operation list * storage = let treasury_vault = get_treasury_vault () in let fees = { - to_burn = 0mutez; + to_send = 0mutez; to_refund = 0mutez; payer = redeem_address; - burner = storage.fee_recipient; + recipient = storage.fee_recipient; } in let fees, updated_ubots, updated_batch_set, payout_token_map = Ubots.collect_redemption_payouts redeem_address fees storage in let operations = Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in @@ -1628,11 +1627,9 @@ let get_clearing_rate (exchange_rate: exchange_rate) : exchange_rate = match clearing.clearing_tolerance with | Exact -> exchange_rate - | Plus -> let val : Rational.t = exchange_rate.rate in - let rate = (Rational.mul val ten_bips_constant) in + | Plus -> let rate = Rational.mul (exchange_rate.rate) ten_bips_constant in { exchange_rate with rate = rate} - | Minus -> let val = exchange_rate.rate in - let rate = (Rational.div val ten_bips_constant) in + | Minus -> let rate = Rational.div (exchange_rate.rate) ten_bips_constant in { exchange_rate with rate = rate} [@inline] @@ -1706,7 +1703,7 @@ let compute_clearing_prices end type storage = Storage.t -type result = (operation list) * storage +type result = operation list * storage [@inline] let no_op (s : storage) : result = (([] : operation list), s) @@ -1718,6 +1715,7 @@ type entrypoint = | Cancel of pair | Change_fee of tez | Change_admin_address of address + | Change_fee_recipient_address of address | Add_token_swap_pair of valid_swap | Remove_token_swap_pair of valid_swap | Amend_token_and_pair_limit of nat @@ -1727,7 +1725,6 @@ type entrypoint = | Disable_swap_pair_for_deposit of string | Change_oracle_source_of_pair of oracle_source_change | Change_deposit_time_window of nat - | Change_scale_factor of nat [@inline] let get_oracle_price @@ -1746,6 +1743,11 @@ let is_administrator (storage : storage) : unit = if Tezos.get_sender () = storage.administrator then () else failwith sender_not_administrator +[@inline] +let admin_and_fee_recipient_address_are_different + (admin : address) + (fee_recipient : address ): unit = + if admin = fee_recipient then failwith admin_and_fee_recipient_address_cannot_be_the_same else () [@inline] @@ -1798,7 +1800,8 @@ let remove_orders_from_batch (ots: ordertypes) (batch: batch): batch = let volumes = Batch_Utils.reduce_volumes ots batch.volumes in - { batch with volumes = volumes} + let holdings = abs (batch.holdings - 1n) in + { batch with volumes = volumes; holdings= holdings; } [@inline] let remove_orders @@ -1860,8 +1863,7 @@ let cancel_order let ubots = storage.user_batch_ordertypes in let current_time = Tezos.get_now () in let (batch, batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in - let () = if not (Batch_Utils.is_batch_open batch) then - failwith cannot_cancel_orders_for_a_batch_that_is_not_open + let () = if not (Batch_Utils.is_batch_open batch) then failwith cannot_cancel_orders_for_a_batch_that_is_not_open in match Big_map.find_opt holder ubots with | None -> failwith no_orders_for_user_address | Some bot -> let orders_to_remove, storage = remove_order_types batch.batch_number holder bot storage in @@ -1884,11 +1886,9 @@ let cancel [@inline] let oracle_price_is_not_stale (deposit_time_window: nat) - (scale_factor_for_oracle_staleness: nat) (oracle_price_timestamp: timestamp) : unit = let dtw_i = int deposit_time_window in - let sffos_i = int scale_factor_for_oracle_staleness in - if (Tezos.get_now () - (sffos_i * dtw_i)) < oracle_price_timestamp then () else failwith oracle_price_is_stale + if (Tezos.get_now () - dtw_i) < oracle_price_timestamp then () else failwith oracle_price_is_stale [@inline] let is_oracle_price_newer_than_current @@ -1910,7 +1910,7 @@ let confirm_oracle_price_is_available_before_deposit let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap_reduced = get_valid_swap_reduced pair_name storage in let (lastupdated, _price) = get_oracle_price oracle_price_should_be_available_before_deposit valid_swap_reduced in - oracle_price_is_not_stale storage.deposit_time_window_in_seconds storage.scale_factor_for_oracle_staleness lastupdated + oracle_price_is_not_stale storage.deposit_time_window_in_seconds lastupdated [@inline] let confirm_swap_pair_is_disabled_prior_to_removal @@ -2013,7 +2013,7 @@ let tick_price let valid_swap_reduced = Utils.valid_swap_to_valid_swap_reduced valid_swap in let (lastupdated, price) = get_oracle_price unable_to_get_price_from_oracle valid_swap_reduced in let () = is_oracle_price_newer_than_current rate_name lastupdated storage in - let () = oracle_price_is_not_stale storage.deposit_time_window_in_seconds storage.scale_factor_for_oracle_staleness lastupdated in + let () = oracle_price_is_not_stale storage.deposit_time_window_in_seconds lastupdated in let oracle_rate = convert_oracle_price valid_swap.oracle_precision valid_swap.swap lastupdated price storage.valid_tokens in let storage = Utils.update_current_rate (rate_name) (oracle_rate) (storage) in let pair = Utils.pair_of_rate oracle_rate in @@ -2053,9 +2053,20 @@ let change_admin_address (storage: storage) : result = let () = is_administrator storage in let () = reject_if_tez_supplied () in + let () = admin_and_fee_recipient_address_are_different new_admin_address storage.fee_recipient in let storage = { storage with administrator = new_admin_address; } in no_op storage +[@inline] +let change_fee_recipient_address + (new_fee_recipient_address: address) + (storage: storage) : result = + let () = is_administrator storage in + let () = reject_if_tez_supplied () in + let () = admin_and_fee_recipient_address_are_different new_fee_recipient_address storage.administrator in + let storage = { storage with fee_recipient = new_fee_recipient_address; } in + no_op storage + [@inline] let add_token_swap_pair (valid_swap: valid_swap) @@ -2140,17 +2151,6 @@ let change_deposit_time_window let storage = { storage with deposit_time_window_in_seconds = new_window; } in no_op storage -[@inline] -let change_scale_factor_for_oracle_staleness - (new_factor: nat) - (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in - if new_factor < minimum_scale_factor_for_oracle_staleness then failwith cannot_update_scale_factor_to_less_than_the_minimum else - if new_factor > maximum_scale_factor_for_oracle_staleness then failwith cannot_update_scale_factor_to_more_than_the_maximum else - let storage = { storage with scale_factor_for_oracle_staleness = new_factor; } in - no_op storage - [@view] let get_fee_in_mutez ((), storage : unit * storage) : tez = storage.fee_in_mutez @@ -2171,7 +2171,7 @@ let get_current_batches ((),storage: unit * storage) : batch list= let main - (action, storage : entrypoint * storage) : result = + (action, storage : entrypoint * storage) : operation list * storage = match action with (* User endpoints *) | Deposit order -> deposit order storage @@ -2182,6 +2182,7 @@ let main (* Admin endpoints *) | Change_fee new_fee -> change_fee new_fee storage | Change_admin_address new_admin_address -> change_admin_address new_admin_address storage + | Change_fee_recipient_address new_fee_recipient_address -> change_fee_recipient_address new_fee_recipient_address storage | Add_token_swap_pair valid_swap -> add_token_swap_pair valid_swap storage | Remove_token_swap_pair valid_swap -> remove_token_swap_pair valid_swap storage | Change_oracle_source_of_pair source_update -> change_oracle_price_source source_update storage @@ -2191,6 +2192,5 @@ let main | Enable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name false storage | Disable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name true storage | Change_deposit_time_window t -> change_deposit_time_window t storage - | Change_scale_factor f -> change_scale_factor_for_oracle_staleness f storage diff --git a/batcher/package.json b/batcher/package.json index a425b0e2..c76b11ad 100644 --- a/batcher/package.json +++ b/batcher/package.json @@ -5,6 +5,6 @@ "description": "Batcher for exchanging tokens", "dependencies": { "@ligo/math-lib": "^1.0.0", - "ligo-breathalyzer": "^1.3.0" + "ligo-breathalyzer": "^1.4.0" } -} \ No newline at end of file +} diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index 28e33428..aabc7b4a 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -61,7 +61,6 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - scale_factor_for_oracle_staleness = 1n } diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index 1085b217..e88abcf5 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -61,7 +61,6 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - scale_factor_for_oracle_staleness = 1n } diff --git a/batcher/test/common/batch.mligo b/batcher/test/common/batch.mligo new file mode 100644 index 00000000..efd55a8b --- /dev/null +++ b/batcher/test/common/batch.mligo @@ -0,0 +1,251 @@ +#import "../../batcher.mligo" "Batcher" +type pressure = Buy | Sell +type skew = +NoSkew +| Balanced +| Negative +| Positive +| LargePositive +| LargeNegative +| PositiveAllBetter +| NegativeAllBetter +| PositiveAllWorse +| NegativeAllWorse + +type tolerance = Batcher.tolerance +type batch = Batcher.batch +type status = Batcher.batch_status + + +type side_test_volumes = { + minus: nat; + exact: nat; + plus: nat; +} + +type clearing_test_case = { + buy_minus: nat; + buy_exact: nat; + buy_plus: nat; + sell_minus: nat; + sell_exact: nat; + sell_plus: nat; + expected: tolerance; +} + +let buy_pressure_cases: (skew,clearing_test_case) map = Map.literal [ +(NoSkew, { + buy_minus = 1000000n; + buy_exact = 2000000n; + buy_plus = 3000000n; + sell_minus = 0n; + sell_exact = 0n; + sell_plus = 0n; + expected = Minus; + }); +(Balanced, { + buy_minus = 1000000n; + buy_exact = 1000000n; + buy_plus = 1000000n; + sell_minus = 200000000n; + sell_exact = 200000000n; + sell_plus = 200000000n; + expected = Exact; + }); +(Negative, { + buy_minus = 3000000n; + buy_exact = 2000000n; + buy_plus = 1000000n; + sell_minus = 200000000n; + sell_exact = 400000000n; + sell_plus = 600000000n; + expected = Exact; + }); +(Positive, { + buy_minus = 1000000n; + buy_exact = 2000000n; + buy_plus = 3000000n; + sell_minus = 200000000n; + sell_exact = 400000000n; + sell_plus = 600000000n; + expected = Exact; + }); +(LargeNegative, { + buy_minus = 5000000n; + buy_exact = 2000000n; + buy_plus = 1000000n; + sell_minus = 200000000n; + sell_exact = 400000000n; + sell_plus = 1000000000n; + expected = Exact; + }); +(LargePositive, { + buy_minus = 1000000n; + buy_exact = 2000000n; + buy_plus = 5000000n; + sell_minus = 1000000000n; + sell_exact = 400000000n; + sell_plus = 200000000n; + expected = Exact; + }); +(NegativeAllWorse, { + buy_minus = 1000000n; + buy_exact = 0n; + buy_plus = 0n; + sell_minus = 200000000n; + sell_exact = 0n; + sell_plus = 0n; + expected = Minus; + }); +(NegativeAllBetter, { + buy_minus = 0n; + buy_exact = 0n; + buy_plus = 1000000n; + sell_minus = 0n; + sell_exact = 0n; + sell_plus = 1000000000n; + expected = Plus; + }) + ] + +let sell_pressure_cases: (skew,clearing_test_case) map = Map.literal [ +(NoSkew,{ + buy_minus = 0n; + buy_exact = 0n; + buy_plus = 0n; + sell_minus = 200000000n; + sell_exact = 400000000n; + sell_plus = 600000000n; + expected = Minus; + }); +(Balanced, { + buy_minus = 1000000n; + buy_exact = 1000000n; + buy_plus = 1000000n; + sell_minus = 500000000n; + sell_exact = 500000000n; + sell_plus = 500000000n; + expected = Exact; + }); +(Negative, { + buy_minus = 3000000n; + buy_exact = 2000000n; + buy_plus = 1000000n; + sell_minus = 500000000n; + sell_exact = 1000000000n; + sell_plus = 1500000000n; + expected = Exact; + }); +(Positive, { + buy_minus = 1000000n; + buy_exact = 2000000n; + buy_plus = 3000000n; + sell_minus = 1500000000n; + sell_exact = 1000000000n; + sell_plus = 500000000n; + expected = Exact; + }); +(LargeNegative, { + buy_minus = 5000000n; + buy_exact = 2000000n; + buy_plus = 1000000n; + sell_minus = 500000000n; + sell_exact = 1000000000n; + sell_plus = 3000000000n; + expected = Plus; + }); +(LargePositive, { + buy_minus = 1000000n; + buy_exact = 2000000n; + buy_plus = 5000000n; + sell_minus = 500000000n; + sell_exact = 1000000000n; + sell_plus = 3000000000n; + expected = Plus; + }); +(PositiveAllWorse, { + buy_minus = 1000000n; + buy_exact = 0n; + buy_plus = 0n; + sell_minus = 1000000000n; + sell_exact = 0n; + sell_plus = 0n; + expected = Minus; + }); +(PositiveAllBetter, { + buy_minus = 0n; + buy_exact = 0n; + buy_plus = 5000000n; + sell_minus = 0n; + sell_exact = 0n; + sell_plus = 1000000000n; + expected = Plus; + }) + ] + +let empty_volumes: Batcher.volumes = { + buy_minus_volume = 0n; + buy_exact_volume = 0n; + buy_plus_volume = 0n; + buy_total_volume = 0n; + sell_minus_volume = 0n; + sell_exact_volume = 0n; + sell_plus_volume = 0n; + sell_total_volume = 0n; + } + +let add_volumes_to_batch + (buy_minus_volume : nat) + (buy_exact_volume : nat) + (buy_plus_volume : nat) + (sell_minus_volume : nat) + (sell_exact_volume : nat) + (sell_plus_volume : nat) + (batch: batch) : batch = + let volumes = { + buy_plus_volume = buy_plus_volume; + buy_exact_volume = buy_exact_volume; + buy_minus_volume = buy_minus_volume; + buy_total_volume = buy_exact_volume + buy_minus_volume + buy_plus_volume; + sell_minus_volume = sell_minus_volume; + sell_plus_volume = sell_plus_volume; + sell_exact_volume = sell_plus_volume; + sell_total_volume = sell_exact_volume + sell_minus_volume + sell_plus_volume; + } in + { batch with volumes = volumes; } + + +let prepare_batch_with_status + (pair: string * string) + (pressure:pressure) + (skew:skew) + (status: status): (tolerance * batch) = + let batch = { + batch_number = 1n; + status = status; + volumes = empty_volumes; + pair = pair; + holdings = 0n; + } in + let test_cases = if pressure = Buy then + buy_pressure_cases + else + sell_pressure_cases + in + let test_case = Option.unopt (Map.find_opt skew test_cases) in + let batch = add_volumes_to_batch test_case.buy_minus test_case.buy_exact test_case.buy_plus test_case.sell_minus test_case.sell_exact test_case.sell_plus batch in + (test_case.expected, batch) + +let prepare_open_batch + (pair: string * string) + (pressure:pressure) + (skew:skew) : (tolerance * batch) = + let status = Open { start_time = Tezos.get_now () - 1000 } in + prepare_batch_with_status pair pressure skew status + +let prepare_closed_batch + (pair: string * string) + (pressure:pressure) + (skew:skew) : (tolerance * batch) = + let status = Closed { start_time = Tezos.get_now () - 1000 ; closing_time = Tezos.get_now () - 200 } in + prepare_batch_with_status pair pressure skew status diff --git a/batcher/test/common/helpers.mligo b/batcher/test/common/helpers.mligo new file mode 100644 index 00000000..36baea98 --- /dev/null +++ b/batcher/test/common/helpers.mligo @@ -0,0 +1,269 @@ +#import "../../batcher.mligo" "Batcher" +#import "../tokens/fa12/main.mligo" "TZBTC" +#import "../tokens/fa2/main.mligo" "USDT" +#import "../tokens/fa2/main.mligo" "EURL" +#import "../mocks/oracle.mligo" "Oracle" +#import "./storage.mligo" "TestStorage" +#import "./utils.mligo" "TestUtils" +#import "./batch.mligo" "TestBatch" +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "@ligo/math-lib/rational/rational.mligo" "Rational" + +type originated = Breath.Contract.originated +type originated_contract = (Batcher.entrypoint, Batcher.storage) originated + +type swap = Batcher.swap +type side = Batcher.side +type storage = Batcher.Storage.t +type tolerance = Batcher.tolerance +type valid_tokens = Batcher.valid_tokens +type level = Breath.Logger.level + +type test_contracts = { + batcher: (Batcher.entrypoint, Batcher.storage) originated; + oracle: (Oracle.entrypoint, Oracle.storage) originated; + additional_oracle: (Oracle.entrypoint, Oracle.storage) originated; + tzbtc: (TZBTC.parameter, TZBTC.storage) originated; + usdt: (USDT.parameter, USDT.storage) originated; + eurl: (EURL.parameter, EURL.storage) originated; +} + +type context = { + btc_trader: Breath.Context.actor; + usdt_trader: Breath.Context.actor; + eurl_trader: Breath.Context.actor; + admin: Breath.Context.actor; + non_admin: Breath.Context.actor; + fee_recipient: address; + contracts: test_contracts; +} +let originate_module + (type a b) + (level: level) + (name: string) + (contract: (a, b) module_contract) + (storage: b) + (quantity: tez) : (a, b) originated = + let typed_address, _, _ = Test.originate_module contract storage quantity in + let contract = Test.to_contract typed_address in + let address = Tezos.address contract in + + let () = + Breath.Logger.log level ("originated smart contract", name, address, storage, quantity) + in + { originated_typed_address = typed_address + ; originated_contract = contract + ; originated_address = address } + +let originate_oracle + (level: Breath.Logger.level) = + let storage = TestStorage.oracle_initial_storage in + TestUtils.originate_oracle storage level + +let originate_tzbtc + (trader: Breath.Context.actor) + (level: Breath.Logger.level) = + let storage = TestStorage.tzbtc_initial_storage trader in + TestUtils.originate_tzbtc storage level + +let originate_usdt + (trader: Breath.Context.actor) + (level: Breath.Logger.level) = + let storage = TestStorage.fa2_initial_storage trader in + TestUtils.originate_usdt storage level + +let originate_eurl + (trader: Breath.Context.actor) + (level: Breath.Logger.level) = + let storage = TestStorage.fa2_initial_storage trader in + TestUtils.originate_eurl storage level + +let originate + (level: Breath.Logger.level) + (tzbtc_trader: Breath.Context.actor) + (usdt_trader: Breath.Context.actor) + (eurl_trader: Breath.Context.actor) = + let oracle = originate_oracle level in + let additional_oracle = originate_oracle level in + let tzbtc = originate_tzbtc tzbtc_trader level in + let usdt = originate_usdt usdt_trader level in + let eurl = originate_eurl eurl_trader level in + let initial_storage = TestStorage.initial_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address in + let batcher = TestUtils.originate initial_storage level in + { + batcher = batcher; + oracle = oracle; + additional_oracle = additional_oracle; + tzbtc = tzbtc; + usdt = usdt; + eurl = eurl; + } + +let originate_with_admin_and_fee_recipient + (level: Breath.Logger.level) + (tzbtc_trader: Breath.Context.actor) + (usdt_trader: Breath.Context.actor) + (eurl_trader: Breath.Context.actor) + (admin: Breath.Context.actor) + (fee_recipient: address) = + let oracle = originate_oracle level in + let additional_oracle = originate_oracle level in + let tzbtc = originate_tzbtc tzbtc_trader level in + let usdt = originate_usdt usdt_trader level in + let eurl = originate_eurl eurl_trader level in + let initial_storage = TestStorage.initial_storage_with_admin_and_fee_recipient oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address admin.address fee_recipient in + let batcher = TestUtils.originate initial_storage level in + { + batcher = batcher; + oracle = oracle; + additional_oracle = additional_oracle; + tzbtc = tzbtc; + usdt = usdt; + eurl = eurl; + } + +let originate_with_batch_for_clearing + (level: Breath.Logger.level) + (tzbtc_trader: Breath.Context.actor) + (usdt_trader: Breath.Context.actor) + (eurl_trader: Breath.Context.actor) + (batch: Batcher.batch) + (pair: string) = + let oracle = originate_oracle level in + let additional_oracle = originate_oracle level in + let tzbtc = originate_tzbtc tzbtc_trader level in + let usdt = originate_usdt usdt_trader level in + let eurl = originate_eurl eurl_trader level in + let initial_storage = TestStorage.initial_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address in + let batch_set = initial_storage.batch_set in + let cbi = Map.add pair 1n batch_set.current_batch_indices in + let batches = Big_map.add 1n batch batch_set.batches in + let batch_set = { batch_set with + current_batch_indices = cbi; + batches = batches + } in + let initial_storage = { initial_storage with batch_set = batch_set; } + in + let batcher = TestUtils.originate initial_storage level in + { + batcher = batcher; + oracle = oracle; + additional_oracle = additional_oracle; + tzbtc = tzbtc; + usdt = usdt; + eurl = eurl; + } + +let test_context + (level: Breath.Logger.level) = + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let fee_recipient_address = usdt_trader.address in + let contracts = originate_with_admin_and_fee_recipient level btc_trader usdt_trader eurl_trader eurl_trader fee_recipient_address in + { + btc_trader = btc_trader; + usdt_trader = usdt_trader; + eurl_trader = eurl_trader; + admin = eurl_trader; + non_admin = btc_trader; + fee_recipient = fee_recipient_address; + contracts = contracts; + } + +let test_context_with_batch + (pair: string) + (batch: Batcher.batch) + (level: Breath.Logger.level) = + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let fee_recipient_address = usdt_trader.address in + let contracts = originate_with_batch_for_clearing level btc_trader usdt_trader eurl_trader batch pair in + { + btc_trader = btc_trader; + usdt_trader = usdt_trader; + eurl_trader = eurl_trader; + admin = eurl_trader; + non_admin = btc_trader; + fee_recipient = fee_recipient_address; + contracts = contracts; + } + +let create_order + (from: string) + (to: string) + (amount: nat) + (side: Batcher.side) + (tolerance: Batcher.tolerance) + (valid_tokens: Batcher.valid_tokens) : Batcher.external_swap_order = + let fromToken = Map.find from valid_tokens in + let toToken = Map.find to valid_tokens in + let nside = TestUtils.side_to_nat side in + let swap = { + from = { + token = fromToken; + amount = amount; + }; + to = toToken; + } in + let ntol = TestUtils.tolerance_to_nat tolerance in + { + swap = swap; + created_at = Tezos.get_now (); + side = nside ; + tolerance = ntol; + } + + + +let place_order + (actor: Breath.Context.actor) + (contract: originated_contract) + (fee: tez) + (from: string) + (to: string) + (amount: nat) + (side: Batcher.side) + (tolerance: Batcher.tolerance) + (valid_tokens: valid_tokens) = + let order = create_order from to amount side tolerance valid_tokens in + Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (Deposit order) fee)) + + +let expect_last_order_number + (storage: storage) + (last_order_number: nat) = TestStorage.expect_from_storage "last_order_number" storage (fun s -> s.last_order_number) last_order_number + +let expect_rate_value + (storage: storage) + (rate_name: string) + (rate: Rational.t) = + match Big_map.find_opt rate_name storage.rates_current with + | None -> Breath.Assert.fail_with "Could not find rate in storage" + | Some r -> Breath.Assert.is_equal "rate value" r.rate rate + +let get_swap_pair + (contract: originated_contract) + (pair: string): Batcher.valid_swap_reduced option = + let storage = Breath.Contract.storage_of contract in + let valid_swaps = storage.valid_swaps in + match Map.find_opt pair valid_swaps with + | Some p -> Some p + | None -> None + +let get_source_update + (pair: string) + (valid_swap: Batcher.valid_swap_reduced) + (new_oracle_address: address) : Batcher.oracle_source_change = + { + pair_name = pair; + oracle_address = new_oracle_address; + oracle_asset_name = valid_swap.oracle_asset_name; + oracle_precision = valid_swap.oracle_precision; + } + + +let get_current_batch + (pair: string) + (storage: Batcher.Storage.t): Batcher.batch option = + let batch_set = storage.batch_set in + match Map.find_opt pair batch_set.current_batch_indices with + | Some i -> Big_map.find_opt i batch_set.batches + | None -> None diff --git a/batcher/test/common/storage.mligo b/batcher/test/common/storage.mligo new file mode 100644 index 00000000..daee903f --- /dev/null +++ b/batcher/test/common/storage.mligo @@ -0,0 +1,143 @@ +#import "../../batcher.mligo" "Batcher" +#import "../tokens/fa12/main.mligo" "TZBTC" +#import "../tokens/fa2/main.mligo" "USDT" +#import "../tokens/fa2/main.mligo" "EURL" +#import "../mocks/oracle.mligo" "Oracle" +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "@ligo/math-lib/rational/rational.mligo" "Rational" + +type level = Breath.Logger.level +type storage = Batcher.Storage.t + +let fee_recipient = ("tz1burnburnburnburnburnburnburjAYjjX" : address) +let administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address) + +let tzbtc_initial_storage + (trader: Breath.Context.actor) = + let trader_address = trader.address in + { + tokens = Big_map.literal [ + ((trader_address), 100000000000n) + ]; + allowances = (Big_map.empty : (TZBTC.allowance_key, nat) big_map); + token_metadata = Big_map.literal [ + (0n, { + token_id = 0n; + token_info = Map.literal [ + ("", ("68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f676c6f74746f6c6f676973742f65653736383665633638376339336131656666653331666362306131343734362f7261772f303232666332646462653534346631363466343431356266633139613131663135376630303562332f545a4254432e6a736f6e" : bytes)) + ] + }) + ]; + total_supply = 10000000000000n; +} + +let fa2_initial_storage + (trader: Breath.Context.actor) = + let trader_address = trader.address in + { + ledger = Big_map.literal [ + ((trader_address, 0n), 10000000000000n) + ]; + token_metadata = Big_map.literal [ + (0n, { + token_id = 0n; + token_info = Map.literal [ + ("", ("68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f676c6f74746f6c6f676973742f63633262366133396336663436313361393039623932356365653163353435362f7261772f343465373561386162633431623361336264636366323162663666373862393461313238653631312f555344542e6a736f6e" : bytes)) + ] + }) + ]; + operators = (Big_map.empty : ((address * address), nat set) big_map) +} + +let initial_storage_with_admin_and_fee_recipient + (oracle_address: address) + (tzbtc_address: address) + (usdt_address:address) + (eurl_address:address) + (admin: address) + (fee_recipient: address): storage = { + metadata = (Big_map.empty : Batcher.metadata); + valid_tokens = Map.literal [ + (("tzBTC"), { + token_id = 0n; + name = "tzBTC"; + address = Some(tzbtc_address); + decimals = 8n; + standard = Some "FA1.2 token" + }); + (("EURL"),{ + token_id = 0n; + name = "EURL"; + address = Some(eurl_address); + decimals = 6n; + standard = Some "FA2 token" + }); + (("USDT"),{ + token_id = 0n; + name = "USDT"; + address = Some(usdt_address); + decimals = 6n; + standard = Some "FA2 token" + }) + ]; + valid_swaps = Map.literal [ + ("tzBTC/USDT", { + swap = { + from = "tzBTC"; + to = "USDT"; + }; + oracle_address = oracle_address ; + oracle_asset_name = "BTC-USDT"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ) + ]; + rates_current = (Big_map.empty : Batcher.rates_current); + batch_set = { + current_batch_indices = (Map.empty : (string,nat) map); + batches = (Big_map.empty : (nat,Batcher.batch) big_map); + }; + last_order_number = 0n; + user_batch_ordertypes = (Big_map.empty: Batcher.user_batch_ordertypes); + fee_in_mutez = 10_000mutez; + fee_recipient = fee_recipient; + administrator = admin; + limit_on_tokens_or_pairs = 10n; + deposit_time_window_in_seconds = 600n; +} + + + + +let initial_storage + (oracle_address: address) + (tzbtc_address: address) + (usdt_address:address) + (eurl_address:address) : storage = + initial_storage_with_admin_and_fee_recipient oracle_address tzbtc_address usdt_address eurl_address administrator fee_recipient + +let oracle_initial_storage = + Map.literal [ + (("BTC-USDT"), + { + name = "BTC-USDT"; + value = 30000000000n; + timestamp = Tezos.get_now () + } + ); + (("BTC-EUR"), + { + name = "BTC-EUR"; + value = 30000000000n; + timestamp = Tezos.get_now () + } + )] + +let expect_from_storage + (type a) + (name: string) + (storage: storage) + (selector: storage -> a) + (expected_value: a) = Breath.Assert.is_equal name (selector storage) expected_value + diff --git a/batcher/test/common/utils.mligo b/batcher/test/common/utils.mligo new file mode 100644 index 00000000..aaf3b93b --- /dev/null +++ b/batcher/test/common/utils.mligo @@ -0,0 +1,127 @@ +#import "../../batcher.mligo" "Batcher" +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "@ligo/math-lib/rational/rational.mligo" "Rational" +#import "../tokens/fa12/main.mligo" "TZBTC" +#import "../tokens/fa2/main.mligo" "USDT" +#import "../tokens/fa2/main.mligo" "EURL" +#import "../mocks/oracle.mligo" "Oracle" +#import "./storage.mligo" "TestStorage" + +type level = Breath.Logger.level +let log = Breath.Logger.log +type storage = Batcher.Storage.t +type originated = Breath.Contract.originated +type valid_swap = Batcher.valid_swap +type external_order = Batcher.external_swap_order +type side = Batcher.side +type tolerance = Batcher.tolerance +type oracle_storage = Oracle.storage +type tzbtc_storage = TZBTC.storage +type usdt_storage = USDT.storage +type eurl_storage = EURL.storage + + + +let side_to_nat +(order_side : side) : nat = + if order_side = Buy then 0n + else + 1n + +let tolerance_to_nat (tolerance : tolerance) : nat = + if tolerance = Minus then 0n + else if tolerance = Exact then 1n + else 2n + +let originate +(storage: storage) +(level: level) = + let () = log level storage in + Breath.Contract.originate_uncurried + level + "batcher" + (Batcher.main) + (storage) + (0tez) + +let originate_oracle +(storage: oracle_storage) +(level: level) = + let () = log level storage in + Breath.Contract.originate_module + level + "oracle" + (contract_of Oracle) + (storage) + (0tez) + +let originate_tzbtc + (storage: tzbtc_storage) + (level: level) = + let () = log level storage in + Breath.Contract.originate_uncurried + level + "tzbtc" + TZBTC.main + (storage) + (0tez) + +let originate_usdt + (storage: usdt_storage) + (level: level) = + let () = log level storage in + Breath.Contract.originate_uncurried + level + "usdt" + USDT.main + (storage) + (0tez) + +let originate_eurl + (storage: eurl_storage) + (level: level) = + let () = log level storage in + Breath.Contract.originate_uncurried + level + "eurl" + EURL.main + (storage) + (0tez) + +let update_rate + (pair_name: string) + (from: string) + (to: string) + (num: nat) + (denom: nat) + (rates : Batcher.rates_current): Batcher.rates_current = + let r_num = Rational.new (int num) in + let r_denom = Rational.new (int denom) in + let rate = Rational.div r_num r_denom in + let swap = { + from = from; + to = to; + } in + let ex_rate = { + swap = swap; + rate = rate; + when = Tezos.get_now () + } in + Big_map.update pair_name (Some ex_rate) rates + + + +let expecte_fail_with_value (type a) (value: a) (result: Breath.Result.result) : Breath.Result.result = + match result with + | Failed [Execution (Rejected (mp, _))] -> + let value_mp = Test.compile_value value in + if Test.michelson_equal mp value_mp then Breath.Result.succeed + else + let full_value = + "Expected failure: `" + ^ (Test.to_string value) ^ "` but: `" + ^ (Test.to_string mp) + ^ "` given" + in + Breath.Result.fail_with full_value + | _ -> Breath.Result.fail_with ("Expected failure: `" ^ (Test.to_string value) ^ "`") diff --git a/batcher/test/economics/test_clearing.mligo b/batcher/test/economics/test_clearing.mligo new file mode 100644 index 00000000..91c25834 --- /dev/null +++ b/batcher/test/economics/test_clearing.mligo @@ -0,0 +1,61 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../common/utils.mligo" "Utils" +#import "./../common/batch.mligo" "Batch" +#import "../../batcher.mligo" "Batcher" +#import "./../common/helpers.mligo" "Helpers" + + +type batch = Batcher.batch +type tolerance = Batcher.tolerance +type skew = Batch.skew +type pressure = Batch.pressure + + +let clearing_test + (description) + (pressure:pressure) + (skew:skew) = + Breath.Model.case + "test clearing" + description + (fun (level: Breath.Logger.level) -> + let pair = ("tzBTC","USDT") in + let tick_pair = "tzBTC/USDT" in + let (expected_tolerance, batch) = Batch.prepare_closed_batch pair pressure skew in + let context = Helpers.test_context_with_batch tick_pair batch level in + let batcher = context.contracts.batcher in + + let act_tick = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Tick tick_pair) 0tez)) in + + let new_storage = Breath.Contract.storage_of batcher in + + let updated_batch = Option.unopt(Big_map.find_opt 1n new_storage.batch_set.batches) in + let () = Breath.Logger.log level updated_batch in + let clearing = Option.unopt (Batcher.Ubots.get_clearing updated_batch) in + + Breath.Result.reduce [ + act_tick + ; Breath.Assert.is_equal "expected cleaing tolerance" expected_tolerance clearing.clearing_tolerance + ]) + +let test_suite = + Breath.Model.suite "Suite for Clearing" [ + clearing_test "Buy Pressure - No Skew" Buy NoSkew + ; clearing_test "Buy Pressure - No Skew" Sell NoSkew + ; clearing_test "Buy Pressure - Balanced" Buy Balanced + ; clearing_test "Sell Pressure - Balanced" Sell Balanced + ; clearing_test "Buy Pressure - Positive Skew" Buy Positive + ; clearing_test "Buy Pressure - Negative Skew " Buy Negative + ; clearing_test "Sell Pressure - Positive Skew" Sell Positive + ; clearing_test "Sell Pressure - Negative Skew" Sell Negative + ; clearing_test "Buy Pressure - Large Positive Skew" Buy LargePositive + ; clearing_test "Buy Pressure - Large Negative Skew " Buy LargeNegative + ; clearing_test "Sell Pressure - Large Negative Skew " Sell LargeNegative + ; clearing_test "Sell Pressure - Large Positive Skew" Sell LargePositive + ; clearing_test "Buy Pressure - Negative Skew - All Worse Prices" Buy NegativeAllWorse + ; clearing_test "Buy Pressure - Negative Skew - All Better Prices" Buy NegativeAllBetter + ; clearing_test "Sell Pressure - Positive Skew - All Worse Prices" Sell PositiveAllWorse + ; clearing_test "Sell Pressure - Positive Skew - All Better Prices" Sell PositiveAllBetter + ] + + diff --git a/batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo b/batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo new file mode 100644 index 00000000..fb94dd0b --- /dev/null +++ b/batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo @@ -0,0 +1,240 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + +let get_tzbtc_eurl_swap_pair + (disabled: bool) + (oracle: address) + (storage: Batcher.Storage.t): (Batcher.valid_swap * Batcher.valid_swap_reduced) = + let valid_tokens = storage.valid_tokens in + let tzbtc = Option.unopt (Map.find_opt "tzBTC" valid_tokens) in + let eurl = Option.unopt (Map.find_opt "EURL" valid_tokens) in + let swap : Batcher.swap = { + from = { + token = tzbtc; + amount = 1n; + }; + to = eurl; + } in + let swap_reduced : Batcher.swap_reduced = { + to = eurl.name; + from = tzbtc.name; + } in + let valid_swap: Batcher.valid_swap = + { + swap = swap; + oracle_address = oracle; + oracle_asset_name = "BTC-EURL"; + oracle_precision = 6n; + is_disabled_for_deposits = disabled; + } in + let valid_swap_reduced = + { + swap = swap_reduced; + oracle_address = oracle; + oracle_asset_name = "BTC-EURL"; + oracle_precision = 6n; + is_disabled_for_deposits = disabled; + } in + (valid_swap, valid_swap_reduced) + +let add_swap_pair_should_succeed_if_user_is_admin = + Breath.Model.case + "test add swap pair" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, swap_pair_reduced) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 0tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; act_add_swap_pair + ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced + ]) + +let add_swap_pair_should_fail_if_user_is_non_admin = + Breath.Model.case + "test add swap pair" + "should fail if user is non admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, _) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 0tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps in + + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_add_swap_pair + ; Breath.Assert.is_equal "swap pair still does not exist" None added_swap_pair_reduced + ]) + +let add_swap_pair_should_fail_if_tez_is_supplied = + Breath.Model.case + "test add swap pair" + "should fail if tez is supplied" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, _) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 5tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps in + + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_add_swap_pair + ; Breath.Assert.is_equal "swap pair still does not exist" None added_swap_pair_reduced + ]) + +let remove_swap_pair_should_succeed_if_user_is_admin = + Breath.Model.case + "test remove swap pair" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, swap_pair_reduced) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 0tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps) in + + let act_remove_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_token_swap_pair swap_pair) 0tez)) in + + let r_storage = Breath.Contract.storage_of batcher in + let removed_swap_pair_reduced = Map.find_opt "tzBTC/EURL" r_storage.valid_swaps in + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; act_add_swap_pair + ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced + ; act_remove_swap_pair + ; Breath.Assert.is_equal "swap pair should have been removed" None removed_swap_pair_reduced + ]) + +let remove_swap_pair_should_fail_if_user_is_non_admin = + Breath.Model.case + "test remove swap pair" + "should fail if user is non admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, swap_pair_reduced) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 0tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps) in + + let act_remove_swap_pair = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_token_swap_pair swap_pair) 0tez)) in + + let r_storage = Breath.Contract.storage_of batcher in + let removed_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" r_storage.valid_swaps) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; act_add_swap_pair + ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_remove_swap_pair + ; Breath.Assert.is_equal "swap pair should still exist" swap_pair_reduced removed_swap_pair_reduced + ]) + +let remove_swap_pair_should_fail_if_tez_is_supplied = + Breath.Model.case + "test remove swap pair" + "should fail if tez supplied" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, swap_pair_reduced) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + let act_add_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_token_swap_pair swap_pair) 0tez)) in + + let new_bstorage = Breath.Contract.storage_of batcher in + let added_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" new_bstorage.valid_swaps) in + + let act_remove_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_token_swap_pair swap_pair) 5tez)) in + + let r_storage = Breath.Contract.storage_of batcher in + let removed_swap_pair_reduced = Option.unopt (Map.find_opt "tzBTC/EURL" r_storage.valid_swaps) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; act_add_swap_pair + ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_remove_swap_pair + ; Breath.Assert.is_equal "swap pair should still exist" swap_pair_reduced removed_swap_pair_reduced + ]) + +let remove_swap_pair_should_fail_if_swap_does_not_exist = + Breath.Model.case + "test remove swap pair" + "should fail if swap does not exist" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, _swap_pair_reduced) = get_tzbtc_eurl_swap_pair true context.contracts.oracle.originated_address bstorage in + + let act_remove_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_token_swap_pair swap_pair) 0tez)) in + + let r_storage = Breath.Contract.storage_of batcher in + let removed_swap_pair_reduced = Map.find_opt "tzBTC/EURL" r_storage.valid_swaps in + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; Breath.Expect.fail_with_value Batcher.swap_does_not_exist act_remove_swap_pair + ; Breath.Assert.is_equal "swap pair should have been removed" None removed_swap_pair_reduced + ]) + +let remove_swap_pair_should_fail_if_swap_is_not_disabled = + Breath.Model.case + "test remove swap pair" + "should fail if swap is not disabled" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let bstorage = Breath.Contract.storage_of batcher in + let swap_pair_does_not_already_exist = Map.find_opt "tzBTC/EURL" bstorage.valid_swaps in + let (swap_pair, _swap_pair_reduced) = get_tzbtc_eurl_swap_pair false context.contracts.oracle.originated_address bstorage in + + let act_remove_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_token_swap_pair swap_pair) 0tez)) in + + let r_storage = Breath.Contract.storage_of batcher in + let removed_swap_pair_reduced = Map.find_opt "tzBTC/EURL" r_storage.valid_swaps in + Breath.Result.reduce [ + Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist + ; Breath.Expect.fail_with_value Batcher.cannot_remove_swap_pair_that_is_not_disabled act_remove_swap_pair + ; Breath.Assert.is_equal "swap pair should have been removed" None removed_swap_pair_reduced + ]) + +let test_suite = + Breath.Model.suite "Suite for Add/Remove Swap Pair (Admin)" [ + add_swap_pair_should_succeed_if_user_is_admin + ; add_swap_pair_should_fail_if_user_is_non_admin + ; add_swap_pair_should_fail_if_tez_is_supplied + ; remove_swap_pair_should_succeed_if_user_is_admin + ; remove_swap_pair_should_fail_if_swap_does_not_exist + ; remove_swap_pair_should_fail_if_user_is_non_admin + ; remove_swap_pair_should_fail_if_tez_is_supplied + ; remove_swap_pair_should_fail_if_swap_is_not_disabled + ] + diff --git a/batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo b/batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo new file mode 100644 index 00000000..7691dd8a --- /dev/null +++ b/batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo @@ -0,0 +1,114 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + +let test_metadata = ("546573742044617461" : bytes) +let updated_test_metadata = ("5570646174656420546573742044617461" : bytes) + +let get_metadata + (contract: Helpers.originated_contract) + (key: string) = + let storage = Breath.Contract.storage_of contract in + let metadata = storage.metadata in + match Big_map.find_opt key metadata with + | Some m -> Some m + | None -> None + + +let change_metadata_should_succeed_if_user_is_admin = + Breath.Model.case + "test change metadata" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let initial_metadata = get_metadata batcher "test" in + let act_add_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = test_metadata; } ) 0tez)) in + + let added_meta = get_metadata batcher "test" in + + let act_update_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = updated_test_metadata; } ) 0tez)) in + + let updated_meta = get_metadata batcher "test" in + + let act_remove_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_metadata "test" ) 0tez)) in + + let removed_meta = get_metadata batcher "test" in + + Breath.Result.reduce [ + Breath.Assert.is_equal "metadata should be empty" None initial_metadata + ; act_add_metadata + ; Breath.Assert.is_equal "metadata should be added" (Some test_metadata) added_meta + ; act_update_metadata + ; Breath.Assert.is_equal "metadata should be updated" (Some updated_test_metadata) updated_meta + ; act_remove_metadata + ; Breath.Assert.is_equal "metadata should be removed" None removed_meta + ]) + +let change_metadata_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change metadata" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let initial_metadata = get_metadata batcher "test" in + let act_add_metadata = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = test_metadata; } ) 0tez)) in + + let added_meta = get_metadata batcher "test" in + + let act_update_metadata = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = updated_test_metadata; } ) 0tez)) in + + let updated_meta = get_metadata batcher "test" in + + let act_remove_metadata = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_metadata "test" ) 0tez)) in + + let removed_meta = get_metadata batcher "test" in + + Breath.Result.reduce [ + Breath.Assert.is_equal "metadata should be empty" None initial_metadata + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_add_metadata + ; Breath.Assert.is_equal "metadata should be empty" None added_meta + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_update_metadata + ; Breath.Assert.is_equal "metadata should be empty" None updated_meta + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_remove_metadata + ; Breath.Assert.is_equal "metadata should be empty" None removed_meta + ]) + +let change_metadata_should_fail_if_tez_is_supplied = + Breath.Model.case + "test change metadata" + "should fail if tez is supplied" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let initial_metadata = get_metadata batcher "test" in + let act_add_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = test_metadata; } ) 5tez)) in + + let added_meta = get_metadata batcher "test" in + + let act_update_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Add_or_update_metadata{key = "test"; value = updated_test_metadata; } ) 5tez)) in + + let updated_meta = get_metadata batcher "test" in + + let act_remove_metadata = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Remove_metadata "test" ) 5tez)) in + + let removed_meta = get_metadata batcher "test" in + + Breath.Result.reduce [ + Breath.Assert.is_equal "metadata should be empty" None initial_metadata + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_add_metadata + ; Breath.Assert.is_equal "metadata should be empty" None added_meta + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_update_metadata + ; Breath.Assert.is_equal "metadata should be empty" None updated_meta + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_remove_metadata + ; Breath.Assert.is_equal "metadata should be empty" None removed_meta + ]) + +let test_suite = + Breath.Model.suite "Suite for Change MetaData (Admin)" [ + change_metadata_should_succeed_if_user_is_admin + ; change_metadata_should_fail_if_user_is_not_admin + ; change_metadata_should_fail_if_tez_is_supplied + ] + diff --git a/batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo b/batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo new file mode 100644 index 00000000..f6ed0f68 --- /dev/null +++ b/batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo @@ -0,0 +1,85 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let amend_token_pair_limit_should_succeed_if_user_is_admin = + Breath.Model.case + "test change token pair limit" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_limit = 20n in + let act_amend_token_pair_limit = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher ( Amend_token_and_pair_limit new_limit) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs + ; act_amend_token_pair_limit + ; Breath.Assert.is_equal "new limit" new_limit new_storage.limit_on_tokens_or_pairs + ]) + +let amend_token_pair_limit_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change token pair limit" + "should fail if user is not an admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_limit = 20n in + let act_amend_token_pair_limit = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher ( Amend_token_and_pair_limit new_limit) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_amend_token_pair_limit + ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs + ]) + +let amend_token_pair_limit_should_fail_if_tez_is_sent = + Breath.Model.case + "test change token pair limit" + "should fail if tez is sent" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_limit = 20n in + let act_amend_token_pair_limit = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher ( Amend_token_and_pair_limit new_limit) 5tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_amend_token_pair_limit + ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs + ]) + +let amend_token_pair_limit_should_fail_if_limit_is_less_than_current_tokens = + Breath.Model.case + "test change token pair limit" + "should fail if limit is less than current tokens" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_limit = 1n in + let act_amend_token_pair_limit = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher ( Amend_token_and_pair_limit new_limit) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs + ; Breath.Expect.fail_with_value Batcher.cannot_reduce_limit_on_tokens_to_less_than_already_exists act_amend_token_pair_limit + ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs + ]) + +let test_suite = + Breath.Model.suite "Suite for Change Admin Address (Admin)" [ + amend_token_pair_limit_should_succeed_if_user_is_admin + ; amend_token_pair_limit_should_fail_if_user_is_not_admin + ; amend_token_pair_limit_should_fail_if_tez_is_sent + ; amend_token_pair_limit_should_fail_if_limit_is_less_than_current_tokens + ] + diff --git a/batcher/test/endpoints/admin/test_change_admin_address.mligo b/batcher/test/endpoints/admin/test_change_admin_address.mligo new file mode 100644 index 00000000..6971eee4 --- /dev/null +++ b/batcher/test/endpoints/admin/test_change_admin_address.mligo @@ -0,0 +1,86 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let change_admin_address_should_succeed_if_user_is_admin = + Breath.Model.case + "test change admin address" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.btc_trader.address in + let act_change_admin_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_admin_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; act_change_admin_address + ; Breath.Assert.is_equal "new address" new_address new_storage.administrator + ]) + +let change_admin_address_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change admin address" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.usdt_trader.address in + let act_change_admin_address = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_admin_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_admin_address + ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator + ]) + +let change_admin_address_should_fail_if_tez_is_sent = + Breath.Model.case + "test change admin address" + "should fail if tez is sent" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.usdt_trader.address in + let act_change_admin_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_admin_address new_address) 5tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_admin_address + ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator + ]) + +let change_admin_address_should_fail_if_new_address_is_the_same_as_fee_recipient = + Breath.Model.case + "test change admin address" + "should fail if new address is the same as fee recipient" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.fee_recipient in + let act_change_admin_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_admin_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; Breath.Expect.fail_with_value Batcher.admin_and_fee_recipient_address_cannot_be_the_same act_change_admin_address + ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator + ]) + +let test_suite = + Breath.Model.suite "Suite for Change Admin Address (Admin)" [ + change_admin_address_should_succeed_if_user_is_admin + ; change_admin_address_should_fail_if_user_is_not_admin + ; change_admin_address_should_fail_if_tez_is_sent + ; change_admin_address_should_fail_if_new_address_is_the_same_as_fee_recipient + ] + diff --git a/batcher/test/endpoints/admin/test_change_deposit_time_window.mligo b/batcher/test/endpoints/admin/test_change_deposit_time_window.mligo new file mode 100644 index 00000000..68ec02a9 --- /dev/null +++ b/batcher/test/endpoints/admin/test_change_deposit_time_window.mligo @@ -0,0 +1,104 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let change_deposit_time_window_should_succeed_if_user_is_admin = + Breath.Model.case + "test change deposit time window" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_window = 1200n in + let act_change_deposit_time_window = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_deposit_time_window new_window) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds + ; act_change_deposit_time_window + ; Breath.Assert.is_equal "time window unchanged" new_window new_storage.deposit_time_window_in_seconds + ]) + +let change_deposit_time_window_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change deposit time window" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_window = 1200n in + let act_change_deposit_time_window = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_deposit_time_window new_window) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_deposit_time_window + ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds + ]) + +let change_deposit_time_window_should_fail_if_tez_is_sent = + Breath.Model.case + "test change deposit time window" + "should fail if tez is sent" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_window = 1200n in + let act_change_deposit_time_window = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_deposit_time_window new_window) 5tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_deposit_time_window + ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds + ]) + +let change_deposit_time_window_should_fail_if_below_minimum_window = + Breath.Model.case + "test change deposit time window" + "should fail if below minimum window" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_window = 500n in + let act_change_deposit_time_window = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_deposit_time_window new_window) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds + ; Breath.Expect.fail_with_value Batcher.cannot_update_deposit_window_to_less_than_the_minimum act_change_deposit_time_window + ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds + ]) + +let change_deposit_time_window_should_fail_if_above_maximum_window = + Breath.Model.case + "test change deposit time window" + "should fail if above maximum window" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_window =4000n in + let act_change_deposit_time_window = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_deposit_time_window new_window) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds + ; Breath.Expect.fail_with_value Batcher.cannot_update_deposit_window_to_more_than_the_maximum act_change_deposit_time_window + ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds + ]) + +let test_suite = + Breath.Model.suite "Suite for Change Admin Address (Admin)" [ + change_deposit_time_window_should_succeed_if_user_is_admin + ; change_deposit_time_window_should_fail_if_user_is_not_admin + ; change_deposit_time_window_should_fail_if_tez_is_sent + ; change_deposit_time_window_should_fail_if_below_minimum_window + ; change_deposit_time_window_should_fail_if_above_maximum_window + ] + diff --git a/batcher/test/endpoints/admin/test_change_fee.mligo b/batcher/test/endpoints/admin/test_change_fee.mligo new file mode 100644 index 00000000..cdc6a88c --- /dev/null +++ b/batcher/test/endpoints/admin/test_change_fee.mligo @@ -0,0 +1,72 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let change_fee_should_succeed_if_user_is_admin = + Breath.Model.case + "test change fee" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let old_fee = old_storage.fee_in_mutez in + let new_fee = 20000mutez in + let act_change_fee = Breath.Context.act_as context.eurl_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee new_fee) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old fee" old_fee old_storage.fee_in_mutez + ; act_change_fee + ; Breath.Assert.is_equal "new fee" new_fee new_storage.fee_in_mutez + ]) + +let change_fee_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change fee" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + + let old_fee = old_storage.fee_in_mutez in + let new_fee = 20000mutez in + + let act_change_fee = Breath.Context.act_as context.btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee new_fee) 0tez)) in + + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old fee" old_fee old_storage.fee_in_mutez + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_fee + ; Breath.Assert.is_equal "old fee is unchanged" old_fee new_storage.fee_in_mutez + ]) + +let change_fee_should_fail_if_tez_is_sent = + Breath.Model.case + "test change fee" + "should fail if tez is sent" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let old_fee = old_storage.fee_in_mutez in + let new_fee = 20000mutez in + let act_change_fee = Breath.Context.act_as context.eurl_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee new_fee) 5tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old fee" old_fee old_storage.fee_in_mutez + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_fee + ; Breath.Assert.is_equal "old fee is unchanged" old_fee new_storage.fee_in_mutez + ]) +let test_suite = + Breath.Model.suite "Suite for Change Fee (Admin)" [ + change_fee_should_succeed_if_user_is_admin + ; change_fee_should_fail_if_user_is_not_admin + ; change_fee_should_fail_if_tez_is_sent + ] + diff --git a/batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo b/batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo new file mode 100644 index 00000000..93b0cbfc --- /dev/null +++ b/batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo @@ -0,0 +1,85 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let change_fee_recipient_address_should_succeed_if_user_is_admin = + Breath.Model.case + "test change fee recipient" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.btc_trader.address in + let act_change_fee_recipient_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee_recipient_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.fee_recipient old_storage.fee_recipient + ; act_change_fee_recipient_address + ; Breath.Assert.is_equal "new address" new_address new_storage.fee_recipient + ]) + +let change_fee_recipient_address_should_fail_if_user_is_not_admin = + Breath.Model.case + "test change fee recipient" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.usdt_trader.address in + let act_change_fee_recipient_address = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee_recipient_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_fee_recipient_address + ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator + ]) + +let change_fee_recipient_address_should_fail_if_tez_is_sent = + Breath.Model.case + "test change fee recipient" + "should fail if tez is sent" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.usdt_trader.address in + let act_change_fee_recipient_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee_recipient_address new_address) 5tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_fee_recipient_address + ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator + ]) + +let change_fee_recipient_address_should_fail_if_new_address_is_the_same_as_admin = + Breath.Model.case + "test change fee recipient" + "should fail if new address is the same as admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let old_storage = Breath.Contract.storage_of batcher in + let new_address = context.admin.address in + let act_change_fee_recipient_address = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_fee_recipient_address new_address) 0tez)) in + let new_storage = Breath.Contract.storage_of batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" context.fee_recipient old_storage.fee_recipient + ; Breath.Expect.fail_with_value Batcher.admin_and_fee_recipient_address_cannot_be_the_same act_change_fee_recipient_address + ; Breath.Assert.is_equal "address unchanged" context.fee_recipient new_storage.fee_recipient + ]) + +let test_suite = + Breath.Model.suite "Suite for Change Fee Recipient Address (Admin)" [ + change_fee_recipient_address_should_succeed_if_user_is_admin + ; change_fee_recipient_address_should_fail_if_user_is_not_admin + ; change_fee_recipient_address_should_fail_if_tez_is_sent + ; change_fee_recipient_address_should_fail_if_new_address_is_the_same_as_admin + ] diff --git a/batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo b/batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo new file mode 100644 index 00000000..a1e78755 --- /dev/null +++ b/batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo @@ -0,0 +1,104 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + +let pair = "tzBTC/USDT" +let oraclepair = "BTC-USDT" +let old_price = 30000000000n + +let change_oracle_source_should_succeed_if_user_is_admin = + Breath.Model.case + "test change oracle source" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let oracle = context.contracts.oracle in + let additional_oracle = context.contracts.additional_oracle in + let test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + let new_oracle_address = additional_oracle.originated_address in + let source_update = Helpers.get_source_update pair test_swap new_oracle_address in + let (_,new_oracle_price): (timestamp * nat) = Option.unopt (Tezos.call_view "getPrice" oraclepair new_oracle_address) in + let act_change_oracle_source = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_oracle_source_of_pair source_update) 0tez)) in + let new_test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "new price" new_oracle_price old_price + ; Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address + ; act_change_oracle_source + ; Breath.Assert.is_equal "new address" new_oracle_address new_test_swap.oracle_address + ]) + +let change_oracle_source_should_fail_if_the_user_is_non_admin = + Breath.Model.case + "test change oracle source" + "should fail if the user is non admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let oracle = context.contracts.oracle in + let additional_oracle = context.contracts.additional_oracle in + let test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + let new_oracle_address = additional_oracle.originated_address in + let source_update = Helpers.get_source_update pair test_swap new_oracle_address in + let (_,new_oracle_price): (timestamp * nat) = Option.unopt (Tezos.call_view "getPrice" oraclepair new_oracle_address) in + let act_change_oracle_source = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_oracle_source_of_pair source_update) 0tez)) in + let new_test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "new price" new_oracle_price old_price + ; Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_oracle_source + ; Breath.Assert.is_equal "old address unchanged" oracle.originated_address new_test_swap.oracle_address + ]) + +let change_oracle_source_should_fail_if_tez_is_sent = + Breath.Model.case + "test change oracle source" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let oracle = context.contracts.oracle in + let additional_oracle = context.contracts.additional_oracle in + let test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + let new_oracle_address = additional_oracle.originated_address in + let source_update = Helpers.get_source_update pair test_swap new_oracle_address in + let (_,new_oracle_price): (timestamp * nat) = Option.unopt (Tezos.call_view "getPrice" oraclepair new_oracle_address) in + let act_change_oracle_source = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_oracle_source_of_pair source_update) 5tez)) in + let new_test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "new price" new_oracle_price old_price + ; Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_oracle_source + ; Breath.Assert.is_equal "old address unchanged" oracle.originated_address new_test_swap.oracle_address + ]) + +let change_oracle_source_should_fail_if_not_a_valid_oracle = + Breath.Model.case + "test change oracle source" + "should fail if not a valid oracle" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let oracle = context.contracts.oracle in + let test_swap = Option.unopt (Helpers.get_swap_pair batcher pair) in + let new_oracle_address = context.btc_trader.address in + let source_update = Helpers.get_source_update pair test_swap new_oracle_address in + let act_change_oracle_source = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Change_oracle_source_of_pair source_update) 0tez)) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address + ; act_change_oracle_source + ; Breath.Assert.is_equal "old address unchanged " oracle.originated_address test_swap.oracle_address + ]) + +let test_suite = + Breath.Model.suite "Suite for Change Oracle Address (Admin)" [ + change_oracle_source_should_succeed_if_user_is_admin + ; change_oracle_source_should_fail_if_the_user_is_non_admin + ; change_oracle_source_should_fail_if_tez_is_sent + ; change_oracle_source_should_fail_if_not_a_valid_oracle + ] + diff --git a/batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo b/batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo new file mode 100644 index 00000000..1d1b3526 --- /dev/null +++ b/batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo @@ -0,0 +1,79 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + + +let enable_disable_swap_pair_should_succeed_if_user_is_admin = + Breath.Model.case + "test enable disable swap pair" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let pair = "tzBTC/USDT" in + let initial_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_disable_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Disable_swap_pair_for_deposit pair) 0tez)) in + let disabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_enable_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Enable_swap_pair_for_deposit pair) 0tez)) in + let enabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "pair should be enabled" false initial_pair.is_disabled_for_deposits + ; act_disable_swap_pair + ; Breath.Assert.is_equal "pair should be disabled" true disabled_pair.is_disabled_for_deposits + ; act_enable_swap_pair + ; Breath.Assert.is_equal "pair should be enabled" false enabled_pair.is_disabled_for_deposits + ]) + +let enable_disable_swap_pair_should_fail_if_user_is_not_admin = + Breath.Model.case + "test enable disable swap pair" + "should fail if user is not admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let pair = "tzBTC/USDT" in + let initial_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_disable_swap_pair = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Disable_swap_pair_for_deposit pair) 0tez)) in + let disabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_enable_swap_pair = Breath.Context.act_as context.non_admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Enable_swap_pair_for_deposit pair) 0tez)) in + let enabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "pair should be enabled" false initial_pair.is_disabled_for_deposits + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_disable_swap_pair + ; Breath.Assert.is_equal "pair should still be enabled" false disabled_pair.is_disabled_for_deposits + ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_enable_swap_pair + ; Breath.Assert.is_equal "pair should still be enabled" false enabled_pair.is_disabled_for_deposits + ]) + +let enable_disable_swap_pair_should_fail_if_tez_is_supplied = + Breath.Model.case + "test enable disable swap pair" + "should fail if tez is supplied" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let pair = "tzBTC/USDT" in + let initial_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_disable_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Disable_swap_pair_for_deposit pair) 5tez)) in + let disabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + let act_enable_swap_pair = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Enable_swap_pair_for_deposit pair) 5tez)) in + let enabled_pair = Option.unopt (Helpers.get_swap_pair batcher pair) in + + Breath.Result.reduce [ + Breath.Assert.is_equal "pair should be enabled" false initial_pair.is_disabled_for_deposits + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_disable_swap_pair + ; Breath.Assert.is_equal "pair should still be enabled" false disabled_pair.is_disabled_for_deposits + ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_enable_swap_pair + ; Breath.Assert.is_equal "pair should still be enabled" false enabled_pair.is_disabled_for_deposits + ]) + +let test_suite = + Breath.Model.suite "Suite for Enable/Disable Swap Pairs (Admin)" [ + enable_disable_swap_pair_should_succeed_if_user_is_admin + ; enable_disable_swap_pair_should_fail_if_user_is_not_admin + ; enable_disable_swap_pair_should_fail_if_tez_is_supplied + ] + diff --git a/batcher/test/endpoints/maintenance/test_tick.mligo b/batcher/test/endpoints/maintenance/test_tick.mligo new file mode 100644 index 00000000..5cd64397 --- /dev/null +++ b/batcher/test/endpoints/maintenance/test_tick.mligo @@ -0,0 +1,27 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "../../../batcher.mligo" "Batcher" + +let pair = "tzBTC/USDT" +let oraclepair = "BTC-USDT" + +let tick_should_succeed_if_oracle_price_is_available_and_not_stale = + Breath.Model.case + "test tick" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let act_tick = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Tick pair) 0tez)) in + + Breath.Result.reduce [ + act_tick + ]) + + +let test_suite = + Breath.Model.suite "Suite for Tick (Maintenance)" [ + tick_should_succeed_if_oracle_price_is_available_and_not_stale + ] + diff --git a/batcher/test/endpoints/user/test_cancellations.mligo b/batcher/test/endpoints/user/test_cancellations.mligo new file mode 100644 index 00000000..44b07308 --- /dev/null +++ b/batcher/test/endpoints/user/test_cancellations.mligo @@ -0,0 +1,77 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "./../../common/batch.mligo" "Batch" +#import "../../../batcher.mligo" "Batcher" + +type skew = Batch.skew +type pressure = Batch.pressure + +let cancellation_fail_if_batch_is_closed = + Breath.Model.case + "test cancellation" + "should fail if batch is closed" + (fun (level: Breath.Logger.level) -> + let pair = ("tzBTC","USDT") in + let tick_pair = "tzBTC/USDT" in + let (_expected_tolerance, batch) = Batch.prepare_closed_batch pair Buy Balanced in + let context = Helpers.test_context_with_batch tick_pair batch level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let act_cancel = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Cancel pair) 0tez)) in + + Breath.Result.reduce [ + Breath.Expect.fail_with_value Batcher.cannot_cancel_orders_for_a_batch_that_is_not_open act_cancel + ]) + +let cancellation_should_succeed = + Breath.Model.case + "test cancellation" + "should be successful" + (fun (level: Breath.Logger.level) -> + let pair = ("tzBTC","USDT") in + let tick_pair = "tzBTC/USDT" in + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" deposit_amount Buy Exact bstorage.valid_tokens in + + let bstorage_after_desposit = Breath.Contract.storage_of batcher in + let batch_after_deposit = Option.unopt (Helpers.get_current_batch tick_pair bstorage_after_desposit) in + let total_volumes_after_deposit = batch_after_deposit.volumes.buy_total_volume + batch_after_deposit.volumes.sell_total_volume in + let holdings_after_deposit = batch_after_deposit.holdings in + + let act_cancel = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Cancel pair) 0tez)) in + + let bstorage_after_cancellation = Breath.Contract.storage_of batcher in + let batch_after_cancellation = Option.unopt (Helpers.get_current_batch tick_pair bstorage_after_cancellation) in + let total_volumes_after_cancellation = batch_after_cancellation.volumes.buy_total_volume + batch_after_deposit.volumes.sell_total_volume in + let holdings_after_cancellation = batch_after_cancellation.holdings in + + Breath.Result.reduce [ + act_allow_transfer + ; act_deposit + ; Helpers.expect_last_order_number bstorage_after_desposit 1n + ; Breath.Assert.is_equal "holdings after deposit" holdings_after_deposit 1n + ; Breath.Assert.is_equal "total volumes after deposit" total_volumes_after_deposit 2000000n + ; act_cancel + ; Breath.Assert.is_equal "holdings after cancellation" holdings_after_cancellation 0n + ; Breath.Assert.is_equal "total volumes after cancellation" total_volumes_after_cancellation 0n + ; Helpers.expect_last_order_number bstorage_after_cancellation 1n (* We do not decrement the last order number on cancellations *) + ]) + +let test_suite = + Breath.Model.suite "Suite for Cancellations" [ + cancellation_fail_if_batch_is_closed + ; cancellation_should_succeed + ] + diff --git a/batcher/test/endpoints/user/test_deposits.mligo b/batcher/test/endpoints/user/test_deposits.mligo new file mode 100644 index 00000000..d3804788 --- /dev/null +++ b/batcher/test/endpoints/user/test_deposits.mligo @@ -0,0 +1,99 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/helpers.mligo" "Helpers" +#import "./../../common/batch.mligo" "Batch" +#import "../../../batcher.mligo" "Batcher" + +type skew = Batch.skew +type pressure = Batch.pressure + +let deposit_fail_no_token_allowance = + Breath.Model.case + "test deposit" + "should fail if token allowance has not been made" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" 200000n Buy Exact bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + let bbalance = Breath.Contract.balance_of batcher in + + Breath.Result.reduce [ + Breath.Expect.fail_with_message "NotEnoughAllowance" act_deposit + ; Breath.Assert.is_equal "balance" bbalance 0tez + ; Helpers.expect_last_order_number bstorage 0n + ]) + +let deposit_fail_if_batch_is_closed = + Breath.Model.case + "test deposit" + "should fail if batch is closed but not cleared yet" + (fun (level: Breath.Logger.level) -> + let pair = ("tzBTC","USDT") in + let tick_pair = "tzBTC/USDT" in + let (_expected_tolerance, batch) = Batch.prepare_closed_batch pair Buy Balanced in + let context = Helpers.test_context_with_batch tick_pair batch level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" deposit_amount Buy Exact bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + let bbalance = Breath.Contract.balance_of batcher in + + Breath.Result.reduce [ + act_allow_transfer + ; Breath.Expect.fail_with_value Batcher.no_open_batch act_deposit + ; Breath.Assert.is_equal "balance" bbalance 0tez + ; Helpers.expect_last_order_number bstorage 0n + ]) + +let vanilla_deposit_should_succeed = + Breath.Model.case + "test deposit" + "should be successful" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" deposit_amount Buy Exact bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + let bbalance = Breath.Contract.balance_of batcher in + + Breath.Result.reduce [ + act_allow_transfer + ; act_deposit + ; Breath.Assert.is_equal "balance" bbalance bstorage.fee_in_mutez + ; Helpers.expect_last_order_number bstorage 1n + ]) + +let test_suite = + Breath.Model.suite "Suite for Deposits" [ + deposit_fail_no_token_allowance + ; vanilla_deposit_should_succeed + ; deposit_fail_if_batch_is_closed + + ] + diff --git a/batcher/test/endpoints/user/test_redemptions.mligo b/batcher/test/endpoints/user/test_redemptions.mligo new file mode 100644 index 00000000..0c7590a6 --- /dev/null +++ b/batcher/test/endpoints/user/test_redemptions.mligo @@ -0,0 +1,36 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../../common/utils.mligo" "Utils" +#import "./../../common/batch.mligo" "Batch" +#import "../../../batcher.mligo" "Batcher" +#import "./../../common/helpers.mligo" "Helpers" + + +let test_redemption_should_be_successful = + Breath.Model.case + "test redemption" + "should refund original token when not in clearing" + (fun (level: Breath.Logger.level) -> + let pair = ("tzBTC","USDT") in + let tick_pair = "tzBTC/USDT" in + let (expected_tolerance, batch) = Batch.prepare_open_batch pair Buy Balanced in + let context = Helpers.test_context_with_batch tick_pair batch level in + let batcher = context.contracts.batcher in + + let act_tick = Breath.Context.act_as context.admin (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Tick tick_pair) 0tez)) in + + let new_storage = Breath.Contract.storage_of batcher in + + let updated_batch = Option.unopt(Big_map.find_opt 1n new_storage.batch_set.batches) in + let () = Breath.Logger.log level updated_batch in + let clearing = Option.unopt (Batcher.Ubots.get_clearing updated_batch) in + + Breath.Result.reduce [ + act_tick + ; Breath.Assert.is_equal "expected cleaing tolerance" expected_tolerance clearing.clearing_tolerance + ]) + +let test_suite = + Breath.Model.suite "Suite for Redemptions" [ + test_redemption_should_be_successful + ] + diff --git a/batcher/test/test_mock_oracle.mligo b/batcher/test/mocks/oracle.mligo similarity index 50% rename from batcher/test/test_mock_oracle.mligo rename to batcher/test/mocks/oracle.mligo index 58efd67a..ea0fabf0 100644 --- a/batcher/test/test_mock_oracle.mligo +++ b/batcher/test/mocks/oracle.mligo @@ -1,10 +1,10 @@ - type rate_update = { + name: string; value: nat; timestamp : timestamp; } -type storage = rate_update option +type storage = (string, rate_update) map type result = (operation list) * storage @@ -15,10 +15,14 @@ type entrypoint = let update (update: rate_update) - (_storage: storage) : result = - let storage = Some update in + (storage: storage) : result = + let storage = match Map.find_opt update.name storage with + | None -> Map.add update.name update storage + | Some _ -> Map.update update.name (Some update) storage + in no_op storage +[@entry] let main (action, storage : entrypoint * storage) : result = match action with @@ -26,7 +30,8 @@ let main [@view] -let getPrice (_asset, storage : string * storage) = - match storage with +let getPrice (asset, storage : string * storage) = + match Map.find_opt asset storage with | None -> failwith "No rate available" - | Some r -> (r.value, r.timestamp) \ No newline at end of file + | Some r -> (r.timestamp, r.value) + diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo new file mode 100644 index 00000000..628da2e9 --- /dev/null +++ b/batcher/test/test.mligo @@ -0,0 +1,61 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./common/helpers.mligo" "Helpers" +#import "./endpoints/user/test_deposits.mligo" "User_Deposits" +#import "./endpoints/user/test_cancellations.mligo" "User_Cancellations" +#import "./endpoints/user/test_redemptions.mligo" "User_Redemptions" +#import "./economics/test_clearing.mligo" "Economics_Clearing" +#import "./endpoints/admin/test_change_fee.mligo" "Admin_Change_Fee" +#import "./endpoints/admin/test_change_admin_address.mligo" "Admin_Change_Admin_Address" +#import "./endpoints/admin/test_change_fee_recipient_address.mligo" "Admin_Change_Fee_Recipient_Address" +#import "./endpoints/admin/test_change_deposit_time_window.mligo" "Admin_Change_Deposit_Time_Window" +#import "./endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo" "Admin_Enable_Disable_Swap_Pair" +#import "./endpoints/admin/test_add_update_remove_metadata.mligo" "Admin_Add_Update_Remove_Metadata" +#import "./endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" +#import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" +#import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" +#import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" +#import "./economics/test_clearing.mligo" "Economics_Clearing" + + +let contract_can_be_originated = + Breath.Model.case + "test contract" + "can be originated" + (fun (level: Breath.Logger.level) -> + let () = Breath.Logger.log level "Originate Batcher contract" in + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in + let batcher_storage = Breath.Contract.storage_of contracts.batcher in + let batcher_balance = Breath.Contract.balance_of contracts.batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "balance" batcher_balance 0tez + ; Helpers.expect_last_order_number batcher_storage 0n + ]) + + +let test_suite = + Breath.Model.suite "Suite for Contract" [ + contract_can_be_originated + ] + +let () = + Breath.Model.run_suites Void + [ + test_suite + (* ; Admin_Change_Fee.test_suite + ; Admin_Change_Admin_Address.test_suite + ; Admin_Change_Fee_Recipient_Address.test_suite + ; Admin_Change_Deposit_Time_Window.test_suite + ; Admin_Enable_Disable_Swap_Pair.test_suite + ; Admin_Amend_Token_pair_Limit.test_suite + ; Admin_Add_Update_Remove_Metadata.test_suite + ; Admin_Change_Oracle_Source_Of_Pair.test_suite + ; Admin_Add_Remove_Token_Swap_Pair.test_suite + ; Maintenance_Tick.test_suite + ; Economics_Clearing.test_suite *) + ; User_Deposits.test_suite + ; User_Cancellations.test_suite +// ; User_Redemptions.test_suite + ] + diff --git a/batcher/test/test_batcher_sc.mligo b/batcher/test/test_batcher_sc.mligo deleted file mode 100644 index 0b9e328d..00000000 --- a/batcher/test/test_batcher_sc.mligo +++ /dev/null @@ -1,68 +0,0 @@ -#import "../batcher.mligo" "Batcher" -#import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "@ligo/math-lib/rational/rational.mligo" "Rational" -#import "test_storage.mligo" "TestStorage" -#import "test_utils.mligo" "TestUtils" - -type level = Breath.Logger.level - - -let test_can_originate_contract = - fun (level: level) -> - let () = Breath.Logger.log level "Originate Batcher contract" in - let oracle = TestUtils.originate_oracle level in - let initial_storage = TestStorage.initial_storage oracle.originated_address in - let contract = TestUtils.originate initial_storage level in - let storage = Breath.Contract.storage_of contract in - let balance = Breath.Contract.balance_of contract in - - Breath.Result.reduce [ - Breath.Assert.is_equal "balance" balance 0tez - ; TestStorage.Helpers.expect_last_order_number storage 0n - ] - -let test_swap_deposit_starts_batch = - fun (level: level) -> - let () = Breath.Logger.log level "Originate Batcher contract" in - let (_, (admin, _user1, _user2)) = Breath.Context.init_default () in - let oracle = TestUtils.originate_oracle level in - let initial_storage = TestStorage.initial_storage oracle.originated_address in - let contract = TestUtils.originate initial_storage level in - - let rate = TestUtils.create_rate_update 18724460712n None in - let update = Breath.Context.act_as admin (TestUtils.update_oracle oracle rate 1tez) in - - let first_tick = Breath.Context.act_as admin (TestUtils.tick "tzBTC/USDT" contract 1tez) in - let () = Breath.Logger.log level first_tick in - - - - let storage = Breath.Contract.storage_of contract in - let balance = Breath.Contract.balance_of contract in - - let oracle_storage = Breath.Contract.storage_of oracle in - let expected_rate = TestUtils.create_rate 1872446071200n 10000000n in - - Breath.Result.reduce [ - update - ; first_tick - ; Breath.Assert.is_equal "balance" balance 0tez - ; TestStorage.Helpers.expect_oracle_value oracle_storage 18724460712n - ; TestStorage.Helpers.expect_last_order_number storage 0n - ; TestStorage.Helpers.expect_rate_value storage "tzBTC/USDT" expected_rate - ] - -let run_test - (name: string) - (description: string) - (test_func: level -> Breath.Result.result) = Breath.Model.case name description test_func - -let () = - Breath.Model.run_suites Void [ - Breath.Model.suite "Suite for Batcher" [ - (* Contract origination tests *) - run_test "can originate contract" "Contract can be originated with default storage" test_can_originate_contract; - run_test "swap deposit starts batch" "A swap order deposit should start a batch" test_swap_deposit_starts_batch; - ] - ] - diff --git a/batcher/test/test_contract.mligo b/batcher/test/test_contract.mligo new file mode 100644 index 00000000..0f5c801e --- /dev/null +++ b/batcher/test/test_contract.mligo @@ -0,0 +1,26 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./common/helpers.mligo" "Helpers" + + +let contract_can_be_originated = + Breath.Model.case + "test contract" + "can be originated" + (fun (level: Breath.Logger.level) -> + let () = Breath.Logger.log level "Originate Batcher contract" in + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in + let batcher_storage = Breath.Contract.storage_of contracts.batcher in + let batcher_balance = Breath.Contract.balance_of contracts.batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "balance" batcher_balance 0tez + ; Helpers.expect_last_order_number batcher_storage 0n + ]) + + +let test_suite = + Breath.Model.suite "Suite for Deposits" [ + contract_can_be_originated + ] + diff --git a/batcher/test/test_storage.mligo b/batcher/test/test_storage.mligo deleted file mode 100644 index 8b2b9c90..00000000 --- a/batcher/test/test_storage.mligo +++ /dev/null @@ -1,125 +0,0 @@ -#import "../batcher.mligo" "Batcher" -#import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "@ligo/math-lib/rational/rational.mligo" "Rational" -#import "test_mock_oracle.mligo" "Oracle" - -type level = Breath.Logger.level -type storage = Batcher.Storage.t -type oracle_storage = Oracle.storage - -let initial_storage - (oracle_address: address) : storage = { - metadata = (Big_map.empty : (string,bytes) big_map); - valid_tokens = Map.literal [ - (("tzBTC"), { - name = "tzBTC"; - address = Some(("KT1XLyXAe5FWMHnoWa98xZqgDUyyRms2B3tG" : address)); - decimals = 8n; - standard = Some "FA1.2 token"; - }); - (("EURL"),{ - name = "EURL"; - address = Some(("KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5" : address)); - decimals = 6n; - standard = Some "FA2 token"; - }); - (("USDT"),{ - name = "USDT"; - address = Some(("KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm" : address)); - decimals = 6n; - standard = Some "FA2 token"; - }) - ]; - valid_swaps = Map.literal [ - ("tzBTC/USDT", { - swap = { - from = { - amount = 1n; - token = { - name = "tzBTC"; - address = Some(("KT1XLyXAe5FWMHnoWa98xZqgDUyyRms2B3tG" : address)); - decimals = 8n; - standard = Some "FA1.2 token"; - }; - }; - to = { - name = "USDT"; - address = Some(("KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } - }; - oracle_address = oracle_address; - oracle_asset_name = "tzBTC-USDT"; - oracle_precision = 6n; - is_disabled_for_deposits = false; - } - ); - ("EURL/tzBTC", { - swap = { - from = { - amount = 1n; - token = { - name = "tzBTC"; - address = Some(("KT1XLyXAe5FWMHnoWa98xZqgDUyyRms2B3tG" : address)); - decimals = 8n; - standard = Some "FA1.2 token"; - }; - }; - to = { - name = "EURL"; - address = Some(("KT1UhjCszVyY5dkNUXFGAwdNcVgVe2ZeuPv5" : address)); - decimals = 6n; - standard = Some "FA2 token"; - } - }; - oracle_address = oracle_address; - oracle_asset_name = "tzBTC-EURL"; - oracle_precision = 6n; - is_disabled_for_deposits = false; - } - ) - ]; - rates_current = (Big_map.empty : Batcher.Storage.rates_current); - batch_set = { - current_batch_indices = (Map.empty : (string,nat) map); - batches = (Big_map.empty : (nat,Batcher.batch) big_map); - }; - last_order_number = 0n; - user_batch_ordertypes = (Big_map.empty: Batcher.user_batch_ordertypes); - fee_in_mutez = 10_000mutez; - fee_recipient = ("tz1burnburnburnburnburnburnburjAYjjX" : address); - administrator = ("tz1ca4batAsNxMYab3mUK5H4QRjY8drV4ViL" : address); - limit_on_tokens_or_pairs = 10n; - deposit_time_window_in_seconds = 600n -} - -module Helpers = struct - -let expect_from_storage - (type a) - (name: string) - (storage: storage) - (selector: storage -> a) - (expected_value: a) = Breath.Assert.is_equal name (selector storage) expected_value - -let expect_last_order_number - (storage: storage) - (last_order_number: nat) = expect_from_storage "last_order_number" storage (fun s -> s.last_order_number) last_order_number - -let expect_rate_value - (storage: storage) - (rate_name: string) - (rate: Rational.t) = - match Big_map.find_opt rate_name storage.rates_current with - | None -> Breath.Assert.fail_with "Could not find rate in storage" - | Some r -> Breath.Assert.is_equal "rate value" r.rate rate - -let expect_oracle_value - (storage: oracle_storage) - (value: nat) = - match storage with - | None -> Breath.Assert.fail_with "Oracle doesn't contain a rate" - | Some s -> Breath.Assert.is_equal "oracle value" s.value value - -end diff --git a/batcher/test/test_utils.mligo b/batcher/test/test_utils.mligo deleted file mode 100644 index 209942eb..00000000 --- a/batcher/test/test_utils.mligo +++ /dev/null @@ -1,90 +0,0 @@ -#import "../batcher.mligo" "Batcher" -#import "test_mock_oracle.mligo" "Oracle" -#import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "@ligo/math-lib/rational/rational.mligo" "Rational" - -type level = Breath.Logger.level -let log = Breath.Logger.log -type storage = Batcher.Storage.t -type originated = Breath.Contract.originated -type valid_swap = Batcher.valid_swap -type external_order = Batcher.external_swap_order - -let originate -(storage: storage) -(level: level) = - let () = log level storage in - Breath.Contract.originate - level - "batcher_sc" - Batcher.main - (storage: Batcher.Storage.t) - (0tez) - -let originate_oracle -(level: level) = - Breath.Contract.originate - level - "oracle_sc" - Oracle.main - (None: Oracle.storage) - (0tez) - -let trader_one_context - (storage: storage) - (level : level) = - let (_, (trader_one, _trader_two, _trader_three)) = Breath.Context.init_default () in - let contract = originate storage level in - trader_one, contract - -let trader_two_context - (storage: storage) - (level : level) = - let (_, (trader_one, _trader_two, _trader_three)) = Breath.Context.init_default () in - let contract = originate storage level in - trader_one, contract - -let trader_one_context - (storage: storage) - (level : level) = - let (_, (trader_one, _trader_two, _trader_three)) = Breath.Context.init_default () in - let contract = originate storage level in - trader_one, contract - -let create_rate - (num: nat) - (denom: nat) : Rational.t = - let r_num = Rational.new (int num) in - let r_denom = Rational.new (int denom) in - Rational.div r_num r_denom - -let create_rate_update - (value: nat) - (when: timestamp option) : Oracle.rate_update = - match when with - | None -> let ts = Tezos.get_now () in - { value = value; timestamp = ts;} - | Some t -> { value = value; timestamp = t;} - -let deposit (order : external_order) - (contract : (Batcher.entrypoint, Batcher.storage) originated) - (fee: tez) - () = - let deposit_end = Deposit order in - Breath.Contract.transfer_to contract deposit_end fee - -let tick - (asset: string) - (contract : (Batcher.entrypoint, Batcher.storage) originated) - (fee: tez) - () = - let tick_end = Tick asset in - Breath.Contract.transfer_to contract tick_end fee - -let update_oracle - (oracle : (Oracle.entrypoint, Oracle.storage) originated) - (update: Oracle.rate_update) - (fee: tez) - () = - let update_end = Update update in - Breath.Contract.transfer_to oracle update_end fee \ No newline at end of file diff --git a/batcher/tokens/README.md b/batcher/test/tokens/README.md similarity index 100% rename from batcher/tokens/README.md rename to batcher/test/tokens/README.md diff --git a/batcher/tokens/fa12/main.mligo b/batcher/test/tokens/fa12/main.mligo similarity index 98% rename from batcher/tokens/fa12/main.mligo rename to batcher/test/tokens/fa12/main.mligo index 84556206..294a18c0 100644 --- a/batcher/tokens/fa12/main.mligo +++ b/batcher/test/tokens/fa12/main.mligo @@ -1,3 +1,4 @@ + type transfer = [@layout:comb] { [@annot:from] address_from : address; @@ -32,10 +33,10 @@ type getTotalSupply = type tokens = (address, nat) big_map type allowances = (allowance_key, nat) big_map type data = { - token_id : nat; + token_id : nat; token_info : (string, bytes) map } -type token_metadata = (nat, data) big_map +type token_metadata = (nat, data) big_map type storage = { tokens : tokens; @@ -128,6 +129,7 @@ let getTotalSupply (param, storage : getTotalSupply * storage) : operation list let total = storage.total_supply in [Tezos.transaction total 0mutez param.callback] + let main (param, storage : parameter * storage) : result = begin if Tezos.get_amount () <> 0mutez diff --git a/batcher/tokens/fa12/storage/CTEZ.json b/batcher/test/tokens/fa12/storage/CTEZ.json similarity index 100% rename from batcher/tokens/fa12/storage/CTEZ.json rename to batcher/test/tokens/fa12/storage/CTEZ.json diff --git a/batcher/tokens/fa12/storage/CTEZ_storage.mligo b/batcher/test/tokens/fa12/storage/CTEZ_storage.mligo similarity index 100% rename from batcher/tokens/fa12/storage/CTEZ_storage.mligo rename to batcher/test/tokens/fa12/storage/CTEZ_storage.mligo diff --git a/batcher/tokens/fa12/storage/KUSD.json b/batcher/test/tokens/fa12/storage/KUSD.json similarity index 100% rename from batcher/tokens/fa12/storage/KUSD.json rename to batcher/test/tokens/fa12/storage/KUSD.json diff --git a/batcher/tokens/fa12/storage/KUSD_storage.mligo b/batcher/test/tokens/fa12/storage/KUSD_storage.mligo similarity index 100% rename from batcher/tokens/fa12/storage/KUSD_storage.mligo rename to batcher/test/tokens/fa12/storage/KUSD_storage.mligo diff --git a/batcher/tokens/fa12/storage/TZBTC.json b/batcher/test/tokens/fa12/storage/TZBTC.json similarity index 100% rename from batcher/tokens/fa12/storage/TZBTC.json rename to batcher/test/tokens/fa12/storage/TZBTC.json diff --git a/batcher/tokens/fa12/storage/tzBTC_storage.mligo b/batcher/test/tokens/fa12/storage/tzBTC_storage.mligo similarity index 100% rename from batcher/tokens/fa12/storage/tzBTC_storage.mligo rename to batcher/test/tokens/fa12/storage/tzBTC_storage.mligo diff --git a/batcher/tokens/fa2/errors.mligo b/batcher/test/tokens/fa2/errors.mligo similarity index 100% rename from batcher/tokens/fa2/errors.mligo rename to batcher/test/tokens/fa2/errors.mligo diff --git a/batcher/tokens/fa2/main.mligo b/batcher/test/tokens/fa2/main.mligo similarity index 100% rename from batcher/tokens/fa2/main.mligo rename to batcher/test/tokens/fa2/main.mligo diff --git a/batcher/tokens/fa2/storage/EURL.json b/batcher/test/tokens/fa2/storage/EURL.json similarity index 100% rename from batcher/tokens/fa2/storage/EURL.json rename to batcher/test/tokens/fa2/storage/EURL.json diff --git a/batcher/tokens/fa2/storage/EURL_storage.mligo b/batcher/test/tokens/fa2/storage/EURL_storage.mligo similarity index 100% rename from batcher/tokens/fa2/storage/EURL_storage.mligo rename to batcher/test/tokens/fa2/storage/EURL_storage.mligo diff --git a/batcher/tokens/fa2/storage/USDT.json b/batcher/test/tokens/fa2/storage/USDT.json similarity index 100% rename from batcher/tokens/fa2/storage/USDT.json rename to batcher/test/tokens/fa2/storage/USDT.json diff --git a/batcher/tokens/fa2/storage/USDT_storage.mligo b/batcher/test/tokens/fa2/storage/USDT_storage.mligo similarity index 100% rename from batcher/tokens/fa2/storage/USDT_storage.mligo rename to batcher/test/tokens/fa2/storage/USDT_storage.mligo From fa5ab1d995f0b4972c57d875a5b5170fc293a571 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Wed, 9 Aug 2023 12:40:36 +0300 Subject: [PATCH 077/108] w --- README.md | 136 +----------------------------- docs/src/CONTRIBUTORS.md | 1 + docs/src/{README.md => DESIGN.md} | 0 docs/src/SUMMARY.md | 9 ++ 4 files changed, 13 insertions(+), 133 deletions(-) create mode 100644 docs/src/CONTRIBUTORS.md rename docs/src/{README.md => DESIGN.md} (100%) diff --git a/README.md b/README.md index adce7501..615aea37 100644 --- a/README.md +++ b/README.md @@ -1,135 +1,5 @@ -# Design document for the Batch Clearing DEX POC +# Batcher -The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. +Batcher is a batch clearing DEX. The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. -> For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price. -> Only the XTZ/USDT pair will be supported for V1 - -After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. - - -## Deposit - -The deposit window is open for a finite time period. During the time period users can deposit their tokens for a BUY or SELL order on the token pair along with an offset to the future received oracle price. - -> For V1, deposit windows won't run sequentially, in that as soon as a deposit window closes another will open straight away. Once the deposit window closes, users will need to wait for that batch to be cleared before another deposit window opens. - -## Waiting - -Once the deposit window has closed there will be a period of 2 minutes prior to awaiting an oracle price. Once that period has elapsed the first received oracle price will close the batch and clearing will start. - -## Clearing - -The clearing process is the process of matching the orders to ensure that all users can trade at the fairest possible price. Upon deposit there will be six categories of order. - -### Side - -Depending on whether you are buying or selling the pair you will either be on the BUY side or the SELL side. For the pair XTZ/USDT, XTZ is the base and USDT is the quote. So if the XTZ/USDT rate was 1.9 you would get 1 unit of XTZ for 1.9 of USDT if I am buying the pair, i.e. on the BUY side. If I am selling the pair, the inverse would be true. The side of the trade is important to understand which token needs to be deposited in a given swap order. - - -### Tolerance - -For any deposit, the user can specify the tolerance to the oracle price that they are willing to trade at. This means that each side can further be segregated into their tolerance levels; $Price_{oracle}-10bps$, $Price_{oracle}$ , $Price_{oracle}+10bps$. - - -### Clearing Level - -Given the three tolerance levels, we need to find the level at which we will clear the most orders; the clearing level. - -Considering that the amount of deposits for each category is different then we have six categories with a differing amount of tokens deposited for each tolerance. - - -| Deposits | P-10bps | P | P+10bps | -|----------|:---------:|----------:|----------:| -| *BUY* | X of USDT | Y of USDT | Z of USDT | -| *SELL* | R of XTZ | S of XTZ | T of XTZ | - - -An added complexity is that if I am will to buy at $Price_{oracle}+10bps$ then I will also be implicitly interested in buying at $Price_{oracle}$ and $Price_{oracle}-10bps$ as they are both cheaper levels if I am on the BUY side. The converse is true for the sell side in that if I sell for $Price_{oracle}-10bps$, then I would be willing to sell for the higher prices of $Price_{oracle}$ and $Price_{oracle}+10bps$. - -#### Determining the clearing level - -| Prices | P-10bps | P | P+10bps | -|----------|:----------------:|----------:|-----------------:| -| *BUY* | P / 1.0001 | P | P * 1.0001 | -| *SELL* | 1.0001 / P | 1/P | 1/ (1.0001 * P) | - - -##### P-10bps level - -Lets take the P-10bps sell level first. All of the buy levels would be interested in buying at that price, so the clearing volume at that level would be: - -$$ CP_{P-10bps} = \min(X + Y + Z, R * \dfrac{ 1.0001 }{P}) $$ - - -##### P level - -Lets take the P sell level first. Only the upper 2 buy levels would be interested in buying at that price, but the lower two SELL levels would be interested in selling so the clearing volume at that level would be: - -$$ CP_{P} = \min(Y + Z, (R+S) * \dfrac{1}{P}) $$ - -##### P+10bps level - -Lets take the P+10bps sell level first. All of the sell levels would be interested in selling at that price, but only the upper BUY level would be interested in buying so the clearing volume at that level would be: - -$$ CP_{P+10bps} = \min(Z, (R+S+T) * \dfrac{1}{(P * 1.0001)}) $$ - -#### Illustrative Examples - -If the Oracle price for XTZ/USDT is 1.9 and the tolerance is +/- 10 basis points, then the six price levels are: - -| Price Levels | BUY | SELL | -|--------------|:------:|:-------:| -|Price + 10bps |1.90019 | 0.52626 | -|Price | 1.9 | 0.52631 | -|Price - 10bps | 1.89981| 0.52636 | - -Assuming these levels we can determine some very basic illustrative examples of different market scenarios: - - -| MARKET | AMOUNTS SKEW | BUY X @ (P-) | BUY Y @ (P) | BUY Z @ (P+) | SELL R @ (P-) | SELL @ S (P) | SELL T @ (P+) | Orders cleared @ P-10bps | Orders cleared @ P | Orders cleared @ P+10bps | Clearance Level | -|---|---|---|---|---|---|---|---|---|---|---|---| -|SELL PRESSUE |CENTERED |55 |100 |45 |1000 |1900 |900 |200 |155 |55 |P-10bps| -|SELL PRESSUE |NEG |100 |55 |45 |1900 |1000 |900 |200 |155 |100 |P-10bps| -|SELL PRESSUE |POS |45 |55 |100 |900 |1000 |1900 |200 |100 |45 |P-10bps| -|BUY PRESSURE |CENTERED |250 |100 |250 |95 |190 |95 |50 |150 |200 |P+10bps| -|BUY PRESSURE |NEG |250 |100 |250 |190 |95 |95 |100 |150 |200 |P+10bps| -|BUY PRESSURE |POS |250 |100 |250 |95 |95 |190 |50 |100 |200 |P+10bps| -|BALANCED |CENTERED |50 |101 |50 |95 |190 |95 |50 |150 |50| P| -|BALANCED |NEG |101| 50| 50| 190|95| 95 |100|150| 101| P| -|BALANCED |POS |50 |50 |101| 95| 95| 190 |50 |100| 50| P| -|BALANCED |OPPOSING (NEG) |50 |50| 101| 190| 95| 95| 100| 100| 50| P-10bps| -|BALANCED |OPPOSING (POS) |101 |50| 50| 95| 95| 190| 50| 100 |101| P+10bps| - -Once we know the clearing level and the volume that can be cleared at that level, we will know how many can be matched (some partially) and those will receive pro-rata execution of their orders. For those that bid outside of the clearing level they will receive their deposits back when they claim. - -> A Google [Sheet](https://docs.google.com/spreadsheets/d/1tWIQEVi2COW3UOH7BPbcNrqe77SsPqZVFqN7nfLe6mc/edit?usp=sharing) with these calculations in is available. -> -## Claiming - -After clearing, users can claim their 'results', whether that be their original deposits, a partially matched order result or a fully filled order for the opposing token. - -# Timelines - - -```mermaid -gantt - dateFormat YYYY-MM-DD - title Timelines for Batcher going to mainnet - excludes weekends - - section Development - End of internal audit :ia, 2023-01-09, 4d - Fee Burning :fb, 2023-01-09, 4d - Oracle :or, 2023-01-09, 10d - Multiple Token Pools (incl. contract management and multisig) :mtp, after fb, 3w - Stabilisation / Final Testing :ft, after mtp, 5d - Mainnet launch :mn, after ft, 3d - - section Engagement - Blog post for fee burning :bpfb, 2023-01-20, 5d - Blog post for token pools :bptp, 2023-01-27, 5d - Blog post for oracle :bpor, 2023-02-10, 5d - Blog post for mainnet :bpmn, 2023-02-20, 5d - -``` +Full documetation can be found [here](https://marigold-dev.github.io/batcher/) diff --git a/docs/src/CONTRIBUTORS.md b/docs/src/CONTRIBUTORS.md new file mode 100644 index 00000000..77e81149 --- /dev/null +++ b/docs/src/CONTRIBUTORS.md @@ -0,0 +1 @@ +# Contributors diff --git a/docs/src/README.md b/docs/src/DESIGN.md similarity index 100% rename from docs/src/README.md rename to docs/src/DESIGN.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index e69de29b..449e42d1 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -0,0 +1,9 @@ +# Summary + +[Design](./DESIGN.md) + + +--- + +[Contributors](CONTRIBUTORS.md) + From 612c9b889a70ca22f9a01150846839cd9e0f6bf2 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Wed, 9 Aug 2023 12:49:53 +0300 Subject: [PATCH 078/108] [1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 615aea37..77205d05 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Batcher -Batcher is a batch clearing DEX. The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. +Batcher is a batch clearing DEX. The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order. -Full documetation can be found [here](https://marigold-dev.github.io/batcher/) +Full documentation can be found [here](https://marigold-dev.github.io/batcher/) From e24bb8b2adb74eead69f549dca7bd256cfa9e4ae Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 10 Aug 2023 13:14:08 +0000 Subject: [PATCH 079/108] Added market maker doc --- .ash_history | 27 +++++++++++++++++++++++++++ docs/src/MARKET_MAKER.md | 12 ++++++++++++ docs/src/SUMMARY.md | 1 + 3 files changed, 40 insertions(+) create mode 100644 docs/src/MARKET_MAKER.md diff --git a/.ash_history b/.ash_history index a3abe509..7f88ac86 100644 --- a/.ash_history +++ b/.ash_history @@ -1 +1,28 @@ exit +oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force +oc gen keys tzthree --sig p256 +ls +oc gen keys --help +oc list keys +oc list known addresses +oc keys +oc export --help +oc list known addresses +oc show address tzthree -S +oc show address tzthree -S --help +oc show address tzthree -S | grep prive +oc show address tzthree -S | grep priv +oc show address tzthree -S | grep Priv +oc show address tzthree -S | grep sec +oc show address tzthree -S +oc show address tzthree -S | grep Secre +oc show address tzthree -S | grep Secre > tz3key.txt +ls +oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force +oc --endpoint "https://mainnet.tezos.marigold.dev" config update +oc --endpoint "https://ghostnet.tezos.marigold.dev" config update +exit +oc --endpoint "https://ghostnet.tezos.marigold.dev" config update +alias oc=octez-client +oc --endpoint "https://ghostnet.tezos.marigold.dev" config update +oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force diff --git a/docs/src/MARKET_MAKER.md b/docs/src/MARKET_MAKER.md new file mode 100644 index 00000000..928bf43d --- /dev/null +++ b/docs/src/MARKET_MAKER.md @@ -0,0 +1,12 @@ +# Community Market Maker + +The community market maker is functionality to allow community members to provide liquidity to Batcher in return for a share of the trading fees. + +## Providing liquidity + +Any user can supply liquidity by depositing tokens into the market vault for that token. In return, the depositor will receive a market vault token that represents the user's share of the vault holdings. The market vault token can be redeemed at any time for the share of the holdings that currently exist in the market vault. + +## Liquidity Injection + +Liquidity in the market vault will be used by Batcher in batches where there is no market on one side of the trading pair. If liquidity is used then all trading fees in that batch will be given to the market vault for the token which was used to supply liquidity. These fees will be sharedo amn + diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 449e42d1..cfb077a3 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,6 +1,7 @@ # Summary [Design](./DESIGN.md) +[Community Market Maker](./MARKET_MAKER.md) --- From e737e4baaa339abc501c4f7785b508e9a87b7cd7 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Thu, 10 Aug 2023 17:30:27 +0300 Subject: [PATCH 080/108] Added market maker doc --- docs/src/MARKET_MAKER.md | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/docs/src/MARKET_MAKER.md b/docs/src/MARKET_MAKER.md index 928bf43d..cdc6d2f9 100644 --- a/docs/src/MARKET_MAKER.md +++ b/docs/src/MARKET_MAKER.md @@ -4,9 +4,41 @@ The community market maker is functionality to allow community members to provid ## Providing liquidity -Any user can supply liquidity by depositing tokens into the market vault for that token. In return, the depositor will receive a market vault token that represents the user's share of the vault holdings. The market vault token can be redeemed at any time for the share of the holdings that currently exist in the market vault. +Any user can supply liquidity by depositing tokens into the market vault for that token. In return, the depositor will receive a market vault token that represents the user's share of the vault holdings. The market vault token can be redeemed at any time for the share of the holdings that currently exist in the market vault. -## Liquidity Injection +## Liquidity Injection -Liquidity in the market vault will be used by Batcher in batches where there is no market on one side of the trading pair. If liquidity is used then all trading fees in that batch will be given to the market vault for the token which was used to supply liquidity. These fees will be sharedo amn +Liquidity in the market vault will be used by Batcher in batches where there is no market on one side of the trading pair. If liquidity is used then all trading fees in that batch will be given to the market vault for the token which was used to supply liquidity. These fees will be shared among the market vault participants according to the percentage of market value token a given user has. The amount of liquidity that is supplied to Batcher will be less than or equal to the position on the opposing size of the trade. This all depends on the liquidity available in the vault at a given time. +### Auto-redemption + +When a batch is cleared that has used the liquidity in a market vault, the order that was placed to supply liquidity will be automatically redeemed. If the order was filled, the tokens redeemed will be stored in the market vault as foreign tokens. For example, if an order supplying liquidity from the tzBTC vault is filled and receives USDT upon redemption then the USDT will be allocated to the tzBTC vault as a foreign token. + +### Auto-exchange of foreign tokens + +If two vaults have a sufficient amount foreign tokens that can be exchanged with each other than Batcher will swap these amounts after receiving a next oracle price for the given pair of tokens. For example, assuming the tzBTC vault holds some USDT as foreign tokens and the USDT vault holds some tzBTC as foreign tokens then these will automatically be swapped between the market vaults using the oracle price. + +## Redemption + +A user can redeem a share of the market vault by depositing an amount of the market vault token which will be burned and the equivalent amount of tokens will be redeemed to the original deposit address. In addition to the redemption of tokens, the share of accumulated fees (in tez) will also will also be returned to the user. + +### Redemption of foreign tokens + +If the market vault holds a number of foreign tokens at the point of redemption then the holdings returned to the user will be the equivalent share of the market vault token along with an equivalent shares of foreign tokens held by the vault. + +## Relationship between vaults. + +There is NO relationship between the market vaults. Each vault is treated independently of each other and as such DOES NOT work like a constant sum or constant product liquidity pool in the traditional sense. + +## Impermanent Loss + +As stated the market vault doesn't work in the same way that a typical liquidity pool does. That said, there are potential loss vectors for a given provider, this will be due to the time that the vault has foreign tokens prior to swapping back to the market token. + +- Loss due to missing out on price appreciation of non-stable token. As an example if a provider has deposited tzBTC in to the tzBTC vault and some of that liquidity has been used in the tzBTC/USDT pair then for an amount of time, the market vault will hold a portion of the original tzBTC as foreign tokens in the form of USDT. If during that period, the price of tzBTC were to rise then the provider would miss out on that price appreciation relative to just holding the original amount of tzBTC. +- Loss due to depreciation of the non-stable token. This is the equivalent to holding something like tzBTC and the price depreciates resulting in a loss. + +Both types of loss are to some degree offset by the reward of trading fees from the use of liquidity within Batcher. + +### Gain + +Whilst a provider can incur losses by providing liquidity, there is also potential for gain (or at least the insulation against loss). Lets assume that some amoutn of the tzBTC vault has been used as liquidity in Batcher. The tzBTC vault will hold an amount of USDT as foreign tokens. If, prior to those tokense bing swapped back to tzBTC, the price of tzBTC depreciates, then at the point of swap the vault will aquire more tzBTC than was previously swapped resulting in a net gain in the quantity of tzBTC. From 31d2879e200faa61e0bc7a7893ec8c3ad0b0ed44 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 14 Aug 2023 20:30:04 +0300 Subject: [PATCH 081/108] Added Add Liquidity enpoint --- batcher/batcher-ghostnet.tz | 8664 +++++++++-------- batcher/batcher-storage-ghostnet.tz | 2 +- batcher/batcher.mligo | 113 +- batcher/market-tokens.mligo | 38 + batcher/package.json | 3 +- batcher/shared.mligo | 18 + .../storage/initial_storage_ghostnet.mligo | 2 + batcher/storage/initial_storage_mainnet.mligo | 2 + 8 files changed, 4691 insertions(+), 4151 deletions(-) create mode 100644 batcher/market-tokens.mligo create mode 100644 batcher/shared.mligo diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index f78414ab..0b46ce9e 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -1,75 +1,85 @@ { parameter - (or (or (or (or (pair %add_or_update_metadata (string %key) (bytes %value)) - (pair %add_token_swap_pair - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits))) - (or (nat %amend_token_and_pair_limit) (pair %cancel string string))) - (or (or (address %change_admin_address) (nat %change_deposit_time_window)) - (or (mutez %change_fee) (address %change_fee_recipient_address)))) - (or (or (or (pair %change_oracle_source_of_pair - (string %pair_name) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision)) - (pair %deposit - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (timestamp %created_at) - (nat %side) - (nat %tolerance))) - (or (string %disable_swap_pair_for_deposit) (string %enable_swap_pair_for_deposit))) - (or (or (unit %redeem) (string %remove_metadata)) - (or (pair %remove_token_swap_pair - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits)) - (string %tick))))) ; + (or (or (or (or (or (pair %addLiquidity + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %add_or_update_metadata (string %key) (bytes %value))) + (or (pair %add_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits)) + (nat %amend_token_and_pair_limit))) + (or (or (pair %cancel string string) (address %change_admin_address)) + (or (nat %change_deposit_time_window) (mutez %change_fee)))) + (or (or (or (address %change_fee_recipient_address) + (pair %change_oracle_source_of_pair + (string %pair_name) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision))) + (or (pair %deposit + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (timestamp %created_at) + (nat %side) + (nat %tolerance)) + (string %disable_swap_pair_for_deposit))) + (or (or (string %enable_swap_pair_for_deposit) (unit %redeem)) + (or (string %remove_metadata) + (pair %remove_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits)))))) + (string %tick)) ; storage (pair (pair (pair (pair (address %administrator) (pair %batch_set @@ -108,23 +118,47 @@ (nat %sell_plus_volume) (nat %sell_total_volume)) (pair %pair string string) - (nat %holdings))))) + (nat %holdings) + (bool %market_vault_used))))) (nat %deposit_time_window_in_seconds) (mutez %fee_in_mutez)) (pair (address %fee_recipient) (nat %last_order_number)) (nat %limit_on_tokens_or_pairs) - (big_map %metadata string bytes)) - (pair (big_map %rates_current + (big_map %market_vaults string - (pair (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when))) + (pair (pair (map %foreign_tokens + string + (pair (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount))) + (pair %native_token + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount))) + (nat %total_shares)))) + (pair (pair (big_map %metadata string bytes) + (big_map %rates_current + string + (pair (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when)))) (big_map %user_batch_ordertypes address (map nat (map (pair (or %side (unit %buy) (unit %sell)) (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) - nat)))) + nat))) + (big_map %user_market_vault_holdings + address + (map string (pair (string %name) (nat %shares))))) (map %valid_swaps string (pair (pair %swap (string %from) (string %to)) @@ -139,40 +173,7 @@ (option %address address) (nat %decimals) (option %standard string)))) ; - code { LAMBDA - (pair nat nat) - nat - { UNPAIR ; - PUSH nat 1 ; - DUG 2 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } } ; - PUSH int 1 ; + code { PUSH int 1 ; PUSH int 10000 ; PAIR ; PUSH int 1 ; @@ -243,660 +244,770 @@ { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; SWAP ; DROP } ; - DIG 4 ; + DIG 3 ; UNPAIR ; IF_LEFT { DIG 2 ; DIG 4 ; - DIG 5 ; - DROP 3 ; + DROP 2 ; IF_LEFT { IF_LEFT { DIG 2 ; DROP ; IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DUP 3 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DUP 6 ; - CAR ; - CDR ; - CDR ; - CDR ; - DUP 6 ; - CAR ; - GET ; - IF_NONE - { DIG 5 ; + { IF_LEFT + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SENDER ; + SELF_ADDRESS ; + DUP 3 ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 4 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DUP 5 ; + CDR ; + DIG 3 ; + DUP 5 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 7 ; + CDR ; + DUP 8 ; + CAR ; + CAR ; + DIG 6 ; + PAIR 3 ; + CONS ; + DUP 5 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 4 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 4 ; CAR ; + GET 3 ; + GET ; + IF_NONE + { DUP 3 ; + CDR ; + DUP 4 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + PAIR ; + PAIR } + { DUP ; DUP 5 ; CDR ; DIG 2 ; CDR ; ADD ; UPDATE 2 } ; + DUP 5 ; CDR ; + CAR ; CDR ; CDR ; + DUP ; + DUP 5 ; + GET ; + IF_NONE + { EMPTY_MAP string (pair string nat) ; + DUP 6 ; + CDR ; + DUP 7 ; + CAR ; + GET 3 ; + PAIR ; + DUP 7 ; + CAR ; + GET 3 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 4 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 7 ; + CAR ; + GET 3 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + DUP 7 ; + CAR ; + GET 3 ; + PAIR ; + DUP 7 ; + CAR ; + GET 3 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 8 ; + CDR ; + DIG 2 ; + CDR ; + ADD ; + UPDATE 2 ; + SOME ; + DUP 7 ; + CAR ; + GET 3 ; + UPDATE } ; + SOME ; + DIG 4 ; + UPDATE } ; + DUP 5 ; DUP 6 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 8 ; + CAR ; + CDR ; + CDR ; CDR ; DIG 6 ; + DIG 8 ; CAR ; + GET 3 ; SWAP ; SOME ; SWAP ; - UPDATE } - { DROP ; - DIG 5 ; - CAR ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; CDR ; + DUP ; + CAR ; + DUP ; CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + DIG 2 ; + CONS } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; CDR ; + DUP ; + CAR ; + DUP ; + CAR ; DUP 6 ; CDR ; - SOME ; - DIG 6 ; CAR ; - UPDATE } ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation ; + CAR ; + CAR ; + DUP 6 ; + CAR ; + GET ; + IF_NONE + { DIG 5 ; + CDR ; + CAR ; + CAR ; + CAR ; + DUP 6 ; + CDR ; + DIG 6 ; + CAR ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DROP ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + CAR ; + DUP 6 ; + CDR ; + SOME ; + DIG 6 ; + CAR ; + UPDATE } ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation } ; PAIR } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - PUSH nat 6 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - GET 7 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 134 ; FAILWITH } - { PUSH nat 6 ; - DUP 2 ; - CAR ; - CDR ; - GET 7 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 134 ; FAILWITH } - { PUSH nat 6 ; - DUP 2 ; - GET 7 ; - COMPARE ; - NEQ ; - IF { DROP 2 ; PUSH nat 133 ; FAILWITH } - { DUP 2 ; - CDR ; - CDR ; - CDR ; - DUP 3 ; - CDR ; - CDR ; - CAR ; - DUP 4 ; - CAR ; - CDR ; - CDR ; - CAR ; - DUP 4 ; - CAR ; - DUP ; - CAR ; - CAR ; - DUP 2 ; - CDR ; - DUP 4 ; - PUSH nat 1 ; - DUP 7 ; - SIZE ; - ADD ; - COMPARE ; - GT ; - IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } - { PUSH bool False ; - DUP 7 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - PUSH bool False ; - DUP 8 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - AND ; - IF { PUSH nat 0 } - { PUSH bool False ; - DUP 7 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - PUSH bool False ; - DUP 8 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - OR ; - IF { PUSH nat 1 } { PUSH nat 2 } } ; - DIG 4 ; - SWAP ; - DUP 7 ; - SIZE ; - ADD ; - COMPARE ; - GT ; - IF { PUSH nat 126 ; FAILWITH } {} } ; - DUP 3 ; - CDR ; - GET 3 ; - DIG 3 ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP 4 ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; - DUP 2 ; - DUP 2 ; - COMPARE ; - GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE - { DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; - DUP ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DUP 2 ; DIG 2 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 6 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + CAR ; + CDR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + GET 7 ; + COMPARE ; + NEQ ; + IF { DROP 2 ; PUSH nat 133 ; FAILWITH } + { DUP 2 ; + CDR ; + CDR ; + CDR ; DUP 3 ; - CAR ; - DUP ; CDR ; - GET 3 ; - SWAP ; - CAR ; + CDR ; CAR ; - GET 3 ; - PAIR ; - DIG 2 ; DUP 4 ; - GET 8 ; - DUP 5 ; - GET 7 ; - DUP 6 ; - GET 5 ; - DUP 7 ; - GET 3 ; - DIG 7 ; CAR ; - DUP ; CDR ; - GET 3 ; - SWAP ; + CDR ; CAR ; + DUP 4 ; + CAR ; + DUP ; CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; - DUP 3 ; CAR ; - DIG 3 ; - CDR ; - DUP 2 ; DUP 2 ; + CDR ; + DUP 4 ; + PUSH nat 1 ; + DUP 7 ; + SIZE ; + ADD ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - PAIR } - { DROP 6 ; PUSH nat 116 ; FAILWITH } ; - UNPAIR ; - DUP 3 ; - DIG 3 ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - NIL operation ; - PAIR } } } } } - { IF_LEFT - { DIG 2 ; - DROP ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CDR ; - SIZE ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 128 ; FAILWITH } - { DUP 2 ; - CDR ; - CDR ; - CAR ; - SIZE ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 129 ; FAILWITH } - { DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation ; - PAIR } } } - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SENDER ; - DUP 2 ; - UNPAIR ; - DUP 5 ; - CDR ; - CDR ; - CAR ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 117 ; FAILWITH } - { DUP 4 ; - CDR ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - NOW ; - DUP 5 ; - CAR ; - CAR ; - CDR ; + IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } + { PUSH bool False ; + DUP 7 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 8 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + AND ; + IF { PUSH nat 0 } + { PUSH bool False ; + DUP 7 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 8 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 6 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 7 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 8 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 8 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + OR ; + IF { PUSH nat 1 } { PUSH nat 2 } } ; + DIG 4 ; + SWAP ; + DUP 7 ; + SIZE ; + ADD ; + COMPARE ; + GT ; + IF { PUSH nat 126 ; FAILWITH } {} } ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 4 ; + DUP 2 ; + CAR ; + DIG 2 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DUP 2 ; DIG 2 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DIG 2 ; + DUP 4 ; + GET 8 ; + DUP 5 ; + GET 7 ; + DUP 6 ; + GET 5 ; + DUP 7 ; + GET 3 ; + DIG 7 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP 3 ; + CAR ; + DIG 3 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + PAIR } + { DROP 6 ; PUSH nat 116 ; FAILWITH } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } } } } + { DUP 2 ; CAR ; - DUP 6 ; CAR ; CAR ; CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; CDR ; CDR ; - DUP 7 ; - CAR ; - CAR ; - CAR ; CDR ; - CAR ; - DUP 7 ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 128 ; FAILWITH } + { DUP 2 ; + CDR ; + CDR ; + CAR ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 129 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } } } + { IF_LEFT + { IF_LEFT + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SENDER ; + DUP 2 ; UNPAIR ; - DUP ; + DUP 5 ; + CDR ; + CDR ; + CAR ; + DUP 3 ; DUP 3 ; COMPARE ; GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE - { DROP ; - DUP 5 ; - CAR ; - CAR ; - CAR ; + { DROP 4 ; PUSH nat 117 ; FAILWITH } + { DUP 4 ; + CDR ; + CDR ; CDR ; - PUSH nat 0 ; DUP 2 ; CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH nat 0 ; - DIG 6 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; DUP 2 ; - DUP 3 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; DUP 3 ; - SOME ; + GET 8 ; DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + NOW ; + DUP 5 ; CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; CAR ; - DUP 3 ; + CDR ; CAR ; - SOME ; - DUP 4 ; - GET 7 ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 7 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 7 ; UNPAIR ; DUP ; DUP 3 ; @@ -904,3591 +1015,3864 @@ GT ; IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DUP ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH bool False ; + PUSH nat 0 ; + DIG 7 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH bool False ; + PUSH nat 0 ; + DIG 7 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } + { DIG 6 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DIG 3 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; + SWAP ; + DUP ; GET 3 ; IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - DUP 5 ; - CAR ; - CAR ; + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + NOT ; + IF { PUSH nat 140 ; FAILWITH } {} ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 5 ; + GET ; + IF_NONE + { DROP 6 ; PUSH nat 139 ; FAILWITH } + { DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } + { DUP 8 ; + DUP 9 ; + CDR ; + DUP ; CAR ; + DUP ; + CDR ; + DIG 11 ; CDR ; - PUSH nat 0 ; - DUP 2 ; CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH nat 0 ; - DIG 6 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; - DUP 2 ; - DUP 3 ; CDR ; - DUP 3 ; - SOME ; - DUP 4 ; CAR ; + DIG 7 ; + DIG 7 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + DUP 11 ; UPDATE ; - UPDATE 1 } - { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } - { DIG 6 ; - DROP ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP ; + PAIR } ; + UNPAIR ; DUP 3 ; - INT ; - ADD ; - DIG 3 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; - SWAP ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - NOT ; - IF { PUSH nat 140 ; FAILWITH } {} ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - DUP 5 ; - GET ; - IF_NONE - { DROP 6 ; PUSH nat 139 ; FAILWITH } - { DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } - { DUP 8 ; - DUP 9 ; - CDR ; - DUP ; - CAR ; - DIG 10 ; - CDR ; - CAR ; - CDR ; - DIG 6 ; - DIG 6 ; - NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - SWAP ; - UPDATE ; - SOME ; - DUP 10 ; - UPDATE ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - SWAP ; - PAIR } ; - UNPAIR ; - DUP 3 ; - GET 5 ; - DUP 2 ; - ITER { UNPAIR ; - UNPAIR ; - IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - SUB ; - ABS ; - SWAP ; + GET 5 ; + DUP 2 ; + ITER { UNPAIR ; + UNPAIR ; IF_LEFT - { IF_LEFT - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 3 ; - SUB ; - ABS ; - UPDATE 3 ; - SWAP ; - UPDATE 7 } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + SUB ; + ABS ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 3 ; + SUB ; + ABS ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + CAR ; + SUB ; + ABS ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } { DROP ; DUP 3 ; DIG 2 ; DIG 3 ; - CAR ; + GET 5 ; SUB ; ABS ; - UPDATE 1 ; + UPDATE 5 ; SWAP ; UPDATE 7 } } { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 5 ; + DUP 2 ; + DUP 4 ; + GET 14 ; SUB ; ABS ; - UPDATE 5 ; SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 14 ; - SUB ; - ABS ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 11 ; - SUB ; - ABS ; - UPDATE 11 ; - SWAP ; - UPDATE 14 } + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 11 ; + SUB ; + ABS ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 9 ; + SUB ; + ABS ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } { DROP ; DUP 3 ; DIG 2 ; DIG 3 ; - GET 9 ; + GET 13 ; SUB ; ABS ; - UPDATE 9 ; + UPDATE 13 ; SWAP ; - UPDATE 14 } } - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 13 ; - SUB ; - ABS ; - UPDATE 13 ; - SWAP ; - UPDATE 14 } } } ; - DIG 3 ; - SWAP ; - UPDATE 5 ; - DUP 3 ; - DIG 3 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 7 ; - DIG 7 ; - CDR ; - DUP 7 ; - SOME ; - DIG 7 ; - CAR ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - PUSH mutez 0 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - PAIR ; - DIG 2 ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 3 ; - DIG 3 ; - CAR ; - IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; - PAIR ; - PAIR ; - DUP 6 ; - SWAP ; - EXEC ; - DUP 3 ; - CAR ; - CAR ; - CDR ; - CDR ; - DIG 2 ; - ADD ; - SWAP ; - PAIR } ; - DIG 2 ; - DIG 4 ; - DROP 2 ; - UNPAIR ; - SELF_ADDRESS ; - NIL operation ; - DIG 2 ; - ITER { CDR ; - DUP ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 2 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 2 ; - CDR ; - DUP 8 ; - DUP 6 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 5 ; - CDR ; - DIG 5 ; - CAR ; - CAR ; - DUP 11 ; - PAIR 3 ; - CONS ; - DUP 6 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - CONS } ; - SWAP ; - DIG 4 ; - DROP 2 ; - PUSH mutez 0 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CDR ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; - CONS } - { SWAP ; DROP } ; - PAIR } } } } } - { DIG 2 ; - DROP ; - IF_LEFT - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CAR ; - CDR ; - CAR ; - CAR ; - DUP 2 ; - COMPARE ; - EQ ; - IF { PUSH nat 144 ; FAILWITH } {} ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - PUSH nat 600 ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 131 ; FAILWITH } - { PUSH nat 3600 ; - DUP 2 ; - COMPARE ; - GT ; - IF { DROP 2 ; PUSH nat 132 ; FAILWITH } - { DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } } } } - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - DUP 2 ; - COMPARE ; - EQ ; - IF { PUSH nat 144 ; FAILWITH } {} ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } ; - NIL operation ; - PAIR } } } - { IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - IF_LEFT - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP ; - GET 3 ; - DUP 2 ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 123 ; FAILWITH } { DROP } ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CDR ; - DIG 5 ; - CDR ; - CDR ; - CAR ; - DIG 4 ; - DUP 6 ; - GET 3 ; - UPDATE 3 ; - DUP 6 ; - GET 5 ; - UPDATE 5 ; - DUP 6 ; - GET 6 ; - UPDATE 7 ; - SOME ; - DIG 5 ; - CAR ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - NIL operation ; - PAIR } - { DUP ; - GET 5 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit } - { PUSH nat 1 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - SWAP ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - NOW ; - DUP 4 ; - CDR ; - CDR ; - CAR ; - DUP 3 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - GET 8 ; - IF { DROP 4 ; PUSH nat 125 ; FAILWITH } - { DUP 4 ; - CAR ; - CAR ; - CDR ; - CDR ; - AMOUNT ; - DUP 2 ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 6 ; PUSH nat 113 ; FAILWITH } - { COMPARE ; - GT ; - IF { DROP 4 ; PUSH nat 130 ; FAILWITH } - { DUP 4 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 5 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { DROP ; - DUP 4 ; + UPDATE 14 } } } ; + PUSH nat 1 ; + DUP 5 ; + GET 9 ; + SUB ; + ABS ; + DIG 4 ; + DIG 2 ; + UPDATE 5 ; + SWAP ; + UPDATE 9 ; + DUP 3 ; + DIG 3 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 7 ; + DIG 7 ; + CDR ; + DUP 7 ; + SOME ; + DIG 7 ; + CAR ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + PUSH mutez 0 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + PAIR ; + DIG 2 ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 3 ; + DIG 3 ; CAR ; + IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; + PAIR ; + PAIR ; + DUP 6 ; + SWAP ; + EXEC ; + DUP 3 ; CAR ; CAR ; CDR ; - PUSH nat 0 ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH nat 0 ; - DUP 5 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; - DUP 2 ; - DUP 3 ; CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; + ADD ; + SWAP ; + PAIR } ; + DIG 2 ; + DIG 4 ; + DROP 2 ; + UNPAIR ; + SELF_ADDRESS ; + NIL operation ; + DIG 2 ; + ITER { CDR ; DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - PUSH nat 0 ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH nat 0 ; - DUP 5 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } - { DUP 3 ; - INT ; - ADD ; - DIG 3 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; - SWAP ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - IF { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - IF { DIG 2 ; DROP } - { DUP 5 ; - CDR ; - CDR ; - CAR ; - DIG 3 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 124 ; FAILWITH } {} ; - CAR ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - INT ; - NOW ; - SUB ; - COMPARE ; - LT ; - IF {} { PUSH nat 120 ; FAILWITH } } ; - DUP 4 ; - DIG 4 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP 2 ; - CAR ; - PUSH nat 1 ; - DUP 3 ; - CAR ; - CDR ; - CAR ; - CDR ; - ADD ; - DUP 6 ; - GET 5 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit } - { PUSH nat 1 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 7 ; - GET 6 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; RIGHT unit ; LEFT unit } - { PUSH nat 1 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit ; LEFT unit } - { PUSH nat 2 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; - SENDER ; - DUP 6 ; - CDR ; - CDR ; - CDR ; - DUP 10 ; - CAR ; - DUP ; - CAR ; - CAR ; - DUP 2 ; - CDR ; - DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DUP ; - GET 8 ; - DUP 4 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 2 ; - GET 7 ; - DUP 5 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 5 ; - DUP 6 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 3 ; - DUP 7 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 4 ; - CAR ; - DIG 6 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 2 ; - GET 8 ; - DUP 4 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 5 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 6 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 7 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DIG 6 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - AND ; - IF { DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP 7 ; - CDR ; - CDR ; - CAR ; - DUP 5 ; - IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - MEM ; - IF {} { PUSH nat 110 ; FAILWITH } } - { DROP ; PUSH nat 110 ; FAILWITH } } } ; - PUSH bool False ; - DIG 2 ; - DIG 3 ; - DIG 9 ; - CAR ; - DIG 4 ; - DUP 7 ; - DUP 7 ; - PAIR 7 ; - DUP 4 ; - CDR ; - CAR ; - CDR ; - DUP 2 ; - GET 5 ; - GET ; - IF_NONE - { PUSH bool True } - { PUSH nat 0 ; - SWAP ; - ITER { CDR ; SIZE ; ADD } ; - PUSH nat 10 ; - SWAP ; - COMPARE ; - LE } ; - IF { DUP 5 ; - GET 5 ; - DUP 2 ; - GET 9 ; - IF_LEFT - { DROP ; - DUP 2 ; - GET 7 ; - CAR ; - CDR ; - DUP 2 ; - GET 7 ; - ADD ; - DUP 3 ; - GET 11 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 3 ; - ADD ; - UPDATE 3 ; - SWAP ; - UPDATE 7 } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; + CDR ; + DUP 8 ; + DUP 6 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; CDR ; - DIG 3 ; - CAR ; - ADD ; - UPDATE 1 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 5 ; - ADD ; - UPDATE 5 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - GET 7 ; - CAR ; - CDR ; - DUP 2 ; - GET 14 ; - ADD ; - DUP 3 ; - GET 11 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; + DIG 5 ; CAR ; - CDR ; - DIG 3 ; - GET 11 ; - ADD ; - UPDATE 11 ; - SWAP ; - UPDATE 14 } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; CAR ; - CDR ; - DIG 3 ; - GET 9 ; - ADD ; - UPDATE 9 ; - SWAP ; - UPDATE 14 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 13 ; - ADD ; - UPDATE 13 ; - SWAP ; - UPDATE 14 } } ; - DUP 7 ; - CDR ; - DIG 6 ; - DIG 2 ; - UPDATE 5 ; - SOME ; - DUP 5 ; - UPDATE ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - DUP 3 ; - GET 5 ; - GET ; - IF_NONE - { DUP ; - DUP 5 ; - GET ; - IF_NONE - { DROP ; PUSH nat 142 ; FAILWITH } - { PUSH nat 1 ; DUP 2 ; GET 8 ; ADD ; UPDATE 8 ; SOME ; DUP 5 ; UPDATE } } - { DUP 5 ; - GET ; - IF_NONE - { DUP ; - DUP 5 ; - GET ; - IF_NONE - { DROP ; PUSH nat 142 ; FAILWITH } - { PUSH nat 1 ; DUP 2 ; GET 8 ; ADD ; UPDATE 8 ; SOME ; DUP 5 ; UPDATE } } - { DROP } } ; - DUP 2 ; - GET 5 ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE - { DUP 6 ; - CDR ; - CAR ; - CDR ; - EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 6 ; - GET 7 ; - CAR ; - CDR ; - DUP 7 ; - GET 11 ; - DUP 8 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 7 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 2 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP ; - DUP 7 ; - GET ; - IF_NONE - { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 5 ; - GET 7 ; - CAR ; - CDR ; - DUP 6 ; - GET 11 ; - DUP 7 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 6 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP 5 ; - GET 11 ; - DUP 6 ; - GET 9 ; - PAIR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; - SOME ; - DIG 6 ; - UPDATE } ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - SWAP ; - SOME ; - DIG 2 ; - UPDATE } ; - DUP 5 ; - DIG 5 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 8 ; - DIG 6 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP ; - CAR ; - DUP ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - DUP 3 ; - GET 7 ; - CAR ; - SELF_ADDRESS ; - DUP 2 ; - CAR ; - GET 5 ; - IF_NONE - { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 5 ; - GET 5 ; - DUP 4 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 4 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - SWAP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 4 ; - CDR ; - DIG 4 ; - DIG 4 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { SWAP ; - CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 7 ; - CDR ; - DIG 7 ; - CAR ; - CAR ; - DIG 7 ; - PAIR 3 ; - CONS ; - DIG 4 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 2 ; - DIG 2 ; - CDR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - DIG 2 ; - CONS ; - PAIR } - { DROP 6 ; PUSH nat 112 ; FAILWITH } } - { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } } - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CDR ; - DIG 5 ; - CDR ; - CDR ; - CAR ; - DIG 4 ; - PUSH bool True ; - UPDATE 8 ; - SOME ; - DIG 5 ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CDR ; - DIG 5 ; - CDR ; - CDR ; - CAR ; - DIG 4 ; - PUSH bool False ; - UPDATE 8 ; - SOME ; - DIG 5 ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 } ; - NIL operation ; - PAIR } } + DUP 11 ; + PAIR 3 ; + CONS ; + DUP 6 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + SWAP ; + DIG 4 ; + DROP 2 ; + PUSH mutez 0 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CDR ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { SWAP ; DROP } ; + PAIR } } } + { DIG 2 ; + DROP ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CAR ; + CDR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } + { DIG 2 ; + DROP ; + IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 600 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 131 ; FAILWITH } + { PUSH nat 3600 ; + DUP 2 ; + COMPARE ; + GT ; + IF { DROP 2 ; PUSH nat 132 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } } { IF_LEFT { DIG 2 ; - DIG 4 ; - DROP 2 ; + DROP ; IF_LEFT - { DROP ; - SENDER ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SELF_ADDRESS ; - PUSH mutez 0 ; - PUSH mutez 0 ; - PAIR ; - DUP 4 ; - CAR ; - CDR ; - CAR ; - CAR ; - DUP 4 ; - PAIR ; - PAIR ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - DUP ; - DUP 6 ; - GET ; - IF_NONE - { DIG 6 ; - DIG 7 ; - DROP 2 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; DIG 2 ; - PAIR ; - SWAP } - { DUP 7 ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } + { DUP 2 ; + CAR ; CAR ; CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; CDR ; CDR ; - DIG 4 ; - PAIR ; - DUP 7 ; + CAR ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 3 ; + DUP 2 ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 123 ; FAILWITH } { DROP } ; + DUP 3 ; + DUP 4 ; CDR ; + DUP ; + CDR ; + DIG 5 ; CDR ; CDR ; + CAR ; DIG 4 ; - PAIR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 4 ; - PAIR ; - PAIR ; + DUP 6 ; + GET 3 ; + UPDATE 3 ; + DUP 6 ; + GET 5 ; + UPDATE 5 ; + DUP 6 ; + GET 6 ; + UPDATE 7 ; + SOME ; + DIG 5 ; + CAR ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 } ; + NIL operation ; + PAIR } + { IF_LEFT + { DUP ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 2 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; PAIR ; SWAP ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 4 ; - UNPAIR ; - DUP 3 ; - CDR ; - DUP ; - DUP 9 ; - GET ; - IF_NONE - { DIG 7 ; DIG 8 ; DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { CAR ; CDR ; SOME } + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + NOW ; + DUP 4 ; + CDR ; + CDR ; + CAR ; + DUP 3 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + GET 8 ; + IF { DROP 4 ; PUSH nat 125 ; FAILWITH } + { DUP 4 ; + CAR ; + CAR ; + CDR ; + CDR ; + AMOUNT ; + DUP 2 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 6 ; PUSH nat 113 ; FAILWITH } + { COMPARE ; + GT ; + IF { DROP 4 ; PUSH nat 130 ; FAILWITH } + { DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 6 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 5 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE { DROP ; - NONE (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp)) } } - { DROP ; - NONE (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp)) } ; - IF_NONE - { SWAP ; DIG 8 ; DIG 9 ; DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP 5 ; - DIG 4 ; - PAIR ; - DUP 7 ; - DUP 4 ; - GET 5 ; - PAIR ; - DIG 9 ; - DIG 3 ; - PAIR ; - PAIR ; - PAIR ; - DIG 8 ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 4 ; - UNPAIR ; - PUSH nat 0 ; - DUP 4 ; - GET 7 ; - COMPARE ; - EQ ; - IF { PUSH bool False } - { PUSH nat 0 ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH bool False ; + PUSH nat 0 ; + DUP 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; DUP 4 ; - GET 14 ; - COMPARE ; - EQ ; - IF { PUSH bool False } - { DUP 7 ; - CDR ; - DUP 6 ; - GET 3 ; - DUP 9 ; - CAR ; - IF_LEFT - { DROP ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool True } } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } } } - { DROP ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool False } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool True } } - { DROP ; PUSH bool False } } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool True } } } } } ; - IF { DUP 5 ; - GET 6 ; CAR ; - DUP 5 ; - DUP 2 ; CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 6 ; - DIG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 8 ; CAR ; - IF_LEFT - { DROP ; - DUP 7 ; - GET 5 ; - DUP ; - GET 5 ; - INT ; - SWAP ; - GET 3 ; - INT ; - DIG 10 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - GET 6 ; - GET 3 ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - DUP ; - CDR ; - DUP 4 ; - CDR ; - MUL ; - DUP 4 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - DIG 2 ; - CDR ; - DIG 4 ; - CAR ; - MUL ; - SUB ; - PAIR ; - PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 25 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PUSH nat 0 ; - DUP 2 ; - CDR ; - COMPARE ; - GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; - PUSH int 1 ; - PUSH int 0 ; - PAIR ; - DUP ; - CAR ; - DUP 4 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 4 ; - CAR ; - MUL ; - COMPARE ; - LE ; - NOT ; - IF { PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 23 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } - { SWAP ; DIG 2 ; DROP 2 } } - { DROP ; - DUP 7 ; - GET 5 ; - DUP ; - CAR ; - INT ; - SWAP ; - GET 6 ; - INT ; - DIG 10 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - GET 6 ; - GET 3 ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - DUP ; - CDR ; - DUP 4 ; - CDR ; - MUL ; - DUP 4 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - DIG 2 ; - CDR ; - DIG 4 ; - CAR ; - MUL ; - SUB ; - PAIR ; - PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 25 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 3 ; - PAIR ; - PUSH nat 0 ; - DUP 2 ; - CDR ; - COMPARE ; - GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; - PUSH int 1 ; - PUSH int 0 ; - PAIR ; - DUP ; - CAR ; - DUP 4 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 4 ; - CAR ; - MUL ; - COMPARE ; - LE ; - NOT ; - IF { PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 23 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } - { SWAP ; DIG 2 ; DROP 2 } } ; - DUP 3 ; - DUP 3 ; - CDR ; CDR ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; ADD ; + PUSH bool False ; + PUSH nat 0 ; + DUP 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; DUP 3 ; - DIG 3 ; CDR ; - DIG 2 ; - UPDATE 2 ; - UPDATE 2 ; - SWAP } - { DUP 5 ; - GET 6 ; + DUP 3 ; + SOME ; + DUP 4 ; CAR ; - DIG 7 ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; CAR ; - IF_LEFT - { DROP ; - DUP 5 ; - SWAP ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} } - { DROP ; - DUP 5 ; - SWAP ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; DUP 3 ; - DUP 3 ; - CDR ; CAR ; - ADD ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; DUP 3 ; - DIG 3 ; - CDR ; - DIG 2 ; - UPDATE 1 ; - UPDATE 2 ; - DIG 6 ; - DIG 7 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } ; - DUG 2 ; - PAIR ; - DIG 3 ; - DIG 3 ; - PAIR ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - PAIR } ; - UNPAIR ; - CAR ; - CDR ; - SWAP ; - CAR ; - DUP 3 ; - CAR ; - DUP 5 ; - DUP 2 ; - GET ; - IF_NONE - { DIG 4 ; DROP 2 ; PUSH nat 141 ; FAILWITH } - { PUSH nat 1 ; - DUP 2 ; - GET 8 ; - SUB ; - ABS ; - DIG 6 ; - DUG 2 ; - UPDATE 8 ; - SOME ; - DIG 2 ; - UPDATE } ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DROP 2 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } + { DUP 3 ; + INT ; + ADD ; + DIG 3 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; + SWAP ; DUP ; - DUP 5 ; - CAR ; - GET ; - IF_NONE - { PUSH nat 141 ; FAILWITH } - { PUSH nat 0 ; SWAP ; GET 8 ; COMPARE ; LE } ; - DIG 5 ; - DIG 3 ; - PAIR ; - DIG 6 ; - DIG 2 ; - IF { DIG 2 ; - DROP ; - DUP 5 ; - DIG 5 ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DIG 2 ; DROP } + { DUP 5 ; + CDR ; + CDR ; + CAR ; + DIG 3 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 124 ; FAILWITH } {} ; + CAR ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } } ; + DUP 4 ; + DIG 4 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP 2 ; + CAR ; + PUSH nat 1 ; + DUP 3 ; + CAR ; CDR ; - DIG 5 ; CAR ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat) ; - SWAP ; - UPDATE ; - UPDATE 2 } - { DIG 4 ; DROP ; DIG 4 ; DIG 3 ; UPDATE 2 } ; - PAIR ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - SWAP ; - UPDATE } } ; - PAIR ; - PAIR ; - PAIR } ; - DIG 5 ; - DIG 6 ; - DROP 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - CAR ; - DIG 3 ; - CAR ; - DIG 3 ; - DIG 2 ; - PAIR ; - DIG 3 ; - DIG 3 ; - SOME ; - DUP 6 ; - UPDATE } ; - DUG 2 ; - UNPAIR ; - NIL operation ; - DIG 2 ; - ITER { CDR ; - DUP ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 2 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 2 ; - CDR ; - DUP 9 ; - DUP 9 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 5 ; - CDR ; - DIG 5 ; - CAR ; - CAR ; - DUP 12 ; - PAIR 3 ; - CONS ; - DUP 9 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - CONS } ; - DIG 4 ; - DIG 5 ; - DROP 2 ; - PUSH mutez 0 ; - DUP 4 ; - CDR ; - CAR ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { PUSH nat 102 ; FAILWITH } - { DUP 4 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; - CONS } - {} ; - PUSH mutez 0 ; - DUP 4 ; - CDR ; - CDR ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CDR ; - CONTRACT unit ; - IF_NONE - { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; - CONS } - { DIG 2 ; DROP } ; - DUP 4 ; - DIG 4 ; - CDR ; - DUP ; - CAR ; - DIG 5 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 5 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - SWAP } - { DIG 2 ; - DIG 3 ; - DROP 2 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DUP 3 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 5 ; - CAR ; - CDR ; - CDR ; - CDR ; - DIG 5 ; - NONE bytes ; - SWAP ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation } ; - PAIR } - { DIG 3 ; - DROP ; - IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DROP 3 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP ; - GET 8 ; - IF {} { PUSH nat 137 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - SWAP ; - DUP 3 ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - GET ; - IF_NONE - { DROP 2 ; PUSH nat 117 ; FAILWITH } - { DROP ; - DUP 3 ; - CDR ; - CDR ; - CDR ; - DIG 2 ; + CDR ; + ADD ; + DUP 6 ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 7 ; + GET 6 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; RIGHT unit ; LEFT unit } + { PUSH nat 1 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit ; LEFT unit } + { PUSH nat 2 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; + SENDER ; + DUP 6 ; + CDR ; + CDR ; + CDR ; + DUP 10 ; + CAR ; + DUP ; + CAR ; + CAR ; + DUP 2 ; + CDR ; + DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DUP ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 2 ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + AND ; + IF { DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 7 ; + CDR ; + CDR ; + CAR ; + DUP 5 ; + IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + MEM ; + IF {} { PUSH nat 110 ; FAILWITH } } + { DROP ; PUSH nat 110 ; FAILWITH } } } ; + PUSH bool False ; + DIG 2 ; + DIG 3 ; + DIG 9 ; + CAR ; + DIG 4 ; + DUP 7 ; + DUP 7 ; + PAIR 7 ; + DUP 4 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET 5 ; + GET ; + IF_NONE + { PUSH bool True } + { PUSH nat 0 ; + SWAP ; + ITER { CDR ; SIZE ; ADD } ; + PUSH nat 10 ; + SWAP ; + COMPARE ; + LE } ; + IF { DUP 5 ; + GET 5 ; + DUP 2 ; + GET 9 ; + IF_LEFT + { DROP ; + DUP 2 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 7 ; + ADD ; + DUP 3 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 3 ; + ADD ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + CAR ; + ADD ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 5 ; + ADD ; + UPDATE 5 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 14 ; + ADD ; + DUP 3 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 11 ; + ADD ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 9 ; + ADD ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 13 ; + ADD ; + UPDATE 13 ; + SWAP ; + UPDATE 14 } } ; + DUP 7 ; + CDR ; + DIG 6 ; + DIG 2 ; + UPDATE 5 ; + SOME ; + DUP 5 ; + UPDATE ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + GET 5 ; + GET ; + IF_NONE + { DUP ; + DUP 5 ; + GET ; + IF_NONE + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } + { DUP 5 ; + GET ; + IF_NONE + { DUP ; + DUP 5 ; + GET ; + IF_NONE + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } + { DROP } } ; + DUP 2 ; + GET 5 ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 6 ; + GET 7 ; + CAR ; + CDR ; + DUP 7 ; + GET 11 ; + DUP 8 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 7 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 2 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 7 ; + GET ; + IF_NONE + { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DUP 6 ; + GET 11 ; + DUP 7 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP 5 ; + GET 11 ; + DUP 6 ; + GET 9 ; + PAIR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; + SOME ; + DIG 6 ; + UPDATE } ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + CAR ; + SWAP ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 8 ; + DIG 6 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP 3 ; + GET 7 ; + CAR ; + SELF_ADDRESS ; + DUP 2 ; + CAR ; + GET 5 ; + IF_NONE + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; + GET 5 ; + DUP 4 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 4 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + SWAP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 4 ; + CDR ; + DIG 4 ; + DIG 4 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { SWAP ; + CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 7 ; + CDR ; + DIG 7 ; + CAR ; + CAR ; + DIG 7 ; + PAIR 3 ; + CONS ; + DIG 4 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 2 ; + DIG 2 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 5 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + DIG 2 ; + CONS ; + PAIR } + { DROP 6 ; PUSH nat 112 ; FAILWITH } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } + { DUP 2 ; CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; CAR ; CAR ; - GET 3 ; - PAIR ; - DUP ; CAR ; - DUP 2 ; - CDR ; - DIG 4 ; - DUP 3 ; - DUP 3 ; + SENDER ; COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - NONE (pair (pair string string) address string nat bool) ; - SWAP ; - UPDATE ; - DUP 3 ; - DUP 3 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 3 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 6 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 7 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP ; DIG 2 } - { DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP ; DIG 2 } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { DIG 3 ; - DIG 2 ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 3 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP } - { DUP ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { SWAP ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - SWAP ; - PAIR } ; - UNPAIR ; - DUP 3 ; - DIG 3 ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - NIL operation ; - PAIR } - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE - { DROP 5 ; PUSH nat 117 ; FAILWITH } - { DUP 3 ; - CDR ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; CDR ; CDR ; - DUP 2 ; CAR ; DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - DUP ; - GET 8 ; - DUP 2 ; - GET 7 ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; DUP 3 ; - GET 5 ; DUP 4 ; - GET 3 ; - DUP 5 ; - CAR ; - DUP ; CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 122 ; FAILWITH } {} ; - UNPAIR ; - DUP 5 ; CDR ; - CAR ; - CAR ; - DUP 5 ; - GET ; - IF_NONE - {} - { DUP 2 ; - SWAP ; - GET 4 ; - COMPARE ; - GE ; - IF { PUSH nat 121 ; FAILWITH } {} } ; - DUP 5 ; - CAR ; - CAR ; + DIG 5 ; + CDR ; CDR ; CAR ; - INT ; + DIG 4 ; + PUSH bool True ; + UPDATE 8 ; + SOME ; + DIG 5 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } } } + { IF_LEFT + { IF_LEFT + { DIG 2 ; + DROP ; DUP 2 ; - SWAP ; - NOW ; - SUB ; - COMPARE ; - LT ; - IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; - CAR ; - DIG 3 ; - GET 7 ; - DUP ; - DUP 3 ; CAR ; CAR ; - GET 7 ; - COMPARE ; - GT ; - IF { DUP 2 ; - CAR ; - CAR ; - GET 7 ; - SUB ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - DIG 3 ; - MUL ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 2 ; - CAR ; - CAR ; - GET 7 ; - INT ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; - INT ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; + CDR ; + CDR ; CAR ; DUP 2 ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CDR ; + DIG 5 ; CDR ; - MUL ; - DIG 2 ; CDR ; - DIG 2 ; CAR ; - MUL ; + DIG 4 ; + PUSH bool False ; + UPDATE 8 ; + SOME ; + DIG 5 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation } + { DROP ; + SENDER ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SELF_ADDRESS ; + PUSH mutez 0 ; + PUSH mutez 0 ; PAIR ; - DIG 2 ; - SWAP ; - DUP 3 ; + DUP 4 ; + CAR ; CDR ; - GET 3 ; - DIG 3 ; CAR ; CAR ; - GET 3 ; + DUP 4 ; PAIR ; - PAIR 3 ; - DUP 3 ; + PAIR ; + DUP 4 ; + CAR ; + CAR ; + CAR ; CDR ; + DUP 5 ; CDR ; + CAR ; CDR ; - DUP 2 ; CAR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 2 ; - DUP 2 ; - CAR ; + DUP 7 ; GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + IF_NONE + { DIG 7 ; DROP ; DIG 2 ; PAIR ; SWAP } + { DUP 8 ; + CAR ; + CAR ; + CDR ; + CDR ; + DIG 5 ; + PAIR ; + DUP 8 ; + CDR ; + CDR ; + CDR ; + DIG 5 ; + PAIR ; + DIG 3 ; + DUP 4 ; + PAIR ; + PAIR ; + PAIR ; + SWAP ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 4 ; + UNPAIR ; + DUP 3 ; + CDR ; + DUP ; + DUP 9 ; + GET ; + IF_NONE + { DIG 7 ; DIG 8 ; DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { CAR ; CDR ; SOME } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp)) } } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp)) } ; + IF_NONE + { SWAP ; DIG 8 ; DIG 9 ; DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP 5 ; + DIG 4 ; + PAIR ; + DUP 7 ; + DUP 4 ; + GET 5 ; + PAIR ; + DIG 9 ; + DIG 3 ; + PAIR ; + PAIR ; + PAIR ; + DIG 8 ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 4 ; + UNPAIR ; + PUSH nat 0 ; + DUP 4 ; + GET 7 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { PUSH nat 0 ; + DUP 4 ; + GET 14 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { DUP 7 ; + CDR ; + DUP 6 ; + GET 3 ; + DUP 9 ; + CAR ; + IF_LEFT + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } } + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } } } ; + IF { DUP 5 ; + GET 6 ; + CAR ; + DUP 5 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 6 ; + DIG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 8 ; + CAR ; + IF_LEFT + { DROP ; + DUP 7 ; + GET 5 ; + DUP ; + GET 5 ; + INT ; + SWAP ; + GET 3 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DIG 10 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + GET 6 ; + GET 3 ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } + { DROP ; + DUP 7 ; + GET 5 ; + DUP ; + CAR ; + INT ; + SWAP ; + GET 6 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DIG 10 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + GET 6 ; + GET 3 ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 3 ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } ; + DUP 3 ; + DUP 3 ; + CDR ; + CDR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 ; + SWAP } + { DUP 5 ; + GET 6 ; + CAR ; + DIG 7 ; + CAR ; + IF_LEFT + { DROP ; + DUP 5 ; + SWAP ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } + { DROP ; + DUP 5 ; + SWAP ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; + DUP 3 ; + DUP 3 ; + CDR ; + CAR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 2 ; + DIG 6 ; + DIG 7 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } ; + DUG 2 ; + PAIR ; + DIG 3 ; + DIG 3 ; + PAIR ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + PAIR } ; + UNPAIR ; + CAR ; + CDR ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + DUP 5 ; + DUP 2 ; + GET ; + IF_NONE + { DIG 4 ; DROP 2 ; PUSH nat 141 ; FAILWITH } + { PUSH nat 1 ; + DUP 2 ; + GET 9 ; + SUB ; + ABS ; + DIG 6 ; + DUG 2 ; + UPDATE 9 ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP ; + DUP 5 ; + CAR ; + GET ; + IF_NONE + { PUSH nat 141 ; FAILWITH } + { PUSH nat 0 ; SWAP ; GET 9 ; COMPARE ; LE } ; + DIG 5 ; + DIG 3 ; + PAIR ; + DIG 6 ; + DIG 2 ; + IF { DIG 2 ; + DROP ; + DUP 5 ; + DIG 5 ; + CDR ; + DIG 5 ; + CAR ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + bool) ; + SWAP ; + UPDATE ; + UPDATE 2 } + { DIG 4 ; DROP ; DIG 4 ; DIG 3 ; UPDATE 2 } ; + PAIR ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; + UPDATE } } ; + PAIR ; + PAIR ; + PAIR } ; + DIG 5 ; + DROP ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + CAR ; + DIG 3 ; + CAR ; + DIG 3 ; + DIG 2 ; + PAIR ; + DIG 3 ; + DIG 3 ; + SOME ; + DUP 6 ; + UPDATE } ; DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - SWAP ; - GET 7 ; - SWAP ; - GET 7 ; - SUB ; - DUP ; - ABS ; - INT ; - PUSH int 10 ; - PAIR ; + UNPAIR ; + NIL operation ; + DIG 2 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 9 ; + DUP 9 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 12 ; + PAIR 3 ; + CONS ; + DUP 9 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + DIG 4 ; DIG 5 ; - SWAP ; - EXEC ; - PUSH int 0 ; - DUP 3 ; + DROP 2 ; + PUSH mutez 0 ; + DUP 4 ; + CDR ; + CAR ; COMPARE ; - EQ ; - IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } - { PUSH int 0 ; - DIG 2 ; - COMPARE ; - LT ; - IF { PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - PUSH int 1 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL } - { PUSH int 1 ; SWAP } } ; - PAIR ; - DUP 2 ; - GET 3 ; - DUP 2 ; + GT ; + IF { DUP 3 ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { PUSH nat 102 ; FAILWITH } + { DUP 4 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + {} ; + PUSH mutez 0 ; + DUP 4 ; + CDR ; + CDR ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CDR ; + CONTRACT unit ; + IF_NONE + { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { DIG 2 ; DROP } ; + DUP 4 ; + DIG 4 ; CDR ; - DUP 2 ; + DUP ; + CAR ; + DUP ; CDR ; - MUL ; - DIG 2 ; + DIG 6 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; CAR ; - DIG 2 ; + DUP ; CAR ; - MUL ; - PAIR ; - UPDATE 3 ; + DUP ; + CAR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + SWAP } } + { DIG 2 ; + DROP ; + IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; DUP 3 ; CDR ; + DUP ; CAR ; + DUP ; CAR ; - DUP 4 ; - DIG 4 ; + DIG 5 ; CDR ; - DUP ; CAR ; - DUP 4 ; - DUP 7 ; - GET ; - IF_NONE - { DIG 3 ; DUP 5 ; DIG 6 ; SWAP ; SOME ; SWAP ; UPDATE } - { GET 4 ; - DUP 6 ; - GET 4 ; - COMPARE ; - GT ; - IF { DIG 3 ; DUP 5 ; SOME ; DIG 6 ; UPDATE } { DIG 5 ; DROP ; DIG 3 } } ; + CAR ; + CAR ; + DIG 5 ; + NONE bytes ; + SWAP ; + UPDATE ; UPDATE 1 ; UPDATE 1 ; - UPDATE 2 ; - DUP 2 ; + UPDATE 1 ; + UPDATE 2 } + { DUP 2 ; CAR ; - UNIT ; - LEFT unit ; - PAIR ; - NOW ; - DUP 3 ; CAR ; CAR ; CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP ; + GET 8 ; + IF {} { PUSH nat 137 ; FAILWITH } ; + DUP 2 ; + CDR ; CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - DUP 4 ; CAR ; + DUP 2 ; CAR ; + DUP ; CDR ; + GET 3 ; + SWAP ; CAR ; - DUP 3 ; - CDR ; - DUP 4 ; CAR ; - DUP 4 ; - UNPAIR ; - DUP ; + GET 3 ; + SWAP ; + DUP 3 ; + DUP 3 ; DUP 3 ; COMPARE ; GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE - { DROP 2 ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat) } - { DUP ; + { DROP 2 ; PUSH nat 117 ; FAILWITH } + { DROP ; + DUP 3 ; + CDR ; + CDR ; + CDR ; + DIG 2 ; + CAR ; + DUP ; + CDR ; GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool False } ; - IF { SWAP ; DIG 2 ; DROP 2 } + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP ; + CAR ; + DUP 2 ; + CDR ; + DIG 4 ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + NONE (pair (pair string string) address string nat bool) ; + SWAP ; + UPDATE ; + DUP 3 ; + DUP 3 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 3 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 6 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 7 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP ; DIG 2 } + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP ; DIG 2 } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 3 ; + DIG 2 ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 3 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP } { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 3 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH nat 0 ; - DIG 2 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 6 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 4 ; - PAIR 5 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; - DROP ; - DUP 3 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; SWAP } } ; - SWAP } ; - SOME } ; - IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 3 ; DROP 2 ; PUSH bool False } - { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } - { DIG 3 ; DROP 2 ; PUSH bool False } ; - IF { NOW ; - DUP 2 ; - GET 5 ; - DUP ; - GET 9 ; - INT ; - DUP 2 ; - GET 11 ; - INT ; - DUP 3 ; - GET 13 ; - INT ; - DUP 4 ; - CAR ; - INT ; - DUP 5 ; - GET 3 ; - INT ; - DUP 6 ; - GET 5 ; - INT ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR ; - PAIR ; - SWAP ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 8 ; - GET 3 ; - DUP 2 ; - CAR ; - CAR ; - DUP 4 ; - UNPAIR ; - UNPAIR ; - DUP 5 ; - DUP 15 ; - DIG 4 ; - DIG 4 ; - DIG 4 ; - ADD ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DUP 3 ; - CAR ; - UNPAIR ; - DUP 6 ; - UNPAIR ; - CDR ; - DIG 3 ; - DIG 3 ; - ADD ; - DUP 5 ; - DIG 3 ; - DIG 3 ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DIG 3 ; - UNPAIR ; - UNPAIR ; - DIG 6 ; - CDR ; - DUG 3 ; - ADD ; - ADD ; - DUP 5 ; - CDR ; - DUP 13 ; - CDR ; - MUL ; - DIG 5 ; - CAR ; - DUP 13 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 14 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 15 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 16 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 4 ; - CAR ; - DUP 7 ; - CDR ; - MUL ; - DUP 5 ; - CDR ; - DUP 8 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 8 ; - CDR ; - MUL ; - DUP 7 ; - CDR ; - DUP 9 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } - { DUP 4 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 4 ; - CDR ; - DUP 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 6 ; - CDR ; - DIG 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; - DUP 10 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 4 ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR 3 ; - PAIR 4 ; - DUP ; GET 3 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - GET 3 ; - DUP 3 ; - CAR ; - ADD ; - DUP 3 ; - GET 13 ; - DIG 3 ; - GET 11 ; - ADD ; - SWAP } - { DROP ; - DUP 2 ; - GET 13 ; - DUP 3 ; - GET 11 ; - DUP 4 ; - GET 9 ; - ADD ; - ADD ; - DIG 2 ; - CAR } } - { DROP ; + GET ; + IF_NONE + { SWAP ; DROP } + { DUP 3 ; + GET 8 ; DUP 2 ; - GET 5 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; DUP 3 ; - GET 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; DUP 4 ; - CAR ; - ADD ; - ADD ; - DIG 2 ; - GET 13 ; - SWAP } ; - DUP 3 ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 9 ; DROP 2 ; DUP 8 } - { DROP ; - DUP 8 ; - GET 3 ; - DUP 10 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 10 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - SWAP ; - UPDATE 3 } } - { DROP ; - DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; GET 3 ; - DUP 10 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 10 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; CAR ; - DIG 2 ; + DIG 5 ; CAR ; - MUL ; - PAIR ; - DUP 9 ; - SWAP ; - UPDATE 3 } ; - DUP 4 ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } - { DROP ; DUP 4 ; CAR ; GET 4 } ; - DUP 2 ; - GET 3 ; - DUP 2 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 0 ; - DUP 2 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } - {} ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DIG 13 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 5 ; - DIG 5 ; - DIG 2 ; - DIG 5 ; - DIG 4 ; - PAIR 4 ; - UPDATE 5 ; - SWAP ; - UPDATE 6 ; - DIG 2 ; - DIG 5 ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - LEFT (pair timestamp timestamp) ; - LEFT timestamp ; - UPDATE 3 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DIG 3 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 } ; - NIL operation ; - PAIR } } } } } } ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { SWAP ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 } ; + NIL operation } ; + PAIR } } } + { DIG 3 ; + DROP ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 117 ; FAILWITH } + { DUP 3 ; + CDR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; + DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 122 ; FAILWITH } {} ; + UNPAIR ; + DUP 5 ; + CDR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + GET ; + IF_NONE + {} + { DUP 2 ; + SWAP ; + GET 4 ; + COMPARE ; + GE ; + IF { PUSH nat 121 ; FAILWITH } {} } ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + DUP 2 ; + SWAP ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } ; + DUP 3 ; + CAR ; + DIG 3 ; + GET 7 ; + DUP ; + DUP 3 ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + GET 7 ; + SUB ; + PUSH int 10 ; + PAIR ; + DUP 7 ; + SWAP ; + EXEC ; + DIG 3 ; + MUL ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 2 ; + CAR ; + CAR ; + GET 7 ; + INT ; + PUSH int 10 ; + PAIR ; + DUP 7 ; + SWAP ; + EXEC ; + SWAP } + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DIG 2 ; + SWAP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP 3 ; + CDR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; + GET 7 ; + SUB ; + DUP ; + ABS ; + INT ; + PUSH int 10 ; + PAIR ; + DIG 5 ; + SWAP ; + EXEC ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } + { PUSH int 0 ; + DIG 2 ; + COMPARE ; + LT ; + IF { PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + PUSH int 1 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL } + { PUSH int 1 ; SWAP } } ; + PAIR ; + DUP 2 ; + GET 3 ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + UPDATE 3 ; + DUP 3 ; + CDR ; + CAR ; + CAR ; + CDR ; + DUP 4 ; + DIG 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 5 ; + DUP 8 ; + GET ; + IF_NONE + { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } + { GET 4 ; + DUP 7 ; + GET 4 ; + COMPARE ; + GT ; + IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + DUP 2 ; + CAR ; + UNIT ; + LEFT unit ; + PAIR ; + NOW ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + DIG 2 ; + UNPAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CDR ; + DUP 4 ; + CAR ; + DUP 4 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP 2 ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + bool) } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool False } ; + IF { SWAP ; DIG 2 ; DROP 2 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 3 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + PUSH bool False ; + PUSH nat 0 ; + DIG 3 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 7 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DROP 2 ; SWAP } } + { DIG 3 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DUP 5 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; SWAP } } ; + SWAP } ; + SOME } ; + IF_NONE + { SWAP ; DIG 3 ; DIG 4 ; DROP 4 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 3 ; DROP 2 ; PUSH bool False } + { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } + { DIG 3 ; DROP 2 ; PUSH bool False } ; + IF { NOW ; + DUP 2 ; + GET 5 ; + DUP ; + GET 9 ; + INT ; + DUP 2 ; + GET 11 ; + INT ; + DUP 3 ; + GET 13 ; + INT ; + DUP 4 ; + CAR ; + INT ; + DUP 5 ; + GET 3 ; + INT ; + DUP 6 ; + GET 5 ; + INT ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR ; + PAIR ; + SWAP ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 8 ; + GET 3 ; + DUP 2 ; + CAR ; + CAR ; + DUP 4 ; + UNPAIR ; + UNPAIR ; + DUP 5 ; + DUP 15 ; + DIG 4 ; + DIG 4 ; + DIG 4 ; + ADD ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DUP 3 ; + CAR ; + UNPAIR ; + DUP 6 ; + UNPAIR ; + CDR ; + DIG 3 ; + DIG 3 ; + ADD ; + DUP 5 ; + DIG 3 ; + DIG 3 ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DIG 3 ; + UNPAIR ; + UNPAIR ; + DIG 6 ; + CDR ; + DUG 3 ; + ADD ; + ADD ; + DUP 5 ; + CDR ; + DUP 13 ; + CDR ; + MUL ; + DIG 5 ; + CAR ; + DUP 13 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 4 ; + CAR ; + DUP 7 ; + CDR ; + MUL ; + DUP 5 ; + CDR ; + DUP 8 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 8 ; + CDR ; + MUL ; + DUP 7 ; + CDR ; + DUP 9 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } + { DUP 4 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 4 ; + CDR ; + DUP 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 6 ; + CDR ; + DIG 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; + DUP 10 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 4 ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR 3 ; + PAIR 4 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + GET 3 ; + DUP 3 ; + CAR ; + ADD ; + DUP 3 ; + GET 13 ; + DIG 3 ; + GET 11 ; + ADD ; + SWAP } + { DROP ; + DUP 2 ; + GET 13 ; + DUP 3 ; + GET 11 ; + DUP 4 ; + GET 9 ; + ADD ; + ADD ; + DIG 2 ; + CAR } } + { DROP ; + DUP 2 ; + GET 5 ; + DUP 3 ; + GET 3 ; + DUP 4 ; + CAR ; + ADD ; + ADD ; + DIG 2 ; + GET 13 ; + SWAP } ; + DUP 3 ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 9 ; DROP 2 ; DUP 8 } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } ; + DUP 4 ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } + { DROP ; DUP 4 ; CAR ; GET 4 } ; + DUP 2 ; + GET 3 ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 1 ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 5 ; + DIG 5 ; + DIG 2 ; + DIG 5 ; + DIG 4 ; + PAIR 4 ; + UPDATE 5 ; + SWAP ; + UPDATE 6 ; + DIG 2 ; + DIG 5 ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + LEFT (pair timestamp timestamp) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DIG 3 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 4 ; DROP 3 } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } ; view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; view "get_valid_swaps" unit @@ -4542,7 +4926,8 @@ (nat %sell_plus_volume) (nat %sell_total_volume)) (pair %pair string string) - (nat %holdings))) + (nat %holdings) + (bool %market_vault_used))) { CDR ; NIL (pair nat (or (or (pair (pair timestamp @@ -4555,7 +4940,8 @@ timestamp) (pair nat nat nat nat nat nat nat nat) (pair string string) - nat) ; + nat + bool) ; DUP 2 ; CAR ; CAR ; diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index f6d2973c..87d4fd91 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -2,7 +2,7 @@ (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) 10 {}) - (Pair {} {}) + (Pair (Pair {} {}) {} {}) { Elt "tzBTC/EURL" (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; Elt "tzBTC/USDT" diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index e47713ad..5ad39f7c 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1,4 +1,5 @@ #import "@ligo/math-lib/rational/rational.mligo" "Rational" +#import "shared.mligo" "Shared" (* Errors *) [@inline] let no_rate_available_for_swap : nat = 100n @@ -80,15 +81,6 @@ -(* Associate alias to token address *) -type token = [@layout:comb] { - token_id: nat; - name : string; - address : address option; - decimals : nat; - standard : string option; -} - (* Side of an order, either BUY side or SELL side *) type side = Buy @@ -98,6 +90,8 @@ type side = type tolerance = Plus | Exact | Minus +type token = Shared.token + (* A token value ascribes an amount to token metadata *) type token_amount = [@layout:comb] { token : token; @@ -250,6 +244,7 @@ type batch = [@layout:comb] { volumes : volumes; pair : pair; holdings : nat; + market_vault_used : bool; } type batch_indices = (string, nat) map @@ -271,7 +266,6 @@ type metadata_update = { value: bytes; } - type orace_price_update = timestamp * nat type oracle_source_change = [@layout:comb] { @@ -297,6 +291,26 @@ type fees = { recipient: address; } +type foreign_tokens = (string, token_amount) map + +type market_maker_vault = { + total_shares: nat; + native_token: token_amount; + foreign_tokens: foreign_tokens; +} + +type market_vaults = (string,market_maker_vault) big_map + +type market_vault_holding = { + name: string; + shares: nat; +} + +type market_vault_holdings = (string, market_vault_holding) map + +type user_market_vault_holdings = (address, market_vault_holdings) big_map + + [@inline] let get_token @@ -415,6 +429,8 @@ module Storage = struct administrator : address; limit_on_tokens_or_pairs : nat; deposit_time_window_in_seconds : nat; + market_vaults: market_vaults; + user_market_vault_holdings: user_market_vault_holdings; } end @@ -1469,6 +1485,7 @@ let make pair = pair; volumes = volumes; holdings = 0n; + market_vault_used = false; } [@inline] @@ -1702,6 +1719,65 @@ let compute_clearing_prices end +module MarketVaultUtils = struct + +type market_vault_holding = { + name: string; + shares: nat; +} + +type market_vault_holdings = (string, market_vault_holding) map + +type user_market_vault_holdings = (address, market_vault_holdings) big_map + +let add_to_vault + (ta: token_amount) + (mvhs: market_vault_holdings) : market_vault_holdings = + match Map.find_opt ta.token.name mvhs with + | None -> let mvh = { + name = ta.token.name; + shares = ta.amount; + } in + Map.add ta.token.name mvh mvhs + | Some mvh -> let uh = { mvh with shares = mvh.shares + ta.amount; } in + Map.update ta.token.name (Some uh) mvhs + +let add_shares + (holder: address) + (ta: token_amount) + (umvhs: user_market_vault_holdings) : user_market_vault_holdings = + match Big_map.find_opt holder umvhs with + | None -> let vh = { + name = ta.token.name; + shares = ta.amount; + } in + let mvh = Map.literal [ + (ta.token.name, vh) + ] in + Big_map.add holder mvh umvhs + | Some mvhs -> let mvhs = add_to_vault ta mvhs in + Big_map.update holder (Some mvhs) umvhs + + +let mint_shares + (holder: address) + (token_amount: token_amount) + (storage: Storage.t) : Storage.t = + let vault = match Big_map.find_opt token_amount.token.name storage.market_vaults with + | None -> { + total_shares = token_amount.amount; + native_token = token_amount; + foreign_tokens = (Map.empty: foreign_tokens); + } + | Some v -> { v with total_shares = v.total_shares + token_amount.amount; } + in + let vaults = Big_map.add token_amount.token.name vault storage.market_vaults in + let shares = add_shares holder token_amount storage.user_market_vault_holdings in + { storage with market_vaults = vaults; user_market_vault_holdings = shares;} + +end + + type storage = Storage.t type result = operation list * storage @@ -1725,6 +1801,8 @@ type entrypoint = | Disable_swap_pair_for_deposit of string | Change_oracle_source_of_pair of oracle_source_change | Change_deposit_time_window of nat + | AddLiquidity of token_amount + [@inline] let get_oracle_price @@ -1917,6 +1995,19 @@ let confirm_swap_pair_is_disabled_prior_to_removal (valid_swap:valid_swap) : unit = if valid_swap.is_disabled_for_deposits then () else failwith cannot_remove_swap_pair_that_is_not_disabled + +(* Deposit Liquidity into a market vault *) +[@inline] +let add_liquidity + (token_amount: token_amount) + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let holder = Tezos.get_sender () in + let treasury_ops = Treasury.deposit holder token_amount in + let storage = MarketVaultUtils.mint_shares holder token_amount storage in + (treasury_ops, storage) + + (* Register a deposit during a valid (Open) deposit time; fails otherwise. Updates the current_batch if the time is valid but the new batch was not initialized. *) [@inline] @@ -2192,5 +2283,7 @@ let main | Enable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name false storage | Disable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name true storage | Change_deposit_time_window t -> change_deposit_time_window t storage + (* Market Liquidity endpoint *) + | AddLiquidity t -> add_liquidity t storage diff --git a/batcher/market-tokens.mligo b/batcher/market-tokens.mligo new file mode 100644 index 00000000..1983034e --- /dev/null +++ b/batcher/market-tokens.mligo @@ -0,0 +1,38 @@ +#import "shared.mligo" "Shared" + +type storage = { + batcher_address: address; + tokens: (string,Shared.market_token) big_map; +} + + + +[@inline] +let no_op (s : storage) : result = (([] : operation list), s) + +type entrypoint = + | Mint of Shared.mint_burn_request + | Tick of Shared.mint_burn_request + + +[@inline] +let mint + (mint_request: mint_burn_request) + (storage: storage) : result = + no_op storage + + +[@view] +let getCurrentCirculation (asset, storage : string * storage) = + match Big_map.find_opt asset storage with + | None -> failwith "No rate available" + | Some r -> (r.timestamp, r.value) + + +let main + (action, storage : entrypoint * storage) : operation list * storage = + match action with + | Mint req -> mint req storage + | Burn -> burn storage + + diff --git a/batcher/package.json b/batcher/package.json index c76b11ad..a5aa12a7 100644 --- a/batcher/package.json +++ b/batcher/package.json @@ -5,6 +5,7 @@ "description": "Batcher for exchanging tokens", "dependencies": { "@ligo/math-lib": "^1.0.0", - "ligo-breathalyzer": "^1.4.0" + "ligo-breathalyzer": "^1.4.0", + "ligo-extendable-fa2": "^1.0.4" } } diff --git a/batcher/shared.mligo b/batcher/shared.mligo new file mode 100644 index 00000000..712ceac2 --- /dev/null +++ b/batcher/shared.mligo @@ -0,0 +1,18 @@ +type mint_burn_request = { + name: string; + amount: nat; +} + +type token = [@layout:comb] { + token_id: nat; + name : string; + address : address option; + decimals : nat; + standard : string option; +} + +type market_token = { + circulation: nat; + token: token; + +} diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index aabc7b4a..0e68d111 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -61,6 +61,8 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; + market_vaults = (Big_map.empty: Batcher.market_vaults); + user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); } diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index e88abcf5..f6dc32b9 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -61,6 +61,8 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; + market_vaults = (Big_map.empty: Batcher.market_vaults); + user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); } From ea94b9863aaf364dfc5cb43dad2e6be804916bbc Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 14 Aug 2023 21:07:21 +0300 Subject: [PATCH 082/108] Added test for adding liquidity --- batcher/test/common/batch.mligo | 1 + batcher/test/common/helpers.mligo | 12 +++++ batcher/test/common/storage.mligo | 2 + .../market_maker/test_add_liquidity.mligo | 45 +++++++++++++++++++ batcher/test/test.mligo | 8 ++-- 5 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 batcher/test/market_maker/test_add_liquidity.mligo diff --git a/batcher/test/common/batch.mligo b/batcher/test/common/batch.mligo index efd55a8b..b7408671 100644 --- a/batcher/test/common/batch.mligo +++ b/batcher/test/common/batch.mligo @@ -226,6 +226,7 @@ let prepare_batch_with_status volumes = empty_volumes; pair = pair; holdings = 0n; + market_vault_used = false; } in let test_cases = if pressure = Buy then buy_pressure_cases diff --git a/batcher/test/common/helpers.mligo b/batcher/test/common/helpers.mligo index 36baea98..88554abb 100644 --- a/batcher/test/common/helpers.mligo +++ b/batcher/test/common/helpers.mligo @@ -226,6 +226,18 @@ let place_order let order = create_order from to amount side tolerance valid_tokens in Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (Deposit order) fee)) +let add_liquidity + (actor: Breath.Context.actor) + (contract: originated_contract) + (token_name: string) + (amount: nat) + (valid_tokens: valid_tokens) = + let token = Option.unopt (Map.find_opt token_name valid_tokens) in + let token_amount = { + token = token; + amount = amount; + } in + Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (AddLiquidity token_amount) 0tez)) let expect_last_order_number (storage: storage) diff --git a/batcher/test/common/storage.mligo b/batcher/test/common/storage.mligo index daee903f..8ef0ea75 100644 --- a/batcher/test/common/storage.mligo +++ b/batcher/test/common/storage.mligo @@ -105,6 +105,8 @@ let initial_storage_with_admin_and_fee_recipient administrator = admin; limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; + market_vaults = (Big_map.empty: Batcher.market_vaults); + user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); } diff --git a/batcher/test/market_maker/test_add_liquidity.mligo b/batcher/test/market_maker/test_add_liquidity.mligo new file mode 100644 index 00000000..b1df0cac --- /dev/null +++ b/batcher/test/market_maker/test_add_liquidity.mligo @@ -0,0 +1,45 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../common/helpers.mligo" "Helpers" +#import "../../batcher.mligo" "Batcher" + + +let add_liquidity_should_succeed = + Breath.Model.case + "test add liquidity" + "should be successful if user is admin" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let token_name = "tzBTC" in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + + let vaults = bstorage.market_vaults in + + let btc_vault = Option.unopt (Big_map.find_opt token_name vaults) in + + Breath.Result.reduce [ + act_allow_transfer + ; act_add_liquidity + ; Breath.Assert.is_equal "total shares should be same" deposit_amount btc_vault.total_shares + ]) + + +let test_suite = + Breath.Model.suite "Suite for Add Liquidity" [ + add_liquidity_should_succeed + ] + diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo index 628da2e9..b1aa2a28 100644 --- a/batcher/test/test.mligo +++ b/batcher/test/test.mligo @@ -13,6 +13,7 @@ #import "./endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" #import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" #import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" +#import "./market_maker/test_add_liquidity.mligo" "Market_Maker_Add_Liquidity" #import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" #import "./economics/test_clearing.mligo" "Economics_Clearing" @@ -43,7 +44,7 @@ let () = Breath.Model.run_suites Void [ test_suite - (* ; Admin_Change_Fee.test_suite + ; Admin_Change_Fee.test_suite ; Admin_Change_Admin_Address.test_suite ; Admin_Change_Fee_Recipient_Address.test_suite ; Admin_Change_Deposit_Time_Window.test_suite @@ -53,9 +54,10 @@ let () = ; Admin_Change_Oracle_Source_Of_Pair.test_suite ; Admin_Add_Remove_Token_Swap_Pair.test_suite ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite *) + ; Economics_Clearing.test_suite ; User_Deposits.test_suite ; User_Cancellations.test_suite -// ; User_Redemptions.test_suite +// ; User_Redemptions.test_suite + ; Market_Maker_Add_Liquidity.test_suite ] From ee3d7cf85ec13daa9bc4c462399f42827200333c Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 22 Aug 2023 17:11:09 +0300 Subject: [PATCH 083/108] Add liquidity to market maker and test --- batcher/batcher-ghostnet.tz | 3561 +++++++++-------- batcher/batcher-storage-ghostnet.tz | 13 +- batcher/batcher.mligo | 214 +- batcher/shared.mligo | 40 + .../storage/initial_storage_ghostnet.mligo | 9 +- batcher/storage/initial_storage_mainnet.mligo | 9 +- batcher/test/common/batch.mligo | 2 +- batcher/test/common/storage.mligo | 8 +- ....mligo => test_add_update_liquidity.mligo} | 15 +- batcher/test/test.mligo | 8 +- 10 files changed, 2061 insertions(+), 1818 deletions(-) rename batcher/test/market_maker/{test_add_liquidity.mligo => test_add_update_liquidity.mligo} (54%) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 0b46ce9e..e85f87f2 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -37,7 +37,8 @@ (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision))) - (or (pair %deposit + (or (unit %claim) + (pair %deposit (pair %swap (pair %from (pair %token @@ -55,31 +56,31 @@ (option %standard string))) (timestamp %created_at) (nat %side) - (nat %tolerance)) - (string %disable_swap_pair_for_deposit))) - (or (or (string %enable_swap_pair_for_deposit) (unit %redeem)) - (or (string %remove_metadata) - (pair %remove_token_swap_pair - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits)))))) - (string %tick)) ; + (nat %tolerance)))) + (or (or (string %disable_swap_pair_for_deposit) (string %enable_swap_pair_for_deposit)) + (or (unit %redeem) (string %removeLiquidity))))) + (or (or (string %remove_metadata) + (pair %remove_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + (string %tick))) ; storage (pair (pair (pair (pair (address %administrator) (pair %batch_set @@ -119,31 +120,38 @@ (nat %sell_total_volume)) (pair %pair string string) (nat %holdings) - (bool %market_vault_used))))) + (option %market_vault_used (or (unit %buy) (unit %sell))))))) (nat %deposit_time_window_in_seconds) (mutez %fee_in_mutez)) (pair (address %fee_recipient) (nat %last_order_number)) (nat %limit_on_tokens_or_pairs) - (big_map %market_vaults - string - (pair (pair (map %foreign_tokens - string - (pair (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount))) - (pair %native_token - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount))) - (nat %total_shares)))) + (pair %market_maker + (pair (nat %last_holding_id) (big_map %user_holdings (pair address string) nat)) + (big_map %vault_holdings + nat + (pair (pair (pair (address %holder) (nat %id)) (nat %shares) (string %token)) + (mutez %unclaimed))) + (big_map %vaults + string + (pair (pair (map %foreign_tokens + string + (pair (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount))) + (set %holdings nat)) + (pair %native_token + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (nat %total_shares))))) (pair (pair (big_map %metadata string bytes) (big_map %rates_current string @@ -156,16 +164,13 @@ (map (pair (or %side (unit %buy) (unit %sell)) (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) nat))) - (big_map %user_market_vault_holdings - address - (map string (pair (string %name) (nat %shares))))) - (map %valid_swaps - string - (pair (pair %swap (string %from) (string %to)) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits))) + (map %valid_swaps + string + (pair (pair %swap (string %from) (string %to)) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits)))) (map %valid_tokens string (pair (nat %token_id) @@ -173,7 +178,40 @@ (option %address address) (nat %decimals) (option %standard string)))) ; - code { PUSH int 1 ; + code { LAMBDA + (pair nat nat) + nat + { UNPAIR ; + PUSH nat 1 ; + DUG 2 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } } ; + PUSH int 1 ; PUSH int 10000 ; PAIR ; PUSH int 1 ; @@ -244,15 +282,122 @@ { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; SWAP ; DROP } ; - DIG 3 ; + LAMBDA + (pair nat + (pair (pair nat string (option address) nat (option string)) nat) + (option + (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) + (set nat)) + (pair (pair nat string (option address) nat (option string)) nat) + nat))) + (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) + (set nat)) + (pair (pair nat string (option address) nat (option string)) nat) + nat) + { UNPAIR 3 ; + DIG 2 ; + IF_NONE + { DUP 2 ; + CDR ; + DIG 2 ; + PAIR ; + EMPTY_SET nat ; + DIG 2 ; + PUSH bool True ; + SWAP ; + UPDATE ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + PAIR ; + PAIR } + { DUP ; + CDR ; + CAR ; + DUP ; + CAR ; + DUP 5 ; + CAR ; + DUP 2 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + NOT ; + IF { DROP 4 ; PUSH nat 115 ; FAILWITH } + { DUP 4 ; + CDR ; + DUP 3 ; + CDR ; + CDR ; + ADD ; + DUP 2 ; + DIG 5 ; + CDR ; + DIG 3 ; + CDR ; + ADD ; + UPDATE 2 ; + DUP 3 ; + DUP 4 ; + CAR ; + DUP 5 ; + CAR ; + CDR ; + DUP 7 ; + MEM ; + IF { DIG 5 ; DROP ; DIG 4 ; CAR ; CDR } + { DIG 4 ; CAR ; CDR ; DIG 5 ; PUSH bool True ; SWAP ; UPDATE } ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 2 } } } ; + DIG 5 ; UNPAIR ; IF_LEFT - { DIG 2 ; - DIG 4 ; + { DIG 3 ; + DIG 5 ; DROP 2 ; IF_LEFT - { IF_LEFT - { DIG 2 ; + { DIG 4 ; + DROP ; + IF_LEFT + { DIG 3 ; DROP ; IF_LEFT { IF_LEFT @@ -315,119 +460,191 @@ CDR ; CDR ; CDR ; - DUP 4 ; + PUSH nat 1 ; + DUP 2 ; + CAR ; + CAR ; + ADD ; + DUP 5 ; CAR ; GET 3 ; - GET ; - IF_NONE - { DUP 3 ; - CDR ; - DUP 4 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - PAIR ; - PAIR } - { DUP ; DUP 5 ; CDR ; DIG 2 ; CDR ; ADD ; UPDATE 2 } ; DUP 5 ; - CDR ; + PAIR ; + DUP 3 ; CAR ; CDR ; - CDR ; - DUP ; - DUP 5 ; + DUP 2 ; GET ; + DUP ; IF_NONE - { EMPTY_MAP string (pair string nat) ; - DUP 6 ; - CDR ; - DUP 7 ; - CAR ; - GET 3 ; - PAIR ; - DUP 7 ; - CAR ; - GET 3 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 4 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP ; - DUP 7 ; + { DUP 7 ; CAR ; GET 3 ; + DUP 5 ; + CDR ; + CDR ; + DUP 2 ; GET ; + DIG 2 ; IF_NONE - { DUP 6 ; + { DUP 8 ; + DUP 5 ; + PAIR 3 ; + DIG 9 ; + SWAP ; + EXEC ; + DUP 4 ; + DUP 6 ; + CAR ; CDR ; - DUP 7 ; + DUP 6 ; + DIG 5 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + PAIR ; + DUP 5 ; + CDR ; + CAR ; + PUSH mutez 0 ; + DUP 10 ; CAR ; GET 3 ; + DIG 10 ; + CDR ; PAIR ; DUP 7 ; - CAR ; - GET 3 ; + DIG 10 ; + PAIR ; + PAIR ; + PAIR ; + DIG 5 ; SWAP ; SOME ; SWAP ; - UPDATE } - { DUP ; - DUP 8 ; + UPDATE ; + DUP 5 ; CDR ; - DIG 2 ; CDR ; - ADD ; - UPDATE 2 ; + DIG 3 ; SOME ; + DIG 4 ; + UPDATE ; + PAIR ; + PAIR } + { DIG 3 ; + DIG 4 ; + DROP 2 ; + SWAP ; DUP 7 ; + DUP 3 ; + PAIR 3 ; + DIG 8 ; + SWAP ; + EXEC ; + DUP 4 ; + CDR ; CAR ; - GET 3 ; - UPDATE } ; - SOME ; + DUP 3 ; + GET ; + NONE (pair (pair (pair address nat) nat string) mutez) ; + DUP 2 ; + COMPARE ; + EQ ; + IF { SWAP ; DIG 2 ; DIG 3 ; DIG 6 ; DIG 7 ; DROP 6 ; PUSH nat 149 ; FAILWITH } + { IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; + DIG 6 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + NOT ; + IF { PUSH nat 150 ; FAILWITH } {} ; + DUP ; + DUP 2 ; + CAR ; + DUP ; + CDR ; + DIG 9 ; + CDR ; + DIG 4 ; + CAR ; + CDR ; + CAR ; + ADD ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP 5 ; + CAR ; + CAR ; + DUP 6 ; + CAR ; + CDR ; + PAIR ; + DUP 6 ; + CDR ; + CAR ; + DIG 2 ; + SOME ; + DIG 4 ; + UPDATE ; + DUP 5 ; + CDR ; + CDR ; + DIG 3 ; + SOME ; + DIG 4 ; + UPDATE ; + PAIR ; + PAIR } } ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + DUP 5 ; + DIG 5 ; + CDR ; DIG 4 ; - UPDATE } ; - DUP 5 ; - DUP 6 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CAR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; + CAR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 1 } + { SWAP ; DIG 2 ; DIG 3 ; DIG 6 ; DIG 7 ; DIG 9 ; DROP 7 } ; + DUP 3 ; + DIG 3 ; CAR ; DUP ; CDR ; DUP ; CDR ; - DIG 8 ; - CAR ; - CDR ; - CDR ; - CDR ; - DIG 6 ; - DIG 8 ; - CAR ; - GET 3 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; + DIG 4 ; UPDATE 2 ; UPDATE 2 ; UPDATE 2 ; UPDATE 1 ; - DUP ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; NIL operation ; DIG 2 ; CONS } - { DUP 2 ; + { DIG 2 ; + DROP ; + DUP 2 ; CAR ; CAR ; CAR ; @@ -488,7 +705,9 @@ UPDATE 2 ; NIL operation } ; PAIR } - { IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -527,13 +746,13 @@ NEQ ; IF { DROP 2 ; PUSH nat 133 ; FAILWITH } { DUP 2 ; - CDR ; CDR ; CDR ; DUP 3 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 4 ; CAR ; CDR ; @@ -729,18 +948,14 @@ CAR ; CAR ; GET 3 ; - PAIR ; - DUP 4 ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; - DUP 2 ; - DUP 2 ; + SWAP ; + DUP 5 ; + DUP 3 ; + DUP 3 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; GET ; IF_NONE { DUP 4 ; @@ -834,17 +1049,17 @@ CAR ; CAR ; GET 3 ; - PAIR ; - DIG 2 ; - DUP 4 ; - GET 8 ; + SWAP ; + DIG 3 ; DUP 5 ; - GET 7 ; + GET 8 ; DUP 6 ; - GET 5 ; + GET 7 ; DUP 7 ; + GET 5 ; + DUP 8 ; GET 3 ; - DIG 7 ; + DIG 8 ; CAR ; DUP ; CDR ; @@ -855,16 +1070,12 @@ GET 3 ; PAIR ; PAIR 5 ; - DUP 3 ; - CAR ; - DIG 3 ; - CDR ; - DUP 2 ; - DUP 2 ; + DUP 4 ; + DUP 4 ; COMPARE ; GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + IF { DIG 3 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } + { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } ; SWAP ; SOME ; SWAP ; @@ -876,17 +1087,17 @@ DIG 3 ; CDR ; DUP ; + CAR ; + DUP ; CDR ; - DIG 3 ; - UPDATE 1 ; + DIG 4 ; UPDATE 2 ; UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; DUP ; CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; + DIG 2 ; UPDATE 2 ; UPDATE 2 ; NIL operation ; @@ -908,16 +1119,16 @@ DUP 2 ; CDR ; CDR ; - CDR ; SIZE ; DUP 2 ; COMPARE ; LT ; IF { DROP 2 ; PUSH nat 128 ; FAILWITH } { DUP 2 ; - CDR ; CDR ; CAR ; + CDR ; + CDR ; SIZE ; DUP 2 ; COMPARE ; @@ -937,7 +1148,9 @@ UPDATE 1 ; NIL operation ; PAIR } } } } } - { IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT { IF_LEFT { PUSH mutez 1 ; AMOUNT ; @@ -949,8 +1162,9 @@ UNPAIR ; DUP 5 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 3 ; DUP 3 ; COMPARE ; @@ -961,7 +1175,6 @@ IF_NONE { DROP 4 ; PUSH nat 117 ; FAILWITH } { DUP 4 ; - CDR ; CDR ; CDR ; DUP 2 ; @@ -1031,7 +1244,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH bool False ; + NONE (or unit unit) ; PUSH nat 0 ; DIG 7 ; PUSH nat 0 ; @@ -1086,20 +1299,19 @@ DROP ; IF_LEFT { DROP 2 ; - DUP 5 ; + PUSH nat 0 ; + DUP 6 ; CAR ; CAR ; CAR ; CDR ; - PUSH nat 0 ; - DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH bool False ; + NONE (or unit unit) ; PUSH nat 0 ; - DIG 7 ; + DIG 6 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1109,7 +1321,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 6 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1120,8 +1332,16 @@ (pair timestamp timestamp)) ; DIG 5 ; PAIR 6 ; - DUP 2 ; - DUP 3 ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CDR ; DUP 3 ; SOME ; @@ -1129,7 +1349,11 @@ CAR ; UPDATE ; UPDATE 2 ; - DIG 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CAR ; DUP 3 ; CAR ; @@ -1588,9 +1812,12 @@ UPDATE 1 ; NIL operation ; PAIR } } } } - { IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT { DIG 2 ; - DROP ; + DIG 3 ; + DROP 2 ; IF_LEFT { IF_LEFT { DUP 2 ; @@ -1644,8 +1871,9 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 2 ; CAR ; GET ; @@ -1660,31 +1888,43 @@ DUP 4 ; CDR ; DUP ; + CAR ; + DUP ; CDR ; - DIG 5 ; - CDR ; + DIG 6 ; CDR ; CAR ; - DIG 4 ; - DUP 6 ; + CDR ; + CDR ; + DIG 5 ; + DUP 7 ; GET 3 ; UPDATE 3 ; - DUP 6 ; + DUP 7 ; GET 5 ; UPDATE 5 ; - DUP 6 ; + DUP 7 ; GET 6 ; UPDATE 7 ; SOME ; - DIG 5 ; + DIG 6 ; CAR ; UPDATE ; - UPDATE 1 ; UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; UPDATE 2 } ; NIL operation ; PAIR } { IF_LEFT + { DROP ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + NIL operation ; + PAIR } { DUP ; GET 5 ; PUSH nat 0 ; @@ -1712,8 +1952,9 @@ NOW ; DUP 4 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 3 ; UNPAIR ; DUP ; @@ -1781,7 +2022,7 @@ ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH bool False ; + NONE (or unit unit) ; PUSH nat 0 ; DUP 6 ; PUSH nat 0 ; @@ -1836,20 +2077,19 @@ DROP ; IF_LEFT { DROP 2 ; - DUP 4 ; + PUSH nat 0 ; + DUP 5 ; CAR ; CAR ; CAR ; CDR ; - PUSH nat 0 ; - DUP 2 ; CAR ; ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; PUSH nat 1 ; ADD ; - PUSH bool False ; + NONE (or unit unit) ; PUSH nat 0 ; - DUP 6 ; + DUP 5 ; PUSH nat 0 ; PUSH nat 0 ; PUSH nat 0 ; @@ -1859,7 +2099,7 @@ PUSH nat 0 ; PUSH nat 0 ; PAIR 8 ; - DIG 6 ; + DIG 5 ; RIGHT (or (pair (pair timestamp (pair (pair nat nat nat) @@ -1870,8 +2110,16 @@ (pair timestamp timestamp)) ; DIG 5 ; PAIR 6 ; - DUP 2 ; - DUP 3 ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CDR ; DUP 3 ; SOME ; @@ -1879,7 +2127,11 @@ CAR ; UPDATE ; UPDATE 2 ; - DIG 2 ; + DUP 5 ; + CAR ; + CAR ; + CAR ; + CDR ; CAR ; DUP 3 ; CAR ; @@ -1976,9 +2228,10 @@ { DROP ; PUSH bool True } ; IF { DIG 2 ; DROP } { DUP 5 ; - CDR ; CDR ; CAR ; + CDR ; + CDR ; DIG 3 ; UNPAIR ; DUP ; @@ -2061,7 +2314,6 @@ DUP 6 ; CDR ; CDR ; - CDR ; DUP 10 ; CAR ; DUP ; @@ -2160,8 +2412,9 @@ PAIR ; DUP 7 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 5 ; IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; UNPAIR ; @@ -2517,7 +2770,12 @@ CONS ; PAIR } { DROP 6 ; PUSH nat 112 ; FAILWITH } } - { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } } } + { IF_LEFT + { DIG 2 ; + DIG 3 ; + DROP 2 ; + IF_LEFT { DUP 2 ; CAR ; CAR ; @@ -2534,8 +2792,9 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 2 ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; @@ -2543,27 +2802,25 @@ DUP 4 ; CDR ; DUP ; + CAR ; + DUP ; CDR ; - DIG 5 ; - CDR ; + DIG 6 ; CDR ; CAR ; - DIG 4 ; + CDR ; + CDR ; + DIG 5 ; PUSH bool True ; UPDATE 8 ; SOME ; - DIG 5 ; + DIG 6 ; UPDATE ; - UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; - NIL operation ; - PAIR } } } - { IF_LEFT - { IF_LEFT - { DIG 2 ; - DROP ; - DUP 2 ; + UPDATE 1 ; + UPDATE 2 } + { DUP 2 ; CAR ; CAR ; CAR ; @@ -2579,8 +2836,9 @@ IF {} { PUSH nat 118 ; FAILWITH } ; DUP 2 ; CDR ; - CDR ; CAR ; + CDR ; + CDR ; DUP 2 ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; @@ -2588,21 +2846,26 @@ DUP 4 ; CDR ; DUP ; + CAR ; + DUP ; CDR ; - DIG 5 ; - CDR ; + DIG 6 ; CDR ; CAR ; - DIG 4 ; + CDR ; + CDR ; + DIG 5 ; PUSH bool False ; UPDATE 8 ; SOME ; - DIG 5 ; + DIG 6 ; UPDATE ; - UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; - NIL operation } + UPDATE 1 ; + UPDATE 2 } ; + NIL operation } + { IF_LEFT { DROP ; SENDER ; PUSH mutez 1 ; @@ -2632,26 +2895,30 @@ CAR ; CDR ; CAR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 2 ; - DUP 7 ; + DUP ; + DUP 6 ; GET ; IF_NONE - { DIG 7 ; DROP ; DIG 2 ; PAIR ; SWAP } - { DUP 8 ; + { DIG 6 ; + DIG 7 ; + DROP 2 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DIG 2 ; + PAIR ; + SWAP } + { DUP 7 ; CAR ; CAR ; CDR ; CDR ; - DIG 5 ; + DIG 4 ; PAIR ; - DUP 8 ; - CDR ; + DUP 7 ; CDR ; CDR ; - DIG 5 ; + DIG 4 ; PAIR ; - DIG 3 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; DUP 4 ; PAIR ; PAIR ; @@ -2788,20 +3055,20 @@ SWAP ; GET 3 ; INT ; - PUSH int 1 ; - SWAP ; - PAIR ; DIG 10 ; INT ; PUSH int 1 ; SWAP ; PAIR ; - DUP 2 ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; CAR ; - DUP 2 ; + DUP 3 ; CDR ; MUL ; - DIG 2 ; + SWAP ; CDR ; DUP 3 ; CAR ; @@ -2861,36 +3128,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 25 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2932,36 +3175,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 23 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -2986,20 +3205,20 @@ SWAP ; GET 6 ; INT ; - PUSH int 1 ; - SWAP ; - PAIR ; DIG 10 ; INT ; PUSH int 1 ; SWAP ; PAIR ; - DUP 2 ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; CAR ; - DUP 2 ; + DUP 3 ; CDR ; MUL ; - DIG 2 ; + SWAP ; CDR ; DUP 3 ; CAR ; @@ -3059,36 +3278,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 25 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -3130,36 +3325,12 @@ { SWAP } ; DUP ; CDR ; - PUSH nat 1 ; PUSH nat 0 ; PUSH nat 10 ; PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; + DUP 23 ; + SWAP ; + EXEC ; DIG 2 ; CAR ; MUL ; @@ -3288,7 +3459,7 @@ (pair nat nat nat nat nat nat nat nat) (pair string string) nat - bool) ; + (option (or unit unit))) ; SWAP ; UPDATE ; UPDATE 2 } @@ -3304,7 +3475,8 @@ PAIR ; PAIR } ; DIG 5 ; - DROP ; + DIG 6 ; + DROP 2 ; UNPAIR ; UNPAIR ; UNPAIR ; @@ -3429,1450 +3601,1371 @@ UPDATE 1 ; UPDATE 1 ; UPDATE 1 ; - SWAP } } - { DIG 2 ; - DROP ; - IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 5 ; - CDR ; - CAR ; - CAR ; - CAR ; - DIG 5 ; - NONE bytes ; - SWAP ; - UPDATE ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; + SWAP } + { DIG 2 ; + DIG 3 ; + DROP 3 ; PUSH mutez 1 ; AMOUNT ; COMPARE ; LT ; IF {} { PUSH nat 118 ; FAILWITH } ; - DUP ; - GET 8 ; - IF {} { PUSH nat 137 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - SWAP ; - DUP 3 ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - GET ; - IF_NONE - { DROP 2 ; PUSH nat 117 ; FAILWITH } - { DROP ; - DUP 3 ; - CDR ; - CDR ; - CDR ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP ; - CAR ; - DUP 2 ; - CDR ; - DIG 4 ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - NONE (pair (pair string string) address string nat bool) ; - SWAP ; - UPDATE ; - DUP 3 ; - DUP 3 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 3 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 6 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 7 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP ; DIG 2 } - { DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP ; DIG 2 } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { DIG 3 ; - DIG 2 ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 3 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP } - { DUP ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { SWAP ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - SWAP ; - PAIR } ; - UNPAIR ; - DUP 3 ; - DIG 3 ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 } ; - NIL operation } ; + NIL operation } } ; PAIR } } } - { DIG 3 ; - DROP ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 117 ; FAILWITH } - { DUP 3 ; - CDR ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; + { DIG 2 ; + DIG 4 ; + DROP 2 ; + IF_LEFT + { DIG 2 ; + DIG 3 ; DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - DUP ; - GET 8 ; - DUP 2 ; - GET 7 ; - DUP 3 ; - GET 5 ; - DUP 4 ; - GET 3 ; - DUP 5 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; - DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 122 ; FAILWITH } {} ; - UNPAIR ; - DUP 5 ; - CDR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - GET ; - IF_NONE - {} + DROP 3 ; + IF_LEFT { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + CAR ; + DIG 5 ; + NONE bytes ; SWAP ; - GET 4 ; + UPDATE ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; COMPARE ; - GE ; - IF { PUSH nat 121 ; FAILWITH } {} } ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - INT ; - DUP 2 ; - SWAP ; - NOW ; - SUB ; - COMPARE ; - LT ; - IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; - CAR ; - DIG 3 ; - GET 7 ; - DUP ; - DUP 3 ; - CAR ; - CAR ; - GET 7 ; - COMPARE ; - GT ; - IF { DUP 2 ; - CAR ; - CAR ; - GET 7 ; - SUB ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - DIG 3 ; - MUL ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 2 ; - CAR ; - CAR ; - GET 7 ; - INT ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DIG 2 ; - SWAP ; - DUP 3 ; - CDR ; - GET 3 ; - DIG 3 ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 3 ; - DUP 3 ; - CDR ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - SWAP ; - GET 7 ; - SWAP ; - GET 7 ; - SUB ; - DUP ; - ABS ; - INT ; - PUSH int 10 ; - PAIR ; - DIG 5 ; - SWAP ; - EXEC ; - PUSH int 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } - { PUSH int 0 ; - DIG 2 ; - COMPARE ; - LT ; - IF { PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - PUSH int 1 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL } - { PUSH int 1 ; SWAP } } ; - PAIR ; - DUP 2 ; - GET 3 ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - UPDATE 3 ; - DUP 3 ; - CDR ; - CAR ; - CAR ; - CDR ; - DUP 4 ; - DIG 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 5 ; - DUP 8 ; - GET ; - IF_NONE - { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } - { GET 4 ; - DUP 7 ; - GET 4 ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; COMPARE ; - GT ; - IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - DUP 2 ; - CAR ; - UNIT ; - LEFT unit ; - PAIR ; - NOW ; - DUP 3 ; - CAR ; - CAR ; - CAR ; - CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - DUP 4 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CDR ; - DUP 4 ; - CAR ; - DUP 4 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { DROP 2 ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat - bool) } - { DUP ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP ; + GET 8 ; + IF {} { PUSH nat 137 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP ; + CDR ; GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool False } ; - IF { SWAP ; DIG 2 ; DROP 2 } - { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 3 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - PUSH bool False ; - PUSH nat 0 ; - DIG 3 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 7 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 2 ; + DUP 2 ; + CAR ; + DIG 2 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE + { DROP 2 ; PUSH nat 117 ; FAILWITH } + { DROP ; + DUP 3 ; + CDR ; + CDR ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP ; + CAR ; + DUP 2 ; + CDR ; + DIG 4 ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + NONE (pair (pair string string) address string nat bool) ; + SWAP ; + UPDATE ; + DUP 3 ; + DUP 3 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 3 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 6 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 7 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP ; DIG 2 } + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP ; DIG 2 } + { DUP 3 ; + GET 8 ; DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; DUP 3 ; - CDR ; - DUP 3 ; - SOME ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; + DIG 5 ; CAR ; - SOME ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 3 ; + DIG 2 ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 3 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP } + { DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; DUP 4 ; GET 7 ; - UNPAIR ; - DUP ; DUP 3 ; + GET 7 ; COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; - DROP ; - DUP 3 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; SWAP } } ; - SWAP } ; - SOME } ; - IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DROP 4 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 3 ; DROP 2 ; PUSH bool False } - { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } - { DIG 3 ; DROP 2 ; PUSH bool False } ; - IF { NOW ; - DUP 2 ; - GET 5 ; - DUP ; - GET 9 ; - INT ; - DUP 2 ; - GET 11 ; - INT ; - DUP 3 ; - GET 13 ; - INT ; - DUP 4 ; - CAR ; - INT ; - DUP 5 ; - GET 3 ; - INT ; - DUP 6 ; - GET 5 ; - INT ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR ; - PAIR ; - SWAP ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 8 ; - GET 3 ; - DUP 2 ; - CAR ; - CAR ; - DUP 4 ; - UNPAIR ; - UNPAIR ; - DUP 5 ; - DUP 15 ; - DIG 4 ; - DIG 4 ; - DIG 4 ; - ADD ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 2 ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { SWAP ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 } ; + NIL operation ; + PAIR } + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CAR ; + CDR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 5 ; PUSH nat 117 ; FAILWITH } + { DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; + DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 122 ; FAILWITH } {} ; + UNPAIR ; + DUP 5 ; + CDR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + GET ; + IF_NONE + {} + { DUP 2 ; + SWAP ; + GET 4 ; + COMPARE ; + GE ; + IF { PUSH nat 121 ; FAILWITH } {} } ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + DUP 2 ; + SWAP ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } ; + DUP 3 ; + CAR ; + DIG 3 ; + GET 7 ; + DUP ; + DUP 3 ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + GT ; + IF { DUP 2 ; CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; + GET 7 ; + SUB ; + PUSH int 10 ; PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DUP 3 ; - CAR ; - UNPAIR ; - DUP 6 ; - UNPAIR ; - CDR ; - DIG 3 ; - DIG 3 ; - ADD ; - DUP 5 ; - DIG 3 ; - DIG 3 ; - ADD ; - PUSH int 1 ; + DUP 7 ; SWAP ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; + EXEC ; DIG 3 ; - UNPAIR ; - UNPAIR ; - DIG 6 ; - CDR ; - DUG 3 ; - ADD ; - ADD ; - DUP 5 ; - CDR ; - DUP 13 ; - CDR ; MUL ; - DIG 5 ; - CAR ; - DUP 13 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; DUP 2 ; CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; CAR ; - MUL ; + GET 7 ; + INT ; + PUSH int 10 ; PAIR ; - PUSH int 1 ; + DUP 7 ; + SWAP ; + EXEC ; + SWAP } + { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; + INT ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DIG 2 ; + SWAP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; + GET 7 ; + SUB ; + DUP ; + ABS ; + INT ; + PUSH int 10 ; + PAIR ; + DIG 5 ; + SWAP ; + EXEC ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } + { PUSH int 0 ; DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - PUSH int 0 ; - DUP 4 ; - CAR ; COMPARE ; LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 1 ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; + IF { PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + PUSH int 1 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL } + { PUSH int 1 ; SWAP } } ; + PAIR ; + DUP 2 ; + GET 3 ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + UPDATE 3 ; + DUP 3 ; + CDR ; + CAR ; + CAR ; + CDR ; + DUP 4 ; + DIG 4 ; + CDR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 5 ; + DUP 8 ; + GET ; + IF_NONE + { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } + { GET 4 ; + DUP 7 ; + GET 4 ; + COMPARE ; + GT ; + IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + DUP 2 ; + CAR ; + UNIT ; + LEFT unit ; + PAIR ; + NOW ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + DIG 2 ; + UNPAIR ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 3 ; + CDR ; + DUP 4 ; + CAR ; + DUP 4 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DROP 2 ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + (option (or unit unit))) } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool False } ; + IF { SWAP ; DIG 2 ; DROP 2 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 3 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DIG 3 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 7 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 2 ; DROP 2 ; SWAP } } + { DIG 3 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DUP 5 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 } ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DUP 4 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; SWAP } } ; + SWAP } ; + SOME } ; + IF_NONE + { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 3 ; DROP 2 ; PUSH bool False } + { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } + { DIG 3 ; DROP 2 ; PUSH bool False } ; + IF { NOW ; + DUP 2 ; + GET 5 ; + DUP ; + GET 9 ; + INT ; + DUP 2 ; + GET 11 ; + INT ; + DUP 3 ; + GET 13 ; + INT ; + DUP 4 ; + CAR ; + INT ; + DUP 5 ; + GET 3 ; + INT ; + DUP 6 ; + GET 5 ; + INT ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR ; + PAIR ; + SWAP ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 8 ; + GET 3 ; + DUP 2 ; + CAR ; + CAR ; + DUP 4 ; UNPAIR ; - PUSH nat 0 ; + UNPAIR ; + DUP 5 ; + DUP 15 ; + DIG 4 ; + DIG 4 ; + DIG 4 ; + ADD ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DUP 3 ; + CAR ; + UNPAIR ; + DUP 6 ; + UNPAIR ; + CDR ; + DIG 3 ; + DIG 3 ; + ADD ; + DUP 5 ; + DIG 3 ; + DIG 3 ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DIG 3 ; + UNPAIR ; + UNPAIR ; + DIG 6 ; + CDR ; + DUG 3 ; + ADD ; + ADD ; + DUP 5 ; + CDR ; + DUP 13 ; + CDR ; + MUL ; + DIG 5 ; + CAR ; + DUP 13 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 14 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 1 ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; PUSH nat 0 ; - DUP 3 ; + PUSH nat 10 ; + PAIR ; + DUP 15 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 1 ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; PUSH nat 0 ; - DUP 3 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 4 ; + CAR ; + DUP 7 ; + CDR ; + MUL ; + DUP 5 ; + CDR ; + DUP 8 ; + CAR ; + MUL ; COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 8 ; + CDR ; + MUL ; + DUP 7 ; + CDR ; + DUP 9 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } + { DUP 4 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 4 ; + CDR ; + DUP 6 ; + CAR ; + MUL ; COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 6 ; + CDR ; MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 4 ; - CAR ; - DUP 7 ; - CDR ; - MUL ; - DUP 5 ; - CDR ; - DUP 8 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 8 ; - CDR ; - MUL ; - DUP 7 ; - CDR ; - DUP 9 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } - { DUP 4 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 4 ; - CDR ; - DUP 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 6 ; - CDR ; - DIG 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; - DUP 10 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 4 ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR 3 ; - PAIR 4 ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - GET 3 ; - DUP 3 ; - CAR ; - ADD ; - DUP 3 ; - GET 13 ; - DIG 3 ; - GET 11 ; - ADD ; - SWAP } + DIG 6 ; + CDR ; + DIG 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; + DUP 10 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 4 ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR 3 ; + PAIR 4 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + GET 3 ; + DUP 3 ; + CAR ; + ADD ; + DUP 3 ; + GET 13 ; + DIG 3 ; + GET 11 ; + ADD ; + SWAP } + { DROP ; + DUP 2 ; + GET 13 ; + DUP 3 ; + GET 11 ; + DUP 4 ; + GET 9 ; + ADD ; + ADD ; + DIG 2 ; + CAR } } { DROP ; DUP 2 ; - GET 13 ; + GET 5 ; DUP 3 ; - GET 11 ; + GET 3 ; DUP 4 ; - GET 9 ; + CAR ; ADD ; ADD ; DIG 2 ; - CAR } } - { DROP ; - DUP 2 ; - GET 5 ; + GET 13 ; + SWAP } ; DUP 3 ; GET 3 ; - DUP 4 ; - CAR ; - ADD ; - ADD ; - DIG 2 ; - GET 13 ; - SWAP } ; - DUP 3 ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 9 ; DROP 2 ; DUP 8 } + IF_LEFT + { IF_LEFT + { DIG 9 ; DROP 2 ; DUP 8 } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } } { DROP ; DUP 8 ; GET 3 ; DUP 10 ; - CAR ; + CDR ; DUP 2 ; CDR ; MUL ; DIG 10 ; - CDR ; + CAR ; DIG 2 ; CAR ; MUL ; PAIR ; DUP 9 ; SWAP ; - UPDATE 3 } } - { DROP ; - DUP 8 ; + UPDATE 3 } ; + DUP 4 ; GET 3 ; - DUP 10 ; + IF_LEFT + { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } + { DROP ; DUP 4 ; CAR ; GET 4 } ; + DUP 2 ; + GET 3 ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; CDR ; DUP 2 ; CDR ; MUL ; - DIG 10 ; + DIG 2 ; CAR ; DIG 2 ; CAR ; MUL ; PAIR ; - DUP 9 ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DIG 13 ; SWAP ; - UPDATE 3 } ; - DUP 4 ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } - { DROP ; DUP 4 ; CAR ; GET 4 } ; - DUP 2 ; - GET 3 ; - DUP 2 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 0 ; - DUP 2 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } - {} ; - DUP ; - CDR ; - PUSH nat 1 ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 5 ; + DIG 5 ; + DIG 2 ; + DIG 5 ; + DIG 4 ; + PAIR 4 ; + UPDATE 5 ; + SWAP ; + UPDATE 6 ; + DIG 2 ; + DIG 5 ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + LEFT (pair timestamp timestamp) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DIG 3 ; + GET 7 ; UNPAIR ; - PUSH nat 0 ; + DUP ; DUP 3 ; COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 5 ; - DIG 5 ; - DIG 2 ; - DIG 5 ; - DIG 4 ; - PAIR 4 ; - UPDATE 5 ; - SWAP ; - UPDATE 6 ; - DIG 2 ; - DIG 5 ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - LEFT (pair timestamp timestamp) ; - LEFT timestamp ; - UPDATE 3 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DIG 3 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 3 ; DIG 4 ; DROP 3 } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 } ; - NIL operation ; - PAIR } } } ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } } ; view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; view "get_valid_swaps" unit @@ -4882,7 +4975,7 @@ (string %oracle_asset_name) (nat %oracle_precision) (bool %is_disabled_for_deposits))) - { CDR ; CDR ; CDR ; CAR } ; + { CDR ; CDR ; CAR ; CDR ; CDR } ; view "get_valid_tokens" unit (map string @@ -4891,7 +4984,7 @@ (option %address address) (nat %decimals) (option %standard string))) - { CDR ; CDR ; CDR ; CDR } ; + { CDR ; CDR ; CDR } ; view "get_current_batches" unit (list (pair (nat %batch_number) @@ -4927,7 +5020,7 @@ (nat %sell_total_volume)) (pair %pair string string) (nat %holdings) - (bool %market_vault_used))) + (option %market_vault_used (or (unit %buy) (unit %sell))))) { CDR ; NIL (pair nat (or (or (pair (pair timestamp @@ -4941,7 +5034,7 @@ (pair nat nat nat nat nat nat nat nat) (pair string string) nat - bool) ; + (option (or unit unit))) ; DUP 2 ; CAR ; CAR ; diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index 87d4fd91..37f12b7e 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -1,12 +1,15 @@ (Pair (Pair (Pair (Pair "tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" {} {}) 600 10000) (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) 10 + (Pair 0 {}) + {} {}) - (Pair (Pair {} {}) {} {}) - { Elt "tzBTC/EURL" - (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; - Elt "tzBTC/USDT" - (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) } + (Pair (Pair {} {}) + {} + { Elt "tzBTC/EURL" + (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; + Elt "tzBTC/USDT" + (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) }) { Elt "EURL" (Pair 0 "EURL" (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") 6 (Some "FA2 token")) ; Elt "USDT" (Pair 0 "USDT" (Some "KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR") 6 (Some "FA2 token")) ; Elt "tzBTC" diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 5ad39f7c..2703019c 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -47,6 +47,12 @@ [@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n [@inline] let batch_already_removed : nat = 143n [@inline] let admin_and_fee_recipient_address_cannot_be_the_same = 144n +[@inline] let incorrect_market_vault_holder = 145n +[@inline] let incorrect_market_vault_id = 146n +[@inline] let market_vault_tokens_are_different = 147n +[@inline] let unable_to_find_user_holding_for_id = 148n +[@inline] let unable_to_find_vault_holding_for_id = 149n +[@inline] let user_in_holding_is_incorrect = 150n (* Constants *) @@ -244,7 +250,7 @@ type batch = [@layout:comb] { volumes : volumes; pair : pair; holdings : nat; - market_vault_used : bool; + market_vault_used : side option; } type batch_indices = (string, nat) map @@ -295,22 +301,33 @@ type foreign_tokens = (string, token_amount) map type market_maker_vault = { total_shares: nat; + holdings: nat set; native_token: token_amount; foreign_tokens: foreign_tokens; } -type market_vaults = (string,market_maker_vault) big_map +type market_vaults = (string, market_maker_vault) big_map -type market_vault_holding = { - name: string; +type market_vault_holding = { + id: nat; + token: string; + holder: address; shares: nat; + unclaimed: tez; } -type market_vault_holdings = (string, market_vault_holding) map +type user_holding_key = address * string -type user_market_vault_holdings = (address, market_vault_holdings) big_map +type user_holdings = (user_holding_key, nat) big_map +type vault_holdings = (nat, market_vault_holding) big_map +type market_maker = { + vaults: market_vaults; + last_holding_id: nat; + user_holdings: user_holdings; + vault_holdings: vault_holdings; +} [@inline] let get_token @@ -429,8 +446,7 @@ module Storage = struct administrator : address; limit_on_tokens_or_pairs : nat; deposit_time_window_in_seconds : nat; - market_vaults: market_vaults; - user_market_vault_holdings: user_market_vault_holdings; + market_maker: market_maker; } end @@ -1485,7 +1501,7 @@ let make pair = pair; volumes = volumes; holdings = 0n; - market_vault_used = false; + market_vault_used = None; } [@inline] @@ -1721,59 +1737,110 @@ end module MarketVaultUtils = struct -type market_vault_holding = { - name: string; - shares: nat; -} - -type market_vault_holdings = (string, market_vault_holding) map - -type user_market_vault_holdings = (address, market_vault_holdings) big_map -let add_to_vault - (ta: token_amount) - (mvhs: market_vault_holdings) : market_vault_holdings = - match Map.find_opt ta.token.name mvhs with - | None -> let mvh = { - name = ta.token.name; - shares = ta.amount; - } in - Map.add ta.token.name mvh mvhs - | Some mvh -> let uh = { mvh with shares = mvh.shares + ta.amount; } in - Map.update ta.token.name (Some uh) mvhs +let create_or_update_market_vault_holding + (id: nat) + (token_amount: token_amount) + (holder:address) + (previous_holding: market_vault_holding option) : market_vault_holding = + match previous_holding with + | None -> { + id = id; + token = token_amount.token.name; + holder = holder; + shares = token_amount.amount; + unclaimed = 0mutez; + } + | Some ph -> if not (ph.holder = holder) then failwith incorrect_market_vault_holder else + if not (ph.id = id) then failwith incorrect_market_vault_id else + { ph with shares = ph.shares + token_amount.amount; } + +let create_or_update_market_maker_vault + (id: nat) + (token_amount: token_amount) + (mmv_opt: market_maker_vault option) : market_maker_vault = + match mmv_opt with + | None -> { + total_shares = token_amount.amount; + holdings = Set.literal [ id ]; + native_token = token_amount; + foreign_tokens = (Map.empty : foreign_tokens); + } + | Some mmv -> let nt = mmv.native_token in + if not Token_Utils.are_equivalent_tokens token_amount.token nt.token then failwith token_already_exists_but_details_are_different else + let shares = mmv.total_shares + token_amount.amount in + let native_token = { nt with amount = nt.amount + token_amount.amount; } in + let hldgs = if Set.mem id mmv.holdings then mmv.holdings else Set.add id mmv.holdings in + { + mmv with holdings = hldgs; total_shares = shares; native_token = native_token; + } -let add_shares - (holder: address) - (ta: token_amount) - (umvhs: user_market_vault_holdings) : user_market_vault_holdings = - match Big_map.find_opt holder umvhs with - | None -> let vh = { - name = ta.token.name; - shares = ta.amount; - } in - let mvh = Map.literal [ - (ta.token.name, vh) - ] in - Big_map.add holder mvh umvhs - | Some mvhs -> let mvhs = add_to_vault ta mvhs in - Big_map.update holder (Some mvhs) umvhs - - -let mint_shares +let add_liquidity + (h_key: user_holding_key) + (uh_opt: nat option) + (new_holding_id: nat) + (holder: address) + (token_amount: token_amount) + (market_maker: market_maker): market_maker = + let max_hid = market_maker.last_holding_id in + let token_name = token_amount.token.name in + let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let new_holding = { + id = new_holding_id; + token = token_amount.token.name; + holder = holder; + shares = token_amount.amount; + unclaimed = 0mutez; + } in + let (vts,vhs,uhs, mid) = match uh_opt with + | None -> let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in + let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in + (vts,vhs,uhs, new_holding_id) + | Some id -> let vault = create_or_update_market_maker_vault id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let vh_opt = Big_map.find_opt id market_maker.vault_holdings in + if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else + let vh = Option.unopt vh_opt in + let () = Shared.assert_or_fail (vh.holder = holder) user_in_holding_is_incorrect in + let vh = {vh with shares = vh.shares + token_amount.amount; } in + let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in + (vts,vhs,market_maker.user_holdings, max_hid) + in + { market_maker with + vaults = vts; + vault_holdings = vhs; + user_holdings = uhs; + last_holding_id = mid; + } + + +let update_liquidity + (_h_key: user_holding_key) + (_uh_opt: nat option) + (_current_holding_id: nat) + (_holder: address) + (_token_amount: token_amount) + (market_maker: market_maker): market_maker = market_maker + +let add_liquidity_to_market_maker (holder: address) (token_amount: token_amount) - (storage: Storage.t) : Storage.t = - let vault = match Big_map.find_opt token_amount.token.name storage.market_vaults with - | None -> { - total_shares = token_amount.amount; - native_token = token_amount; - foreign_tokens = (Map.empty: foreign_tokens); - } - | Some v -> { v with total_shares = v.total_shares + token_amount.amount; } - in - let vaults = Big_map.add token_amount.token.name vault storage.market_vaults in - let shares = add_shares holder token_amount storage.user_market_vault_holdings in - { storage with market_vaults = vaults; user_market_vault_holdings = shares;} + (storage: Storage.t): ( operation list * Storage.t) = + let ops = Treasury.deposit holder token_amount in + let market_maker = storage.market_maker in + let last_holding_id = market_maker.last_holding_id in + let next_holding_id = last_holding_id + 1n in + let h_key = (holder, token_amount.token.name) in + let uh_opt = Big_map.find_opt h_key market_maker.user_holdings in + let mm = match uh_opt with + | None -> add_liquidity h_key uh_opt next_holding_id holder token_amount market_maker + | Some uh_id -> update_liquidity h_key uh_opt uh_id holder token_amount market_maker + in + let storage ={ storage with market_maker = mm; } in + (ops, storage) + end @@ -1802,6 +1869,8 @@ type entrypoint = | Change_oracle_source_of_pair of oracle_source_change | Change_deposit_time_window of nat | AddLiquidity of token_amount + | RemoveLiquidity of string + | Claim [@inline] @@ -1996,17 +2065,36 @@ let confirm_swap_pair_is_disabled_prior_to_removal if valid_swap.is_disabled_for_deposits then () else failwith cannot_remove_swap_pair_that_is_not_disabled -(* Deposit Liquidity into a market vault *) +(* Add Liquidity into a market vault *) [@inline] let add_liquidity (token_amount: token_amount) (storage: storage) : result = let () = reject_if_tez_supplied () in let holder = Tezos.get_sender () in - let treasury_ops = Treasury.deposit holder token_amount in - let storage = MarketVaultUtils.mint_shares holder token_amount storage in - (treasury_ops, storage) + MarketVaultUtils.add_liquidity_to_market_maker holder token_amount storage + +(* Add Liquidity into a market vault *) +[@inline] +let claim + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let _holder = Tezos.get_sender () in + no_op (storage) + (* MarketVaultUtils.claim_rewards holder vault_name storage in + (treasury_ops, storage) *) +(* Remove Liquidity into a market vault *) +[@inline] +let remove_liquidity + (_token_name: string) + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let _holder = Tezos.get_sender () in + no_op (storage) + (* let treasury_ops = Treasury.deposit holder token_amount in + let storage = MarketVaultUtils.mint_shares holder token_amount storage in + (treasury_ops, storage) *) (* Register a deposit during a valid (Open) deposit time; fails otherwise. Updates the current_batch if the time is valid but the new batch was not initialized. *) @@ -2285,5 +2373,7 @@ let main | Change_deposit_time_window t -> change_deposit_time_window t storage (* Market Liquidity endpoint *) | AddLiquidity t -> add_liquidity t storage + | RemoveLiquidity n -> remove_liquidity n storage + | Claim -> claim storage diff --git a/batcher/shared.mligo b/batcher/shared.mligo index 712ceac2..bd2e227e 100644 --- a/batcher/shared.mligo +++ b/batcher/shared.mligo @@ -16,3 +16,43 @@ type market_token = { token: token; } + +let assert_or_fail + (predicate: bool) + (error: nat) = + if not predicate then failwith error else () + +let find_or_fail + (type a b) + (key: a) + (error: nat) + (bmap: (a,b) big_map) : b = + match Big_map.find_opt key bmap with + | None -> failwith error + | Some v -> v + +let bi_map_opt_sn + (type a b) + (f_some: a -> b) + (f_none: unit -> b) + (boxed: a option): b = + match boxed with + | Some v -> f_some v + | None -> f_none () + +let map_opt + (type a b) + (f: a -> b) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> Some (f v) + +let bind_opt + (type a b) + (f: a -> b option) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> f v + diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index 0e68d111..ecb25348 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -61,8 +61,11 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_vaults = (Big_map.empty: Batcher.market_vaults); - user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); - + market_maker = { + vaults = (Big_map.empty: Batcher.market_vaults); + last_holding_id = 0n; + user_holdings = (Big_map.empty: Batcher.user_holdings); + vault_holdings = (Big_map.empty: Batcher.vault_holdings); + }; } diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index f6dc32b9..4794d98c 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -61,8 +61,11 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_vaults = (Big_map.empty: Batcher.market_vaults); - user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); - + market_maker = { + vaults = (Big_map.empty: Batcher.market_vaults); + last_holding_id = 0n; + user_holdings = (Big_map.empty: Batcher.user_holdings); + vault_holdings = (Big_map.empty: Batcher.vault_holdings); + }; } diff --git a/batcher/test/common/batch.mligo b/batcher/test/common/batch.mligo index b7408671..f7c3c079 100644 --- a/batcher/test/common/batch.mligo +++ b/batcher/test/common/batch.mligo @@ -226,7 +226,7 @@ let prepare_batch_with_status volumes = empty_volumes; pair = pair; holdings = 0n; - market_vault_used = false; + market_vault_used = (None: Batcher.side option); } in let test_cases = if pressure = Buy then buy_pressure_cases diff --git a/batcher/test/common/storage.mligo b/batcher/test/common/storage.mligo index 8ef0ea75..3546931e 100644 --- a/batcher/test/common/storage.mligo +++ b/batcher/test/common/storage.mligo @@ -105,8 +105,12 @@ let initial_storage_with_admin_and_fee_recipient administrator = admin; limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_vaults = (Big_map.empty: Batcher.market_vaults); - user_market_vault_holdings = (Big_map.empty: Batcher.user_market_vault_holdings); + market_maker = { + vaults = (Big_map.empty: Batcher.market_vaults); + last_holding_id = 0n; + user_holdings = (Big_map.empty: Batcher.user_holdings); + vault_holdings = (Big_map.empty: Batcher.vault_holdings); + }; } diff --git a/batcher/test/market_maker/test_add_liquidity.mligo b/batcher/test/market_maker/test_add_update_liquidity.mligo similarity index 54% rename from batcher/test/market_maker/test_add_liquidity.mligo rename to batcher/test/market_maker/test_add_update_liquidity.mligo index b1df0cac..3f5a4318 100644 --- a/batcher/test/market_maker/test_add_liquidity.mligo +++ b/batcher/test/market_maker/test_add_update_liquidity.mligo @@ -27,19 +27,26 @@ let add_liquidity_should_succeed = let bstorage = Breath.Contract.storage_of batcher in - let vaults = bstorage.market_vaults in + let market_maker = bstorage.market_maker in + let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in + let user_holding = Option.unopt (Big_map.find_opt h_key market_maker.user_holdings) in + let vault_holding = Option.unopt (Big_map.find_opt user_holding market_maker.vault_holdings) in - let btc_vault = Option.unopt (Big_map.find_opt token_name vaults) in Breath.Result.reduce [ act_allow_transfer ; act_add_liquidity - ; Breath.Assert.is_equal "total shares should be same" deposit_amount btc_vault.total_shares + ; Breath.Assert.is_equal "total shares should be same" deposit_amount vault.total_shares + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity" btc_trader.address vault_holding.holder + ; Breath.Assert.is_equal "for the first liquidity , total shares hould be equal to holding shares" vault_holding.shares vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to amount" vault.native_token.amount vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to deposit amount" deposit_amount vault.total_shares ]) let test_suite = - Breath.Model.suite "Suite for Add Liquidity" [ + Breath.Model.suite "Suite for Add / Update Liquidity" [ add_liquidity_should_succeed ] diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo index b1aa2a28..55ead4ea 100644 --- a/batcher/test/test.mligo +++ b/batcher/test/test.mligo @@ -13,7 +13,7 @@ #import "./endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" #import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" #import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" -#import "./market_maker/test_add_liquidity.mligo" "Market_Maker_Add_Liquidity" +#import "./market_maker/test_add_update_liquidity.mligo" "Market_Maker_Add_Update_Liquidity" #import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" #import "./economics/test_clearing.mligo" "Economics_Clearing" @@ -44,7 +44,7 @@ let () = Breath.Model.run_suites Void [ test_suite - ; Admin_Change_Fee.test_suite + (* ; Admin_Change_Fee.test_suite ; Admin_Change_Admin_Address.test_suite ; Admin_Change_Fee_Recipient_Address.test_suite ; Admin_Change_Deposit_Time_Window.test_suite @@ -56,8 +56,8 @@ let () = ; Maintenance_Tick.test_suite ; Economics_Clearing.test_suite ; User_Deposits.test_suite - ; User_Cancellations.test_suite + ; User_Cancellations.test_suite *) // ; User_Redemptions.test_suite - ; Market_Maker_Add_Liquidity.test_suite + ; Market_Maker_Add_Update_Liquidity.test_suite ] From 8e2097bd3bf48f88fde17cde2a5240666bbec5cf Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Wed, 30 Aug 2023 14:18:32 +0300 Subject: [PATCH 084/108] Added add/remove liquidity and claim rewards tests. Added view for getting vault holdings summary --- batcher/Makefile | 2 +- batcher/batcher-ghostnet.tz | 880 ++++++++++++++---- batcher/batcher.mligo | 242 +++-- batcher/shared.mligo | 12 +- batcher/test/common/helpers.mligo | 52 +- batcher/test/common/storage.mligo | 10 +- .../test/endpoints/user/test_deposits.mligo | 9 +- .../test_add_update_liquidity.mligo | 135 ++- .../market_maker/test_claim_rewards.mligo | 42 + .../market_maker/test_remove_liquidity.mligo | 72 ++ batcher/test/test.mligo | 10 +- batcher/test/tokens/fa12/main.mligo | 2 + batcher/test/tokens/fa2/main.mligo | 7 +- 13 files changed, 1229 insertions(+), 246 deletions(-) create mode 100644 batcher/test/market_maker/test_claim_rewards.mligo create mode 100644 batcher/test/market_maker/test_remove_liquidity.mligo diff --git a/batcher/Makefile b/batcher/Makefile index 49ab7d7f..39fab41a 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -1,6 +1,6 @@ .PHONY: test -LIGO_COMPILER_VERSION:=0.70.0 +LIGO_COMPILER_VERSION:=0.72.0 TEZOS_PROTOCOL:=mumbai LIGO_DOCKER := docker run --rm -v $(PWD):$(PWD) -w $(PWD) ligolang/ligo:$(LIGO_COMPILER_VERSION) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index e85f87f2..e1074055 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -37,7 +37,7 @@ (address %oracle_address) (string %oracle_asset_name) (nat %oracle_precision))) - (or (unit %claim) + (or (string %claim) (pair %deposit (pair %swap (pair %from @@ -211,6 +211,10 @@ PAIR ; PAIR ; LEFT nat } } } ; + LAMBDA + (pair bool nat) + unit + { UNPAIR ; NOT ; IF { FAILWITH } { DROP ; UNIT } } ; PUSH int 1 ; PUSH int 10000 ; PAIR ; @@ -228,6 +232,7 @@ CAR ; MUL ; PAIR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; LAMBDA (pair (pair (pair nat string (option address) nat (option string)) nat) (map string (pair (pair nat string (option address) nat (option string)) nat))) @@ -283,18 +288,21 @@ SWAP ; DROP } ; LAMBDA - (pair nat - (pair (pair nat string (option address) nat (option string)) nat) - (option - (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) - (set nat)) - (pair (pair nat string (option address) nat (option string)) nat) - nat))) + (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) + (pair nat + (pair (pair nat string (option address) nat (option string)) nat) + (option + (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) + (set nat)) + (pair (pair nat string (option address) nat (option string)) nat) + nat)))) (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) (set nat)) (pair (pair nat string (option address) nat (option string)) nat) nat) - { UNPAIR 3 ; + { UNPAIR ; + SWAP ; + UNPAIR 3 ; DIG 2 ; IF_NONE { DUP 2 ; @@ -306,10 +314,12 @@ PUSH bool True ; SWAP ; UPDATE ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DIG 2 ; PAIR ; PAIR } - { DUP ; + { DIG 3 ; + DROP ; + DUP ; CDR ; CAR ; DUP ; @@ -387,15 +397,103 @@ DIG 2 ; UPDATE 1 ; UPDATE 2 } } } ; - DIG 5 ; + DUP 4 ; + APPLY ; + LAMBDA + (pair (pair (lambda + (pair (pair (pair nat string (option address) nat (option string)) nat) + (map string (pair (pair nat string (option address) nat (option string)) nat))) + (map string (pair (pair nat string (option address) nat (option string)) nat))) + (lambda (pair nat nat) nat)) + (pair (pair int int) + (pair (pair nat string (option address) nat (option string)) nat) + (map string (pair (pair nat string (option address) nat (option string)) nat)))) + (pair (pair (pair nat string (option address) nat (option string)) nat) + (map string (pair (pair nat string (option address) nat (option string)) nat))) + { UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR 3 ; + DUP 2 ; + CDR ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DIG 6 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 2 ; + CDR ; + DUP 2 ; + COMPARE ; + GT ; + IF { DROP 4 ; PUSH nat 153 ; FAILWITH } + { DUP ; + DUP 3 ; + CDR ; + INT ; + SUB ; + ABS ; + DUP 3 ; + DIG 2 ; + UPDATE 2 ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + EQ ; + IF { DIG 4 ; DROP 2 ; DIG 2 } + { DIG 3 ; SWAP ; PAIR ; DIG 3 ; SWAP ; EXEC } ; + DUG 2 ; + UPDATE 2 ; + PAIR } } ; + DUP 8 ; + DUP 5 ; + PAIR ; + APPLY ; + DIG 8 ; UNPAIR ; IF_LEFT - { DIG 3 ; - DIG 5 ; + { DIG 4 ; + DIG 7 ; DROP 2 ; IF_LEFT - { DIG 4 ; - DROP ; + { DIG 2 ; + DIG 5 ; + DIG 7 ; + DROP 3 ; IF_LEFT { DIG 3 ; DROP ; @@ -475,150 +573,70 @@ CDR ; DUP 2 ; GET ; - DUP ; IF_NONE - { DUP 7 ; + { DIG 8 ; + DROP ; + DUP 6 ; CAR ; GET 3 ; - DUP 5 ; + DUP 4 ; CDR ; CDR ; DUP 2 ; GET ; - DIG 2 ; - IF_NONE - { DUP 8 ; - DUP 5 ; - PAIR 3 ; - DIG 9 ; - SWAP ; - EXEC ; - DUP 4 ; - DUP 6 ; - CAR ; - CDR ; - DUP 6 ; - DIG 5 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - PAIR ; - DUP 5 ; - CDR ; - CAR ; - PUSH mutez 0 ; - DUP 10 ; - CAR ; - GET 3 ; - DIG 10 ; - CDR ; - PAIR ; - DUP 7 ; - DIG 10 ; - PAIR ; - PAIR ; - PAIR ; - DIG 5 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DUP 5 ; - CDR ; - CDR ; - DIG 3 ; - SOME ; - DIG 4 ; - UPDATE ; - PAIR ; - PAIR } - { DIG 3 ; - DIG 4 ; - DROP 2 ; - SWAP ; - DUP 7 ; - DUP 3 ; - PAIR 3 ; - DIG 8 ; - SWAP ; - EXEC ; - DUP 4 ; - CDR ; - CAR ; - DUP 3 ; - GET ; - NONE (pair (pair (pair address nat) nat string) mutez) ; - DUP 2 ; - COMPARE ; - EQ ; - IF { SWAP ; DIG 2 ; DIG 3 ; DIG 6 ; DIG 7 ; DROP 6 ; PUSH nat 149 ; FAILWITH } - { IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; - DIG 6 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - NOT ; - IF { PUSH nat 150 ; FAILWITH } {} ; - DUP ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - DIG 9 ; - CDR ; - DIG 4 ; - CAR ; - CDR ; - CAR ; - ADD ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - DUP 5 ; - CAR ; - CAR ; - DUP 6 ; - CAR ; - CDR ; - PAIR ; - DUP 6 ; - CDR ; - CAR ; - DIG 2 ; - SOME ; - DIG 4 ; - UPDATE ; - DUP 5 ; - CDR ; - CDR ; - DIG 3 ; - SOME ; - DIG 4 ; - UPDATE ; - PAIR ; - PAIR } } ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR ; + DUP 8 ; DUP 5 ; - DIG 5 ; + PAIR 3 ; + DIG 9 ; + SWAP ; + EXEC ; + DUP 5 ; + DUP 6 ; + CDR ; + DUP 7 ; + CDR ; CDR ; + DIG 3 ; + SOME ; DIG 4 ; + UPDATE ; UPDATE 2 ; UPDATE 2 ; DUP ; CDR ; - DIG 4 ; + DUP 5 ; + CDR ; + CAR ; + PUSH mutez 0 ; + DUP 10 ; + CAR ; + GET 3 ; + DIG 10 ; + CDR ; + PAIR ; + DUP 7 ; + DIG 10 ; + PAIR ; + PAIR ; + PAIR ; + DUP 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; UPDATE 1 ; UPDATE 2 ; DUP ; CAR ; - DIG 2 ; + DIG 4 ; + CAR ; + CDR ; + DUP 5 ; + DIG 4 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; UPDATE 2 ; UPDATE 1 ; DUP ; @@ -626,7 +644,101 @@ DIG 2 ; UPDATE 1 ; UPDATE 1 } - { SWAP ; DIG 2 ; DIG 3 ; DIG 6 ; DIG 7 ; DIG 9 ; DROP 7 } ; + { SWAP ; + DIG 2 ; + DROP 2 ; + DUP 5 ; + CAR ; + GET 3 ; + DUP 3 ; + CDR ; + CDR ; + DUP 2 ; + GET ; + DUP 7 ; + DUP 4 ; + PAIR 3 ; + DIG 8 ; + SWAP ; + EXEC ; + DUP 4 ; + CDR ; + CAR ; + DUP 4 ; + GET ; + NONE (pair (pair (pair address nat) nat string) mutez) ; + DUP 2 ; + COMPARE ; + EQ ; + IF { SWAP ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 6 ; + DIG 7 ; + DIG 9 ; + DROP 8 ; + PUSH nat 149 ; + FAILWITH } + { IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; + PUSH nat 150 ; + DIG 7 ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + PAIR ; + DIG 9 ; + SWAP ; + EXEC ; + DROP ; + DUP ; + DUP 2 ; + CAR ; + DUP ; + CDR ; + DIG 9 ; + CDR ; + DIG 4 ; + CAR ; + CDR ; + CAR ; + ADD ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP 5 ; + DUP 6 ; + CDR ; + DUP 7 ; + CDR ; + CDR ; + DIG 4 ; + SOME ; + DIG 5 ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DUP 5 ; + CDR ; + CAR ; + DIG 3 ; + SOME ; + DIG 4 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CAR ; + DIG 2 ; + CAR ; + CDR ; + UPDATE 2 ; + UPDATE 1 } } ; DUP 3 ; DIG 3 ; CAR ; @@ -643,7 +755,8 @@ DIG 2 ; CONS } { DIG 2 ; - DROP ; + DIG 3 ; + DROP 2 ; DUP 2 ; CAR ; CAR ; @@ -706,7 +819,8 @@ NIL operation } ; PAIR } { DIG 2 ; - DROP ; + DIG 3 ; + DROP 2 ; IF_LEFT { DUP 2 ; CAR ; @@ -1149,7 +1263,8 @@ NIL operation ; PAIR } } } } } { DIG 2 ; - DROP ; + DIG 4 ; + DROP 2 ; IF_LEFT { IF_LEFT { PUSH mutez 1 ; @@ -1812,12 +1927,15 @@ UPDATE 1 ; NIL operation ; PAIR } } } } - { DIG 2 ; + { DIG 3 ; DROP ; IF_LEFT { DIG 2 ; DIG 3 ; - DROP 2 ; + DIG 4 ; + DIG 5 ; + DIG 6 ; + DROP 5 ; IF_LEFT { IF_LEFT { DUP 2 ; @@ -1917,14 +2035,74 @@ NIL operation ; PAIR } { IF_LEFT - { DROP ; - PUSH mutez 1 ; + { PUSH mutez 1 ; AMOUNT ; COMPARE ; LT ; IF {} { PUSH nat 118 ; FAILWITH } ; - NIL operation ; - PAIR } + SENDER ; + DUP 3 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP ; + CAR ; + CDR ; + DIG 3 ; + DUP 4 ; + PAIR ; + GET ; + IF_NONE + { DROP 3 ; PUSH nat 155 ; FAILWITH } + { DUP 2 ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 155 ; FAILWITH } + { DUP ; + CDR ; + PUSH mutez 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP 6 ; PUSH nat 155 ; FAILWITH } + { DIG 4 ; + CONTRACT unit ; + IF_NONE + { DROP ; PUSH nat 102 ; FAILWITH } + { SWAP ; UNIT ; TRANSFER_TOKENS } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DUP 8 ; + DUP 9 ; + CDR ; + DIG 9 ; + CDR ; + CAR ; + DIG 8 ; + PUSH mutez 0 ; + UPDATE 2 ; + SOME ; + DIG 9 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + DIG 2 ; + CONS ; + PAIR } } } } { DUP ; GET 5 ; PUSH nat 0 ; @@ -2774,7 +2952,10 @@ { IF_LEFT { DIG 2 ; DIG 3 ; - DROP 2 ; + DIG 4 ; + DIG 5 ; + DIG 6 ; + DROP 5 ; IF_LEFT { DUP 2 ; CAR ; @@ -2866,7 +3047,10 @@ UPDATE 2 } ; NIL operation } { IF_LEFT - { DROP ; + { DIG 2 ; + DIG 4 ; + DIG 5 ; + DROP 4 ; SENDER ; PUSH mutez 1 ; AMOUNT ; @@ -2895,30 +3079,25 @@ CAR ; CDR ; CAR ; - DUP ; - DUP 6 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DUP 2 ; + DUP 7 ; GET ; IF_NONE - { DIG 6 ; - DIG 7 ; - DROP 2 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DIG 2 ; - PAIR ; - SWAP } - { DUP 7 ; + { DIG 7 ; DIG 8 ; DROP 2 ; DIG 2 ; PAIR ; SWAP } + { DUP 8 ; CAR ; CAR ; CDR ; CDR ; - DIG 4 ; + DIG 5 ; PAIR ; - DUP 7 ; + DUP 8 ; CDR ; CDR ; - DIG 4 ; + DIG 5 ; PAIR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DIG 3 ; DUP 4 ; PAIR ; PAIR ; @@ -3600,21 +3779,293 @@ UPDATE 2 ; UPDATE 1 ; UPDATE 1 ; - UPDATE 1 ; - SWAP } - { DIG 2 ; - DIG 3 ; - DROP 3 ; + UPDATE 1 } + { DIG 6 ; + DROP ; PUSH mutez 1 ; AMOUNT ; COMPARE ; LT ; IF {} { PUSH nat 118 ; FAILWITH } ; - NIL operation } } ; + SENDER ; + DUP 3 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 3 ; + DUP 3 ; + PAIR ; + DUP 2 ; + CAR ; + CDR ; + DUP 2 ; + GET ; + DUP 3 ; + CDR ; + CDR ; + DUP 6 ; + GET ; + DUP 2 ; + IF_NONE { PUSH nat 151 ; FAILWITH } { DROP } ; + DUP ; + IF_NONE { PUSH nat 152 ; FAILWITH } { DROP } ; + DIG 3 ; + SWAP ; + IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; + DIG 3 ; + DIG 5 ; + DIG 5 ; + DIG 5 ; + IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; + DUP 6 ; + CDR ; + CAR ; + DUP ; + DUP 3 ; + GET ; + IF_NONE { PUSH nat 149 ; FAILWITH } {} ; + PUSH nat 150 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + DUP 6 ; + COMPARE ; + EQ ; + PAIR ; + DIG 13 ; + SWAP ; + EXEC ; + DROP ; + UNPAIR ; + CDR ; + CAR ; + DUP 8 ; + CDR ; + CDR ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 14 ; + DUP 10 ; + CDR ; + CAR ; + DUP 3 ; + PAIR 3 ; + DUP 13 ; + SWAP ; + EXEC ; + UNPAIR ; + SWAP ; + DIG 15 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 10 ; + CAR ; + CAR ; + ITER { CDR ; + SWAP ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + DIG 3 ; + DUP 3 ; + PAIR 3 ; + DUP 15 ; + SWAP ; + EXEC ; + UNPAIR ; + DIG 3 ; + SWAP ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + PAIR ; + PAIR } ; + DIG 12 ; + DIG 13 ; + DROP 2 ; + UNPAIR ; + CDR ; + DUP 11 ; + CDR ; + CDR ; + DUP 5 ; + COMPARE ; + GT ; + IF { SWAP ; DIG 2 ; DIG 3 ; DIG 10 ; DROP 5 ; PUSH nat 154 ; FAILWITH } + { DIG 3 ; + DUP 11 ; + CDR ; + CDR ; + SUB ; + ABS ; + DIG 2 ; + DUP 11 ; + DUP 12 ; + CDR ; + DIG 5 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DIG 10 ; + CAR ; + CDR ; + DUP 8 ; + PUSH bool False ; + SWAP ; + UPDATE ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + PAIR } ; + UNPAIR ; + DUP 6 ; + CONTRACT unit ; + IF_NONE { PUSH nat 102 ; FAILWITH } { DUP 4 ; UNIT ; TRANSFER_TOKENS } ; + SELF_ADDRESS ; + NIL operation ; + DIG 4 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 11 ; + DUP 6 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 14 ; + PAIR 3 ; + CONS ; + DUP 6 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + SWAP ; + DIG 7 ; + DROP 2 ; + DUP 9 ; + DUP 10 ; + CAR ; + DUP 11 ; + CAR ; + CDR ; + DIG 10 ; + NONE nat ; + SWAP ; + UPDATE ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; + CDR ; + DIG 6 ; + DIG 7 ; + NONE (pair (pair (pair address nat) nat string) mutez) ; + SWAP ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CDR ; + DIG 7 ; + CDR ; + CDR ; + DIG 5 ; + SOME ; + DIG 7 ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + PUSH mutez 0 ; + DIG 4 ; + COMPARE ; + GT ; + IF { SWAP ; DIG 2 ; CONS } { DIG 2 ; DROP ; SWAP } ; + DUP 3 ; + DIG 3 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP } ; PAIR } } } { DIG 2 ; - DIG 4 ; - DROP 2 ; + DIG 3 ; + DIG 5 ; + DIG 6 ; + DIG 8 ; + DROP 5 ; IF_LEFT { DIG 2 ; DIG 3 ; @@ -5052,5 +5503,80 @@ GET ; IF_NONE {} { CONS } } ; SWAP ; - DROP } } + DROP } ; + view "get_market_vault_holdings" + unit + (pair (map %holdings + string + (pair (pair (pair (address %holder) (nat %id)) (nat %shares) (string %token)) + (mutez %unclaimed))) + (map %vaults + string + (pair (pair (map %foreign_tokens + string + (pair (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount))) + (set %holdings nat)) + (pair %native_token + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (nat %total_shares)))) + { CDR ; + DUP ; + CAR ; + CDR ; + CDR ; + CDR ; + SENDER ; + NIL string ; + DIG 3 ; + CDR ; + CDR ; + ITER { CAR ; CONS } ; + EMPTY_MAP + string + (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) + (set nat)) + (pair (pair nat string (option address) nat (option string)) nat) + nat) ; + DUP 2 ; + ITER { SWAP ; + DUP 5 ; + CDR ; + CDR ; + DUP 3 ; + GET ; + IF_NONE { SWAP ; DROP } { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } ; + EMPTY_MAP string (pair (pair (pair address nat) nat string) mutez) ; + DIG 2 ; + ITER { SWAP ; + DUP 5 ; + CAR ; + CDR ; + DUP 3 ; + DUP 6 ; + PAIR ; + GET ; + IF_NONE + { SWAP ; DROP } + { DUP 6 ; + CDR ; + CAR ; + SWAP ; + GET ; + IF_NONE { SWAP ; DROP } { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + PAIR } } diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 2703019c..34e02565 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -53,6 +53,11 @@ [@inline] let unable_to_find_user_holding_for_id = 148n [@inline] let unable_to_find_vault_holding_for_id = 149n [@inline] let user_in_holding_is_incorrect = 150n +[@inline] let no_holding_in_market_maker_for_holder = 151n +[@inline] let no_market_vault_for_token = 152n +[@inline] let holding_amount_to_redeem_is_larger_than_holding = 153n +[@inline] let holding_shares_greater_than_total_shares_remaining = 154n +[@inline] let no_holdings_to_claim = 155n (* Constants *) @@ -85,8 +90,6 @@ (* The contract assumes that the minimum precision is six and that the oracle precision must EXACTLY be 6 *) [@inline] let minimum_precision : nat = 6n - - (* Side of an order, either BUY side or SELL side *) type side = Buy @@ -189,7 +192,6 @@ type clearing_volumes = [@layout:comb] { plus: nat; } - type clearing = [@layout:comb] { clearing_volumes : clearing_volumes; clearing_tolerance : tolerance; @@ -197,7 +199,6 @@ type clearing = [@layout:comb] { clearing_rate: exchange_rate; } - (* These types are used in math module *) type buy_minus_token = int type buy_exact_token = int @@ -214,7 +215,6 @@ type batch_status = | Closed of { start_time : timestamp ; closing_time : timestamp } | Cleared of { at : timestamp; clearing : clearing; rate : exchange_rate } - type volumes = [@layout:comb] { buy_minus_volume : nat; buy_exact_volume : nat; @@ -263,7 +263,8 @@ type batches = (nat, batch) big_map type batch_set = [@layout:comb] { current_batch_indices: batch_indices; batches: batches; - } +} + (* Type for contract metadata *) type metadata = (string, bytes) big_map @@ -297,13 +298,12 @@ type fees = { recipient: address; } -type foreign_tokens = (string, token_amount) map type market_maker_vault = { total_shares: nat; holdings: nat set; native_token: token_amount; - foreign_tokens: foreign_tokens; + foreign_tokens: token_amount_map; } type market_vaults = (string, market_maker_vault) big_map @@ -360,6 +360,8 @@ module TokenAmountMap = struct type op = Increase | Decrease + let new = (Map.empty: token_amount_map) + let amend (ta: token_amount) (op: op) @@ -1764,7 +1766,7 @@ let create_or_update_market_maker_vault total_shares = token_amount.amount; holdings = Set.literal [ id ]; native_token = token_amount; - foreign_tokens = (Map.empty : foreign_tokens); + foreign_tokens = TokenAmountMap.new; } | Some mmv -> let nt = mmv.native_token in if not Token_Utils.are_equivalent_tokens token_amount.token nt.token then failwith token_already_exists_but_details_are_different else @@ -1777,12 +1779,10 @@ let create_or_update_market_maker_vault let add_liquidity (h_key: user_holding_key) - (uh_opt: nat option) (new_holding_id: nat) (holder: address) (token_amount: token_amount) (market_maker: market_maker): market_maker = - let max_hid = market_maker.last_holding_id in let token_name = token_amount.token.name in let vault_opt = Big_map.find_opt token_name market_maker.vaults in let new_holding = { @@ -1792,37 +1792,38 @@ let add_liquidity shares = token_amount.amount; unclaimed = 0mutez; } in - let (vts,vhs,uhs, mid) = match uh_opt with - | None -> let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in - let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in - (vts,vhs,uhs, new_holding_id) - | Some id -> let vault = create_or_update_market_maker_vault id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let vh_opt = Big_map.find_opt id market_maker.vault_holdings in - if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else - let vh = Option.unopt vh_opt in - let () = Shared.assert_or_fail (vh.holder = holder) user_in_holding_is_incorrect in - let vh = {vh with shares = vh.shares + token_amount.amount; } in - let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in - (vts,vhs,market_maker.user_holdings, max_hid) - in - { market_maker with + let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in + let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in + { market_maker with vaults = vts; vault_holdings = vhs; user_holdings = uhs; - last_holding_id = mid; - } + last_holding_id = new_holding_id; + } let update_liquidity - (_h_key: user_holding_key) - (_uh_opt: nat option) - (_current_holding_id: nat) - (_holder: address) - (_token_amount: token_amount) - (market_maker: market_maker): market_maker = market_maker + (id: nat) + (holder: address) + (token_amount: token_amount) + (market_maker: market_maker): market_maker = + let token_name = token_amount.token.name in + let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let vault = create_or_update_market_maker_vault id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let vh_opt = Big_map.find_opt id market_maker.vault_holdings in + if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else + let vh = Option.unopt vh_opt in + let () = Shared.assert_or_fail_with (vh.holder = holder) user_in_holding_is_incorrect in + let vh = {vh with shares = vh.shares + token_amount.amount; } in + let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in + { market_maker with + vaults = vts; + vault_holdings = vhs; + user_holdings = market_maker.user_holdings; + } let add_liquidity_to_market_maker (holder: address) @@ -1835,13 +1836,114 @@ let add_liquidity_to_market_maker let h_key = (holder, token_amount.token.name) in let uh_opt = Big_map.find_opt h_key market_maker.user_holdings in let mm = match uh_opt with - | None -> add_liquidity h_key uh_opt next_holding_id holder token_amount market_maker - | Some uh_id -> update_liquidity h_key uh_opt uh_id holder token_amount market_maker + | None -> add_liquidity h_key next_holding_id holder token_amount market_maker + | Some uh_id -> update_liquidity uh_id holder token_amount market_maker in let storage ={ storage with market_maker = mm; } in (ops, storage) - +let collect_from_vault + (perc_share: Rational.t) + (ta: token_amount) + (tam: token_amount_map): (token_amount * token_amount_map) = + let rat_amt = Rational.new (int ta.amount) in + let rat_amount_to_redeem = Rational.mul perc_share rat_amt in + let amount_to_redeem = Utils.get_rounded_number_lower_bound rat_amount_to_redeem in + if amount_to_redeem > ta.amount then failwith holding_amount_to_redeem_is_larger_than_holding else + let rem =abs ((int ta.amount) - amount_to_redeem) in + let ta_rem = {ta with amount = rem; } in + let ta_red = {ta with amount = amount_to_redeem; } in + let tam = if ta_red.amount = 0n then tam else TokenAmountMap.increase ta_red tam in + (ta_rem, tam) + +let collect_tokens_for_redemption + (holding_id: nat) + (perc_share: Rational.t) + (shares: nat) + (vault: market_maker_vault) = + let tokens = TokenAmountMap.new in + let (native,tokens) = collect_from_vault perc_share vault.native_token tokens in + let acc: (Rational.t * token_amount_map * token_amount_map) = (perc_share, TokenAmountMap.new, tokens ) in + let collect_redemptions = fun ((ps,rem_t,red_t),(_tn,ta):(Rational.t * token_amount_map * token_amount_map) * (string * token_amount)) -> + let (ta_rem,red_t) = collect_from_vault ps ta red_t in + let rem_t = TokenAmountMap.increase ta_rem rem_t in + (ps,rem_t,red_t) + in + let (_, foreign_tokens, tokens) = Map.fold collect_redemptions vault.foreign_tokens acc in + if shares > vault.total_shares then failwith holding_shares_greater_than_total_shares_remaining else + let rem_shares = abs (vault.total_shares - shares) in + let holdings = Set.remove holding_id vault.holdings in + ({ vault with native_token = native; foreign_tokens = foreign_tokens; holdings = holdings; total_shares = rem_shares;} ,tokens) + +let remove_liquidity + (id: nat) + (holder: address) + (token_name: string) + (h_key: user_holding_key) + (vault: market_maker_vault) + (market_maker: market_maker): (operation list * market_maker) = + let vaults = market_maker.vaults in + let user_holdings = market_maker.user_holdings in + let vault_holdings = market_maker.vault_holdings in + let holding = Shared.find_or_fail_with id unable_to_find_vault_holding_for_id vault_holdings in + let () = Shared.assert_or_fail_with (holder = holding.holder) user_in_holding_is_incorrect in + let unclaimed_tez = holding.unclaimed in + let shares = holding.shares in + let total_shares = vault.total_shares in + let perc_share = Rational.div (Rational.new (int shares)) (Rational.new (int total_shares)) in + let (vault, tam) = collect_tokens_for_redemption id perc_share shares vault in + let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in + let treasury_vault = Treasury.get_treasury_vault () in + let tok_ops = Treasury_Utils.transfer_holdings treasury_vault holder tam in + let vaults = Big_map.update token_name (Some vault) vaults in + let user_holdings = Big_map.remove h_key user_holdings in + let vault_holdings = Big_map.remove id vault_holdings in + let ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in + let mm = { market_maker with user_holdings = user_holdings; vault_holdings = vault_holdings; vaults = vaults; } in + (ops, mm) + +let remove_liquidity_from_market_maker + (holder: address) + (token_name: string) + (storage: Storage.t): ( operation list * Storage.t) = + let market_maker = storage.market_maker in + let h_key = (holder, token_name) in + let uh_opt: nat option = Big_map.find_opt h_key market_maker.user_holdings in + let v_opt = Big_map.find_opt token_name market_maker.vaults in + let () = Shared.assert_some_or_fail_with uh_opt no_holding_in_market_maker_for_holder in + let () = Shared.assert_some_or_fail_with v_opt no_market_vault_for_token in + let (ops, mm) = remove_liquidity (Option.unopt uh_opt) holder token_name h_key (Option.unopt v_opt) market_maker in + let storage = { storage with market_maker = mm; } in + (ops, storage) + +let claim_from_holding + (holder:address) + (id:nat) + (holding: market_vault_holding) + (market_maker: market_maker) + (storage: Storage.t) : (operation list * Storage.t) = + let unclaimed_tez = holding.unclaimed in + if unclaimed_tez = 0mutez then failwith no_holdings_to_claim else + let holding = { holding with unclaimed = 0tez; } in + let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in + let vault_holdings = Big_map.update id (Some holding) market_maker.vault_holdings in + let market_maker = {market_maker with vault_holdings = vault_holdings;} in + let storage = { storage with market_maker = market_maker; } in + ([tez_op], storage) + + +let claim_rewards + (holder:address) + (token_name:string) + (storage:Storage.t) : (operation list * Storage.t) = + let market_maker = storage.market_maker in + let h_key = (holder, token_name) in + match Big_map.find_opt h_key market_maker.user_holdings with + | None -> failwith no_holdings_to_claim + | Some id -> (match Big_map.find_opt id market_maker.vault_holdings with + | None -> failwith no_holdings_to_claim + | Some h ->claim_from_holding holder id h market_maker storage) + end @@ -1868,9 +1970,9 @@ type entrypoint = | Disable_swap_pair_for_deposit of string | Change_oracle_source_of_pair of oracle_source_change | Change_deposit_time_window of nat - | AddLiquidity of token_amount | RemoveLiquidity of string - | Claim + | AddLiquidity of token_amount + | Claim of string [@inline] @@ -2077,24 +2179,20 @@ let add_liquidity (* Add Liquidity into a market vault *) [@inline] let claim + (token_name: string) (storage: storage) : result = let () = reject_if_tez_supplied () in - let _holder = Tezos.get_sender () in - no_op (storage) - (* MarketVaultUtils.claim_rewards holder vault_name storage in - (treasury_ops, storage) *) + let holder = Tezos.get_sender () in + MarketVaultUtils.claim_rewards holder token_name storage (* Remove Liquidity into a market vault *) [@inline] let remove_liquidity - (_token_name: string) + (token_name: string) (storage: storage) : result = let () = reject_if_tez_supplied () in - let _holder = Tezos.get_sender () in - no_op (storage) - (* let treasury_ops = Treasury.deposit holder token_amount in - let storage = MarketVaultUtils.mint_shares holder token_amount storage in - (treasury_ops, storage) *) + let holder = Tezos.get_sender () in + MarketVaultUtils.remove_liquidity_from_market_maker holder token_name storage (* Register a deposit during a valid (Open) deposit time; fails otherwise. Updates the current_batch if the time is valid but the new batch was not initialized. *) @@ -2348,6 +2446,44 @@ let get_current_batches ((),storage: unit * storage) : batch list= in Map.fold collect_batches storage.batch_set.current_batch_indices [] +type vault_summary = (string, market_maker_vault) map +type holding_summary = (string, market_vault_holding) map + +type vault_holdings_summary = + { + holdings: holding_summary; + vaults: vault_summary; + } + +[@view] +let get_market_vault_holdings ((), storage : unit * storage) : vault_holdings_summary = + let mm = storage.market_maker in + let vaults = mm.vaults in + let user_holdings = mm.user_holdings in + let vault_holdings = mm.vault_holdings in + let holder = Tezos.get_sender () in + let get_tokens = fun (l,(tn,_vt): string list * (string * token)) -> tn :: l in + let tokens = Map.fold get_tokens storage.valid_tokens [] in + let get_vaults = fun (vs,t: vault_summary * string) -> + match Big_map.find_opt t vaults with + | None -> vs + | Some v -> Map.add t v vs + in + let vaults = List.fold get_vaults tokens (Map.empty: vault_summary) in + let get_holdings = fun (hs,t: holding_summary * string) -> + let key = (holder, t) in + match Big_map.find_opt key user_holdings with + | None -> hs + | Some id -> (match Big_map.find_opt id vault_holdings with + | None -> hs + | Some h -> Map.add t h hs) + in + let holdings = List.fold get_holdings tokens (Map.empty: holding_summary) in + { + holdings = holdings; + vaults = vaults; + } + let main (action, storage : entrypoint * storage) : operation list * storage = @@ -2373,7 +2509,7 @@ let main | Change_deposit_time_window t -> change_deposit_time_window t storage (* Market Liquidity endpoint *) | AddLiquidity t -> add_liquidity t storage - | RemoveLiquidity n -> remove_liquidity n storage - | Claim -> claim storage + | RemoveLiquidity tn -> remove_liquidity tn storage + | Claim tn -> claim tn storage diff --git a/batcher/shared.mligo b/batcher/shared.mligo index bd2e227e..6e5b1548 100644 --- a/batcher/shared.mligo +++ b/batcher/shared.mligo @@ -17,12 +17,20 @@ type market_token = { } -let assert_or_fail +let assert_some_or_fail_with + (type a) + (an_opt: a option) + (error: nat) = + match an_opt with + | None -> failwith error + | Some _ -> () + +let assert_or_fail_with (predicate: bool) (error: nat) = if not predicate then failwith error else () -let find_or_fail +let find_or_fail_with (type a b) (key: a) (error: nat) diff --git a/batcher/test/common/helpers.mligo b/batcher/test/common/helpers.mligo index 88554abb..6c5efda3 100644 --- a/batcher/test/common/helpers.mligo +++ b/batcher/test/common/helpers.mligo @@ -62,8 +62,10 @@ let originate_oracle let originate_tzbtc (trader: Breath.Context.actor) + (trader_2: Breath.Context.actor) + (trader_3: Breath.Context.actor) (level: Breath.Logger.level) = - let storage = TestStorage.tzbtc_initial_storage trader in + let storage = TestStorage.tzbtc_initial_storage trader trader_2 trader_3 in TestUtils.originate_tzbtc storage level let originate_usdt @@ -85,7 +87,7 @@ let originate (eurl_trader: Breath.Context.actor) = let oracle = originate_oracle level in let additional_oracle = originate_oracle level in - let tzbtc = originate_tzbtc tzbtc_trader level in + let tzbtc = originate_tzbtc tzbtc_trader usdt_trader eurl_trader level in let usdt = originate_usdt usdt_trader level in let eurl = originate_eurl eurl_trader level in let initial_storage = TestStorage.initial_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address in @@ -108,7 +110,7 @@ let originate_with_admin_and_fee_recipient (fee_recipient: address) = let oracle = originate_oracle level in let additional_oracle = originate_oracle level in - let tzbtc = originate_tzbtc tzbtc_trader level in + let tzbtc = originate_tzbtc tzbtc_trader usdt_trader eurl_trader level in let usdt = originate_usdt usdt_trader level in let eurl = originate_eurl eurl_trader level in let initial_storage = TestStorage.initial_storage_with_admin_and_fee_recipient oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address admin.address fee_recipient in @@ -131,7 +133,7 @@ let originate_with_batch_for_clearing (pair: string) = let oracle = originate_oracle level in let additional_oracle = originate_oracle level in - let tzbtc = originate_tzbtc tzbtc_trader level in + let tzbtc = originate_tzbtc tzbtc_trader usdt_trader eurl_trader level in let usdt = originate_usdt usdt_trader level in let eurl = originate_eurl eurl_trader level in let initial_storage = TestStorage.initial_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address in @@ -239,6 +241,12 @@ let add_liquidity } in Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (AddLiquidity token_amount) 0tez)) +let remove_liquidity + (actor: Breath.Context.actor) + (contract: originated_contract) + (token_name: string) = + Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (RemoveLiquidity token_name) 0tez)) + let expect_last_order_number (storage: storage) (last_order_number: nat) = TestStorage.expect_from_storage "last_order_number" storage (fun s -> s.last_order_number) last_order_number @@ -279,3 +287,39 @@ let get_current_batch match Map.find_opt pair batch_set.current_batch_indices with | Some i -> Big_map.find_opt i batch_set.batches | None -> None + + + +type balances = { + tzbtc : nat; + usdt: nat; + eurl: nat; +} + +let get_balances + (holder: address) + (tzbtc_contract: (TZBTC.parameter, TZBTC.storage) originated) + (usdt_contract: (USDT.parameter, USDT.storage) originated) + (eurl_contract: (EURL.parameter, EURL.storage) originated) : balances = + let tzbtc_storage = Breath.Contract.storage_of tzbtc_contract in + let eurl_storage = Breath.Contract.storage_of usdt_contract in + let usdt_storage = Breath.Contract.storage_of eurl_contract in + let tzbtc_balance = match Big_map.find_opt holder tzbtc_storage.tokens with + | None -> 0n + | Some v -> v + in + let usdt_balance = match Big_map.find_opt (holder,0n) usdt_storage.ledger with + | None -> 0n + | Some v -> v + in + let eurl_balance = match Big_map.find_opt (holder,0n) eurl_storage.ledger with + | None -> 0n + | Some v -> v + in + { + tzbtc = tzbtc_balance; + usdt = usdt_balance; + eurl = eurl_balance; + } + + diff --git a/batcher/test/common/storage.mligo b/batcher/test/common/storage.mligo index 3546931e..7746e04d 100644 --- a/batcher/test/common/storage.mligo +++ b/batcher/test/common/storage.mligo @@ -13,11 +13,17 @@ let fee_recipient = ("tz1burnburnburnburnburnburnburjAYjjX" : address) let administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address) let tzbtc_initial_storage - (trader: Breath.Context.actor) = + (trader: Breath.Context.actor) + (trader_2: Breath.Context.actor) + (trader_3: Breath.Context.actor) = let trader_address = trader.address in + let trader_2_address = trader_2.address in + let trader_3_address = trader_3.address in { tokens = Big_map.literal [ - ((trader_address), 100000000000n) + ((trader_address), 90000000000n); + ((trader_2_address), 10000000000n); + ((trader_3_address), 10000000000n) ]; allowances = (Big_map.empty : (TZBTC.allowance_key, nat) big_map); token_metadata = Big_map.literal [ diff --git a/batcher/test/endpoints/user/test_deposits.mligo b/batcher/test/endpoints/user/test_deposits.mligo index d3804788..42f44613 100644 --- a/batcher/test/endpoints/user/test_deposits.mligo +++ b/batcher/test/endpoints/user/test_deposits.mligo @@ -76,16 +76,23 @@ let vanilla_deposit_should_succeed = spender = batcher.originated_address; value = deposit_amount } in + + let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" deposit_amount Buy Exact bstorage.valid_tokens in let bstorage = Breath.Contract.storage_of batcher in let bbalance = Breath.Contract.balance_of batcher in - + let post_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let expected_prior_balance = 90000000000n in + let expected_post_balance = abs (expected_prior_balance - deposit_amount) in + Breath.Result.reduce [ act_allow_transfer ; act_deposit ; Breath.Assert.is_equal "balance" bbalance bstorage.fee_in_mutez + ; Breath.Assert.is_equal "tzbtc balance prior" prior_balances.tzbtc expected_prior_balance + ; Breath.Assert.is_equal "tzbtc balance post" post_balances.tzbtc expected_post_balance ; Helpers.expect_last_order_number bstorage 1n ]) diff --git a/batcher/test/market_maker/test_add_update_liquidity.mligo b/batcher/test/market_maker/test_add_update_liquidity.mligo index 3f5a4318..508803ae 100644 --- a/batcher/test/market_maker/test_add_update_liquidity.mligo +++ b/batcher/test/market_maker/test_add_update_liquidity.mligo @@ -7,7 +7,7 @@ let add_liquidity_should_succeed = Breath.Model.case "test add liquidity" - "should be successful if user is admin" + "should be successful" (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in let batcher = context.contracts.batcher in @@ -22,6 +22,7 @@ let add_liquidity_should_succeed = spender = batcher.originated_address; value = deposit_amount } in + let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in @@ -32,21 +33,151 @@ let add_liquidity_should_succeed = let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in let user_holding = Option.unopt (Big_map.find_opt h_key market_maker.user_holdings) in let vault_holding = Option.unopt (Big_map.find_opt user_holding market_maker.vault_holdings) in - + let is_mem = Set.mem user_holding vault.holdings in + let post_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let expected_prior_balance = 90000000000n in + let expected_post_balance = abs (expected_prior_balance - deposit_amount) in Breath.Result.reduce [ act_allow_transfer ; act_add_liquidity ; Breath.Assert.is_equal "total shares should be same" deposit_amount vault.total_shares + ; Breath.Assert.is_equal "vault should have the holding" is_mem true ; Breath.Assert.is_equal "holder should be the one that supplied liquidity" btc_trader.address vault_holding.holder ; Breath.Assert.is_equal "for the first liquidity , total shares hould be equal to holding shares" vault_holding.shares vault.total_shares ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to amount" vault.native_token.amount vault.total_shares ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to deposit amount" deposit_amount vault.total_shares + ; Breath.Assert.is_equal "tzbtc balance prior" prior_balances.tzbtc expected_prior_balance + ; Breath.Assert.is_equal "tzbtc balance post" post_balances.tzbtc expected_post_balance + ]) + +let update_liquidity_for_same_user_should_succeed = + Breath.Model.case + "test update liquidity" + "for same user should increase shares " + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let token_name = "tzBTC" in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + + let first_market_maker = bstorage.market_maker in + let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let first_vault = Option.unopt (Big_map.find_opt token_name first_market_maker.vaults) in + let first_user_holding = Option.unopt (Big_map.find_opt h_key first_market_maker.user_holdings) in + let first_vault_holding = Option.unopt (Big_map.find_opt first_user_holding first_market_maker.vault_holdings) in + + let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let act_allow_second_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_additional_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + + let ustorage = Breath.Contract.storage_of batcher in + + let twice_deposit_amount = abs (2 * deposit_amount) in + let second_market_maker = ustorage.market_maker in + let second_vault = Option.unopt (Big_map.find_opt token_name second_market_maker.vaults) in + let second_user_holding = Option.unopt (Big_map.find_opt h_key second_market_maker.user_holdings) in + let second_vault_holding = Option.unopt (Big_map.find_opt second_user_holding second_market_maker.vault_holdings) in + + let post_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let expected_prior_balance = abs (90000000000n - deposit_amount) in + let expected_post_balance = abs (expected_prior_balance - deposit_amount) in + Breath.Result.reduce [ + act_allow_transfer + ; act_add_liquidity + ; Breath.Assert.is_equal "total shares should be same" deposit_amount first_vault.total_shares + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity" btc_trader.address first_vault_holding.holder + ; Breath.Assert.is_equal "for the first liquidity , total shares hould be equal to holding shares" first_vault_holding.shares first_vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to amount" first_vault.native_token.amount first_vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to deposit amount" deposit_amount first_vault.total_shares + ; act_allow_second_transfer + ; act_add_additional_liquidity + ; Breath.Assert.is_equal "total shares should be twice the deposit amount" twice_deposit_amount second_vault.total_shares + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity" btc_trader.address second_vault_holding.holder + ; Breath.Assert.is_equal "for the second liquidity , total shares hould be equal to holding shares" second_vault_holding.shares second_vault.total_shares + ; Breath.Assert.is_equal "for the second liquidity , shares should be equal to amount" second_vault.native_token.amount second_vault.total_shares + ; Breath.Assert.is_equal "for the second liquidity , shares should be equal to deposit amount" twice_deposit_amount second_vault.total_shares + ; Breath.Assert.is_equal "tzbtc balance prior" prior_balances.tzbtc expected_prior_balance + ; Breath.Assert.is_equal "tzbtc balance post" post_balances.tzbtc expected_post_balance ]) +let add_liquidity_for_two_users_should_succeed = + Breath.Model.case + "test add liquidity" + "for two users should suceed " + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + let usdt_trader = context.usdt_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let token_name = "tzBTC" in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let prior_balances_tzbtc = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let prior_balances_usdt = Helpers.get_balances usdt_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let act_allow_transfer_trader_1 = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity_trader_1 = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_allow_transfer_trader_2 = Breath.Context.act_as usdt_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity_trader_2 = Helpers.add_liquidity usdt_trader batcher token_name deposit_amount bstorage.valid_tokens in + + let bstorage = Breath.Contract.storage_of batcher in + let market_maker = bstorage.market_maker in + let h_key_1: Batcher.user_holding_key = (btc_trader.address, token_name) in + let h_key_2: Batcher.user_holding_key = (usdt_trader.address, token_name) in + let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in + let user_holding_1 = Option.unopt (Big_map.find_opt h_key_1 market_maker.user_holdings) in + let vault_holding_1 = Option.unopt (Big_map.find_opt user_holding_1 market_maker.vault_holdings) in + let user_holding_2 = Option.unopt (Big_map.find_opt h_key_2 market_maker.user_holdings) in + let vault_holding_2 = Option.unopt (Big_map.find_opt user_holding_2 market_maker.vault_holdings) in + + let total_shares = abs (2 * deposit_amount) in + + let post_balances_tzbtc = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let post_balances_usdt = Helpers.get_balances usdt_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let tzbtc_bal_diff = abs (prior_balances_tzbtc.tzbtc - post_balances_tzbtc.tzbtc) in + let usdt_bal_diff = abs (prior_balances_usdt.tzbtc - post_balances_usdt.tzbtc) in + + + Breath.Result.reduce [ + act_allow_transfer_trader_1 + ; act_add_liquidity_trader_1 + ; act_allow_transfer_trader_2 + ; act_add_liquidity_trader_2 + ; Breath.Assert.is_equal "total shares should be same" total_shares vault.total_shares + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity (trader_1)" btc_trader.address vault_holding_1.holder + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity (trader_2)" usdt_trader.address vault_holding_2.holder + ; Breath.Assert.is_equal "holding shares (trader_1) should be equal deposit amount" vault_holding_1.shares deposit_amount + ; Breath.Assert.is_equal "holding shares (trader_2) should be equal deposit amount" vault_holding_2.shares deposit_amount + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to amount" vault.native_token.amount vault.total_shares + ; Breath.Assert.is_equal "shares should be equal to both deposit amounts" total_shares vault.total_shares + ; Breath.Assert.is_equal "tzbtc balance difference should be deposit" tzbtc_bal_diff deposit_amount + ; Breath.Assert.is_equal "tzbtc (trader 2) balance difference should be deposit" usdt_bal_diff deposit_amount + ]) let test_suite = Breath.Model.suite "Suite for Add / Update Liquidity" [ add_liquidity_should_succeed + ; update_liquidity_for_same_user_should_succeed + ; add_liquidity_for_two_users_should_succeed ] diff --git a/batcher/test/market_maker/test_claim_rewards.mligo b/batcher/test/market_maker/test_claim_rewards.mligo new file mode 100644 index 00000000..b823b81b --- /dev/null +++ b/batcher/test/market_maker/test_claim_rewards.mligo @@ -0,0 +1,42 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../common/helpers.mligo" "Helpers" +#import "../../batcher.mligo" "Batcher" + + +let claim_should_fail_with_zero_unclaimed = + Breath.Model.case + "test claim" + "should fail with zero unclaimed" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let token_name = "tzBTC" in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_claim = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Claim token_name) 0tez)) in + let bstorage = Breath.Contract.storage_of batcher in + + + Breath.Result.reduce [ + act_allow_transfer + ; act_add_liquidity + ; Breath.Expect.fail_with_value Batcher.no_holdings_to_claim act_claim + ]) + +let test_suite = + Breath.Model.suite "Suite for Claim Rewards" [ + claim_should_fail_with_zero_unclaimed + ] + diff --git a/batcher/test/market_maker/test_remove_liquidity.mligo b/batcher/test/market_maker/test_remove_liquidity.mligo new file mode 100644 index 00000000..633a8ef7 --- /dev/null +++ b/batcher/test/market_maker/test_remove_liquidity.mligo @@ -0,0 +1,72 @@ + +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./../common/helpers.mligo" "Helpers" +#import "../../batcher.mligo" "Batcher" + + +let remove_liquidity_should_succeed = + Breath.Model.case + "test remove liquidity" + "should be successful" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let token_name = "tzBTC" in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + let initial_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + + let after_addition_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let bstorage = Breath.Contract.storage_of batcher in + + let market_maker = bstorage.market_maker in + let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in + let user_holding = Option.unopt (Big_map.find_opt h_key market_maker.user_holdings) in + let vault_holding = Option.unopt (Big_map.find_opt user_holding market_maker.vault_holdings) in + + let act_remove_liquidity = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (RemoveLiquidity token_name) 0tez)) in + + let after_removal_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in + let after_bstorage = Breath.Contract.storage_of batcher in + + let after_market_maker = after_bstorage.market_maker in + let after_vault = Option.unopt (Big_map.find_opt token_name after_market_maker.vaults) in + let after_user_holding = Big_map.find_opt h_key after_market_maker.user_holdings in + + + let expected_initial_balance = 90000000000n in + let expected_balance_after_addition = abs (expected_initial_balance - deposit_amount) in + + Breath.Result.reduce [ + act_allow_transfer + ; act_add_liquidity + ; Breath.Assert.is_equal "total shares should be same" deposit_amount vault.total_shares + ; Breath.Assert.is_equal "holder should be the one that supplied liquidity" btc_trader.address vault_holding.holder + ; Breath.Assert.is_equal "for the first liquidity , total shares should be equal to holding shares" vault_holding.shares vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to amount" vault.native_token.amount vault.total_shares + ; Breath.Assert.is_equal "for the first liquidity , shares should be equal to deposit amount" deposit_amount vault.total_shares + ; act_remove_liquidity + ; Breath.Assert.is_equal "after removal, total shares should be 0" 0n after_vault.total_shares + ; Breath.Assert.is_equal "after removal, native token amount should be 0" 0n after_vault.native_token.amount + ; Breath.Assert.is_none "after removal, user should have no holdings" after_user_holding + ; Breath.Assert.is_equal "initial tzbtc balance" initial_balances.tzbtc expected_initial_balance + ; Breath.Assert.is_equal "tzbtc balance after addition should be less by the deposit amount" after_addition_balances.tzbtc expected_balance_after_addition + ; Breath.Assert.is_equal "tzbtc balance after removal should be back to initial balance" after_removal_balances.tzbtc expected_initial_balance + ]) + +let test_suite = + Breath.Model.suite "Suite for Remove Liquidity" [ + remove_liquidity_should_succeed + ] + diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo index 55ead4ea..6df06cb0 100644 --- a/batcher/test/test.mligo +++ b/batcher/test/test.mligo @@ -14,6 +14,8 @@ #import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" #import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" #import "./market_maker/test_add_update_liquidity.mligo" "Market_Maker_Add_Update_Liquidity" +#import "./market_maker/test_claim_rewards.mligo" "Market_Maker_Claim_Rewards" +#import "./market_maker/test_remove_liquidity.mligo" "Market_Maker_Remove_Liquidity" #import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" #import "./economics/test_clearing.mligo" "Economics_Clearing" @@ -44,7 +46,7 @@ let () = Breath.Model.run_suites Void [ test_suite - (* ; Admin_Change_Fee.test_suite + (* ; Admin_Change_Fee.test_suite ; Admin_Change_Admin_Address.test_suite ; Admin_Change_Fee_Recipient_Address.test_suite ; Admin_Change_Deposit_Time_Window.test_suite @@ -54,10 +56,12 @@ let () = ; Admin_Change_Oracle_Source_Of_Pair.test_suite ; Admin_Add_Remove_Token_Swap_Pair.test_suite ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite + ; Economics_Clearing.test_suite *) ; User_Deposits.test_suite - ; User_Cancellations.test_suite *) + ; User_Cancellations.test_suite // ; User_Redemptions.test_suite ; Market_Maker_Add_Update_Liquidity.test_suite + ; Market_Maker_Claim_Rewards.test_suite + ; Market_Maker_Remove_Liquidity.test_suite ] diff --git a/batcher/test/tokens/fa12/main.mligo b/batcher/test/tokens/fa12/main.mligo index 294a18c0..d13b853d 100644 --- a/batcher/test/tokens/fa12/main.mligo +++ b/batcher/test/tokens/fa12/main.mligo @@ -130,6 +130,8 @@ let getTotalSupply (param, storage : getTotalSupply * storage) : operation list [Tezos.transaction total 0mutez param.callback] + +[@entry] let main (param, storage : parameter * storage) : result = begin if Tezos.get_amount () <> 0mutez diff --git a/batcher/test/tokens/fa2/main.mligo b/batcher/test/tokens/fa2/main.mligo index fa4b1115..2b006c12 100644 --- a/batcher/test/tokens/fa2/main.mligo +++ b/batcher/test/tokens/fa2/main.mligo @@ -202,14 +202,19 @@ let update_ops (updates : update_operators) (s : storage) : operation list * sto let s = Storage.set_operators s operators in ([]: operation list), s +[@view] +let get_balance ((holder, token_id), storage : (address * nat) * storage) = + Ledger.get_for_user storage.ledger holder token_id + type parameter = [@layout:comb] | Transfer of transfer | Balance_of of balance_of | Update_operators of update_operators +[@entry] let main (p, s : parameter * storage) = match p with | Transfer p -> transfer p s | Balance_of p -> balance_of p s - | Update_operators p -> update_ops p s \ No newline at end of file + | Update_operators p -> update_ops p s From 43ebce3ea9e2441a1cb6446fd2c006ddcc4e7c20 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Thu, 7 Sep 2023 14:42:05 +0400 Subject: [PATCH 085/108] Started splitting market maker off into own contract --- batcher/Makefile | 12 +- batcher/batcher-ghostnet.tz | 5582 ----------------- batcher/batcher-storage-ghostnet.tz | 17 - batcher/batcher.mligo | 531 +- batcher/market-tokens.mligo | 38 - batcher/marketmaker.mligo | 428 ++ batcher/shared.mligo | 66 - .../marketmaker_storage.ghostnet.mligo | 59 + .../test/endpoints/user/test_deposits.mligo | 27 + .../market_maker/test_claim_rewards.mligo | 2 - batcher/test/test.mligo | 6 +- batcher/types.mligo | 204 + batcher/utils.mligo | 0 13 files changed, 821 insertions(+), 6151 deletions(-) delete mode 100644 batcher/batcher-ghostnet.tz delete mode 100644 batcher/batcher-storage-ghostnet.tz delete mode 100644 batcher/market-tokens.mligo create mode 100644 batcher/marketmaker.mligo delete mode 100644 batcher/shared.mligo create mode 100644 batcher/storage/marketmaker_storage.ghostnet.mligo create mode 100644 batcher/types.mligo create mode 100644 batcher/utils.mligo diff --git a/batcher/Makefile b/batcher/Makefile index 39fab41a..083ad4fe 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -1,6 +1,6 @@ .PHONY: test -LIGO_COMPILER_VERSION:=0.72.0 +LIGO_COMPILER_VERSION:=0.70.0 TEZOS_PROTOCOL:=mumbai LIGO_DOCKER := docker run --rm -v $(PWD):$(PWD) -w $(PWD) ligolang/ligo:$(LIGO_COMPILER_VERSION) @@ -51,6 +51,14 @@ build-ghostnet: $(call clean_ghostnet_files) $(call compile_contract,batcher.mligo, batcher-ghostnet.tz) $(call compile_storage,$(STORAGE_DIRECTORY)/initial_storage_ghostnet.mligo, batcher-storage-ghostnet.tz) +build-mm-mainnet: + $(call clean_mainnet_files) + $(call compile_contract,marketmaker.mligo, marketmaker-mainnet.tz) + $(call compile_storage,$(STORAGE_DIRECTORY)/marketmaker_storage_mainnet.mligo, marketmaker-storage-mainnet.tz) +build-mm-ghostnet: + $(call clean_ghostnet_files) + $(call compile_contract,marketmaker.mligo, marketmaker-ghostnet.tz) + $(call compile_storage,$(STORAGE_DIRECTORY)/marketmaker_storage_ghostnet.mligo, marketmaker-storage-ghostnet.tz) build-tzBTC: $(call clean_files) $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, tzBTC_token.tz) @@ -77,6 +85,8 @@ build-fa12-tzBTC: $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/tzBTC_storage.mligo, tzBTC_fa12_token_storage.tz) test: $(call test_ligo,$(TEST_DIRECTORY)/test.mligo) +test-mm: + $(call test_ligo,$(TEST_DIRECTORY)/test_mm.mligo) measure: $(call measure_contract,batcher.mligo) install: diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz deleted file mode 100644 index e1074055..00000000 --- a/batcher/batcher-ghostnet.tz +++ /dev/null @@ -1,5582 +0,0 @@ -{ parameter - (or (or (or (or (or (pair %addLiquidity - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %add_or_update_metadata (string %key) (bytes %value))) - (or (pair %add_token_swap_pair - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits)) - (nat %amend_token_and_pair_limit))) - (or (or (pair %cancel string string) (address %change_admin_address)) - (or (nat %change_deposit_time_window) (mutez %change_fee)))) - (or (or (or (address %change_fee_recipient_address) - (pair %change_oracle_source_of_pair - (string %pair_name) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision))) - (or (string %claim) - (pair %deposit - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (timestamp %created_at) - (nat %side) - (nat %tolerance)))) - (or (or (string %disable_swap_pair_for_deposit) (string %enable_swap_pair_for_deposit)) - (or (unit %redeem) (string %removeLiquidity))))) - (or (or (string %remove_metadata) - (pair %remove_token_swap_pair - (pair %swap - (pair %from - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (pair %to - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits))) - (string %tick))) ; - storage - (pair (pair (pair (pair (address %administrator) - (pair %batch_set - (map %current_batch_indices string nat) - (big_map %batches - nat - (pair (nat %batch_number) - (or %status - (or (pair %cleared - (pair (timestamp %at) - (pair %clearing - (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) - (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) - (pair %total_cleared_volumes - (nat %buy_side_total_cleared_volume) - (nat %buy_side_volume_subject_to_clearing) - (nat %sell_side_total_cleared_volume) - (nat %sell_side_volume_subject_to_clearing)) - (pair %clearing_rate - (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when)))) - (pair %rate - (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when))) - (pair %closed (timestamp %closing_time) (timestamp %start_time))) - (timestamp %open)) - (pair %volumes - (nat %buy_minus_volume) - (nat %buy_exact_volume) - (nat %buy_plus_volume) - (nat %buy_total_volume) - (nat %sell_minus_volume) - (nat %sell_exact_volume) - (nat %sell_plus_volume) - (nat %sell_total_volume)) - (pair %pair string string) - (nat %holdings) - (option %market_vault_used (or (unit %buy) (unit %sell))))))) - (nat %deposit_time_window_in_seconds) - (mutez %fee_in_mutez)) - (pair (address %fee_recipient) (nat %last_order_number)) - (nat %limit_on_tokens_or_pairs) - (pair %market_maker - (pair (nat %last_holding_id) (big_map %user_holdings (pair address string) nat)) - (big_map %vault_holdings - nat - (pair (pair (pair (address %holder) (nat %id)) (nat %shares) (string %token)) - (mutez %unclaimed))) - (big_map %vaults - string - (pair (pair (map %foreign_tokens - string - (pair (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount))) - (set %holdings nat)) - (pair %native_token - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (nat %total_shares))))) - (pair (pair (big_map %metadata string bytes) - (big_map %rates_current - string - (pair (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when)))) - (big_map %user_batch_ordertypes - address - (map nat - (map (pair (or %side (unit %buy) (unit %sell)) - (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) - nat))) - (map %valid_swaps - string - (pair (pair %swap (string %from) (string %to)) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits)))) - (map %valid_tokens - string - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)))) ; - code { LAMBDA - (pair nat nat) - nat - { UNPAIR ; - PUSH nat 1 ; - DUG 2 ; - PAIR ; - PAIR ; - LEFT nat ; - LOOP_LEFT - { UNPAIR ; - UNPAIR ; - PUSH nat 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } - { PUSH nat 1 ; - PUSH nat 1 ; - DUP 4 ; - AND ; - COMPARE ; - EQ ; - IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; - PUSH nat 1 ; - DIG 3 ; - LSR ; - DUP 3 ; - DIG 3 ; - MUL ; - PAIR ; - PAIR ; - LEFT nat } } } ; - LAMBDA - (pair bool nat) - unit - { UNPAIR ; NOT ; IF { FAILWITH } { DROP ; UNIT } } ; - PUSH int 1 ; - PUSH int 10000 ; - PAIR ; - PUSH int 1 ; - PUSH int 10001 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - LAMBDA - (pair (pair (pair nat string (option address) nat (option string)) nat) - (map string (pair (pair nat string (option address) nat (option string)) nat))) - (map string (pair (pair nat string (option address) nat (option string)) nat)) - { UNPAIR ; - SWAP ; - UNIT ; - RIGHT unit ; - DIG 2 ; - DUP ; - CAR ; - GET 3 ; - DUP 4 ; - DUP 2 ; - GET ; - IF_NONE - { DIG 2 ; DROP ; SWAP ; SOME ; SWAP ; UPDATE } - { DIG 3 ; - IF_LEFT - { DROP ; - DUP ; - CDR ; - DUP 4 ; - CDR ; - COMPARE ; - GT ; - IF { DROP ; PUSH nat 111 ; FAILWITH } - { DUP 3 ; CDR ; SWAP ; CDR ; SUB ; ABS } } - { DROP ; CDR ; DUP 3 ; CDR ; ADD } ; - DIG 3 ; - DIG 3 ; - DIG 2 ; - UPDATE 2 ; - SOME ; - DIG 2 ; - UPDATE } } ; - LAMBDA - (pair int int) - int - { UNPAIR ; - SWAP ; - PUSH int 1 ; - PAIR ; - LEFT int ; - LOOP_LEFT - { UNPAIR ; - PUSH int 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { SWAP ; DROP ; RIGHT (pair int int) } - { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; - SWAP ; - DROP } ; - LAMBDA - (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) - (pair nat - (pair (pair nat string (option address) nat (option string)) nat) - (option - (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) - (set nat)) - (pair (pair nat string (option address) nat (option string)) nat) - nat)))) - (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) - (set nat)) - (pair (pair nat string (option address) nat (option string)) nat) - nat) - { UNPAIR ; - SWAP ; - UNPAIR 3 ; - DIG 2 ; - IF_NONE - { DUP 2 ; - CDR ; - DIG 2 ; - PAIR ; - EMPTY_SET nat ; - DIG 2 ; - PUSH bool True ; - SWAP ; - UPDATE ; - DIG 2 ; - PAIR ; - PAIR } - { DIG 3 ; - DROP ; - DUP ; - CDR ; - CAR ; - DUP ; - CAR ; - DUP 5 ; - CAR ; - DUP 2 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - NOT ; - IF { DROP 4 ; PUSH nat 115 ; FAILWITH } - { DUP 4 ; - CDR ; - DUP 3 ; - CDR ; - CDR ; - ADD ; - DUP 2 ; - DIG 5 ; - CDR ; - DIG 3 ; - CDR ; - ADD ; - UPDATE 2 ; - DUP 3 ; - DUP 4 ; - CAR ; - DUP 5 ; - CAR ; - CDR ; - DUP 7 ; - MEM ; - IF { DIG 5 ; DROP ; DIG 4 ; CAR ; CDR } - { DIG 4 ; CAR ; CDR ; DIG 5 ; PUSH bool True ; SWAP ; UPDATE } ; - UPDATE 2 ; - UPDATE 1 ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DIG 2 ; - UPDATE 1 ; - UPDATE 2 } } } ; - DUP 4 ; - APPLY ; - LAMBDA - (pair (pair (lambda - (pair (pair (pair nat string (option address) nat (option string)) nat) - (map string (pair (pair nat string (option address) nat (option string)) nat))) - (map string (pair (pair nat string (option address) nat (option string)) nat))) - (lambda (pair nat nat) nat)) - (pair (pair int int) - (pair (pair nat string (option address) nat (option string)) nat) - (map string (pair (pair nat string (option address) nat (option string)) nat)))) - (pair (pair (pair nat string (option address) nat (option string)) nat) - (map string (pair (pair nat string (option address) nat (option string)) nat))) - { UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR 3 ; - DUP 2 ; - CDR ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 0 ; - DUP 2 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } - {} ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DIG 6 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 2 ; - CDR ; - DUP 2 ; - COMPARE ; - GT ; - IF { DROP 4 ; PUSH nat 153 ; FAILWITH } - { DUP ; - DUP 3 ; - CDR ; - INT ; - SUB ; - ABS ; - DUP 3 ; - DIG 2 ; - UPDATE 2 ; - PUSH nat 0 ; - DUP 2 ; - CDR ; - COMPARE ; - EQ ; - IF { DIG 4 ; DROP 2 ; DIG 2 } - { DIG 3 ; SWAP ; PAIR ; DIG 3 ; SWAP ; EXEC } ; - DUG 2 ; - UPDATE 2 ; - PAIR } } ; - DUP 8 ; - DUP 5 ; - PAIR ; - APPLY ; - DIG 8 ; - UNPAIR ; - IF_LEFT - { DIG 4 ; - DIG 7 ; - DROP 2 ; - IF_LEFT - { DIG 2 ; - DIG 5 ; - DIG 7 ; - DROP 3 ; - IF_LEFT - { DIG 3 ; - DROP ; - IF_LEFT - { IF_LEFT - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SENDER ; - SELF_ADDRESS ; - DUP 3 ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 4 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DUP 5 ; - CDR ; - DIG 3 ; - DUP 5 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 7 ; - CDR ; - DUP 8 ; - CAR ; - CAR ; - DIG 6 ; - PAIR 3 ; - CONS ; - DUP 5 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 4 ; - CAR ; - CDR ; - CDR ; - CDR ; - PUSH nat 1 ; - DUP 2 ; - CAR ; - CAR ; - ADD ; - DUP 5 ; - CAR ; - GET 3 ; - DUP 5 ; - PAIR ; - DUP 3 ; - CAR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE - { DIG 8 ; - DROP ; - DUP 6 ; - CAR ; - GET 3 ; - DUP 4 ; - CDR ; - CDR ; - DUP 2 ; - GET ; - DUP 8 ; - DUP 5 ; - PAIR 3 ; - DIG 9 ; - SWAP ; - EXEC ; - DUP 5 ; - DUP 6 ; - CDR ; - DUP 7 ; - CDR ; - CDR ; - DIG 3 ; - SOME ; - DIG 4 ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DUP 5 ; - CDR ; - CAR ; - PUSH mutez 0 ; - DUP 10 ; - CAR ; - GET 3 ; - DIG 10 ; - CDR ; - PAIR ; - DUP 7 ; - DIG 10 ; - PAIR ; - PAIR ; - PAIR ; - DUP 6 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CAR ; - DIG 4 ; - CAR ; - CDR ; - DUP 5 ; - DIG 4 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - UPDATE 2 ; - UPDATE 1 ; - DUP ; - CAR ; - DIG 2 ; - UPDATE 1 ; - UPDATE 1 } - { SWAP ; - DIG 2 ; - DROP 2 ; - DUP 5 ; - CAR ; - GET 3 ; - DUP 3 ; - CDR ; - CDR ; - DUP 2 ; - GET ; - DUP 7 ; - DUP 4 ; - PAIR 3 ; - DIG 8 ; - SWAP ; - EXEC ; - DUP 4 ; - CDR ; - CAR ; - DUP 4 ; - GET ; - NONE (pair (pair (pair address nat) nat string) mutez) ; - DUP 2 ; - COMPARE ; - EQ ; - IF { SWAP ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 6 ; - DIG 7 ; - DIG 9 ; - DROP 8 ; - PUSH nat 149 ; - FAILWITH } - { IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; - PUSH nat 150 ; - DIG 7 ; - DUP 3 ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - PAIR ; - DIG 9 ; - SWAP ; - EXEC ; - DROP ; - DUP ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - DIG 9 ; - CDR ; - DIG 4 ; - CAR ; - CDR ; - CAR ; - ADD ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - DUP 5 ; - DUP 6 ; - CDR ; - DUP 7 ; - CDR ; - CDR ; - DIG 4 ; - SOME ; - DIG 5 ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - DUP ; - CDR ; - DUP 5 ; - CDR ; - CAR ; - DIG 3 ; - SOME ; - DIG 4 ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CAR ; - DIG 2 ; - CAR ; - CDR ; - UPDATE 2 ; - UPDATE 1 } } ; - DUP 3 ; - DIG 3 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation ; - DIG 2 ; - CONS } - { DIG 2 ; - DIG 3 ; - DROP 2 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - DUP 6 ; - CAR ; - GET ; - IF_NONE - { DIG 5 ; - CDR ; - CAR ; - CAR ; - CAR ; - DUP 6 ; - CDR ; - DIG 6 ; - CAR ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DROP ; - DIG 5 ; - CDR ; - CAR ; - CAR ; - CAR ; - DUP 6 ; - CDR ; - SOME ; - DIG 6 ; - CAR ; - UPDATE } ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - NIL operation } ; - PAIR } - { DIG 2 ; - DIG 3 ; - DROP 2 ; - IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - PUSH nat 6 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - GET 7 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 134 ; FAILWITH } - { PUSH nat 6 ; - DUP 2 ; - CAR ; - CDR ; - GET 7 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 134 ; FAILWITH } - { PUSH nat 6 ; - DUP 2 ; - GET 7 ; - COMPARE ; - NEQ ; - IF { DROP 2 ; PUSH nat 133 ; FAILWITH } - { DUP 2 ; - CDR ; - CDR ; - DUP 3 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 4 ; - CAR ; - CDR ; - CDR ; - CAR ; - DUP 4 ; - CAR ; - DUP ; - CAR ; - CAR ; - DUP 2 ; - CDR ; - DUP 4 ; - PUSH nat 1 ; - DUP 7 ; - SIZE ; - ADD ; - COMPARE ; - GT ; - IF { DIG 3 ; DROP ; PUSH nat 127 ; FAILWITH } - { PUSH bool False ; - DUP 7 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - PUSH bool False ; - DUP 8 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - AND ; - IF { PUSH nat 0 } - { PUSH bool False ; - DUP 7 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - PUSH bool False ; - DUP 8 ; - ITER { CDR ; - SWAP ; - DUP 2 ; - GET 8 ; - DUP 5 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 6 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 7 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 8 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 8 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR } ; - OR ; - IF { PUSH nat 1 } { PUSH nat 2 } } ; - DIG 4 ; - SWAP ; - DUP 7 ; - SIZE ; - ADD ; - COMPARE ; - GT ; - IF { PUSH nat 126 ; FAILWITH } {} } ; - DUP 3 ; - CDR ; - GET 3 ; - DIG 3 ; - CAR ; - CAR ; - GET 3 ; - SWAP ; - DUP 5 ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - GET ; - IF_NONE - { DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; - DUP ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DUP 2 ; DIG 2 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; - DUP 3 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - SWAP ; - DIG 3 ; - DUP 5 ; - GET 8 ; - DUP 6 ; - GET 7 ; - DUP 7 ; - GET 5 ; - DUP 8 ; - GET 3 ; - DIG 8 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; - DUP 4 ; - DUP 4 ; - COMPARE ; - GT ; - IF { DIG 3 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } - { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 3 ; CONCAT } ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - PAIR } - { DROP 6 ; PUSH nat 116 ; FAILWITH } ; - UNPAIR ; - DUP 3 ; - DIG 3 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CDR ; - DIG 2 ; - UPDATE 2 ; - UPDATE 2 ; - NIL operation ; - PAIR } } } } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CDR ; - SIZE ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 128 ; FAILWITH } - { DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - SIZE ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 129 ; FAILWITH } - { DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation ; - PAIR } } } } } - { DIG 2 ; - DIG 4 ; - DROP 2 ; - IF_LEFT - { IF_LEFT - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SENDER ; - DUP 2 ; - UNPAIR ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 117 ; FAILWITH } - { DUP 4 ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - NOW ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 7 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { DROP ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - PUSH nat 0 ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - NONE (or unit unit) ; - PUSH nat 0 ; - DIG 7 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 6 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - NONE (or unit unit) ; - PUSH nat 0 ; - DIG 6 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DIG 5 ; DROP 3 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } - { DIG 6 ; - DROP ; - DUP 3 ; - INT ; - ADD ; - DIG 3 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; - SWAP ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - NOT ; - IF { PUSH nat 140 ; FAILWITH } {} ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - CAR ; - DUP 5 ; - GET ; - IF_NONE - { DROP 6 ; PUSH nat 139 ; FAILWITH } - { DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DIG 6 ; DROP 3 ; PUSH nat 139 ; FAILWITH } - { DUP 8 ; - DUP 9 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 11 ; - CDR ; - CAR ; - CDR ; - CAR ; - DIG 7 ; - DIG 7 ; - NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - SWAP ; - UPDATE ; - SOME ; - DUP 11 ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - SWAP ; - PAIR } ; - UNPAIR ; - DUP 3 ; - GET 5 ; - DUP 2 ; - ITER { UNPAIR ; - UNPAIR ; - IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - SUB ; - ABS ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 3 ; - SUB ; - ABS ; - UPDATE 3 ; - SWAP ; - UPDATE 7 } - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - CAR ; - SUB ; - ABS ; - UPDATE 1 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 5 ; - SUB ; - ABS ; - UPDATE 5 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 14 ; - SUB ; - ABS ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 11 ; - SUB ; - ABS ; - UPDATE 11 ; - SWAP ; - UPDATE 14 } - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 9 ; - SUB ; - ABS ; - UPDATE 9 ; - SWAP ; - UPDATE 14 } } - { DROP ; - DUP 3 ; - DIG 2 ; - DIG 3 ; - GET 13 ; - SUB ; - ABS ; - UPDATE 13 ; - SWAP ; - UPDATE 14 } } } ; - PUSH nat 1 ; - DUP 5 ; - GET 9 ; - SUB ; - ABS ; - DIG 4 ; - DIG 2 ; - UPDATE 5 ; - SWAP ; - UPDATE 9 ; - DUP 3 ; - DIG 3 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 7 ; - DIG 7 ; - CDR ; - DUP 7 ; - SOME ; - DIG 7 ; - CAR ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - PUSH mutez 0 ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - PAIR ; - DIG 2 ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 3 ; - DIG 3 ; - CAR ; - IF_LEFT { DROP ; DUP 5 ; CAR ; CAR ; CAR } { DROP ; DUP 5 ; CAR ; CDR } ; - PAIR ; - PAIR ; - DUP 6 ; - SWAP ; - EXEC ; - DUP 3 ; - CAR ; - CAR ; - CDR ; - CDR ; - DIG 2 ; - ADD ; - SWAP ; - PAIR } ; - DIG 2 ; - DIG 4 ; - DROP 2 ; - UNPAIR ; - SELF_ADDRESS ; - NIL operation ; - DIG 2 ; - ITER { CDR ; - DUP ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 2 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 2 ; - CDR ; - DUP 8 ; - DUP 6 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 5 ; - CDR ; - DIG 5 ; - CAR ; - CAR ; - DUP 11 ; - PAIR 3 ; - CONS ; - DUP 6 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - CONS } ; - SWAP ; - DIG 4 ; - DROP 2 ; - PUSH mutez 0 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CDR ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; - CONS } - { SWAP ; DROP } ; - PAIR } } } - { DIG 2 ; - DROP ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CAR ; - CDR ; - CAR ; - CAR ; - DUP 2 ; - COMPARE ; - EQ ; - IF { PUSH nat 144 ; FAILWITH } {} ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } } - { DIG 2 ; - DROP ; - IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - PUSH nat 600 ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 2 ; PUSH nat 131 ; FAILWITH } - { PUSH nat 3600 ; - DUP 2 ; - COMPARE ; - GT ; - IF { DROP 2 ; PUSH nat 132 ; FAILWITH } - { DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } } } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - NIL operation ; - PAIR } } } } - { DIG 3 ; - DROP ; - IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DIG 6 ; - DROP 5 ; - IF_LEFT - { IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - DUP 2 ; - COMPARE ; - EQ ; - IF { PUSH nat 144 ; FAILWITH } {} ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP ; - GET 3 ; - DUP 2 ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 123 ; FAILWITH } { DROP } ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; - CDR ; - CAR ; - CDR ; - CDR ; - DIG 5 ; - DUP 7 ; - GET 3 ; - UPDATE 3 ; - DUP 7 ; - GET 5 ; - UPDATE 5 ; - DUP 7 ; - GET 6 ; - UPDATE 7 ; - SOME ; - DIG 6 ; - CAR ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 } ; - NIL operation ; - PAIR } - { IF_LEFT - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SENDER ; - DUP 3 ; - CAR ; - CDR ; - CDR ; - CDR ; - DUP ; - CAR ; - CDR ; - DIG 3 ; - DUP 4 ; - PAIR ; - GET ; - IF_NONE - { DROP 3 ; PUSH nat 155 ; FAILWITH } - { DUP 2 ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 155 ; FAILWITH } - { DUP ; - CDR ; - PUSH mutez 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP 6 ; PUSH nat 155 ; FAILWITH } - { DIG 4 ; - CONTRACT unit ; - IF_NONE - { DROP ; PUSH nat 102 ; FAILWITH } - { SWAP ; UNIT ; TRANSFER_TOKENS } ; - DUP 5 ; - DIG 5 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DUP 8 ; - DUP 9 ; - CDR ; - DIG 9 ; - CDR ; - CAR ; - DIG 8 ; - PUSH mutez 0 ; - UPDATE 2 ; - SOME ; - DIG 9 ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - NIL operation ; - DIG 2 ; - CONS ; - PAIR } } } } - { DUP ; - GET 5 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit } - { PUSH nat 1 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - SWAP ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - NOW ; - DUP 4 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - GET 8 ; - IF { DROP 4 ; PUSH nat 125 ; FAILWITH } - { DUP 4 ; - CAR ; - CAR ; - CDR ; - CDR ; - AMOUNT ; - DUP 2 ; - DUP 2 ; - COMPARE ; - LT ; - IF { DROP 6 ; PUSH nat 113 ; FAILWITH } - { COMPARE ; - GT ; - IF { DROP 4 ; PUSH nat 130 ; FAILWITH } - { DUP 4 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 6 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 5 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { DROP ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - PUSH nat 0 ; - DUP 2 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - NONE (or unit unit) ; - PUSH nat 0 ; - DUP 6 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 6 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - NONE (or unit unit) ; - PUSH nat 0 ; - DUP 5 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DIG 5 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } - { DUP 3 ; - INT ; - ADD ; - DIG 3 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DUP 5 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; DUP 4 ; CAR ; CAR ; CAR ; CDR } } } ; - SWAP ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - IF { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } ; - IF { DIG 2 ; DROP } - { DUP 5 ; - CDR ; - CAR ; - CDR ; - CDR ; - DIG 3 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 124 ; FAILWITH } {} ; - CAR ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - INT ; - NOW ; - SUB ; - COMPARE ; - LT ; - IF {} { PUSH nat 120 ; FAILWITH } } ; - DUP 4 ; - DIG 4 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP 2 ; - CAR ; - PUSH nat 1 ; - DUP 3 ; - CAR ; - CDR ; - CAR ; - CDR ; - ADD ; - DUP 6 ; - GET 5 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit } - { PUSH nat 1 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; - DUP 7 ; - GET 6 ; - PUSH nat 0 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; RIGHT unit ; LEFT unit } - { PUSH nat 1 ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; UNIT ; LEFT unit ; LEFT unit } - { PUSH nat 2 ; - SWAP ; - COMPARE ; - EQ ; - IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; - SENDER ; - DUP 6 ; - CDR ; - CDR ; - DUP 10 ; - CAR ; - DUP ; - CAR ; - CAR ; - DUP 2 ; - CDR ; - DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DIG 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { DROP 4 ; PUSH nat 110 ; FAILWITH } - { DUP ; - GET 8 ; - DUP 4 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 2 ; - GET 7 ; - DUP 5 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 5 ; - DUP 6 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 3 ; - DUP 7 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 4 ; - CAR ; - DIG 6 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 2 ; - GET 8 ; - DUP 4 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 5 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 6 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 7 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DIG 6 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - AND ; - IF { DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP 7 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 5 ; - IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - MEM ; - IF {} { PUSH nat 110 ; FAILWITH } } - { DROP ; PUSH nat 110 ; FAILWITH } } } ; - PUSH bool False ; - DIG 2 ; - DIG 3 ; - DIG 9 ; - CAR ; - DIG 4 ; - DUP 7 ; - DUP 7 ; - PAIR 7 ; - DUP 4 ; - CDR ; - CAR ; - CDR ; - CAR ; - DUP 2 ; - GET 5 ; - GET ; - IF_NONE - { PUSH bool True } - { PUSH nat 0 ; - SWAP ; - ITER { CDR ; SIZE ; ADD } ; - PUSH nat 10 ; - SWAP ; - COMPARE ; - LE } ; - IF { DUP 5 ; - GET 5 ; - DUP 2 ; - GET 9 ; - IF_LEFT - { DROP ; - DUP 2 ; - GET 7 ; - CAR ; - CDR ; - DUP 2 ; - GET 7 ; - ADD ; - DUP 3 ; - GET 11 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 3 ; - ADD ; - UPDATE 3 ; - SWAP ; - UPDATE 7 } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - CAR ; - ADD ; - UPDATE 1 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 5 ; - ADD ; - UPDATE 5 ; - SWAP ; - UPDATE 7 } } - { DROP ; - DUP 2 ; - GET 7 ; - CAR ; - CDR ; - DUP 2 ; - GET 14 ; - ADD ; - DUP 3 ; - GET 11 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 11 ; - ADD ; - UPDATE 11 ; - SWAP ; - UPDATE 14 } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 9 ; - ADD ; - UPDATE 9 ; - SWAP ; - UPDATE 14 } } - { DROP ; - DUP 2 ; - DUP 4 ; - GET 7 ; - CAR ; - CDR ; - DIG 3 ; - GET 13 ; - ADD ; - UPDATE 13 ; - SWAP ; - UPDATE 14 } } ; - DUP 7 ; - CDR ; - DIG 6 ; - DIG 2 ; - UPDATE 5 ; - SOME ; - DUP 5 ; - UPDATE ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - GET 5 ; - GET ; - IF_NONE - { DUP ; - DUP 5 ; - GET ; - IF_NONE - { DROP ; PUSH nat 142 ; FAILWITH } - { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } - { DUP 5 ; - GET ; - IF_NONE - { DUP ; - DUP 5 ; - GET ; - IF_NONE - { DROP ; PUSH nat 142 ; FAILWITH } - { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } - { DROP } } ; - DUP 2 ; - GET 5 ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - DUP 2 ; - GET ; - IF_NONE - { DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 6 ; - GET 7 ; - CAR ; - CDR ; - DUP 7 ; - GET 11 ; - DUP 8 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 7 ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 2 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP ; - DUP 7 ; - GET ; - IF_NONE - { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; - DUP 5 ; - GET 7 ; - CAR ; - CDR ; - DUP 6 ; - GET 11 ; - DUP 7 ; - GET 9 ; - PAIR ; - SWAP ; - SOME ; - SWAP ; - UPDATE ; - DIG 6 ; - SWAP ; - SOME ; - SWAP ; - UPDATE } - { DUP 5 ; - GET 11 ; - DUP 6 ; - GET 9 ; - PAIR ; - DUP 2 ; - DUP 2 ; - GET ; - IF_NONE - { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } - { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; - SOME ; - DIG 6 ; - UPDATE } ; - DUP 6 ; - CDR ; - CAR ; - CDR ; - CAR ; - SWAP ; - SOME ; - DIG 2 ; - UPDATE } ; - DUP 5 ; - DIG 5 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 8 ; - DIG 6 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - DUP ; - CAR ; - DUP ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - DUP 3 ; - GET 7 ; - CAR ; - SELF_ADDRESS ; - DUP 2 ; - CAR ; - GET 5 ; - IF_NONE - { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } - { DIG 5 ; - GET 5 ; - DUP 4 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 4 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - SWAP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 4 ; - CDR ; - DIG 4 ; - DIG 4 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { SWAP ; - CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 7 ; - CDR ; - DIG 7 ; - CAR ; - CAR ; - DIG 7 ; - PAIR 3 ; - CONS ; - DIG 4 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; - DUP 2 ; - DIG 2 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 5 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - NIL operation ; - DIG 2 ; - CONS ; - PAIR } - { DROP 6 ; PUSH nat 112 ; FAILWITH } } - { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } } } - { IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DIG 6 ; - DROP 5 ; - IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; - CDR ; - CAR ; - CDR ; - CDR ; - DIG 5 ; - PUSH bool True ; - UPDATE 8 ; - SOME ; - DIG 6 ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE { PUSH nat 117 ; FAILWITH } {} ; - DUP 3 ; - DUP 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; - CDR ; - CAR ; - CDR ; - CDR ; - DIG 5 ; - PUSH bool False ; - UPDATE 8 ; - SOME ; - DIG 6 ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 } ; - NIL operation } - { IF_LEFT - { DIG 2 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - SENDER ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SELF_ADDRESS ; - PUSH mutez 0 ; - PUSH mutez 0 ; - PAIR ; - DUP 4 ; - CAR ; - CDR ; - CAR ; - CAR ; - DUP 4 ; - PAIR ; - PAIR ; - DUP 4 ; - CAR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - CDR ; - CAR ; - CDR ; - CAR ; - EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; - DUP 2 ; - DUP 7 ; - GET ; - IF_NONE - { DIG 7 ; DIG 8 ; DROP 2 ; DIG 2 ; PAIR ; SWAP } - { DUP 8 ; - CAR ; - CAR ; - CDR ; - CDR ; - DIG 5 ; - PAIR ; - DUP 8 ; - CDR ; - CDR ; - DIG 5 ; - PAIR ; - DIG 3 ; - DUP 4 ; - PAIR ; - PAIR ; - PAIR ; - SWAP ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 4 ; - UNPAIR ; - DUP 3 ; - CDR ; - DUP ; - DUP 9 ; - GET ; - IF_NONE - { DIG 7 ; DIG 8 ; DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { CAR ; CDR ; SOME } - { DROP ; - NONE (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp)) } } - { DROP ; - NONE (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp)) } ; - IF_NONE - { SWAP ; DIG 8 ; DIG 9 ; DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } - { DUP 5 ; - DIG 4 ; - PAIR ; - DUP 7 ; - DUP 4 ; - GET 5 ; - PAIR ; - DIG 9 ; - DIG 3 ; - PAIR ; - PAIR ; - PAIR ; - DIG 8 ; - ITER { UNPAIR ; - DIG 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - UNPAIR ; - DIG 4 ; - UNPAIR ; - PUSH nat 0 ; - DUP 4 ; - GET 7 ; - COMPARE ; - EQ ; - IF { PUSH bool False } - { PUSH nat 0 ; - DUP 4 ; - GET 14 ; - COMPARE ; - EQ ; - IF { PUSH bool False } - { DUP 7 ; - CDR ; - DUP 6 ; - GET 3 ; - DUP 9 ; - CAR ; - IF_LEFT - { DROP ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool True } } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } - { DROP ; PUSH bool True } } } - { DROP ; - SWAP ; - IF_LEFT - { IF_LEFT - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool False } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool True } } - { DROP ; PUSH bool False } } } - { DROP ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } - { DROP ; PUSH bool True } } } } } ; - IF { DUP 5 ; - GET 6 ; - CAR ; - DUP 5 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 6 ; - DIG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 8 ; - CAR ; - IF_LEFT - { DROP ; - DUP 7 ; - GET 5 ; - DUP ; - GET 5 ; - INT ; - SWAP ; - GET 3 ; - INT ; - DIG 10 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - GET 6 ; - GET 3 ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - DUP ; - CDR ; - DUP 4 ; - CDR ; - MUL ; - DUP 4 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - DIG 2 ; - CDR ; - DIG 4 ; - CAR ; - MUL ; - SUB ; - PAIR ; - PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 25 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PUSH nat 0 ; - DUP 2 ; - CDR ; - COMPARE ; - GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; - PUSH int 1 ; - PUSH int 0 ; - PAIR ; - DUP ; - CAR ; - DUP 4 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 4 ; - CAR ; - MUL ; - COMPARE ; - LE ; - NOT ; - IF { PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 23 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } - { SWAP ; DIG 2 ; DROP 2 } } - { DROP ; - DUP 7 ; - GET 5 ; - DUP ; - CAR ; - INT ; - SWAP ; - GET 6 ; - INT ; - DIG 10 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP ; - CAR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - GET 6 ; - GET 3 ; - DUP ; - CDR ; - DUP 3 ; - CDR ; - MUL ; - SWAP ; - CAR ; - DUP 3 ; - CAR ; - MUL ; - PAIR ; - DUP ; - CDR ; - DUP 4 ; - CDR ; - MUL ; - DUP 4 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - DIG 2 ; - CDR ; - DIG 4 ; - CAR ; - MUL ; - SUB ; - PAIR ; - PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 25 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 3 ; - PAIR ; - PUSH nat 0 ; - DUP 2 ; - CDR ; - COMPARE ; - GT ; - IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; - PUSH int 1 ; - PUSH int 0 ; - PAIR ; - DUP ; - CAR ; - DUP 4 ; - CDR ; - MUL ; - SWAP ; - CDR ; - DUP 4 ; - CAR ; - MUL ; - COMPARE ; - LE ; - NOT ; - IF { PUSH int 0 ; - DUP 3 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } - { SWAP } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 23 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 2 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } - { SWAP ; DIG 2 ; DROP 2 } } ; - DUP 3 ; - DUP 3 ; - CDR ; - CDR ; - ADD ; - DUP 3 ; - DIG 3 ; - CDR ; - DIG 2 ; - UPDATE 2 ; - UPDATE 2 ; - SWAP } - { DUP 5 ; - GET 6 ; - CAR ; - DIG 7 ; - CAR ; - IF_LEFT - { DROP ; - DUP 5 ; - SWAP ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} } - { DROP ; - DUP 5 ; - SWAP ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; - DUP 3 ; - DUP 3 ; - CDR ; - CAR ; - ADD ; - DUP 3 ; - DIG 3 ; - CDR ; - DIG 2 ; - UPDATE 1 ; - UPDATE 2 ; - DIG 6 ; - DIG 7 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 18 ; - SWAP ; - EXEC } ; - DUG 2 ; - PAIR ; - DIG 3 ; - DIG 3 ; - PAIR ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - PAIR } ; - UNPAIR ; - CAR ; - CDR ; - SWAP ; - CAR ; - DUP 3 ; - CAR ; - DUP 5 ; - DUP 2 ; - GET ; - IF_NONE - { DIG 4 ; DROP 2 ; PUSH nat 141 ; FAILWITH } - { PUSH nat 1 ; - DUP 2 ; - GET 9 ; - SUB ; - ABS ; - DIG 6 ; - DUG 2 ; - UPDATE 9 ; - SOME ; - DIG 2 ; - UPDATE } ; - DUP ; - DUP 5 ; - CAR ; - GET ; - IF_NONE - { PUSH nat 141 ; FAILWITH } - { PUSH nat 0 ; SWAP ; GET 9 ; COMPARE ; LE } ; - DIG 5 ; - DIG 3 ; - PAIR ; - DIG 6 ; - DIG 2 ; - IF { DIG 2 ; - DROP ; - DUP 5 ; - DIG 5 ; - CDR ; - DIG 5 ; - CAR ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat - (option (or unit unit))) ; - SWAP ; - UPDATE ; - UPDATE 2 } - { DIG 4 ; DROP ; DIG 4 ; DIG 3 ; UPDATE 2 } ; - PAIR ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; - SWAP ; - UPDATE } } ; - PAIR ; - PAIR ; - PAIR } ; - DIG 5 ; - DIG 6 ; - DROP 2 ; - UNPAIR ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - CAR ; - DIG 3 ; - CAR ; - DIG 3 ; - DIG 2 ; - PAIR ; - DIG 3 ; - DIG 3 ; - SOME ; - DUP 6 ; - UPDATE } ; - DUG 2 ; - UNPAIR ; - NIL operation ; - DIG 2 ; - ITER { CDR ; - DUP ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 2 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 2 ; - CDR ; - DUP 9 ; - DUP 9 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 5 ; - CDR ; - DIG 5 ; - CAR ; - CAR ; - DUP 12 ; - PAIR 3 ; - CONS ; - DUP 9 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - CONS } ; - DIG 4 ; - DIG 5 ; - DROP 2 ; - PUSH mutez 0 ; - DUP 4 ; - CDR ; - CAR ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CAR ; - CONTRACT unit ; - IF_NONE - { PUSH nat 102 ; FAILWITH } - { DUP 4 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; - CONS } - {} ; - PUSH mutez 0 ; - DUP 4 ; - CDR ; - CDR ; - COMPARE ; - GT ; - IF { DUP 3 ; - CAR ; - CDR ; - CONTRACT unit ; - IF_NONE - { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } - { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; - CONS } - { DIG 2 ; DROP } ; - DUP 4 ; - DIG 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 6 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 5 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 } - { DIG 6 ; - DROP ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - SENDER ; - DUP 3 ; - CAR ; - CDR ; - CDR ; - CDR ; - DUP 3 ; - DUP 3 ; - PAIR ; - DUP 2 ; - CAR ; - CDR ; - DUP 2 ; - GET ; - DUP 3 ; - CDR ; - CDR ; - DUP 6 ; - GET ; - DUP 2 ; - IF_NONE { PUSH nat 151 ; FAILWITH } { DROP } ; - DUP ; - IF_NONE { PUSH nat 152 ; FAILWITH } { DROP } ; - DIG 3 ; - SWAP ; - IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; - DIG 3 ; - DIG 5 ; - DIG 5 ; - DIG 5 ; - IF_NONE { PUSH string "option is None" ; FAILWITH } {} ; - DUP 6 ; - CDR ; - CAR ; - DUP ; - DUP 3 ; - GET ; - IF_NONE { PUSH nat 149 ; FAILWITH } {} ; - PUSH nat 150 ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - DUP 6 ; - COMPARE ; - EQ ; - PAIR ; - DIG 13 ; - SWAP ; - EXEC ; - DROP ; - UNPAIR ; - CDR ; - CAR ; - DUP 8 ; - CDR ; - CDR ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 14 ; - DUP 10 ; - CDR ; - CAR ; - DUP 3 ; - PAIR 3 ; - DUP 13 ; - SWAP ; - EXEC ; - UNPAIR ; - SWAP ; - DIG 15 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 10 ; - CAR ; - CAR ; - ITER { CDR ; - SWAP ; - UNPAIR ; - UNPAIR ; - DIG 2 ; - DIG 3 ; - DUP 3 ; - PAIR 3 ; - DUP 15 ; - SWAP ; - EXEC ; - UNPAIR ; - DIG 3 ; - SWAP ; - PAIR ; - DUP 16 ; - SWAP ; - EXEC ; - DIG 2 ; - PAIR ; - PAIR } ; - DIG 12 ; - DIG 13 ; - DROP 2 ; - UNPAIR ; - CDR ; - DUP 11 ; - CDR ; - CDR ; - DUP 5 ; - COMPARE ; - GT ; - IF { SWAP ; DIG 2 ; DIG 3 ; DIG 10 ; DROP 5 ; PUSH nat 154 ; FAILWITH } - { DIG 3 ; - DUP 11 ; - CDR ; - CDR ; - SUB ; - ABS ; - DIG 2 ; - DUP 11 ; - DUP 12 ; - CDR ; - DIG 5 ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 1 ; - UPDATE 1 ; - DUP ; - CAR ; - DIG 10 ; - CAR ; - CDR ; - DUP 8 ; - PUSH bool False ; - SWAP ; - UPDATE ; - UPDATE 2 ; - UPDATE 1 ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 2 ; - UPDATE 2 ; - PAIR } ; - UNPAIR ; - DUP 6 ; - CONTRACT unit ; - IF_NONE { PUSH nat 102 ; FAILWITH } { DUP 4 ; UNIT ; TRANSFER_TOKENS } ; - SELF_ADDRESS ; - NIL operation ; - DIG 4 ; - ITER { CDR ; - DUP ; - CAR ; - GET 5 ; - IF_NONE - { DROP ; PUSH nat 109 ; FAILWITH } - { DUP 2 ; - CAR ; - GET 8 ; - IF_NONE - { DROP 2 ; PUSH nat 108 ; FAILWITH } - { PUSH string "FA1.2 token" ; - DUP 2 ; - COMPARE ; - EQ ; - IF { DROP ; - CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - DIG 2 ; - CDR ; - DUP 11 ; - DUP 6 ; - PAIR 3 ; - TRANSFER_TOKENS } - { PUSH string "FA2 token" ; - SWAP ; - COMPARE ; - EQ ; - IF { CONTRACT %transfer - (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - PUSH mutez 0 ; - NIL (pair address (list (pair address nat nat))) ; - NIL (pair address nat nat) ; - DUP 5 ; - CDR ; - DIG 5 ; - CAR ; - CAR ; - DUP 14 ; - PAIR 3 ; - CONS ; - DUP 6 ; - PAIR ; - CONS ; - TRANSFER_TOKENS } - { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; - CONS } ; - SWAP ; - DIG 7 ; - DROP 2 ; - DUP 9 ; - DUP 10 ; - CAR ; - DUP 11 ; - CAR ; - CDR ; - DIG 10 ; - NONE nat ; - SWAP ; - UPDATE ; - UPDATE 2 ; - UPDATE 1 ; - DUP ; - CDR ; - DIG 6 ; - DIG 7 ; - NONE (pair (pair (pair address nat) nat string) mutez) ; - SWAP ; - UPDATE ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CDR ; - DIG 7 ; - CDR ; - CDR ; - DIG 5 ; - SOME ; - DIG 7 ; - UPDATE ; - UPDATE 2 ; - UPDATE 2 ; - PUSH mutez 0 ; - DIG 4 ; - COMPARE ; - GT ; - IF { SWAP ; DIG 2 ; CONS } { DIG 2 ; DROP ; SWAP } ; - DUP 3 ; - DIG 3 ; - CAR ; - DUP ; - CDR ; - DUP ; - CDR ; - DIG 5 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 } ; - SWAP } ; - PAIR } } } - { DIG 2 ; - DIG 3 ; - DIG 5 ; - DIG 6 ; - DIG 8 ; - DROP 5 ; - IF_LEFT - { DIG 2 ; - DIG 3 ; - DIG 4 ; - DROP 3 ; - IF_LEFT - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 5 ; - CDR ; - CAR ; - CAR ; - CAR ; - DIG 5 ; - NONE bytes ; - SWAP ; - UPDATE ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DUP 2 ; - CAR ; - CAR ; - CAR ; - CAR ; - SENDER ; - COMPARE ; - EQ ; - IF {} { PUSH nat 114 ; FAILWITH } ; - PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP ; - GET 8 ; - IF {} { PUSH nat 137 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP 2 ; - DUP 2 ; - CAR ; - DIG 2 ; - CDR ; - DUP 2 ; - DUP 2 ; - COMPARE ; - GT ; - IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE - { DROP 2 ; PUSH nat 117 ; FAILWITH } - { DROP ; - DUP 3 ; - CDR ; - CDR ; - DIG 2 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - DUP ; - CAR ; - DUP 2 ; - CDR ; - DIG 4 ; - DUP 3 ; - DUP 3 ; - COMPARE ; - GT ; - IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; - NONE (pair (pair string string) address string nat bool) ; - SWAP ; - UPDATE ; - DUP 3 ; - DUP 3 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 3 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 6 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 7 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP ; DIG 2 } - { DUP 4 ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP ; DIG 2 } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { DIG 3 ; - DIG 2 ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - PUSH bool False ; - DUP 4 ; - ITER { CDR ; - CAR ; - DUP 3 ; - DUP 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 4 ; - DIG 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DIG 2 ; - DUP 2 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 3 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 5 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - DUP 3 ; - GET 8 ; - DUP 6 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 7 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 8 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 9 ; - GET 3 ; - COMPARE ; - EQ ; - DIG 6 ; - CAR ; - DUP 9 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - OR ; - OR } ; - IF { SWAP ; DROP } - { DUP ; - DUP 3 ; - GET 3 ; - GET ; - IF_NONE - { SWAP ; DROP } - { DUP 3 ; - GET 8 ; - DUP 2 ; - GET 8 ; - COMPARE ; - EQ ; - DUP 4 ; - GET 7 ; - DUP 3 ; - GET 7 ; - COMPARE ; - EQ ; - DUP 5 ; - GET 5 ; - DUP 4 ; - GET 5 ; - COMPARE ; - EQ ; - DUP 6 ; - GET 3 ; - DUP 5 ; - GET 3 ; - COMPARE ; - EQ ; - DUP 7 ; - CAR ; - DIG 5 ; - CAR ; - COMPARE ; - EQ ; - AND ; - AND ; - AND ; - AND ; - IF { SWAP ; - GET 3 ; - NONE (pair nat string (option address) nat (option string)) ; - SWAP ; - UPDATE } - { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; - SWAP ; - PAIR } ; - UNPAIR ; - DUP 3 ; - DIG 3 ; - CDR ; - DUP ; - CAR ; - DUP ; - CDR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 2 ; - DUP ; - CDR ; - DIG 2 ; - UPDATE 2 ; - UPDATE 2 } ; - NIL operation ; - PAIR } - { PUSH mutez 1 ; - AMOUNT ; - COMPARE ; - LT ; - IF {} { PUSH nat 118 ; FAILWITH } ; - DUP 2 ; - CDR ; - CAR ; - CDR ; - CDR ; - DUP 2 ; - GET ; - IF_NONE - { DROP 5 ; PUSH nat 117 ; FAILWITH } - { DUP 3 ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUP 3 ; - GET 8 ; - DUP 4 ; - GET 7 ; - DUP 5 ; - GET 5 ; - DIG 5 ; - GET 3 ; - DIG 4 ; - PUSH nat 1 ; - DIG 6 ; - PAIR ; - PAIR ; - PAIR 5 ; - DUP ; - GET 8 ; - DUP 2 ; - GET 7 ; - DUP 3 ; - GET 5 ; - DUP 4 ; - GET 3 ; - DUP 5 ; - CAR ; - DUP ; - CDR ; - GET 3 ; - SWAP ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 5 ; - DUP ; - GET 3 ; - SWAP ; - GET 5 ; - VIEW "getPrice" (pair timestamp nat) ; - IF_NONE { PUSH nat 122 ; FAILWITH } {} ; - UNPAIR ; - DUP 5 ; - CDR ; - CAR ; - CAR ; - CDR ; - DUP 5 ; - GET ; - IF_NONE - {} - { DUP 2 ; - SWAP ; - GET 4 ; - COMPARE ; - GE ; - IF { PUSH nat 121 ; FAILWITH } {} } ; - DUP 5 ; - CAR ; - CAR ; - CDR ; - CAR ; - INT ; - DUP 2 ; - SWAP ; - NOW ; - SUB ; - COMPARE ; - LT ; - IF {} { PUSH nat 120 ; FAILWITH } ; - DUP 3 ; - CAR ; - DIG 3 ; - GET 7 ; - DUP ; - DUP 3 ; - CAR ; - CAR ; - GET 7 ; - COMPARE ; - GT ; - IF { DUP 2 ; - CAR ; - CAR ; - GET 7 ; - SUB ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - DIG 3 ; - MUL ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 2 ; - CAR ; - CAR ; - GET 7 ; - INT ; - PUSH int 10 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; - SWAP } - { INT ; PUSH int 10 ; PAIR ; DUP 7 ; SWAP ; EXEC ; DIG 3 } ; - INT ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DIG 2 ; - SWAP ; - DUP 3 ; - CDR ; - GET 3 ; - DIG 3 ; - CAR ; - CAR ; - GET 3 ; - PAIR ; - PAIR 3 ; - DUP 3 ; - CDR ; - CDR ; - DUP 2 ; - CAR ; - DUP 2 ; - DUP 2 ; - CAR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - DUG 2 ; - CDR ; - GET ; - IF_NONE { PUSH nat 111 ; FAILWITH } {} ; - SWAP ; - GET 7 ; - SWAP ; - GET 7 ; - SUB ; - DUP ; - ABS ; - INT ; - PUSH int 10 ; - PAIR ; - DIG 5 ; - SWAP ; - EXEC ; - PUSH int 0 ; - DUP 3 ; - COMPARE ; - EQ ; - IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } - { PUSH int 0 ; - DIG 2 ; - COMPARE ; - LT ; - IF { PUSH int 1 ; - SWAP ; - PAIR ; - PUSH int 1 ; - PUSH int 1 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL } - { PUSH int 1 ; SWAP } } ; - PAIR ; - DUP 2 ; - GET 3 ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - UPDATE 3 ; - DUP 3 ; - CDR ; - CAR ; - CAR ; - CDR ; - DUP 4 ; - DIG 4 ; - CDR ; - DUP ; - CAR ; - DUP ; - CAR ; - DUP 5 ; - DUP 8 ; - GET ; - IF_NONE - { DIG 4 ; DUP 6 ; DIG 7 ; SWAP ; SOME ; SWAP ; UPDATE } - { GET 4 ; - DUP 7 ; - GET 4 ; - COMPARE ; - GT ; - IF { DIG 4 ; DUP 6 ; SOME ; DIG 7 ; UPDATE } { DIG 6 ; DROP ; DIG 4 } } ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 ; - DUP 2 ; - CAR ; - UNIT ; - LEFT unit ; - PAIR ; - NOW ; - DUP 3 ; - CAR ; - CAR ; - CAR ; - CDR ; - DIG 2 ; - UNPAIR ; - IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; - DUP 4 ; - CAR ; - CAR ; - CDR ; - CAR ; - DUP 3 ; - CDR ; - DUP 4 ; - CAR ; - DUP 4 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - GET ; - IF_NONE { PUSH nat 0 } {} ; - GET ; - IF_NONE - { DROP 2 ; - NONE (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat - (option (or unit unit))) } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } - { DROP ; PUSH bool False } ; - IF { SWAP ; DIG 2 ; DROP 2 } - { DUP ; - GET 3 ; - IF_LEFT - { DIG 2 ; - DROP ; - IF_LEFT - { DROP 2 ; - PUSH nat 0 ; - DUP 3 ; - CAR ; - ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; - PUSH nat 1 ; - ADD ; - NONE (or unit unit) ; - PUSH nat 0 ; - DIG 3 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 8 ; - DUP 7 ; - RIGHT - (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) ; - DIG 5 ; - PAIR 6 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 2 ; DROP 2 ; SWAP } } - { DIG 3 ; - DROP ; - DUP 3 ; - INT ; - ADD ; - DUP 5 ; - COMPARE ; - GE ; - IF { DUP ; - GET 3 ; - IF_LEFT - { SWAP ; - DIG 2 ; - DROP 2 ; - IF_LEFT - { DROP ; PUSH nat 105 ; FAILWITH } - { DROP ; PUSH nat 105 ; FAILWITH } } - { DIG 2 ; - INT ; - DUP 2 ; - ADD ; - PAIR ; - RIGHT - (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) ; - LEFT timestamp ; - UPDATE 3 } ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DUP 4 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { SWAP ; DROP ; SWAP } } ; - SWAP } ; - SOME } ; - IF_NONE - { SWAP ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } - { DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 3 ; DROP 2 ; PUSH bool False } - { CAR ; PUSH int 120 ; ADD ; DIG 3 ; COMPARE ; GT } } - { DIG 3 ; DROP 2 ; PUSH bool False } ; - IF { NOW ; - DUP 2 ; - GET 5 ; - DUP ; - GET 9 ; - INT ; - DUP 2 ; - GET 11 ; - INT ; - DUP 3 ; - GET 13 ; - INT ; - DUP 4 ; - CAR ; - INT ; - DUP 5 ; - GET 3 ; - INT ; - DUP 6 ; - GET 5 ; - INT ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR ; - PAIR ; - SWAP ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - DUP 8 ; - GET 3 ; - DUP 2 ; - CAR ; - CAR ; - DUP 4 ; - UNPAIR ; - UNPAIR ; - DUP 5 ; - DUP 15 ; - DIG 4 ; - DIG 4 ; - DIG 4 ; - ADD ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DUP 3 ; - CAR ; - UNPAIR ; - DUP 6 ; - UNPAIR ; - CDR ; - DIG 3 ; - DIG 3 ; - ADD ; - DUP 5 ; - DIG 3 ; - DIG 3 ; - ADD ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - DIG 3 ; - UNPAIR ; - UNPAIR ; - DIG 6 ; - CDR ; - DUG 3 ; - ADD ; - ADD ; - DUP 5 ; - CDR ; - DUP 13 ; - CDR ; - MUL ; - DIG 5 ; - CAR ; - DUP 13 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 3 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 1 ; - DIG 2 ; - PAIR ; - DUP 2 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DUP 3 ; - CDR ; - DUP 3 ; - CAR ; - MUL ; - COMPARE ; - LE ; - IF { SWAP ; DROP } { DROP } ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 14 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 15 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - PUSH int 0 ; - DUP 4 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } - { DUP 3 } ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DUP 16 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DUP 4 ; - CAR ; - DUP 7 ; - CDR ; - MUL ; - DUP 5 ; - CDR ; - DUP 8 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 8 ; - CDR ; - MUL ; - DUP 7 ; - CDR ; - DUP 9 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } - { DUP 4 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 4 ; - CDR ; - DUP 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - DUP 6 ; - CAR ; - DUP 6 ; - CDR ; - MUL ; - DIG 6 ; - CDR ; - DIG 6 ; - CAR ; - MUL ; - COMPARE ; - LT ; - NOT ; - AND ; - IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; - DUP 10 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PUSH nat 0 ; - PAIR 4 ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - PAIR 3 ; - PAIR 4 ; - DUP ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DROP ; - DUP 2 ; - GET 3 ; - DUP 3 ; - CAR ; - ADD ; - DUP 3 ; - GET 13 ; - DIG 3 ; - GET 11 ; - ADD ; - SWAP } - { DROP ; - DUP 2 ; - GET 13 ; - DUP 3 ; - GET 11 ; - DUP 4 ; - GET 9 ; - ADD ; - ADD ; - DIG 2 ; - CAR } } - { DROP ; - DUP 2 ; - GET 5 ; - DUP 3 ; - GET 3 ; - DUP 4 ; - CAR ; - ADD ; - ADD ; - DIG 2 ; - GET 13 ; - SWAP } ; - DUP 3 ; - GET 3 ; - IF_LEFT - { IF_LEFT - { DIG 9 ; DROP 2 ; DUP 8 } - { DROP ; - DUP 8 ; - GET 3 ; - DUP 10 ; - CAR ; - DUP 2 ; - CDR ; - MUL ; - DIG 10 ; - CDR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - SWAP ; - UPDATE 3 } } - { DROP ; - DUP 8 ; - GET 3 ; - DUP 10 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 10 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - DUP 9 ; - SWAP ; - UPDATE 3 } ; - DUP 4 ; - GET 3 ; - IF_LEFT - { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } - { DROP ; DUP 4 ; CAR ; GET 4 } ; - DUP 2 ; - GET 3 ; - DUP 2 ; - INT ; - PUSH int 1 ; - SWAP ; - PAIR ; - DUP 2 ; - CDR ; - DUP 2 ; - CDR ; - MUL ; - DIG 2 ; - CAR ; - DIG 2 ; - CAR ; - MUL ; - PAIR ; - PUSH int 0 ; - DUP 2 ; - CAR ; - COMPARE ; - LT ; - IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } - {} ; - DUP ; - CDR ; - PUSH nat 0 ; - PUSH nat 10 ; - PAIR ; - DIG 13 ; - SWAP ; - EXEC ; - DIG 2 ; - CAR ; - MUL ; - EDIV ; - IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; - CAR ; - ISNAT ; - IF_NONE { PUSH nat 119 ; FAILWITH } {} ; - DIG 5 ; - DIG 5 ; - DIG 2 ; - DIG 5 ; - DIG 4 ; - PAIR 4 ; - UPDATE 5 ; - SWAP ; - UPDATE 6 ; - DIG 2 ; - DIG 5 ; - DIG 2 ; - DIG 3 ; - PAIR ; - PAIR ; - LEFT (pair timestamp timestamp) ; - LEFT timestamp ; - UPDATE 3 ; - DUP 2 ; - DUP 3 ; - CDR ; - DUP 3 ; - SOME ; - DUP 4 ; - CAR ; - UPDATE ; - UPDATE 2 ; - DIG 2 ; - CAR ; - DUP 3 ; - CAR ; - SOME ; - DIG 3 ; - GET 7 ; - UNPAIR ; - DUP ; - DUP 3 ; - COMPARE ; - GT ; - IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } - { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; - UPDATE ; - UPDATE 1 } - { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; - DUP 2 ; - DIG 2 ; - CAR ; - DUP ; - CAR ; - DUP ; - CAR ; - DIG 4 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 1 } ; - NIL operation ; - PAIR } } } } ; - view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; - view "get_valid_swaps" - unit - (map string - (pair (pair %swap (string %from) (string %to)) - (address %oracle_address) - (string %oracle_asset_name) - (nat %oracle_precision) - (bool %is_disabled_for_deposits))) - { CDR ; CDR ; CAR ; CDR ; CDR } ; - view "get_valid_tokens" - unit - (map string - (pair (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string))) - { CDR ; CDR ; CDR } ; - view "get_current_batches" - unit - (list (pair (nat %batch_number) - (or %status - (or (pair %cleared - (pair (timestamp %at) - (pair %clearing - (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) - (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) - (pair %total_cleared_volumes - (nat %buy_side_total_cleared_volume) - (nat %buy_side_volume_subject_to_clearing) - (nat %sell_side_total_cleared_volume) - (nat %sell_side_volume_subject_to_clearing)) - (pair %clearing_rate - (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when)))) - (pair %rate - (pair %swap (string %from) (string %to)) - (pair %rate (int %p) (int %q)) - (timestamp %when))) - (pair %closed (timestamp %closing_time) (timestamp %start_time))) - (timestamp %open)) - (pair %volumes - (nat %buy_minus_volume) - (nat %buy_exact_volume) - (nat %buy_plus_volume) - (nat %buy_total_volume) - (nat %sell_minus_volume) - (nat %sell_exact_volume) - (nat %sell_plus_volume) - (nat %sell_total_volume)) - (pair %pair string string) - (nat %holdings) - (option %market_vault_used (or (unit %buy) (unit %sell))))) - { CDR ; - NIL (pair nat - (or (or (pair (pair timestamp - (pair (pair nat nat nat) - (or (or unit unit) unit) - (pair nat nat nat nat) - (pair (pair string string) (pair int int) timestamp))) - (pair (pair string string) (pair int int) timestamp)) - (pair timestamp timestamp)) - timestamp) - (pair nat nat nat nat nat nat nat nat) - (pair string string) - nat - (option (or unit unit))) ; - DUP 2 ; - CAR ; - CAR ; - CAR ; - CDR ; - CAR ; - ITER { CDR ; - DUP 3 ; - CAR ; - CAR ; - CAR ; - CDR ; - CDR ; - SWAP ; - GET ; - IF_NONE {} { CONS } } ; - SWAP ; - DROP } ; - view "get_market_vault_holdings" - unit - (pair (map %holdings - string - (pair (pair (pair (address %holder) (nat %id)) (nat %shares) (string %token)) - (mutez %unclaimed))) - (map %vaults - string - (pair (pair (map %foreign_tokens - string - (pair (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount))) - (set %holdings nat)) - (pair %native_token - (pair %token - (nat %token_id) - (string %name) - (option %address address) - (nat %decimals) - (option %standard string)) - (nat %amount)) - (nat %total_shares)))) - { CDR ; - DUP ; - CAR ; - CDR ; - CDR ; - CDR ; - SENDER ; - NIL string ; - DIG 3 ; - CDR ; - CDR ; - ITER { CAR ; CONS } ; - EMPTY_MAP - string - (pair (pair (map string (pair (pair nat string (option address) nat (option string)) nat)) - (set nat)) - (pair (pair nat string (option address) nat (option string)) nat) - nat) ; - DUP 2 ; - ITER { SWAP ; - DUP 5 ; - CDR ; - CDR ; - DUP 3 ; - GET ; - IF_NONE { SWAP ; DROP } { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } ; - EMPTY_MAP string (pair (pair (pair address nat) nat string) mutez) ; - DIG 2 ; - ITER { SWAP ; - DUP 5 ; - CAR ; - CDR ; - DUP 3 ; - DUP 6 ; - PAIR ; - GET ; - IF_NONE - { SWAP ; DROP } - { DUP 6 ; - CDR ; - CAR ; - SWAP ; - GET ; - IF_NONE { SWAP ; DROP } { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } } ; - DIG 2 ; - DIG 3 ; - DROP 2 ; - PAIR } } - diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz deleted file mode 100644 index 37f12b7e..00000000 --- a/batcher/batcher-storage-ghostnet.tz +++ /dev/null @@ -1,17 +0,0 @@ -(Pair (Pair (Pair (Pair "tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" {} {}) 600 10000) - (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) - 10 - (Pair 0 {}) - {} - {}) - (Pair (Pair {} {}) - {} - { Elt "tzBTC/EURL" - (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; - Elt "tzBTC/USDT" - (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) }) - { Elt "EURL" (Pair 0 "EURL" (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") 6 (Some "FA2 token")) ; - Elt "USDT" (Pair 0 "USDT" (Some "KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR") 6 (Some "FA2 token")) ; - Elt "tzBTC" - (Pair 0 "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) }) - diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 34e02565..d1d51ea3 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1,5 +1,5 @@ #import "@ligo/math-lib/rational/rational.mligo" "Rational" -#import "shared.mligo" "Shared" +#import "types.mligo" "Types" (* Errors *) [@inline] let no_rate_available_for_swap : nat = 100n @@ -58,6 +58,7 @@ [@inline] let holding_amount_to_redeem_is_larger_than_holding = 153n [@inline] let holding_shares_greater_than_total_shares_remaining = 154n [@inline] let no_holdings_to_claim = 155n +[@inline] let incorrect_side_specified = 156n (* Constants *) @@ -90,125 +91,53 @@ (* The contract assumes that the minimum precision is six and that the oracle precision must EXACTLY be 6 *) [@inline] let minimum_precision : nat = 6n -(* Side of an order, either BUY side or SELL side *) -type side = - Buy - | Sell +type side = Types.side -(* Tolerance of the order against the oracle price *) -type tolerance = - Plus | Exact | Minus +type tolerance = Types.tolerance -type token = Shared.token +type token = Types.token -(* A token value ascribes an amount to token metadata *) -type token_amount = [@layout:comb] { - token : token; - amount : nat; -} +type token_amount = Types.token_amount -type token_amount_map = (string, token_amount) map +type token_amount_map = Types.token_amount_map -type token_holding_map = (address, token_amount_map) map +type token_holding_map = Types.token_holding_map +type token_holding = Types.token_holding -(* A token amount 'held' by a specific address *) -type token_holding = [@layout:comb] { - holder: address; - token_amount : token_amount; - redeemed: bool; -} +type swap = Types.swap -type swap = [@layout:comb] { - from : token_amount; - to : token; -} +type swap_reduced = Types.swap_reduced -type swap_reduced = [@layout:comb] { - from: string; - to: string; -} +type valid_swap_reduced = Types.valid_swap_reduced -(* A valid swap is a swap pair that has a source of pricing from an oracle. *) -type valid_swap_reduced = [@layout:comb] { - swap: swap_reduced; - oracle_address: address; - oracle_asset_name: string; - oracle_precision: nat; - is_disabled_for_deposits: bool; -} -(* A valid swap is a swap pair that has a source of pricing from an oracle. *) -type valid_swap = [@layout:comb] { - swap: swap; - oracle_address: address; - oracle_asset_name: string; - oracle_precision: nat; - is_disabled_for_deposits: bool; -} +type valid_swap = Types.valid_swap -type exchange_rate_full = [@layout:comb] { - swap : swap; - rate: Rational.t; - when : timestamp; -} +type exchange_rate_full = Types.exchange_rate_full -type exchange_rate = [@layout:comb] { - swap : swap_reduced; - rate: Rational.t; - when : timestamp; -} +type exchange_rate = Types.exchange_rate -type swap_order = [@layout:comb] { - order_number: nat; - batch_number: nat; - trader : address; - swap : swap; - side : side; - tolerance : tolerance; - redeemed:bool; -} +type swap_order = Types.swap_order -type external_swap_order = [@layout:comb] { - swap : swap; - created_at : timestamp; - side : nat; - tolerance : nat; -} +type external_swap_order = Types.external_swap_order -type batch_status = - NOT_OPEN | OPEN | CLOSED | FINALIZED +type batch_status = Types.batch_status -type total_cleared_volumes = [@layout:comb] { - buy_side_total_cleared_volume: nat; - buy_side_volume_subject_to_clearing: nat; - sell_side_total_cleared_volume: nat; - sell_side_volume_subject_to_clearing: nat; +type total_cleared_volumes = Types.total_cleared_volumes -} +type clearing_volumes = Types.clearing_volumes -type clearing_volumes = [@layout:comb] { - minus: nat; - exact: nat; - plus: nat; -} - -type clearing = [@layout:comb] { - clearing_volumes : clearing_volumes; - clearing_tolerance : tolerance; - total_cleared_volumes: total_cleared_volumes; - clearing_rate: exchange_rate; -} +type clearing = Types.clearing -(* These types are used in math module *) -type buy_minus_token = int -type buy_exact_token = int -type buy_plus_token = int -type buy_side = buy_minus_token * buy_exact_token * buy_plus_token +type buy_minus_token = Types.buy_minus_token +type buy_exact_token = Types.buy_exact_token +type buy_plus_token = Types.buy_plus_token +type buy_side = Types.buy_side -type sell_minus_token = int -type sell_exact_token = int -type sell_plus_token = int -type sell_side = sell_minus_token * sell_exact_token * sell_plus_token +type sell_minus_token = Types.sell_minus_token +type sell_exact_token = Types.sell_exact_token +type sell_plus_token = Types.sell_plus_token +type sell_side = Types.sell_side type batch_status = | Open of { start_time : timestamp } @@ -265,13 +194,9 @@ type batch_set = [@layout:comb] { batches: batches; } -(* Type for contract metadata *) -type metadata = (string, bytes) big_map +type metadata = Shared.metadata -type metadata_update = { - key: string; - value: bytes; -} +type metadata_update = Shared.metadata_update type orace_price_update = timestamp * nat @@ -299,36 +224,6 @@ type fees = { } -type market_maker_vault = { - total_shares: nat; - holdings: nat set; - native_token: token_amount; - foreign_tokens: token_amount_map; -} - -type market_vaults = (string, market_maker_vault) big_map - -type market_vault_holding = { - id: nat; - token: string; - holder: address; - shares: nat; - unclaimed: tez; -} - -type user_holding_key = address * string - -type user_holdings = (user_holding_key, nat) big_map - -type vault_holdings = (nat, market_vault_holding) big_map - -type market_maker = { - vaults: market_vaults; - last_holding_id: nat; - user_holdings: user_holdings; - vault_holdings: vault_holdings; -} - [@inline] let get_token (token_name: string) @@ -1545,12 +1440,15 @@ let start_period [@inline] let close (deposit_time_window: nat) -(batch : batch) : batch = +(batch : batch) +(storage: Storage.t): Storage.t * batch = match batch.status with | Open { start_time } -> + let liquidity_order_number = storage.last_order_number + 1n in + let (batch,storage) = MarketVaultUtils.inject_jit_liquidity batch liquidity_order_number storage in let batch_close_time = start_time + (int deposit_time_window) in let new_status = Closed { start_time = start_time; closing_time = batch_close_time } in - { batch with status = new_status } + storage,{ batch with status = new_status } | _ -> failwith trying_to_close_batch_which_is_not_open [@inline] @@ -1566,18 +1464,21 @@ let progress_batch (pair: pair) (batch: batch) (batch_set: batch_set) - (current_time : timestamp) : (batch * batch_set) = + (storage: Storage.t) + (current_time : timestamp) : (batch * batch_set * Storage.t) = match batch.status with | Open { start_time } -> if current_time >= start_time + (int deposit_time_window) then - let closed_batch = close deposit_time_window batch in - update_current_batch_in_set closed_batch batch_set + let (storage,closed_batch) = close deposit_time_window batch storage in + let (b,bs) = update_current_batch_in_set closed_batch batch_set in + (b,bs,storage) else - (batch, batch_set) + (batch, batch_set,storage) | Closed { closing_time =_ ; start_time = _} -> (* Batches can only be cleared on receipt of rate so here they should just be returned *) - (batch, batch_set) - | Cleared _ -> start_period pair batch_set current_time + (batch, batch_set,storage) + | Cleared _ -> let (b,bs) = start_period pair batch_set current_time in + (b,bs,storage) [@inline] @@ -1627,27 +1528,50 @@ let get_current_batch_without_opening (deposit_time_window: nat) (pair: pair) (current_time: timestamp) - (batch_set: batch_set) : (batch option * batch_set) = + (storage: Storage.t) + (batch_set: batch_set) : (batch option * batch_set * Storage.t) = let current_batch_index = Utils.get_current_batch_index pair batch_set.current_batch_indices in match Big_map.find_opt current_batch_index batch_set.batches with - | None -> None, batch_set + | None -> None, batch_set,storage | Some cb -> let is_cleared = is_cleared cb in if is_cleared then - Some cb, batch_set + Some cb, batch_set,storage else - let batch, batch_set = progress_batch deposit_time_window pair cb batch_set current_time in - Some batch, batch_set + let batch, batch_set, storage = progress_batch deposit_time_window pair cb batch_set storage current_time in + Some batch, batch_set, storage [@inline] let get_current_batch (deposit_time_window: nat) (pair: pair) (current_time: timestamp) - (batch_set: batch_set) : (batch * batch_set) = + (storage: Storage.t) + (batch_set: batch_set) : (batch * batch_set * Storage.t) = let current_batch_index = Utils.get_current_batch_index pair batch_set.current_batch_indices in match Big_map.find_opt current_batch_index batch_set.batches with - | None -> start_period pair batch_set current_time - | Some cb -> progress_batch deposit_time_window pair cb batch_set current_time + | None -> let (b, bs) = start_period pair batch_set current_time in + (b,bs,storage) + | Some cb -> progress_batch deposit_time_window pair cb batch_set storage current_time + + +let update_storage_with_order + (order: swap_order) + (next_order_number: nat) + (current_batch_number: nat) + (batch: batch) + (batch_set: batch_set) + (storage:Storage.t) : Storage.t = + let updated_volumes = update_volumes order batch in + let updated_batches = Big_map.update current_batch_number (Some updated_volumes) batch_set.batches in + let updated_batches = BatchHoldings_Utils.add_batch_holding current_batch_number order.trader storage.user_batch_ordertypes updated_batches in + let new_ubot = Ubots.add_order order.trader current_batch_number order storage.user_batch_ordertypes in + let updated_batch_set = { batch_set with batches = updated_batches } in + updated_volumes, { + storage with batch_set = updated_batch_set; + last_order_number = next_order_number; + user_batch_ordertypes = new_ubot; + } + end @@ -1737,214 +1661,6 @@ let compute_clearing_prices end -module MarketVaultUtils = struct - - -let create_or_update_market_vault_holding - (id: nat) - (token_amount: token_amount) - (holder:address) - (previous_holding: market_vault_holding option) : market_vault_holding = - match previous_holding with - | None -> { - id = id; - token = token_amount.token.name; - holder = holder; - shares = token_amount.amount; - unclaimed = 0mutez; - } - | Some ph -> if not (ph.holder = holder) then failwith incorrect_market_vault_holder else - if not (ph.id = id) then failwith incorrect_market_vault_id else - { ph with shares = ph.shares + token_amount.amount; } - -let create_or_update_market_maker_vault - (id: nat) - (token_amount: token_amount) - (mmv_opt: market_maker_vault option) : market_maker_vault = - match mmv_opt with - | None -> { - total_shares = token_amount.amount; - holdings = Set.literal [ id ]; - native_token = token_amount; - foreign_tokens = TokenAmountMap.new; - } - | Some mmv -> let nt = mmv.native_token in - if not Token_Utils.are_equivalent_tokens token_amount.token nt.token then failwith token_already_exists_but_details_are_different else - let shares = mmv.total_shares + token_amount.amount in - let native_token = { nt with amount = nt.amount + token_amount.amount; } in - let hldgs = if Set.mem id mmv.holdings then mmv.holdings else Set.add id mmv.holdings in - { - mmv with holdings = hldgs; total_shares = shares; native_token = native_token; - } - -let add_liquidity - (h_key: user_holding_key) - (new_holding_id: nat) - (holder: address) - (token_amount: token_amount) - (market_maker: market_maker): market_maker = - let token_name = token_amount.token.name in - let vault_opt = Big_map.find_opt token_name market_maker.vaults in - let new_holding = { - id = new_holding_id; - token = token_amount.token.name; - holder = holder; - shares = token_amount.amount; - unclaimed = 0mutez; - } in - let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in - let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in - { market_maker with - vaults = vts; - vault_holdings = vhs; - user_holdings = uhs; - last_holding_id = new_holding_id; - } - - -let update_liquidity - (id: nat) - (holder: address) - (token_amount: token_amount) - (market_maker: market_maker): market_maker = - let token_name = token_amount.token.name in - let vault_opt = Big_map.find_opt token_name market_maker.vaults in - let vault = create_or_update_market_maker_vault id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let vh_opt = Big_map.find_opt id market_maker.vault_holdings in - if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else - let vh = Option.unopt vh_opt in - let () = Shared.assert_or_fail_with (vh.holder = holder) user_in_holding_is_incorrect in - let vh = {vh with shares = vh.shares + token_amount.amount; } in - let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in - { market_maker with - vaults = vts; - vault_holdings = vhs; - user_holdings = market_maker.user_holdings; - } - -let add_liquidity_to_market_maker - (holder: address) - (token_amount: token_amount) - (storage: Storage.t): ( operation list * Storage.t) = - let ops = Treasury.deposit holder token_amount in - let market_maker = storage.market_maker in - let last_holding_id = market_maker.last_holding_id in - let next_holding_id = last_holding_id + 1n in - let h_key = (holder, token_amount.token.name) in - let uh_opt = Big_map.find_opt h_key market_maker.user_holdings in - let mm = match uh_opt with - | None -> add_liquidity h_key next_holding_id holder token_amount market_maker - | Some uh_id -> update_liquidity uh_id holder token_amount market_maker - in - let storage ={ storage with market_maker = mm; } in - (ops, storage) - -let collect_from_vault - (perc_share: Rational.t) - (ta: token_amount) - (tam: token_amount_map): (token_amount * token_amount_map) = - let rat_amt = Rational.new (int ta.amount) in - let rat_amount_to_redeem = Rational.mul perc_share rat_amt in - let amount_to_redeem = Utils.get_rounded_number_lower_bound rat_amount_to_redeem in - if amount_to_redeem > ta.amount then failwith holding_amount_to_redeem_is_larger_than_holding else - let rem =abs ((int ta.amount) - amount_to_redeem) in - let ta_rem = {ta with amount = rem; } in - let ta_red = {ta with amount = amount_to_redeem; } in - let tam = if ta_red.amount = 0n then tam else TokenAmountMap.increase ta_red tam in - (ta_rem, tam) - -let collect_tokens_for_redemption - (holding_id: nat) - (perc_share: Rational.t) - (shares: nat) - (vault: market_maker_vault) = - let tokens = TokenAmountMap.new in - let (native,tokens) = collect_from_vault perc_share vault.native_token tokens in - let acc: (Rational.t * token_amount_map * token_amount_map) = (perc_share, TokenAmountMap.new, tokens ) in - let collect_redemptions = fun ((ps,rem_t,red_t),(_tn,ta):(Rational.t * token_amount_map * token_amount_map) * (string * token_amount)) -> - let (ta_rem,red_t) = collect_from_vault ps ta red_t in - let rem_t = TokenAmountMap.increase ta_rem rem_t in - (ps,rem_t,red_t) - in - let (_, foreign_tokens, tokens) = Map.fold collect_redemptions vault.foreign_tokens acc in - if shares > vault.total_shares then failwith holding_shares_greater_than_total_shares_remaining else - let rem_shares = abs (vault.total_shares - shares) in - let holdings = Set.remove holding_id vault.holdings in - ({ vault with native_token = native; foreign_tokens = foreign_tokens; holdings = holdings; total_shares = rem_shares;} ,tokens) - -let remove_liquidity - (id: nat) - (holder: address) - (token_name: string) - (h_key: user_holding_key) - (vault: market_maker_vault) - (market_maker: market_maker): (operation list * market_maker) = - let vaults = market_maker.vaults in - let user_holdings = market_maker.user_holdings in - let vault_holdings = market_maker.vault_holdings in - let holding = Shared.find_or_fail_with id unable_to_find_vault_holding_for_id vault_holdings in - let () = Shared.assert_or_fail_with (holder = holding.holder) user_in_holding_is_incorrect in - let unclaimed_tez = holding.unclaimed in - let shares = holding.shares in - let total_shares = vault.total_shares in - let perc_share = Rational.div (Rational.new (int shares)) (Rational.new (int total_shares)) in - let (vault, tam) = collect_tokens_for_redemption id perc_share shares vault in - let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in - let treasury_vault = Treasury.get_treasury_vault () in - let tok_ops = Treasury_Utils.transfer_holdings treasury_vault holder tam in - let vaults = Big_map.update token_name (Some vault) vaults in - let user_holdings = Big_map.remove h_key user_holdings in - let vault_holdings = Big_map.remove id vault_holdings in - let ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in - let mm = { market_maker with user_holdings = user_holdings; vault_holdings = vault_holdings; vaults = vaults; } in - (ops, mm) - -let remove_liquidity_from_market_maker - (holder: address) - (token_name: string) - (storage: Storage.t): ( operation list * Storage.t) = - let market_maker = storage.market_maker in - let h_key = (holder, token_name) in - let uh_opt: nat option = Big_map.find_opt h_key market_maker.user_holdings in - let v_opt = Big_map.find_opt token_name market_maker.vaults in - let () = Shared.assert_some_or_fail_with uh_opt no_holding_in_market_maker_for_holder in - let () = Shared.assert_some_or_fail_with v_opt no_market_vault_for_token in - let (ops, mm) = remove_liquidity (Option.unopt uh_opt) holder token_name h_key (Option.unopt v_opt) market_maker in - let storage = { storage with market_maker = mm; } in - (ops, storage) - -let claim_from_holding - (holder:address) - (id:nat) - (holding: market_vault_holding) - (market_maker: market_maker) - (storage: Storage.t) : (operation list * Storage.t) = - let unclaimed_tez = holding.unclaimed in - if unclaimed_tez = 0mutez then failwith no_holdings_to_claim else - let holding = { holding with unclaimed = 0tez; } in - let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in - let vault_holdings = Big_map.update id (Some holding) market_maker.vault_holdings in - let market_maker = {market_maker with vault_holdings = vault_holdings;} in - let storage = { storage with market_maker = market_maker; } in - ([tez_op], storage) - - -let claim_rewards - (holder:address) - (token_name:string) - (storage:Storage.t) : (operation list * Storage.t) = - let market_maker = storage.market_maker in - let h_key = (holder, token_name) in - match Big_map.find_opt h_key market_maker.user_holdings with - | None -> failwith no_holdings_to_claim - | Some id -> (match Big_map.find_opt id market_maker.vault_holdings with - | None -> failwith no_holdings_to_claim - | Some h ->claim_from_holding holder id h market_maker storage) - -end type storage = Storage.t @@ -1970,9 +1686,6 @@ type entrypoint = | Disable_swap_pair_for_deposit of string | Change_oracle_source_of_pair of oracle_source_change | Change_deposit_time_window of nat - | RemoveLiquidity of string - | AddLiquidity of token_amount - | Claim of string [@inline] @@ -2111,7 +1824,7 @@ let cancel_order (storage: storage) : result = let ubots = storage.user_batch_ordertypes in let current_time = Tezos.get_now () in - let (batch, batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in + let (batch, batch_set, storage) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage storage.batch_set in let () = if not (Batch_Utils.is_batch_open batch) then failwith cannot_cancel_orders_for_a_batch_that_is_not_open in match Big_map.find_opt holder ubots with | None -> failwith no_orders_for_user_address @@ -2167,32 +1880,15 @@ let confirm_swap_pair_is_disabled_prior_to_removal if valid_swap.is_disabled_for_deposits then () else failwith cannot_remove_swap_pair_that_is_not_disabled -(* Add Liquidity into a market vault *) -[@inline] -let add_liquidity - (token_amount: token_amount) - (storage: storage) : result = - let () = reject_if_tez_supplied () in - let holder = Tezos.get_sender () in - MarketVaultUtils.add_liquidity_to_market_maker holder token_amount storage - -(* Add Liquidity into a market vault *) -[@inline] -let claim - (token_name: string) - (storage: storage) : result = - let () = reject_if_tez_supplied () in - let holder = Tezos.get_sender () in - MarketVaultUtils.claim_rewards holder token_name storage - -(* Remove Liquidity into a market vault *) [@inline] -let remove_liquidity - (token_name: string) - (storage: storage) : result = - let () = reject_if_tez_supplied () in - let holder = Tezos.get_sender () in - MarketVaultUtils.remove_liquidity_from_market_maker holder token_name storage +let enforce_correct_side + (order:external_swap_order) + (valid_swap:valid_swap_reduced) : unit = + let swap = order.swap in + if order.side = 0n then + if swap.from.token.name = valid_swap.swap.from then () else failwith incorrect_side_specified + else + if swap.from.token.name = valid_swap.swap.to then () else failwith incorrect_side_specified (* Register a deposit during a valid (Open) deposit time; fails otherwise. Updates the current_batch if the time is valid but the new batch was not initialized. *) @@ -2203,11 +1899,12 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap = get_valid_swap_reduced pair_name storage in if valid_swap.is_disabled_for_deposits then failwith swap_is_disabled_for_deposits else + let () = enforce_correct_side external_order valid_swap in let fee_amount_in_mutez = storage.fee_in_mutez in let fee_provided = Tezos.get_amount () in if fee_provided < fee_amount_in_mutez then failwith insufficient_swap_fee else if fee_provided > fee_amount_in_mutez then failwith more_tez_sent_than_fee_cost else - let (current_batch, current_batch_set) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage.batch_set in + let (current_batch, current_batch_set, storage) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage storage.batch_set in if Batch_Utils.can_deposit current_batch then let () = confirm_oracle_price_is_available_before_deposit pair current_batch storage in let storage = { storage with batch_set = current_batch_set } in @@ -2216,15 +1913,7 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = let order : swap_order = external_to_order external_order next_order_number current_batch_number storage.valid_tokens storage.valid_swaps in (* We intentionally limit the amount of distinct orders that can be placed whilst unredeemed orders exist for a given user *) if Ubots.is_within_limit order.trader storage.user_batch_ordertypes then - let updated_volumes = Batch_Utils.update_volumes order current_batch in - let updated_batches = Big_map.update current_batch_number (Some updated_volumes) current_batch_set.batches in - let updated_batches = BatchHoldings_Utils.add_batch_holding current_batch_number order.trader storage.user_batch_ordertypes updated_batches in - let new_ubot = Ubots.add_order order.trader current_batch_number order storage.user_batch_ordertypes in - let updated_batch_set = { current_batch_set with batches = updated_batches } in - let updated_storage = { - storage with batch_set = updated_batch_set; - last_order_number = next_order_number; - user_batch_ordertypes = new_ubot; } in + let updated_storage = Batch_Utils.update_storage_with_order order next_order_number current_batch_number current_batch current_batch_set storage in let treasury_ops = Treasury.deposit order.trader order.swap.from in (treasury_ops, updated_storage) @@ -2296,7 +1985,7 @@ let tick_price let pair = Utils.pair_of_rate oracle_rate in let current_time = Tezos.get_now () in let batch_set = storage.batch_set in - let (batch_opt, batch_set) = Batch_Utils.get_current_batch_without_opening storage.deposit_time_window_in_seconds pair current_time batch_set in + let (batch_opt, batch_set, storage) = Batch_Utils.get_current_batch_without_opening storage.deposit_time_window_in_seconds pair current_time storage batch_set in match batch_opt with | Some b -> let batch_set = finalize b current_time oracle_rate batch_set in let storage = { storage with batch_set = batch_set } in @@ -2446,44 +2135,6 @@ let get_current_batches ((),storage: unit * storage) : batch list= in Map.fold collect_batches storage.batch_set.current_batch_indices [] -type vault_summary = (string, market_maker_vault) map -type holding_summary = (string, market_vault_holding) map - -type vault_holdings_summary = - { - holdings: holding_summary; - vaults: vault_summary; - } - -[@view] -let get_market_vault_holdings ((), storage : unit * storage) : vault_holdings_summary = - let mm = storage.market_maker in - let vaults = mm.vaults in - let user_holdings = mm.user_holdings in - let vault_holdings = mm.vault_holdings in - let holder = Tezos.get_sender () in - let get_tokens = fun (l,(tn,_vt): string list * (string * token)) -> tn :: l in - let tokens = Map.fold get_tokens storage.valid_tokens [] in - let get_vaults = fun (vs,t: vault_summary * string) -> - match Big_map.find_opt t vaults with - | None -> vs - | Some v -> Map.add t v vs - in - let vaults = List.fold get_vaults tokens (Map.empty: vault_summary) in - let get_holdings = fun (hs,t: holding_summary * string) -> - let key = (holder, t) in - match Big_map.find_opt key user_holdings with - | None -> hs - | Some id -> (match Big_map.find_opt id vault_holdings with - | None -> hs - | Some h -> Map.add t h hs) - in - let holdings = List.fold get_holdings tokens (Map.empty: holding_summary) in - { - holdings = holdings; - vaults = vaults; - } - let main (action, storage : entrypoint * storage) : operation list * storage = @@ -2507,9 +2158,5 @@ let main | Enable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name false storage | Disable_swap_pair_for_deposit pair_name -> set_deposit_status pair_name true storage | Change_deposit_time_window t -> change_deposit_time_window t storage - (* Market Liquidity endpoint *) - | AddLiquidity t -> add_liquidity t storage - | RemoveLiquidity tn -> remove_liquidity tn storage - | Claim tn -> claim tn storage diff --git a/batcher/market-tokens.mligo b/batcher/market-tokens.mligo deleted file mode 100644 index 1983034e..00000000 --- a/batcher/market-tokens.mligo +++ /dev/null @@ -1,38 +0,0 @@ -#import "shared.mligo" "Shared" - -type storage = { - batcher_address: address; - tokens: (string,Shared.market_token) big_map; -} - - - -[@inline] -let no_op (s : storage) : result = (([] : operation list), s) - -type entrypoint = - | Mint of Shared.mint_burn_request - | Tick of Shared.mint_burn_request - - -[@inline] -let mint - (mint_request: mint_burn_request) - (storage: storage) : result = - no_op storage - - -[@view] -let getCurrentCirculation (asset, storage : string * storage) = - match Big_map.find_opt asset storage with - | None -> failwith "No rate available" - | Some r -> (r.timestamp, r.value) - - -let main - (action, storage : entrypoint * storage) : operation list * storage = - match action with - | Mint req -> mint req storage - | Burn -> burn storage - - diff --git a/batcher/marketmaker.mligo b/batcher/marketmaker.mligo new file mode 100644 index 00000000..1b621d1d --- /dev/null +++ b/batcher/marketmaker.mligo @@ -0,0 +1,428 @@ +#import "@ligo/math-lib/rational/rational.mligo" "Rational" +#import "types.mligo" "Types" + + +type token = Types.token + +type token_amount = Types.token_amount + +type token_amount_map = Types.token_amount_map + +type market_maker_vault = { + total_shares: nat; + holdings: nat set; + native_token: token_amount; + foreign_tokens: token_amount_map; +} + +type market_vaults = (string, market_maker_vault) big_map + +type market_vault_holding = { + id: nat; + token: string; + holder: address; + shares: nat; + unclaimed: tez; +} + +type user_holding_key = address * string + +type user_holdings = (user_holding_key, nat) big_map + +type vault_holdings = (nat, market_vault_holding) big_map + +type metadata = Shared.metadata + +type metadata_update = Shared.metadata_update + +module Storage = struct + + type t = { + metadata: metadata; + valid_tokens : valid_tokens; + valid_swaps : valid_swaps; + administrator : address; + batcher : address; + limit_on_tokens_or_pairs : nat; + vaults: market_vaults; + last_holding_id: nat; + user_holdings: user_holdings; + vault_holdings: vault_holdings; + } + +end +module MarketVaultUtils = struct + +let find_liquidity_amount + (rate:exchange_rate) + (total_liquidity:nat) + (volume:nat) : nat = + let rat_volume = Rational.new (int volume) in + let equiv_vol = Rational.mul rate.rate rat_volume in + let resolved_equiv_vol = Utils.get_rounded_number_lower_bound equiv_vol in + if total_liquidity > resolved_equiv_vol then resolved_equiv_vol else total_liquidity + +let create_liq_order + (bn:nat) + (non:nat) + (from:string) + (to:string) + (side:side) + (liq:nat) + (valid_tokens: valid_tokens): swap_order = + let from_token = Option.unopt (Map.find_opt from valid_tokens) in + let to_token = Option.unopt (Map.find_opt to valid_tokens) in + { + order_number = non; + batch_number = bn; + trader = Treasury.get_treasury_vault (); + swap = { + from = { + token = from_token; + amount = liq; + }; + to = to_token; + }; + side=side; + tolerance = Exact; + redeemed = false; + } + + +let inject_buy_side_liquidity + (non: nat) + (last_rate:exchange_rate) + (sell_volume: nat) + (batch:batch) + (batch_set: batch_set) + (storage: Storage.t): batch * Storage.t = + let (buy_token,sell_token) = batch.pair in + let mm = storage.market_maker in + match Big_map.find_opt buy_token mm.vaults with + | None -> batch,storage + | Some v -> let liq_amount = find_liquidity_amount last_rate v.native_token.amount sell_volume in + let order = create_liq_order batch.batch_number non buy_token sell_token Buy liq_amount storage.valid_tokens in + Batch_Utils.update_storage_with_order order non batch.number batch batch_set storage + +let inject_sell_side_liquidity + (non: nat) + (last_rate:exchange_rate) + (buy_volume: nat) + (batch:batch) + (batch_set: batch_set) + (storage: Storage.t): batch * Storage.t = + let (buy_token, sell_token) = batch.pair in + let mm = storage.market_maker in + match Big_map.find_opt sell_token mm.vaults with + | None -> batch,storage + | Some v -> let liq_amount = find_liquidity_amount last_rate v.native_token.amount buy_volume in + let order = create_liq_order batch.batch_number non sell_token buy_token Sell liq_amount storage.valid_tokens in + Batch_Utils.update_storage_with_order order non batch.number batch batch_set storage + +let inject_jit_liquidity + (last_rate:exchange_rate) + (batch:batch) + (next_order_number:nat) + (storage: Storage.t): batch * Storage.t = + let batch_set = storage.batch_set in + let buy_volume = batch.volumes.buy_total_volume in + let sell_volume = batch.volumes.sell_total_volume in + if (buy_volume > 0n) && (sell_volume = 0n) then inject_sell_side_liquidity next_order_number last_rate buy_volume batch batch_set storage else + if (buy_volume = 0n) && (sell_volume > 0n) then inject_buy_side_liquidity next_order_number last_rate sell_volume batch batch_set storage else + batch,storage + +let create_or_update_market_vault_holding + (id: nat) + (token_amount: token_amount) + (holder:address) + (previous_holding: market_vault_holding option) : market_vault_holding = + match previous_holding with + | None -> { + id = id; + token = token_amount.token.name; + holder = holder; + shares = token_amount.amount; + unclaimed = 0mutez; + } + | Some ph -> if not (ph.holder = holder) then failwith incorrect_market_vault_holder else + if not (ph.id = id) then failwith incorrect_market_vault_id else + { ph with shares = ph.shares + token_amount.amount; } + +let create_or_update_market_maker_vault + (id: nat) + (token_amount: token_amount) + (mmv_opt: market_maker_vault option) : market_maker_vault = + match mmv_opt with + | None -> { + total_shares = token_amount.amount; + holdings = Set.literal [ id ]; + native_token = token_amount; + foreign_tokens = TokenAmountMap.new; + } + | Some mmv -> let nt = mmv.native_token in + if not Token_Utils.are_equivalent_tokens token_amount.token nt.token then failwith token_already_exists_but_details_are_different else + let shares = mmv.total_shares + token_amount.amount in + let native_token = { nt with amount = nt.amount + token_amount.amount; } in + let hldgs = if Set.mem id mmv.holdings then mmv.holdings else Set.add id mmv.holdings in + { + mmv with holdings = hldgs; total_shares = shares; native_token = native_token; + } + +let add_liquidity + (h_key: user_holding_key) + (new_holding_id: nat) + (holder: address) + (token_amount: token_amount) + (market_maker: market_maker): market_maker = + let token_name = token_amount.token.name in + let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let new_holding = { + id = new_holding_id; + token = token_amount.token.name; + holder = holder; + shares = token_amount.amount; + unclaimed = 0mutez; + } in + let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in + let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in + { market_maker with + vaults = vts; + vault_holdings = vhs; + user_holdings = uhs; + last_holding_id = new_holding_id; + } + + +let update_liquidity + (id: nat) + (holder: address) + (token_amount: token_amount) + (market_maker: market_maker): market_maker = + let token_name = token_amount.token.name in + let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let vault = create_or_update_market_maker_vault id token_amount vault_opt in + let vts = Big_map.update token_name (Some vault) market_maker.vaults in + let vh_opt = Big_map.find_opt id market_maker.vault_holdings in + if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else + let vh = Option.unopt vh_opt in + let () = Shared.assert_or_fail_with (vh.holder = holder) user_in_holding_is_incorrect in + let vh = {vh with shares = vh.shares + token_amount.amount; } in + let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in + { market_maker with + vaults = vts; + vault_holdings = vhs; + user_holdings = market_maker.user_holdings; + } + +let add_liquidity_to_market_maker + (holder: address) + (token_amount: token_amount) + (storage: Storage.t): ( operation list * Storage.t) = + let ops = Treasury.deposit holder token_amount in + let market_maker = storage.market_maker in + let last_holding_id = market_maker.last_holding_id in + let next_holding_id = last_holding_id + 1n in + let h_key = (holder, token_amount.token.name) in + let uh_opt = Big_map.find_opt h_key market_maker.user_holdings in + let mm = match uh_opt with + | None -> add_liquidity h_key next_holding_id holder token_amount market_maker + | Some uh_id -> update_liquidity uh_id holder token_amount market_maker + in + let storage ={ storage with market_maker = mm; } in + (ops, storage) + +let collect_from_vault + (perc_share: Rational.t) + (ta: token_amount) + (tam: token_amount_map): (token_amount * token_amount_map) = + let rat_amt = Rational.new (int ta.amount) in + let rat_amount_to_redeem = Rational.mul perc_share rat_amt in + let amount_to_redeem = Utils.get_rounded_number_lower_bound rat_amount_to_redeem in + if amount_to_redeem > ta.amount then failwith holding_amount_to_redeem_is_larger_than_holding else + let rem =abs ((int ta.amount) - amount_to_redeem) in + let ta_rem = {ta with amount = rem; } in + let ta_red = {ta with amount = amount_to_redeem; } in + let tam = if ta_red.amount = 0n then tam else TokenAmountMap.increase ta_red tam in + (ta_rem, tam) + +let collect_tokens_for_redemption + (holding_id: nat) + (perc_share: Rational.t) + (shares: nat) + (vault: market_maker_vault) = + let tokens = TokenAmountMap.new in + let (native,tokens) = collect_from_vault perc_share vault.native_token tokens in + let acc: (Rational.t * token_amount_map * token_amount_map) = (perc_share, TokenAmountMap.new, tokens ) in + let collect_redemptions = fun ((ps,rem_t,red_t),(_tn,ta):(Rational.t * token_amount_map * token_amount_map) * (string * token_amount)) -> + let (ta_rem,red_t) = collect_from_vault ps ta red_t in + let rem_t = TokenAmountMap.increase ta_rem rem_t in + (ps,rem_t,red_t) + in + let (_, foreign_tokens, tokens) = Map.fold collect_redemptions vault.foreign_tokens acc in + if shares > vault.total_shares then failwith holding_shares_greater_than_total_shares_remaining else + let rem_shares = abs (vault.total_shares - shares) in + let holdings = Set.remove holding_id vault.holdings in + ({ vault with native_token = native; foreign_tokens = foreign_tokens; holdings = holdings; total_shares = rem_shares;} ,tokens) + +let remove_liquidity + (id: nat) + (holder: address) + (token_name: string) + (h_key: user_holding_key) + (vault: market_maker_vault) + (market_maker: market_maker): (operation list * market_maker) = + let vaults = market_maker.vaults in + let user_holdings = market_maker.user_holdings in + let vault_holdings = market_maker.vault_holdings in + let holding = Shared.find_or_fail_with id unable_to_find_vault_holding_for_id vault_holdings in + let () = Shared.assert_or_fail_with (holder = holding.holder) user_in_holding_is_incorrect in + let unclaimed_tez = holding.unclaimed in + let shares = holding.shares in + let total_shares = vault.total_shares in + let perc_share = Rational.div (Rational.new (int shares)) (Rational.new (int total_shares)) in + let (vault, tam) = collect_tokens_for_redemption id perc_share shares vault in + let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in + let treasury_vault = Treasury.get_treasury_vault () in + let tok_ops = Treasury_Utils.transfer_holdings treasury_vault holder tam in + let vaults = Big_map.update token_name (Some vault) vaults in + let user_holdings = Big_map.remove h_key user_holdings in + let vault_holdings = Big_map.remove id vault_holdings in + let ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in + let mm = { market_maker with user_holdings = user_holdings; vault_holdings = vault_holdings; vaults = vaults; } in + (ops, mm) + +let remove_liquidity_from_market_maker + (holder: address) + (token_name: string) + (storage: Storage.t): ( operation list * Storage.t) = + let market_maker = storage.market_maker in + let h_key = (holder, token_name) in + let uh_opt: nat option = Big_map.find_opt h_key market_maker.user_holdings in + let v_opt = Big_map.find_opt token_name market_maker.vaults in + let () = Shared.assert_some_or_fail_with uh_opt no_holding_in_market_maker_for_holder in + let () = Shared.assert_some_or_fail_with v_opt no_market_vault_for_token in + let (ops, mm) = remove_liquidity (Option.unopt uh_opt) holder token_name h_key (Option.unopt v_opt) market_maker in + let storage = { storage with market_maker = mm; } in + (ops, storage) + +let claim_from_holding + (holder:address) + (id:nat) + (holding: market_vault_holding) + (market_maker: market_maker) + (storage: Storage.t) : (operation list * Storage.t) = + let unclaimed_tez = holding.unclaimed in + if unclaimed_tez = 0mutez then failwith no_holdings_to_claim else + let holding = { holding with unclaimed = 0tez; } in + let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in + let vault_holdings = Big_map.update id (Some holding) market_maker.vault_holdings in + let market_maker = {market_maker with vault_holdings = vault_holdings;} in + let storage = { storage with market_maker = market_maker; } in + ([tez_op], storage) + + +let claim_rewards + (holder:address) + (token_name:string) + (storage:Storage.t) : (operation list * Storage.t) = + let market_maker = storage.market_maker in + let h_key = (holder, token_name) in + match Big_map.find_opt h_key market_maker.user_holdings with + | None -> failwith no_holdings_to_claim + | Some id -> (match Big_map.find_opt id market_maker.vault_holdings with + | None -> failwith no_holdings_to_claim + | Some h ->claim_from_holding holder id h market_maker storage) + +end + +type storage = Storage.t +type result = operation list * storage + +[@inline] +let no_op (s : storage) : result = (([] : operation list), s) + +type entrypoint = + | RemoveLiquidity of string + | AddLiquidity of token_amount + | Claim of string + + +(* Add Liquidity into a market vault *) +[@inline] +let add_liquidity + (token_amount: token_amount) + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let holder = Tezos.get_sender () in + MarketVaultUtils.add_liquidity_to_market_maker holder token_amount storage + +(* Add Liquidity into a market vault *) +[@inline] +let claim + (token_name: string) + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let holder = Tezos.get_sender () in + MarketVaultUtils.claim_rewards holder token_name storage + +(* Remove Liquidity into a market vault *) +[@inline] +let remove_liquidity + (token_name: string) + (storage: storage) : result = + let () = reject_if_tez_supplied () in + let holder = Tezos.get_sender () in + MarketVaultUtils.remove_liquidity_from_market_maker holder token_name storage + + + +type vault_summary = (string, market_maker_vault) map +type holding_summary = (string, market_vault_holding) map + +type vault_holdings_summary = + { + holdings: holding_summary; + vaults: vault_summary; + } + + +[@view] +let get_market_vault_holdings ((), storage : unit * storage) : vault_holdings_summary = + let mm = storage.market_maker in + let vaults = mm.vaults in + let user_holdings = mm.user_holdings in + let vault_holdings = mm.vault_holdings in + let holder = Tezos.get_sender () in + let get_tokens = fun (l,(tn,_vt): string list * (string * token)) -> tn :: l in + let tokens = Map.fold get_tokens storage.valid_tokens [] in + let get_vaults = fun (vs,t: vault_summary * string) -> + match Big_map.find_opt t vaults with + | None -> vs + | Some v -> Map.add t v vs + in + let vaults = List.fold get_vaults tokens (Map.empty: vault_summary) in + let get_holdings = fun (hs,t: holding_summary * string) -> + let key = (holder, t) in + match Big_map.find_opt key user_holdings with + | None -> hs + | Some id -> (match Big_map.find_opt id vault_holdings with + | None -> hs + | Some h -> Map.add t h hs) + in + let holdings = List.fold get_holdings tokens (Map.empty: holding_summary) in + { + holdings = holdings; + vaults = vaults; + } + +let main + (action, storage : entrypoint * storage) : operation list * storage = + match action with + (* Market Liquidity endpoint *) + | AddLiquidity t -> add_liquidity t storage + | RemoveLiquidity tn -> remove_liquidity tn storage + | Claim tn -> claim tn storage + + diff --git a/batcher/shared.mligo b/batcher/shared.mligo deleted file mode 100644 index 6e5b1548..00000000 --- a/batcher/shared.mligo +++ /dev/null @@ -1,66 +0,0 @@ -type mint_burn_request = { - name: string; - amount: nat; -} - -type token = [@layout:comb] { - token_id: nat; - name : string; - address : address option; - decimals : nat; - standard : string option; -} - -type market_token = { - circulation: nat; - token: token; - -} - -let assert_some_or_fail_with - (type a) - (an_opt: a option) - (error: nat) = - match an_opt with - | None -> failwith error - | Some _ -> () - -let assert_or_fail_with - (predicate: bool) - (error: nat) = - if not predicate then failwith error else () - -let find_or_fail_with - (type a b) - (key: a) - (error: nat) - (bmap: (a,b) big_map) : b = - match Big_map.find_opt key bmap with - | None -> failwith error - | Some v -> v - -let bi_map_opt_sn - (type a b) - (f_some: a -> b) - (f_none: unit -> b) - (boxed: a option): b = - match boxed with - | Some v -> f_some v - | None -> f_none () - -let map_opt - (type a b) - (f: a -> b) - (boxed: a option): b option = - match boxed with - | None -> None - | Some v -> Some (f v) - -let bind_opt - (type a b) - (f: a -> b option) - (boxed: a option): b option = - match boxed with - | None -> None - | Some v -> f v - diff --git a/batcher/storage/marketmaker_storage.ghostnet.mligo b/batcher/storage/marketmaker_storage.ghostnet.mligo new file mode 100644 index 00000000..2b723eb9 --- /dev/null +++ b/batcher/storage/marketmaker_storage.ghostnet.mligo @@ -0,0 +1,59 @@ +#import "../marketmaker.mligo" "MarketMaker" + +let f(_:unit) : MarketMaker.Storage.t = { + metadata = (Big_map.empty : MarketMaker.metadata); + valid_tokens = Map.literal [ + (("tzBTC"), { + token_id = 0n; + name = "tzBTC"; + address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); + decimals = 8n; + standard = Some "FA1.2 token" + }); + (("EURL"),{ + token_id = 0n; + name = "EURL"; + address = Some(("KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS" : address)); + decimals = 6n; + standard = Some "FA2 token" + }); + (("USDT"),{ + token_id = 0n; + name = "USDT"; + address = Some(("KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR" : address)); + decimals = 6n; + standard = Some "FA2 token" + }) + ]; + valid_swaps = Map.literal [ + ("tzBTC/USDT", { + swap = { + from = "tzBTC"; + to = "USDT"; + }; + oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); + oracle_asset_name = "BTC-USDT"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ); + ("tzBTC/EURL", { + swap = { + from = "tzBTC"; + to = "EURL"; + }; + oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); + oracle_asset_name = "BTC-EUR"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ) + ]; + batcher = ("tz1burnburnburnburnburnburnburjAYjjX" : address); + administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); + vaults = (Big_map.empty: Batcher.market_vaults); + last_holding_id = 0n; + user_holdings = (Big_map.empty: MarketMaker.user_holdings); + vault_holdings = (Big_map.empty: MarketMaker.vault_holdings); +} + diff --git a/batcher/test/endpoints/user/test_deposits.mligo b/batcher/test/endpoints/user/test_deposits.mligo index 42f44613..9a40831f 100644 --- a/batcher/test/endpoints/user/test_deposits.mligo +++ b/batcher/test/endpoints/user/test_deposits.mligo @@ -96,11 +96,38 @@ let vanilla_deposit_should_succeed = ; Helpers.expect_last_order_number bstorage 1n ]) +let deposit_with_incorrect_side_should_fail = + Breath.Model.case + "test deposit" + "should be successful" + (fun (level: Breath.Logger.level) -> + let context = Helpers.test_context level in + let batcher = context.contracts.batcher in + let btc_trader = context.btc_trader in + + let bstorage = Breath.Contract.storage_of batcher in + + let deposit_amount = 2000000n in + let allowance = { + spender = batcher.originated_address; + value = deposit_amount + } in + + let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in + let act_deposit = Helpers.place_order btc_trader batcher bstorage.fee_in_mutez "tzBTC" "USDT" deposit_amount Sell Exact bstorage.valid_tokens in + + Breath.Result.reduce [ + act_allow_transfer + ; act_deposit + ; Breath.Expect.fail_with_value Batcher.incorrect_side_specified act_deposit + ]) + let test_suite = Breath.Model.suite "Suite for Deposits" [ deposit_fail_no_token_allowance ; vanilla_deposit_should_succeed ; deposit_fail_if_batch_is_closed + ; deposit_with_incorrect_side_should_fail ] diff --git a/batcher/test/market_maker/test_claim_rewards.mligo b/batcher/test/market_maker/test_claim_rewards.mligo index b823b81b..fdc6da74 100644 --- a/batcher/test/market_maker/test_claim_rewards.mligo +++ b/batcher/test/market_maker/test_claim_rewards.mligo @@ -22,11 +22,9 @@ let claim_should_fail_with_zero_unclaimed = spender = batcher.originated_address; value = deposit_amount } in - let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in let act_claim = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Claim token_name) 0tez)) in - let bstorage = Breath.Contract.storage_of batcher in Breath.Result.reduce [ diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo index 6df06cb0..3a09ae7d 100644 --- a/batcher/test/test.mligo +++ b/batcher/test/test.mligo @@ -46,7 +46,7 @@ let () = Breath.Model.run_suites Void [ test_suite - (* ; Admin_Change_Fee.test_suite +(* ; Admin_Change_Fee.test_suite ; Admin_Change_Admin_Address.test_suite ; Admin_Change_Fee_Recipient_Address.test_suite ; Admin_Change_Deposit_Time_Window.test_suite @@ -56,9 +56,9 @@ let () = ; Admin_Change_Oracle_Source_Of_Pair.test_suite ; Admin_Add_Remove_Token_Swap_Pair.test_suite ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite *) + ; Economics_Clearing.test_suite ; User_Deposits.test_suite - ; User_Cancellations.test_suite + ; User_Cancellations.test_suite *) // ; User_Redemptions.test_suite ; Market_Maker_Add_Update_Liquidity.test_suite ; Market_Maker_Claim_Rewards.test_suite diff --git a/batcher/types.mligo b/batcher/types.mligo new file mode 100644 index 00000000..ce65c963 --- /dev/null +++ b/batcher/types.mligo @@ -0,0 +1,204 @@ + + + + + +(* Side of an order, either BUY side or SELL side *) +type side = + Buy + | Sell + +(* Tolerance of the order against the oracle price *) +type tolerance = + Plus | Exact | Minus + + +type mint_burn_request = { + name: string; + amount: nat; +} + +type token = [@layout:comb] { + token_id: nat; + name : string; + address : address option; + decimals : nat; + standard : string option; +} + +(* A token value ascribes an amount to token metadata *) +type token_amount = [@layout:comb] { + token : token; + amount : nat; +} + +type token_amount_map = (string, token_amount) map + +type token_holding_map = (address, token_amount_map) map + + +(* A token amount 'held' by a specific address *) +type token_holding = [@layout:comb] { + holder: address; + token_amount : token_amount; + redeemed: bool; +} + +type swap = [@layout:comb] { + from : token_amount; + to : token; +} + +type swap_reduced = [@layout:comb] { + from: string; + to: string; +} + +(* A valid swap is a swap pair that has a source of pricing from an oracle. *) +type valid_swap_reduced = [@layout:comb] { + swap: swap_reduced; + oracle_address: address; + oracle_asset_name: string; + oracle_precision: nat; + is_disabled_for_deposits: bool; +} +(* A valid swap is a swap pair that has a source of pricing from an oracle. *) +type valid_swap = [@layout:comb] { + swap: swap; + oracle_address: address; + oracle_asset_name: string; + oracle_precision: nat; + is_disabled_for_deposits: bool; +} + + +type exchange_rate_full = [@layout:comb] { + swap : swap; + rate: Rational.t; + when : timestamp; +} + +type exchange_rate = [@layout:comb] { + swap : swap_reduced; + rate: Rational.t; + when : timestamp; +} + +type swap_order = [@layout:comb] { + order_number: nat; + batch_number: nat; + trader : address; + swap : swap; + side : side; + tolerance : tolerance; + redeemed:bool; +} + +type external_swap_order = [@layout:comb] { + swap : swap; + created_at : timestamp; + side : nat; + tolerance : nat; +} + +type batch_status = + NOT_OPEN | OPEN | CLOSED | FINALIZED + +type total_cleared_volumes = [@layout:comb] { + buy_side_total_cleared_volume: nat; + buy_side_volume_subject_to_clearing: nat; + sell_side_total_cleared_volume: nat; + sell_side_volume_subject_to_clearing: nat; + +} + +type clearing_volumes = [@layout:comb] { + minus: nat; + exact: nat; + plus: nat; +} + +type clearing = [@layout:comb] { + clearing_volumes : clearing_volumes; + clearing_tolerance : tolerance; + total_cleared_volumes: total_cleared_volumes; + clearing_rate: exchange_rate; +} + +(* These types are used in math module *) +type buy_minus_token = int +type buy_exact_token = int +type buy_plus_token = int +type buy_side = buy_minus_token * buy_exact_token * buy_plus_token + +type sell_minus_token = int +type sell_exact_token = int +type sell_plus_token = int +type sell_side = sell_minus_token * sell_exact_token * sell_plus_token + + + + + + +type market_token = { + circulation: nat; + token: token; + +} + +(* Type for contract metadata *) +type metadata = (string, bytes) big_map + +type metadata_update = { + key: string; + value: bytes; +} + +let assert_some_or_fail_with + (type a) + (an_opt: a option) + (error: nat) = + match an_opt with + | None -> failwith error + | Some _ -> () + +let assert_or_fail_with + (predicate: bool) + (error: nat) = + if not predicate then failwith error else () + +let find_or_fail_with + (type a b) + (key: a) + (error: nat) + (bmap: (a,b) big_map) : b = + match Big_map.find_opt key bmap with + | None -> failwith error + | Some v -> v + +let bi_map_opt_sn + (type a b) + (f_some: a -> b) + (f_none: unit -> b) + (boxed: a option): b = + match boxed with + | Some v -> f_some v + | None -> f_none () + +let map_opt + (type a b) + (f: a -> b) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> Some (f v) + +let bind_opt + (type a b) + (f: a -> b option) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> f v + diff --git a/batcher/utils.mligo b/batcher/utils.mligo new file mode 100644 index 00000000..e69de29b From 7528a6a43a88b47acd108dc3f614f1033ddcded8 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Thu, 7 Sep 2023 14:43:21 +0400 Subject: [PATCH 086/108] Seperated out tests --- .github/workflows/test.yml | 12 ++-- batcher/Makefile | 9 ++- .../economics/test_clearing.mligo | 8 +-- .../test_add_remove_token_swap_pair.mligo | 4 +- .../test_add_update_remove_metadata.mligo | 4 +- .../admin/test_amend_token_pair_limit.mligo | 4 +- .../admin/test_change_admin_address.mligo | 4 +- .../test_change_deposit_time_window.mligo | 4 +- .../endpoints/admin/test_change_fee.mligo | 4 +- .../test_change_fee_recipient_address.mligo | 4 +- .../test_change_oracle_source_of_pair.mligo | 4 +- ...enable_disable_swap_pair_for_deposit.mligo | 4 +- .../endpoints/maintenance/test_tick.mligo | 4 +- .../endpoints/user/test_cancellations.mligo | 6 +- .../endpoints/user/test_deposits.mligo | 6 +- .../endpoints/user/test_redemptions.mligo | 8 +-- .../test/{ => batcher}/test_contract.mligo | 0 batcher/test/test-batcher.mligo | 61 +++++++++++++++++ batcher/test/test-market-maker.mligo | 38 +++++++++++ batcher/test/test.mligo | 67 ------------------- 20 files changed, 148 insertions(+), 107 deletions(-) rename batcher/test/{ => batcher}/economics/test_clearing.mligo (93%) rename batcher/test/{ => batcher}/endpoints/admin/test_add_remove_token_swap_pair.mligo (99%) rename batcher/test/{ => batcher}/endpoints/admin/test_add_update_remove_metadata.mligo (98%) rename batcher/test/{ => batcher}/endpoints/admin/test_amend_token_pair_limit.mligo (97%) rename batcher/test/{ => batcher}/endpoints/admin/test_change_admin_address.mligo (97%) rename batcher/test/{ => batcher}/endpoints/admin/test_change_deposit_time_window.mligo (98%) rename batcher/test/{ => batcher}/endpoints/admin/test_change_fee.mligo (96%) rename batcher/test/{ => batcher}/endpoints/admin/test_change_fee_recipient_address.mligo (97%) rename batcher/test/{ => batcher}/endpoints/admin/test_change_oracle_source_of_pair.mligo (98%) rename batcher/test/{ => batcher}/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo (97%) rename batcher/test/{ => batcher}/endpoints/maintenance/test_tick.mligo (88%) rename batcher/test/{ => batcher}/endpoints/user/test_cancellations.mligo (96%) rename batcher/test/{ => batcher}/endpoints/user/test_deposits.mligo (96%) rename batcher/test/{ => batcher}/endpoints/user/test_redemptions.mligo (86%) rename batcher/test/{ => batcher}/test_contract.mligo (100%) create mode 100644 batcher/test/test-batcher.mligo create mode 100644 batcher/test/test-market-maker.mligo delete mode 100644 batcher/test/test.mligo diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef2c9a20..7cd13083 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,6 @@ on: workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually push: - jobs: test: runs-on: ubuntu-latest @@ -23,10 +22,15 @@ jobs: ligo_version: 0.70.1 command: install working_directory: batcher - - name: Run test + - name: Run batcher test uses: marigold-dev/ligo-action@v1.0.0 with: ligo_version: 0.70.1 - command: run test test/test.mligo + command: run test test/test-batcher.mligo + working_directory: batcher + - name: Run market maker test + uses: marigold-dev/ligo-action@v1.0.0 + with: + ligo_version: 0.70.1 + command: run test test/test-market-maker.mligo working_directory: batcher - diff --git a/batcher/Makefile b/batcher/Makefile index 39fab41a..d569cac0 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -75,8 +75,13 @@ build-fa12-tzBTC: $(call clean_files) $(call compile_contract,$(FA12_DIRECTORY)/main.mligo, tzBTC_fa12_token.tz) $(call compile_storage,$(FA12_STORAGE_DIRECTORY)/tzBTC_storage.mligo, tzBTC_fa12_token_storage.tz) -test: - $(call test_ligo,$(TEST_DIRECTORY)/test.mligo) +test-mm: + $(call test_ligo,$(TEST_DIRECTORY)/test-market-maker.mligo) +test-batcher: + $(call test_ligo,$(TEST_DIRECTORY)/test-batcher.mligo) +test-all: + $(call test_ligo,$(TEST_DIRECTORY)/test-batcher.mligo) + $(call test_ligo,$(TEST_DIRECTORY)/test-market-maker.mligo) measure: $(call measure_contract,batcher.mligo) install: diff --git a/batcher/test/economics/test_clearing.mligo b/batcher/test/batcher/economics/test_clearing.mligo similarity index 93% rename from batcher/test/economics/test_clearing.mligo rename to batcher/test/batcher/economics/test_clearing.mligo index 91c25834..47cd9164 100644 --- a/batcher/test/economics/test_clearing.mligo +++ b/batcher/test/batcher/economics/test_clearing.mligo @@ -1,8 +1,8 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../common/utils.mligo" "Utils" -#import "./../common/batch.mligo" "Batch" -#import "../../batcher.mligo" "Batcher" -#import "./../common/helpers.mligo" "Helpers" +#import "./../../common/utils.mligo" "Utils" +#import "./../../common/batch.mligo" "Batch" +#import "../../../batcher.mligo" "Batcher" +#import "./../../common/helpers.mligo" "Helpers" type batch = Batcher.batch diff --git a/batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo b/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo similarity index 99% rename from batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo rename to batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo index fb94dd0b..bdd798b1 100644 --- a/batcher/test/endpoints/admin/test_add_remove_token_swap_pair.mligo +++ b/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo @@ -1,6 +1,6 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let get_tzbtc_eurl_swap_pair (disabled: bool) diff --git a/batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo b/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo similarity index 98% rename from batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo rename to batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo index 7691dd8a..b8e31fb3 100644 --- a/batcher/test/endpoints/admin/test_add_update_remove_metadata.mligo +++ b/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo @@ -1,6 +1,6 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let test_metadata = ("546573742044617461" : bytes) let updated_test_metadata = ("5570646174656420546573742044617461" : bytes) diff --git a/batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo b/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo similarity index 97% rename from batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo rename to batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo index f6ed0f68..cb13a411 100644 --- a/batcher/test/endpoints/admin/test_amend_token_pair_limit.mligo +++ b/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo @@ -1,6 +1,6 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let amend_token_pair_limit_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/admin/test_change_admin_address.mligo b/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo similarity index 97% rename from batcher/test/endpoints/admin/test_change_admin_address.mligo rename to batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo index 6971eee4..56e75965 100644 --- a/batcher/test/endpoints/admin/test_change_admin_address.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let change_admin_address_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/admin/test_change_deposit_time_window.mligo b/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo similarity index 98% rename from batcher/test/endpoints/admin/test_change_deposit_time_window.mligo rename to batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo index 68ec02a9..b4b46e52 100644 --- a/batcher/test/endpoints/admin/test_change_deposit_time_window.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo @@ -1,6 +1,6 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let change_deposit_time_window_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/admin/test_change_fee.mligo b/batcher/test/batcher/endpoints/admin/test_change_fee.mligo similarity index 96% rename from batcher/test/endpoints/admin/test_change_fee.mligo rename to batcher/test/batcher/endpoints/admin/test_change_fee.mligo index cdc6a88c..6be3d025 100644 --- a/batcher/test/endpoints/admin/test_change_fee.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_fee.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let change_fee_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo b/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo similarity index 97% rename from batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo rename to batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo index 93b0cbfc..cb4aef37 100644 --- a/batcher/test/endpoints/admin/test_change_fee_recipient_address.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let change_fee_recipient_address_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo b/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo similarity index 98% rename from batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo rename to batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo index a1e78755..6018decb 100644 --- a/batcher/test/endpoints/admin/test_change_oracle_source_of_pair.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo @@ -1,6 +1,6 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let pair = "tzBTC/USDT" let oraclepair = "BTC-USDT" diff --git a/batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo b/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo similarity index 97% rename from batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo rename to batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo index 1d1b3526..5e8e2691 100644 --- a/batcher/test/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo +++ b/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let enable_disable_swap_pair_should_succeed_if_user_is_admin = diff --git a/batcher/test/endpoints/maintenance/test_tick.mligo b/batcher/test/batcher/endpoints/maintenance/test_tick.mligo similarity index 88% rename from batcher/test/endpoints/maintenance/test_tick.mligo rename to batcher/test/batcher/endpoints/maintenance/test_tick.mligo index 5cd64397..4fe5ac39 100644 --- a/batcher/test/endpoints/maintenance/test_tick.mligo +++ b/batcher/test/batcher/endpoints/maintenance/test_tick.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "../../../../batcher.mligo" "Batcher" let pair = "tzBTC/USDT" let oraclepair = "BTC-USDT" diff --git a/batcher/test/endpoints/user/test_cancellations.mligo b/batcher/test/batcher/endpoints/user/test_cancellations.mligo similarity index 96% rename from batcher/test/endpoints/user/test_cancellations.mligo rename to batcher/test/batcher/endpoints/user/test_cancellations.mligo index 44b07308..6163f3b7 100644 --- a/batcher/test/endpoints/user/test_cancellations.mligo +++ b/batcher/test/batcher/endpoints/user/test_cancellations.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "./../../common/batch.mligo" "Batch" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "./../../../common/batch.mligo" "Batch" +#import "../../../../batcher.mligo" "Batcher" type skew = Batch.skew type pressure = Batch.pressure diff --git a/batcher/test/endpoints/user/test_deposits.mligo b/batcher/test/batcher/endpoints/user/test_deposits.mligo similarity index 96% rename from batcher/test/endpoints/user/test_deposits.mligo rename to batcher/test/batcher/endpoints/user/test_deposits.mligo index 42f44613..ba788bb7 100644 --- a/batcher/test/endpoints/user/test_deposits.mligo +++ b/batcher/test/batcher/endpoints/user/test_deposits.mligo @@ -1,7 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/helpers.mligo" "Helpers" -#import "./../../common/batch.mligo" "Batch" -#import "../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" +#import "./../../../common/batch.mligo" "Batch" +#import "../../../../batcher.mligo" "Batcher" type skew = Batch.skew type pressure = Batch.pressure diff --git a/batcher/test/endpoints/user/test_redemptions.mligo b/batcher/test/batcher/endpoints/user/test_redemptions.mligo similarity index 86% rename from batcher/test/endpoints/user/test_redemptions.mligo rename to batcher/test/batcher/endpoints/user/test_redemptions.mligo index 0c7590a6..d0e0c2df 100644 --- a/batcher/test/endpoints/user/test_redemptions.mligo +++ b/batcher/test/batcher/endpoints/user/test_redemptions.mligo @@ -1,8 +1,8 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./../../common/utils.mligo" "Utils" -#import "./../../common/batch.mligo" "Batch" -#import "../../../batcher.mligo" "Batcher" -#import "./../../common/helpers.mligo" "Helpers" +#import "./../../../common/utils.mligo" "Utils" +#import "./../../../common/batch.mligo" "Batch" +#import "../../../../batcher.mligo" "Batcher" +#import "./../../../common/helpers.mligo" "Helpers" let test_redemption_should_be_successful = diff --git a/batcher/test/test_contract.mligo b/batcher/test/batcher/test_contract.mligo similarity index 100% rename from batcher/test/test_contract.mligo rename to batcher/test/batcher/test_contract.mligo diff --git a/batcher/test/test-batcher.mligo b/batcher/test/test-batcher.mligo new file mode 100644 index 00000000..ef0a0a20 --- /dev/null +++ b/batcher/test/test-batcher.mligo @@ -0,0 +1,61 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./common/helpers.mligo" "Helpers" +#import "./batcher/endpoints/user/test_deposits.mligo" "User_Deposits" +#import "./batcher/endpoints/user/test_cancellations.mligo" "User_Cancellations" +#import "./batcher/endpoints/user/test_redemptions.mligo" "User_Redemptions" +#import "./batcher/economics/test_clearing.mligo" "Economics_Clearing" +#import "./batcher/endpoints/admin/test_change_fee.mligo" "Admin_Change_Fee" +#import "./batcher/endpoints/admin/test_change_admin_address.mligo" "Admin_Change_Admin_Address" +#import "./batcher/endpoints/admin/test_change_fee_recipient_address.mligo" "Admin_Change_Fee_Recipient_Address" +#import "./batcher/endpoints/admin/test_change_deposit_time_window.mligo" "Admin_Change_Deposit_Time_Window" +#import "./batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo" "Admin_Enable_Disable_Swap_Pair" +#import "./batcher/endpoints/admin/test_add_update_remove_metadata.mligo" "Admin_Add_Update_Remove_Metadata" +#import "./batcher/endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" +#import "./batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" +#import "./batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" +#import "./batcher/endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" +#import "./batcher/economics/test_clearing.mligo" "Economics_Clearing" + + +let contract_can_be_originated = + Breath.Model.case + "test contract" + "can be originated" + (fun (level: Breath.Logger.level) -> + let () = Breath.Logger.log level "Originate Batcher contract" in + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in + let batcher_storage = Breath.Contract.storage_of contracts.batcher in + let batcher_balance = Breath.Contract.balance_of contracts.batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "balance" batcher_balance 0tez + ; Helpers.expect_last_order_number batcher_storage 0n + ]) + + +let test_suite = + Breath.Model.suite "Suite for Contract" [ + contract_can_be_originated + ] + +let () = + Breath.Model.run_suites Void + [ + test_suite + (* ; Admin_Change_Fee.test_suite + ; Admin_Change_Admin_Address.test_suite + ; Admin_Change_Fee_Recipient_Address.test_suite + ; Admin_Change_Deposit_Time_Window.test_suite + ; Admin_Enable_Disable_Swap_Pair.test_suite + ; Admin_Amend_Token_pair_Limit.test_suite + ; Admin_Add_Update_Remove_Metadata.test_suite + ; Admin_Change_Oracle_Source_Of_Pair.test_suite + ; Admin_Add_Remove_Token_Swap_Pair.test_suite + ; Maintenance_Tick.test_suite + ; Economics_Clearing.test_suite *) + ; User_Deposits.test_suite + ; User_Cancellations.test_suite +// ; User_Redemptions.test_suite + ] + diff --git a/batcher/test/test-market-maker.mligo b/batcher/test/test-market-maker.mligo new file mode 100644 index 00000000..941fb98c --- /dev/null +++ b/batcher/test/test-market-maker.mligo @@ -0,0 +1,38 @@ +#import "ligo-breathalyzer/lib/lib.mligo" "Breath" +#import "./common/helpers.mligo" "Helpers" +#import "./market_maker/test_add_update_liquidity.mligo" "Market_Maker_Add_Update_Liquidity" +#import "./market_maker/test_claim_rewards.mligo" "Market_Maker_Claim_Rewards" +#import "./market_maker/test_remove_liquidity.mligo" "Market_Maker_Remove_Liquidity" + + +let contract_can_be_originated = + Breath.Model.case + "test contract" + "can be originated" + (fun (level: Breath.Logger.level) -> + let () = Breath.Logger.log level "Originate Batcher contract" in + let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in + let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in + let batcher_storage = Breath.Contract.storage_of contracts.batcher in + let batcher_balance = Breath.Contract.balance_of contracts.batcher in + + Breath.Result.reduce [ + Breath.Assert.is_equal "balance" batcher_balance 0tez + ; Helpers.expect_last_order_number batcher_storage 0n + ]) + + +let test_suite = + Breath.Model.suite "Suite for Contract" [ + contract_can_be_originated + ] + +let () = + Breath.Model.run_suites Void + [ + test_suite + ; Market_Maker_Add_Update_Liquidity.test_suite + ; Market_Maker_Claim_Rewards.test_suite + ; Market_Maker_Remove_Liquidity.test_suite + ] + diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo deleted file mode 100644 index 6df06cb0..00000000 --- a/batcher/test/test.mligo +++ /dev/null @@ -1,67 +0,0 @@ -#import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./common/helpers.mligo" "Helpers" -#import "./endpoints/user/test_deposits.mligo" "User_Deposits" -#import "./endpoints/user/test_cancellations.mligo" "User_Cancellations" -#import "./endpoints/user/test_redemptions.mligo" "User_Redemptions" -#import "./economics/test_clearing.mligo" "Economics_Clearing" -#import "./endpoints/admin/test_change_fee.mligo" "Admin_Change_Fee" -#import "./endpoints/admin/test_change_admin_address.mligo" "Admin_Change_Admin_Address" -#import "./endpoints/admin/test_change_fee_recipient_address.mligo" "Admin_Change_Fee_Recipient_Address" -#import "./endpoints/admin/test_change_deposit_time_window.mligo" "Admin_Change_Deposit_Time_Window" -#import "./endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo" "Admin_Enable_Disable_Swap_Pair" -#import "./endpoints/admin/test_add_update_remove_metadata.mligo" "Admin_Add_Update_Remove_Metadata" -#import "./endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" -#import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" -#import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" -#import "./market_maker/test_add_update_liquidity.mligo" "Market_Maker_Add_Update_Liquidity" -#import "./market_maker/test_claim_rewards.mligo" "Market_Maker_Claim_Rewards" -#import "./market_maker/test_remove_liquidity.mligo" "Market_Maker_Remove_Liquidity" -#import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" -#import "./economics/test_clearing.mligo" "Economics_Clearing" - - -let contract_can_be_originated = - Breath.Model.case - "test contract" - "can be originated" - (fun (level: Breath.Logger.level) -> - let () = Breath.Logger.log level "Originate Batcher contract" in - let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in - let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in - let batcher_storage = Breath.Contract.storage_of contracts.batcher in - let batcher_balance = Breath.Contract.balance_of contracts.batcher in - - Breath.Result.reduce [ - Breath.Assert.is_equal "balance" batcher_balance 0tez - ; Helpers.expect_last_order_number batcher_storage 0n - ]) - - -let test_suite = - Breath.Model.suite "Suite for Contract" [ - contract_can_be_originated - ] - -let () = - Breath.Model.run_suites Void - [ - test_suite - (* ; Admin_Change_Fee.test_suite - ; Admin_Change_Admin_Address.test_suite - ; Admin_Change_Fee_Recipient_Address.test_suite - ; Admin_Change_Deposit_Time_Window.test_suite - ; Admin_Enable_Disable_Swap_Pair.test_suite - ; Admin_Amend_Token_pair_Limit.test_suite - ; Admin_Add_Update_Remove_Metadata.test_suite - ; Admin_Change_Oracle_Source_Of_Pair.test_suite - ; Admin_Add_Remove_Token_Swap_Pair.test_suite - ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite *) - ; User_Deposits.test_suite - ; User_Cancellations.test_suite -// ; User_Redemptions.test_suite - ; Market_Maker_Add_Update_Liquidity.test_suite - ; Market_Maker_Claim_Rewards.test_suite - ; Market_Maker_Remove_Liquidity.test_suite - ] - From 7d5f7c37f980bf22f2ef3dc83e841dc1dc888691 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Thu, 7 Sep 2023 21:48:04 +0400 Subject: [PATCH 087/108] Split out mm contract from Batcher and pulled out common code into shared files --- batcher/batcher-ghostnet.tz | 4587 +++++++++++++++++ batcher/batcher-storage-ghostnet.tz | 14 + batcher/batcher.mligo | 916 +--- batcher/constants.mligo | 30 + batcher/errors.mligo | 58 + batcher/marketmaker.mligo | 212 +- batcher/package.json | 5 +- .../storage/initial_storage_ghostnet.mligo | 6 - batcher/storage/initial_storage_mainnet.mligo | 6 - ...igo => marketmaker_storage_ghostnet.mligo} | 4 +- .../storage/marketmaker_storage_mainnet.mligo | 59 + batcher/test/test.mligo | 67 - batcher/types.mligo | 145 +- batcher/utils.mligo | 566 ++ 14 files changed, 5633 insertions(+), 1042 deletions(-) create mode 100644 batcher/batcher-ghostnet.tz create mode 100644 batcher/batcher-storage-ghostnet.tz create mode 100644 batcher/constants.mligo create mode 100644 batcher/errors.mligo rename batcher/storage/{marketmaker_storage.ghostnet.mligo => marketmaker_storage_ghostnet.mligo} (95%) create mode 100644 batcher/storage/marketmaker_storage_mainnet.mligo delete mode 100644 batcher/test/test.mligo diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz new file mode 100644 index 00000000..f50766f3 --- /dev/null +++ b/batcher/batcher-ghostnet.tz @@ -0,0 +1,4587 @@ +{ parameter + (or (or (or (or (pair %add_or_update_metadata (string %key) (bytes %value)) + (pair %add_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + (or (nat %amend_token_and_pair_limit) (pair %cancel string string))) + (or (or (address %change_admin_address) (nat %change_deposit_time_window)) + (or (mutez %change_fee) (address %change_fee_recipient_address)))) + (or (or (or (pair %change_oracle_source_of_pair + (string %pair_name) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision)) + (pair %deposit + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (timestamp %created_at) + (nat %side) + (nat %tolerance))) + (or (string %disable_swap_pair_for_deposit) (string %enable_swap_pair_for_deposit))) + (or (or (unit %redeem) (string %remove_metadata)) + (or (pair %remove_token_swap_pair + (pair %swap + (pair %from + (pair %token + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)) + (nat %amount)) + (pair %to + (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits)) + (string %tick))))) ; + storage + (pair (pair (pair (pair (address %administrator) + (pair %batch_set + (map %current_batch_indices string nat) + (big_map %batches + nat + (pair (nat %batch_number) + (or %status + (or (pair %cleared + (pair (timestamp %at) + (pair %clearing + (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) + (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) + (pair %total_cleared_volumes + (nat %buy_side_total_cleared_volume) + (nat %buy_side_volume_subject_to_clearing) + (nat %sell_side_total_cleared_volume) + (nat %sell_side_volume_subject_to_clearing)) + (pair %clearing_rate + (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when)))) + (pair %rate + (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (pair %closed (timestamp %closing_time) (timestamp %start_time))) + (timestamp %open)) + (pair %volumes + (nat %buy_minus_volume) + (nat %buy_exact_volume) + (nat %buy_plus_volume) + (nat %buy_total_volume) + (nat %sell_minus_volume) + (nat %sell_exact_volume) + (nat %sell_plus_volume) + (nat %sell_total_volume)) + (pair %pair string string) + (nat %holdings) + (option %market_vault_used (or (unit %buy) (unit %sell))))))) + (nat %deposit_time_window_in_seconds) + (mutez %fee_in_mutez)) + (pair (address %fee_recipient) (nat %last_order_number)) + (nat %limit_on_tokens_or_pairs) + (big_map %metadata string bytes)) + (pair (big_map %rates_current + string + (pair (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (big_map %user_batch_ordertypes + address + (map nat + (map (pair (or %side (unit %buy) (unit %sell)) + (or %tolerance (or (unit %exact) (unit %minus)) (unit %plus))) + nat)))) + (map %valid_swaps + string + (pair (pair %swap (string %from) (string %to)) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + (map %valid_tokens + string + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string)))) ; + code { LAMBDA + (pair nat nat) + nat + { UNPAIR ; + PUSH nat 1 ; + DUG 2 ; + PAIR ; + PAIR ; + LEFT nat ; + LOOP_LEFT + { UNPAIR ; + UNPAIR ; + PUSH nat 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; RIGHT (pair (pair nat nat) nat) } + { PUSH nat 1 ; + PUSH nat 1 ; + DUP 4 ; + AND ; + COMPARE ; + EQ ; + IF { DUP ; DIG 3 ; MUL } { DIG 2 } ; + PUSH nat 1 ; + DIG 3 ; + LSR ; + DUP 3 ; + DIG 3 ; + MUL ; + PAIR ; + PAIR ; + LEFT nat } } } ; + PUSH int 1 ; + PUSH int 10000 ; + PAIR ; + PUSH int 1 ; + PUSH int 10001 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + LAMBDA + (pair int int) + int + { UNPAIR ; + SWAP ; + PUSH int 1 ; + PAIR ; + LEFT int ; + LOOP_LEFT + { UNPAIR ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { SWAP ; DROP ; RIGHT (pair int int) } + { PUSH int 1 ; DIG 2 ; SUB ; DUP 3 ; DIG 2 ; MUL ; PAIR ; LEFT int } } ; + SWAP ; + DROP } ; + LAMBDA + (pair (pair (pair nat string (option address) nat (option string)) nat) + (map string (pair (pair nat string (option address) nat (option string)) nat))) + (map string (pair (pair nat string (option address) nat (option string)) nat)) + { UNPAIR ; + SWAP ; + UNIT ; + RIGHT unit ; + DIG 2 ; + DUP ; + CAR ; + GET 3 ; + DUP 4 ; + DUP 2 ; + GET ; + IF_NONE + { DIG 2 ; DROP ; SWAP ; SOME ; SWAP ; UPDATE } + { DIG 3 ; + IF_LEFT + { DROP ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + COMPARE ; + GT ; + IF { DROP ; PUSH nat 111 ; FAILWITH } + { DUP 3 ; CDR ; SWAP ; CDR ; SUB ; ABS } } + { DROP ; CDR ; DUP 3 ; CDR ; ADD } ; + DIG 3 ; + DIG 3 ; + DIG 2 ; + UPDATE 2 ; + SOME ; + DIG 2 ; + UPDATE } } ; + DIG 4 ; + UNPAIR ; + IF_LEFT + { DIG 3 ; + DIG 4 ; + DIG 5 ; + DROP 3 ; + IF_LEFT + { IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DUP 6 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CAR ; + GET ; + IF_NONE + { DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CDR ; + DIG 6 ; + CAR ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DROP ; + DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DUP 6 ; + CDR ; + SOME ; + DIG 6 ; + CAR ; + UPDATE } ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + PAIR } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 6 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + CAR ; + CDR ; + GET 7 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 134 ; FAILWITH } + { PUSH nat 6 ; + DUP 2 ; + GET 7 ; + COMPARE ; + NEQ ; + IF { DROP 2 ; PUSH nat 133 ; FAILWITH } + { DUP 2 ; + CDR ; + CDR ; + CDR ; + DUP 3 ; + CDR ; + CDR ; + CAR ; + DUP 3 ; + CAR ; + DUP ; + CAR ; + CAR ; + DUP 2 ; + CDR ; + DUP 7 ; + CAR ; + CDR ; + CDR ; + CAR ; + DUP ; + PUSH nat 1 ; + DUP 7 ; + SIZE ; + ADD ; + COMPARE ; + GT ; + IF { DROP ; PUSH nat 127 ; FAILWITH } + { PUSH bool False ; + DUP 7 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 8 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + AND ; + IF { PUSH nat 0 } + { PUSH bool False ; + DUP 7 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + PUSH bool False ; + DUP 8 ; + ITER { CDR ; + SWAP ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR } ; + OR ; + IF { PUSH nat 1 } { PUSH nat 2 } } ; + DUP 7 ; + SIZE ; + ADD ; + COMPARE ; + GT ; + IF { PUSH nat 126 ; FAILWITH } {} } ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 4 ; + DUP 2 ; + CAR ; + DIG 2 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DIG 3 ; DUP 3 ; DIG 3 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 2 } { DIG 2 ; DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DUP 2 ; DIG 2 ; GET 3 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF {} { DROP ; PUSH nat 115 ; FAILWITH } } ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DIG 2 ; + DUP 4 ; + GET 8 ; + DUP 5 ; + GET 7 ; + DUP 6 ; + GET 5 ; + DUP 7 ; + GET 3 ; + DIG 7 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP 3 ; + CAR ; + DIG 3 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + PAIR } + { DROP 6 ; PUSH nat 116 ; FAILWITH } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } } } } } + { IF_LEFT + { DIG 2 ; + DROP ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CDR ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 128 ; FAILWITH } + { DUP 2 ; + CDR ; + CDR ; + CAR ; + SIZE ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 129 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SENDER ; + DUP 2 ; + UNPAIR ; + DUP 5 ; + CDR ; + CDR ; + CAR ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 117 ; FAILWITH } + { DUP 4 ; + CDR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + NOW ; + DUP 7 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP ; + CDR ; + DUP 2 ; + CAR ; + DUP 9 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DIG 9 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 7 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP 9 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET 3 ; + IF_LEFT + { SWAP ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DIG 9 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DUP 7 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 8 ; DROP 3 ; DUP 7 ; DIG 2 } } + { DIG 9 ; + DROP ; + DUP 2 ; + INT ; + ADD ; + DIG 4 ; + COMPARE ; + GE ; + IF { DUP 2 ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DROP 2 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { SWAP ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 7 ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DROP ; DUP 7 ; DIG 2 } } } ; + DIG 2 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + NOT ; + IF { PUSH nat 140 ; FAILWITH } {} ; + DIG 7 ; + CDR ; + CAR ; + CDR ; + DUP 8 ; + GET ; + IF_NONE + { DROP 8 ; PUSH nat 139 ; FAILWITH } + { DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 139 ; FAILWITH } + { DUP 6 ; + DUP 7 ; + CDR ; + DUP ; + CAR ; + DIG 8 ; + CDR ; + CAR ; + CDR ; + DIG 6 ; + DIG 6 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; + UPDATE ; + SOME ; + DUP 12 ; + UPDATE ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + GET 5 ; + DUP 2 ; + ITER { UNPAIR ; + UNPAIR ; + IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + SUB ; + ABS ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 3 ; + SUB ; + ABS ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + CAR ; + SUB ; + ABS ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 5 ; + SUB ; + ABS ; + UPDATE 5 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 14 ; + SUB ; + ABS ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 11 ; + SUB ; + ABS ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 9 ; + SUB ; + ABS ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } + { DROP ; + DUP 3 ; + DIG 2 ; + DIG 3 ; + GET 13 ; + SUB ; + ABS ; + UPDATE 13 ; + SWAP ; + UPDATE 14 } } } ; + PUSH nat 1 ; + DUP 5 ; + GET 9 ; + SUB ; + ABS ; + DIG 4 ; + DIG 2 ; + UPDATE 5 ; + SWAP ; + UPDATE 9 ; + DUP 3 ; + DIG 3 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 7 ; + DIG 7 ; + CDR ; + DUP 7 ; + SOME ; + DIG 7 ; + CAR ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP 5 ; + GET 8 ; + DUP 6 ; + GET 7 ; + DUP 7 ; + GET 5 ; + DIG 7 ; + GET 3 ; + DIG 6 ; + PUSH nat 1 ; + DIG 8 ; + PAIR ; + PAIR ; + PAIR 5 ; + PUSH mutez 0 ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + PAIR ; + DIG 3 ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 3 ; + DIG 3 ; + CAR ; + IF_LEFT { DROP ; DUP 4 ; CAR ; CAR ; CAR } { DROP ; DUP 4 ; CAR ; CDR } ; + PAIR ; + PAIR ; + DUP 6 ; + SWAP ; + EXEC ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CDR ; + DIG 2 ; + ADD ; + SWAP ; + PAIR } ; + SWAP ; + DIG 4 ; + DROP 2 ; + UNPAIR ; + SELF_ADDRESS ; + NIL operation ; + DIG 2 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 8 ; + DUP 6 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 11 ; + PAIR 3 ; + CONS ; + DUP 6 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + SWAP ; + DIG 4 ; + DROP 2 ; + PUSH mutez 0 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CDR ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { SWAP ; DROP } ; + PAIR } } } } } + { DIG 2 ; + DROP ; + IF_LEFT + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CAR ; + CDR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + PUSH nat 600 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 2 ; PUSH nat 131 ; FAILWITH } + { PUSH nat 3600 ; + DUP 2 ; + COMPARE ; + GT ; + IF { DROP 2 ; PUSH nat 132 ; FAILWITH } + { DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + NIL operation ; + PAIR } } } } + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CDR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + DUP 2 ; + COMPARE ; + EQ ; + IF { PUSH nat 144 ; FAILWITH } {} ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } + { IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + DROP 4 ; + IF_LEFT + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 3 ; + DUP 2 ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 123 ; FAILWITH } { DROP } ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + CDR ; + CDR ; + CAR ; + DIG 4 ; + DUP 6 ; + GET 3 ; + UPDATE 3 ; + DUP 6 ; + GET 5 ; + UPDATE 5 ; + DUP 6 ; + GET 6 ; + UPDATE 7 ; + SOME ; + DIG 5 ; + CAR ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } + { DUP ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 2 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + SWAP ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + NOW ; + DUP 4 ; + CDR ; + CDR ; + CAR ; + DUP 3 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 8 ; + IF { DROP 5 ; PUSH nat 125 ; FAILWITH } + { DUP 4 ; + CAR ; + PUSH nat 0 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + IF { SWAP ; + CAR ; + CAR ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + COMPARE ; + EQ ; + IF {} { PUSH nat 156 ; FAILWITH } } + { SWAP ; + CAR ; + CDR ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + COMPARE ; + EQ ; + IF {} { PUSH nat 156 ; FAILWITH } } ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CDR ; + AMOUNT ; + DUP 2 ; + DUP 2 ; + COMPARE ; + LT ; + IF { DROP 6 ; PUSH nat 113 ; FAILWITH } + { COMPARE ; + GT ; + IF { DROP 4 ; PUSH nat 130 ; FAILWITH } + { DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP ; + CDR ; + DUP 2 ; + CAR ; + DUP 5 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DUP 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DIG 4 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DUP 6 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + GET 3 ; + IF_LEFT + { SWAP ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DUP 6 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DIG 6 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DIG 4 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DROP 2 ; DIG 4 ; DIG 2 } } + { DUP 2 ; + INT ; + ADD ; + DIG 4 ; + COMPARE ; + GE ; + IF { DUP 2 ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DIG 6 ; + DROP 3 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { SWAP ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 ; + DIG 4 ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DROP ; DIG 4 ; DIG 2 } } } ; + DIG 2 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } ; + IF { DIG 3 ; DROP } + { DUP 3 ; + CDR ; + CDR ; + CAR ; + DIG 4 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 124 ; FAILWITH } {} ; + CAR ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } } ; + DUP 3 ; + DIG 3 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP 2 ; + CAR ; + PUSH nat 1 ; + DUP 3 ; + CAR ; + CDR ; + CAR ; + CDR ; + ADD ; + DUP 6 ; + GET 5 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + DUP 7 ; + GET 6 ; + PUSH nat 0 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; RIGHT unit ; LEFT unit } + { PUSH nat 1 ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; UNIT ; LEFT unit ; LEFT unit } + { PUSH nat 2 ; + SWAP ; + COMPARE ; + EQ ; + IF { UNIT ; RIGHT (or unit unit) } { PUSH nat 107 ; FAILWITH } } } ; + SENDER ; + DUP 6 ; + CDR ; + CDR ; + CDR ; + DUP 10 ; + CAR ; + DUP ; + CAR ; + CAR ; + DUP 2 ; + CDR ; + DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DIG 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { DROP 4 ; PUSH nat 110 ; FAILWITH } + { DUP ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 2 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 4 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 2 ; + GET 8 ; + DUP 4 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 5 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 7 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DIG 6 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + AND ; + IF { DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DUP 7 ; + CDR ; + CDR ; + CAR ; + DUP 5 ; + IF_LEFT { DROP ; SWAP } { DROP ; DUP 2 ; CAR ; DIG 2 ; CDR ; PAIR } ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + MEM ; + IF {} { PUSH nat 110 ; FAILWITH } } + { DROP ; PUSH nat 110 ; FAILWITH } } } ; + PUSH bool False ; + DIG 2 ; + DIG 3 ; + DIG 9 ; + CAR ; + DIG 4 ; + DUP 7 ; + DUP 7 ; + PAIR 7 ; + DUP 4 ; + CDR ; + CAR ; + CDR ; + DUP 2 ; + GET 5 ; + GET ; + IF_NONE + { PUSH bool True } + { PUSH nat 0 ; + SWAP ; + ITER { CDR ; SIZE ; ADD } ; + PUSH nat 10 ; + SWAP ; + COMPARE ; + LE } ; + IF { DUP 5 ; + GET 5 ; + DUP 2 ; + GET 9 ; + IF_LEFT + { DROP ; + DUP 2 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 7 ; + ADD ; + DUP 3 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 3 ; + ADD ; + UPDATE 3 ; + SWAP ; + UPDATE 7 } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + CAR ; + ADD ; + UPDATE 1 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 5 ; + ADD ; + UPDATE 5 ; + SWAP ; + UPDATE 7 } } + { DROP ; + DUP 2 ; + GET 7 ; + CAR ; + CDR ; + DUP 2 ; + GET 14 ; + ADD ; + DUP 3 ; + GET 11 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 11 ; + ADD ; + UPDATE 11 ; + SWAP ; + UPDATE 14 } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 9 ; + ADD ; + UPDATE 9 ; + SWAP ; + UPDATE 14 } } + { DROP ; + DUP 2 ; + DUP 4 ; + GET 7 ; + CAR ; + CDR ; + DIG 3 ; + GET 13 ; + ADD ; + UPDATE 13 ; + SWAP ; + UPDATE 14 } } ; + DIG 5 ; + SWAP ; + UPDATE 5 ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + DUP 3 ; + GET 5 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + SWAP ; + SOME ; + DUP 5 ; + UPDATE ; + DUP ; + DUP 5 ; + GET ; + IF_NONE + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } + { DUP 5 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + SWAP ; + SOME ; + DUP 5 ; + UPDATE ; + DUP ; + DUP 5 ; + GET ; + IF_NONE + { DROP ; PUSH nat 142 ; FAILWITH } + { PUSH nat 1 ; DUP 2 ; GET 9 ; ADD ; UPDATE 9 ; SOME ; DUP 5 ; UPDATE } } + { DROP ; DUP 6 ; CDR ; SWAP ; SOME ; DUP 5 ; UPDATE } } ; + DUP 2 ; + GET 5 ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + DUP 2 ; + GET ; + IF_NONE + { DUP 6 ; + CDR ; + CAR ; + CDR ; + EMPTY_MAP nat (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 6 ; + GET 7 ; + CAR ; + CDR ; + DUP 7 ; + GET 11 ; + DUP 8 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 7 ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 2 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP ; + DUP 7 ; + GET ; + IF_NONE + { EMPTY_MAP (pair (or unit unit) (or (or unit unit) unit)) nat ; + DUP 5 ; + GET 7 ; + CAR ; + CDR ; + DUP 6 ; + GET 11 ; + DUP 7 ; + GET 9 ; + PAIR ; + SWAP ; + SOME ; + SWAP ; + UPDATE ; + DIG 6 ; + SWAP ; + SOME ; + SWAP ; + UPDATE } + { DUP 5 ; + GET 11 ; + DUP 6 ; + GET 9 ; + PAIR ; + DUP 2 ; + DUP 2 ; + GET ; + IF_NONE + { SWAP ; DUP 6 ; GET 7 ; CAR ; CDR ; DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } + { DUP 7 ; GET 7 ; CAR ; CDR ; ADD ; DIG 2 ; SWAP ; SOME ; DIG 2 ; UPDATE } ; + SOME ; + DIG 6 ; + UPDATE } ; + DUP 6 ; + CDR ; + CAR ; + CDR ; + SWAP ; + SOME ; + DIG 2 ; + UPDATE } ; + SELF_ADDRESS ; + DUP 4 ; + GET 7 ; + CAR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { SWAP ; DIG 4 ; DROP 3 ; PUSH nat 109 ; FAILWITH } + { DIG 5 ; + GET 5 ; + DUP 3 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 4 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + SWAP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 3 ; + CDR ; + DIG 4 ; + DIG 4 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { SWAP ; + CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 6 ; + CDR ; + DIG 6 ; + CAR ; + CAR ; + DIG 7 ; + PAIR 3 ; + CONS ; + DIG 4 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 4 ; PUSH nat 108 ; FAILWITH } } } } ; + DUP 5 ; + DIG 5 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 8 ; + DIG 7 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + DUP ; + CAR ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 ; + DUP ; + CDR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + NIL operation ; + DIG 2 ; + CONS ; + PAIR } + { DROP 6 ; PUSH nat 112 ; FAILWITH } } + { DROP 5 ; PUSH nat 103 ; FAILWITH } } } } } } + { IF_LEFT + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + CDR ; + CDR ; + CAR ; + DIG 4 ; + PUSH bool True ; + UPDATE 8 ; + SOME ; + DIG 5 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 } + { DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + CDR ; + CDR ; + CAR ; + DIG 4 ; + PUSH bool False ; + UPDATE 8 ; + SOME ; + DIG 5 ; + UPDATE ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 } ; + NIL operation ; + PAIR } } + { IF_LEFT + { DIG 3 ; + DIG 4 ; + DROP 2 ; + IF_LEFT + { DROP ; + SENDER ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + SELF_ADDRESS ; + PUSH mutez 0 ; + PUSH mutez 0 ; + PAIR ; + DUP 4 ; + CAR ; + CDR ; + CAR ; + CAR ; + DUP 4 ; + PAIR ; + PAIR ; + DUP 4 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 5 ; + CDR ; + CAR ; + CDR ; + EMPTY_MAP string (pair (pair nat string (option address) nat (option string)) nat) ; + DUP 2 ; + DUP 7 ; + GET ; + IF_NONE + { DIG 7 ; DIG 8 ; DROP 2 ; DIG 2 ; PAIR ; SWAP } + { DUP 8 ; + CAR ; + CAR ; + CDR ; + CDR ; + DIG 5 ; + PAIR ; + DUP 8 ; + CDR ; + CDR ; + CDR ; + DIG 5 ; + PAIR ; + DIG 3 ; + DUP 4 ; + PAIR ; + PAIR ; + PAIR ; + SWAP ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 4 ; + UNPAIR ; + DUP 3 ; + CDR ; + DUP ; + DUP 9 ; + GET ; + IF_NONE + { DIG 7 ; DIG 8 ; DROP 3 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { CAR ; CDR ; SOME } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp)) } } + { DROP ; + NONE (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp)) } ; + IF_NONE + { SWAP ; DIG 8 ; DIG 9 ; DROP 4 ; PAIR ; DUG 2 ; PAIR ; DIG 3 ; DIG 3 } + { DUP 5 ; + DIG 4 ; + PAIR ; + DUP 7 ; + DUP 4 ; + GET 5 ; + PAIR ; + DIG 9 ; + DIG 3 ; + PAIR ; + PAIR ; + PAIR ; + DIG 8 ; + ITER { UNPAIR ; + DIG 2 ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + UNPAIR ; + DIG 4 ; + UNPAIR ; + PUSH nat 0 ; + DUP 4 ; + GET 7 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { PUSH nat 0 ; + DUP 4 ; + GET 14 ; + COMPARE ; + EQ ; + IF { PUSH bool False } + { DUP 7 ; + CDR ; + DUP 6 ; + GET 3 ; + DUP 9 ; + CAR ; + IF_LEFT + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool False } } + { DROP ; PUSH bool True } } } + { DROP ; + SWAP ; + IF_LEFT + { IF_LEFT + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool False } { DROP ; PUSH bool True } } + { DROP ; PUSH bool False } } } + { DROP ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool True } } + { DROP ; PUSH bool True } } } } } ; + IF { DUP 5 ; + GET 6 ; + CAR ; + DUP 5 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 6 ; + DIG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 8 ; + CAR ; + IF_LEFT + { DROP ; + DUP 7 ; + GET 5 ; + DUP ; + GET 5 ; + INT ; + SWAP ; + GET 3 ; + INT ; + DIG 10 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + GET 6 ; + GET 3 ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 25 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 23 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } + { DROP ; + DUP 7 ; + GET 5 ; + DUP ; + CAR ; + INT ; + SWAP ; + GET 6 ; + INT ; + DIG 10 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP ; + CAR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + GET 6 ; + GET 3 ; + DUP ; + CDR ; + DUP 3 ; + CDR ; + MUL ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + MUL ; + PAIR ; + DUP ; + CDR ; + DUP 4 ; + CDR ; + MUL ; + DUP 4 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + DIG 2 ; + CDR ; + DIG 4 ; + CAR ; + MUL ; + SUB ; + PAIR ; + PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 25 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 3 ; + PAIR ; + PUSH nat 0 ; + DUP 2 ; + CDR ; + COMPARE ; + GT ; + IF { DIG 8 ; SWAP ; PAIR ; DUP 20 ; SWAP ; EXEC } { DROP ; DIG 7 } ; + PUSH int 1 ; + PUSH int 0 ; + PAIR ; + DUP ; + CAR ; + DUP 4 ; + CDR ; + MUL ; + SWAP ; + CDR ; + DUP 4 ; + CAR ; + MUL ; + COMPARE ; + LE ; + NOT ; + IF { PUSH int 0 ; + DUP 3 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 3 ; CDR ; MUL ; PUSH int -1 ; DIG 3 ; CAR ; MUL ; PAIR } + { SWAP } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 23 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 2 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } + { SWAP ; DIG 2 ; DROP 2 } } ; + DUP 3 ; + DUP 3 ; + CDR ; + CDR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 2 ; + UPDATE 2 ; + SWAP } + { DUP 5 ; + GET 6 ; + CAR ; + DIG 7 ; + CAR ; + IF_LEFT + { DROP ; + DUP 5 ; + SWAP ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } + { DROP ; + DUP 5 ; + SWAP ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} } ; + DUP 3 ; + DUP 3 ; + CDR ; + CAR ; + ADD ; + DUP 3 ; + DIG 3 ; + CDR ; + DIG 2 ; + UPDATE 1 ; + UPDATE 2 ; + DIG 6 ; + DIG 7 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 18 ; + SWAP ; + EXEC } ; + DUG 2 ; + PAIR ; + DIG 3 ; + DIG 3 ; + PAIR ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + PAIR } ; + UNPAIR ; + CAR ; + CDR ; + SWAP ; + CAR ; + DUP 3 ; + CAR ; + DUP 5 ; + DUP 2 ; + GET ; + IF_NONE + { DIG 4 ; DROP 2 ; PUSH nat 141 ; FAILWITH } + { PUSH nat 1 ; + DUP 2 ; + GET 9 ; + SUB ; + ABS ; + DIG 6 ; + DUG 2 ; + UPDATE 9 ; + SOME ; + DIG 2 ; + UPDATE } ; + DUP ; + DUP 5 ; + CAR ; + GET ; + IF_NONE + { PUSH nat 141 ; FAILWITH } + { PUSH nat 0 ; SWAP ; GET 9 ; COMPARE ; LE } ; + DIG 5 ; + DIG 3 ; + PAIR ; + DIG 6 ; + DIG 2 ; + IF { DIG 2 ; + DROP ; + DUP 5 ; + DIG 5 ; + CDR ; + DIG 5 ; + CAR ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + (option (or unit unit))) ; + SWAP ; + UPDATE ; + UPDATE 2 } + { DIG 4 ; DROP ; DIG 4 ; DIG 3 ; UPDATE 2 } ; + PAIR ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + NONE (map (pair (or unit unit) (or (or unit unit) unit)) nat) ; + SWAP ; + UPDATE } } ; + PAIR ; + PAIR ; + PAIR } ; + DIG 5 ; + DIG 6 ; + DROP 2 ; + UNPAIR ; + UNPAIR ; + UNPAIR ; + DIG 2 ; + CAR ; + DIG 3 ; + CAR ; + DIG 3 ; + DIG 2 ; + PAIR ; + DIG 3 ; + DIG 3 ; + SOME ; + DUP 6 ; + UPDATE } ; + DUG 2 ; + UNPAIR ; + NIL operation ; + DIG 2 ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE + { DROP ; PUSH nat 109 ; FAILWITH } + { DUP 2 ; + CAR ; + GET 8 ; + IF_NONE + { DROP 2 ; PUSH nat 108 ; FAILWITH } + { PUSH string "FA1.2 token" ; + DUP 2 ; + COMPARE ; + EQ ; + IF { DROP ; + CONTRACT %transfer (pair (address %from) (address %to) (nat %value)) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + DIG 2 ; + CDR ; + DUP 9 ; + DUP 9 ; + PAIR 3 ; + TRANSFER_TOKENS } + { PUSH string "FA2 token" ; + SWAP ; + COMPARE ; + EQ ; + IF { CONTRACT %transfer + (list (pair (address %from_) (list %tx (pair (address %to_) (nat %token_id) (nat %amount))))) ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PUSH mutez 0 ; + NIL (pair address (list (pair address nat nat))) ; + NIL (pair address nat nat) ; + DUP 5 ; + CDR ; + DIG 5 ; + CAR ; + CAR ; + DUP 12 ; + PAIR 3 ; + CONS ; + DUP 9 ; + PAIR ; + CONS ; + TRANSFER_TOKENS } + { DROP 2 ; PUSH nat 108 ; FAILWITH } } } } ; + CONS } ; + DIG 4 ; + DIG 5 ; + DROP 2 ; + PUSH mutez 0 ; + DUP 4 ; + CDR ; + CAR ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CAR ; + CONTRACT unit ; + IF_NONE + { PUSH nat 102 ; FAILWITH } + { DUP 4 ; CDR ; CAR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + {} ; + PUSH mutez 0 ; + DUP 4 ; + CDR ; + CDR ; + COMPARE ; + GT ; + IF { DUP 3 ; + CAR ; + CDR ; + CONTRACT unit ; + IF_NONE + { DIG 2 ; DROP ; PUSH nat 102 ; FAILWITH } + { DIG 3 ; CDR ; CDR ; UNIT ; TRANSFER_TOKENS } ; + CONS } + { DIG 2 ; DROP } ; + DUP 4 ; + DIG 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 2 ; + DUP ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 5 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 ; + SWAP } + { DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + DUP 3 ; + CAR ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 5 ; + CAR ; + CDR ; + CDR ; + CDR ; + DIG 5 ; + NONE bytes ; + SWAP ; + UPDATE ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 1 ; + NIL operation } ; + PAIR } + { DIG 2 ; + DROP ; + IF_LEFT + { DIG 2 ; + DIG 3 ; + DIG 4 ; + DROP 3 ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CAR ; + SENDER ; + COMPARE ; + EQ ; + IF {} { PUSH nat 114 ; FAILWITH } ; + PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP ; + GET 8 ; + IF {} { PUSH nat 137 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + SWAP ; + DUP 3 ; + DUP 3 ; + DUP 3 ; + COMPARE ; + GT ; + IF { DIG 2 ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; DIG 2 ; CONCAT } ; + GET ; + IF_NONE + { DROP 2 ; PUSH nat 117 ; FAILWITH } + { DROP ; + DUP 3 ; + CDR ; + CDR ; + CDR ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + DIG 2 ; + DUP 2 ; + CAR ; + DUP 3 ; + CDR ; + DUP 2 ; + DUP 2 ; + COMPARE ; + GT ; + IF { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + NONE (pair (pair string string) address string nat bool) ; + SWAP ; + UPDATE ; + DUP 3 ; + DUP 3 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 3 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 6 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 7 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP ; DIG 2 } + { DUP 4 ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP ; DIG 2 } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { DIG 3 ; + DIG 2 ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { SWAP ; DIG 3 ; DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + PUSH bool False ; + DUP 4 ; + ITER { CDR ; + CAR ; + DUP 3 ; + DUP 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 4 ; + DIG 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 2 ; + DUP 2 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 3 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 5 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + DUP 3 ; + GET 8 ; + DUP 6 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 7 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 8 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 9 ; + GET 3 ; + COMPARE ; + EQ ; + DIG 6 ; + CAR ; + DUP 9 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + OR ; + OR } ; + IF { SWAP ; DROP } + { DUP ; + DUP 3 ; + GET 3 ; + GET ; + IF_NONE + { SWAP ; DROP } + { DUP 3 ; + GET 8 ; + DUP 2 ; + GET 8 ; + COMPARE ; + EQ ; + DUP 4 ; + GET 7 ; + DUP 3 ; + GET 7 ; + COMPARE ; + EQ ; + DUP 5 ; + GET 5 ; + DUP 4 ; + GET 5 ; + COMPARE ; + EQ ; + DUP 6 ; + GET 3 ; + DUP 5 ; + GET 3 ; + COMPARE ; + EQ ; + DUP 7 ; + CAR ; + DIG 5 ; + CAR ; + COMPARE ; + EQ ; + AND ; + AND ; + AND ; + AND ; + IF { SWAP ; + GET 3 ; + NONE (pair nat string (option address) nat (option string)) ; + SWAP ; + UPDATE } + { DROP 2 ; PUSH nat 115 ; FAILWITH } } } ; + SWAP ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DIG 3 ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 2 ; + DUP ; + CDR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 2 ; + UPDATE 2 ; + UPDATE 2 ; + NIL operation ; + PAIR } + { PUSH mutez 1 ; + AMOUNT ; + COMPARE ; + LT ; + IF {} { PUSH nat 118 ; FAILWITH } ; + DUP 2 ; + CDR ; + CDR ; + CAR ; + DUP 2 ; + GET ; + IF_NONE + { DROP 5 ; PUSH nat 117 ; FAILWITH } + { DUP 3 ; + CDR ; + CDR ; + CDR ; + DUP 2 ; + CAR ; + DUP 2 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DUP 3 ; + GET 8 ; + DUP 4 ; + GET 7 ; + DUP 5 ; + GET 5 ; + DIG 5 ; + GET 3 ; + DIG 4 ; + PUSH nat 1 ; + DIG 6 ; + PAIR ; + PAIR ; + PAIR 5 ; + DUP ; + GET 8 ; + DUP 2 ; + GET 7 ; + DUP 3 ; + GET 5 ; + DUP 4 ; + GET 3 ; + DUP 5 ; + CAR ; + DUP ; + CDR ; + GET 3 ; + SWAP ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 5 ; + DUP ; + GET 3 ; + SWAP ; + GET 5 ; + VIEW "getPrice" (pair timestamp nat) ; + IF_NONE { PUSH nat 122 ; FAILWITH } {} ; + UNPAIR ; + DUP 5 ; + CDR ; + CAR ; + CAR ; + DUP 5 ; + GET ; + IF_NONE + {} + { DUP 2 ; + SWAP ; + GET 4 ; + COMPARE ; + GE ; + IF { PUSH nat 121 ; FAILWITH } {} } ; + DUP 5 ; + CAR ; + CAR ; + CDR ; + CAR ; + INT ; + DUP 2 ; + SWAP ; + NOW ; + SUB ; + COMPARE ; + LT ; + IF {} { PUSH nat 120 ; FAILWITH } ; + DUP 5 ; + CDR ; + CDR ; + CDR ; + DUP 4 ; + CAR ; + DIG 4 ; + GET 7 ; + DUP ; + DUP 3 ; + CAR ; + CAR ; + GET 7 ; + COMPARE ; + GT ; + IF { DUP 2 ; + CAR ; + CAR ; + GET 7 ; + SUB ; + PUSH int 10 ; + PAIR ; + DUP 8 ; + SWAP ; + EXEC ; + DIG 4 ; + MUL ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 2 ; + CAR ; + CAR ; + GET 7 ; + INT ; + PUSH int 10 ; + PAIR ; + DUP 8 ; + SWAP ; + EXEC ; + SWAP } + { INT ; PUSH int 10 ; PAIR ; DUP 8 ; SWAP ; EXEC ; DIG 4 } ; + INT ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DIG 3 ; + SWAP ; + DUP 3 ; + CDR ; + GET 3 ; + DIG 3 ; + CAR ; + CAR ; + GET 3 ; + PAIR ; + PAIR 3 ; + DUP ; + CAR ; + DUP 3 ; + DUP 2 ; + CAR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + DIG 3 ; + DIG 2 ; + CDR ; + GET ; + IF_NONE { PUSH nat 111 ; FAILWITH } {} ; + SWAP ; + GET 7 ; + SWAP ; + GET 7 ; + SUB ; + DUP ; + ABS ; + INT ; + PUSH int 10 ; + PAIR ; + DIG 5 ; + SWAP ; + EXEC ; + PUSH int 0 ; + DUP 3 ; + COMPARE ; + EQ ; + IF { DROP 2 ; PUSH int 1 ; PUSH int 1 } + { PUSH int 0 ; + DIG 2 ; + COMPARE ; + LT ; + IF { PUSH int 1 ; + SWAP ; + PAIR ; + PUSH int 1 ; + PUSH int 1 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL } + { PUSH int 1 ; SWAP } } ; + PAIR ; + DUP 2 ; + GET 3 ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + UPDATE 3 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP ; + DUP 7 ; + GET ; + IF_NONE + { DUP 5 ; DIG 6 ; SWAP ; SOME ; SWAP ; UPDATE } + { GET 4 ; + DUP 6 ; + GET 4 ; + COMPARE ; + GT ; + IF { DUP 5 ; SOME ; DIG 6 ; UPDATE } { DIG 5 ; DROP } } ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 ; + DUP 2 ; + CAR ; + UNIT ; + LEFT unit ; + IF_LEFT { DROP } { DROP ; DUP ; CAR ; SWAP ; CDR ; PAIR } ; + NOW ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + DUP 4 ; + CAR ; + CAR ; + CDR ; + CAR ; + DUP 2 ; + CDR ; + DUP 3 ; + CAR ; + DUP 6 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + GET ; + IF_NONE { PUSH nat 0 } {} ; + GET ; + IF_NONE + { DIG 3 ; + DROP 2 ; + DIG 2 ; + SWAP ; + NONE (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + (option (or unit unit))) } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; PUSH bool True } { DROP ; PUSH bool False } } + { DROP ; PUSH bool False } ; + IF { SWAP ; DIG 4 ; DROP 2 ; DIG 3 } + { DUP ; + GET 3 ; + IF_LEFT + { DIG 2 ; + DROP ; + IF_LEFT + { DROP 2 ; + PUSH nat 0 ; + DUP 2 ; + CAR ; + ITER { CDR ; DUP 2 ; DUP 2 ; COMPARE ; GT ; IF { SWAP ; DROP } { DROP } } ; + PUSH nat 1 ; + ADD ; + NONE (or unit unit) ; + PUSH nat 0 ; + DIG 5 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 8 ; + DUP 7 ; + RIGHT + (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) ; + DIG 5 ; + PAIR 6 ; + DIG 3 ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 4 ; DROP 2 ; DIG 3 ; DIG 2 } } + { DIG 5 ; + DROP ; + DUP 3 ; + INT ; + ADD ; + DUP 5 ; + COMPARE ; + GE ; + IF { DUP ; + GET 3 ; + IF_LEFT + { SWAP ; + DIG 2 ; + DIG 5 ; + DROP 3 ; + IF_LEFT + { DROP ; PUSH nat 105 ; FAILWITH } + { DROP ; PUSH nat 105 ; FAILWITH } } + { DIG 2 ; + INT ; + DUP 2 ; + ADD ; + PAIR ; + RIGHT + (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) ; + LEFT timestamp ; + UPDATE 3 ; + DIG 3 ; + PAIR } ; + UNPAIR ; + DUP 3 ; + DUP 4 ; + CDR ; + DUP 4 ; + SOME ; + DUP 5 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 3 ; + CAR ; + DUP 4 ; + CAR ; + SOME ; + DUP 5 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { SWAP ; DROP ; DIG 3 ; DIG 2 } } ; + DUG 2 } ; + DUG 2 ; + SOME } ; + IF_NONE + { DIG 2 ; DIG 3 ; DIG 4 ; DIG 5 ; DROP 5 } + { DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 4 ; DROP 2 ; PUSH bool False } + { CAR ; PUSH int 120 ; ADD ; DIG 4 ; COMPARE ; GT } } + { DIG 4 ; DROP 2 ; PUSH bool False } ; + IF { NOW ; + DUP 2 ; + GET 5 ; + DUP ; + GET 9 ; + INT ; + DUP 2 ; + GET 11 ; + INT ; + DUP 3 ; + GET 13 ; + INT ; + DUP 4 ; + CAR ; + INT ; + DUP 5 ; + GET 3 ; + INT ; + DUP 6 ; + GET 5 ; + INT ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR ; + PAIR ; + SWAP ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + DUP 8 ; + GET 3 ; + DUP 2 ; + CAR ; + CAR ; + DUP 4 ; + UNPAIR ; + UNPAIR ; + DUP 5 ; + DUP 15 ; + DIG 4 ; + DIG 4 ; + DIG 4 ; + ADD ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DUP 3 ; + CAR ; + UNPAIR ; + DUP 6 ; + UNPAIR ; + CDR ; + DIG 3 ; + DIG 3 ; + ADD ; + DUP 5 ; + DIG 3 ; + DIG 3 ; + ADD ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + DIG 3 ; + UNPAIR ; + UNPAIR ; + DIG 6 ; + CDR ; + DUG 3 ; + ADD ; + ADD ; + DUP 5 ; + CDR ; + DUP 13 ; + CDR ; + MUL ; + DIG 5 ; + CAR ; + DUP 13 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 3 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 1 ; + DIG 2 ; + PAIR ; + DUP 2 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DUP 3 ; + CDR ; + DUP 3 ; + CAR ; + MUL ; + COMPARE ; + LE ; + IF { SWAP ; DROP } { DROP } ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 14 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 15 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + PUSH int 0 ; + DUP 4 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 4 ; CDR ; MUL ; PUSH int -1 ; DUP 5 ; CAR ; MUL ; PAIR } + { DUP 3 } ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DUP 16 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DUP 4 ; + CAR ; + DUP 7 ; + CDR ; + MUL ; + DUP 5 ; + CDR ; + DUP 8 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 8 ; + CDR ; + MUL ; + DUP 7 ; + CDR ; + DUP 9 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { DIG 3 ; DIG 4 ; DIG 5 ; DROP 3 ; UNIT ; RIGHT unit ; LEFT unit } + { DUP 4 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 4 ; + CDR ; + DUP 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + DUP 6 ; + CAR ; + DUP 6 ; + CDR ; + MUL ; + DIG 6 ; + CDR ; + DIG 6 ; + CAR ; + MUL ; + COMPARE ; + LT ; + NOT ; + AND ; + IF { UNIT ; LEFT unit ; LEFT unit } { UNIT ; RIGHT (or unit unit) } } ; + DUP 10 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PUSH nat 0 ; + PAIR 4 ; + DIG 2 ; + DIG 3 ; + DIG 4 ; + DIG 5 ; + PAIR 3 ; + PAIR 4 ; + DUP ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DROP ; + DUP 2 ; + GET 3 ; + DUP 3 ; + CAR ; + ADD ; + DUP 3 ; + GET 13 ; + DIG 3 ; + GET 11 ; + ADD ; + SWAP } + { DROP ; + DUP 2 ; + GET 13 ; + DUP 3 ; + GET 11 ; + DUP 4 ; + GET 9 ; + ADD ; + ADD ; + DIG 2 ; + CAR } } + { DROP ; + DUP 2 ; + GET 5 ; + DUP 3 ; + GET 3 ; + DUP 4 ; + CAR ; + ADD ; + ADD ; + DIG 2 ; + GET 13 ; + SWAP } ; + DUP 3 ; + GET 3 ; + IF_LEFT + { IF_LEFT + { DIG 9 ; DROP 2 ; DUP 8 } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CAR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CDR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } } + { DROP ; + DUP 8 ; + GET 3 ; + DUP 10 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 10 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + DUP 9 ; + SWAP ; + UPDATE 3 } ; + DUP 4 ; + GET 3 ; + IF_LEFT + { IF_LEFT { DROP ; DUP 4 ; CAR ; GET 3 } { DROP ; DUP 4 ; CAR ; CAR } } + { DROP ; DUP 4 ; CAR ; GET 4 } ; + DUP 2 ; + GET 3 ; + DUP 2 ; + INT ; + PUSH int 1 ; + SWAP ; + PAIR ; + DUP 2 ; + CDR ; + DUP 2 ; + CDR ; + MUL ; + DIG 2 ; + CAR ; + DIG 2 ; + CAR ; + MUL ; + PAIR ; + PUSH int 0 ; + DUP 2 ; + CAR ; + COMPARE ; + LT ; + IF { PUSH int -1 ; DUP 2 ; CDR ; MUL ; PUSH int -1 ; DIG 2 ; CAR ; MUL ; PAIR } + {} ; + DUP ; + CDR ; + PUSH nat 0 ; + PUSH nat 10 ; + PAIR ; + DIG 13 ; + SWAP ; + EXEC ; + DIG 2 ; + CAR ; + MUL ; + EDIV ; + IF_NONE { PUSH string "DIV by 0" ; FAILWITH } {} ; + CAR ; + ISNAT ; + IF_NONE { PUSH nat 119 ; FAILWITH } {} ; + DIG 5 ; + DIG 5 ; + DIG 2 ; + DIG 5 ; + DIG 4 ; + PAIR 4 ; + UPDATE 5 ; + SWAP ; + UPDATE 6 ; + DIG 2 ; + DIG 5 ; + DIG 2 ; + DIG 3 ; + PAIR ; + PAIR ; + LEFT (pair timestamp timestamp) ; + LEFT timestamp ; + UPDATE 3 ; + DUP 2 ; + DUP 3 ; + CDR ; + DUP 3 ; + SOME ; + DUP 4 ; + CAR ; + UPDATE ; + UPDATE 2 ; + DIG 2 ; + CAR ; + DUP 3 ; + CAR ; + SOME ; + DIG 3 ; + GET 7 ; + UNPAIR ; + DUP ; + DUP 3 ; + COMPARE ; + GT ; + IF { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } + { SWAP ; PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; + UPDATE ; + UPDATE 1 } + { DIG 3 ; DIG 4 ; DIG 5 ; DROP 4 } ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CAR ; + DUP ; + CAR ; + DIG 4 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 1 } ; + NIL operation ; + PAIR } } } } } } ; + view "get_fee_in_mutez" unit mutez { CDR ; CAR ; CAR ; CDR ; CDR } ; + view "get_valid_swaps" + unit + (map string + (pair (pair %swap (string %from) (string %to)) + (address %oracle_address) + (string %oracle_asset_name) + (nat %oracle_precision) + (bool %is_disabled_for_deposits))) + { CDR ; CDR ; CDR ; CAR } ; + view "get_valid_tokens" + unit + (map string + (pair (nat %token_id) + (string %name) + (option %address address) + (nat %decimals) + (option %standard string))) + { CDR ; CDR ; CDR ; CDR } ; + view "get_current_batches" + unit + (list (pair (nat %batch_number) + (or %status + (or (pair %cleared + (pair (timestamp %at) + (pair %clearing + (pair %clearing_volumes (nat %minus) (nat %exact) (nat %plus)) + (or %clearing_tolerance (or (unit %exact) (unit %minus)) (unit %plus)) + (pair %total_cleared_volumes + (nat %buy_side_total_cleared_volume) + (nat %buy_side_volume_subject_to_clearing) + (nat %sell_side_total_cleared_volume) + (nat %sell_side_volume_subject_to_clearing)) + (pair %clearing_rate + (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when)))) + (pair %rate + (pair %swap (string %from) (string %to)) + (pair %rate (int %p) (int %q)) + (timestamp %when))) + (pair %closed (timestamp %closing_time) (timestamp %start_time))) + (timestamp %open)) + (pair %volumes + (nat %buy_minus_volume) + (nat %buy_exact_volume) + (nat %buy_plus_volume) + (nat %buy_total_volume) + (nat %sell_minus_volume) + (nat %sell_exact_volume) + (nat %sell_plus_volume) + (nat %sell_total_volume)) + (pair %pair string string) + (nat %holdings) + (option %market_vault_used (or (unit %buy) (unit %sell))))) + { CDR ; + NIL (pair nat + (or (or (pair (pair timestamp + (pair (pair nat nat nat) + (or (or unit unit) unit) + (pair nat nat nat nat) + (pair (pair string string) (pair int int) timestamp))) + (pair (pair string string) (pair int int) timestamp)) + (pair timestamp timestamp)) + timestamp) + (pair nat nat nat nat nat nat nat nat) + (pair string string) + nat + (option (or unit unit))) ; + DUP 2 ; + CAR ; + CAR ; + CAR ; + CDR ; + CAR ; + ITER { CDR ; + DUP 3 ; + CAR ; + CAR ; + CAR ; + CDR ; + CDR ; + SWAP ; + GET ; + IF_NONE {} { CONS } } ; + SWAP ; + DROP } } + diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz new file mode 100644 index 00000000..f6d2973c --- /dev/null +++ b/batcher/batcher-storage-ghostnet.tz @@ -0,0 +1,14 @@ +(Pair (Pair (Pair (Pair "tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" {} {}) 600 10000) + (Pair "tz1burnburnburnburnburnburnburjAYjjX" 0) + 10 + {}) + (Pair {} {}) + { Elt "tzBTC/EURL" + (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; + Elt "tzBTC/USDT" + (Pair (Pair "tzBTC" "USDT") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-USDT" 6 False) } + { Elt "EURL" (Pair 0 "EURL" (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") 6 (Some "FA2 token")) ; + Elt "USDT" (Pair 0 "USDT" (Some "KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR") 6 (Some "FA2 token")) ; + Elt "tzBTC" + (Pair 0 "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) }) + diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index d1d51ea3..b1165135 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1,295 +1,66 @@ #import "@ligo/math-lib/rational/rational.mligo" "Rational" #import "types.mligo" "Types" - -(* Errors *) -[@inline] let no_rate_available_for_swap : nat = 100n -[@inline] let invalid_token_address : nat = 101n -[@inline] let invalid_tezos_address : nat = 102n -[@inline] let no_open_batch : nat = 103n -[@inline] let batch_should_be_cleared : nat = 104n -[@inline] let trying_to_close_batch_which_is_not_open : nat = 105n -[@inline] let unable_to_parse_side_from_external_order : nat = 106n -[@inline] let unable_to_parse_tolerance_from_external_order : nat = 107n -[@inline] let token_standard_not_found : nat = 108n -[@inline] let xtz_not_currently_supported : nat = 109n -[@inline] let unsupported_swap_type : nat = 110n -[@inline] let unable_to_reduce_token_amount_to_less_than_zero : nat = 111n -[@inline] let too_many_unredeemed_orders : nat = 112n -[@inline] let insufficient_swap_fee : nat = 113n -[@inline] let sender_not_administrator : nat = 114n -[@inline] let token_already_exists_but_details_are_different: nat = 115n -[@inline] let swap_already_exists: nat = 116n -[@inline] let swap_does_not_exist: nat = 117n -[@inline] let endpoint_does_not_accept_tez: nat = 118n -[@inline] let number_is_not_a_nat: nat = 119n -[@inline] let oracle_price_is_stale: nat = 120n -[@inline] let oracle_price_is_not_timely: nat = 121n -[@inline] let unable_to_get_price_from_oracle: nat = 122n -[@inline] let unable_to_get_price_from_new_oracle_source: nat = 123n -[@inline] let oracle_price_should_be_available_before_deposit: nat = 124n -[@inline] let swap_is_disabled_for_deposits: nat = 125n -[@inline] let upper_limit_on_tokens_has_been_reached: nat = 126n -[@inline] let upper_limit_on_swap_pairs_has_been_reached: nat = 127n -[@inline] let cannot_reduce_limit_on_tokens_to_less_than_already_exists: nat = 128n -[@inline] let cannot_reduce_limit_on_swap_pairs_to_less_than_already_exists: nat = 129n -[@inline] let more_tez_sent_than_fee_cost : nat = 130n -[@inline] let cannot_update_deposit_window_to_less_than_the_minimum : nat = 131n -[@inline] let cannot_update_deposit_window_to_more_than_the_maximum : nat = 132n -[@inline] let oracle_must_be_equal_to_minimum_precision : nat = 133n -[@inline] let swap_precision_is_less_than_minimum : nat = 134n -[@inline] let cannot_update_scale_factor_to_less_than_the_minimum : nat = 135n -[@inline] let cannot_update_scale_factor_to_more_than_the_maximum : nat = 136n -[@inline] let cannot_remove_swap_pair_that_is_not_disabled : nat = 137n -[@inline] let token_name_not_in_list_of_valid_tokens : nat = 138n -[@inline] let no_orders_for_user_address : nat = 139n -[@inline] let cannot_cancel_orders_for_a_batch_that_is_not_open : nat = 140n -[@inline] let cannot_decrease_holdings_of_removed_batch : nat = 141n -[@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n -[@inline] let batch_already_removed : nat = 143n -[@inline] let admin_and_fee_recipient_address_cannot_be_the_same = 144n -[@inline] let incorrect_market_vault_holder = 145n -[@inline] let incorrect_market_vault_id = 146n -[@inline] let market_vault_tokens_are_different = 147n -[@inline] let unable_to_find_user_holding_for_id = 148n -[@inline] let unable_to_find_vault_holding_for_id = 149n -[@inline] let user_in_holding_is_incorrect = 150n -[@inline] let no_holding_in_market_maker_for_holder = 151n -[@inline] let no_market_vault_for_token = 152n -[@inline] let holding_amount_to_redeem_is_larger_than_holding = 153n -[@inline] let holding_shares_greater_than_total_shares_remaining = 154n -[@inline] let no_holdings_to_claim = 155n -[@inline] let incorrect_side_specified = 156n - -(* Constants *) - -(* The constant which represents a 10 basis point difference *) -[@inline] let ten_bips_constant = Rational.div (Rational.new 10001) (Rational.new 10000) - -(* The constant which represents they4j period during which a closed batch will wait before looking for a price, in seconds. *) -[@inline] let price_wait_window_in_seconds : int = 120 - -(* The minimum length of a the scale factor for oracle staleness *) -(* Oracle prices would be considered stale if they are older than scale_factor_for_oracle_staleness * deposit_time_window *) -[@inline] let minimum_scale_factor_for_oracle_staleness : nat = 1n - -(* The maximum length of a the scale factor for oracle staleness *) -(* Oracle prices would be considered stale if they are older than scale_factor_for_oracle_staleness * deposit_time_window *) -[@inline] let maximum_scale_factor_for_oracle_staleness : nat = 10n - -(* The minimum length of a deposit price window *) -[@inline] let minimum_deposit_time_in_seconds : nat = 600n - -(* The maximum length of a deposit price window *) -[@inline] let maximum_deposit_time_in_seconds : nat = 3600n - -[@inline] let fa12_token : string = "FA1.2 token" - -[@inline] let fa2_token : string = "FA2 token" - -[@inline] let limit_of_redeemable_items : nat = 10n - -(* The contract assumes that the minimum precision is six and that the oracle precision must EXACTLY be 6 *) -[@inline] let minimum_precision : nat = 6n +#import "utils.mligo" "Utils" +#import "errors.mligo" "Errors" +#import "constants.mligo" "Constants" type side = Types.side - type tolerance = Types.tolerance - type token = Types.token - type token_amount = Types.token_amount - type token_amount_map = Types.token_amount_map - type token_holding_map = Types.token_holding_map - type token_holding = Types.token_holding - type swap = Types.swap - type swap_reduced = Types.swap_reduced - type valid_swap_reduced = Types.valid_swap_reduced - type valid_swap = Types.valid_swap - type exchange_rate_full = Types.exchange_rate_full - type exchange_rate = Types.exchange_rate - type swap_order = Types.swap_order - type external_swap_order = Types.external_swap_order - type batch_status = Types.batch_status - type total_cleared_volumes = Types.total_cleared_volumes - type clearing_volumes = Types.clearing_volumes - type clearing = Types.clearing - type buy_minus_token = Types.buy_minus_token type buy_exact_token = Types.buy_exact_token type buy_plus_token = Types.buy_plus_token type buy_side = Types.buy_side - type sell_minus_token = Types.sell_minus_token type sell_exact_token = Types.sell_exact_token type sell_plus_token = Types.sell_plus_token type sell_side = Types.sell_side +type batch_status = Types.batch_status +type volumes = Types.volumes +type pair = Types.pair +type ordertype = Types.ordertype +type ordertypes = Types.ordertypes +type batch_ordertypes = Types.batch_ordertypes +type user_batch_ordertypes = Types.user_batch_ordertypes +type batch = Types.batch +type batch_indices = Types.batch_indices +type batches = Types.batches +type batch_set = Types.batch_set +type metadata = Types.metadata +type metadata_update = Types.metadata_update +type orace_price_update = Types.oracle_price_update +type oracle_source_change = Types.oracle_source_change +type valid_tokens = Types.valid_tokens +type valid_swaps = Types.valid_swaps +type rates_current = Types.rates_current +type fees = Types.fees -type batch_status = - | Open of { start_time : timestamp } - | Closed of { start_time : timestamp ; closing_time : timestamp } - | Cleared of { at : timestamp; clearing : clearing; rate : exchange_rate } -type volumes = [@layout:comb] { - buy_minus_volume : nat; - buy_exact_volume : nat; - buy_plus_volume : nat; - buy_total_volume : nat; - sell_minus_volume : nat; - sell_exact_volume : nat; - sell_plus_volume : nat; - sell_total_volume : nat; -} - -type pair = string * string - -(* This represents the type of order. I.e. buy/sell and which level*) -type ordertype = [@layout:comb] { - side: side; - tolerance: tolerance; -} - -(* Mapping order type to total amount of placed orders *) -type ordertypes = (ordertype, nat) map - -(* pairing of batch_id and ordertypes. *) -type batch_ordertypes = (nat, ordertypes) map - -(* Associated user address to a given set of batches and ordertypes *) -type user_batch_ordertypes = (address, batch_ordertypes) big_map - -(* Batch of orders for the same pair of tokens *) -type batch = [@layout:comb] { - batch_number: nat; - status : batch_status; - volumes : volumes; - pair : pair; - holdings : nat; - market_vault_used : side option; -} - -type batch_indices = (string, nat) map - -type batches = (nat, batch) big_map - -(* Set of batches, containing the current batch and the previous (finalized) batches. - The current batch can be open for deposits, closed for deposits (awaiting clearing) or - finalized, as we wait for a new deposit to start a new batch *) -type batch_set = [@layout:comb] { - current_batch_indices: batch_indices; - batches: batches; -} - -type metadata = Shared.metadata - -type metadata_update = Shared.metadata_update - -type orace_price_update = timestamp * nat - -type oracle_source_change = [@layout:comb] { - pair_name: string; - oracle_address: address; - oracle_asset_name: string; - oracle_precision: nat; -} - -(* The tokens that are valid within the contract *) -type valid_tokens = (string, token) map - -(* The swaps of valid tokens that are accepted by the contract *) -type valid_swaps = (string, valid_swap_reduced) map - -(* The current, most up to date exchange rates between tokens *) -type rates_current = (string, exchange_rate) big_map - -type fees = { - to_send: tez; - to_refund: tez; - payer: address; - recipient: address; -} - - -[@inline] -let get_token - (token_name: string) - (tokens: valid_tokens): token = - let tok_opt = Map.find_opt token_name tokens in - match tok_opt with - | Some t -> t - | None -> failwith unable_to_reduce_token_amount_to_less_than_zero - -module TokenAmount = struct - - let recover - (ot: ordertype) - (amt: nat) - (c: clearing) - (tokens: valid_tokens): token_amount = - let swap = c.clearing_rate.swap in - let token = match ot.side with - | Buy -> get_token swap.from tokens - | Sell -> get_token swap.to tokens - in - { - token = token; - amount = amt; - } -end - -module TokenAmountMap = struct - - type op = Increase | Decrease - - let new = (Map.empty: token_amount_map) - - let amend - (ta: token_amount) - (op: op) - (tam : token_amount_map): token_amount_map = - let token_name = ta.token.name in - match Map.find_opt token_name tam with - | None -> Map.add token_name ta tam - | Some prev -> let new_amt: nat = match op with - | Increase -> ta.amount + prev.amount - | Decrease -> if ta.amount > prev.amount then - (failwith unable_to_reduce_token_amount_to_less_than_zero : nat) - else - abs (prev.amount - ta.amount) - in - let new_tamt = { ta with amount = new_amt } in - Map.update token_name (Some new_tamt) tam - - let increase - (ta: token_amount) - (tam : token_amount_map): token_amount_map = - amend ta Increase tam - -end module BatchHoldings_Utils = struct - [@inline] let increase_holding (batch_number: nat) (batches: batches): batches = match Big_map.find_opt batch_number batches with - | None -> failwith cannot_increase_holdings_of_batch_that_does_not_exist + | None -> failwith Errors.cannot_increase_holdings_of_batch_that_does_not_exist | Some b -> let bh = b.holdings + 1n in let b = { b with holdings = bh; } in Big_map.update batch_number (Some b) batches @@ -311,7 +82,7 @@ let remove_batch_holding (batch_number: nat) (batches: batches): batches = match Big_map.find_opt batch_number batches with - | None -> failwith cannot_decrease_holdings_of_removed_batch + | None -> failwith Errors.cannot_decrease_holdings_of_removed_batch | Some b -> let nh = abs(b.holdings - 1n) in let b = { b with holdings = nh; } in Big_map.update batch_number (Some b) batches @@ -322,7 +93,7 @@ let can_batch_be_removed (batch_number: nat) (batches: batches): bool = match Big_map.find_opt batch_number batches with - | None -> failwith cannot_decrease_holdings_of_removed_batch + | None -> failwith Errors.cannot_decrease_holdings_of_removed_batch | Some b -> b.holdings <= 0n end @@ -343,314 +114,10 @@ module Storage = struct administrator : address; limit_on_tokens_or_pairs : nat; deposit_time_window_in_seconds : nat; - market_maker: market_maker; } end -module Utils = struct - - -[@inline] -let swap_to_swap_reduced - (swap: swap): swap_reduced = - { - from = swap.from.token.name; - to = swap.to.name; - } - -[@inline] -let valid_swap_to_valid_swap_reduced - (valid_swap: valid_swap) : valid_swap_reduced = - let swap_reduced = swap_to_swap_reduced valid_swap.swap in - { - swap = swap_reduced; - oracle_address = valid_swap.oracle_address; - oracle_asset_name = valid_swap.oracle_asset_name; - oracle_precision = valid_swap.oracle_precision; - is_disabled_for_deposits = valid_swap.is_disabled_for_deposits; - } - -[@inline] -let swap_reduced_to_swap - (swap_reduced: swap_reduced) - (from_amount: nat) - (tokens: valid_tokens) : swap = - let from = get_token swap_reduced.from tokens in - let to = get_token swap_reduced.to tokens in - { - from = { - token = from; - amount = from_amount; - }; - to = to; - } - - -[@inline] -let valid_swap_reduced_to_valid_swap - (valid_swap_reduced: valid_swap_reduced) - (from_amount: nat) - (tokens: valid_tokens) : valid_swap = - let swap = swap_reduced_to_swap valid_swap_reduced.swap from_amount tokens in - { - swap = swap; - oracle_address = valid_swap_reduced.oracle_address; - oracle_precision = valid_swap_reduced.oracle_precision; - oracle_asset_name = valid_swap_reduced.oracle_asset_name; - is_disabled_for_deposits = valid_swap_reduced.is_disabled_for_deposits; - } - - -[@inline] -let empty_total_cleared_volumes : total_cleared_volumes = { - buy_side_total_cleared_volume = 0n; - buy_side_volume_subject_to_clearing = 0n; - sell_side_total_cleared_volume = 0n; - sell_side_volume_subject_to_clearing = 0n; -} - -[@inline] -let to_nat (i:int): nat = - match is_nat i with - | Some n -> n - | None -> failwith number_is_not_a_nat - -[@inline] -let gt (a : Rational.t) (b : Rational.t) : bool = not (Rational.lte a b) - -[@inline] -let gte (a : Rational.t) (b : Rational.t) : bool = not (Rational.lt a b) - -let pow (base : int) (pow : int) : int = - let rec iter (acc : int) (rem_pow : int) : int = if rem_pow = 0 then acc else iter (acc * base) (rem_pow - 1) in - iter 1 pow - -(* Get the number with 0 decimal accuracy *) -[@inline] -let get_rounded_number_lower_bound (number : Rational.t) : nat = - let zero_decimal_number = Rational.resolve number 0n in - to_nat zero_decimal_number - -[@inline] -let get_min_number (a : Rational.t) (b : Rational.t) = - if Rational.lte a b then a - else b - -[@inline] -let get_clearing_tolerance - (cp_minus : Rational.t) - (cp_exact : Rational.t) - (cp_plus : Rational.t) : tolerance = - if gte cp_minus cp_exact && gte cp_minus cp_plus then Minus - else if gte cp_exact cp_minus && gte cp_exact cp_plus then Exact - else Plus - -[@inline] -let get_cp_minus - (rate : Rational.t) - (buy_side : buy_side) - (sell_side : sell_side) : Rational.t = - let buy_minus_token, _, _ = buy_side in - let sell_minus_token, sell_exact_token, sell_plus_token = sell_side in - let left_number = Rational.new (buy_minus_token) in - let right_number = Rational.div (Rational.mul (Rational.new (sell_minus_token + sell_exact_token + sell_plus_token)) ten_bips_constant) rate in - let min_number = get_min_number left_number right_number in - min_number - -[@inline] -let get_cp_exact - (rate : Rational.t) - (buy_side : buy_side) - (sell_side : sell_side) : Rational.t = - let buy_minus_token, buy_exact_token, _ = buy_side in - let _, sell_exact_token, sell_plus_token = sell_side in - let left_number = Rational.new (buy_minus_token + buy_exact_token) in - let right_number = Rational.div (Rational.new (sell_exact_token + sell_plus_token)) rate in - let min_number = get_min_number left_number right_number in - min_number - -[@inline] -let get_cp_plus - (rate : Rational.t) - (buy_side : buy_side) - (sell_side : sell_side) : Rational.t = - let buy_minus_token, buy_exact_token, buy_plus_token = buy_side in - let _, _, sell_plus_token = sell_side in - let left_number = Rational.new (buy_minus_token + buy_exact_token + buy_plus_token) in - let right_number = Rational.div (Rational.new (sell_plus_token)) (Rational.mul ten_bips_constant rate) in - let min_number = get_min_number left_number right_number in - min_number - -[@inline] -let get_clearing_price (exchange_rate : exchange_rate) (buy_side : buy_side) (sell_side : sell_side) : clearing = - let rate = exchange_rate.rate in - let cp_minus = get_cp_minus rate buy_side sell_side in - let cp_exact = get_cp_exact rate buy_side sell_side in - let cp_plus = get_cp_plus rate buy_side sell_side in - let rounded_cp_minus = get_rounded_number_lower_bound cp_minus in - let rounded_cp_exact = get_rounded_number_lower_bound cp_exact in - let rounded_cp_plus = get_rounded_number_lower_bound cp_plus in - let clearing_volumes = - { - minus = rounded_cp_minus; - exact = rounded_cp_exact; - plus = rounded_cp_plus - } - in - let clearing_tolerance = get_clearing_tolerance cp_minus cp_exact cp_plus in - { - clearing_volumes = clearing_volumes; - clearing_tolerance = clearing_tolerance; - total_cleared_volumes = empty_total_cleared_volumes; - clearing_rate = exchange_rate - } - -[@inline] -let nat_to_side -(order_side : nat) : side = - if order_side = 0n then Buy - else - if order_side = 1n then Sell - else failwith unable_to_parse_side_from_external_order - -[@inline] -let nat_to_tolerance (tolerance : nat) : tolerance = - if tolerance = 0n then Minus - else if tolerance = 1n then Exact - else if tolerance = 2n then Plus - else failwith unable_to_parse_tolerance_from_external_order - -[@inline] -let find_lexicographical_pair_name - (token_one_name: string) - (token_two_name: string) : string = - if token_one_name > token_two_name then - token_one_name ^ "/" ^ token_two_name - else - token_two_name ^ "/" ^ token_one_name - -[@inline] -let get_rate_name_from_swap (s : swap_reduced) : string = - let base_name = s.from in - let quote_name = s.to in - find_lexicographical_pair_name quote_name base_name - -[@inline] -let get_rate_name_from_pair (s : pair) : string = - let base_name, quote_name = s in - find_lexicographical_pair_name quote_name base_name - -[@inline] -let get_inverse_rate_name_from_pair (s : pair) : string = - let base_name, quote_name = s in - find_lexicographical_pair_name quote_name base_name - -[@inline] -let get_rate_name - (r : exchange_rate): string = - let base_name = r.swap.from in - let quote_name = r.swap.to in - find_lexicographical_pair_name quote_name base_name - - -[@inline] -let pair_of_swap - (side: side) - (swap: swap_reduced): (pair) = - match side with - | Buy -> swap.from, swap.to - | Sell -> swap.to, swap.from - -[@inline] -let pair_of_rate - (r : exchange_rate): pair = pair_of_swap Buy r.swap - -[@inline] -let pair_of_external_swap - (order : external_swap_order): pair = - (* Note: we assume left-handedness - i.e. direction is buy side*) - let swap = order.swap in - let side = nat_to_side order.side in - let swap_reduced = swap_to_swap_reduced swap in - pair_of_swap side swap_reduced - -[@inline] -let get_current_batch_index - (pair: pair) - (batch_indices: batch_indices): nat = - let rate_name = get_rate_name_from_pair pair in - match Map.find_opt rate_name batch_indices with - | Some cbi -> cbi - | None -> 0n - - -[@inline] -let get_highest_batch_index - (batch_indices: batch_indices) : nat = - let return_highest (acc, (_s, i) : nat * (string * nat)) : nat = if i > acc then - i - else - acc - in - Map.fold return_highest batch_indices 0n - -(** [concat a b] concat [a] and [b]. *) -let concat1 (type a) (left: a list) (right: a list) : a list = - List.fold_right (fun (x, xs: a * a list) -> x :: xs) left right - -(** [rev list] should return the same list reversed. *) -let rev1 (type a) (list: a list) : a list = - List.fold_left (fun (xs, x : a list * a) -> x :: xs) ([] : a list) list - -[@inline] -let update_if_more_recent - (rate_name: string) - (rate: exchange_rate) - (rates_current: rates_current) : rates_current = - match Big_map.find_opt rate_name rates_current with - | None -> Big_map.add rate_name rate rates_current - | Some lr -> if rate.when > lr.when then - Big_map.update rate_name (Some rate) rates_current - else - rates_current - -[@inline] -let update_current_rate (rate_name : string) (rate : exchange_rate) (storage : Storage.t) = - let updated_rates = update_if_more_recent rate_name rate storage.rates_current in - { storage with rates_current = updated_rates } - -[@inline] -let get_rate_scaling_power_of_10 - (rate : exchange_rate) - (tokens: valid_tokens): Rational.t = - let swap = rate.swap in - let from_token = get_token swap.from tokens in - let to_token = get_token swap.to tokens in - let from_decimals = from_token.decimals in - let to_decimals = to_token.decimals in - let diff = to_decimals - from_decimals in - let abs_diff = int (abs diff) in - let power10 = pow 10 abs_diff in - if diff = 0 then - Rational.new 1 - else - if diff < 0 then - Rational.div (Rational.new 1) (Rational.new power10) - else - (Rational.new power10) - -[@inline] -let scale_on_receive_for_token_precision_difference - (rate : exchange_rate) - (tokens: valid_tokens): exchange_rate = - let scaling_rate = get_rate_scaling_power_of_10 rate tokens in - let adjusted_rate = Rational.mul rate.rate scaling_rate in - { rate with rate = adjusted_rate } - - - -end module OrderType = struct @@ -778,7 +245,7 @@ let add_payout_if_not_zero (payout: token_amount) (tam: token_amount_map) : token_amount_map = if payout.amount > 0n then - TokenAmountMap.increase payout tam + Utils.TokenAmountMap.increase payout tam else tam @@ -818,7 +285,7 @@ let get_cleared_sell_side_payout token = from; amount = Utils.get_rounded_number_lower_bound remaining; } in - TokenAmountMap.increase token_rem u_tam + Utils.TokenAmountMap.increase token_rem u_tam else u_tam @@ -857,7 +324,7 @@ let get_cleared_buy_side_payout token = from; amount = Utils.get_rounded_number_lower_bound remaining; } in - TokenAmountMap.increase token_rem u_tam + Utils.TokenAmountMap.increase token_rem u_tam else u_tam @@ -870,8 +337,8 @@ let get_cleared_payout (tokens: valid_tokens): token_amount_map = let s = ot.side in let swap = clearing.clearing_rate.swap in - let from_token = get_token swap.from tokens in - let to_token = get_token swap.to tokens in + let from_token = Utils.get_token swap.from tokens in + let to_token = Utils.get_token swap.to tokens in match s with | Buy -> get_cleared_buy_side_payout from_token to_token amt clearing tam | Sell -> get_cleared_sell_side_payout to_token from_token amt clearing tam @@ -886,10 +353,10 @@ let collect_order_payout_from_clearing let uf = { fees with to_send = f; } in (tm, uf) else - let ta: token_amount = TokenAmount.recover ot amt c tokens in + let ta: token_amount = Utils.TokenAmount.recover ot amt c tokens in let f = fees.to_refund + fee_in_mutez in let uf = { fees with to_refund = f; } in - (TokenAmountMap.increase ta tam, uf) + (Utils.TokenAmountMap.increase ta tam, uf) in (c, u_tam, vols, tokens, u_fees, fee_in_mutez) @@ -960,136 +427,17 @@ let is_within_limit match Big_map.find_opt holder ubots with | None -> true | Some bots -> let outstanding_token_items = Batch_OrderTypes.count bots in - outstanding_token_items <= limit_of_redeemable_items + outstanding_token_items <= Constants.limit_of_redeemable_items end -module Treasury_Utils = struct - - type adjustment = INCREASE | DECREASE - type order_list = swap_order list - - type atomic_trans = - [@layout:comb] { - to_ : address; - token_id : nat; - amount : nat; - } - - type transfer_from = { - from_ : address; - tx : atomic_trans list - } - - (* Transferred format for tokens in FA2 standard *) - type fa2_transfer = transfer_from list - - (* Transferred format for tokens in FA12 standard *) - type fa12_transfer = - [@layout:comb] { - [@annot:from] address_from : address; - [@annot:to] address_to : address; - value : nat - } - - - -[@inline] -let transfer_fa12_token - (sender : address) - (receiver : address) - (token_address : address) - (token_amount : nat) : operation = - let transfer_entrypoint : fa12_transfer contract = - match (Tezos.get_entrypoint_opt "%transfer" token_address : fa12_transfer contract option) with - | None -> failwith invalid_token_address - | Some transfer_entrypoint -> transfer_entrypoint - in - let transfer : fa12_transfer = { - address_from = sender; - address_to = receiver; - value = token_amount - } in - Tezos.transaction transfer 0tez transfer_entrypoint - -[@inline] -let transfer_fa2_token - (sender : address) - (receiver : address) - (token_address : address) - (token_id: nat) - (token_amount : nat) : operation = - let transfer_entrypoint : fa2_transfer contract = - match (Tezos.get_entrypoint_opt "%transfer" token_address : fa2_transfer contract option) with - | None -> failwith invalid_token_address - | Some transfer_entrypoint -> transfer_entrypoint - in - let transfer : fa2_transfer = [ - { - from_ = sender; - tx = [ - { - to_ = receiver; - token_id = token_id; - amount = token_amount - } - ] - } - ] in - Tezos.transaction transfer 0tez transfer_entrypoint - -(* Transfer the tokens to the appropriate address. This is based on the FA12 and FA2 token standard *) -[@inline] -let transfer_token - (sender : address) - (receiver : address) - (token_address : address) - (token_amount : token_amount) : operation = - match token_amount.token.standard with - | Some standard -> - if standard = fa12_token then - transfer_fa12_token sender receiver token_address token_amount.amount - else if standard = fa2_token then - transfer_fa2_token sender receiver token_address token_amount.token.token_id token_amount.amount - else - failwith token_standard_not_found - | None -> - failwith token_standard_not_found - -[@inline] -let handle_transfer (sender : address) (receiver : address) (received_token : token_amount) : operation = - match received_token.token.address with - | None -> failwith xtz_not_currently_supported - | Some token_address -> - transfer_token sender receiver token_address received_token - -[@inline] -let transfer_holdings (treasury_vault : address) (holder: address) (holdings : token_amount_map) : operation list = - let atomic_transfer (operations, (_token_name,ta) : operation list * ( string * token_amount)) : operation list = - let op: operation = handle_transfer treasury_vault holder ta in - op :: operations - in - let op_list = Map.fold atomic_transfer holdings ([] : operation list) - in - op_list - -[@inline] -let transfer_fee (receiver : address) (amount : tez) : operation = - match (Tezos.get_contract_opt receiver : unit contract option) with - | None -> failwith invalid_tezos_address - | Some rec_address -> Tezos.transaction () amount rec_address - - -end module Treasury = struct type storage = Storage.t -[@inline] -let get_treasury_vault () : address = Tezos.get_self_address () [@inline] let resolve_fees @@ -1097,12 +445,12 @@ let resolve_fees (token_ops: operation list): operation list = let token_ops = if fees.to_refund > 0mutez then - Treasury_Utils.transfer_fee fees.payer fees.to_refund :: token_ops + Utils.Treasury_Utils.transfer_fee fees.payer fees.to_refund :: token_ops else token_ops in if fees.to_send > 0mutez then - Treasury_Utils.transfer_fee fees.recipient fees.to_send :: token_ops + Utils.Treasury_Utils.transfer_fee fees.recipient fees.to_send :: token_ops else token_ops @@ -1110,8 +458,8 @@ let resolve_fees let deposit (deposit_address : address) (deposited_token : token_amount) : operation list = - let treasury_vault = get_treasury_vault () in - let deposit_op = Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in + let treasury_vault = Utils.get_vault () in + let deposit_op = Utils.Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in [ deposit_op] @@ -1119,7 +467,7 @@ let deposit let redeem (redeem_address : address) (storage : storage) : operation list * storage = - let treasury_vault = get_treasury_vault () in + let treasury_vault = Utils.get_vault () in let fees = { to_send = 0mutez; to_refund = 0mutez; @@ -1127,7 +475,7 @@ let redeem recipient = storage.fee_recipient; } in let fees, updated_ubots, updated_batch_set, payout_token_map = Ubots.collect_redemption_payouts redeem_address fees storage in - let operations = Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in + let operations = Utils.Treasury_Utils.transfer_holdings treasury_vault redeem_address payout_token_map in let operations = resolve_fees fees operations in let updated_storage = { storage with user_batch_ordertypes = updated_ubots; batch_set = updated_batch_set; } in (operations, updated_storage) @@ -1136,15 +484,6 @@ end module Token_Utils = struct -[@inline] -let are_equivalent_tokens - (given: token) - (test: token) : bool = - given.token_id = test.token_id && - given.name = test.name && - given.address = test.address && - given.decimals = test.decimals && - given.standard = test.standard [@inline] let is_valid_swap_pair @@ -1153,17 +492,17 @@ let is_valid_swap_pair (valid_swaps: valid_swaps): swap_reduced = let token_pair = Utils.pair_of_swap side swap in let rate_name = Utils.get_rate_name_from_pair token_pair in - if Map.mem rate_name valid_swaps then swap else failwith unsupported_swap_type + if Map.mem rate_name valid_swaps then swap else failwith Errors.unsupported_swap_type [@inline] let remove_token (token: token) (valid_tokens: valid_tokens) : valid_tokens = match Map.find_opt token.name valid_tokens with - | Some existing_token -> if are_equivalent_tokens existing_token token then + | Some existing_token -> if Utils.are_equivalent_tokens existing_token token then Map.remove token.name valid_tokens else - failwith token_already_exists_but_details_are_different + failwith Errors.token_already_exists_but_details_are_different | None -> valid_tokens [@inline] @@ -1171,10 +510,10 @@ let add_token (token: token) (valid_tokens: valid_tokens) : valid_tokens = match Map.find_opt token.name valid_tokens with - | Some existing_token -> if are_equivalent_tokens existing_token token then + | Some existing_token -> if Utils.are_equivalent_tokens existing_token token then valid_tokens else - failwith token_already_exists_but_details_are_different + failwith Errors.token_already_exists_but_details_are_different | None -> Map.add token.name token valid_tokens [@inline] @@ -1182,7 +521,7 @@ let is_token_used (token: token) (valid_tokens: valid_tokens) : bool = let is_token_in_tokens (acc, (_i, t) : bool * (string * token)) : bool = - are_equivalent_tokens token t || + Utils.are_equivalent_tokens token t || acc in Map.fold is_token_in_tokens valid_tokens false @@ -1194,10 +533,10 @@ let is_token_used_in_swaps (tokens: valid_tokens): bool = let is_token_used_in_swap (acc, (_i, valid_swap) : bool * (string * valid_swap_reduced)) : bool = let swap = valid_swap.swap in - let to_token = get_token swap.to tokens in - let from_token = get_token swap.from tokens in - are_equivalent_tokens token to_token || - are_equivalent_tokens token from_token || + let to_token = Utils.get_token swap.to tokens in + let from_token = Utils.get_token swap.from tokens in + Utils.are_equivalent_tokens token to_token || + Utils.are_equivalent_tokens token from_token || acc in Map.fold is_token_used_in_swap valid_swaps false @@ -1221,8 +560,8 @@ let remove_swap let swap_reduced = Utils.swap_to_swap_reduced(swap) in let rate_name = Utils.get_rate_name_from_swap swap_reduced in let valid_swaps = Map.remove rate_name valid_swaps in - let from = get_token swap_reduced.from valid_tokens in - let to = get_token swap_reduced.to valid_tokens in + let from = Utils.get_token swap_reduced.from valid_tokens in + let to = Utils.get_token swap_reduced.to valid_tokens in let valid_tokens = if is_token_used_in_swaps from valid_swaps valid_tokens then valid_tokens else @@ -1249,20 +588,20 @@ let validate let from = swap.from.token in let to = swap.to in match Map.find_opt from.name valid_tokens with - | None -> failwith unsupported_swap_type + | None -> failwith Errors.unsupported_swap_type | Some ft -> (match Map.find_opt to.name valid_tokens with - | None -> failwith unsupported_swap_type - | Some tt -> if (Token_Utils.are_equivalent_tokens from ft) && (Token_Utils.are_equivalent_tokens to tt) then + | None -> failwith Errors.unsupported_swap_type + | Some tt -> if (Utils.are_equivalent_tokens from ft) && (Utils.are_equivalent_tokens to tt) then let sr = Utils.swap_to_swap_reduced swap in Token_Utils.is_valid_swap_pair side sr valid_swaps else - failwith unsupported_swap_type) + failwith Errors.unsupported_swap_type) [@inline] let check_tokens_size_or_fail (tokens_size: nat) (limit_on_tokens_or_pairs: nat) - (num_tokens: nat) : unit = if tokens_size + num_tokens > limit_on_tokens_or_pairs then failwith upper_limit_on_tokens_has_been_reached else () + (num_tokens: nat) : unit = if tokens_size + num_tokens > limit_on_tokens_or_pairs then failwith Errors.upper_limit_on_tokens_has_been_reached else () [@inline] let can_add @@ -1272,7 +611,7 @@ let can_add (valid_tokens: valid_tokens) (valid_swaps: valid_swaps): unit = let pairs_size = Map.size valid_swaps in - if pairs_size + 1n > limit_on_tokens_or_pairs then failwith upper_limit_on_swap_pairs_has_been_reached else + if pairs_size + 1n > limit_on_tokens_or_pairs then failwith Errors.upper_limit_on_swap_pairs_has_been_reached else let tokens_size = Map.size valid_tokens in let unused_tokens_being_added = if Token_Utils.is_token_used to valid_tokens && Token_Utils.is_token_used from valid_tokens then 0n else @@ -1292,7 +631,7 @@ let remove_pair let rate_found = Map.find_opt rate_name valid_swaps in match rate_found with | Some _ -> Token_Utils.remove_swap valid_swap valid_tokens valid_swaps - | None -> failwith swap_does_not_exist + | None -> failwith Errors.swap_does_not_exist [@inline] let add_pair @@ -1308,7 +647,7 @@ let add_pair let rate_name = Utils.get_rate_name_from_swap swap_reduced in let rate_found = Map.find_opt rate_name valid_swaps in match rate_found with - | Some _ -> failwith swap_already_exists + | Some _ -> failwith Errors.swap_already_exists | None -> let valid_tokens = Token_Utils.add_token from valid_tokens in let valid_tokens = Token_Utils.add_token to valid_tokens in let valid_swaps = Token_Utils.add_swap valid_swap valid_swaps in @@ -1416,7 +755,7 @@ let should_be_cleared (current_time : timestamp) : bool = match batch.status with | Closed { start_time = _; closing_time } -> - current_time > closing_time + price_wait_window_in_seconds + current_time > closing_time + Constants.price_wait_window_in_seconds | _ -> false @@ -1444,12 +783,10 @@ let close (storage: Storage.t): Storage.t * batch = match batch.status with | Open { start_time } -> - let liquidity_order_number = storage.last_order_number + 1n in - let (batch,storage) = MarketVaultUtils.inject_jit_liquidity batch liquidity_order_number storage in let batch_close_time = start_time + (int deposit_time_window) in let new_status = Closed { start_time = start_time; closing_time = batch_close_time } in storage,{ batch with status = new_status } - | _ -> failwith trying_to_close_batch_which_is_not_open + | _ -> failwith Errors.trying_to_close_batch_which_is_not_open [@inline] let new_batch_set : batch_set = @@ -1560,7 +897,7 @@ let update_storage_with_order (current_batch_number: nat) (batch: batch) (batch_set: batch_set) - (storage:Storage.t) : Storage.t = + (storage:Storage.t) : batch * Storage.t = let updated_volumes = update_volumes order batch in let updated_batches = Big_map.update current_batch_number (Some updated_volumes) batch_set.batches in let updated_batches = BatchHoldings_Utils.add_batch_holding current_batch_number order.trader storage.user_batch_ordertypes updated_batches in @@ -1586,9 +923,9 @@ let get_clearing_rate (exchange_rate: exchange_rate) : exchange_rate = match clearing.clearing_tolerance with | Exact -> exchange_rate - | Plus -> let rate = Rational.mul (exchange_rate.rate) ten_bips_constant in + | Plus -> let rate = Rational.mul (exchange_rate.rate) Constants.ten_bips_constant in { exchange_rate with rate = rate} - | Minus -> let rate = Rational.div (exchange_rate.rate) ten_bips_constant in + | Minus -> let rate = Rational.div (exchange_rate.rate) Constants.ten_bips_constant in { exchange_rate with rate = rate} [@inline] @@ -1696,20 +1033,12 @@ let get_oracle_price | Some opu -> opu | None -> failwith failure_code -[@inline] -let reject_if_tez_supplied(): unit = - if Tezos.get_amount () < 1mutez then () else failwith endpoint_does_not_accept_tez - -[@inline] -let is_administrator - (storage : storage) : unit = - if Tezos.get_sender () = storage.administrator then () else failwith sender_not_administrator [@inline] let admin_and_fee_recipient_address_are_different (admin : address) (fee_recipient : address ): unit = - if admin = fee_recipient then failwith admin_and_fee_recipient_address_cannot_be_the_same else () + if admin = fee_recipient then failwith Errors.admin_and_fee_recipient_address_cannot_be_the_same else () [@inline] @@ -1754,7 +1083,7 @@ let get_valid_swap_reduced (storage : storage) : valid_swap_reduced = match Map.find_opt pair_name storage.valid_swaps with | Some vswp -> vswp - | None -> failwith swap_does_not_exist + | None -> failwith Errors.swap_does_not_exist [@inline] @@ -1784,7 +1113,7 @@ let remove_order_types (bot: batch_ordertypes) (storage:storage) : ordertypes * storage = match Map.find_opt batch_number bot with - | None -> failwith no_orders_for_user_address + | None -> failwith Errors.no_orders_for_user_address | Some ots -> let bot = Map.remove batch_number bot in let ubots = Big_map.update holder (Some bot) storage.user_batch_ordertypes in let storage = { storage with user_batch_ordertypes = ubots;} in @@ -1806,14 +1135,14 @@ let refund_orders token = token; amount = amt; } in - let tam = TokenAmountMap.increase ta tam in + let tam = Utils.TokenAmountMap.increase ta tam in let mutez_to_ref = mutez_to_ref + fee in tam, mutez_to_ref in let token_refunds, tez_refunds= Map.fold collect_refunds ots ((Map.empty: token_amount_map), 0mutez) in - let treasury_vault = Treasury.get_treasury_vault () in - let operations = Treasury_Utils.transfer_holdings treasury_vault refund_address token_refunds in - let operations = if tez_refunds > 0mutez then Treasury_Utils.transfer_fee storage.fee_recipient tez_refunds :: operations else operations in + let treasury_vault = Utils.get_vault () in + let operations = Utils.Treasury_Utils.transfer_holdings treasury_vault refund_address token_refunds in + let operations = if tez_refunds > 0mutez then Utils.Treasury_Utils.transfer_fee storage.fee_recipient tez_refunds :: operations else operations in operations, storage [@inline] @@ -1825,9 +1154,9 @@ let cancel_order let ubots = storage.user_batch_ordertypes in let current_time = Tezos.get_now () in let (batch, batch_set, storage) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage storage.batch_set in - let () = if not (Batch_Utils.is_batch_open batch) then failwith cannot_cancel_orders_for_a_batch_that_is_not_open in + let () = if not (Batch_Utils.is_batch_open batch) then failwith Errors.cannot_cancel_orders_for_a_batch_that_is_not_open in match Big_map.find_opt holder ubots with - | None -> failwith no_orders_for_user_address + | None -> failwith Errors.no_orders_for_user_address | Some bot -> let orders_to_remove, storage = remove_order_types batch.batch_number holder bot storage in let storage = remove_orders orders_to_remove batch batch_set storage in refund_orders holder orders_to_remove valid_swap storage @@ -1836,12 +1165,12 @@ let cancel_order let cancel (pair: pair) (storage: storage): result = - let () = reject_if_tez_supplied () in + let () = Utils.reject_if_tez_supplied () in let sender = Tezos.get_sender () in let token_one, token_two = pair in let pair_name = Utils.find_lexicographical_pair_name token_one token_two in match Map.find_opt pair_name storage.valid_swaps with - | None -> failwith swap_does_not_exist + | None -> failwith Errors.swap_does_not_exist | Some vswpr -> let vswp = Utils.valid_swap_reduced_to_valid_swap vswpr 1n storage.valid_tokens in cancel_order pair sender vswp storage @@ -1850,7 +1179,7 @@ let oracle_price_is_not_stale (deposit_time_window: nat) (oracle_price_timestamp: timestamp) : unit = let dtw_i = int deposit_time_window in - if (Tezos.get_now () - dtw_i) < oracle_price_timestamp then () else failwith oracle_price_is_stale + if (Tezos.get_now () - dtw_i) < oracle_price_timestamp then () else failwith Errors.oracle_price_is_stale [@inline] let is_oracle_price_newer_than_current @@ -1859,7 +1188,7 @@ let is_oracle_price_newer_than_current (storage: storage): unit = let rates = storage.rates_current in match Big_map.find_opt rate_name rates with - | Some r -> if r.when >=oracle_price_timestamp then failwith oracle_price_is_not_timely + | Some r -> if r.when >=oracle_price_timestamp then failwith Errors.oracle_price_is_not_timely | None -> () @@ -1871,13 +1200,13 @@ let confirm_oracle_price_is_available_before_deposit if Batch_Utils.is_batch_open batch then () else let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap_reduced = get_valid_swap_reduced pair_name storage in - let (lastupdated, _price) = get_oracle_price oracle_price_should_be_available_before_deposit valid_swap_reduced in + let (lastupdated, _price) = get_oracle_price Errors.oracle_price_should_be_available_before_deposit valid_swap_reduced in oracle_price_is_not_stale storage.deposit_time_window_in_seconds lastupdated [@inline] let confirm_swap_pair_is_disabled_prior_to_removal (valid_swap:valid_swap) : unit = - if valid_swap.is_disabled_for_deposits then () else failwith cannot_remove_swap_pair_that_is_not_disabled + if valid_swap.is_disabled_for_deposits then () else failwith Errors.cannot_remove_swap_pair_that_is_not_disabled [@inline] @@ -1886,9 +1215,9 @@ let enforce_correct_side (valid_swap:valid_swap_reduced) : unit = let swap = order.swap in if order.side = 0n then - if swap.from.token.name = valid_swap.swap.from then () else failwith incorrect_side_specified + if swap.from.token.name = valid_swap.swap.from then () else failwith Errors.incorrect_side_specified else - if swap.from.token.name = valid_swap.swap.to then () else failwith incorrect_side_specified + if swap.from.token.name = valid_swap.swap.to then () else failwith Errors.incorrect_side_specified (* Register a deposit during a valid (Open) deposit time; fails otherwise. Updates the current_batch if the time is valid but the new batch was not initialized. *) @@ -1898,12 +1227,12 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = let current_time = Tezos.get_now () in let pair_name = Utils.get_rate_name_from_pair pair in let valid_swap = get_valid_swap_reduced pair_name storage in - if valid_swap.is_disabled_for_deposits then failwith swap_is_disabled_for_deposits else + if valid_swap.is_disabled_for_deposits then failwith Errors.swap_is_disabled_for_deposits else let () = enforce_correct_side external_order valid_swap in let fee_amount_in_mutez = storage.fee_in_mutez in let fee_provided = Tezos.get_amount () in - if fee_provided < fee_amount_in_mutez then failwith insufficient_swap_fee else - if fee_provided > fee_amount_in_mutez then failwith more_tez_sent_than_fee_cost else + if fee_provided < fee_amount_in_mutez then failwith Errors.insufficient_swap_fee else + if fee_provided > fee_amount_in_mutez then failwith Errors.more_tez_sent_than_fee_cost else let (current_batch, current_batch_set, storage) = Batch_Utils.get_current_batch storage.deposit_time_window_in_seconds pair current_time storage storage.batch_set in if Batch_Utils.can_deposit current_batch then let () = confirm_oracle_price_is_available_before_deposit pair current_batch storage in @@ -1913,20 +1242,20 @@ let deposit (external_order: external_swap_order) (storage : storage) : result = let order : swap_order = external_to_order external_order next_order_number current_batch_number storage.valid_tokens storage.valid_swaps in (* We intentionally limit the amount of distinct orders that can be placed whilst unredeemed orders exist for a given user *) if Ubots.is_within_limit order.trader storage.user_batch_ordertypes then - let updated_storage = Batch_Utils.update_storage_with_order order next_order_number current_batch_number current_batch current_batch_set storage in + let _,updated_storage = Batch_Utils.update_storage_with_order order next_order_number current_batch_number current_batch current_batch_set storage in let treasury_ops = Treasury.deposit order.trader order.swap.from in (treasury_ops, updated_storage) else - failwith too_many_unredeemed_orders + failwith Errors.too_many_unredeemed_orders else - failwith no_open_batch + failwith Errors.no_open_batch [@inline] let redeem (storage : storage) : result = let holder = Tezos.get_sender () in - let () = reject_if_tez_supplied () in + let () = Utils.reject_if_tez_supplied () in let (tokens_transfer_ops, new_storage) = Treasury.redeem holder storage in (tokens_transfer_ops, new_storage) @@ -1962,11 +1291,11 @@ let convert_oracle_price let change_oracle_price_source (source_change: oracle_source_change) (storage: storage) : result = - let _ = is_administrator storage in - let () = reject_if_tez_supplied () in + let _ = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let valid_swap_reduced = get_valid_swap_reduced source_change.pair_name storage in let valid_swap = { valid_swap_reduced with oracle_address = source_change.oracle_address; oracle_asset_name = source_change.oracle_asset_name; oracle_precision = source_change.oracle_precision; } in - let _ = get_oracle_price unable_to_get_price_from_new_oracle_source valid_swap_reduced in + let _ = get_oracle_price Errors.unable_to_get_price_from_new_oracle_source valid_swap_reduced in let updated_swaps = Map.update source_change.pair_name (Some valid_swap) storage.valid_swaps in let storage = { storage with valid_swaps = updated_swaps} in no_op (storage) @@ -1977,11 +1306,12 @@ let tick_price (valid_swap : valid_swap) (storage : storage) : storage = let valid_swap_reduced = Utils.valid_swap_to_valid_swap_reduced valid_swap in - let (lastupdated, price) = get_oracle_price unable_to_get_price_from_oracle valid_swap_reduced in + let (lastupdated, price) = get_oracle_price Errors.unable_to_get_price_from_oracle valid_swap_reduced in let () = is_oracle_price_newer_than_current rate_name lastupdated storage in let () = oracle_price_is_not_stale storage.deposit_time_window_in_seconds lastupdated in let oracle_rate = convert_oracle_price valid_swap.oracle_precision valid_swap.swap lastupdated price storage.valid_tokens in - let storage = Utils.update_current_rate (rate_name) (oracle_rate) (storage) in + let rates_current = Utils.update_current_rate (rate_name) (oracle_rate) (storage.rates_current) in + let storage = { storage with rates_current = rates_current; } in let pair = Utils.pair_of_rate oracle_rate in let current_time = Tezos.get_now () in let batch_set = storage.batch_set in @@ -1997,19 +1327,19 @@ let tick_price let tick (rate_name: string) (storage : storage) : result = - let () = reject_if_tez_supplied () in + let () = Utils.reject_if_tez_supplied () in match Map.find_opt rate_name storage.valid_swaps with | Some vswpr -> let vswp = Utils.valid_swap_reduced_to_valid_swap vswpr 1n storage.valid_tokens in let storage = tick_price rate_name vswp storage in no_op (storage) - | None -> failwith swap_does_not_exist + | None -> failwith Errors.swap_does_not_exist [@inline] let change_fee (new_fee: tez) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let storage = { storage with fee_in_mutez = new_fee; } in no_op storage @@ -2017,8 +1347,8 @@ let change_fee let change_admin_address (new_admin_address: address) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let () = admin_and_fee_recipient_address_are_different new_admin_address storage.fee_recipient in let storage = { storage with administrator = new_admin_address; } in no_op storage @@ -2027,8 +1357,8 @@ let change_admin_address let change_fee_recipient_address (new_fee_recipient_address: address) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let () = admin_and_fee_recipient_address_are_different new_fee_recipient_address storage.administrator in let storage = { storage with fee_recipient = new_fee_recipient_address; } in no_op storage @@ -2037,11 +1367,11 @@ let change_fee_recipient_address let add_token_swap_pair (valid_swap: valid_swap) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in - if valid_swap.swap.from.token.decimals < minimum_precision then failwith swap_precision_is_less_than_minimum else - if valid_swap.swap.to.decimals < minimum_precision then failwith swap_precision_is_less_than_minimum else - if valid_swap.oracle_precision <> minimum_precision then failwith oracle_must_be_equal_to_minimum_precision else + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in + if valid_swap.swap.from.token.decimals < Constants.minimum_precision then failwith Errors.swap_precision_is_less_than_minimum else + if valid_swap.swap.to.decimals < Constants.minimum_precision then failwith Errors.swap_precision_is_less_than_minimum else + if valid_swap.oracle_precision <> Constants.minimum_precision then failwith Errors.oracle_must_be_equal_to_minimum_precision else let (u_swaps,u_tokens) = Tokens.add_pair storage.limit_on_tokens_or_pairs valid_swap storage.valid_swaps storage.valid_tokens in let storage = { storage with valid_swaps = u_swaps; valid_tokens = u_tokens; } in no_op storage @@ -2050,8 +1380,8 @@ let add_token_swap_pair let remove_token_swap_pair (swap: valid_swap) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let () = confirm_swap_pair_is_disabled_prior_to_removal swap in let (u_swaps,u_tokens) = Tokens.remove_pair swap storage.valid_swaps storage.valid_tokens in let storage = { storage with valid_swaps = u_swaps; valid_tokens = u_tokens; } in @@ -2061,8 +1391,8 @@ let remove_token_swap_pair let add_or_update_metadata (metadata_update: metadata_update) (storage:storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let updated_metadata = match Big_map.find_opt metadata_update.key storage.metadata with | None -> Big_map.add metadata_update.key metadata_update.value storage.metadata | Some _ -> Big_map.update metadata_update.key (Some metadata_update.value) storage.metadata @@ -2074,8 +1404,8 @@ let add_or_update_metadata let remove_metadata (key: string) (storage:storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let updated_metadata = Big_map.remove key storage.metadata in let storage = {storage with metadata = updated_metadata } in no_op storage @@ -2085,8 +1415,8 @@ let set_deposit_status (pair_name: string) (disabled: bool) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let valid_swap = get_valid_swap_reduced pair_name storage in let valid_swap = { valid_swap with is_disabled_for_deposits = disabled; } in let valid_swaps = Map.update pair_name (Some valid_swap) storage.valid_swaps in @@ -2097,12 +1427,12 @@ let set_deposit_status let amend_token_and_pair_limit (limit: nat) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in let token_count = Map.size storage.valid_tokens in let pair_count = Map.size storage.valid_swaps in - if limit < token_count then failwith cannot_reduce_limit_on_tokens_to_less_than_already_exists else - if limit < pair_count then failwith cannot_reduce_limit_on_swap_pairs_to_less_than_already_exists else + if limit < token_count then failwith Errors.cannot_reduce_limit_on_tokens_to_less_than_already_exists else + if limit < pair_count then failwith Errors.cannot_reduce_limit_on_swap_pairs_to_less_than_already_exists else let storage = { storage with limit_on_tokens_or_pairs = limit} in no_op (storage) @@ -2110,10 +1440,10 @@ let amend_token_and_pair_limit let change_deposit_time_window (new_window: nat) (storage: storage) : result = - let () = is_administrator storage in - let () = reject_if_tez_supplied () in - if new_window < minimum_deposit_time_in_seconds then failwith cannot_update_deposit_window_to_less_than_the_minimum else - if new_window > maximum_deposit_time_in_seconds then failwith cannot_update_deposit_window_to_more_than_the_maximum else + let () = Utils.is_administrator storage.administrator in + let () = Utils.reject_if_tez_supplied () in + if new_window < Constants.minimum_deposit_time_in_seconds then failwith Errors.cannot_update_deposit_window_to_less_than_the_minimum else + if new_window > Constants.maximum_deposit_time_in_seconds then failwith Errors.cannot_update_deposit_window_to_more_than_the_maximum else let storage = { storage with deposit_time_window_in_seconds = new_window; } in no_op storage diff --git a/batcher/constants.mligo b/batcher/constants.mligo new file mode 100644 index 00000000..26ce0935 --- /dev/null +++ b/batcher/constants.mligo @@ -0,0 +1,30 @@ +#import "@ligo/math-lib/rational/rational.mligo" "Rational" + +(* The constant which represents a 10 basis point difference *) +[@inline] let ten_bips_constant = Rational.div (Rational.new 10001) (Rational.new 10000) + +(* The constant which represents they4j period during which a closed batch will wait before looking for a price, in seconds. *) +[@inline] let price_wait_window_in_seconds : int = 120 + +(* The minimum length of a the scale factor for oracle staleness *) +(* Oracle prices would be considered stale if they are older than scale_factor_for_oracle_staleness * deposit_time_window *) +[@inline] let minimum_scale_factor_for_oracle_staleness : nat = 1n + +(* The maximum length of a the scale factor for oracle staleness *) +(* Oracle prices would be considered stale if they are older than scale_factor_for_oracle_staleness * deposit_time_window *) +[@inline] let maximum_scale_factor_for_oracle_staleness : nat = 10n + +(* The minimum length of a deposit price window *) +[@inline] let minimum_deposit_time_in_seconds : nat = 600n + +(* The maximum length of a deposit price window *) +[@inline] let maximum_deposit_time_in_seconds : nat = 3600n + +[@inline] let fa12_token : string = "FA1.2 token" + +[@inline] let fa2_token : string = "FA2 token" + +[@inline] let limit_of_redeemable_items : nat = 10n + +(* The contract assumes that the minimum precision is six and that the oracle precision must EXACTLY be 6 *) +[@inline] let minimum_precision : nat = 6n diff --git a/batcher/errors.mligo b/batcher/errors.mligo new file mode 100644 index 00000000..d571f728 --- /dev/null +++ b/batcher/errors.mligo @@ -0,0 +1,58 @@ + +[@inline] let no_rate_available_for_swap : nat = 100n +[@inline] let invalid_token_address : nat = 101n +[@inline] let invalid_tezos_address : nat = 102n +[@inline] let no_open_batch : nat = 103n +[@inline] let batch_should_be_cleared : nat = 104n +[@inline] let trying_to_close_batch_which_is_not_open : nat = 105n +[@inline] let unable_to_parse_side_from_external_order : nat = 106n +[@inline] let unable_to_parse_tolerance_from_external_order : nat = 107n +[@inline] let token_standard_not_found : nat = 108n +[@inline] let xtz_not_currently_supported : nat = 109n +[@inline] let unsupported_swap_type : nat = 110n +[@inline] let unable_to_reduce_token_amount_to_less_than_zero : nat = 111n +[@inline] let too_many_unredeemed_orders : nat = 112n +[@inline] let insufficient_swap_fee : nat = 113n +[@inline] let sender_not_administrator : nat = 114n +[@inline] let token_already_exists_but_details_are_different: nat = 115n +[@inline] let swap_already_exists: nat = 116n +[@inline] let swap_does_not_exist: nat = 117n +[@inline] let endpoint_does_not_accept_tez: nat = 118n +[@inline] let number_is_not_a_nat: nat = 119n +[@inline] let oracle_price_is_stale: nat = 120n +[@inline] let oracle_price_is_not_timely: nat = 121n +[@inline] let unable_to_get_price_from_oracle: nat = 122n +[@inline] let unable_to_get_price_from_new_oracle_source: nat = 123n +[@inline] let oracle_price_should_be_available_before_deposit: nat = 124n +[@inline] let swap_is_disabled_for_deposits: nat = 125n +[@inline] let upper_limit_on_tokens_has_been_reached: nat = 126n +[@inline] let upper_limit_on_swap_pairs_has_been_reached: nat = 127n +[@inline] let cannot_reduce_limit_on_tokens_to_less_than_already_exists: nat = 128n +[@inline] let cannot_reduce_limit_on_swap_pairs_to_less_than_already_exists: nat = 129n +[@inline] let more_tez_sent_than_fee_cost : nat = 130n +[@inline] let cannot_update_deposit_window_to_less_than_the_minimum : nat = 131n +[@inline] let cannot_update_deposit_window_to_more_than_the_maximum : nat = 132n +[@inline] let oracle_must_be_equal_to_minimum_precision : nat = 133n +[@inline] let swap_precision_is_less_than_minimum : nat = 134n +[@inline] let cannot_update_scale_factor_to_less_than_the_minimum : nat = 135n +[@inline] let cannot_update_scale_factor_to_more_than_the_maximum : nat = 136n +[@inline] let cannot_remove_swap_pair_that_is_not_disabled : nat = 137n +[@inline] let token_name_not_in_list_of_valid_tokens : nat = 138n +[@inline] let no_orders_for_user_address : nat = 139n +[@inline] let cannot_cancel_orders_for_a_batch_that_is_not_open : nat = 140n +[@inline] let cannot_decrease_holdings_of_removed_batch : nat = 141n +[@inline] let cannot_increase_holdings_of_batch_that_does_not_exist : nat = 142n +[@inline] let batch_already_removed : nat = 143n +[@inline] let admin_and_fee_recipient_address_cannot_be_the_same = 144n +[@inline] let incorrect_market_vault_holder = 145n +[@inline] let incorrect_market_vault_id = 146n +[@inline] let market_vault_tokens_are_different = 147n +[@inline] let unable_to_find_user_holding_for_id = 148n +[@inline] let unable_to_find_vault_holding_for_id = 149n +[@inline] let user_in_holding_is_incorrect = 150n +[@inline] let no_holding_in_market_maker_for_holder = 151n +[@inline] let no_market_vault_for_token = 152n +[@inline] let holding_amount_to_redeem_is_larger_than_holding = 153n +[@inline] let holding_shares_greater_than_total_shares_remaining = 154n +[@inline] let no_holdings_to_claim = 155n +[@inline] let incorrect_side_specified = 156n diff --git a/batcher/marketmaker.mligo b/batcher/marketmaker.mligo index 1b621d1d..371199e9 100644 --- a/batcher/marketmaker.mligo +++ b/batcher/marketmaker.mligo @@ -1,39 +1,27 @@ #import "@ligo/math-lib/rational/rational.mligo" "Rational" #import "types.mligo" "Types" +#import "utils.mligo" "Utils" +#import "errors.mligo" "Errors" type token = Types.token - +type side = Types.side type token_amount = Types.token_amount - type token_amount_map = Types.token_amount_map - -type market_maker_vault = { - total_shares: nat; - holdings: nat set; - native_token: token_amount; - foreign_tokens: token_amount_map; -} - -type market_vaults = (string, market_maker_vault) big_map - -type market_vault_holding = { - id: nat; - token: string; - holder: address; - shares: nat; - unclaimed: tez; -} - -type user_holding_key = address * string - -type user_holdings = (user_holding_key, nat) big_map - -type vault_holdings = (nat, market_vault_holding) big_map - -type metadata = Shared.metadata - -type metadata_update = Shared.metadata_update +type market_maker_vault = Types.market_maker_vault +type market_vaults = Types.market_vaults +type market_vault_holding = Types.market_vault_holding +type valid_swaps = Types.valid_swaps +type valid_tokens = Types.valid_tokens +type exchange_rate = Types.exchange_rate +type user_holding_key = Types.user_holding_key +type user_holdings = Types.user_holdings +type vault_holdings = Types.vault_holdings +type metadata = Types.metadata +type metadata_update = Types.metadata_update +type swap_order = Types.swap_order +type batch = Types.batch +type batch_set = Types.batch_set module Storage = struct @@ -51,8 +39,17 @@ module Storage = struct } end + module MarketVaultUtils = struct +[@inline] +let deposit + (deposit_address : address) + (deposited_token : token_amount) : operation list = + let treasury_vault = Utils.get_vault () in + let deposit_op = Utils.Treasury_Utils.handle_transfer deposit_address treasury_vault deposited_token in + [ deposit_op] + let find_liquidity_amount (rate:exchange_rate) (total_liquidity:nat) @@ -75,7 +72,7 @@ let create_liq_order { order_number = non; batch_number = bn; - trader = Treasury.get_treasury_vault (); + trader = Utils.get_vault (); swap = { from = { token = from_token; @@ -88,7 +85,7 @@ let create_liq_order redeemed = false; } - +(* let inject_buy_side_liquidity (non: nat) (last_rate:exchange_rate) @@ -97,8 +94,7 @@ let inject_buy_side_liquidity (batch_set: batch_set) (storage: Storage.t): batch * Storage.t = let (buy_token,sell_token) = batch.pair in - let mm = storage.market_maker in - match Big_map.find_opt buy_token mm.vaults with + match Big_map.find_opt buy_token storage.vaults with | None -> batch,storage | Some v -> let liq_amount = find_liquidity_amount last_rate v.native_token.amount sell_volume in let order = create_liq_order batch.batch_number non buy_token sell_token Buy liq_amount storage.valid_tokens in @@ -130,6 +126,7 @@ let inject_jit_liquidity if (buy_volume > 0n) && (sell_volume = 0n) then inject_sell_side_liquidity next_order_number last_rate buy_volume batch batch_set storage else if (buy_volume = 0n) && (sell_volume > 0n) then inject_buy_side_liquidity next_order_number last_rate sell_volume batch batch_set storage else batch,storage +*) let create_or_update_market_vault_holding (id: nat) @@ -144,8 +141,8 @@ let create_or_update_market_vault_holding shares = token_amount.amount; unclaimed = 0mutez; } - | Some ph -> if not (ph.holder = holder) then failwith incorrect_market_vault_holder else - if not (ph.id = id) then failwith incorrect_market_vault_id else + | Some ph -> if not (ph.holder = holder) then failwith Errors.incorrect_market_vault_holder else + if not (ph.id = id) then failwith Errors.incorrect_market_vault_id else { ph with shares = ph.shares + token_amount.amount; } let create_or_update_market_maker_vault @@ -157,10 +154,10 @@ let create_or_update_market_maker_vault total_shares = token_amount.amount; holdings = Set.literal [ id ]; native_token = token_amount; - foreign_tokens = TokenAmountMap.new; + foreign_tokens = Utils.TokenAmountMap.new; } | Some mmv -> let nt = mmv.native_token in - if not Token_Utils.are_equivalent_tokens token_amount.token nt.token then failwith token_already_exists_but_details_are_different else + if not Utils.are_equivalent_tokens token_amount.token nt.token then failwith Errors.token_already_exists_but_details_are_different else let shares = mmv.total_shares + token_amount.amount in let native_token = { nt with amount = nt.amount + token_amount.amount; } in let hldgs = if Set.mem id mmv.holdings then mmv.holdings else Set.add id mmv.holdings in @@ -173,9 +170,9 @@ let add_liquidity (new_holding_id: nat) (holder: address) (token_amount: token_amount) - (market_maker: market_maker): market_maker = + (storage: Storage.t): Storage.t = let token_name = token_amount.token.name in - let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let vault_opt = Big_map.find_opt token_name storage.vaults in let new_holding = { id = new_holding_id; token = token_amount.token.name; @@ -184,10 +181,10 @@ let add_liquidity unclaimed = 0mutez; } in let vault = create_or_update_market_maker_vault new_holding_id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let uhs = Big_map.add h_key new_holding_id market_maker.user_holdings in - let vhs = Big_map.add new_holding_id new_holding market_maker.vault_holdings in - { market_maker with + let vts = Big_map.update token_name (Some vault) storage.vaults in + let uhs = Big_map.add h_key new_holding_id storage.user_holdings in + let vhs = Big_map.add new_holding_id new_holding storage.vault_holdings in + { storage with vaults = vts; vault_holdings = vhs; user_holdings = uhs; @@ -199,38 +196,36 @@ let update_liquidity (id: nat) (holder: address) (token_amount: token_amount) - (market_maker: market_maker): market_maker = + (storage: Storage.t): Storage.t = let token_name = token_amount.token.name in - let vault_opt = Big_map.find_opt token_name market_maker.vaults in + let vault_opt = Big_map.find_opt token_name storage.vaults in let vault = create_or_update_market_maker_vault id token_amount vault_opt in - let vts = Big_map.update token_name (Some vault) market_maker.vaults in - let vh_opt = Big_map.find_opt id market_maker.vault_holdings in - if vh_opt = (None: market_vault_holding option) then failwith unable_to_find_vault_holding_for_id else + let vts = Big_map.update token_name (Some vault) storage.vaults in + let vh_opt = Big_map.find_opt id storage.vault_holdings in + if vh_opt = (None: market_vault_holding option) then failwith Errors.unable_to_find_vault_holding_for_id else let vh = Option.unopt vh_opt in - let () = Shared.assert_or_fail_with (vh.holder = holder) user_in_holding_is_incorrect in + let () = Utils.assert_or_fail_with (vh.holder = holder) Errors.user_in_holding_is_incorrect in let vh = {vh with shares = vh.shares + token_amount.amount; } in - let vhs = Big_map.update id (Some vh) market_maker.vault_holdings in - { market_maker with + let vhs = Big_map.update id (Some vh) storage.vault_holdings in + { storage with vaults = vts; vault_holdings = vhs; - user_holdings = market_maker.user_holdings; + user_holdings = storage.user_holdings; } let add_liquidity_to_market_maker (holder: address) (token_amount: token_amount) (storage: Storage.t): ( operation list * Storage.t) = - let ops = Treasury.deposit holder token_amount in - let market_maker = storage.market_maker in - let last_holding_id = market_maker.last_holding_id in + let ops = deposit holder token_amount in + let last_holding_id = storage.last_holding_id in let next_holding_id = last_holding_id + 1n in let h_key = (holder, token_amount.token.name) in - let uh_opt = Big_map.find_opt h_key market_maker.user_holdings in - let mm = match uh_opt with - | None -> add_liquidity h_key next_holding_id holder token_amount market_maker - | Some uh_id -> update_liquidity uh_id holder token_amount market_maker + let uh_opt = Big_map.find_opt h_key storage.user_holdings in + let storage = match uh_opt with + | None -> add_liquidity h_key next_holding_id holder token_amount storage + | Some uh_id -> update_liquidity uh_id holder token_amount storage in - let storage ={ storage with market_maker = mm; } in (ops, storage) let collect_from_vault @@ -240,11 +235,11 @@ let collect_from_vault let rat_amt = Rational.new (int ta.amount) in let rat_amount_to_redeem = Rational.mul perc_share rat_amt in let amount_to_redeem = Utils.get_rounded_number_lower_bound rat_amount_to_redeem in - if amount_to_redeem > ta.amount then failwith holding_amount_to_redeem_is_larger_than_holding else + if amount_to_redeem > ta.amount then failwith Errors.holding_amount_to_redeem_is_larger_than_holding else let rem =abs ((int ta.amount) - amount_to_redeem) in let ta_rem = {ta with amount = rem; } in let ta_red = {ta with amount = amount_to_redeem; } in - let tam = if ta_red.amount = 0n then tam else TokenAmountMap.increase ta_red tam in + let tam = if ta_red.amount = 0n then tam else Utils.TokenAmountMap.increase ta_red tam in (ta_rem, tam) let collect_tokens_for_redemption @@ -252,16 +247,16 @@ let collect_tokens_for_redemption (perc_share: Rational.t) (shares: nat) (vault: market_maker_vault) = - let tokens = TokenAmountMap.new in + let tokens = Utils.TokenAmountMap.new in let (native,tokens) = collect_from_vault perc_share vault.native_token tokens in - let acc: (Rational.t * token_amount_map * token_amount_map) = (perc_share, TokenAmountMap.new, tokens ) in + let acc: (Rational.t * token_amount_map * token_amount_map) = (perc_share, Utils.TokenAmountMap.new, tokens ) in let collect_redemptions = fun ((ps,rem_t,red_t),(_tn,ta):(Rational.t * token_amount_map * token_amount_map) * (string * token_amount)) -> let (ta_rem,red_t) = collect_from_vault ps ta red_t in - let rem_t = TokenAmountMap.increase ta_rem rem_t in + let rem_t = Utils.TokenAmountMap.increase ta_rem rem_t in (ps,rem_t,red_t) in let (_, foreign_tokens, tokens) = Map.fold collect_redemptions vault.foreign_tokens acc in - if shares > vault.total_shares then failwith holding_shares_greater_than_total_shares_remaining else + if shares > vault.total_shares then failwith Errors.holding_shares_greater_than_total_shares_remaining else let rem_shares = abs (vault.total_shares - shares) in let holdings = Set.remove holding_id vault.holdings in ({ vault with native_token = native; foreign_tokens = foreign_tokens; holdings = holdings; total_shares = rem_shares;} ,tokens) @@ -272,54 +267,49 @@ let remove_liquidity (token_name: string) (h_key: user_holding_key) (vault: market_maker_vault) - (market_maker: market_maker): (operation list * market_maker) = - let vaults = market_maker.vaults in - let user_holdings = market_maker.user_holdings in - let vault_holdings = market_maker.vault_holdings in - let holding = Shared.find_or_fail_with id unable_to_find_vault_holding_for_id vault_holdings in - let () = Shared.assert_or_fail_with (holder = holding.holder) user_in_holding_is_incorrect in + (storage: Storage.t): (operation list * Storage.t) = + let vaults = storage.vaults in + let user_holdings = storage.user_holdings in + let vault_holdings = storage.vault_holdings in + let holding = Utils.find_or_fail_with id Errors.unable_to_find_vault_holding_for_id vault_holdings in + let () = Utils.assert_or_fail_with (holder = holding.holder) Errors.user_in_holding_is_incorrect in let unclaimed_tez = holding.unclaimed in let shares = holding.shares in let total_shares = vault.total_shares in let perc_share = Rational.div (Rational.new (int shares)) (Rational.new (int total_shares)) in let (vault, tam) = collect_tokens_for_redemption id perc_share shares vault in - let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in - let treasury_vault = Treasury.get_treasury_vault () in - let tok_ops = Treasury_Utils.transfer_holdings treasury_vault holder tam in + let tez_op = Utils.Treasury_Utils.transfer_fee holder unclaimed_tez in + let treasury_vault = Utils.get_vault () in + let tok_ops = Utils.Treasury_Utils.transfer_holdings treasury_vault holder tam in let vaults = Big_map.update token_name (Some vault) vaults in let user_holdings = Big_map.remove h_key user_holdings in let vault_holdings = Big_map.remove id vault_holdings in let ops: operation list =if unclaimed_tez > 0mutez then tez_op :: tok_ops else tok_ops in - let mm = { market_maker with user_holdings = user_holdings; vault_holdings = vault_holdings; vaults = vaults; } in - (ops, mm) + let storage = { storage with user_holdings = user_holdings; vault_holdings = vault_holdings; vaults = vaults; } in + (ops, storage) let remove_liquidity_from_market_maker (holder: address) (token_name: string) (storage: Storage.t): ( operation list * Storage.t) = - let market_maker = storage.market_maker in let h_key = (holder, token_name) in - let uh_opt: nat option = Big_map.find_opt h_key market_maker.user_holdings in - let v_opt = Big_map.find_opt token_name market_maker.vaults in - let () = Shared.assert_some_or_fail_with uh_opt no_holding_in_market_maker_for_holder in - let () = Shared.assert_some_or_fail_with v_opt no_market_vault_for_token in - let (ops, mm) = remove_liquidity (Option.unopt uh_opt) holder token_name h_key (Option.unopt v_opt) market_maker in - let storage = { storage with market_maker = mm; } in - (ops, storage) + let uh_opt: nat option = Big_map.find_opt h_key storage.user_holdings in + let v_opt = Big_map.find_opt token_name storage.vaults in + let () = Utils.assert_some_or_fail_with uh_opt Errors.no_holding_in_market_maker_for_holder in + let () = Utils.assert_some_or_fail_with v_opt Errors.no_market_vault_for_token in + remove_liquidity (Option.unopt uh_opt) holder token_name h_key (Option.unopt v_opt) storage let claim_from_holding (holder:address) (id:nat) (holding: market_vault_holding) - (market_maker: market_maker) (storage: Storage.t) : (operation list * Storage.t) = let unclaimed_tez = holding.unclaimed in - if unclaimed_tez = 0mutez then failwith no_holdings_to_claim else + if unclaimed_tez = 0mutez then failwith Errors.no_holdings_to_claim else let holding = { holding with unclaimed = 0tez; } in - let tez_op = Treasury_Utils.transfer_fee holder unclaimed_tez in - let vault_holdings = Big_map.update id (Some holding) market_maker.vault_holdings in - let market_maker = {market_maker with vault_holdings = vault_holdings;} in - let storage = { storage with market_maker = market_maker; } in + let tez_op = Utils.Treasury_Utils.transfer_fee holder unclaimed_tez in + let vault_holdings = Big_map.update id (Some holding) storage.vault_holdings in + let storage = {storage with vault_holdings = vault_holdings;} in ([tez_op], storage) @@ -327,21 +317,20 @@ let claim_rewards (holder:address) (token_name:string) (storage:Storage.t) : (operation list * Storage.t) = - let market_maker = storage.market_maker in let h_key = (holder, token_name) in - match Big_map.find_opt h_key market_maker.user_holdings with - | None -> failwith no_holdings_to_claim - | Some id -> (match Big_map.find_opt id market_maker.vault_holdings with - | None -> failwith no_holdings_to_claim - | Some h ->claim_from_holding holder id h market_maker storage) + match Big_map.find_opt h_key storage.user_holdings with + | None -> failwith Errors.no_holdings_to_claim + | Some id -> (match Big_map.find_opt id storage.vault_holdings with + | None -> failwith Errors.no_holdings_to_claim + | Some h ->claim_from_holding holder id h storage) end -type storage = Storage.t -type result = operation list * storage + +type result = operation list * Storage.t [@inline] -let no_op (s : storage) : result = (([] : operation list), s) +let no_op (s : Storage.t) : result = (([] : operation list), s) type entrypoint = | RemoveLiquidity of string @@ -353,8 +342,8 @@ type entrypoint = [@inline] let add_liquidity (token_amount: token_amount) - (storage: storage) : result = - let () = reject_if_tez_supplied () in + (storage: Storage.t) : result = + let () = Utils.reject_if_tez_supplied () in let holder = Tezos.get_sender () in MarketVaultUtils.add_liquidity_to_market_maker holder token_amount storage @@ -362,8 +351,8 @@ let add_liquidity [@inline] let claim (token_name: string) - (storage: storage) : result = - let () = reject_if_tez_supplied () in + (storage: Storage.t) : result = + let () = Utils.reject_if_tez_supplied () in let holder = Tezos.get_sender () in MarketVaultUtils.claim_rewards holder token_name storage @@ -371,8 +360,8 @@ let claim [@inline] let remove_liquidity (token_name: string) - (storage: storage) : result = - let () = reject_if_tez_supplied () in + (storage: Storage.t) : result = + let () = Utils.reject_if_tez_supplied () in let holder = Tezos.get_sender () in MarketVaultUtils.remove_liquidity_from_market_maker holder token_name storage @@ -389,11 +378,10 @@ type vault_holdings_summary = [@view] -let get_market_vault_holdings ((), storage : unit * storage) : vault_holdings_summary = - let mm = storage.market_maker in - let vaults = mm.vaults in - let user_holdings = mm.user_holdings in - let vault_holdings = mm.vault_holdings in +let get_market_vault_holdings ((), storage : unit * Storage.t) : vault_holdings_summary = + let vaults = storage.vaults in + let user_holdings = storage.user_holdings in + let vault_holdings = storage.vault_holdings in let holder = Tezos.get_sender () in let get_tokens = fun (l,(tn,_vt): string list * (string * token)) -> tn :: l in let tokens = Map.fold get_tokens storage.valid_tokens [] in @@ -418,7 +406,7 @@ let get_market_vault_holdings ((), storage : unit * storage) : vault_holdings_su } let main - (action, storage : entrypoint * storage) : operation list * storage = + (action, storage : entrypoint * Storage.t) : operation list * Storage.t = match action with (* Market Liquidity endpoint *) | AddLiquidity t -> add_liquidity t storage diff --git a/batcher/package.json b/batcher/package.json index a5aa12a7..b0affbae 100644 --- a/batcher/package.json +++ b/batcher/package.json @@ -4,8 +4,7 @@ "author": "batcher ", "description": "Batcher for exchanging tokens", "dependencies": { - "@ligo/math-lib": "^1.0.0", - "ligo-breathalyzer": "^1.4.0", - "ligo-extendable-fa2": "^1.0.4" + "@ligo/math-lib": "^1.1.0", + "ligo-breathalyzer": "^1.4.0" } } diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index ecb25348..dab9518b 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -61,11 +61,5 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_maker = { - vaults = (Big_map.empty: Batcher.market_vaults); - last_holding_id = 0n; - user_holdings = (Big_map.empty: Batcher.user_holdings); - vault_holdings = (Big_map.empty: Batcher.vault_holdings); - }; } diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index 4794d98c..1368c98b 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -61,11 +61,5 @@ let f(_:unit) : Batcher.Storage.t = { administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_maker = { - vaults = (Big_map.empty: Batcher.market_vaults); - last_holding_id = 0n; - user_holdings = (Big_map.empty: Batcher.user_holdings); - vault_holdings = (Big_map.empty: Batcher.vault_holdings); - }; } diff --git a/batcher/storage/marketmaker_storage.ghostnet.mligo b/batcher/storage/marketmaker_storage_ghostnet.mligo similarity index 95% rename from batcher/storage/marketmaker_storage.ghostnet.mligo rename to batcher/storage/marketmaker_storage_ghostnet.mligo index 2b723eb9..cf770de2 100644 --- a/batcher/storage/marketmaker_storage.ghostnet.mligo +++ b/batcher/storage/marketmaker_storage_ghostnet.mligo @@ -51,9 +51,9 @@ let f(_:unit) : MarketMaker.Storage.t = { ]; batcher = ("tz1burnburnburnburnburnburnburjAYjjX" : address); administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); - vaults = (Big_map.empty: Batcher.market_vaults); + vaults = (Big_map.empty: MarketMaker.market_vaults); + limit_on_tokens_or_pairs = 10n; last_holding_id = 0n; user_holdings = (Big_map.empty: MarketMaker.user_holdings); vault_holdings = (Big_map.empty: MarketMaker.vault_holdings); } - diff --git a/batcher/storage/marketmaker_storage_mainnet.mligo b/batcher/storage/marketmaker_storage_mainnet.mligo new file mode 100644 index 00000000..cf770de2 --- /dev/null +++ b/batcher/storage/marketmaker_storage_mainnet.mligo @@ -0,0 +1,59 @@ +#import "../marketmaker.mligo" "MarketMaker" + +let f(_:unit) : MarketMaker.Storage.t = { + metadata = (Big_map.empty : MarketMaker.metadata); + valid_tokens = Map.literal [ + (("tzBTC"), { + token_id = 0n; + name = "tzBTC"; + address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); + decimals = 8n; + standard = Some "FA1.2 token" + }); + (("EURL"),{ + token_id = 0n; + name = "EURL"; + address = Some(("KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS" : address)); + decimals = 6n; + standard = Some "FA2 token" + }); + (("USDT"),{ + token_id = 0n; + name = "USDT"; + address = Some(("KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR" : address)); + decimals = 6n; + standard = Some "FA2 token" + }) + ]; + valid_swaps = Map.literal [ + ("tzBTC/USDT", { + swap = { + from = "tzBTC"; + to = "USDT"; + }; + oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); + oracle_asset_name = "BTC-USDT"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ); + ("tzBTC/EURL", { + swap = { + from = "tzBTC"; + to = "EURL"; + }; + oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); + oracle_asset_name = "BTC-EUR"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ) + ]; + batcher = ("tz1burnburnburnburnburnburnburjAYjjX" : address); + administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); + vaults = (Big_map.empty: MarketMaker.market_vaults); + limit_on_tokens_or_pairs = 10n; + last_holding_id = 0n; + user_holdings = (Big_map.empty: MarketMaker.user_holdings); + vault_holdings = (Big_map.empty: MarketMaker.vault_holdings); +} diff --git a/batcher/test/test.mligo b/batcher/test/test.mligo deleted file mode 100644 index 3a09ae7d..00000000 --- a/batcher/test/test.mligo +++ /dev/null @@ -1,67 +0,0 @@ -#import "ligo-breathalyzer/lib/lib.mligo" "Breath" -#import "./common/helpers.mligo" "Helpers" -#import "./endpoints/user/test_deposits.mligo" "User_Deposits" -#import "./endpoints/user/test_cancellations.mligo" "User_Cancellations" -#import "./endpoints/user/test_redemptions.mligo" "User_Redemptions" -#import "./economics/test_clearing.mligo" "Economics_Clearing" -#import "./endpoints/admin/test_change_fee.mligo" "Admin_Change_Fee" -#import "./endpoints/admin/test_change_admin_address.mligo" "Admin_Change_Admin_Address" -#import "./endpoints/admin/test_change_fee_recipient_address.mligo" "Admin_Change_Fee_Recipient_Address" -#import "./endpoints/admin/test_change_deposit_time_window.mligo" "Admin_Change_Deposit_Time_Window" -#import "./endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo" "Admin_Enable_Disable_Swap_Pair" -#import "./endpoints/admin/test_add_update_remove_metadata.mligo" "Admin_Add_Update_Remove_Metadata" -#import "./endpoints/admin/test_amend_token_pair_limit.mligo" "Admin_Amend_Token_pair_Limit" -#import "./endpoints/admin/test_change_oracle_source_of_pair.mligo" "Admin_Change_Oracle_Source_Of_Pair" -#import "./endpoints/admin/test_add_remove_token_swap_pair.mligo" "Admin_Add_Remove_Token_Swap_Pair" -#import "./market_maker/test_add_update_liquidity.mligo" "Market_Maker_Add_Update_Liquidity" -#import "./market_maker/test_claim_rewards.mligo" "Market_Maker_Claim_Rewards" -#import "./market_maker/test_remove_liquidity.mligo" "Market_Maker_Remove_Liquidity" -#import "./endpoints/maintenance/test_tick.mligo" "Maintenance_Tick" -#import "./economics/test_clearing.mligo" "Economics_Clearing" - - -let contract_can_be_originated = - Breath.Model.case - "test contract" - "can be originated" - (fun (level: Breath.Logger.level) -> - let () = Breath.Logger.log level "Originate Batcher contract" in - let (_, (btc_trader, usdt_trader, eurl_trader)) = Breath.Context.init_default () in - let contracts = Helpers.originate level btc_trader usdt_trader eurl_trader in - let batcher_storage = Breath.Contract.storage_of contracts.batcher in - let batcher_balance = Breath.Contract.balance_of contracts.batcher in - - Breath.Result.reduce [ - Breath.Assert.is_equal "balance" batcher_balance 0tez - ; Helpers.expect_last_order_number batcher_storage 0n - ]) - - -let test_suite = - Breath.Model.suite "Suite for Contract" [ - contract_can_be_originated - ] - -let () = - Breath.Model.run_suites Void - [ - test_suite -(* ; Admin_Change_Fee.test_suite - ; Admin_Change_Admin_Address.test_suite - ; Admin_Change_Fee_Recipient_Address.test_suite - ; Admin_Change_Deposit_Time_Window.test_suite - ; Admin_Enable_Disable_Swap_Pair.test_suite - ; Admin_Amend_Token_pair_Limit.test_suite - ; Admin_Add_Update_Remove_Metadata.test_suite - ; Admin_Change_Oracle_Source_Of_Pair.test_suite - ; Admin_Add_Remove_Token_Swap_Pair.test_suite - ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite - ; User_Deposits.test_suite - ; User_Cancellations.test_suite *) -// ; User_Redemptions.test_suite - ; Market_Maker_Add_Update_Liquidity.test_suite - ; Market_Maker_Claim_Rewards.test_suite - ; Market_Maker_Remove_Liquidity.test_suite - ] - diff --git a/batcher/types.mligo b/batcher/types.mligo index ce65c963..dec0e697 100644 --- a/batcher/types.mligo +++ b/batcher/types.mligo @@ -1,7 +1,4 @@ - - - - +#import "@ligo/math-lib/rational/rational.mligo" "Rational" (* Side of an order, either BUY side or SELL side *) type side = @@ -136,15 +133,56 @@ type sell_exact_token = int type sell_plus_token = int type sell_side = sell_minus_token * sell_exact_token * sell_plus_token +type batch_status = + | Open of { start_time : timestamp } + | Closed of { start_time : timestamp ; closing_time : timestamp } + | Cleared of { at : timestamp; clearing : clearing; rate : exchange_rate } +type volumes = [@layout:comb] { + buy_minus_volume : nat; + buy_exact_volume : nat; + buy_plus_volume : nat; + buy_total_volume : nat; + sell_minus_volume : nat; + sell_exact_volume : nat; + sell_plus_volume : nat; + sell_total_volume : nat; +} + +type pair = string * string +(* This represents the type of order. I.e. buy/sell and which level*) +type ordertype = [@layout:comb] { + side: side; + tolerance: tolerance; +} +(* Mapping order type to total amount of placed orders *) +type ordertypes = (ordertype, nat) map +(* pairing of batch_id and ordertypes. *) +type batch_ordertypes = (nat, ordertypes) map -type market_token = { - circulation: nat; - token: token; +(* Associated user address to a given set of batches and ordertypes *) +type user_batch_ordertypes = (address, batch_ordertypes) big_map +(* Batch of orders for the same pair of tokens *) +type batch = [@layout:comb] { + batch_number: nat; + status : batch_status; + volumes : volumes; + pair : pair; + holdings : nat; + market_vault_used : side option; +} + +type batch_indices = (string, nat) map + +type batches = (nat, batch) big_map + +type batch_set = [@layout:comb] { + current_batch_indices: batch_indices; + batches: batches; } (* Type for contract metadata *) @@ -155,50 +193,51 @@ type metadata_update = { value: bytes; } -let assert_some_or_fail_with - (type a) - (an_opt: a option) - (error: nat) = - match an_opt with - | None -> failwith error - | Some _ -> () - -let assert_or_fail_with - (predicate: bool) - (error: nat) = - if not predicate then failwith error else () - -let find_or_fail_with - (type a b) - (key: a) - (error: nat) - (bmap: (a,b) big_map) : b = - match Big_map.find_opt key bmap with - | None -> failwith error - | Some v -> v - -let bi_map_opt_sn - (type a b) - (f_some: a -> b) - (f_none: unit -> b) - (boxed: a option): b = - match boxed with - | Some v -> f_some v - | None -> f_none () - -let map_opt - (type a b) - (f: a -> b) - (boxed: a option): b option = - match boxed with - | None -> None - | Some v -> Some (f v) - -let bind_opt - (type a b) - (f: a -> b option) - (boxed: a option): b option = - match boxed with - | None -> None - | Some v -> f v +type oracle_price_update = timestamp * nat + +type oracle_source_change = [@layout:comb] { + pair_name: string; + oracle_address: address; + oracle_asset_name: string; + oracle_precision: nat; +} + +(* The tokens that are valid within the contract *) +type valid_tokens = (string, token) map + +(* The swaps of valid tokens that are accepted by the contract *) +type valid_swaps = (string, valid_swap_reduced) map + +(* The current, most up to date exchange rates between tokens *) +type rates_current = (string, exchange_rate) big_map + +type fees = { + to_send: tez; + to_refund: tez; + payer: address; + recipient: address; +} + +type market_maker_vault = { + total_shares: nat; + holdings: nat set; + native_token: token_amount; + foreign_tokens: token_amount_map; +} + +type market_vaults = (string, market_maker_vault) big_map + +type market_vault_holding = { + id: nat; + token: string; + holder: address; + shares: nat; + unclaimed: tez; +} + +type user_holding_key = address * string + +type user_holdings = (user_holding_key, nat) big_map + +type vault_holdings = (nat, market_vault_holding) big_map diff --git a/batcher/utils.mligo b/batcher/utils.mligo index e69de29b..74343083 100644 --- a/batcher/utils.mligo +++ b/batcher/utils.mligo @@ -0,0 +1,566 @@ +#import "types.mligo" "Types" +#import "errors.mligo" "Errors" +#import "constants.mligo" "Constants" +#import "@ligo/math-lib/rational/rational.mligo" "Rational" + +type buy_side = Types.buy_side +type sell_side = Types.sell_side +type token = Types.token +type valid_tokens = Types.valid_tokens +type swap = Types.swap +type swap_reduced = Types.swap_reduced +type valid_swap = Types.valid_swap +type valid_swap_reduced = Types.valid_swap_reduced +type total_cleared_volumes = Types.total_cleared_volumes +type tolerance = Types.tolerance +type exchange_rate = Types.exchange_rate +type clearing = Types.clearing +type side = Types.side +type pair = Types.pair +type batch_indices = Types.batch_indices +type rates_current = Types.rates_current +type external_swap_order = Types.external_swap_order +type token_amount_map = Types.token_amount_map +type token_amount = Types.token_amount +type ordertype = Types.ordertype +type swap_order = Types.swap_order + +[@inline] +let get_vault () : address = Tezos.get_self_address () + +[@inline] +let get_token + (token_name: string) + (tokens: valid_tokens): token = + let tok_opt = Map.find_opt token_name tokens in + match tok_opt with + | Some t -> t + | None -> failwith Errors.unable_to_reduce_token_amount_to_less_than_zero + +[@inline] +let swap_to_swap_reduced + (swap: swap): swap_reduced = + { + from = swap.from.token.name; + to = swap.to.name; + } + +[@inline] +let valid_swap_to_valid_swap_reduced + (valid_swap: valid_swap) : valid_swap_reduced = + let swap_reduced = swap_to_swap_reduced valid_swap.swap in + { + swap = swap_reduced; + oracle_address = valid_swap.oracle_address; + oracle_asset_name = valid_swap.oracle_asset_name; + oracle_precision = valid_swap.oracle_precision; + is_disabled_for_deposits = valid_swap.is_disabled_for_deposits; + } + +[@inline] +let swap_reduced_to_swap + (swap_reduced: swap_reduced) + (from_amount: nat) + (tokens: valid_tokens) : swap = + let from = get_token swap_reduced.from tokens in + let to = get_token swap_reduced.to tokens in + { + from = { + token = from; + amount = from_amount; + }; + to = to; + } + +[@inline] +let valid_swap_reduced_to_valid_swap + (valid_swap_reduced: valid_swap_reduced) + (from_amount: nat) + (tokens: valid_tokens) : valid_swap = + let swap = swap_reduced_to_swap valid_swap_reduced.swap from_amount tokens in + { + swap = swap; + oracle_address = valid_swap_reduced.oracle_address; + oracle_precision = valid_swap_reduced.oracle_precision; + oracle_asset_name = valid_swap_reduced.oracle_asset_name; + is_disabled_for_deposits = valid_swap_reduced.is_disabled_for_deposits; + } + + +[@inline] +let empty_total_cleared_volumes : total_cleared_volumes = { + buy_side_total_cleared_volume = 0n; + buy_side_volume_subject_to_clearing = 0n; + sell_side_total_cleared_volume = 0n; + sell_side_volume_subject_to_clearing = 0n; +} + +[@inline] +let to_nat (i:int): nat = + match is_nat i with + | Some n -> n + | None -> failwith Errors.number_is_not_a_nat + +[@inline] +let gt (a : Rational.t) (b : Rational.t) : bool = not (Rational.lte a b) + +[@inline] +let gte (a : Rational.t) (b : Rational.t) : bool = not (Rational.lt a b) + +let pow (base : int) (pow : int) : int = + let rec iter (acc : int) (rem_pow : int) : int = if rem_pow = 0 then acc else iter (acc * base) (rem_pow - 1) in + iter 1 pow + +(* Get the number with 0 decimal accuracy *) +[@inline] +let get_rounded_number_lower_bound (number : Rational.t) : nat = + let zero_decimal_number = Rational.resolve number 0n in + to_nat zero_decimal_number + +[@inline] +let get_min_number (a : Rational.t) (b : Rational.t) = + if Rational.lte a b then a + else b + +[@inline] +let get_clearing_tolerance + (cp_minus : Rational.t) + (cp_exact : Rational.t) + (cp_plus : Rational.t) : tolerance = + if gte cp_minus cp_exact && gte cp_minus cp_plus then Minus + else if gte cp_exact cp_minus && gte cp_exact cp_plus then Exact + else Plus + +[@inline] +let get_cp_minus + (rate : Rational.t) + (buy_side : buy_side) + (sell_side : sell_side) : Rational.t = + let buy_minus_token, _, _ = buy_side in + let sell_minus_token, sell_exact_token, sell_plus_token = sell_side in + let left_number = Rational.new (buy_minus_token) in + let right_number = Rational.div (Rational.mul (Rational.new (sell_minus_token + sell_exact_token + sell_plus_token)) Constants.ten_bips_constant) rate in + let min_number = get_min_number left_number right_number in + min_number + +[@inline] +let get_cp_exact + (rate : Rational.t) + (buy_side : buy_side) + (sell_side : sell_side) : Rational.t = + let buy_minus_token, buy_exact_token, _ = buy_side in + let _, sell_exact_token, sell_plus_token = sell_side in + let left_number = Rational.new (buy_minus_token + buy_exact_token) in + let right_number = Rational.div (Rational.new (sell_exact_token + sell_plus_token)) rate in + let min_number = get_min_number left_number right_number in + min_number + +[@inline] +let get_cp_plus + (rate : Rational.t) + (buy_side : buy_side) + (sell_side : sell_side) : Rational.t = + let buy_minus_token, buy_exact_token, buy_plus_token = buy_side in + let _, _, sell_plus_token = sell_side in + let left_number = Rational.new (buy_minus_token + buy_exact_token + buy_plus_token) in + let right_number = Rational.div (Rational.new (sell_plus_token)) (Rational.mul Constants.ten_bips_constant rate) in + let min_number = get_min_number left_number right_number in + min_number + +[@inline] +let get_clearing_price (exchange_rate : exchange_rate) (buy_side : buy_side) (sell_side : sell_side) : clearing = + let rate = exchange_rate.rate in + let cp_minus = get_cp_minus rate buy_side sell_side in + let cp_exact = get_cp_exact rate buy_side sell_side in + let cp_plus = get_cp_plus rate buy_side sell_side in + let rounded_cp_minus = get_rounded_number_lower_bound cp_minus in + let rounded_cp_exact = get_rounded_number_lower_bound cp_exact in + let rounded_cp_plus = get_rounded_number_lower_bound cp_plus in + let clearing_volumes = + { + minus = rounded_cp_minus; + exact = rounded_cp_exact; + plus = rounded_cp_plus + } + in + let clearing_tolerance = get_clearing_tolerance cp_minus cp_exact cp_plus in + { + clearing_volumes = clearing_volumes; + clearing_tolerance = clearing_tolerance; + total_cleared_volumes = empty_total_cleared_volumes; + clearing_rate = exchange_rate + } + +[@inline] +let nat_to_side +(order_side : nat) : side = + if order_side = 0n then Buy + else + if order_side = 1n then Sell + else failwith Errors.unable_to_parse_side_from_external_order + +[@inline] +let nat_to_tolerance (tolerance : nat) : tolerance = + if tolerance = 0n then Minus + else if tolerance = 1n then Exact + else if tolerance = 2n then Plus + else failwith Errors.unable_to_parse_tolerance_from_external_order + +[@inline] +let find_lexicographical_pair_name + (token_one_name: string) + (token_two_name: string) : string = + if token_one_name > token_two_name then + token_one_name ^ "/" ^ token_two_name + else + token_two_name ^ "/" ^ token_one_name + +[@inline] +let get_rate_name_from_swap (s : swap_reduced) : string = + let base_name = s.from in + let quote_name = s.to in + find_lexicographical_pair_name quote_name base_name + +[@inline] +let get_rate_name_from_pair (s : pair) : string = + let base_name, quote_name = s in + find_lexicographical_pair_name quote_name base_name + +[@inline] +let get_inverse_rate_name_from_pair (s : pair) : string = + let base_name, quote_name = s in + find_lexicographical_pair_name quote_name base_name + +[@inline] +let get_current_batch_index + (pair: pair) + (batch_indices: batch_indices): nat = + let rate_name = get_rate_name_from_pair pair in + match Map.find_opt rate_name batch_indices with + | Some cbi -> cbi + | None -> 0n + + +[@inline] +let get_highest_batch_index + (batch_indices: batch_indices) : nat = + let return_highest (acc, (_s, i) : nat * (string * nat)) : nat = if i > acc then + i + else + acc + in + Map.fold return_highest batch_indices 0n + +(** [concat a b] concat [a] and [b]. *) +let concat1 (type a) (left: a list) (right: a list) : a list = + List.fold_right (fun (x, xs: a * a list) -> x :: xs) left right + +(** [rev list] should return the same list reversed. *) +let rev1 (type a) (list: a list) : a list = + List.fold_left (fun (xs, x : a list * a) -> x :: xs) ([] : a list) list + +[@inline] +let update_if_more_recent + (rate_name: string) + (rate: exchange_rate) + (rates_current: rates_current) : rates_current = + match Big_map.find_opt rate_name rates_current with + | None -> Big_map.add rate_name rate rates_current + | Some lr -> if rate.when > lr.when then + Big_map.update rate_name (Some rate) rates_current + else + rates_current + +[@inline] +let update_current_rate (rate_name : string) (rate : exchange_rate) (rates_current : rates_current) = + update_if_more_recent rate_name rate rates_current + +[@inline] +let get_rate_scaling_power_of_10 + (rate : exchange_rate) + (tokens: valid_tokens): Rational.t = + let swap = rate.swap in + let from_token = get_token swap.from tokens in + let to_token = get_token swap.to tokens in + let from_decimals = from_token.decimals in + let to_decimals = to_token.decimals in + let diff = to_decimals - from_decimals in + let abs_diff = int (abs diff) in + let power10 = pow 10 abs_diff in + if diff = 0 then + Rational.new 1 + else + if diff < 0 then + Rational.div (Rational.new 1) (Rational.new power10) + else + (Rational.new power10) + +[@inline] +let scale_on_receive_for_token_precision_difference + (rate : exchange_rate) + (tokens: valid_tokens): exchange_rate = + let scaling_rate = get_rate_scaling_power_of_10 rate tokens in + let adjusted_rate = Rational.mul rate.rate scaling_rate in + { rate with rate = adjusted_rate } + +let assert_some_or_fail_with + (type a) + (an_opt: a option) + (error: nat) = + match an_opt with + | None -> failwith error + | Some _ -> () + +let assert_or_fail_with + (predicate: bool) + (error: nat) = + if not predicate then failwith error else () + +let find_or_fail_with + (type a b) + (key: a) + (error: nat) + (bmap: (a,b) big_map) : b = + match Big_map.find_opt key bmap with + | None -> failwith error + | Some v -> v + +let bi_map_opt_sn + (type a b) + (f_some: a -> b) + (f_none: unit -> b) + (boxed: a option): b = + match boxed with + | Some v -> f_some v + | None -> f_none () + +let map_opt + (type a b) + (f: a -> b) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> Some (f v) + +let bind_opt + (type a b) + (f: a -> b option) + (boxed: a option): b option = + match boxed with + | None -> None + | Some v -> f v + +[@inline] +let get_rate_name + (r : exchange_rate): string = + let base_name = r.swap.from in + let quote_name = r.swap.to in + find_lexicographical_pair_name quote_name base_name + + +[@inline] +let pair_of_swap + (side: side) + (swap: swap_reduced): (pair) = + match side with + | Buy -> swap.from, swap.to + | Sell -> swap.to, swap.from + +[@inline] +let pair_of_rate + (r : exchange_rate): pair = pair_of_swap Buy r.swap + +[@inline] +let pair_of_external_swap + (order : external_swap_order): pair = + (* Note: we assume left-handedness - i.e. direction is buy side*) + let swap = order.swap in + let side = nat_to_side order.side in + let swap_reduced = swap_to_swap_reduced swap in + pair_of_swap side swap_reduced + +[@inline] +let are_equivalent_tokens + (given: token) + (test: token) : bool = + given.token_id = test.token_id && + given.name = test.name && + given.address = test.address && + given.decimals = test.decimals && + given.standard = test.standard + +[@inline] +let reject_if_tez_supplied(): unit = + if Tezos.get_amount () < 1mutez then () else failwith Errors.endpoint_does_not_accept_tez + +[@inline] +let is_administrator + (administrator : address) : unit = + if Tezos.get_sender () = administrator then () else failwith Errors.sender_not_administrator + +module TokenAmountMap = struct + + type op = Increase | Decrease + + let new = (Map.empty: token_amount_map) + + let amend + (ta: token_amount) + (op: op) + (tam : token_amount_map): token_amount_map = + let token_name = ta.token.name in + match Map.find_opt token_name tam with + | None -> Map.add token_name ta tam + | Some prev -> let new_amt: nat = match op with + | Increase -> ta.amount + prev.amount + | Decrease -> if ta.amount > prev.amount then + (failwith Errors.unable_to_reduce_token_amount_to_less_than_zero : nat) + else + abs (prev.amount - ta.amount) + in + let new_tamt = { ta with amount = new_amt } in + Map.update token_name (Some new_tamt) tam + + let increase + (ta: token_amount) + (tam : token_amount_map): token_amount_map = + amend ta Increase tam + +end + +module TokenAmount = struct + + let recover + (ot: ordertype) + (amt: nat) + (c: clearing) + (tokens: valid_tokens): token_amount = + let swap = c.clearing_rate.swap in + let token = match ot.side with + | Buy -> get_token swap.from tokens + | Sell -> get_token swap.to tokens + in + { + token = token; + amount = amt; + } +end + +module Treasury_Utils = struct + + type adjustment = INCREASE | DECREASE + type order_list = swap_order list + + type atomic_trans = + [@layout:comb] { + to_ : address; + token_id : nat; + amount : nat; + } + + type transfer_from = { + from_ : address; + tx : atomic_trans list + } + + (* Transferred format for tokens in FA2 standard *) + type fa2_transfer = transfer_from list + + (* Transferred format for tokens in FA12 standard *) + type fa12_transfer = + [@layout:comb] { + [@annot:from] address_from : address; + [@annot:to] address_to : address; + value : nat + } + + + +[@inline] +let transfer_fa12_token + (sender : address) + (receiver : address) + (token_address : address) + (token_amount : nat) : operation = + let transfer_entrypoint : fa12_transfer contract = + match (Tezos.get_entrypoint_opt "%transfer" token_address : fa12_transfer contract option) with + | None -> failwith Errors.invalid_token_address + | Some transfer_entrypoint -> transfer_entrypoint + in + let transfer : fa12_transfer = { + address_from = sender; + address_to = receiver; + value = token_amount + } in + Tezos.transaction transfer 0tez transfer_entrypoint + +[@inline] +let transfer_fa2_token + (sender : address) + (receiver : address) + (token_address : address) + (token_id: nat) + (token_amount : nat) : operation = + let transfer_entrypoint : fa2_transfer contract = + match (Tezos.get_entrypoint_opt "%transfer" token_address : fa2_transfer contract option) with + | None -> failwith Errors.invalid_token_address + | Some transfer_entrypoint -> transfer_entrypoint + in + let transfer : fa2_transfer = [ + { + from_ = sender; + tx = [ + { + to_ = receiver; + token_id = token_id; + amount = token_amount + } + ] + } + ] in + Tezos.transaction transfer 0tez transfer_entrypoint + +(* Transfer the tokens to the appropriate address. This is based on the FA12 and FA2 token standard *) +[@inline] +let transfer_token + (sender : address) + (receiver : address) + (token_address : address) + (token_amount : token_amount) : operation = + match token_amount.token.standard with + | Some standard -> + if standard = Constants.fa12_token then + transfer_fa12_token sender receiver token_address token_amount.amount + else if standard = Constants.fa2_token then + transfer_fa2_token sender receiver token_address token_amount.token.token_id token_amount.amount + else + failwith Errors.token_standard_not_found + | None -> + failwith Errors.token_standard_not_found + +[@inline] +let handle_transfer (sender : address) (receiver : address) (received_token : token_amount) : operation = + match received_token.token.address with + | None -> failwith Errors.xtz_not_currently_supported + | Some token_address -> + transfer_token sender receiver token_address received_token + +[@inline] +let transfer_holdings (treasury_vault : address) (holder: address) (holdings : token_amount_map) : operation list = + let atomic_transfer (operations, (_token_name,ta) : operation list * ( string * token_amount)) : operation list = + let op: operation = handle_transfer treasury_vault holder ta in + op :: operations + in + let op_list = Map.fold atomic_transfer holdings ([] : operation list) + in + op_list + +[@inline] +let transfer_fee (receiver : address) (amount : tez) : operation = + match (Tezos.get_contract_opt receiver : unit contract option) with + | None -> failwith Errors.invalid_tezos_address + | Some rec_address -> Tezos.transaction () amount rec_address + + +end + From 34807349e78d6d131a3f5b5006cac09cfe96a924 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Fri, 8 Sep 2023 11:59:17 +0400 Subject: [PATCH 088/108] Amended tests to work with new split contracts --- batcher/batcher.mligo | 6 +- .../test_add_remove_token_swap_pair.mligo | 13 +-- .../test_add_update_remove_metadata.mligo | 13 +-- .../admin/test_amend_token_pair_limit.mligo | 7 +- .../admin/test_change_admin_address.mligo | 7 +- .../test_change_deposit_time_window.mligo | 9 ++- .../endpoints/admin/test_change_fee.mligo | 5 +- .../test_change_fee_recipient_address.mligo | 7 +- .../test_change_oracle_source_of_pair.mligo | 5 +- ...enable_disable_swap_pair_for_deposit.mligo | 9 ++- .../endpoints/user/test_cancellations.mligo | 3 +- .../endpoints/user/test_deposits.mligo | 6 +- batcher/test/common/helpers.mligo | 13 ++- batcher/test/common/storage.mligo | 79 ++++++++++++++++--- batcher/test/common/utils.mligo | 17 +++- .../test_add_update_liquidity.mligo | 53 +++++++------ .../market_maker/test_claim_rewards.mligo | 14 ++-- .../market_maker/test_remove_liquidity.mligo | 21 ++--- batcher/test/test-batcher.mligo | 4 +- 19 files changed, 194 insertions(+), 97 deletions(-) diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index b1165135..d0f82ce5 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1214,9 +1214,11 @@ let enforce_correct_side (order:external_swap_order) (valid_swap:valid_swap_reduced) : unit = let swap = order.swap in - if order.side = 0n then + let side = Utils.nat_to_side order.side in + match side with + | Buy -> if swap.from.token.name = valid_swap.swap.from then () else failwith Errors.incorrect_side_specified - else + | Sell -> if swap.from.token.name = valid_swap.swap.to then () else failwith Errors.incorrect_side_specified (* Register a deposit during a valid (Open) deposit time; fails otherwise. diff --git a/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo b/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo index bdd798b1..0a4964fa 100644 --- a/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo +++ b/batcher/test/batcher/endpoints/admin/test_add_remove_token_swap_pair.mligo @@ -1,6 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let get_tzbtc_eurl_swap_pair (disabled: bool) @@ -76,7 +77,7 @@ let add_swap_pair_should_fail_if_user_is_non_admin = Breath.Result.reduce [ Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_add_swap_pair + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_add_swap_pair ; Breath.Assert.is_equal "swap pair still does not exist" None added_swap_pair_reduced ]) @@ -97,7 +98,7 @@ let add_swap_pair_should_fail_if_tez_is_supplied = Breath.Result.reduce [ Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_add_swap_pair + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_add_swap_pair ; Breath.Assert.is_equal "swap pair still does not exist" None added_swap_pair_reduced ]) @@ -152,7 +153,7 @@ let remove_swap_pair_should_fail_if_user_is_non_admin = Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist ; act_add_swap_pair ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_remove_swap_pair + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_remove_swap_pair ; Breath.Assert.is_equal "swap pair should still exist" swap_pair_reduced removed_swap_pair_reduced ]) @@ -180,7 +181,7 @@ let remove_swap_pair_should_fail_if_tez_is_supplied = Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist ; act_add_swap_pair ; Breath.Assert.is_equal "swap pair should have been added" swap_pair_reduced added_swap_pair_reduced - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_remove_swap_pair + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_remove_swap_pair ; Breath.Assert.is_equal "swap pair should still exist" swap_pair_reduced removed_swap_pair_reduced ]) @@ -201,7 +202,7 @@ let remove_swap_pair_should_fail_if_swap_does_not_exist = let removed_swap_pair_reduced = Map.find_opt "tzBTC/EURL" r_storage.valid_swaps in Breath.Result.reduce [ Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist - ; Breath.Expect.fail_with_value Batcher.swap_does_not_exist act_remove_swap_pair + ; Breath.Expect.fail_with_value Errors.swap_does_not_exist act_remove_swap_pair ; Breath.Assert.is_equal "swap pair should have been removed" None removed_swap_pair_reduced ]) @@ -222,7 +223,7 @@ let remove_swap_pair_should_fail_if_swap_is_not_disabled = let removed_swap_pair_reduced = Map.find_opt "tzBTC/EURL" r_storage.valid_swaps in Breath.Result.reduce [ Breath.Assert.is_equal "swap pair should not already exist" None swap_pair_does_not_already_exist - ; Breath.Expect.fail_with_value Batcher.cannot_remove_swap_pair_that_is_not_disabled act_remove_swap_pair + ; Breath.Expect.fail_with_value Errors.cannot_remove_swap_pair_that_is_not_disabled act_remove_swap_pair ; Breath.Assert.is_equal "swap pair should have been removed" None removed_swap_pair_reduced ]) diff --git a/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo b/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo index b8e31fb3..b716070c 100644 --- a/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo +++ b/batcher/test/batcher/endpoints/admin/test_add_update_remove_metadata.mligo @@ -1,6 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let test_metadata = ("546573742044617461" : bytes) let updated_test_metadata = ("5570646174656420546573742044617461" : bytes) @@ -67,11 +68,11 @@ let change_metadata_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "metadata should be empty" None initial_metadata - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_add_metadata + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_add_metadata ; Breath.Assert.is_equal "metadata should be empty" None added_meta - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_update_metadata + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_update_metadata ; Breath.Assert.is_equal "metadata should be empty" None updated_meta - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_remove_metadata + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_remove_metadata ; Breath.Assert.is_equal "metadata should be empty" None removed_meta ]) @@ -97,11 +98,11 @@ let change_metadata_should_fail_if_tez_is_supplied = Breath.Result.reduce [ Breath.Assert.is_equal "metadata should be empty" None initial_metadata - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_add_metadata + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_add_metadata ; Breath.Assert.is_equal "metadata should be empty" None added_meta - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_update_metadata + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_update_metadata ; Breath.Assert.is_equal "metadata should be empty" None updated_meta - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_remove_metadata + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_remove_metadata ; Breath.Assert.is_equal "metadata should be empty" None removed_meta ]) diff --git a/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo b/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo index cb13a411..99af6c19 100644 --- a/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo +++ b/batcher/test/batcher/endpoints/admin/test_amend_token_pair_limit.mligo @@ -1,6 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let amend_token_pair_limit_should_succeed_if_user_is_admin = @@ -35,7 +36,7 @@ let amend_token_pair_limit_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_amend_token_pair_limit + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_amend_token_pair_limit ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs ]) @@ -53,7 +54,7 @@ let amend_token_pair_limit_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_amend_token_pair_limit + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_amend_token_pair_limit ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs ]) @@ -71,7 +72,7 @@ let amend_token_pair_limit_should_fail_if_limit_is_less_than_current_tokens = Breath.Result.reduce [ Breath.Assert.is_equal "old limit" 10n old_storage.limit_on_tokens_or_pairs - ; Breath.Expect.fail_with_value Batcher.cannot_reduce_limit_on_tokens_to_less_than_already_exists act_amend_token_pair_limit + ; Breath.Expect.fail_with_value Errors.cannot_reduce_limit_on_tokens_to_less_than_already_exists act_amend_token_pair_limit ; Breath.Assert.is_equal "limit unchanged" 10n new_storage.limit_on_tokens_or_pairs ]) diff --git a/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo b/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo index 56e75965..a89a4a4c 100644 --- a/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_admin_address.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let change_admin_address_should_succeed_if_user_is_admin = @@ -36,7 +37,7 @@ let change_admin_address_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_admin_address + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_change_admin_address ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator ]) @@ -54,7 +55,7 @@ let change_admin_address_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_admin_address + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_change_admin_address ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator ]) @@ -72,7 +73,7 @@ let change_admin_address_should_fail_if_new_address_is_the_same_as_fee_recipient Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator - ; Breath.Expect.fail_with_value Batcher.admin_and_fee_recipient_address_cannot_be_the_same act_change_admin_address + ; Breath.Expect.fail_with_value Errors.admin_and_fee_recipient_address_cannot_be_the_same act_change_admin_address ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator ]) diff --git a/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo b/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo index b4b46e52..94fbf046 100644 --- a/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_deposit_time_window.mligo @@ -1,6 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let change_deposit_time_window_should_succeed_if_user_is_admin = @@ -35,7 +36,7 @@ let change_deposit_time_window_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_deposit_time_window + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_change_deposit_time_window ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds ]) @@ -53,7 +54,7 @@ let change_deposit_time_window_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_deposit_time_window + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_change_deposit_time_window ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds ]) @@ -71,7 +72,7 @@ let change_deposit_time_window_should_fail_if_below_minimum_window = Breath.Result.reduce [ Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds - ; Breath.Expect.fail_with_value Batcher.cannot_update_deposit_window_to_less_than_the_minimum act_change_deposit_time_window + ; Breath.Expect.fail_with_value Errors.cannot_update_deposit_window_to_less_than_the_minimum act_change_deposit_time_window ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds ]) @@ -89,7 +90,7 @@ let change_deposit_time_window_should_fail_if_above_maximum_window = Breath.Result.reduce [ Breath.Assert.is_equal "time window" 600n old_storage.deposit_time_window_in_seconds - ; Breath.Expect.fail_with_value Batcher.cannot_update_deposit_window_to_more_than_the_maximum act_change_deposit_time_window + ; Breath.Expect.fail_with_value Errors.cannot_update_deposit_window_to_more_than_the_maximum act_change_deposit_time_window ; Breath.Assert.is_equal "time window unchanged" 600n new_storage.deposit_time_window_in_seconds ]) diff --git a/batcher/test/batcher/endpoints/admin/test_change_fee.mligo b/batcher/test/batcher/endpoints/admin/test_change_fee.mligo index 6be3d025..bbf524b8 100644 --- a/batcher/test/batcher/endpoints/admin/test_change_fee.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_fee.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let change_fee_should_succeed_if_user_is_admin = @@ -41,7 +42,7 @@ let change_fee_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "old fee" old_fee old_storage.fee_in_mutez - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_fee + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_change_fee ; Breath.Assert.is_equal "old fee is unchanged" old_fee new_storage.fee_in_mutez ]) @@ -60,7 +61,7 @@ let change_fee_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "old fee" old_fee old_storage.fee_in_mutez - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_fee + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_change_fee ; Breath.Assert.is_equal "old fee is unchanged" old_fee new_storage.fee_in_mutez ]) let test_suite = diff --git a/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo b/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo index cb4aef37..c75c2371 100644 --- a/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_fee_recipient_address.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let change_fee_recipient_address_should_succeed_if_user_is_admin = @@ -36,7 +37,7 @@ let change_fee_recipient_address_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_fee_recipient_address + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_change_fee_recipient_address ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator ]) @@ -54,7 +55,7 @@ let change_fee_recipient_address_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.admin.address old_storage.administrator - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_fee_recipient_address + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_change_fee_recipient_address ; Breath.Assert.is_equal "address unchanged" context.admin.address new_storage.administrator ]) @@ -72,7 +73,7 @@ let change_fee_recipient_address_should_fail_if_new_address_is_the_same_as_admin Breath.Result.reduce [ Breath.Assert.is_equal "old address" context.fee_recipient old_storage.fee_recipient - ; Breath.Expect.fail_with_value Batcher.admin_and_fee_recipient_address_cannot_be_the_same act_change_fee_recipient_address + ; Breath.Expect.fail_with_value Errors.admin_and_fee_recipient_address_cannot_be_the_same act_change_fee_recipient_address ; Breath.Assert.is_equal "address unchanged" context.fee_recipient new_storage.fee_recipient ]) diff --git a/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo b/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo index 6018decb..1c16386e 100644 --- a/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo +++ b/batcher/test/batcher/endpoints/admin/test_change_oracle_source_of_pair.mligo @@ -1,6 +1,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let pair = "tzBTC/USDT" let oraclepair = "BTC-USDT" @@ -48,7 +49,7 @@ let change_oracle_source_should_fail_if_the_user_is_non_admin = Breath.Result.reduce [ Breath.Assert.is_equal "new price" new_oracle_price old_price ; Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_change_oracle_source + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_change_oracle_source ; Breath.Assert.is_equal "old address unchanged" oracle.originated_address new_test_swap.oracle_address ]) @@ -71,7 +72,7 @@ let change_oracle_source_should_fail_if_tez_is_sent = Breath.Result.reduce [ Breath.Assert.is_equal "new price" new_oracle_price old_price ; Breath.Assert.is_equal "old address" oracle.originated_address test_swap.oracle_address - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_change_oracle_source + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_change_oracle_source ; Breath.Assert.is_equal "old address unchanged" oracle.originated_address new_test_swap.oracle_address ]) diff --git a/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo b/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo index 5e8e2691..29774969 100644 --- a/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo +++ b/batcher/test/batcher/endpoints/admin/test_enable_disable_swap_pair_for_deposit.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../../../common/helpers.mligo" "Helpers" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" let enable_disable_swap_pair_should_succeed_if_user_is_admin = @@ -42,9 +43,9 @@ let enable_disable_swap_pair_should_fail_if_user_is_not_admin = Breath.Result.reduce [ Breath.Assert.is_equal "pair should be enabled" false initial_pair.is_disabled_for_deposits - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_disable_swap_pair + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_disable_swap_pair ; Breath.Assert.is_equal "pair should still be enabled" false disabled_pair.is_disabled_for_deposits - ; Breath.Expect.fail_with_value Batcher.sender_not_administrator act_enable_swap_pair + ; Breath.Expect.fail_with_value Errors.sender_not_administrator act_enable_swap_pair ; Breath.Assert.is_equal "pair should still be enabled" false enabled_pair.is_disabled_for_deposits ]) @@ -64,9 +65,9 @@ let enable_disable_swap_pair_should_fail_if_tez_is_supplied = Breath.Result.reduce [ Breath.Assert.is_equal "pair should be enabled" false initial_pair.is_disabled_for_deposits - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_disable_swap_pair + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_disable_swap_pair ; Breath.Assert.is_equal "pair should still be enabled" false disabled_pair.is_disabled_for_deposits - ; Breath.Expect.fail_with_value Batcher.endpoint_does_not_accept_tez act_enable_swap_pair + ; Breath.Expect.fail_with_value Errors.endpoint_does_not_accept_tez act_enable_swap_pair ; Breath.Assert.is_equal "pair should still be enabled" false enabled_pair.is_disabled_for_deposits ]) diff --git a/batcher/test/batcher/endpoints/user/test_cancellations.mligo b/batcher/test/batcher/endpoints/user/test_cancellations.mligo index 6163f3b7..4a2c6721 100644 --- a/batcher/test/batcher/endpoints/user/test_cancellations.mligo +++ b/batcher/test/batcher/endpoints/user/test_cancellations.mligo @@ -2,6 +2,7 @@ #import "./../../../common/helpers.mligo" "Helpers" #import "./../../../common/batch.mligo" "Batch" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" type skew = Batch.skew type pressure = Batch.pressure @@ -21,7 +22,7 @@ let cancellation_fail_if_batch_is_closed = let act_cancel = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Cancel pair) 0tez)) in Breath.Result.reduce [ - Breath.Expect.fail_with_value Batcher.cannot_cancel_orders_for_a_batch_that_is_not_open act_cancel + Breath.Expect.fail_with_value Errors.cannot_cancel_orders_for_a_batch_that_is_not_open act_cancel ]) let cancellation_should_succeed = diff --git a/batcher/test/batcher/endpoints/user/test_deposits.mligo b/batcher/test/batcher/endpoints/user/test_deposits.mligo index 3f76012a..04ee16a2 100644 --- a/batcher/test/batcher/endpoints/user/test_deposits.mligo +++ b/batcher/test/batcher/endpoints/user/test_deposits.mligo @@ -2,6 +2,7 @@ #import "./../../../common/helpers.mligo" "Helpers" #import "./../../../common/batch.mligo" "Batch" #import "../../../../batcher.mligo" "Batcher" +#import "../../../../errors.mligo" "Errors" type skew = Batch.skew type pressure = Batch.pressure @@ -55,7 +56,7 @@ let deposit_fail_if_batch_is_closed = Breath.Result.reduce [ act_allow_transfer - ; Breath.Expect.fail_with_value Batcher.no_open_batch act_deposit + ; Breath.Expect.fail_with_value Errors.no_open_batch act_deposit ; Breath.Assert.is_equal "balance" bbalance 0tez ; Helpers.expect_last_order_number bstorage 0n ]) @@ -118,8 +119,7 @@ let deposit_with_incorrect_side_should_fail = Breath.Result.reduce [ act_allow_transfer - ; act_deposit - ; Breath.Expect.fail_with_value Batcher.incorrect_side_specified act_deposit + ; Breath.Expect.fail_with_value Errors.incorrect_side_specified act_deposit ]) let test_suite = diff --git a/batcher/test/common/helpers.mligo b/batcher/test/common/helpers.mligo index 6c5efda3..e4a31b0a 100644 --- a/batcher/test/common/helpers.mligo +++ b/batcher/test/common/helpers.mligo @@ -1,4 +1,5 @@ #import "../../batcher.mligo" "Batcher" +#import "../../marketmaker.mligo" "MarketMaker" #import "../tokens/fa12/main.mligo" "TZBTC" #import "../tokens/fa2/main.mligo" "USDT" #import "../tokens/fa2/main.mligo" "EURL" @@ -11,6 +12,7 @@ type originated = Breath.Contract.originated type originated_contract = (Batcher.entrypoint, Batcher.storage) originated +type originated_mm_contract = (MarketMaker.entrypoint, MarketMaker.Storage.t) originated type swap = Batcher.swap type side = Batcher.side @@ -21,6 +23,7 @@ type level = Breath.Logger.level type test_contracts = { batcher: (Batcher.entrypoint, Batcher.storage) originated; + marketmaker: (MarketMaker.entrypoint, MarketMaker.Storage.t) originated; oracle: (Oracle.entrypoint, Oracle.storage) originated; additional_oracle: (Oracle.entrypoint, Oracle.storage) originated; tzbtc: (TZBTC.parameter, TZBTC.storage) originated; @@ -92,8 +95,11 @@ let originate let eurl = originate_eurl eurl_trader level in let initial_storage = TestStorage.initial_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address in let batcher = TestUtils.originate initial_storage level in + let initial_mm_storage: MarketMaker.Storage.t = TestStorage.initial_mm_storage oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address initial_storage.administrator in + let mm: originated_mm_contract = TestUtils.originate_mm initial_mm_storage level in { batcher = batcher; + marketmaker = mm; oracle = oracle; additional_oracle = additional_oracle; tzbtc = tzbtc; @@ -115,8 +121,11 @@ let originate_with_admin_and_fee_recipient let eurl = originate_eurl eurl_trader level in let initial_storage = TestStorage.initial_storage_with_admin_and_fee_recipient oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address admin.address fee_recipient in let batcher = TestUtils.originate initial_storage level in + let initial_mm_storage : MarketMaker.Storage.t = TestStorage.initial_mm_storage_with_admin oracle.originated_address tzbtc.originated_address usdt.originated_address eurl.originated_address admin.address batcher.originated_address in + let mm : originated_mm_contract = TestUtils.originate_mm initial_mm_storage level in { batcher = batcher; + marketmaker = mm; oracle = oracle; additional_oracle = additional_oracle; tzbtc = tzbtc; @@ -230,7 +239,7 @@ let place_order let add_liquidity (actor: Breath.Context.actor) - (contract: originated_contract) + (contract: originated_mm_contract) (token_name: string) (amount: nat) (valid_tokens: valid_tokens) = @@ -243,7 +252,7 @@ let add_liquidity let remove_liquidity (actor: Breath.Context.actor) - (contract: originated_contract) + (contract: originated_mm_contract) (token_name: string) = Breath.Context.act_as actor (fun (_u:unit) -> (Breath.Contract.transfer_to contract (RemoveLiquidity token_name) 0tez)) diff --git a/batcher/test/common/storage.mligo b/batcher/test/common/storage.mligo index 7746e04d..2a724e58 100644 --- a/batcher/test/common/storage.mligo +++ b/batcher/test/common/storage.mligo @@ -1,4 +1,5 @@ #import "../../batcher.mligo" "Batcher" +#import "../../marketmaker.mligo" "MarketMaker" #import "../tokens/fa12/main.mligo" "TZBTC" #import "../tokens/fa2/main.mligo" "USDT" #import "../tokens/fa2/main.mligo" "EURL" @@ -7,7 +8,8 @@ #import "@ligo/math-lib/rational/rational.mligo" "Rational" type level = Breath.Logger.level -type storage = Batcher.Storage.t +type batcher_storage = Batcher.Storage.t +type mm_storage = MarketMaker.Storage.t let fee_recipient = ("tz1burnburnburnburnburnburnburjAYjjX" : address) let administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address) @@ -61,7 +63,7 @@ let initial_storage_with_admin_and_fee_recipient (usdt_address:address) (eurl_address:address) (admin: address) - (fee_recipient: address): storage = { + (fee_recipient: address): batcher_storage = { metadata = (Big_map.empty : Batcher.metadata); valid_tokens = Map.literal [ (("tzBTC"), { @@ -111,12 +113,6 @@ let initial_storage_with_admin_and_fee_recipient administrator = admin; limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; - market_maker = { - vaults = (Big_map.empty: Batcher.market_vaults); - last_holding_id = 0n; - user_holdings = (Big_map.empty: Batcher.user_holdings); - vault_holdings = (Big_map.empty: Batcher.vault_holdings); - }; } @@ -126,9 +122,72 @@ let initial_storage (oracle_address: address) (tzbtc_address: address) (usdt_address:address) - (eurl_address:address) : storage = + (eurl_address:address) : batcher_storage = initial_storage_with_admin_and_fee_recipient oracle_address tzbtc_address usdt_address eurl_address administrator fee_recipient +let initial_mm_storage_with_admin + (oracle_address: address) + (tzbtc_address: address) + (usdt_address:address) + (eurl_address:address) + (admin: address) + (batcher: address): mm_storage = { + metadata = (Big_map.empty : MarketMaker.metadata); + valid_tokens = Map.literal [ + (("tzBTC"), { + token_id = 0n; + name = "tzBTC"; + address = Some(tzbtc_address); + decimals = 8n; + standard = Some "FA1.2 token" + }); + (("EURL"),{ + token_id = 0n; + name = "EURL"; + address = Some(eurl_address); + decimals = 6n; + standard = Some "FA2 token" + }); + (("USDT"),{ + token_id = 0n; + name = "USDT"; + address = Some(usdt_address); + decimals = 6n; + standard = Some "FA2 token" + }) + ]; + valid_swaps = Map.literal [ + ("tzBTC/USDT", { + swap = { + from = "tzBTC"; + to = "USDT"; + }; + oracle_address = oracle_address ; + oracle_asset_name = "BTC-USDT"; + oracle_precision = 6n; + is_disabled_for_deposits = false + } + ) + ]; + administrator = admin; + limit_on_tokens_or_pairs = 10n; + batcher = batcher; + vaults = (Big_map.empty: MarketMaker.market_vaults); + last_holding_id = 0n; + user_holdings = (Big_map.empty: MarketMaker.user_holdings); + vault_holdings = (Big_map.empty: MarketMaker.vault_holdings); +} + + +let initial_mm_storage + (oracle_address: address) + (tzbtc_address: address) + (usdt_address:address) + (eurl_address:address) + (batcher_address:address): mm_storage = + initial_mm_storage_with_admin oracle_address tzbtc_address usdt_address eurl_address administrator batcher_address + + let oracle_initial_storage = Map.literal [ (("BTC-USDT"), @@ -147,7 +206,7 @@ let oracle_initial_storage = )] let expect_from_storage - (type a) + (type a storage) (name: string) (storage: storage) (selector: storage -> a) diff --git a/batcher/test/common/utils.mligo b/batcher/test/common/utils.mligo index aaf3b93b..727dd697 100644 --- a/batcher/test/common/utils.mligo +++ b/batcher/test/common/utils.mligo @@ -6,10 +6,12 @@ #import "../tokens/fa2/main.mligo" "EURL" #import "../mocks/oracle.mligo" "Oracle" #import "./storage.mligo" "TestStorage" +#import "../../marketmaker.mligo" "MarketMaker" type level = Breath.Logger.level let log = Breath.Logger.log -type storage = Batcher.Storage.t +type batcher_storage = Batcher.Storage.t +type mm_storage = MarketMaker.Storage.t type originated = Breath.Contract.originated type valid_swap = Batcher.valid_swap type external_order = Batcher.external_swap_order @@ -34,7 +36,7 @@ let tolerance_to_nat (tolerance : tolerance) : nat = else 2n let originate -(storage: storage) +(storage: batcher_storage) (level: level) = let () = log level storage in Breath.Contract.originate_uncurried @@ -44,6 +46,17 @@ let originate (storage) (0tez) +let originate_mm +(storage: mm_storage) +(level: level) = + let () = log level storage in + Breath.Contract.originate_uncurried + level + "marketmaker" + (MarketMaker.main) + (storage) + (0tez) + let originate_oracle (storage: oracle_storage) (level: level) = diff --git a/batcher/test/market_maker/test_add_update_liquidity.mligo b/batcher/test/market_maker/test_add_update_liquidity.mligo index 508803ae..15ccf36c 100644 --- a/batcher/test/market_maker/test_add_update_liquidity.mligo +++ b/batcher/test/market_maker/test_add_update_liquidity.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../common/helpers.mligo" "Helpers" #import "../../batcher.mligo" "Batcher" +#import "../../marketmaker.mligo" "MarketMaker" let add_liquidity_should_succeed = @@ -10,26 +11,26 @@ let add_liquidity_should_succeed = "should be successful" (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in - let batcher = context.contracts.batcher in + let mm = context.contracts.marketmaker in let btc_trader = context.btc_trader in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in let token_name = "tzBTC" in let deposit_amount = 2000000n in let allowance = { - spender = batcher.originated_address; + spender = mm.originated_address; value = deposit_amount } in let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_liquidity = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in - let market_maker = bstorage.market_maker in - let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let market_maker = bstorage in + let h_key: MarketMaker.user_holding_key = (btc_trader.address, token_name) in let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in let user_holding = Option.unopt (Big_map.find_opt h_key market_maker.user_holdings) in let vault_holding = Option.unopt (Big_map.find_opt user_holding market_maker.vault_holdings) in @@ -57,37 +58,37 @@ let update_liquidity_for_same_user_should_succeed = "for same user should increase shares " (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in - let batcher = context.contracts.batcher in + let mm = context.contracts.marketmaker in let btc_trader = context.btc_trader in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in let token_name = "tzBTC" in let deposit_amount = 2000000n in let allowance = { - spender = batcher.originated_address; + spender = mm.originated_address; value = deposit_amount } in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_liquidity = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in - let first_market_maker = bstorage.market_maker in - let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let first_market_maker = bstorage in + let h_key: MarketMaker.user_holding_key = (btc_trader.address, token_name) in let first_vault = Option.unopt (Big_map.find_opt token_name first_market_maker.vaults) in let first_user_holding = Option.unopt (Big_map.find_opt h_key first_market_maker.user_holdings) in let first_vault_holding = Option.unopt (Big_map.find_opt first_user_holding first_market_maker.vault_holdings) in let prior_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_second_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_additional_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_additional_liquidity = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in - let ustorage = Breath.Contract.storage_of batcher in + let ustorage = Breath.Contract.storage_of mm in let twice_deposit_amount = abs (2 * deposit_amount) in - let second_market_maker = ustorage.market_maker in + let second_market_maker = ustorage in let second_vault = Option.unopt (Big_map.find_opt token_name second_market_maker.vaults) in let second_user_holding = Option.unopt (Big_map.find_opt h_key second_market_maker.user_holdings) in let second_vault_holding = Option.unopt (Big_map.find_opt second_user_holding second_market_maker.vault_holdings) in @@ -120,30 +121,30 @@ let add_liquidity_for_two_users_should_succeed = "for two users should suceed " (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in - let batcher = context.contracts.batcher in + let mm = context.contracts.marketmaker in let btc_trader = context.btc_trader in let usdt_trader = context.usdt_trader in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in let token_name = "tzBTC" in let deposit_amount = 2000000n in let allowance = { - spender = batcher.originated_address; + spender = mm.originated_address; value = deposit_amount } in let prior_balances_tzbtc = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let prior_balances_usdt = Helpers.get_balances usdt_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer_trader_1 = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity_trader_1 = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_liquidity_trader_1 = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in let act_allow_transfer_trader_2 = Breath.Context.act_as usdt_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity_trader_2 = Helpers.add_liquidity usdt_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_liquidity_trader_2 = Helpers.add_liquidity usdt_trader mm token_name deposit_amount bstorage.valid_tokens in - let bstorage = Breath.Contract.storage_of batcher in - let market_maker = bstorage.market_maker in - let h_key_1: Batcher.user_holding_key = (btc_trader.address, token_name) in - let h_key_2: Batcher.user_holding_key = (usdt_trader.address, token_name) in + let bstorage = Breath.Contract.storage_of mm in + let market_maker = bstorage in + let h_key_1: MarketMaker.user_holding_key = (btc_trader.address, token_name) in + let h_key_2: MarketMaker.user_holding_key = (usdt_trader.address, token_name) in let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in let user_holding_1 = Option.unopt (Big_map.find_opt h_key_1 market_maker.user_holdings) in let vault_holding_1 = Option.unopt (Big_map.find_opt user_holding_1 market_maker.vault_holdings) in diff --git a/batcher/test/market_maker/test_claim_rewards.mligo b/batcher/test/market_maker/test_claim_rewards.mligo index fdc6da74..e7fe7ca3 100644 --- a/batcher/test/market_maker/test_claim_rewards.mligo +++ b/batcher/test/market_maker/test_claim_rewards.mligo @@ -2,6 +2,8 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../common/helpers.mligo" "Helpers" #import "../../batcher.mligo" "Batcher" +#import "../../marketmaker.mligo" "MarketMaker" +#import "../../errors.mligo" "Errors" let claim_should_fail_with_zero_unclaimed = @@ -10,27 +12,27 @@ let claim_should_fail_with_zero_unclaimed = "should fail with zero unclaimed" (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in - let batcher = context.contracts.batcher in + let mm = context.contracts.marketmaker in let btc_trader = context.btc_trader in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in let token_name = "tzBTC" in let deposit_amount = 2000000n in let allowance = { - spender = batcher.originated_address; + spender = mm.originated_address; value = deposit_amount } in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in - let act_claim = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (Claim token_name) 0tez)) in + let act_add_liquidity = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in + let act_claim = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to mm (Claim token_name) 0tez)) in Breath.Result.reduce [ act_allow_transfer ; act_add_liquidity - ; Breath.Expect.fail_with_value Batcher.no_holdings_to_claim act_claim + ; Breath.Expect.fail_with_value Errors.no_holdings_to_claim act_claim ]) let test_suite = diff --git a/batcher/test/market_maker/test_remove_liquidity.mligo b/batcher/test/market_maker/test_remove_liquidity.mligo index 633a8ef7..7f31e4b1 100644 --- a/batcher/test/market_maker/test_remove_liquidity.mligo +++ b/batcher/test/market_maker/test_remove_liquidity.mligo @@ -2,6 +2,7 @@ #import "ligo-breathalyzer/lib/lib.mligo" "Breath" #import "./../common/helpers.mligo" "Helpers" #import "../../batcher.mligo" "Batcher" +#import "../../marketmaker.mligo" "MarketMaker" let remove_liquidity_should_succeed = @@ -10,37 +11,37 @@ let remove_liquidity_should_succeed = "should be successful" (fun (level: Breath.Logger.level) -> let context = Helpers.test_context level in - let batcher = context.contracts.batcher in + let mm = context.contracts.marketmaker in let btc_trader = context.btc_trader in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in let token_name = "tzBTC" in let deposit_amount = 2000000n in let allowance = { - spender = batcher.originated_address; + spender = mm.originated_address; value = deposit_amount } in let initial_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in let act_allow_transfer = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to context.contracts.tzbtc (Approve allowance) 0tez)) in - let act_add_liquidity = Helpers.add_liquidity btc_trader batcher token_name deposit_amount bstorage.valid_tokens in + let act_add_liquidity = Helpers.add_liquidity btc_trader mm token_name deposit_amount bstorage.valid_tokens in let after_addition_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in - let bstorage = Breath.Contract.storage_of batcher in + let bstorage = Breath.Contract.storage_of mm in - let market_maker = bstorage.market_maker in - let h_key: Batcher.user_holding_key = (btc_trader.address, token_name) in + let market_maker = bstorage in + let h_key: MarketMaker.user_holding_key = (btc_trader.address, token_name) in let vault = Option.unopt (Big_map.find_opt token_name market_maker.vaults) in let user_holding = Option.unopt (Big_map.find_opt h_key market_maker.user_holdings) in let vault_holding = Option.unopt (Big_map.find_opt user_holding market_maker.vault_holdings) in - let act_remove_liquidity = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to batcher (RemoveLiquidity token_name) 0tez)) in + let act_remove_liquidity = Breath.Context.act_as btc_trader (fun (_u:unit) -> (Breath.Contract.transfer_to mm (RemoveLiquidity token_name) 0tez)) in let after_removal_balances = Helpers.get_balances btc_trader.address context.contracts.tzbtc context.contracts.usdt context.contracts.eurl in - let after_bstorage = Breath.Contract.storage_of batcher in + let after_bstorage = Breath.Contract.storage_of mm in - let after_market_maker = after_bstorage.market_maker in + let after_market_maker = after_bstorage in let after_vault = Option.unopt (Big_map.find_opt token_name after_market_maker.vaults) in let after_user_holding = Big_map.find_opt h_key after_market_maker.user_holdings in diff --git a/batcher/test/test-batcher.mligo b/batcher/test/test-batcher.mligo index ef0a0a20..6c01066f 100644 --- a/batcher/test/test-batcher.mligo +++ b/batcher/test/test-batcher.mligo @@ -43,7 +43,7 @@ let () = Breath.Model.run_suites Void [ test_suite - (* ; Admin_Change_Fee.test_suite + ; Admin_Change_Fee.test_suite ; Admin_Change_Admin_Address.test_suite ; Admin_Change_Fee_Recipient_Address.test_suite ; Admin_Change_Deposit_Time_Window.test_suite @@ -53,7 +53,7 @@ let () = ; Admin_Change_Oracle_Source_Of_Pair.test_suite ; Admin_Add_Remove_Token_Swap_Pair.test_suite ; Maintenance_Tick.test_suite - ; Economics_Clearing.test_suite *) + ; Economics_Clearing.test_suite ; User_Deposits.test_suite ; User_Cancellations.test_suite // ; User_Redemptions.test_suite From 4a8ceda33bd6b7029151ed09a794d92f519977fd Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Tue, 12 Sep 2023 13:31:07 +0400 Subject: [PATCH 089/108] Populated ghostnet storage for marketmaker --- batcher-ui/.eslintrc.js | 8 - batcher-ui/.eslintrc.json | 24 + batcher-ui/.gitignore | 6 +- batcher-ui/.husky/.gitignore | 1 - batcher-ui/.husky/commit-msg | 7 - batcher-ui/.husky/pre-commit | 2 +- batcher-ui/.lintstagedrc.js | 10 + batcher-ui/.prettierignore | 2 - batcher-ui/.prettierrc.js | 5 - batcher-ui/.prettierrc.json | 7 + batcher-ui/.stylelintrc.js | 3 - batcher-ui/Dockerfile.ghostnet | 17 +- batcher-ui/README.md | 44 +- batcher-ui/config/config.dev.ts | 15 - batcher-ui/config/config.ghostnet.ts | 123 - batcher-ui/config/config.mainnet.ts | 123 - batcher-ui/config/config.ts | 49 - batcher-ui/config/defaultSettings.ts | 23 - batcher-ui/config/proxy.ts | 34 - batcher-ui/config/routes.ts | 58 - batcher-ui/global.d.ts | 8 + batcher-ui/img/exchange-dollar.svg | 21 - batcher-ui/img/exchange-euro.svg | 21 - batcher-ui/img/marigold-logo.svg | 24 - batcher-ui/jest.config.js | 1 - batcher-ui/next-env.d.ts | 5 + batcher-ui/next.config.js | 21 + batcher-ui/package-lock.json | 9149 +++++++++++++++++ batcher-ui/package.json | 126 +- batcher-ui/pages/404.tsx | 23 + batcher-ui/pages/_app.tsx | 62 + batcher-ui/pages/about.tsx | 78 + batcher-ui/pages/holdings.tsx | 127 + batcher-ui/pages/index.tsx | 44 + batcher-ui/pages/marketmaker.tsx | 58 + batcher-ui/pages/volumes.tsx | 109 + batcher-ui/playwright.config.ts | 22 - batcher-ui/postcss.config.js | 8 + batcher-ui/{img => public}/batcher-logo.png | Bin batcher-ui/public/favicon.ico | Bin 0 -> 15406 bytes batcher-ui/{img => public}/marigold-logo.png | Bin batcher-ui/src/access.ts | 9 - batcher-ui/src/actions/events.ts | 9 + batcher-ui/src/actions/exchange.ts | 123 + batcher-ui/src/actions/holdings.ts | 23 + batcher-ui/src/actions/index.ts | 18 + batcher-ui/src/actions/marketholdings.ts | 35 + batcher-ui/src/actions/wallet.ts | 39 + batcher-ui/src/app.tsx | 42 - batcher-ui/src/commands/events.ts | 94 + batcher-ui/src/commands/exchange.ts | 112 + batcher-ui/src/commands/holdings.ts | 22 + batcher-ui/src/commands/marketholdings.ts | 21 + batcher-ui/src/commands/wallet.ts | 21 + batcher-ui/src/components/About/index.less | 110 - batcher-ui/src/components/About/index.tsx | 56 - .../src/components/BatcherAction/index.less | 53 - .../src/components/BatcherAction/index.tsx | 49 - batcher-ui/src/components/BatcherInfo.tsx | 58 + .../src/components/BatcherInfo/index.less | 106 - .../src/components/BatcherInfo/index.tsx | 135 - batcher-ui/src/components/BatcherStepper.tsx | 61 + .../src/components/BatcherStepper/index.less | 31 - .../src/components/BatcherStepper/index.tsx | 51 - batcher-ui/src/components/Copy.tsx | 47 + batcher-ui/src/components/Exchange.tsx | 376 + .../src/components/Exchange/customicons.ts | 0 batcher-ui/src/components/Exchange/index.less | 160 - batcher-ui/src/components/Exchange/index.tsx | 351 - batcher-ui/src/components/Footer.tsx | 57 + batcher-ui/src/components/Footer/index.tsx | 36 - batcher-ui/src/components/Holdings/index.less | 121 - batcher-ui/src/components/Holdings/index.tsx | 273 - batcher-ui/src/components/Link.tsx | 28 + batcher-ui/src/components/Menu.tsx | 58 + batcher-ui/src/components/NavBar.tsx | 87 + batcher-ui/src/components/PriceStrategy.tsx | 70 + .../src/components/RightContent/index.less | 116 - .../src/components/RightContent/index.tsx | 158 - batcher-ui/src/components/SelectPair.tsx | 100 + batcher-ui/src/components/Tooltip.tsx | 36 + batcher-ui/src/components/Volume/index.less | 110 - batcher-ui/src/components/Volume/index.tsx | 105 - batcher-ui/src/config/env.ts | 28 + batcher-ui/src/contexts/events.tsx | 35 + batcher-ui/src/contexts/tezos-toolkit.tsx | 31 + batcher-ui/src/contexts/wallet.tsx | 146 + batcher-ui/src/extra_utils/types.ts | 282 - batcher-ui/src/extra_utils/utils.ts | 165 - batcher-ui/src/extra_utils/webSocketUtils.ts | 84 - batcher-ui/src/global.less | 234 - batcher-ui/src/global.tsx | 90 - batcher-ui/src/manifest.json | 22 - batcher-ui/src/pages/404.tsx | 18 - batcher-ui/src/pages/Main.tsx | 920 -- batcher-ui/src/reducers/events.ts | 12 + batcher-ui/src/reducers/exchange.ts | 191 + batcher-ui/src/reducers/holdings.ts | 26 + batcher-ui/src/reducers/index.ts | 58 + batcher-ui/src/reducers/marketholdings.ts | 31 + batcher-ui/src/reducers/wallet.ts | 52 + batcher-ui/src/service-worker.js | 65 - batcher-ui/src/store.ts | 28 + batcher-ui/src/types/contract.ts | 162 + batcher-ui/src/types/events.ts | 109 + batcher-ui/src/types/index.ts | 2 + batcher-ui/src/types/state.ts | 76 + batcher-ui/src/typings.d.ts | 33 - batcher-ui/src/utils/local-storage.ts | 16 + batcher-ui/src/utils/utils.ts | 641 ++ batcher-ui/src/utils/webSocketUtils.ts | 50 + batcher-ui/styles/globals.css | 22 + batcher-ui/tailwind.config.js | 28 + batcher-ui/tsconfig.json | 42 +- batcher/batcher-ghostnet.tz | 4587 --------- batcher/batcher-storage-ghostnet.tz | 14 - batcher/batcher.mligo | 11 + batcher/marketmaker-ghostnet.tz | 981 ++ batcher/marketmaker-storage-ghostnet.tz | 27 + .../marketmaker_storage_ghostnet.mligo | 48 +- .../endpoints/user/test_redemptions.mligo | 1 + batcher/types.mligo | 5 + 122 files changed, 14145 insertions(+), 9263 deletions(-) delete mode 100644 batcher-ui/.eslintrc.js create mode 100644 batcher-ui/.eslintrc.json delete mode 100644 batcher-ui/.husky/.gitignore delete mode 100755 batcher-ui/.husky/commit-msg create mode 100644 batcher-ui/.lintstagedrc.js delete mode 100644 batcher-ui/.prettierrc.js create mode 100644 batcher-ui/.prettierrc.json delete mode 100644 batcher-ui/.stylelintrc.js delete mode 100644 batcher-ui/config/config.dev.ts delete mode 100644 batcher-ui/config/config.ghostnet.ts delete mode 100644 batcher-ui/config/config.mainnet.ts delete mode 100644 batcher-ui/config/config.ts delete mode 100644 batcher-ui/config/defaultSettings.ts delete mode 100644 batcher-ui/config/proxy.ts delete mode 100644 batcher-ui/config/routes.ts create mode 100644 batcher-ui/global.d.ts delete mode 100644 batcher-ui/img/exchange-dollar.svg delete mode 100644 batcher-ui/img/exchange-euro.svg delete mode 100644 batcher-ui/img/marigold-logo.svg create mode 100644 batcher-ui/next-env.d.ts create mode 100644 batcher-ui/next.config.js create mode 100644 batcher-ui/package-lock.json create mode 100644 batcher-ui/pages/404.tsx create mode 100644 batcher-ui/pages/_app.tsx create mode 100644 batcher-ui/pages/about.tsx create mode 100644 batcher-ui/pages/holdings.tsx create mode 100644 batcher-ui/pages/index.tsx create mode 100644 batcher-ui/pages/marketmaker.tsx create mode 100644 batcher-ui/pages/volumes.tsx delete mode 100644 batcher-ui/playwright.config.ts create mode 100644 batcher-ui/postcss.config.js rename batcher-ui/{img => public}/batcher-logo.png (100%) create mode 100644 batcher-ui/public/favicon.ico rename batcher-ui/{img => public}/marigold-logo.png (100%) delete mode 100644 batcher-ui/src/access.ts create mode 100644 batcher-ui/src/actions/events.ts create mode 100644 batcher-ui/src/actions/exchange.ts create mode 100644 batcher-ui/src/actions/holdings.ts create mode 100644 batcher-ui/src/actions/index.ts create mode 100644 batcher-ui/src/actions/marketholdings.ts create mode 100644 batcher-ui/src/actions/wallet.ts delete mode 100644 batcher-ui/src/app.tsx create mode 100644 batcher-ui/src/commands/events.ts create mode 100644 batcher-ui/src/commands/exchange.ts create mode 100644 batcher-ui/src/commands/holdings.ts create mode 100644 batcher-ui/src/commands/marketholdings.ts create mode 100644 batcher-ui/src/commands/wallet.ts delete mode 100644 batcher-ui/src/components/About/index.less delete mode 100644 batcher-ui/src/components/About/index.tsx delete mode 100644 batcher-ui/src/components/BatcherAction/index.less delete mode 100644 batcher-ui/src/components/BatcherAction/index.tsx create mode 100644 batcher-ui/src/components/BatcherInfo.tsx delete mode 100644 batcher-ui/src/components/BatcherInfo/index.less delete mode 100644 batcher-ui/src/components/BatcherInfo/index.tsx create mode 100644 batcher-ui/src/components/BatcherStepper.tsx delete mode 100644 batcher-ui/src/components/BatcherStepper/index.less delete mode 100644 batcher-ui/src/components/BatcherStepper/index.tsx create mode 100644 batcher-ui/src/components/Copy.tsx create mode 100644 batcher-ui/src/components/Exchange.tsx delete mode 100644 batcher-ui/src/components/Exchange/customicons.ts delete mode 100644 batcher-ui/src/components/Exchange/index.less delete mode 100644 batcher-ui/src/components/Exchange/index.tsx create mode 100644 batcher-ui/src/components/Footer.tsx delete mode 100644 batcher-ui/src/components/Footer/index.tsx delete mode 100644 batcher-ui/src/components/Holdings/index.less delete mode 100644 batcher-ui/src/components/Holdings/index.tsx create mode 100644 batcher-ui/src/components/Link.tsx create mode 100644 batcher-ui/src/components/Menu.tsx create mode 100644 batcher-ui/src/components/NavBar.tsx create mode 100644 batcher-ui/src/components/PriceStrategy.tsx delete mode 100644 batcher-ui/src/components/RightContent/index.less delete mode 100644 batcher-ui/src/components/RightContent/index.tsx create mode 100644 batcher-ui/src/components/SelectPair.tsx create mode 100644 batcher-ui/src/components/Tooltip.tsx delete mode 100644 batcher-ui/src/components/Volume/index.less delete mode 100644 batcher-ui/src/components/Volume/index.tsx create mode 100644 batcher-ui/src/config/env.ts create mode 100644 batcher-ui/src/contexts/events.tsx create mode 100644 batcher-ui/src/contexts/tezos-toolkit.tsx create mode 100644 batcher-ui/src/contexts/wallet.tsx delete mode 100644 batcher-ui/src/extra_utils/types.ts delete mode 100644 batcher-ui/src/extra_utils/utils.ts delete mode 100644 batcher-ui/src/extra_utils/webSocketUtils.ts delete mode 100644 batcher-ui/src/global.less delete mode 100644 batcher-ui/src/global.tsx delete mode 100644 batcher-ui/src/manifest.json delete mode 100644 batcher-ui/src/pages/404.tsx delete mode 100644 batcher-ui/src/pages/Main.tsx create mode 100644 batcher-ui/src/reducers/events.ts create mode 100644 batcher-ui/src/reducers/exchange.ts create mode 100644 batcher-ui/src/reducers/holdings.ts create mode 100644 batcher-ui/src/reducers/index.ts create mode 100644 batcher-ui/src/reducers/marketholdings.ts create mode 100644 batcher-ui/src/reducers/wallet.ts delete mode 100644 batcher-ui/src/service-worker.js create mode 100644 batcher-ui/src/store.ts create mode 100644 batcher-ui/src/types/contract.ts create mode 100644 batcher-ui/src/types/events.ts create mode 100644 batcher-ui/src/types/index.ts create mode 100644 batcher-ui/src/types/state.ts delete mode 100644 batcher-ui/src/typings.d.ts create mode 100644 batcher-ui/src/utils/local-storage.ts create mode 100644 batcher-ui/src/utils/utils.ts create mode 100644 batcher-ui/src/utils/webSocketUtils.ts create mode 100644 batcher-ui/styles/globals.css create mode 100644 batcher-ui/tailwind.config.js delete mode 100644 batcher/batcher-ghostnet.tz delete mode 100644 batcher/batcher-storage-ghostnet.tz create mode 100644 batcher/marketmaker-ghostnet.tz create mode 100644 batcher/marketmaker-storage-ghostnet.tz diff --git a/batcher-ui/.eslintrc.js b/batcher-ui/.eslintrc.js deleted file mode 100644 index b882c20e..00000000 --- a/batcher-ui/.eslintrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - extends: [require.resolve('@umijs/fabric/dist/eslint')], - globals: { - ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, - page: true, - REACT_APP_ENV: true, - }, -}; diff --git a/batcher-ui/.eslintrc.json b/batcher-ui/.eslintrc.json new file mode 100644 index 00000000..a4502a8c --- /dev/null +++ b/batcher-ui/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "extends": [ + "eslint:recommended", + "next", + "prettier" + ], + // For more informations, see https://github.com/vercel/next.js/issues/40687#issuecomment-1378845989 + "overrides": [ + { + // Adapt to your needs (e.g. some might want to only override "next.config.js") + "files": [ + "*.js" + ], + // This is the default parser of ESLint + "parser": "espree", + "parserOptions": { + "ecmaVersion": 2020 + } + } + ], + "rules": { + "no-unused-vars": "off" + } +} \ No newline at end of file diff --git a/batcher-ui/.gitignore b/batcher-ui/.gitignore index 21ab9fb7..2f598bde 100644 --- a/batcher-ui/.gitignore +++ b/batcher-ui/.gitignore @@ -17,7 +17,6 @@ yarn-error.log /coverage .idea yarn.lock -package-lock.json pnpm-lock.yaml *bak @@ -28,13 +27,10 @@ pnpm-lock.yaml functions/* .temp/** -# umi -.umi -.umi-production - # screenshot screenshot .firebase .eslintcache build +.next \ No newline at end of file diff --git a/batcher-ui/.husky/.gitignore b/batcher-ui/.husky/.gitignore deleted file mode 100644 index 31354ec1..00000000 --- a/batcher-ui/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/batcher-ui/.husky/commit-msg b/batcher-ui/.husky/commit-msg deleted file mode 100755 index d50cdcf9..00000000 --- a/batcher-ui/.husky/commit-msg +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -# Export Git hook params -export GIT_PARAMS=$* - -npx --no-install fabric verify-commit diff --git a/batcher-ui/.husky/pre-commit b/batcher-ui/.husky/pre-commit index d37daa07..36af2198 100755 --- a/batcher-ui/.husky/pre-commit +++ b/batcher-ui/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx --no-install lint-staged +npx lint-staged diff --git a/batcher-ui/.lintstagedrc.js b/batcher-ui/.lintstagedrc.js new file mode 100644 index 00000000..f85c082b --- /dev/null +++ b/batcher-ui/.lintstagedrc.js @@ -0,0 +1,10 @@ +const path = require('path'); + +const buildEslintCommand = filenames => + `next lint --fix --file ${filenames + .map(f => path.relative(process.cwd(), f)) + .join(' --file ')}`; + +module.exports = { + '*.{js,jsx,ts,tsx}': [buildEslintCommand], +}; diff --git a/batcher-ui/.prettierignore b/batcher-ui/.prettierignore index d17efb44..b3a247ab 100644 --- a/batcher-ui/.prettierignore +++ b/batcher-ui/.prettierignore @@ -1,7 +1,5 @@ **/*.svg package.json -.umi -.umi-production /dist .dockerignore .DS_Store diff --git a/batcher-ui/.prettierrc.js b/batcher-ui/.prettierrc.js deleted file mode 100644 index 7b597d78..00000000 --- a/batcher-ui/.prettierrc.js +++ /dev/null @@ -1,5 +0,0 @@ -const fabric = require('@umijs/fabric'); - -module.exports = { - ...fabric.prettier, -}; diff --git a/batcher-ui/.prettierrc.json b/batcher-ui/.prettierrc.json new file mode 100644 index 00000000..62ee55b4 --- /dev/null +++ b/batcher-ui/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "jsxBracketSameLine": true, + "arrowParens": "avoid", + "tabWidth": 2 +} \ No newline at end of file diff --git a/batcher-ui/.stylelintrc.js b/batcher-ui/.stylelintrc.js deleted file mode 100644 index a1184de4..00000000 --- a/batcher-ui/.stylelintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: [require.resolve('@umijs/fabric/dist/stylelint')], -}; diff --git a/batcher-ui/Dockerfile.ghostnet b/batcher-ui/Dockerfile.ghostnet index 6f76dbae..cbdefdbf 100644 --- a/batcher-ui/Dockerfile.ghostnet +++ b/batcher-ui/Dockerfile.ghostnet @@ -2,18 +2,25 @@ FROM node:latest as builder WORKDIR /app +# ENV ENV=ghostnet + COPY ./package.json ./ RUN npm install COPY ./tsconfig.json ./jsconfig.json ./ +COPY ./pages ./pages COPY ./src ./src +COPY ./styles ./styles COPY ./public ./public -COPY ./img ./img -COPY ./config ./config +COPY ./postcss.config.js ./postcss.config.js +COPY ./next.config.js ./next.config.js +COPY ./tailwind.config.js ./tailwind.config.js + + +RUN npm run build:ghostnet -RUN npm run build:ghostnet-ci +EXPOSE 80 -FROM nginx:latest +CMD ["npm", "run", "start:ghostnet"] -COPY --from=builder /app/dist /usr/share/nginx/html diff --git a/batcher-ui/README.md b/batcher-ui/README.md index 4c89a727..945f07ce 100644 --- a/batcher-ui/README.md +++ b/batcher-ui/README.md @@ -1,6 +1,8 @@ -# Ant Design Pro +# Batcher User Interface + + +This project is built with React ecosystem. Follow is the quick guide for how to use. -This project is initialized with [Ant Design Pro](https://pro.ant.design). Follow is the quick guide for how to use. ## Environment Prepare @@ -10,48 +12,38 @@ Install `node_modules`: npm install ``` -or +### Run project in development mode -```bash -yarn -``` -## Provided Scripts +:warning: For now, Batcher in development runs onto Ghostnet Smart Contract. -Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test. -Scripts provided in `package.json`. It's safe to modify or add additional script: -### Start project -```bash -npm start -``` -### Build project -```bash -npm run build -``` -### Check code style ```bash -npm run lint +npm run dev + ``` -You can also use script to auto fix some lint error: +### Start project on GHOSTNET + ```bash -npm run lint:fix +npm run build:ghostnet && npm run start:ghostnet + ``` -### Test code +### Build project on MAINNET + + + ```bash -npm test -``` +npm run build && npm start -## More +``` -You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro). diff --git a/batcher-ui/config/config.dev.ts b/batcher-ui/config/config.dev.ts deleted file mode 100644 index ab0e590f..00000000 --- a/batcher-ui/config/config.dev.ts +++ /dev/null @@ -1,15 +0,0 @@ -// https://umijs.org/config/ -import { defineConfig } from 'umi'; - -export default defineConfig({ - plugins: [ - // https://github.com/zthxxx/react-dev-inspector - 'react-dev-inspector/plugins/umi/react-inspector', - ], - // https://github.com/zthxxx/react-dev-inspector#inspector-loader-props - inspectorConfig: { - exclude: [], - babelPlugins: [], - babelOptions: {}, - }, -}); diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts deleted file mode 100644 index febcb408..00000000 --- a/batcher-ui/config/config.ghostnet.ts +++ /dev/null @@ -1,123 +0,0 @@ -// @ts-nocheck -import { defineConfig } from 'umi'; - -import defaultSettings from './defaultSettings'; -import proxy from './proxy'; - -const { REACT_APP_ENV } = process.env; - -const BATCHER_LOGO = 'https://storage.googleapis.com/marigold-public-bucket/batcher-logo.png'; - -export default defineConfig({ - hash: true, - antd: {}, - dva: { - hmr: true, - }, - layout: { - // https://umijs.org/zh-CN/plugins/plugin-layout - locale: true, - siderWidth: 208, - ...defaultSettings, - }, - dynamicImport: { - loading: '@ant-design/pro-layout/es/PageLoading', - }, - targets: { - ie: 11, - }, - // umi routes: https://umijs.org/docs/routing - access: {}, - theme: { - 'root-entry-name': 'variable', - }, - // esbuild is father build tools - // https://umijs.org/plugins/plugin-esbuild - esbuild: {}, - title: false, - ignoreMomentLocale: true, - proxy: proxy[REACT_APP_ENV || 'dev'], - manifest: { - basePath: '/', - }, - // Fast Refresh 热更新 - fastRefresh: {}, - nodeModulesTransform: { type: 'none' }, - mfsu: {}, - webpack5: {}, - exportStatic: {}, - favicon: - 'https://uploads-ssl.webflow.com/616ab4741d375d1642c19027/617952f8510cfc45cbf09312_Favicon(3)(1).png', - define: { - REACT_APP_NETWORK_TARGET: 'GHOSTNET', - REACT_APP_BATCHER_URI: 'https://ghostnet.batcher.marigold.dev', - REACT_APP_PATH_TO_BATCHER_LOGO: BATCHER_LOGO, - REACT_APP_TEZOS_NODE_URI: 'https://ghostnet.tezos.marigold.dev', - REACT_APP_TZKT_URI_API: 'https://api.ghostnet.tzkt.io', - REACT_APP_BATCHER_CONTRACT_HASH: 'KT1KDhj8AVi38YxGQAEGLY618iHQNaKuqQ7e', - }, - metas: [ - { - property: 'og:locale', - content: 'en_US', - }, - { - property: 'og:title', - content: 'Batcher DEX', - }, - { - property: 'og:description', - content: - 'The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss..', - }, - { - property: 'og:url', - content: 'https://batcher.marigold.dev', - }, - { - property: 'og:site_name', - content: 'Batcher DEX', - }, - { - property: 'og:image', - content: BATCHER_LOGO, - }, - { - property: 'og:image:secure_url', - content: BATCHER_LOGO, - }, - { - property: 'og:image:width', - content: '400', - }, - { - property: 'og:image:height', - content: '400', - }, - { - name: 'twitter:card', - content: 'summary', - }, - { - name: 'twitter:description', - content: - 'The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss.', - }, - { - name: 'twitter:title', - content: 'Batcher DEX', - }, - { - name: 'twitter:site', - content: '@Marigold_Dev', - }, - { - name: 'twitter:image', - content: BATCHER_LOGO, - }, - { - name: 'twitter:creator', - content: '@Marigold_Dev', - }, - ], -}); diff --git a/batcher-ui/config/config.mainnet.ts b/batcher-ui/config/config.mainnet.ts deleted file mode 100644 index c1255f75..00000000 --- a/batcher-ui/config/config.mainnet.ts +++ /dev/null @@ -1,123 +0,0 @@ -// @ts-nocheck -import { defineConfig } from 'umi'; - -import defaultSettings from './defaultSettings'; -import proxy from './proxy'; - -const { REACT_APP_ENV } = process.env; - -const BATCHER_LOGO = 'https://storage.googleapis.com/marigold-public-bucket/batcher-logo.png'; - -export default defineConfig({ - hash: true, - antd: {}, - dva: { - hmr: true, - }, - layout: { - // https://umijs.org/zh-CN/plugins/plugin-layout - locale: true, - siderWidth: 208, - ...defaultSettings, - }, - dynamicImport: { - loading: '@ant-design/pro-layout/es/PageLoading', - }, - targets: { - ie: 11, - }, - // umi routes: https://umijs.org/docs/routing - access: {}, - theme: { - 'root-entry-name': 'variable', - }, - // esbuild is father build tools - // https://umijs.org/plugins/plugin-esbuild - esbuild: {}, - title: false, - ignoreMomentLocale: true, - proxy: proxy[REACT_APP_ENV || 'dev'], - manifest: { - basePath: '/', - }, - // Fast Refresh 热更新 - fastRefresh: {}, - nodeModulesTransform: { type: 'none' }, - mfsu: {}, - webpack5: {}, - exportStatic: {}, - favicon: - 'https://uploads-ssl.webflow.com/616ab4741d375d1642c19027/617952f8510cfc45cbf09312_Favicon(3)(1).png', - define: { - REACT_APP_NETWORK_TARGET: 'MAINNET', - REACT_APP_BATCHER_URI: 'https://batcher.marigold.dev', - REACT_APP_PATH_TO_BATCHER_LOGO: BATCHER_LOGO, - REACT_APP_TEZOS_NODE_URI: 'https://mainnet.tezos.marigold.dev', - REACT_APP_TZKT_URI_API: 'https://api.tzkt.io', - REACT_APP_BATCHER_CONTRACT_HASH: 'KT1CoTu4CXcWoVk69Ukbgwx2iDK7ZA4FMSpJ', - }, - metas: [ - { - property: 'og:locale', - content: 'en_US', - }, - { - property: 'og:title', - content: 'Batcher DEX', - }, - { - property: 'og:description', - content: - 'The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss..', - }, - { - property: 'og:url', - content: 'https://batcher.marigold.dev', - }, - { - property: 'og:site_name', - content: 'Batcher DEX', - }, - { - property: 'og:image', - content: BATCHER_LOGO, - }, - { - property: 'og:image:secure_url', - content: BATCHER_LOGO, - }, - { - property: 'og:image:width', - content: '400', - }, - { - property: 'og:image:height', - content: '400', - }, - { - name: 'twitter:card', - content: 'summary', - }, - { - name: 'twitter:description', - content: - 'The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss.', - }, - { - name: 'twitter:title', - content: 'Batcher DEX', - }, - { - name: 'twitter:site', - content: '@Marigold_Dev', - }, - { - name: 'twitter:image', - content: BATCHER_LOGO, - }, - { - name: 'twitter:creator', - content: '@Marigold_Dev', - }, - ], -}); diff --git a/batcher-ui/config/config.ts b/batcher-ui/config/config.ts deleted file mode 100644 index 1449d67c..00000000 --- a/batcher-ui/config/config.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { defineConfig } from 'umi'; - -import defaultSettings from './defaultSettings'; -import proxy from './proxy'; - -const { REACT_APP_ENV } = process.env; - -export default defineConfig({ - hash: true, - antd: {}, - dva: { - hmr: true, - }, - layout: { - // https://umijs.org/zh-CN/plugins/plugin-layout - locale: true, - siderWidth: 208, - ...defaultSettings, - }, - dynamicImport: { - loading: '@ant-design/pro-layout/es/PageLoading', - }, - targets: { - ie: 11, - }, - // umi routes: https://umijs.org/docs/routing - access: {}, - theme: { - 'root-entry-name': 'variable', - }, - // esbuild is father build tools - // https://umijs.org/plugins/plugin-esbuild - esbuild: {}, - title: false, - ignoreMomentLocale: true, - proxy: proxy[REACT_APP_ENV || 'dev'], - manifest: { - basePath: '/', - }, - // Fast Refresh 热更新 - fastRefresh: {}, - nodeModulesTransform: { type: 'none' }, - mfsu: {}, - webpack5: {}, - exportStatic: {}, - define: { - REACT_APP_BATCHER: 'hello', - }, -}); diff --git a/batcher-ui/config/defaultSettings.ts b/batcher-ui/config/defaultSettings.ts deleted file mode 100644 index 682d3d83..00000000 --- a/batcher-ui/config/defaultSettings.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Settings as LayoutSettings } from '@ant-design/pro-components'; - -const Settings: LayoutSettings & { - pwa?: boolean; - logo?: string; - disableMobile?: boolean; -} = { - navTheme: 'dark', - // 拂晓蓝 - primaryColor: 'black', - layout: 'top', - contentWidth: 'Fluid', - fixedHeader: true, - fixSiderbar: true, - colorWeak: false, - title: 'BATCHER', - pwa: false, - logo: 'https://storage.googleapis.com/marigold-public-bucket/batcher-logo.png', - iconfontUrl: '', - disableMobile: true, -}; - -export default Settings; diff --git a/batcher-ui/config/proxy.ts b/batcher-ui/config/proxy.ts deleted file mode 100644 index a8194b7e..00000000 --- a/batcher-ui/config/proxy.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 - * ------------------------------- - * The agent cannot take effect in the production environment - * so there is no configuration of the production environment - * For details, please see - * https://pro.ant.design/docs/deploy - */ -export default { - dev: { - // localhost:8000/api/** -> https://preview.pro.ant.design/api/** - '/api/': { - // 要代理的地址 - target: 'https://preview.pro.ant.design', - // 配置了这个可以从 http 代理到 https - // 依赖 origin 的功能可能需要这个,比如 cookie - changeOrigin: true, - }, - }, - test: { - '/api/': { - target: 'https://proapi.azurewebsites.net', - changeOrigin: true, - pathRewrite: { '^': '' }, - }, - }, - pre: { - '/api/': { - target: 'your pre url', - changeOrigin: true, - pathRewrite: { '^': '' }, - }, - }, -}; diff --git a/batcher-ui/config/routes.ts b/batcher-ui/config/routes.ts deleted file mode 100644 index 78d4af5e..00000000 --- a/batcher-ui/config/routes.ts +++ /dev/null @@ -1,58 +0,0 @@ -export default [ - { - path: '/user', - layout: false, - routes: [ - { - name: 'login', - path: '/user/login', - component: './404', - }, - { - component: './404', - }, - ], - }, - { - path: '/welcome', - name: 'welcome', - icon: 'smile', - component: './Welcome', - }, - { - path: '/admin', - name: 'admin', - icon: 'crown', - access: 'canAdmin', - routes: [ - { - path: '/admin/sub-page', - name: 'sub-page', - icon: 'smile', - component: './Welcome', - }, - { - component: './404', - }, - ], - }, - // { - // name: 'list.table-list', - // icon: 'table', - // path: '/list', - // component: './TableList', - // }, - { - path: '/', - redirect: '/welcome', - }, - { - component: './404', - }, - { - path: '/hihi', - name: 'hihi', - icon: 'smile', - component: './Welcome', - }, -]; diff --git a/batcher-ui/global.d.ts b/batcher-ui/global.d.ts new file mode 100644 index 00000000..2fb6c50d --- /dev/null +++ b/batcher-ui/global.d.ts @@ -0,0 +1,8 @@ +declare global { + namespace NodeJS { + interface ProcessEnv { + SECRET: string; + } + } +} +export {}; diff --git a/batcher-ui/img/exchange-dollar.svg b/batcher-ui/img/exchange-dollar.svg deleted file mode 100644 index 58070f80..00000000 --- a/batcher-ui/img/exchange-dollar.svg +++ /dev/null @@ -1,21 +0,0 @@ - - diff --git a/batcher-ui/img/exchange-euro.svg b/batcher-ui/img/exchange-euro.svg deleted file mode 100644 index f46feb03..00000000 --- a/batcher-ui/img/exchange-euro.svg +++ /dev/null @@ -1,21 +0,0 @@ - - diff --git a/batcher-ui/img/marigold-logo.svg b/batcher-ui/img/marigold-logo.svg deleted file mode 100644 index e4a0c2e0..00000000 --- a/batcher-ui/img/marigold-logo.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - diff --git a/batcher-ui/jest.config.js b/batcher-ui/jest.config.js index 47295738..bed84b7d 100644 --- a/batcher-ui/jest.config.js +++ b/batcher-ui/jest.config.js @@ -3,7 +3,6 @@ module.exports = { verbose: false, extraSetupFiles: ['./tests/setupTests.js'], globals: { - ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, localStorage: null, }, }; diff --git a/batcher-ui/next-env.d.ts b/batcher-ui/next-env.d.ts new file mode 100644 index 00000000..4f11a03d --- /dev/null +++ b/batcher-ui/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/batcher-ui/next.config.js b/batcher-ui/next.config.js new file mode 100644 index 00000000..c2e43fff --- /dev/null +++ b/batcher-ui/next.config.js @@ -0,0 +1,21 @@ +/** @type {import('next').NextConfig} */ + +const config = require('./src/config/env.ts'); + +const env = process.env.ENV; // 'mainnet' | 'ghostnet' + +console.info('🚀 Current env:', env); + +const nextConfig = { + reactStrictMode: false, + swcMinify: true, + env: config[env], + webpack: (config, { isServer, webpack }) => { + console.log(isServer); + if (!isServer) config.resolve.fallback['fs'] = false; + + return config; + }, +}; + +module.exports = nextConfig; diff --git a/batcher-ui/package-lock.json b/batcher-ui/package-lock.json new file mode 100644 index 00000000..d536d3a8 --- /dev/null +++ b/batcher-ui/package-lock.json @@ -0,0 +1,9149 @@ +{ + "name": "batcher", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "batcher", + "version": "1.0.0", + "dependencies": { + "@airgap/beacon-sdk": "^4.0.6", + "@fortawesome/fontawesome-svg-core": "^6.4.2", + "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@fortawesome/react-fontawesome": "^0.2.0", + "@microsoft/signalr": "^6.0.10", + "@radix-ui/react-dialog": "^1.0.4", + "@radix-ui/react-form": "^0.0.3", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-radio-group": "^1.1.3", + "@radix-ui/react-select": "^1.2.2", + "@radix-ui/react-tooltip": "^1.0.6", + "@taquito/beacon-wallet": "^16.0.0", + "@taquito/taquito": "^16.0.0", + "@taquito/tzip12": "^16.0.0", + "@taquito/tzip16": "^16.0.0", + "@types/react-redux": "^7.1.25", + "@tzkt/sdk-api": "^2.2.0", + "date-fns": "^2.29.3", + "fp-ts": "^2.16.0", + "next": "^13.4.10", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-ga4": "^2.1.0", + "react-redux": "^8.1.1", + "redux": "^4.2.1", + "redux-logger": "^3.0.6", + "redux-loop": "^6.2.0" + }, + "devDependencies": { + "@types/jest": "^26.0.0", + "@types/react": "^18.2.15", + "@types/react-dom": "^17.0.0", + "@types/redux-logger": "^3.0.9", + "assert": "^2.0.0", + "autoprefixer": "^10.4.14", + "cross-port-killer": "^1.3.0", + "eslint": "^8.45.0", + "eslint-config-next": "^13.4.12", + "eslint-config-prettier": "^8.8.0", + "gh-pages": "^3.2.0", + "husky": "^8.0.0", + "lint-staged": "^13.2.3", + "postcss": "^8.4.26", + "postcss-import": "^15.1.0", + "prettier": "^2.5.0", + "process": "^0.11.10", + "tailwindcss": "^3.3.3", + "typescript": "^5.1.6" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-substrate/-/beacon-blockchain-substrate-4.0.6.tgz", + "integrity": "sha512-6tP2Y/67fc/U8JPoMpYspvb9NSw2NfHPOYLchmf+y1VO1ybK9cSr3mWPLWoomjAyEWPpY9ymVzflEsnQMVDiXQ==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-ui": "4.0.6" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate/node_modules/@airgap/beacon-core": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.6.tgz", + "integrity": "sha512-gSyA1rEZ9Rphbr575UgYNnEAcVAYaZ1AGo/7m4xmvyNVAi906BPfnfpsrH8HfsDZRcnW+ahMd+YElA6a2tesmw==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.4", + "@stablelib/utf8": "^1.0.1", + "@stablelib/x25519-session": "^1.0.4", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate/node_modules/@airgap/beacon-transport-postmessage": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.6.tgz", + "integrity": "sha512-lEwh3bLEOHnvjqA2ffaYxiIfcHLjnk0CzKW3CsvA5RJaMMZATNYj63HKC85K1SQZmy5EPReqGrjg7NpohC/TKw==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate/node_modules/@airgap/beacon-types": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.6.tgz", + "integrity": "sha512-9hBUts03MdYAp0IdNnXbLO1JDZd3jNXyez4ahht0jv396aPc27ZKAcWKBjkZCMbxQwpw9/pZVAmkLCErYNMSww==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate/node_modules/@airgap/beacon-ui": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.0.6.tgz", + "integrity": "sha512-wid0hxsR4QrB8se1/ID7H8O9BVL3VrLUjTEIMqaXPNyDa+p53FNTVq+CGeKJ8dz/IcjjZrRB7ZTRlYVTxgqP5A==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "qrcode-svg": "^1.1.0", + "solid-js": "^1.6.6" + } + }, + "node_modules/@airgap/beacon-blockchain-substrate/node_modules/@airgap/beacon-utils": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.6.tgz", + "integrity": "sha512-vV6xtS50Qd/VzJPeoK3y14ddSR+9AEV0HtmP7BcYC5jTN2flT+PlTO8y8vS0+Yx8eFnQTnlS2vp7a2DTa/aWUA==", + "dependencies": { + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.3", + "@stablelib/random": "^1.0.2", + "@stablelib/utf8": "^1.0.1", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-blockchain-tezos/-/beacon-blockchain-tezos-4.0.6.tgz", + "integrity": "sha512-YLGWSHkhmkC4KomW15bj2MRDGROQxn8oBlN2MJ1N+2CwLmEEEo4WPsIgBNuRhfUdM1/toOAiHICy5v7g98jieQ==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-ui": "4.0.6" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos/node_modules/@airgap/beacon-core": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.6.tgz", + "integrity": "sha512-gSyA1rEZ9Rphbr575UgYNnEAcVAYaZ1AGo/7m4xmvyNVAi906BPfnfpsrH8HfsDZRcnW+ahMd+YElA6a2tesmw==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.4", + "@stablelib/utf8": "^1.0.1", + "@stablelib/x25519-session": "^1.0.4", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos/node_modules/@airgap/beacon-transport-postmessage": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.6.tgz", + "integrity": "sha512-lEwh3bLEOHnvjqA2ffaYxiIfcHLjnk0CzKW3CsvA5RJaMMZATNYj63HKC85K1SQZmy5EPReqGrjg7NpohC/TKw==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos/node_modules/@airgap/beacon-types": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.6.tgz", + "integrity": "sha512-9hBUts03MdYAp0IdNnXbLO1JDZd3jNXyez4ahht0jv396aPc27ZKAcWKBjkZCMbxQwpw9/pZVAmkLCErYNMSww==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos/node_modules/@airgap/beacon-ui": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.0.6.tgz", + "integrity": "sha512-wid0hxsR4QrB8se1/ID7H8O9BVL3VrLUjTEIMqaXPNyDa+p53FNTVq+CGeKJ8dz/IcjjZrRB7ZTRlYVTxgqP5A==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "qrcode-svg": "^1.1.0", + "solid-js": "^1.6.6" + } + }, + "node_modules/@airgap/beacon-blockchain-tezos/node_modules/@airgap/beacon-utils": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.6.tgz", + "integrity": "sha512-vV6xtS50Qd/VzJPeoK3y14ddSR+9AEV0HtmP7BcYC5jTN2flT+PlTO8y8vS0+Yx8eFnQTnlS2vp7a2DTa/aWUA==", + "dependencies": { + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.3", + "@stablelib/random": "^1.0.2", + "@stablelib/utf8": "^1.0.1", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-core": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.2.tgz", + "integrity": "sha512-a6mAn6BfbejBQI95tRc6pIZ0VS6MTK9MZ7iXPTLF9hrnCHiROmrCgNKst8qp2dcE0Ehk7z/hGs2WliJzi657YA==", + "dependencies": { + "@airgap/beacon-types": "4.0.2", + "@airgap/beacon-utils": "4.0.2", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.4", + "@stablelib/utf8": "^1.0.1", + "@stablelib/x25519-session": "^1.0.4", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-dapp": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-4.0.2.tgz", + "integrity": "sha512-7vjvcM470GPfDkizYpuUzJ7Fus7X/zkFeXYTkxx69Dt5TlmKg09YNfRtvrFMDbf4OKnjbaRfVhqzwfYkpaRbPg==", + "dependencies": { + "@airgap/beacon-core": "4.0.2", + "@airgap/beacon-transport-matrix": "4.0.2", + "@airgap/beacon-transport-postmessage": "4.0.2", + "@airgap/beacon-transport-walletconnect": "4.0.2", + "@airgap/beacon-ui": "4.0.2" + } + }, + "node_modules/@airgap/beacon-sdk": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-sdk/-/beacon-sdk-4.0.6.tgz", + "integrity": "sha512-fY3V/oK6W7G3dZlgTd+zJOQkaMtageolBviH7PjqhAbAztlK0GNrateJg53Z7ZLIGVIoS4jZ7nAMfBR5Ll+Nyg==", + "dependencies": { + "@airgap/beacon-blockchain-substrate": "4.0.6", + "@airgap/beacon-blockchain-tezos": "4.0.6", + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-dapp": "4.0.6", + "@airgap/beacon-transport-matrix": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-ui": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@airgap/beacon-wallet": "4.0.6" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-core": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.6.tgz", + "integrity": "sha512-gSyA1rEZ9Rphbr575UgYNnEAcVAYaZ1AGo/7m4xmvyNVAi906BPfnfpsrH8HfsDZRcnW+ahMd+YElA6a2tesmw==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.4", + "@stablelib/utf8": "^1.0.1", + "@stablelib/x25519-session": "^1.0.4", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-dapp": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-4.0.6.tgz", + "integrity": "sha512-4+AgPopWWjwxVJcpLXTlRGb/5jdkc0MUjBvtH6kZJfhf2drsdWUkBtGHCiqpy8KjLLOiyVgdGniNTFt4025hsg==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-transport-matrix": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6", + "@airgap/beacon-transport-walletconnect": "4.0.6", + "@airgap/beacon-ui": "4.0.6" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-transport-matrix": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.0.6.tgz", + "integrity": "sha512-wLla13DorVGadc4fG5S/o1EijwpTKIADP0DhGGD33bQc5s/59BFNSPAo3ZErZqD7+5vn7JTRKN4V/JUigsX+ZA==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "axios": "0.24.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-transport-postmessage": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.6.tgz", + "integrity": "sha512-lEwh3bLEOHnvjqA2ffaYxiIfcHLjnk0CzKW3CsvA5RJaMMZATNYj63HKC85K1SQZmy5EPReqGrjg7NpohC/TKw==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-transport-walletconnect": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-walletconnect/-/beacon-transport-walletconnect-4.0.6.tgz", + "integrity": "sha512-/YxGCbhw8JqkyEYGd7mCa5greMYO9/Ro+61xQv1/3WjT/wlTYFDF0tuH+Di6ZxVz7SBk8e95bQsKL5u10poGoA==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@walletconnect/sign-client": "^2.9.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-types": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.6.tgz", + "integrity": "sha512-9hBUts03MdYAp0IdNnXbLO1JDZd3jNXyez4ahht0jv396aPc27ZKAcWKBjkZCMbxQwpw9/pZVAmkLCErYNMSww==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-ui": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.0.6.tgz", + "integrity": "sha512-wid0hxsR4QrB8se1/ID7H8O9BVL3VrLUjTEIMqaXPNyDa+p53FNTVq+CGeKJ8dz/IcjjZrRB7ZTRlYVTxgqP5A==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "qrcode-svg": "^1.1.0", + "solid-js": "^1.6.6" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@airgap/beacon-utils": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.6.tgz", + "integrity": "sha512-vV6xtS50Qd/VzJPeoK3y14ddSR+9AEV0HtmP7BcYC5jTN2flT+PlTO8y8vS0+Yx8eFnQTnlS2vp7a2DTa/aWUA==", + "dependencies": { + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.3", + "@stablelib/random": "^1.0.2", + "@stablelib/utf8": "^1.0.1", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@walletconnect/core": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.1.tgz", + "integrity": "sha512-xyWeP0eLhEEDQAVJSmqs4n/AClKUM+8os2ZFe7BTuw1tFYjeLNVDtKCHziVOSTh8wEChMsKSGKA4zerQoH8mAQ==", + "dependencies": { + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-provider": "1.0.13", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.13", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/relay-auth": "^1.0.4", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.1", + "@walletconnect/utils": "2.9.1", + "events": "^3.3.0", + "lodash.isequal": "4.5.0", + "uint8arrays": "^3.1.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@walletconnect/sign-client": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.1.tgz", + "integrity": "sha512-Z7tFRrJ9btA1vU427vsjUS6cPlHQVcTWdKH90khEc2lv3dB6mU8FNO0VJsw+I2D7CW7WaMWF3nnj6Z1FfotbDg==", + "dependencies": { + "@walletconnect/core": "2.9.1", + "@walletconnect/events": "^1.0.1", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.1", + "@walletconnect/utils": "2.9.1", + "events": "^3.3.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@walletconnect/types": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.1.tgz", + "integrity": "sha512-xbGgTPuD6xsb7YMvCESBIH55cjB86QAnnVL50a/ED42YkQzDsOdJ0VGTbrm0tG5cxUOF933rpxZQjxGdP+ovww==", + "dependencies": { + "@walletconnect/events": "^1.0.1", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "events": "^3.3.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/@walletconnect/utils": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.1.tgz", + "integrity": "sha512-tXeQVebF5oPBvhdmuUyVSkSIBYx/egIi4czav1QrnUpwrUS1LsrFhyWBxSbhN7TXY287ULWkEf6aFpWOHdp5EA==", + "dependencies": { + "@stablelib/chacha20poly1305": "1.0.1", + "@stablelib/hkdf": "1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/sha256": "1.0.1", + "@stablelib/x25519": "^1.0.3", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.1", + "@walletconnect/window-getters": "^1.0.1", + "@walletconnect/window-metadata": "^1.0.1", + "detect-browser": "5.3.0", + "query-string": "7.1.3", + "uint8arrays": "^3.1.0" + } + }, + "node_modules/@airgap/beacon-sdk/node_modules/query-string": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", + "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", + "dependencies": { + "decode-uri-component": "^0.2.2", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@airgap/beacon-transport-matrix": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.0.2.tgz", + "integrity": "sha512-sidXWA9QkcdpTLObsgMIIePq2+6eHn8djSK2UeoAWZpVOky+jpaIU78UlzqgDzMrO9inzu/xwsuXlk5Nmy1RyA==", + "dependencies": { + "@airgap/beacon-core": "4.0.2", + "@airgap/beacon-utils": "4.0.2", + "axios": "0.24.0" + } + }, + "node_modules/@airgap/beacon-transport-postmessage": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.2.tgz", + "integrity": "sha512-UDHigcIRD5/VdKX3YDj+CVHYWafYg3N8nHT5yQ2JOU5nsQhD2y5NNNp/7U7I44CcD4OeK9d2slV+lnp8lBYe1g==", + "dependencies": { + "@airgap/beacon-core": "4.0.2", + "@airgap/beacon-types": "4.0.2", + "@airgap/beacon-utils": "4.0.2" + } + }, + "node_modules/@airgap/beacon-transport-walletconnect": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-walletconnect/-/beacon-transport-walletconnect-4.0.2.tgz", + "integrity": "sha512-t4ZrgyImVf8UIhVa6ei/p1STVKNdRq5WSoop8eTSqArIHVj4zk2dr5J0ihbe64UyLAX1O0Z7yV+dUVoH+kVWGw==", + "dependencies": { + "@airgap/beacon-core": "4.0.2", + "@airgap/beacon-types": "4.0.2", + "@airgap/beacon-utils": "4.0.2", + "@walletconnect/sign-client": "2.7.0" + } + }, + "node_modules/@airgap/beacon-types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.2.tgz", + "integrity": "sha512-MWbE+350Yd7aICBEwTVIkty/YmKO5eTDsMbReUCNH8qf64gGhj/ZXEN6FPwMab+qKdmACgCkmbbtAXGGtmjwrA==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-ui": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.0.2.tgz", + "integrity": "sha512-ZTcvdQ5GNlQ58M0Fduoq/KqsulBXeBN6jKiHnzHM3e98syy953DKQoDhU2NXNZiJ7AvEGO3s/fd+BN8y/+CVuQ==", + "dependencies": { + "@airgap/beacon-core": "4.0.2", + "@airgap/beacon-transport-postmessage": "4.0.2", + "@airgap/beacon-types": "4.0.2", + "@airgap/beacon-utils": "4.0.2", + "qrcode-svg": "^1.1.0", + "solid-js": "^1.6.6" + } + }, + "node_modules/@airgap/beacon-utils": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.2.tgz", + "integrity": "sha512-5TfOI3ZolQQ9WNHogEO3SY4M2Paqbb3hf8DvolFofST6Brp0qyxkwZ0i99puahgwRo+B0qGilZpkLCYl72DMQg==", + "dependencies": { + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.3", + "@stablelib/random": "^1.0.2", + "@stablelib/utf8": "^1.0.1", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-wallet": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-wallet/-/beacon-wallet-4.0.6.tgz", + "integrity": "sha512-m3jJvWB7JAl/Dehn8i8dRN0e6+NSNRVpzDxfO7nDedQiuPKmgcFPmenP87zF51spXDHKTkK4t7YU4HGDYR2Xrw==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-transport-matrix": "4.0.6", + "@airgap/beacon-transport-postmessage": "4.0.6" + } + }, + "node_modules/@airgap/beacon-wallet/node_modules/@airgap/beacon-core": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.6.tgz", + "integrity": "sha512-gSyA1rEZ9Rphbr575UgYNnEAcVAYaZ1AGo/7m4xmvyNVAi906BPfnfpsrH8HfsDZRcnW+ahMd+YElA6a2tesmw==", + "dependencies": { + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.4", + "@stablelib/utf8": "^1.0.1", + "@stablelib/x25519-session": "^1.0.4", + "bs58check": "2.1.2" + } + }, + "node_modules/@airgap/beacon-wallet/node_modules/@airgap/beacon-transport-matrix": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.0.6.tgz", + "integrity": "sha512-wLla13DorVGadc4fG5S/o1EijwpTKIADP0DhGGD33bQc5s/59BFNSPAo3ZErZqD7+5vn7JTRKN4V/JUigsX+ZA==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-utils": "4.0.6", + "axios": "0.24.0" + } + }, + "node_modules/@airgap/beacon-wallet/node_modules/@airgap/beacon-transport-postmessage": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.6.tgz", + "integrity": "sha512-lEwh3bLEOHnvjqA2ffaYxiIfcHLjnk0CzKW3CsvA5RJaMMZATNYj63HKC85K1SQZmy5EPReqGrjg7NpohC/TKw==", + "dependencies": { + "@airgap/beacon-core": "4.0.6", + "@airgap/beacon-types": "4.0.6", + "@airgap/beacon-utils": "4.0.6" + } + }, + "node_modules/@airgap/beacon-wallet/node_modules/@airgap/beacon-types": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.6.tgz", + "integrity": "sha512-9hBUts03MdYAp0IdNnXbLO1JDZd3jNXyez4ahht0jv396aPc27ZKAcWKBjkZCMbxQwpw9/pZVAmkLCErYNMSww==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-wallet/node_modules/@airgap/beacon-utils": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.6.tgz", + "integrity": "sha512-vV6xtS50Qd/VzJPeoK3y14ddSR+9AEV0HtmP7BcYC5jTN2flT+PlTO8y8vS0+Yx8eFnQTnlS2vp7a2DTa/aWUA==", + "dependencies": { + "@stablelib/ed25519": "^1.0.3", + "@stablelib/nacl": "^1.0.3", + "@stablelib/random": "^1.0.2", + "@stablelib/utf8": "^1.0.1", + "bs58check": "2.1.2" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.6.tgz", + "integrity": "sha512-M3YgsLjI0lZxvrpeGVk9Ap032W6TPQkH6pRAZz81Ac3WUNF79VQooAFnp8umjvVzUmD93NkogxEwbSce7qMsUg==", + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "call-me-maybe": "^1.0.1", + "js-yaml": "^3.13.1" + } + }, + "node_modules/@apidevtools/openapi-schemas": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz", + "integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@apidevtools/swagger-methods": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", + "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==" + }, + "node_modules/@apidevtools/swagger-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.1.0.tgz", + "integrity": "sha512-9Kt7EuS/7WbMAUv2gSziqjvxwDbFSg3Xeyfuj5laUODX8o/k/CpsAKiQ8W7/R88eXFTMbJYg6+7uAmOWNKmwnw==", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "9.0.6", + "@apidevtools/openapi-schemas": "^2.1.0", + "@apidevtools/swagger-methods": "^3.0.2", + "@jsdevtools/ono": "^7.1.3", + "ajv": "^8.6.3", + "ajv-draft-04": "^1.0.0", + "call-me-maybe": "^1.0.1" + }, + "peerDependencies": { + "openapi-types": ">=7" + } + }, + "node_modules/@apidevtools/swagger-parser/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@apidevtools/swagger-parser/node_modules/ajv-draft-04": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", + "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "peerDependencies": { + "ajv": "^8.5.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/@apidevtools/swagger-parser/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/@babel/runtime": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz", + "integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==", + "dependencies": { + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", + "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/js": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", + "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@exodus/schemasafe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.0.1.tgz", + "integrity": "sha512-PQdbF8dGd4LnbwBlcc4ML8RKYdplm+e9sUeWBTr4zgF13/Shiuov9XznvM4T8cb1CfyKK21yTUkuAIIh/DAH/g==" + }, + "node_modules/@floating-ui/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz", + "integrity": "sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==", + "dependencies": { + "@floating-ui/utils": "^0.1.1" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.1.tgz", + "integrity": "sha512-KwvVcPSXg6mQygvA1TjbN/gh///36kKtllIF8SUm0qpFj8+rvYrpvlYdL1JoA71SHpDqgSSdGOSoQ0Mp3uY5aw==", + "dependencies": { + "@floating-ui/core": "^1.4.1", + "@floating-ui/utils": "^0.1.1" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz", + "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==", + "dependencies": { + "@floating-ui/dom": "^1.5.1" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz", + "integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw==" + }, + "node_modules/@fortawesome/fontawesome-common-types": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.4.2.tgz", + "integrity": "sha512-1DgP7f+XQIJbLFCTX1V2QnxVmpLdKdzzo2k8EmvDOePfchaIGQ9eCHj2up3/jNEbZuBqel5OxiaOJf37TWauRA==", + "hasInstallScript": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/fontawesome-svg-core": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.4.2.tgz", + "integrity": "sha512-gjYDSKv3TrM2sLTOKBc5rH9ckje8Wrwgx1CxAPbN5N3Fm4prfi7NsJVWd1jklp7i5uSCVwhZS5qlhMXqLrpAIg==", + "hasInstallScript": true, + "dependencies": { + "@fortawesome/fontawesome-common-types": "6.4.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/free-solid-svg-icons": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.4.2.tgz", + "integrity": "sha512-sYwXurXUEQS32fZz9hVCUUv/xu49PEJEyUOsA51l6PU/qVgfbTb2glsTEaJngVVT8VqBATRIdh7XVgV1JF1LkA==", + "hasInstallScript": true, + "dependencies": { + "@fortawesome/fontawesome-common-types": "6.4.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/react-fontawesome": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.2.0.tgz", + "integrity": "sha512-uHg75Rb/XORTtVt7OS9WoK8uM276Ufi7gCzshVWkUJbHhh3svsUUeqXerrM96Wm7fRiDzfKRwSoahhMIkGAYHw==", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "@fortawesome/fontawesome-svg-core": "~1 || ~6", + "react": ">=16.3" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", + "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" + }, + "node_modules/@microsoft/signalr": { + "version": "6.0.20", + "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-6.0.20.tgz", + "integrity": "sha512-jcJDnI/Ca4+EBQnIE0B9q4XZLGn48S//rk6IeiKeItSkR15mZ9DjLui3VMSXUrpx4ioNGVWMVzI/7DPByJshLA==", + "dependencies": { + "abort-controller": "^3.0.0", + "eventsource": "^1.0.7", + "fetch-cookie": "^0.11.0", + "node-fetch": "^2.6.7", + "ws": "^7.4.5" + } + }, + "node_modules/@next/env": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.10.tgz", + "integrity": "sha512-3G1yD/XKTSLdihyDSa8JEsaWOELY+OWe08o0LUYzfuHp1zHDA8SObQlzKt+v+wrkkPcnPweoLH1ImZeUa0A1NQ==" + }, + "node_modules/@next/eslint-plugin-next": { + "version": "13.4.12", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.12.tgz", + "integrity": "sha512-6rhK9CdxEgj/j1qvXIyLTWEaeFv7zOK8yJMulz3Owel0uek0U9MJCGzmKgYxM3aAUBo3gKeywCZKyQnJKto60A==", + "dev": true, + "dependencies": { + "glob": "7.1.7" + } + }, + "node_modules/@next/eslint-plugin-next/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.10.tgz", + "integrity": "sha512-4bsdfKmmg7mgFGph0UorD1xWfZ5jZEw4kKRHYEeTK9bT1QnMbPVPlVXQRIiFPrhoDQnZUoa6duuPUJIEGLV1Jg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.10.tgz", + "integrity": "sha512-ngXhUBbcZIWZWqNbQSNxQrB9T1V+wgfCzAor2olYuo/YpaL6mUYNUEgeBMhr8qwV0ARSgKaOp35lRvB7EmCRBg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.10.tgz", + "integrity": "sha512-SjCZZCOmHD4uyM75MVArSAmF5Y+IJSGroPRj2v9/jnBT36SYFTORN8Ag/lhw81W9EeexKY/CUg2e9mdebZOwsg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.10.tgz", + "integrity": "sha512-F+VlcWijX5qteoYIOxNiBbNE8ruaWuRlcYyIRK10CugqI/BIeCDzEDyrHIHY8AWwbkTwe6GRHabMdE688Rqq4Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.10.tgz", + "integrity": "sha512-WDv1YtAV07nhfy3i1visr5p/tjiH6CeXp4wX78lzP1jI07t4PnHHG1WEDFOduXh3WT4hG6yN82EQBQHDi7hBrQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.10.tgz", + "integrity": "sha512-zFkzqc737xr6qoBgDa3AwC7jPQzGLjDlkNmt/ljvQJ/Veri5ECdHjZCUuiTUfVjshNIIpki6FuP0RaQYK9iCRg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.10.tgz", + "integrity": "sha512-IboRS8IWz5mWfnjAdCekkl8s0B7ijpWeDwK2O8CdgZkoCDY0ZQHBSGiJ2KViAG6+BJVfLvcP+a2fh6cdyBr9QQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.10.tgz", + "integrity": "sha512-bSA+4j8jY4EEiwD/M2bol4uVEu1lBlgsGdvM+mmBm/BbqofNBfaZ2qwSbwE2OwbAmzNdVJRFRXQZ0dkjopTRaQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.10.tgz", + "integrity": "sha512-g2+tU63yTWmcVQKDGY0MV1PjjqgZtwM4rB1oVVi/v0brdZAcrcTV+04agKzWtvWroyFz6IqtT0MoZJA7PNyLVw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@pkgr/utils/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "dev": true + }, + "node_modules/@radix-ui/number": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.1.tgz", + "integrity": "sha512-T5gIdVO2mmPW3NNhjNgEP3cqMXjXL9UbO0BzWcXfvdBs+BohbQxvd/K5hSVKmn9/lbTdsQVKbUcP5WLCwvUbBg==", + "dependencies": { + "@babel/runtime": "^7.13.10" + } + }, + "node_modules/@radix-ui/primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.0.1.tgz", + "integrity": "sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==", + "dependencies": { + "@babel/runtime": "^7.13.10" + } + }, + "node_modules/@radix-ui/react-arrow": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.0.3.tgz", + "integrity": "sha512-wSP+pHsB/jQRaL6voubsQ/ZlrGBHHrOjmBnr19hxYgtS0WvAFwZhK2WP/YY5yF9uKECCEEDGxuLxq1NBK51wFA==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-primitive": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz", + "integrity": "sha512-3SzW+0PW7yBBoQlT8wNcGtaxaD0XSu0uLUFgrtHY08Acx05TaHaOmVLR73c0j/cqpDy53KBMO7s0dx2wmOIDIA==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-slot": "1.0.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-compose-refs": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.0.1.tgz", + "integrity": "sha512-fDSBgd44FKHa1FRMU59qBMPFcl2PZE+2nmqunj+BWFyYYjnhIDWL2ItDs3rrbJDQOtzt5nIebLCQc4QRfz6LJw==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.0.1.tgz", + "integrity": "sha512-ebbrdFoYTcuZ0v4wG5tedGnp9tzcV8awzsxYph7gXUyvnNLuTIcCk1q17JEbnVhXAKG9oX3KtchwiMIAYp9NLg==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.4.tgz", + "integrity": "sha512-hJtRy/jPULGQZceSAP2Re6/4NpKo8im6V8P2hUqZsdFiSL8l35kYsw3qbRI6Ay5mQd2+wlLqje770eq+RJ3yZg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-dismissable-layer": "1.0.4", + "@radix-ui/react-focus-guards": "1.0.1", + "@radix-ui/react-focus-scope": "1.0.3", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-portal": "1.0.3", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-slot": "1.0.2", + "@radix-ui/react-use-controllable-state": "1.0.1", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.5.5" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-direction": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.0.1.tgz", + "integrity": "sha512-RXcvnXgyvYvBEOhCBuddKecVkoMiI10Jcm5cTI7abJRAHYfFxeu+FBQs/DvdxSYucxR5mna0dNsL6QFlds5TMA==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.4.tgz", + "integrity": "sha512-7UpBa/RKMoHJYjie1gkF1DlK8l1fdU/VKDpoS3rCCo8YBJR294GwcEHyxHw72yvphJ7ld0AXEcSLAzY2F/WyCg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-escape-keydown": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-guards": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.0.1.tgz", + "integrity": "sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.3.tgz", + "integrity": "sha512-upXdPfqI4islj2CslyfUBNlaJCPybbqRHAi1KER7Isel9Q2AtSJ0zRBZv8mWQiFXD2nyAJ4BhC3yXgZ6kMBSrQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-form": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-form/-/react-form-0.0.3.tgz", + "integrity": "sha512-kgE+Z/haV6fxE5WqIXj05KkaXa3OkZASoTDy25yX2EIp/x0c54rOH/vFr5nOZTg7n7T1z8bSyXmiVIFP9bbhPQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-label": "2.0.2", + "@radix-ui/react-primitive": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-icons": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.0.tgz", + "integrity": "sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==", + "peerDependencies": { + "react": "^16.x || ^17.x || ^18.x" + } + }, + "node_modules/@radix-ui/react-id": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.1.tgz", + "integrity": "sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-use-layout-effect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-label": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.0.2.tgz", + "integrity": "sha512-N5ehvlM7qoTLx7nWPodsPYPgMzA5WM8zZChQg8nyFJKnDO5WHdba1vv5/H6IO5LtJMfD2Q3wh1qHFGNtK0w3bQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-primitive": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.2.tgz", + "integrity": "sha512-1CnGGfFi/bbqtJZZ0P/NQY20xdG3E0LALJaLUEoKwPLwl6PPPfbeiCqMVQnhoFRAxjJj4RpBRJzDmUgsex2tSg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1", + "@radix-ui/react-use-rect": "1.0.1", + "@radix-ui/react-use-size": "1.0.1", + "@radix-ui/rect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.3.tgz", + "integrity": "sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-primitive": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-presence": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.0.1.tgz", + "integrity": "sha512-UXLW4UAbIY5ZjcvzjfRFo5gxva8QirC9hF7wRE4U5gz+TP0DbRk+//qyuAQ1McDxBt1xNMBTaciFGvEmJvAZCg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-primitive": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-1.0.3.tgz", + "integrity": "sha512-yi58uVyoAcK/Nq1inRY56ZSjKypBNKTa/1mcL8qdl6oJeEaDbOldlzrGn7P6Q3Id5d+SYNGc5AJgc4vGhjs5+g==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-slot": "1.0.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.1.3.tgz", + "integrity": "sha512-x+yELayyefNeKeTx4fjK6j99Fs6c4qKm3aY38G3swQVTN6xMpsrbigC0uHs2L//g8q4qR7qOcww8430jJmi2ag==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-roving-focus": "1.0.4", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-previous": "1.0.1", + "@radix-ui/react-use-size": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.0.4.tgz", + "integrity": "sha512-2mUg5Mgcu001VkGy+FfzZyzbmuUWzgWkj3rvv4yu+mLw03+mTzbxZHvfcGyFp2b8EkQeMkpRQ5FiA2Vr2O6TeQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-collection": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-controllable-state": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-1.2.2.tgz", + "integrity": "sha512-zI7McXr8fNaSrUY9mZe4x/HC0jTLY9fWNhO1oLWYMQGDXuV4UCivIGTxwioSzO0ZCYX9iSLyWmAh/1TOmX3Cnw==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/number": "1.0.1", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-collection": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-dismissable-layer": "1.0.4", + "@radix-ui/react-focus-guards": "1.0.1", + "@radix-ui/react-focus-scope": "1.0.3", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-popper": "1.1.2", + "@radix-ui/react-portal": "1.0.3", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-slot": "1.0.2", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1", + "@radix-ui/react-use-previous": "1.0.1", + "@radix-ui/react-visually-hidden": "1.0.3", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.5.5" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz", + "integrity": "sha512-YeTpuq4deV+6DusvVUW4ivBgnkHwECUu0BiN43L5UCDFgdhsRUWAghhTF5MbvNTPzmiFOx90asDSUjWuCNapwg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-compose-refs": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.6.tgz", + "integrity": "sha512-DmNFOiwEc2UDigsYj6clJENma58OelxD24O4IODoZ+3sQc3Zb+L8w1EP+y9laTuKCLAysPw4fD6/v0j4KNV8rg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-dismissable-layer": "1.0.4", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-popper": "1.1.2", + "@radix-ui/react-portal": "1.0.3", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-slot": "1.0.2", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-visually-hidden": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-callback-ref": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.1.tgz", + "integrity": "sha512-D94LjX4Sp0xJFVaoQOd3OO9k7tpBYNOXdVhkltUbGv2Qb9OXdrg/CpsjlZv7ia14Sylv398LswWBVVu5nqKzAQ==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.0.1.tgz", + "integrity": "sha512-Svl5GY5FQeN758fWKrjM6Qb7asvXeiZltlT4U2gVfl8Gx5UAv2sMR0LWo8yhsIZh2oQ0eFdZ59aoOOMV7b47VA==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-use-callback-ref": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-escape-keydown": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.3.tgz", + "integrity": "sha512-vyL82j40hcFicA+M4Ex7hVkB9vHgSse1ZWomAqV2Je3RleKGO5iM8KMOEtfoSB0PnIelMd2lATjTGMYqN5ylTg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-use-callback-ref": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.0.1.tgz", + "integrity": "sha512-v/5RegiJWYdoCvMnITBkNNx6bCj20fiaJnWtRkU18yITptraXjffz5Qbn05uOiQnOvi+dbkznkoaMltz1GnszQ==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-previous": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.0.1.tgz", + "integrity": "sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.0.1.tgz", + "integrity": "sha512-Cq5DLuSiuYVKNU8orzJMbl15TXilTnJKUCltMVQg53BQOF1/C5toAaGrowkgksdBQ9H+SRL23g0HDmg9tvmxXw==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/rect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.0.1.tgz", + "integrity": "sha512-ibay+VqrgcaI6veAojjofPATwledXiSmX+C0KrBk/xgpX9rBzPV3OsfwlhQdUOFbh+LKQorLYT+xTXW9V8yd0g==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-use-layout-effect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.0.3.tgz", + "integrity": "sha512-D4w41yN5YRKtu464TLnByKzMDG/JlMPHtfZgQAu9v6mNakUqGUI9vUrfQKz8NK41VMm/xbZbh76NUTVtIYqOMA==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-primitive": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.0.1.tgz", + "integrity": "sha512-fyrgCaedtvMg9NK3en0pnOYJdtfwxUcNolezkNPUsoX57X8oQk+NkqcvzHXD2uKNij6GXmWU9NDru2IWjrO4BQ==", + "dependencies": { + "@babel/runtime": "^7.13.10" + } + }, + "node_modules/@rushstack/eslint-patch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.2.tgz", + "integrity": "sha512-V+MvGwaHH03hYhY+k6Ef/xKd6RYlc4q8WBx+2ANmipHJcKuktNcI/NgEsJgdSUF6Lw32njT6OnrRsKYCdgHjYw==", + "dev": true + }, + "node_modules/@stablelib/aead": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/aead/-/aead-1.0.1.tgz", + "integrity": "sha512-q39ik6sxGHewqtO0nP4BuSe3db5G1fEJE8ukvngS2gLkBXyy6E7pLubhbYgnkDFv6V8cWaxcE4Xn0t6LWcJkyg==" + }, + "node_modules/@stablelib/binary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", + "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", + "dependencies": { + "@stablelib/int": "^1.0.1" + } + }, + "node_modules/@stablelib/blake2b": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", + "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/bytes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", + "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==" + }, + "node_modules/@stablelib/chacha": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/chacha/-/chacha-1.0.1.tgz", + "integrity": "sha512-Pmlrswzr0pBzDofdFuVe1q7KdsHKhhU24e8gkEwnTGOmlC7PADzLVxGdn2PoNVBBabdg0l/IfLKg6sHAbTQugg==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/chacha20poly1305": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/chacha20poly1305/-/chacha20poly1305-1.0.1.tgz", + "integrity": "sha512-MmViqnqHd1ymwjOQfghRKw2R/jMIGT3wySN7cthjXCBdO+qErNPUBnRzqNpnvIwg7JBCg3LdeCZZO4de/yEhVA==", + "dependencies": { + "@stablelib/aead": "^1.0.1", + "@stablelib/binary": "^1.0.1", + "@stablelib/chacha": "^1.0.1", + "@stablelib/constant-time": "^1.0.1", + "@stablelib/poly1305": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", + "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==" + }, + "node_modules/@stablelib/ed25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", + "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "dependencies": { + "@stablelib/random": "^1.0.2", + "@stablelib/sha512": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/hash": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" + }, + "node_modules/@stablelib/hkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hkdf/-/hkdf-1.0.1.tgz", + "integrity": "sha512-SBEHYE16ZXlHuaW5RcGk533YlBj4grMeg5TooN80W3NpcHRtLZLLXvKyX0qcRFxf+BGDobJLnwkvgEwHIDBR6g==", + "dependencies": { + "@stablelib/hash": "^1.0.1", + "@stablelib/hmac": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/hmac": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hmac/-/hmac-1.0.1.tgz", + "integrity": "sha512-V2APD9NSnhVpV/QMYgCVMIYKiYG6LSqw1S65wxVoirhU/51ACio6D4yDVSwMzuTJXWZoVHbDdINioBwKy5kVmA==", + "dependencies": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/int": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" + }, + "node_modules/@stablelib/keyagreement": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", + "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", + "dependencies": { + "@stablelib/bytes": "^1.0.1" + } + }, + "node_modules/@stablelib/nacl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@stablelib/nacl/-/nacl-1.0.4.tgz", + "integrity": "sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw==", + "dependencies": { + "@stablelib/poly1305": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3", + "@stablelib/xsalsa20": "^1.0.2" + } + }, + "node_modules/@stablelib/poly1305": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", + "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", + "dependencies": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/random": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", + "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/salsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/salsa20/-/salsa20-1.0.2.tgz", + "integrity": "sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/sha256": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/sha256/-/sha256-1.0.1.tgz", + "integrity": "sha512-GIIH3e6KH+91FqGV42Kcj71Uefd/QEe7Dy42sBTeqppXV95ggCcxLTk39bEr+lZfJmp+ghsR07J++ORkRELsBQ==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/sha512": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", + "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/utf8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/utf8/-/utf8-1.0.1.tgz", + "integrity": "sha512-FrYD1xadah/TtAP6VJ04lDD5h9rdDj/d8wH/jMYTtHqZBv9z2btdvEU8vTxdjdkFmo1b/BH+t3R1wi/mYhCCNg==" + }, + "node_modules/@stablelib/wipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" + }, + "node_modules/@stablelib/x25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", + "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", + "dependencies": { + "@stablelib/keyagreement": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/x25519-session": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@stablelib/x25519-session/-/x25519-session-1.0.4.tgz", + "integrity": "sha512-UZw67EJWSNTaou7Qp086fzGek7crrCQl2K7MoqEzslXxrm6vybySfcdsqaZ0ZpKq19IHWK8G0wAlFBy70srm3w==", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/keyagreement": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3" + } + }, + "node_modules/@stablelib/xsalsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz", + "integrity": "sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog==", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/salsa20": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@swc/helpers": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", + "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@swc/helpers/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" + }, + "node_modules/@taquito/beacon-wallet": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/beacon-wallet/-/beacon-wallet-16.2.0.tgz", + "integrity": "sha512-ajjtprR/+hXTRPA+5qNoAvaZh02cWTpFJ0FgJIKkUO5ygHFhBGQIEGwvzLqWvCEueM9zkFbX9Ux8gVOssOXjmg==", + "dependencies": { + "@airgap/beacon-dapp": "4.0.2", + "@taquito/taquito": "^16.2.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/core": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/core/-/core-16.2.0.tgz", + "integrity": "sha512-N1r7zVjpcT8MGtE9Kcel7OgEOrj4cvS7VPWJYKMuUltILBcUmViRcBHiK9qGV6pMdujnihKkupCI6S1LJXPoLg==", + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/http-utils": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-16.2.0.tgz", + "integrity": "sha512-3iPP6/zk+U3wFYhFp2/xFj81uZCJhe7unrTgwHS4KbhCTAZ584ux7ViVvy5WlT1WTgI1a+pAi0JH9aEiAqEXbg==", + "dependencies": { + "axios": "^0.26.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/http-utils/node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/@taquito/local-forging": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-16.2.0.tgz", + "integrity": "sha512-rYyRKudADi4U64XV1Viy63haNICEJ0vm/sMUBul7sixRF+wqmo4Adqt3a1oF4J9lQxc03Jx554SwaS5yF/cvZA==", + "dependencies": { + "@taquito/core": "^16.2.0", + "@taquito/utils": "^16.2.0", + "bignumber.js": "^9.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/michel-codec": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-16.2.0.tgz", + "integrity": "sha512-az477DkyqJkOmLex/QMWYhtpDnxZ1YpNykUYuuZppWYpdVUA0nHkLGMc5QcekeX3pLCFjf6r0AgOwcAwe3QnLA==", + "dependencies": { + "@taquito/core": "^16.2.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/michelson-encoder": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-16.2.0.tgz", + "integrity": "sha512-Rt2Slod+7TAqIyPQM5U1/YEoB6thATlbthF4SegsO/kL1i/IClrCOhDKMI8DQ0ZfGnH4nW7bqGJ+eU1TPNVwAg==", + "dependencies": { + "@taquito/rpc": "^16.2.0", + "@taquito/utils": "^16.2.0", + "bignumber.js": "^9.1.0", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/rpc": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-16.2.0.tgz", + "integrity": "sha512-nxcMJbAN53Cq7EJP2Cw/AnUcC2HADZiAbzOvnAIjcC8qmgr+f1Z1IuqfbrHv9CAf+SpEmWa1yMXoNCmixbxfbg==", + "dependencies": { + "@taquito/core": "^16.2.0", + "@taquito/http-utils": "^16.2.0", + "@taquito/utils": "^16.2.0", + "bignumber.js": "^9.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/taquito": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-16.2.0.tgz", + "integrity": "sha512-nkenSPUcOrivbeg1uxmUu9BIweVjjVchywH3NfZWajZ3W9sOiIe+IwLGJ2H5FPD2LZrt0X9zpFEaLlyDDZEVUQ==", + "hasInstallScript": true, + "dependencies": { + "@taquito/core": "^16.2.0", + "@taquito/http-utils": "^16.2.0", + "@taquito/local-forging": "^16.2.0", + "@taquito/michel-codec": "^16.2.0", + "@taquito/michelson-encoder": "^16.2.0", + "@taquito/rpc": "^16.2.0", + "@taquito/utils": "^16.2.0", + "bignumber.js": "^9.1.0", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/tzip12": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/tzip12/-/tzip12-16.2.0.tgz", + "integrity": "sha512-rod7E3HuRLmZYm+JdtTeD3tkETRRjlN/xq9eyq2xK/45pS+8hJLuQLwAYSj0r8e9GxADzJ7wVrMj1FqvW9+nSQ==", + "dependencies": { + "@taquito/michelson-encoder": "^16.2.0", + "@taquito/taquito": "^16.2.0", + "@taquito/tzip16": "^16.2.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/tzip16": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/tzip16/-/tzip16-16.2.0.tgz", + "integrity": "sha512-dh+ilrHhZrHaVy1lKgdER8dH6RfonyAuwfBRVrIdPFEXRBI3mbnRVzHZvxIQa7+AXK4jvsPLfmgHTFJEoacGSA==", + "dependencies": { + "@taquito/http-utils": "^16.2.0", + "@taquito/michelson-encoder": "^16.2.0", + "@taquito/rpc": "^16.2.0", + "@taquito/taquito": "^16.2.0", + "@taquito/utils": "^16.2.0", + "bignumber.js": "^9.1.0", + "crypto-js": "^4.1.1" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@taquito/utils": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-16.2.0.tgz", + "integrity": "sha512-Oa9oV0wwBHpgcVHTfINwXGcUlS1EVjCyBR9ntTVvYu6AqdktdS3N+6PPX+MaMt8eXT2bnEfXPWJKjA9I+yYljA==", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.3", + "@taquito/core": "^16.2.0", + "@types/bs58check": "^2.1.0", + "bignumber.js": "^9.1.0", + "blakejs": "^1.2.1", + "bs58check": "^2.1.2", + "buffer": "^6.0.3", + "elliptic": "^6.5.4", + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@types/bs58check": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.0.tgz", + "integrity": "sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/chrome": { + "version": "0.0.163", + "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.163.tgz", + "integrity": "sha512-g+3E2tg/ukFsEgH+tB3a/b+J1VSvq/8gh2Jwih9eq+T3Idrz7ngj97u+/ya58Bfei2TQtPlRivj1FsCaSnukDA==", + "dependencies": { + "@types/filesystem": "*", + "@types/har-format": "*" + } + }, + "node_modules/@types/filesystem": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.32.tgz", + "integrity": "sha512-Yuf4jR5YYMR2DVgwuCiP11s0xuVRyPKmz8vo6HBY3CGdeMj8af93CFZX+T82+VD1+UqHOxTq31lO7MI7lepBtQ==", + "dependencies": { + "@types/filewriter": "*" + } + }, + "node_modules/@types/filewriter": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.29.tgz", + "integrity": "sha512-BsPXH/irW0ht0Ji6iw/jJaK8Lj3FJemon2gvEqHKpCdDCeemHa+rI3WBGq5z7cDMZgoLjY40oninGxqk+8NzNQ==" + }, + "node_modules/@types/har-format": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.11.tgz", + "integrity": "sha512-T232/TneofqK30AD1LRrrf8KnjLvzrjWDp7eWST5KoiSzrBfRsLrWDPk4STQPW4NZG6v2MltnduBVmakbZOBIQ==" + }, + "node_modules/@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dependencies": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "26.0.24", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz", + "integrity": "sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w==", + "dev": true, + "dependencies": { + "jest-diff": "^26.0.0", + "pretty-format": "^26.0.0" + } + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" + }, + "node_modules/@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" + }, + "node_modules/@types/react": { + "version": "18.2.15", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.15.tgz", + "integrity": "sha512-oEjE7TQt1fFTFSbf8kkNuc798ahTUzn3Le67/PWjE8MAfYAD/qB7O8hSTcromLFqHCt9bcdOg5GXMokzTjJ5SA==", + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "17.0.20", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.20.tgz", + "integrity": "sha512-4pzIjSxDueZZ90F52mU3aPoogkHIoSIDG+oQ+wQK7Cy2B9S+MvOqY0uEA/qawKz381qrEDkvpwyt8Bm31I8sbA==", + "devOptional": true, + "dependencies": { + "@types/react": "^17" + } + }, + "node_modules/@types/react-dom/node_modules/@types/react": { + "version": "17.0.62", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.62.tgz", + "integrity": "sha512-eANCyz9DG8p/Vdhr0ZKST8JV12PhH2ACCDYlFw6DIO+D+ca+uP4jtEDEpVqXZrh/uZdXQGwk7whJa3ah5DtyLw==", + "devOptional": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-redux": { + "version": "7.1.25", + "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.25.tgz", + "integrity": "sha512-bAGh4e+w5D8dajd6InASVIyCo4pZLJ66oLb80F9OBLO1gKESbZcRCJpTT6uLXX+HAB57zw1WTdwJdAsewuTweg==", + "dependencies": { + "@types/hoist-non-react-statics": "^3.3.0", + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0", + "redux": "^4.0.0" + } + }, + "node_modules/@types/redux-logger": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@types/redux-logger/-/redux-logger-3.0.9.tgz", + "integrity": "sha512-cwYhVbYNgH01aepeMwhd0ABX6fhVB2rcQ9m80u8Fl50ZODhsZ8RhQArnLTkE7/Zrfq4Sz/taNoF7DQy9pCZSKg==", + "dev": true, + "dependencies": { + "redux": "^4.0.0" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.3", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", + "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==" + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", + "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==" + }, + "node_modules/@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@tzkt/oazapfts": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@tzkt/oazapfts/-/oazapfts-4.5.2.tgz", + "integrity": "sha512-swGzinGddQL6S40CY5X7OC5B1zYZLSKsDXnqI1YIgOQ9iXA91OT/jaB1HpQ2BHaExG24h5SaxckDL/WnlwM00w==", + "dependencies": { + "@apidevtools/swagger-parser": "^10.1.0", + "lodash": "^4.17.21", + "minimist": "^1.2.7", + "swagger2openapi": "^7.0.8", + "typescript": "^4.9.3" + }, + "bin": { + "oazapfts": "lib/codegen/cli.js" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + } + }, + "node_modules/@tzkt/oazapfts/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@tzkt/sdk-api": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tzkt/sdk-api/-/sdk-api-2.2.0.tgz", + "integrity": "sha512-CgmW9FZmjZEDW+32ahFoj7Wov9Dtx8vWfareWu3XjE8rqnN2/k+aSPfubIeAB3hjF6PKTrCocWMMd7lIpdEr0g==", + "dependencies": { + "@tzkt/oazapfts": "^4.5.2" + }, + "engines": { + "node": ">=14", + "npm": ">=6" + } + }, + "node_modules/@walletconnect/core": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.7.0.tgz", + "integrity": "sha512-xUeFPpElybgn1a+lknqtHleei4VyuV/4qWgB1nP8qQUAO6a5pNsioODrnB2VAPdUHJYBdx2dCt2maRk6g53IPQ==", + "dependencies": { + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-provider": "^1.0.12", + "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/jsonrpc-ws-connection": "^1.0.11", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/relay-auth": "^1.0.4", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.7.0", + "@walletconnect/utils": "2.7.0", + "events": "^3.3.0", + "lodash.isequal": "4.5.0", + "uint8arrays": "^3.1.0" + } + }, + "node_modules/@walletconnect/environment": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/environment/-/environment-1.0.1.tgz", + "integrity": "sha512-T426LLZtHj8e8rYnKfzsw1aG6+M0BT1ZxayMdv/p8yM0MU+eJDISqNY3/bccxRr4LrF9csq02Rhqt08Ibl0VRg==", + "dependencies": { + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/events": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/events/-/events-1.0.1.tgz", + "integrity": "sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==", + "dependencies": { + "keyvaluestorage-interface": "^1.0.0", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/heartbeat": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz", + "integrity": "sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q==", + "dependencies": { + "@walletconnect/events": "^1.0.1", + "@walletconnect/time": "^1.0.2", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/jsonrpc-provider": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", + "integrity": "sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g==", + "dependencies": { + "@walletconnect/jsonrpc-utils": "^1.0.8", + "@walletconnect/safe-json": "^1.0.2", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/jsonrpc-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz", + "integrity": "sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw==", + "dependencies": { + "keyvaluestorage-interface": "^1.0.0", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/jsonrpc-utils": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz", + "integrity": "sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==", + "dependencies": { + "@walletconnect/environment": "^1.0.1", + "@walletconnect/jsonrpc-types": "^1.0.3", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/jsonrpc-ws-connection": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.13.tgz", + "integrity": "sha512-mfOM7uFH4lGtQxG+XklYuFBj6dwVvseTt5/ahOkkmpcAEgz2umuzu7fTR+h5EmjQBdrmYyEBOWADbeaFNxdySg==", + "dependencies": { + "@walletconnect/jsonrpc-utils": "^1.0.6", + "@walletconnect/safe-json": "^1.0.2", + "events": "^3.3.0", + "tslib": "1.14.1", + "ws": "^7.5.1" + } + }, + "node_modules/@walletconnect/keyvaluestorage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.0.2.tgz", + "integrity": "sha512-U/nNG+VLWoPFdwwKx0oliT4ziKQCEoQ27L5Hhw8YOFGA2Po9A9pULUYNWhDgHkrb0gYDNt//X7wABcEWWBd3FQ==", + "dependencies": { + "safe-json-utils": "^1.1.1", + "tslib": "1.14.1" + }, + "peerDependencies": { + "@react-native-async-storage/async-storage": "1.x", + "lokijs": "1.x" + }, + "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + }, + "lokijs": { + "optional": true + } + } + }, + "node_modules/@walletconnect/logger": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/logger/-/logger-2.0.1.tgz", + "integrity": "sha512-SsTKdsgWm+oDTBeNE/zHxxr5eJfZmE9/5yp/Ku+zJtcTAjELb3DXueWkDXmE9h8uHIbJzIb5wj5lPdzyrjT6hQ==", + "dependencies": { + "pino": "7.11.0", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/relay-api": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", + "integrity": "sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg==", + "dependencies": { + "@walletconnect/jsonrpc-types": "^1.0.2", + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/relay-auth": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz", + "integrity": "sha512-kKJcS6+WxYq5kshpPaxGHdwf5y98ZwbfuS4EE/NkQzqrDFm5Cj+dP8LofzWvjrrLkZq7Afy7WrQMXdLy8Sx7HQ==", + "dependencies": { + "@stablelib/ed25519": "^1.0.2", + "@stablelib/random": "^1.0.1", + "@walletconnect/safe-json": "^1.0.1", + "@walletconnect/time": "^1.0.2", + "tslib": "1.14.1", + "uint8arrays": "^3.0.0" + } + }, + "node_modules/@walletconnect/safe-json": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@walletconnect/safe-json/-/safe-json-1.0.2.tgz", + "integrity": "sha512-Ogb7I27kZ3LPC3ibn8ldyUr5544t3/STow9+lzz7Sfo808YD7SBWk7SAsdBFlYgP2zDRy2hS3sKRcuSRM0OTmA==", + "dependencies": { + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/sign-client": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.7.0.tgz", + "integrity": "sha512-K99xa6GSFS04U+140yrIEi/VJJJ0Q1ov4jCaiqa9euILDKxlBsM7m5GR+9sq6oYyj18SluJY4CJTdeOXUJlarA==", + "dependencies": { + "@walletconnect/core": "2.7.0", + "@walletconnect/events": "^1.0.1", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.7.0", + "@walletconnect/utils": "2.7.0", + "events": "^3.3.0" + } + }, + "node_modules/@walletconnect/time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", + "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", + "dependencies": { + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/types": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.7.0.tgz", + "integrity": "sha512-aMUDUtO79WSBtC/bDetE6aFwdgwJr0tJ8nC8gnAl5ELsrjygEKCn6M8Q+v6nP9svG9yf5Rds4cImxCT6BWwTyw==", + "dependencies": { + "@walletconnect/events": "^1.0.1", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "events": "^3.3.0" + } + }, + "node_modules/@walletconnect/utils": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.7.0.tgz", + "integrity": "sha512-k32jrQeyJsNZPdmtmg85Y3QgaS5YfzYSPrAxRC2uUD1ts7rrI6P5GG2iXNs3AvWKOuCgsp/PqU8s7AC7CRUscw==", + "dependencies": { + "@stablelib/chacha20poly1305": "1.0.1", + "@stablelib/hkdf": "1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/sha256": "1.0.1", + "@stablelib/x25519": "^1.0.3", + "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.7.0", + "@walletconnect/window-getters": "^1.0.1", + "@walletconnect/window-metadata": "^1.0.1", + "detect-browser": "5.3.0", + "query-string": "7.1.1", + "uint8arrays": "^3.1.0" + } + }, + "node_modules/@walletconnect/window-getters": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.1.tgz", + "integrity": "sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==", + "dependencies": { + "tslib": "1.14.1" + } + }, + "node_modules/@walletconnect/window-metadata": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/window-metadata/-/window-metadata-1.0.1.tgz", + "integrity": "sha512-9koTqyGrM2cqFRW517BPY/iEtUDx2r1+Pwwu5m7sJ7ka79wi3EyqhqcICk/yDmv6jAS1rjKgTKXlEhanYjijcA==", + "dependencies": { + "@walletconnect/window-getters": "^1.0.1", + "tslib": "1.14.1" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/aria-hidden": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.3.tgz", + "integrity": "sha512-xcLxITLe2HYa1cnYnwCjkOO1PqUHQpozB8x9AR0OgWN2woOBi5kSDVxKfd0b7sb1hw5qFeJhXm9H1nu3xSfLeQ==", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/aria-hidden/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", + "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.1.tgz", + "integrity": "sha512-pZYPXPRl2PqWcsUs6LOMn+1f1532nEoPTYowBtqLwAW+W8vSVhkIGnmOX1t/UQjD6YGI0vcD2B1U7ZFGQH9jnQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.1.3" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.1.tgz", + "integrity": "sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, + "node_modules/ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==", + "dev": true + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/autoprefixer": { + "version": "10.4.14", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", + "integrity": "sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + } + ], + "dependencies": { + "browserslist": "^4.21.5", + "caniuse-lite": "^1.0.30001464", + "fraction.js": "^4.2.0", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axe-core": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.2.tgz", + "integrity": "sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/axios": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "dependencies": { + "follow-redirects": "^1.14.4" + } + }, + "node_modules/axobject-query": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", + "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/bplist-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", + "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "dev": true, + "dependencies": { + "big-integer": "^1.6.44" + }, + "engines": { + "node": ">= 5.10.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browserslist": { + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", + "node-releases": "^2.0.12", + "update-browserslist-db": "^1.0.11" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/bundle-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", + "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", + "dev": true, + "dependencies": { + "run-applescript": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==" + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001516", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001516.tgz", + "integrity": "sha512-Wmec9pCBY8CWbmI4HsjBeQLqDTqV91nFVR83DnZpYyRnPI1wePDsTg0bGLPC5VU/3OIZV1fmxEea1b+tFKe86g==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/cross-port-killer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cross-port-killer/-/cross-port-killer-1.4.0.tgz", + "integrity": "sha512-ujqfftKsSeorFMVI6JP25xMBixHEaDWVK+NarRZAGnJjR5AhebRQU+g+k/Lj8OHwM6f+wrrs8u5kkCdI7RLtxQ==", + "dev": true, + "bin": { + "kill-port": "source/cli.js" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" + }, + "node_modules/damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true + }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/deep-diff": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-0.3.8.tgz", + "integrity": "sha512-yVn6RZmHiGnxRKR9sJb3iVV2XTF1Ghh2DiWRZ3dMnGc43yUdWWF/kX6lQyk3+P84iprfWKU/8zFTrlkvtFm1ug==" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/default-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", + "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", + "dev": true, + "dependencies": { + "bundle-name": "^3.0.0", + "default-browser-id": "^3.0.0", + "execa": "^7.1.1", + "titleize": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", + "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", + "dev": true, + "dependencies": { + "bplist-parser": "^0.2.0", + "untildify": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-properties": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", + "dev": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-browser": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", + "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==" + }, + "node_modules/detect-node-es": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==" + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "node_modules/diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "dev": true, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/electron-to-chromium": { + "version": "1.4.463", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.463.tgz", + "integrity": "sha512-fT3hvdUWLjDbaTGzyOjng/CQhQJSQP8ThO3XZAoaxHvHo2kUXiRQVMj9M235l8uDFiNPsPa6KHT1p3RaR6ugRw==", + "dev": true + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/email-addresses": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", + "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/enhanced-resolve/node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/es-abstract": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.1.tgz", + "integrity": "sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.1", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "safe-array-concat": "^1.0.0", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "dev": true + }, + "node_modules/es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.45.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", + "integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.1.0", + "@eslint/js": "8.44.0", + "@humanwhocodes/config-array": "^0.11.10", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.6.0", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-next": { + "version": "13.4.12", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.4.12.tgz", + "integrity": "sha512-ZF0r5vxKaVazyZH/37Au/XItiG7qUOBw+HaH3PeyXltIMwXorsn6bdrl0Nn9N5v5v9spc+6GM2ryjugbjF6X2g==", + "dev": true, + "dependencies": { + "@next/eslint-plugin-next": "13.4.12", + "@rushstack/eslint-patch": "^1.1.3", + "@typescript-eslint/parser": "^5.42.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-import-resolver-typescript": "^3.5.2", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jsx-a11y": "^6.5.1", + "eslint-plugin-react": "^7.31.7", + "eslint-plugin-react-hooks": "5.0.0-canary-7118f5dd7-20230705" + }, + "peerDependencies": { + "eslint": "^7.23.0 || ^8.0.0", + "typescript": ">=3.3.1" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz", + "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz", + "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.11.0", + "resolve": "^1.22.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.5.tgz", + "integrity": "sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "get-tsconfig": "^4.5.0", + "globby": "^13.1.3", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3", + "synckit": "^0.8.5" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*" + } + }, + "node_modules/eslint-import-resolver-typescript/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-import-resolver-typescript/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", + "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.7.4", + "has": "^1.0.3", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.values": "^1.1.6", + "resolve": "^1.22.1", + "semver": "^6.3.0", + "tsconfig-paths": "^3.14.1" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-jsx-a11y": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz", + "integrity": "sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.20.7", + "aria-query": "^5.1.3", + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "ast-types-flow": "^0.0.7", + "axe-core": "^4.6.2", + "axobject-query": "^3.1.1", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "has": "^1.0.3", + "jsx-ast-utils": "^3.3.3", + "language-tags": "=1.0.5", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=4.0" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.33.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.0.tgz", + "integrity": "sha512-qewL/8P34WkY8jAqdQxsiL82pDUeT7nhs8IsuXgfgnsEloKCT4miAV9N9kGtx7/KM9NH/NCGUE7Edt9iGxLXFw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "array.prototype.tosorted": "^1.1.1", + "doctrine": "^2.1.0", + "estraverse": "^5.3.0", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "object.hasown": "^1.1.2", + "object.values": "^1.1.6", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.4", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.8" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "5.0.0-canary-7118f5dd7-20230705", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.0.0-canary-7118f5dd7-20230705.tgz", + "integrity": "sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.1.tgz", + "integrity": "sha512-CvefSOsDdaYYvxChovdrPo/ZGt8d5lrJWleAc1diXRKhHGiTYEI26cvo8Kle/wGnsizoCJjK73FMg1/IkIwiNA==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/eventsource": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.2.tgz", + "integrity": "sha512-xAH3zWhgO2/3KIniEKYPr8plNSzlGINOUqYj0m0u7AB81iRw8b/3E73W6AuU+6klLbaSFmZnaETQ2lXPfAydrA==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + }, + "node_modules/fast-glob": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fast-redact": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.2.0.tgz", + "integrity": "sha512-zaTadChr+NekyzallAMXATXLOR8MNx3zqpZ0MUF2aGf4EathnG0f32VLODNlY8IuGY3HoRO2L6/6fSzNsLaHIw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fetch-cookie": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.11.0.tgz", + "integrity": "sha512-BQm7iZLFhMWFy5CZ/162sAGjBfdNWb7a8LEqqnzsHFhxT/X/SVj/z2t2nu3aJvjlbQkrAlTUApplPRjWyH4mhA==", + "dependencies": { + "tough-cookie": "^2.3.3 || ^3.0.1 || ^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "dev": true, + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/fp-ts": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", + "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" + }, + "node_modules/fraction.js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", + "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/infusion" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-nonce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz", + "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.6.2.tgz", + "integrity": "sha512-E5XrT4CbbXcXWy+1jChlZmrmCwd5KGx502kDCXJJ7y898TtWW9FwoG5HfOLVRKmlmDGkWN2HM9Ho+/Y8F0sJDg==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/gh-pages": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-3.2.3.tgz", + "integrity": "sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg==", + "dev": true, + "dependencies": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^8.1.0", + "globby": "^6.1.0" + }, + "bin": { + "gh-pages": "bin/gh-pages.js", + "gh-pages-clean": "bin/gh-pages-clean.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/gh-pages/node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "dev": true, + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gh-pages/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/gh-pages/node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "dev": true, + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gh-pages/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/gh-pages/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/http2-client": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", + "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==" + }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", + "dev": true, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jiti": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.1.tgz", + "integrity": "sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.4.tgz", + "integrity": "sha512-fX2TVdCViod6HwKEtSWGHs57oFhVfCMwieb9PuRDgjDPh5XeqJiHFFFJCHxU5cnTc3Bu/GRL+kPiFmw8XWOfKw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyvaluestorage-interface": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", + "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==" + }, + "node_modules/language-subtag-registry": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", + "integrity": "sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==", + "dev": true + }, + "node_modules/language-tags": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.5.tgz", + "integrity": "sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ==", + "dev": true, + "dependencies": { + "language-subtag-registry": "~0.3.2" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "dependencies": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/lint-staged/node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/listr2/node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/listr2/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/next": { + "version": "13.4.10", + "resolved": "https://registry.npmjs.org/next/-/next-13.4.10.tgz", + "integrity": "sha512-4ep6aKxVTQ7rkUW2fBLhpBr/5oceCuf4KmlUpvG/aXuDTIf9mexNSpabUD6RWPspu6wiJJvozZREhXhueYO36A==", + "dependencies": { + "@next/env": "13.4.10", + "@swc/helpers": "0.5.1", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001406", + "postcss": "8.4.14", + "styled-jsx": "5.1.1", + "watchpack": "2.4.0", + "zod": "3.21.4" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=16.8.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "13.4.10", + "@next/swc-darwin-x64": "13.4.10", + "@next/swc-linux-arm64-gnu": "13.4.10", + "@next/swc-linux-arm64-musl": "13.4.10", + "@next/swc-linux-x64-gnu": "13.4.10", + "@next/swc-linux-x64-musl": "13.4.10", + "@next/swc-win32-arm64-msvc": "13.4.10", + "@next/swc-win32-ia32-msvc": "13.4.10", + "@next/swc-win32-x64-msvc": "13.4.10" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "fibers": ">= 3.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "fibers": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/next/node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/next/node_modules/postcss": { + "version": "8.4.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", + "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "dependencies": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/next/node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch-h2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", + "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==", + "dependencies": { + "http2-client": "^1.2.5" + }, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-readfiles": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz", + "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==", + "dependencies": { + "es6-promise": "^3.2.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/oas-kit-common": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", + "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==", + "dependencies": { + "fast-safe-stringify": "^2.0.7" + } + }, + "node_modules/oas-linter": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz", + "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==", + "dependencies": { + "@exodus/schemasafe": "^1.0.0-rc.2", + "should": "^13.2.1", + "yaml": "^1.10.0" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-resolver": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", + "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==", + "dependencies": { + "node-fetch-h2": "^2.3.0", + "oas-kit-common": "^1.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" + }, + "bin": { + "resolve": "resolve.js" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-schema-walker": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz", + "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==", + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-validator": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz", + "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==", + "dependencies": { + "call-me-maybe": "^1.0.1", + "oas-kit-common": "^1.0.8", + "oas-linter": "^3.2.2", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "reftools": "^1.1.9", + "should": "^13.2.1", + "yaml": "^1.10.0" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.6.tgz", + "integrity": "sha512-leTPzo4Zvg3pmbQ3rDK69Rl8GQvIqMWubrkxONG9/ojtFE2rD9fjMKfSI5BxW3osRH1m6VdzmqK8oAY9aT4x5w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.6.tgz", + "integrity": "sha512-VciD13dswC4j1Xt5394WR4MzmAQmlgN72phd/riNp9vtD7tp4QQWJ0R4wvclXcafgcYK8veHRed2W6XeGBvcfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.hasown": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.2.tgz", + "integrity": "sha512-B5UIT3J1W+WuWIU55h0mjlwaqxiE5vYENJXIXZ4VFe05pNYrkKuK0U/6aFcb0pKywYJh7IhfoqUfKVmrJJHZHw==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-exit-leak-free": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz", + "integrity": "sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", + "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", + "dev": true, + "dependencies": { + "default-browser": "^4.0.0", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open/node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openapi-types": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "peer": true + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pino": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-7.11.0.tgz", + "integrity": "sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg==", + "dependencies": { + "atomic-sleep": "^1.0.0", + "fast-redact": "^3.0.0", + "on-exit-leak-free": "^0.2.0", + "pino-abstract-transport": "v0.5.0", + "pino-std-serializers": "^4.0.0", + "process-warning": "^1.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.1.0", + "safe-stable-stringify": "^2.1.0", + "sonic-boom": "^2.2.1", + "thread-stream": "^0.15.1" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz", + "integrity": "sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ==", + "dependencies": { + "duplexify": "^4.1.2", + "split2": "^4.0.0" + } + }, + "node_modules/pino-abstract-transport/node_modules/duplexify": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", + "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + } + }, + "node_modules/pino-std-serializers": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz", + "integrity": "sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q==" + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/postcss": { + "version": "8.4.26", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.26.tgz", + "integrity": "sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.13", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", + "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "dev": true, + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-warning": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", + "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qrcode-svg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/qrcode-svg/-/qrcode-svg-1.1.0.tgz", + "integrity": "sha512-XyQCIXux1zEIA3NPb0AeR8UMYvXZzWEhgdBgBjH9gO7M48H9uoHzviNz8pXw3UzrAcxRRRn9gxHewAVK7bn9qw==", + "bin": { + "qrcode-svg": "bin/qrcode-svg.js" + } + }, + "node_modules/query-string": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.1.tgz", + "integrity": "sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==", + "dependencies": { + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==" + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-ga4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-ga4/-/react-ga4-2.1.0.tgz", + "integrity": "sha512-ZKS7PGNFqqMd3PJ6+C2Jtz/o1iU9ggiy8Y8nUeksgVuvNISbmrQtJiZNvC/TjDsqD0QlU5Wkgs7i+w9+OjHhhQ==" + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, + "node_modules/react-redux": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.1.1.tgz", + "integrity": "sha512-5W0QaKtEhj+3bC0Nj0NkqkhIv8gLADH/2kYFMTHxCVqQILiWzLv6MaLuV5wJU3BQEdHKzTfcvPN0WMS6SC1oyA==", + "dependencies": { + "@babel/runtime": "^7.12.1", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/use-sync-external-store": "^0.0.3", + "hoist-non-react-statics": "^3.3.2", + "react-is": "^18.0.0", + "use-sync-external-store": "^1.0.0" + }, + "peerDependencies": { + "@types/react": "^16.8 || ^17.0 || ^18.0", + "@types/react-dom": "^16.8 || ^17.0 || ^18.0", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0", + "react-native": ">=0.59", + "redux": "^4 || ^5.0.0-beta.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-redux/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + }, + "node_modules/react-remove-scroll": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz", + "integrity": "sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==", + "dependencies": { + "react-remove-scroll-bar": "^2.3.3", + "react-style-singleton": "^2.2.1", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.0", + "use-sidecar": "^1.1.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-remove-scroll-bar": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.4.tgz", + "integrity": "sha512-63C4YQBUt0m6ALadE9XV56hV8BgJWDmmTPY758iIJjfQKt2nYwoUrPk0LXRXcB/yIj82T1/Ixfdpdk68LwIB0A==", + "dependencies": { + "react-style-singleton": "^2.2.1", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-remove-scroll-bar/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/react-remove-scroll/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/react-style-singleton": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz", + "integrity": "sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==", + "dependencies": { + "get-nonce": "^1.0.0", + "invariant": "^2.2.4", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-style-singleton/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/read-cache/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/real-require": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz", + "integrity": "sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg==", + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, + "node_modules/redux-logger": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/redux-logger/-/redux-logger-3.0.6.tgz", + "integrity": "sha512-JoCIok7bg/XpqA1JqCqXFypuqBbQzGQySrhFzewB7ThcnysTO30l4VCst86AuB9T9tuT03MAA56Jw2PNhRSNCg==", + "dependencies": { + "deep-diff": "^0.3.5" + } + }, + "node_modules/redux-loop": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/redux-loop/-/redux-loop-6.2.0.tgz", + "integrity": "sha512-Je/5EdfwX8J99sRq9Y6FsTs/5KIfulli66AMkdu8VnHUXlnas9cA62BjuipUt1nVL9yo+UxCK91TtZ1KHILEwg==", + "peerDependencies": { + "redux": "^3.7.2 || ^4.0.0" + } + }, + "node_modules/reftools": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz", + "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==", + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", + "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/run-applescript": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", + "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-applescript/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/run-applescript/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz", + "integrity": "sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-json-utils": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/safe-json-utils/-/safe-json-utils-1.1.1.tgz", + "integrity": "sha512-SAJWGKDs50tAbiDXLf89PDwt9XYkWyANFWVzn4dTXl5QyI8t2o/bW5/OJl3lvc2WVU4MEpTo9Yz5NVFNsp+OJQ==" + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/seroval": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/seroval/-/seroval-0.5.1.tgz", + "integrity": "sha512-ZfhQVB59hmIauJG5Ydynupy8KHyr5imGNtdDhbZG68Ufh1Ynkv9KOYOAABf71oVbQxJ8VkWnMHAjEHE7fWkH5g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dependencies": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "node_modules/should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dependencies": { + "should-type": "^1.4.0" + } + }, + "node_modules/should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "node_modules/should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==" + }, + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dependencies": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "node_modules/should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/solid-js": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.7.8.tgz", + "integrity": "sha512-XHBWk1FvFd0JMKljko7FfhefJMTSgYEuVKcQ2a8hzRXfiuSJAGsrPPafqEo+f6l+e8Oe3cROSpIL6kbzjC1fjQ==", + "dependencies": { + "csstype": "^3.1.0", + "seroval": "^0.5.0" + } + }, + "node_modules/sonic-boom": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.8.0.tgz", + "integrity": "sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg==", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, + "node_modules/stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" + }, + "node_modules/strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz", + "integrity": "sha512-6zOCOcJ+RJAQshcTvXPHoxoQGONa3e/Lqx90wUA+wEzX78sg5Bo+1tQo4N0pohS0erG9qtCqJDjNCQBjeWVxyg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "regexp.prototype.flags": "^1.4.3", + "side-channel": "^1.0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/sucrase": { + "version": "3.33.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.33.0.tgz", + "integrity": "sha512-ARGC7vbufOHfpvyGcZZXFaXCMZ9A4fffOGC5ucOW7+WHDGlAe8LJdf3Jts1sWhDeiI1RSWrKy5Hodl+JWGdW2A==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "7.1.6", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sucrase/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/swagger2openapi": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", + "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==", + "dependencies": { + "call-me-maybe": "^1.0.1", + "node-fetch": "^2.6.1", + "node-fetch-h2": "^2.3.0", + "node-readfiles": "^0.2.0", + "oas-kit-common": "^1.0.8", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "oas-validator": "^5.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" + }, + "bin": { + "boast": "boast.js", + "oas-validate": "oas-validate.js", + "swagger2openapi": "swagger2openapi.js" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "dependencies": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/synckit/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "dev": true + }, + "node_modules/tailwindcss": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", + "integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==", + "dev": true, + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.5.3", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.2.12", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.18.2", + "lilconfig": "^2.1.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.23", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.1", + "postcss-nested": "^6.0.1", + "postcss-selector-parser": "^6.0.11", + "resolve": "^1.22.2", + "sucrase": "^3.32.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tailwindcss/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/tailwindcss/node_modules/postcss-js": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dev": true, + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/tailwindcss/node_modules/postcss-load-config": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.1.tgz", + "integrity": "sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==", + "dev": true, + "dependencies": { + "lilconfig": "^2.0.5", + "yaml": "^2.1.1" + }, + "engines": { + "node": ">= 14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/tailwindcss/node_modules/postcss-nested": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", + "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.11" + }, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/tailwindcss/node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/thread-stream": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-0.15.2.tgz", + "integrity": "sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA==", + "dependencies": { + "real-require": "^0.1.0" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/titleize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", + "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true + }, + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/untildify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/use-callback-ref": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.0.tgz", + "integrity": "sha512-3FT9PRuRdbB9HfXhEq35u4oZkvpJ5kuYbpqhCfmiZyReuRgpnhDlbr2ZEnnuS0RrJAPn6l23xjFg9kpDM+Ms7w==", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-callback-ref/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/use-sidecar": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz", + "integrity": "sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==", + "dependencies": { + "detect-node-es": "^1.1.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sidecar/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", + "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/batcher-ui/package.json b/batcher-ui/package.json index 7fe9fefa..81e4ba89 100644 --- a/batcher-ui/package.json +++ b/batcher-ui/package.json @@ -2,44 +2,20 @@ "name": "batcher", "version": "1.0.0", "private": true, - "description": "An out-of-box UI solution for enterprise applications", + "description": "Batch clearing DEX", "scripts": { - "analyze": "cross-env ANALYZE=1 umi build", - "build": "umi build", - "build:ghostnet": "UMI_ENV=ghostnet umi build", - "build:ghostnet-ci": "UMI_ENV=ghostnet NODE_OPTIONS='--openssl-legacy-provider' umi build", - "build:mainnet": "UMI_ENV=mainnet umi build", - "build:mainnet-ci": "UMI_ENV=mainnet NODE_OPTIONS='--openssl-legacy-provider' umi build", - "deploy": "npm run build && npm run gh-pages", - "dev": "npm run start:dev", "gh-pages": "gh-pages -d dist", - "i18n-remove": "pro i18n-remove --locale=zh-CN --write", - "postinstall": "umi g tmp", - "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc", - "lint-staged": "lint-staged", - "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", - "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style", - "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", - "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto", - "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", - "openapi": "umi openapi", - "playwright": "playwright install && playwright test", - "prepare": "husky install", + "prepare": "cd .. && husky install batcher-ui/.husky", "prettier": "prettier -c --write \"src/**/*\"", - "serve": "umi-serve", - "start": "cross-env UMI_ENV=dev umi dev", - "start:ghostnet": "cross-env UMI_ENV=ghostnet umi dev", - "start:ghostnet-ci": "cross-env UMI_ENV=ghostnet NODE_OPTIONS='--openssl-legacy-provider' umi dev", - "start:mainnet": "cross-env UMI_ENV=mainnet umi dev", - "start:mainnet-ci": "cross-env UMI_ENV=mainnet NODE_OPTIONS='--openssl-legacy-provider' umi dev", - "test": "umi test", - "test:component": "umi test ./src/components", - "test:e2e": "node ./tests/run-tests.js", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "dev": "ENV=ghostnet next dev", + "build": "next build", + "start": "next start -p 80", + "start:ghostnet": "ENV=ghostnet next start -p 80", + "build:ghostnet": "ENV=ghostnet next build", + "lint": "next lint" }, "lint-staged": { - "**/*.less": "stylelint --syntax less", - "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", "**/*.{js,jsx,tsx,ts,less,md,json}": [ "prettier --write" ] @@ -50,68 +26,56 @@ "not ie <= 10" ], "dependencies": { - "@ant-design/icons": "^4.7.0", - "@ant-design/pro-components": "1.1.1", - "@dipdup/tzkt-api": "^0.0.1", + "@airgap/beacon-sdk": "^4.0.6", + "@fortawesome/fontawesome-svg-core": "^6.4.2", + "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@fortawesome/react-fontawesome": "^0.2.0", "@microsoft/signalr": "^6.0.10", + "@radix-ui/react-dialog": "^1.0.4", + "@radix-ui/react-form": "^0.0.3", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-radio-group": "^1.1.3", + "@radix-ui/react-select": "^1.2.2", + "@radix-ui/react-tooltip": "^1.0.6", "@taquito/beacon-wallet": "^16.0.0", "@taquito/taquito": "^16.0.0", "@taquito/tzip12": "^16.0.0", "@taquito/tzip16": "^16.0.0", - "@umijs/route-utils": "^2.0.0", - "antd": "^4.20.0", - "classnames": "^2.3.0", + "@types/react-redux": "^7.1.25", + "@tzkt/sdk-api": "^2.2.0", "date-fns": "^2.29.3", - "dotenv": "^16.0.3", - "jsonpath-plus": "^7.2.0", - "lodash": "^4.17.0", - "moment": "^2.29.0", - "omit.js": "^2.0.2", - "rc-menu": "^9.1.0", - "rc-util": "^5.16.0", - "react": "^16.0.2", - "react-dev-inspector": "^1.7.0", - "react-dom": "^16.0.2", - "react-helmet-async": "^1.2.0", - "react-hot-toast": "^2.4.0", - "typescript": "^4.4.2", - "umi": "^3.5.0" + "fp-ts": "^2.16.0", + "next": "^13.4.10", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-ga4": "^2.1.0", + "react-redux": "^8.1.1", + "redux": "^4.2.1", + "redux-logger": "^3.0.6", + "redux-loop": "^6.2.0" }, "devDependencies": { - "@ant-design/pro-cli": "^2.1.0", - "@playwright/test": "^1.17.0", - "@types/classnames": "^2.3.1", - "@types/express": "^4.17.0", - "@types/history": "^4.7.0", "@types/jest": "^26.0.0", - "@types/lodash": "^4.14.0", - "@types/react": "^17.0.0", + "@types/react": "^18.2.15", "@types/react-dom": "^17.0.0", - "@types/react-helmet": "^6.1.0", - "@umijs/fabric": "^2.11.1", - "@umijs/openapi": "^1.6.0", - "@umijs/plugin-blocks": "^2.2.0", - "@umijs/plugin-esbuild": "^1.4.0", - "@umijs/plugin-openapi": "^1.3.3", - "@umijs/preset-ant-design-pro": "^1.3.0", - "@umijs/preset-dumi": "^1.1.0", - "@umijs/preset-react": "^2.1.0", - "cross-env": "^7.0.0", + "@types/redux-logger": "^3.0.9", + "assert": "^2.0.0", + "autoprefixer": "^10.4.14", "cross-port-killer": "^1.3.0", - "detect-installer": "^1.0.0", - "eslint": "^7.32.0", + "eslint": "^8.45.0", + "eslint-config-next": "^13.4.12", + "eslint-config-prettier": "^8.8.0", "gh-pages": "^3.2.0", - "husky": "^7.0.4", - "jsdom-global": "^3.0.0", - "lint-staged": "^10.0.0", - "mockjs": "^1.1.0", + "husky": "^8.0.0", + "lint-staged": "^13.2.3", + "postcss": "^8.4.26", + "postcss-import": "^15.1.0", "prettier": "^2.5.0", - "stylelint": "^13.0.0", - "swagger-ui-dist": "^4.12.0", - "typescript": "^4.5.0", - "umi-serve": "^1.9.10" + "process": "^0.11.10", + "tailwindcss": "^3.3.3", + "typescript": "^5.1.6" }, "engines": { - "node": ">=12.0.0" + "node": ">=16.0.0" } } diff --git a/batcher-ui/pages/404.tsx b/batcher-ui/pages/404.tsx new file mode 100644 index 00000000..b4a41cd5 --- /dev/null +++ b/batcher-ui/pages/404.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import Link from 'next/link'; +import Head from 'next/head'; + +const NoFoundPage = () => ( + <> + + BATCHER - Not found + +
+

Sorry, the page you visited does not exist

+ + + Back Home + +
+ +); + +export default NoFoundPage; diff --git a/batcher-ui/pages/_app.tsx b/batcher-ui/pages/_app.tsx new file mode 100644 index 00000000..584a92bc --- /dev/null +++ b/batcher-ui/pages/_app.tsx @@ -0,0 +1,62 @@ +import Footer from '../src/components/Footer'; +import React, { useEffect, useState } from 'react'; +import { AppProps } from 'next/app'; +import { TezosToolkitProvider } from '../src/contexts/tezos-toolkit'; +import { WalletProvider } from '../src/contexts/wallet'; +import { EventsProvider } from '../src/contexts/events'; +import '../styles/globals.css'; +import { Provider } from 'react-redux'; +import { store } from '../src/store'; +import NavBar from '../src/components/NavBar'; +import ReactGA from 'react-ga4'; +import * as api from '@tzkt/sdk-api'; +import Head from 'next/head'; +import { config } from '@fortawesome/fontawesome-svg-core'; +import '@fortawesome/fontawesome-svg-core/styles.css'; + +config.autoAddCss = false; + +process.env.NEXT_PUBLIC_GA_TRACKING_ID && + ReactGA.initialize(process.env.NEXT_PUBLIC_GA_TRACKING_ID); + +const App = ({ Component }: AppProps) => { + const [isMenuOpen, setIsMenuOpen] = useState(false); + + // Override TZKT base url if we are in ghostnet + useEffect(() => { + console.warn(process.env.NEXT_PUBLIC_NETWORK_TARGET); + if (process.env.NEXT_PUBLIC_NETWORK_TARGET === 'GHOSTNET') { + console.log('GHOSTNET !!'); + api.defaults.baseUrl = 'https://api.ghostnet.tzkt.io/'; + } + }, []); + + return ( +
+ + + BATCHER + + + + + +
+
+ + {!isMenuOpen && } +
+
+
+
+
+
+
+
+ ); +}; + +export default App; diff --git a/batcher-ui/pages/about.tsx b/batcher-ui/pages/about.tsx new file mode 100644 index 00000000..fce5fb91 --- /dev/null +++ b/batcher-ui/pages/about.tsx @@ -0,0 +1,78 @@ +import React from 'react'; +import Link from 'next/link'; + +const About = () => { + return ( +
+

+ WHAT IS BATCHER? +

+ +

+ Batcher is a new type of DEX that we have named a batch clearing DEX. It + provides a dark pool-like trading environment without using liquidity + pools or having the issue of significant slippage. Batcher’s goal is to + enable users to deposit tokens with the aim of being swapped at a + fair price with + bounded slippage and almost no impermanent loss. This + means that all orders for potential swaps between two pairs of tokens + are collected over a finite period (currently 10 minutes). This is + deemed the batch. After the order collection period is over, the batch + is closed to additions. Batcher then waits for the next Oracle price for + the token pair. When this is received, the batch is terminated and then + Batcher looks to match the maximum amount of orders at the fairest + possible price. +

+ +

TIMELINE

+ +

+ For V1, the deposit window will be 10 mins and then a wait time + of 2 minutes before awaiting the oracle price. Once we got oracle price, + the batch is cleared. +

+ +

DISCLAIMER

+

+ + All investing comes with risk and DeFi is no exception. The content in + this Dapp contains no financial advice. Please do your own thorough + research and note that all users funds are traded at their own risk. + No reimbursement will be made and Marigold will not assume + responsibility for any losses. + +

+ +

NOTE

+ +

+ Batcher can deal with token value imbalance which means that holders of{' '} + tzBTC + and holders of USDT can swap different amounts as long as there + is a market for the + trade on both sides. +

+ +

+ Batcher has been designed to be composable with other high liquidity + paths in the Tezos ecosystem, specifically the Sirius DEX; thus, the two + pairs that are supported in V1 are tzBTC/USDT and tzBTC/EURL. +

+

+ For more information including blog posts and faqs, please visit the + Batcher project page at Marigold.dev. +

+ + {'Batcher Project Page'} + +
+ ); +}; + +export default About; diff --git a/batcher-ui/pages/holdings.tsx b/batcher-ui/pages/holdings.tsx new file mode 100644 index 00000000..f70dc545 --- /dev/null +++ b/batcher-ui/pages/holdings.tsx @@ -0,0 +1,127 @@ +import React, { useCallback, useContext, useEffect } from 'react'; +import { TezosToolkitContext } from 'src/contexts/tezos-toolkit'; +import { useDispatch, useSelector } from 'react-redux'; +import { getHoldings, userAddressSelector } from 'src/reducers'; +import { getHoldings as getHoldingsAction } from 'src/actions'; + +const Holdings = () => { + const { tezos } = useContext(TezosToolkitContext); + const contractAddress = process.env.NEXT_PUBLIC_BATCHER_CONTRACT_HASH; + + const { open, cleared } = useSelector(getHoldings); + const userAddress = useSelector(userAddressSelector); + + const dispatch = useDispatch(); + + const hasClearedHoldings = useCallback( + () => Object.values(cleared).some(holdings => holdings > 0), + [cleared] + ); + + useEffect(() => { + if (userAddress) { + dispatch(getHoldingsAction(userAddress)); + } + }, [userAddress, dispatch]); + + const redeem = async (): Promise => { + try { + if (!tezos || !contractAddress) { + throw new Error('Failed to initialize communication with contract.'); + } + const contractWallet = await tezos.wallet.at(contractAddress); + + let redeemTransaction = await contractWallet.methods.redeem().send(); + + if (redeemTransaction) { + //?useless + // message.loading('Attempting to redeem holdings...', 0); + const confirm = await redeemTransaction.confirmation(); + if (!confirm.completed) { + console.error('Failed to redeem holdings' + confirm); + } else { + // setOpenHoldings(new Map()); + // setClearedHoldings(new Map()); + console.info('Successfully redeemed holdings'); + } + } else { + throw new Error('Failed to redeem tokens'); + } + } catch (error: any) { + console.error('Unable to redeem holdings' + error); + } + }; + return ( +
+

Holdings

+

Open/closed batches

+
+ + + {Object.keys(open).map((b, i) => ( + + ))} + + + + + {Object.values(open).map((b, i) => { + return ( + + ); + })} + + +
+ {b} +
+ {b} +
+ +

Cleared batches (Redeemable)

+ + + + + {Object.keys(cleared).map((b, i) => ( + + ))} + + + + + {Object.values(cleared).map((b, i) => { + return ( + + ); + })} + + +
+ {b} +
+ {b} +
+ <> + {hasClearedHoldings() && ( + + )} + +
+ ); +}; + +export default Holdings; diff --git a/batcher-ui/pages/index.tsx b/batcher-ui/pages/index.tsx new file mode 100644 index 00000000..cb31db4f --- /dev/null +++ b/batcher-ui/pages/index.tsx @@ -0,0 +1,44 @@ +import React, { useEffect } from 'react'; +import Exchange from '../src/components/Exchange'; +import BatcherInfo from '../src/components/BatcherInfo'; +import PriceStrategy from '../src/components/PriceStrategy'; + +import { useSelector, useDispatch } from 'react-redux'; +import { userAddressSelector } from '../src/reducers'; +import { + fetchUserBalances, + batcherSetup, + batcherUnsetup, +} from '../src/actions'; + + +const Welcome = () => { + const userAddress = useSelector(userAddressSelector); + + const dispatch = useDispatch(); + + useEffect(() => { + dispatch(batcherSetup()); + return () => { + dispatch(batcherUnsetup()); + }; + }, [dispatch]); + + useEffect(() => { + if (userAddress) { + dispatch(fetchUserBalances()); + } + }, [userAddress, dispatch]); + + return ( +
+ +
+ + +
+
+ ); +}; + +export default Welcome; diff --git a/batcher-ui/pages/marketmaker.tsx b/batcher-ui/pages/marketmaker.tsx new file mode 100644 index 00000000..e391330e --- /dev/null +++ b/batcher-ui/pages/marketmaker.tsx @@ -0,0 +1,58 @@ +import React, { useCallback, useContext, useEffect } from 'react'; +import { TezosToolkitContext } from 'src/contexts/tezos-toolkit'; +import { useDispatch, useSelector } from 'react-redux'; +import { getMarketHoldings, userAddressSelector } from 'src/reducers'; +import { getMarketHoldings as getMarketHoldingsAction } from 'src/actions'; + +const Holdings = () => { + const { tezos } = useContext(TezosToolkitContext); + const contractAddress = process.env.NEXT_PUBLIC_BATCHER_CONTRACT_HASH; + + const { vaults } = useSelector(getMarketHoldings); + const userAddress = useSelector(userAddressSelector); + + const dispatch = useDispatch(); + + useEffect(() => { + if (userAddress) { + dispatch(getMarketHoldingsAction(userAddress)); + } + }, [userAddress, dispatch]); + + return ( +
+

Market Vaults

+

Total

+ + + + {Object.keys(vaults).map((b, i) => ( + + ))} + + + + + {Object.values(vaults).map((b, i) => { + return ( + + ); + })} + + +
+ {b} +
+ {b.total_shares} +
+
+ ); +}; + +export default Holdings; diff --git a/batcher-ui/pages/volumes.tsx b/batcher-ui/pages/volumes.tsx new file mode 100644 index 00000000..14a857ef --- /dev/null +++ b/batcher-ui/pages/volumes.tsx @@ -0,0 +1,109 @@ +import React, { useEffect } from 'react'; +import { PriceStrategy } from 'src/types'; +import { volumesSelector } from 'src/reducers'; +import { useSelector } from 'react-redux'; +import { useDispatch } from 'react-redux'; +import { getCurrentBatchNumber } from 'src/actions'; + +const Volume = () => { + const { sell, buy } = useSelector(volumesSelector); + + const dispatch = useDispatch(); + + useEffect(() => { + dispatch(getCurrentBatchNumber()); + }, [dispatch]); + + const listOfBuyVolumesColumns = [ + { + title: 'Buy Minus Volume', + key: PriceStrategy.WORSE, + dataIndex: 'buyMinusVolume', + }, + { + title: 'Buy Exact Volume', + key: PriceStrategy.EXACT, + dataIndex: 'buyExactVolume', + }, + { + title: 'Buy Plus Volume', + key: PriceStrategy.BETTER, + dataIndex: 'buyPlusVolume', + }, + ]; + + const listOfSellVolumesColumns = [ + { + title: 'Sell Minus Volume', + key: PriceStrategy.WORSE, + dataIndex: 'sellMinusVolume', + }, + { + title: 'Sell Exact Volume', + key: PriceStrategy.EXACT, + dataIndex: 'sellExactVolume', + }, + { + title: 'Sell Plus Volume', + key: PriceStrategy.BETTER, + dataIndex: 'sellPlusVolume', + }, + ]; + return ( +
+

Volumes

+ + + + {listOfBuyVolumesColumns.map((b, i) => ( + + ))} + + + + + {listOfBuyVolumesColumns.map((b, i) => { + return ( + + ); + })} + + + + + {listOfSellVolumesColumns.map((b, i) => ( + + ))} + + + + + {listOfSellVolumesColumns.map((b, i) => { + return ( + + ); + })} + + +
+ {b.title} +
+ {buy[b.key]} +
+ {b.title} +
+ {sell[b.key]} +
+
+ ); +}; + +export default Volume; diff --git a/batcher-ui/playwright.config.ts b/batcher-ui/playwright.config.ts deleted file mode 100644 index ec1b31db..00000000 --- a/batcher-ui/playwright.config.ts +++ /dev/null @@ -1,22 +0,0 @@ -// playwright.config.ts -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const config: PlaywrightTestConfig = { - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 2 : 0, - use: { - trace: 'on-first-retry', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - ], -}; -export default config; diff --git a/batcher-ui/postcss.config.js b/batcher-ui/postcss.config.js new file mode 100644 index 00000000..e569373f --- /dev/null +++ b/batcher-ui/postcss.config.js @@ -0,0 +1,8 @@ +module.exports = { + plugins: { + 'postcss-import': {}, + 'tailwindcss/nesting': {}, + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/batcher-ui/img/batcher-logo.png b/batcher-ui/public/batcher-logo.png similarity index 100% rename from batcher-ui/img/batcher-logo.png rename to batcher-ui/public/batcher-logo.png diff --git a/batcher-ui/public/favicon.ico b/batcher-ui/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4d0f39b09935ee94242af5e8945b4e0ddd6e74c8 GIT binary patch literal 15406 zcmeI3e~esJ700Iq6!8Z?5`R=95=DWA!tT78VnK0icYf_EAhHO70+ECgMgIT+sZqBf zYNdZb|EN&`g@6ItN=YRYu|hSKP(To@Kq+l$w_SGLd$U_Y`Bln}pYMI|&U^Fb&F;2o zH8D=|_P%@Xx#ymH?)i1keVfTl$sCk9;)o38F`3H`&SYk0GMQtJ3F^lmnaTWywyv(Q z|8tqlqaV&>jt7Pzj0oB(CjG0PQvXoJ@xN8c`RjQGD>=7!;=zq6Jz4*RYR>Jh&EKv#-u7@!J1GmI zS9992w(NCAW|Ucv>g8Nbd~GoHU*_RmZ9!lC>w>l8Y$==uH*+vnbHQtWP&AZt-fqz( z+Gu}5v?l4VX1xo_j{h7ou-L4XHA}7nS#y^ep1>Q{eztfeo@q|eB7EYh-E-zRLp-;% z8JP?AbxeCCIPuZ!9cva%!fW;q88C9>_)F|~$!)M6)>lCe)5A7JDmZFg> zWP?4{9*NIU@BVv}ojHc5z$5##KYyi@hCjkSd>=V^37)*hI&Rfo?9VycaUnZ7e-;r(^=@oF$xHGXEOvVzFFWUK{D|7EQAyVZRC8>PIduSciRasQo^xeYD!uR@O(s-M!Qeq*(}K7F!u$Tl)=a}qyo zZ^HkJ`uiIPX|Kyp?J8irCYXY59_pLK+c;eOU3`MKds4>j=`;ErhYsG+h4;gkM}>RV ztj7B+gzO@8k0x9>yBjJ{Udz1z;POf#K#u%ZkPC7%DI=u+o5ZD zbG((+tan))#=c8d!S7r6fOhxy)PD?~E8y>sXj`X#WZ~)F{3wx){WYcn<3s<0wne4J zT71nCd5*)_cj=3PF>+JCA@D1<*OrZ`)tq-Xa`qtWU5DL0$8nxKgmDAZ{{@XZB%c<# zob|7Wa0Wi2l=IHB{qeHo)V_xwT!>w}H{PCnmt2){wPJbt;8D!?JMce+AN;B4VEvD% z-Hs{ey&pl>F5;ZyCBN|R%~JQ!>5RKM=_`!g$hoV4Uu4JIvQTIoEWh3349{TflRVRG zUmOqf-xI|M+7s_F$&7_%j}%`JI~sqeaMk>zm$VU28b5oz8vBuD)_SSowTU&oHSlIB zFa1&rOqgAH*#?XCE0 z@r+k8cAEAlpxb*Yt}DIyU5bOOe!o8F#M(#U$*r^{?YLz8(PEd|)t_k`ME?MAKN)Y{ zcwZxwNpqS(c|vSlvEy^gjtU$!>xJG2JIJr$p0ymxTki7hxM4inf)c-gX6_a*9j zV(WK3!N$jya`kiA`#a-p7ldbRhG0s3AK`}asjEKaRKwoZ0UGBw#4$Jivr@Hx+AJ;<=P z$;fncCJ?^|Ek0sf#WcvAH!2;m^GkPVA7d=KWONGM>a2h2V?OEK8l3?G9jIR_T^3H} zxt=~Vcib1lhnci1h9_rnhK-r3dT>_p?$&$oi_Ut`I1N5MDI4{L8C#E( z&9YFogtkTSbCqnJZL@gjyIC=hv60wH*-YAYf%k_NHq@(!jjcr=q4z0Z?o@lA^X<0N zj#UY+70|elvUx^{_schg{22qU_N^fwVqxT4&;!nOI)8fuqN9p#fNvf3Rq{=iS9Xj_ z`7-UF#VKDG@3-&l*LTDDWBTa**!HW`p29;vK977ce0$o^>v)e5fBuktyMjHI?_S=t zxn}QOKWieB zMknI2fMP6gZGx^xJFP>p8Zg$*$ME@k#*2mfi4DQq7W=ZE7N5+1%RhnFU7NI(T914^ z{nDq{+`JRp#@CznZhWy~;86Yy4&EiZqJ#ZcjBRrZqQO%vE?Xk`l>V}YHex${`0Bv?bjIvJ!yEAab{^uY$SxiTD(0NB%f>CzvzM^z*UdSl_R#||*Z(?B z(puFXaQw za~Cu$Eav?S!}eX2!|>9t!q;JfC8xW|zT{{?t{W-;+khjNe3Ch@#fa*iHn)8Wvpe5#F` z*A=F_A4tL#XAb3%N8Poh^U86zOOBJ{I@Nn-49@^p^FE^k-Zy$r_PD(qKc+FUv*TWC z*5G&}+OOmo_Uq6}-qrn$Ia{U7HzpnIL~p#^?#b$ru5weQ@1$bmo~ zv|ez)mvs8W976LB-L5-c7Q419-|vPvw1zdsnO?3?*m7tbuKm3+r5C*feg}GZ32VKH z_YL@kvt(OK+2Ps9hSrDO_y5MTqgvgVu<7KL9e)KdmjB#=M*0k27q-va+5%qAsNQot zcLP6M%8#Dj3emY%&5fMKn7_%U%f2I53wZEh?gr>UKm6NIBYrMA^%C_Vn`5&WwN7By zum`e1D`z{k&&UTMZ!b_ED{{vVzCPa1Pwt(?p?J!i1M%y?J+B<1?VG3sejfP$VDp)? zW(~ftn1AIFZnW z5~VB1mgX_K!MW}qIxku5v>(Tl(0zBa;&RC{cTi_B2X`#Qmyv$0txA@ObIRFQWtYa~ zyPZp=*2x{&58&zjJb#ru1$g1VGxCKvtlni?u|Hlkx4*NLb-y9L>r4ucTcGWosNbw} z4|VZK_P)-eec8>kiTPv)AD2ER=bCKY>;t)f>2YPI6ra?{M*Ev$`TT^)#pIlmt;0@io5wk6p?%6r_r8M@#ac^g@pY0>QldlTDxge)8 z0qxkFGC4irkSzk<#+-c9=Iz1vw((xJ4cf`|dvBGnd9rih+vC5s9eUh(8vx_>PAg_U~#pfXZe?f-+fDX-{ zjPJE;GPa*sT=H2&hM0G)of|sH!T3w%GnLPf4`t5HQNN*aHFffk!B4(eJ~;+6l#FlX z)9E*7dSmna65zKmmYBeOMLGa4R-4#_7$wNX1^U2R z4^=D!taz(^xj)E1M*1S$p}wg9Rq*TEl8Ysec3#C)^y!?a_>jBYXgoZcOZ#S>0WEx5 zY4}cz2Y$tRa~1n31`PH(!WSPKelPkA_(!F4iZSE;_MJ6OgD3j_@gCNq^M}4wJ=6Mg z%}1YPXG1Ap|D+wKQn@l{+Fs2L8=Vn7@@wW>JM62qQR2Pi4IK00 z9a_i(w4S4-E8yM%%v#EI$n>*1Gs-U&v;Nm;e?jL86Q=>!mm57JE`MpX=*-H!UXHO* zZjQ69&bVptQ5&%h=SNF#O1XLP|y z*+1IL##GsIeA;JpZkDV=hxSl9X>^x8SRUwhL~Z+<`95n^I40NwyB9(E_cYszY+ZxA zDX!g;v_o32aw^0Fi@xhBQVR8Qvr5CWg`w&LsvU-Twh5Z)on4sQ$Xf#q*vo)+54xwspZTZ^!DehckS zDn9W>xuE1|?JK;~cW@?0*cxxQLK|Pg_vpxw?1XrqI#)|OK4Y@?8ok;2xrUB(yzeU4 zD!ft%CCcrP>j{K0@G5M*qIZT_O0Uy*#-NZHBA62@|9gK7>?F=y% zu1|MBPXqHfy1j`q87r#3O?OH?_-Dmrx@%H=Li>1kmt(rS5+6mwaeAU+M^1O89L zoYiEh3Z*+*Os&-r%V9cG+#gj`u|E_VLsz}y9%2WY=n?TU%_=FX)P z^|oEQFZ;zj^W;a6ZSFk1=S*COuc6(pY2tO5wQ}cbVy##Df;n{eYwl*p&5>Jr_PrdK zYI1SJ<;t5YCR0oZ{mR`TAv1<$sF0$ + ({ + type: 'NEW_EVENT', + payload: { event }, + } as const); + +export type EventActions = ReturnType; diff --git a/batcher-ui/src/actions/exchange.ts b/batcher-ui/src/actions/exchange.ts new file mode 100644 index 00000000..9930d0b7 --- /dev/null +++ b/batcher-ui/src/actions/exchange.ts @@ -0,0 +1,123 @@ +import { BatcherStatus, CurrentSwap, PriceStrategy } from '../types'; + +export const updatePriceStrategy = (priceStrategy: PriceStrategy) => + ({ + type: 'UDPATE_PRICE_STATEGY', + payload: { priceStrategy }, + } as const); + +export const reverseSwap = () => + ({ + type: 'REVERSE_SWAP', + } as const); + +export const changePair = (pair: string, isReverse: boolean) => + ({ + type: 'CHANGE_PAIR', + payload: { pair, isReverse }, + } as const); + +export const getPairsInfos = (pair: string) => + ({ + type: 'GET_PAIR_INFOS', + payload: { pair }, + } as const); + +export const updatePairsInfos = ({ + currentSwap, + pair, +}: { + currentSwap: Omit; + pair: string; +}) => + ({ + type: 'UPDATE_PAIR_INFOS', + payload: { currentSwap, pair }, + } as const); + +export const getBatcherStatus = () => + ({ + type: 'GET_BATCHER_STATUS', + } as const); + +export const updateBatcherStatus = ({ + status, + at, + startTime, +}: { + status: BatcherStatus; + at: string; + startTime: string | null; +}) => + ({ + type: 'UDPATE_BATCHER_STATUS', + payload: { status, at, startTime }, + } as const); + +export const getCurrentBatchNumber = () => + ({ + type: 'GET_CURRENT_BATCHER_NUMBER', + } as const); + +//TODO: fix that +export const updateBatchNumber = (batchNumber: number | undefined) => + ({ + type: 'UDPATE_BATCH_NUMBER', + payload: { batchNumber }, + } as const); + +export const batcherSetup = () => + ({ + type: 'BATCHER_SETUP', + } as const); + +export const batcherTimerId = (timerId: number) => + ({ + type: 'BATCHER_TIMER_ID', + payload: { timerId }, + } as const); + +export const batcherUnsetup = () => + ({ + type: 'BATCHER_UNSETUP', + } as const); + +export const getOraclePrice = () => + ({ + type: 'GET_ORACLE_PRICE', + } as const); + +export const updateOraclePrice = (oraclePrice: number) => + ({ + type: 'UPDATE_ORACLE_PRICE', + payload: { oraclePrice }, + } as const); + +export const getVolumes = () => + ({ + type: 'GET_VOLUMES', + } as const); + +export const updateVolumes = (volumes: unknown) => + ({ + type: 'UPDATE_VOLUMES', + payload: { volumes }, + } as const); + +export type ExchangeActions = + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType; diff --git a/batcher-ui/src/actions/holdings.ts b/batcher-ui/src/actions/holdings.ts new file mode 100644 index 00000000..b7460078 --- /dev/null +++ b/batcher-ui/src/actions/holdings.ts @@ -0,0 +1,23 @@ +import { HoldingsState } from 'src/types'; + +export const redeem = () => + ({ + type: 'REDEEM', + } as const); + +export const updateHoldings = (holdings: HoldingsState) => + ({ + type: 'UPDATE_HOLDINGS', + payload: { holdings }, + } as const); + +export const getHoldings = (userAddress: string | undefined) => + ({ + type: 'GET_HOLDINGS', + payload: { userAddress }, + } as const); + +export type HoldingsActions = + | ReturnType + | ReturnType + | ReturnType; diff --git a/batcher-ui/src/actions/index.ts b/batcher-ui/src/actions/index.ts new file mode 100644 index 00000000..343dbc5f --- /dev/null +++ b/batcher-ui/src/actions/index.ts @@ -0,0 +1,18 @@ +import { WalletActions } from './wallet'; +import { ExchangeActions } from './exchange'; +import { EventActions } from './events'; +import { HoldingsActions } from './holdings'; +import { MarketHoldingsActions } from './marketholdings'; + +export * from './wallet'; +export * from './exchange'; +export * from './events'; +export * from './holdings'; +export * from './marketholdings'; + +export type Actions = + | WalletActions + | ExchangeActions + | EventActions + | HoldingsActions + | MarketHoldingsActions; diff --git a/batcher-ui/src/actions/marketholdings.ts b/batcher-ui/src/actions/marketholdings.ts new file mode 100644 index 00000000..dcec722f --- /dev/null +++ b/batcher-ui/src/actions/marketholdings.ts @@ -0,0 +1,35 @@ +import { MarketHoldingsState } from 'src/types'; + +export const addLiquidity = () => + ({ + type: 'ADDLIQUIDITY', + }) as const; + +export const removeLiquidity = () => + ({ + type: 'REMOVELIQUIDITY', + }) as const; + +export const claimRewards = () => + ({ + type: 'CLAIMREWARDS', + }) as const; + +export const updateMarketHoldings = (vaults: MarketHoldingsState) => + ({ + type: 'UPDATE_MARKET_HOLDINGS', + payload: { vaults }, + }) as const; + +export const getMarketHoldings = (userAddress: string | undefined) => + ({ + type: 'GET_MARKET_HOLDINGS', + payload: { userAddress }, + }) as const; + +export type MarketHoldingsActions = + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType; diff --git a/batcher-ui/src/actions/wallet.ts b/batcher-ui/src/actions/wallet.ts new file mode 100644 index 00000000..c4aa9f95 --- /dev/null +++ b/batcher-ui/src/actions/wallet.ts @@ -0,0 +1,39 @@ +// import { Option } from 'fp-ts/Option'; +import { Balances } from 'src/utils/utils'; + +const connectedWallet = ({ userAddress }: { userAddress: string }) => + ({ + type: 'CONNECTED_WALLET', + payload: { + userAddress, + }, + } as const); + +const disconnectedWallet = () => + ({ + type: 'DISCONNECTED_WALLET', + } as const); + +const fetchUserBalances = () => + ({ + type: 'FETCH_USER_BALANCES', + } as const); + +const gotUserBalances = (balances: Balances) => + ({ + type: 'GOT_USER_BALANCES', + balances, + } as const); + +export { + connectedWallet, + disconnectedWallet, + fetchUserBalances, + gotUserBalances, +}; + +export type WalletActions = + | ReturnType + | ReturnType + | ReturnType + | ReturnType; diff --git a/batcher-ui/src/app.tsx b/batcher-ui/src/app.tsx deleted file mode 100644 index 80f14337..00000000 --- a/batcher-ui/src/app.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import Footer from '@/components/Footer'; -import React, { useState, useEffect } from 'react'; -import RightContent from '@/components/RightContent'; -import { AccountInfo } from '@airgap/beacon-sdk'; -import { BeaconWallet } from '@taquito/beacon-wallet'; -import { PageLoading } from '@ant-design/pro-components'; -import type { RunTimeLayoutConfig } from 'umi'; -import defaultSettings from '../config/defaultSettings'; -import Main from './pages/Main'; -import { Spin, Image } from 'antd'; -import MarigoldLogo from '../img/marigold-logo.png'; -import { TezosToolkit } from '@taquito/taquito'; -Spin.setDefaultIndicator(); - -export const initialStateConfig = { - loading: , -}; - -export async function getInitialState(): Promise { - return { - wallet: null, - userAddress: null, - userAccount: null, - settings: defaultSettings, - }; -} - -export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { - return { - rightContentRender: () => , - disableContentMargin: false, - waterMarkProps: { - content: initialState?.currentUser?.name, - }, - footerRender: () =>