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 001/154] 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 002/154] 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 003/154] 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 004/154] 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 005/154] 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 0a660bb576e233ddb38af3a3002cfa9860037aa8 Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:13:53 +0300 Subject: [PATCH 006/154] Release new contract to Ghostnet due to faucet changes (#374) * 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 * 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 * 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 * Changed to use a reduced swap structure (name only) to reduce duplication in storage (#350) * 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 --------- Co-authored-by: Cyril B Co-authored-by: aguillon Co-authored-by: Ulrik Strid --- batcher-ui/config/config.ghostnet.ts | 2 +- 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 | 44 +- batcher/storage/initial_storage_mainnet.mligo | 40 +- 9 files changed, 971 insertions(+), 879 deletions(-) diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index a6a55455..467bde0a 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: 'KT1VsdkeG3PZZ5yraiBJTdKWhT9C8nNiLGu1', }, metas: [ { 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..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" }) @@ -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 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 007/154] 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 008/154] 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 009/154] 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 010/154] 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 0d5364416d7f59d5c2e774953c0374d3799ccc92 Mon Sep 17 00:00:00 2001 From: Cyril B Date: Tue, 25 Jul 2023 12:15:23 +0200 Subject: [PATCH 011/154] add google analytics tracking (#385) --- batcher-ui/config/config.ghostnet.ts | 1 + batcher-ui/config/config.mainnet.ts | 1 + batcher-ui/package.json | 1 + batcher-ui/src/app.tsx | 3 +++ batcher-ui/src/typings.d.ts | 1 + 5 files changed, 7 insertions(+) diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index 467bde0a..875d7f2e 100644 --- a/batcher-ui/config/config.ghostnet.ts +++ b/batcher-ui/config/config.ghostnet.ts @@ -55,6 +55,7 @@ export default defineConfig({ 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: 'KT1VsdkeG3PZZ5yraiBJTdKWhT9C8nNiLGu1', + GA_TRACKING_ID: 'G-2K59PEELC8', }, metas: [ { diff --git a/batcher-ui/config/config.mainnet.ts b/batcher-ui/config/config.mainnet.ts index c1255f75..92c5c02a 100644 --- a/batcher-ui/config/config.mainnet.ts +++ b/batcher-ui/config/config.mainnet.ts @@ -55,6 +55,7 @@ export default defineConfig({ 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', + GA_TRACKING_ID: 'G-VS1FBNXJ7N', }, metas: [ { diff --git a/batcher-ui/package.json b/batcher-ui/package.json index 7fe9fefa..d1bc6a09 100644 --- a/batcher-ui/package.json +++ b/batcher-ui/package.json @@ -72,6 +72,7 @@ "react": "^16.0.2", "react-dev-inspector": "^1.7.0", "react-dom": "^16.0.2", + "react-ga4": "^2.1.0", "react-helmet-async": "^1.2.0", "react-hot-toast": "^2.4.0", "typescript": "^4.4.2", diff --git a/batcher-ui/src/app.tsx b/batcher-ui/src/app.tsx index 80f14337..1f61d3f6 100644 --- a/batcher-ui/src/app.tsx +++ b/batcher-ui/src/app.tsx @@ -10,8 +10,11 @@ import Main from './pages/Main'; import { Spin, Image } from 'antd'; import MarigoldLogo from '../img/marigold-logo.png'; import { TezosToolkit } from '@taquito/taquito'; +import ReactGA from "react-ga4"; Spin.setDefaultIndicator(); +ReactGA.initialize(GA_TRACKING_ID); + export const initialStateConfig = { loading: , }; diff --git a/batcher-ui/src/typings.d.ts b/batcher-ui/src/typings.d.ts index bd5e6c8d..c6d7703b 100644 --- a/batcher-ui/src/typings.d.ts +++ b/batcher-ui/src/typings.d.ts @@ -31,3 +31,4 @@ declare const REACT_APP_TZBTC_HASH; declare const REACT_APP_USDT_HASH; declare const REACT_APP_BATCHER_URI; declare const REACT_APP_PATH_TO_BATCHER_LOGO; +declare const GA_TRACKING_ID; From 4f62ac15d3f0e750b6e4949ab60a54cf1a8f614d Mon Sep 17 00:00:00 2001 From: Cyril B Date: Tue, 25 Jul 2023 12:36:02 +0200 Subject: [PATCH 012/154] edit pipelines [skip ci] --- .github/workflows/docker-ghostnet.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-ghostnet.yml b/.github/workflows/docker-ghostnet.yml index a923952b..dc35b7f4 100644 --- a/.github/workflows/docker-ghostnet.yml +++ b/.github/workflows/docker-ghostnet.yml @@ -13,6 +13,8 @@ on: jobs: ui: + # Only run this job if it's a direct push or a *merged* pull request + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) strategy: matrix: network: [ghostnet] @@ -38,7 +40,7 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push release version + - name: Build and push release version of ui uses: docker/build-push-action@v3 with: file: ./batcher-ui/Dockerfile.${{ matrix.network }} 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 013/154] 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 014/154] 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 015/154] [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 016/154] 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 017/154] 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 018/154] 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 019/154] 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 020/154] 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 021/154] 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 9f2ad1005fa47d289e69f5e003443b6c5684a68c Mon Sep 17 00:00:00 2001 From: "Jason Ridgway-Taylor (~misfur-mondut)" <57174310+glottologist@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:52:11 +0300 Subject: [PATCH 022/154] Current mainnet contract (#393) * Added enforcement of correct side when depositing tokens (#390) * Added enforcement of correct side when depositing tokens * Built contract * Enforce side (#391) * Added enforcement of correct side when depositing tokens * Built contract * :/:Dockerfile.tick.ghostnet * Enforce side (#392) * Added enforcement of correct side when depositing tokens * Built contract * :/:Dockerfile.tick.ghostnet * Added correct tokens for ghostnet contract * Switched UI to new ghostnet contract --- Dockerfile.tick.ghostnet | 3 +- batcher-ui/config/config.ghostnet.ts | 3 +- batcher/Makefile | 2 + batcher/batcher-ghostnet.tz | 47 +++++++++++++++---- batcher/batcher.mligo | 17 ++++++- .../storage/initial_storage_ghostnet.mligo | 34 ++++++++++++-- 6 files changed, 91 insertions(+), 15 deletions(-) diff --git a/Dockerfile.tick.ghostnet b/Dockerfile.tick.ghostnet index 6313e66b..8f9c841f 100644 --- a/Dockerfile.tick.ghostnet +++ b/Dockerfile.tick.ghostnet @@ -12,4 +12,5 @@ WORKDIR /etc/run COPY ./tick.sh /etc/run/ -CMD [ "/etc/run/tick.sh", "-b", "KT1VbeN9etQe5c2b6EAFfCZVaSTpiieHj5u1", "-f", "150" ] \ No newline at end of file +CMD [ "/etc/run/tick.sh", "-b", "KT1Txkbx4sDc3qXQubG48vL3ojoTK4HH8Ci8", "-f", "150" ] + diff --git a/batcher-ui/config/config.ghostnet.ts b/batcher-ui/config/config.ghostnet.ts index 875d7f2e..a2026c66 100644 --- a/batcher-ui/config/config.ghostnet.ts +++ b/batcher-ui/config/config.ghostnet.ts @@ -54,8 +54,9 @@ 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: 'KT1VsdkeG3PZZ5yraiBJTdKWhT9C8nNiLGu1', + REACT_APP_BATCHER_CONTRACT_HASH: 'KT1UPMR3WkoFRJYmBBbvv4Z9bBhKYuhCx7Cq', GA_TRACKING_ID: 'G-2K59PEELC8', + }, metas: [ { diff --git a/batcher/Makefile b/batcher/Makefile index 7c5478eb..c0844e03 100644 --- a/batcher/Makefile +++ b/batcher/Makefile @@ -1,7 +1,9 @@ .PHONY: test + 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 diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 90d3b8b1..197a24d2 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -1044,9 +1044,40 @@ { PUSH string "/" ; CONCAT ; SWAP ; CONCAT } ; GET ; IF_NONE { PUSH nat 117 ; FAILWITH } {} ; + DUP ; GET 8 ; - IF { DROP 4 ; PUSH nat 125 ; FAILWITH } + IF { DROP 5 ; PUSH nat 125 ; FAILWITH } { DUP 4 ; + CAR ; + PUSH nat 0 ; + DUP 6 ; + GET 5 ; + COMPARE ; + EQ ; + IF { SWAP ; + CAR ; + CAR ; + CAR ; + CAR ; + SWAP ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + IF {} { PUSH nat 138 ; FAILWITH } } + { SWAP ; + CAR ; + CDR ; + CAR ; + SWAP ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + IF {} { PUSH nat 138 ; FAILWITH } } ; + DUP 4 ; CAR ; CAR ; CDR ; @@ -2617,17 +2648,12 @@ DIG 2 ; CAR ; DUP ; - CDR ; - GET 3 ; - SWAP ; CAR ; CAR ; - GET 3 ; - PAIR ; - DUP ; CAR ; DUP 2 ; CDR ; + CAR ; DIG 4 ; DUP 3 ; DUP 3 ; @@ -2635,7 +2661,12 @@ 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) ; + NONE (pair (pair (pair (pair string (option address) nat (option string)) nat) + (pair string (option address) nat (option string))) + address + string + nat + bool) ; SWAP ; UPDATE ; DUP 3 ; diff --git a/batcher/batcher.mligo b/batcher/batcher.mligo index 4e7102a6..0f23fb82 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -39,7 +39,9 @@ [@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 incorrect_side_specified: nat = 138n +[@inline] let token_name_not_in_list_of_valid_tokens : nat = 139n + (* Constants *) @@ -1699,6 +1701,18 @@ 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 + +[@inline] +let enforce_correct_side + (order:external_swap_order) + (valid_swap:valid_swap) : unit = + let swap = order.swap in + if order.side = 0n then + if swap.from.token.name = valid_swap.swap.from.token.name then () else failwith incorrect_side_specified + else + if swap.from.token.name = valid_swap.swap.to.name 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. *) [@inline] @@ -1708,6 +1722,7 @@ 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 diff --git a/batcher/storage/initial_storage_ghostnet.mligo b/batcher/storage/initial_storage_ghostnet.mligo index 28e33428..2a642f93 100644 --- a/batcher/storage/initial_storage_ghostnet.mligo +++ b/batcher/storage/initial_storage_ghostnet.mligo @@ -28,8 +28,21 @@ let f(_:unit) : Batcher.Storage.t = { valid_swaps = Map.literal [ ("tzBTC/USDT", { swap = { - from = "tzBTC"; - to = "USDT"; + from = { + amount = 1n; + token = { + name = "tzBTC"; + address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); + decimals = 8n; + standard = Some "FA1.2 token" + } + }; + to = { + name = "USDT"; + address = Some(("KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR" : address)); + decimals = 6n; + standard = Some "FA2 token"; + } }; oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); oracle_asset_name = "BTC-USDT"; @@ -39,8 +52,21 @@ let f(_:unit) : Batcher.Storage.t = { ); ("tzBTC/EURL", { swap = { - from = "tzBTC"; - to = "EURL"; + from = { + amount = 1n; + token = { + name = "tzBTC"; + address = Some(("KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS" : address)); + decimals = 8n; + standard = Some "FA1.2 token"; + } + }; + to = { + name = "EURL"; + address = Some(("KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS" : address)); + decimals = 6n; + standard = Some "FA2 token"; + } }; oracle_address = ("KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ": address); oracle_asset_name = "BTC-EUR"; From ed3aa217c14e10feb1ec03ace9ff2ca316522236 Mon Sep 17 00:00:00 2001 From: Quentin Burg Date: Fri, 1 Sep 2023 20:29:50 +0200 Subject: [PATCH 023/154] Current mainnet contract (#395) * Added enforcement of correct side when depositing tokens (#390) * Added enforcement of correct side when depositing tokens * Built contract * Enforce side (#391) * Added enforcement of correct side when depositing tokens * Built contract * :/:Dockerfile.tick.ghostnet * Enforce side (#392) * Added enforcement of correct side when depositing tokens * Built contract * :/:Dockerfile.tick.ghostnet * Added correct tokens for ghostnet contract * Switched UI to new ghostnet contract * Enforce side (#394) * Added enforcement of correct side when depositing tokens * Built contract * :/:Dockerfile.tick.ghostnet * Added correct tokens for ghostnet contract * Switched UI to new ghostnet contract * Changed enforce side code to parse side first before checking * Updated contract storage for mainnet --------- Co-authored-by: Jason Ridgway-Taylor (~misfur-mondut) <57174310+glottologist@users.noreply.github.com> --- batcher/batcher-ghostnet.tz | 54 +++++++++++-------- batcher/batcher-storage-ghostnet.tz | 24 +++++++-- batcher/batcher.mligo | 6 ++- batcher/storage/initial_storage_mainnet.mligo | 19 +++++-- 4 files changed, 72 insertions(+), 31 deletions(-) diff --git a/batcher/batcher-ghostnet.tz b/batcher/batcher-ghostnet.tz index 197a24d2..0cd7cf15 100644 --- a/batcher/batcher-ghostnet.tz +++ b/batcher/batcher-ghostnet.tz @@ -1049,34 +1049,44 @@ IF { DROP 5 ; PUSH nat 125 ; FAILWITH } { DUP 4 ; CAR ; - PUSH nat 0 ; - DUP 6 ; + DUP 5 ; GET 5 ; + PUSH nat 0 ; + DUP 2 ; COMPARE ; EQ ; - IF { SWAP ; - CAR ; - CAR ; - CAR ; - CAR ; + IF { DROP ; UNIT ; LEFT unit } + { PUSH nat 1 ; SWAP ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - IF {} { PUSH nat 138 ; FAILWITH } } - { SWAP ; - CAR ; - CDR ; - CAR ; - SWAP ; - CAR ; - CAR ; - CAR ; COMPARE ; EQ ; - IF {} { PUSH nat 138 ; FAILWITH } } ; + IF { UNIT ; RIGHT unit } { PUSH nat 106 ; FAILWITH } } ; + IF_LEFT + { DROP ; + SWAP ; + CAR ; + CAR ; + CAR ; + CAR ; + SWAP ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + IF {} { PUSH nat 138 ; FAILWITH } } + { DROP ; + SWAP ; + CAR ; + CDR ; + CAR ; + SWAP ; + CAR ; + CAR ; + CAR ; + COMPARE ; + EQ ; + IF {} { PUSH nat 138 ; FAILWITH } } ; DUP 4 ; CAR ; CAR ; diff --git a/batcher/batcher-storage-ghostnet.tz b/batcher/batcher-storage-ghostnet.tz index 7b272f77..70d97851 100644 --- a/batcher/batcher-storage-ghostnet.tz +++ b/batcher/batcher-storage-ghostnet.tz @@ -5,11 +5,27 @@ (Pair (Pair {} 1) {} { Elt "tzBTC/EURL" - (Pair (Pair "tzBTC" "EURL") "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" "BTC-EUR" 6 False) ; + (Pair (Pair (Pair (Pair "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) 1) + "EURL" + (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") + 6 + (Some "FA2 token")) + "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 (Pair (Pair (Pair "tzBTC" (Some "KT1P8RdJ5MfHMK5phKJ5JsfNfask5v2b2NQS") 8 (Some "FA1.2 token")) 1) + "USDT" + (Some "KT1WNrZ7pEbpmYBGPib1e7UVCeC6GA6TkJYR") + 6 + (Some "FA2 token")) + "KT1DG2g5DPYWqyHKGpRL579YkYZwJxibwaAZ" + "BTC-USDT" + 6 + False) }) + { Elt "EURL" (Pair "EURL" (Some "KT1RcHjqDWWycYQGrz4KBYoGZSMmMuVpkmuS") 6 (Some "FA2 token")) ; + Elt "USDT" (Pair "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 0f23fb82..981dc953 100644 --- a/batcher/batcher.mligo +++ b/batcher/batcher.mligo @@ -1707,9 +1707,11 @@ let enforce_correct_side (order:external_swap_order) (valid_swap:valid_swap) : 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.token.name then () else failwith incorrect_side_specified - else + | Sell -> if swap.from.token.name = valid_swap.swap.to.name then () else failwith incorrect_side_specified diff --git a/batcher/storage/initial_storage_mainnet.mligo b/batcher/storage/initial_storage_mainnet.mligo index 1085b217..070db9a1 100644 --- a/batcher/storage/initial_storage_mainnet.mligo +++ b/batcher/storage/initial_storage_mainnet.mligo @@ -28,8 +28,21 @@ let f(_:unit) : Batcher.Storage.t = { valid_swaps = Map.literal [ ("tzBTC/USDT", { swap = { - from = "tzBTC"; - to = "USDT"; + from = { + amount = 1n; + token = { + name = "tzBTC"; + address = Some(("KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn" : address)); + decimals = 8n; + standard = Some "FA1.2 token" + } + }; + to = { + name = "USDT"; + address = Some(("KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o" : address)); + decimals = 6n; + standard = Some "FA2 token"; + } }; oracle_address = ("KT1EhS7KVk6cAaYjUpg4jM1VjPGLJTrT9vqG": address); oracle_asset_name = "BTC-USDT"; @@ -58,7 +71,7 @@ let f(_:unit) : Batcher.Storage.t = { user_batch_ordertypes = (Big_map.empty: Batcher.user_batch_ordertypes); fee_in_mutez = 10_000mutez; fee_recipient = ("tz1burnburnburnburnburnburnburjAYjjX" : address); - administrator = ("tz1aSL2gjFnfh96Xf1Zp4T36LxbzKuzyvVJ4" : address); + administrator = ("tz1ftWawLjmm6poX3R73Xc1UaFRoucCSpnhf" : address); limit_on_tokens_or_pairs = 10n; deposit_time_window_in_seconds = 600n; scale_factor_for_oracle_staleness = 1n From 75f33729531bb8349c75cc00b56ed95178c9eafd Mon Sep 17 00:00:00 2001 From: Cyril B Date: Mon, 4 Sep 2023 17:02:13 +0200 Subject: [PATCH 024/154] edit pipeline to create a docker image for beta version. [skip ci] --- .../docker-ghostnet-front-staging.yml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/docker-ghostnet-front-staging.yml diff --git a/.github/workflows/docker-ghostnet-front-staging.yml b/.github/workflows/docker-ghostnet-front-staging.yml new file mode 100644 index 00000000..b3db635b --- /dev/null +++ b/.github/workflows/docker-ghostnet-front-staging.yml @@ -0,0 +1,67 @@ +name: Docker ghostnet front staging + +on: + push: + branches: + - '378-upgrade-batcher-ui' + - 'release-ghostnet-beta' + pull_request: + branches: + - '378-upgrade-batcher-ui' + - 'release-ghostnet-beta' + types: + - closed + workflow_dispatch: + +jobs: + ui: + strategy: + matrix: + network: [ghostnet] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.0.0 + with: + submodules: true + + - name: Set outputs + id: vars + run: | + 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@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push ui version 378-upgrade-batcher-ui + if: github.ref == 'refs/heads/378-upgrade-batcher-ui' + uses: docker/build-push-action@v3 + with: + file: ./batcher-ui/Dockerfile.${{ matrix.network }} + context: ./batcher-ui/ + push: ${{ github.ref == 'refs/heads/378-upgrade-batcher-ui' }} + tags: | + ghcr.io/marigold-dev/batcher-${{ matrix.network }}:staging + ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-staging + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push ui version on release-ghostnet-beta + if: github.ref == 'refs/heads/release-ghostnet-beta' + uses: docker/build-push-action@v3 + with: + file: ./batcher-ui/Dockerfile.${{ matrix.network }} + context: ./batcher-ui/ + push: ${{ github.ref == 'refs/heads/release-ghostnet-beta' }} + tags: | + ghcr.io/marigold-dev/batcher-${{ matrix.network }}:beta + ghcr.io/marigold-dev/batcher-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-beta + cache-from: type=gha + cache-to: type=gha,mode=max From 0bf9f330edc0bea40c95c5e5db6937019b9e3221 Mon Sep 17 00:00:00 2001 From: Quentin Burg Date: Mon, 4 Sep 2023 17:48:21 +0200 Subject: [PATCH 025/154] Upgrade Batcher UI (#388) * :construction: :boom: init migration to NextJS * :construction: :art: :lipstick: rewriting style without less & antd * :construction: add redux & redux-loop to manage wallet connection * :wrench: update react-GA due to merge * :wrench: fix husky * :boom: organize global state with redux and write some types to represent smart contract types * :construction: * :construction: use both context and redux to manage wallet and tzkt instance * :lipstick: review choose pair component * cleaning... * :construction: deposit token * :construction: rework batcher infos :sparkles: * :construction: impl oracle price * :construction: trying to deploy with NextJS * :construction: :wrench: make nextjs/tailwind working in Docker * :construction: test deploying * :construction: run nextjs server on port 80 * :construction: volumes * :fire: clean code and add metadata * :construction: websocket improvments * :construction: fix warning * :construction: * :lipstick: review styling * :lipstick: update style with feedbacks * :sparkles: volumes & holdings * :recycle: review some items && change contract address for ghostnet * :bug: fix bugs on swap component * :recycle: change pair selecting * :bug: fix some bugs * :fire: remove useless files and clean :sparkles: * :wrench: fix issue with images * :fire: move folders into src * :sparkles: add Copy & Tooltip component from tzsafe-ui * :construction: * :fire: remove useless file * :bug: fix user balance fetching --------- Co-authored-by: Quentin Co-authored-by: Quentin Burg --- 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 | 125 - batcher-ui/config/config.mainnet.ts | 124 - 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 | 125 +- 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/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 | 15 + batcher-ui/src/actions/wallet.ts | 39 + batcher-ui/src/app.tsx | 45 - batcher-ui/src/commands/events.ts | 85 + batcher-ui/src/commands/exchange.ts | 112 + batcher-ui/src/commands/holdings.ts | 22 + 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 | 117 - batcher-ui/src/components/Link.tsx | 28 + batcher-ui/src/components/Menu.tsx | 51 + batcher-ui/src/components/NavBar.tsx | 81 + 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 | 24 + 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 | 269 - batcher-ui/src/extra_utils/utils.ts | 156 - 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 | 881 -- batcher-ui/src/reducers/events.ts | 12 + batcher-ui/src/reducers/exchange.ts | 186 + batcher-ui/src/reducers/holdings.ts | 26 + batcher-ui/src/reducers/index.ts | 54 + 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 | 122 + batcher-ui/src/types/events.ts | 109 + batcher-ui/src/types/index.ts | 2 + batcher-ui/src/types/state.ts | 50 + batcher-ui/src/typings.d.ts | 34 - batcher-ui/src/utils/local-storage.ts | 16 + batcher-ui/src/utils/utils.ts | 605 ++ batcher-ui/src/utils/webSocketUtils.ts | 50 + batcher-ui/styles/globals.css | 22 + batcher-ui/tailwind.config.js | 28 + batcher-ui/tsconfig.json | 42 +- 110 files changed, 12787 insertions(+), 4451 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/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/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/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/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 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 a2026c66..00000000 --- a/batcher-ui/config/config.ghostnet.ts +++ /dev/null @@ -1,125 +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: 'KT1UPMR3WkoFRJYmBBbvv4Z9bBhKYuhCx7Cq', - GA_TRACKING_ID: 'G-2K59PEELC8', - - }, - 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 92c5c02a..00000000 --- a/batcher-ui/config/config.mainnet.ts +++ /dev/null @@ -1,124 +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', - GA_TRACKING_ID: 'G-VS1FBNXJ7N', - }, - 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 d1bc6a09..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,69 +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", + "fp-ts": "^2.16.0", + "next": "^13.4.10", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-ga4": "^2.1.0", - "react-helmet-async": "^1.2.0", - "react-hot-toast": "^2.4.0", - "typescript": "^4.4.2", - "umi": "^3.5.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/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..9879b241 --- /dev/null +++ b/batcher-ui/src/actions/index.ts @@ -0,0 +1,15 @@ +import { WalletActions } from './wallet'; +import { ExchangeActions } from './exchange'; +import { EventActions } from './events'; +import { HoldingsActions } from './holdings'; + +export * from './wallet'; +export * from './exchange'; +export * from './events'; +export * from './holdings'; + +export type Actions = + | WalletActions + | ExchangeActions + | EventActions + | HoldingsActions; 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 1f61d3f6..00000000 --- a/batcher-ui/src/app.tsx +++ /dev/null @@ -1,45 +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'; -import ReactGA from "react-ga4"; -Spin.setDefaultIndicator(); - -ReactGA.initialize(GA_TRACKING_ID); - -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: () =>