From ff06943df15f4f493dcd464276953cb0b2b59010 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 30 Oct 2023 15:43:23 +0530 Subject: [PATCH] Adjusted vault process response --- batcher/michelson/btctz-vault-ghostnet.tz | 225 +++++++++++----------- batcher/michelson/eurl-vault-ghostnet.tz | 225 +++++++++++----------- batcher/michelson/tzbtc-vault-ghostnet.tz | 225 +++++++++++----------- batcher/michelson/usdt-vault-ghostnet.tz | 225 +++++++++++----------- batcher/michelson/usdtz-vault-ghostnet.tz | 225 +++++++++++----------- batcher/types.mligo | 5 +- batcher/utils.mligo | 2 +- batcher/vault.mligo | 14 +- 8 files changed, 577 insertions(+), 569 deletions(-) diff --git a/batcher/michelson/btctz-vault-ghostnet.tz b/batcher/michelson/btctz-vault-ghostnet.tz index 59bd1706..4a4efc1e 100644 --- a/batcher/michelson/btctz-vault-ghostnet.tz +++ b/batcher/michelson/btctz-vault-ghostnet.tz @@ -1,9 +1,8 @@ { parameter (or (or (or (or (nat %addLiquidity) (mutez %addReward)) (or (unit %assertBalances) (nat %balance_response_fa12))) - (or (or (pair %balance_response_fa2 - (pair %request (address %owner) (nat %token_id)) - (nat %balance)) + (or (or (list %balance_response_fa2 + (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) (address %change_admin_address)) (or (address %change_batcher_address) (address %change_marketmaker_address)))) (or (or (address %change_tokenmanager_address) (unit %claim)) @@ -248,15 +247,11 @@ UPDATE 2 ; UPDATE 1 } ; DUP 6 ; - CDR ; - CDR ; - CDR ; DUP 7 ; - DIG 7 ; CDR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; @@ -264,20 +259,24 @@ CDR ; DUP ; CDR ; - DUP 4 ; + DIG 7 ; + CDR ; + CDR ; + CDR ; + DUP ; CAR ; DUP 9 ; MEM ; - IF { DUP 4 ; DIG 4 ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } - { DUP 4 ; - DUP 5 ; + IF { DUP ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } + { DUP ; + DUP 2 ; CAR ; DUP 10 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 4 ; + SWAP ; CDR ; DIG 5 ; DIG 8 ; @@ -498,10 +497,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -559,10 +558,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -584,13 +583,17 @@ SWAP ; DROP } { SENDER ; - DUP 3 ; + PUSH nat 101 ; + DUP 4 ; CDR ; CAR ; CAR ; CAR ; GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PAIR ; + DIG 4 ; + SWAP ; + EXEC ; PUSH nat 0 ; DUP 5 ; CDR ; @@ -626,14 +629,10 @@ CAR ; DUP ; ITER { CDR ; - PUSH nat 101 ; - DUP 2 ; + DUP ; CAR ; GET 5 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH nat 0 ; DUP 3 ; CAR ; @@ -649,8 +648,7 @@ { DROP } } ; DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; DIG 2 ; CAR ; @@ -664,88 +662,91 @@ { IF_LEFT { IF_LEFT { SENDER ; - DUP 2 ; - CDR ; - DIG 2 ; - CAR ; - CDR ; - DUP 4 ; - CDR ; - CAR ; - CAR ; - CAR ; - GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - DUP 2 ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - DUP 5 ; - DIG 2 ; - COMPARE ; - EQ ; - AND ; - IF { DUP 4 ; - DUP 5 ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - CDR ; - CAR ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DIG 3 } ; - DUP ; - CAR ; - CDR ; - CAR ; - DUP ; - ITER { CDR ; - PUSH nat 101 ; + DUG 2 ; + ITER { SWAP ; DUP 2 ; + CDR ; + DIG 2 ; + CAR ; + CDR ; + PUSH nat 101 ; + DUP 4 ; + CDR ; + CAR ; + CAR ; CAR ; GET 5 ; PAIR ; - DUP 8 ; + DUP 6 ; SWAP ; EXEC ; + DUP 2 ; DUP 5 ; - DUP 3 ; + CDR ; + CAR ; + CAR ; CAR ; CAR ; COMPARE ; EQ ; - DUP 8 ; + DUP 6 ; DIG 2 ; COMPARE ; EQ ; AND ; - IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } - { DROP } } ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - DUP 2 ; + IF { DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DIG 2 } ; + DUP ; + CAR ; + CDR ; + CAR ; + DUP ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + DUP 5 ; + DUP 3 ; + CAR ; + CAR ; + COMPARE ; + EQ ; + DUP 8 ; + DIG 2 ; + COMPARE ; + EQ ; + AND ; + IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } + { DROP } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP ; DIG 2 ; - CAR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } + DROP 2 } { DIG 2 ; DROP ; DUP 2 ; @@ -890,34 +891,34 @@ { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; DUP 3 ; + DUP 4 ; CDR ; + DUP ; CDR ; - CDR ; - DUP 3 ; - CAR ; - CAR ; - DUP 5 ; DIG 5 ; CDR ; - DUP ; CDR ; - DUP 5 ; + CDR ; + DUP 6 ; CAR ; - DUP 5 ; + CAR ; + DUP 2 ; + CAR ; + DUP 2 ; MEM ; - IF { DUP 5 ; DIG 5 ; CDR ; DIG 7 ; SOME ; DIG 6 ; UPDATE ; UPDATE 2 } - { DUP 5 ; - DUP 6 ; + IF { DUP 2 ; DIG 2 ; CDR ; DIG 7 ; SOME ; DIG 3 ; UPDATE ; UPDATE 2 } + { DUP 2 ; + DUP 3 ; CAR ; - DUP 6 ; + DUP 3 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 5 ; + DIG 2 ; CDR ; DIG 7 ; - DIG 6 ; + DIG 3 ; SWAP ; SOME ; SWAP ; @@ -1125,10 +1126,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1186,10 +1187,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1628,7 +1629,7 @@ CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 2 ; CONTRACT %balance_response_fa2 (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; diff --git a/batcher/michelson/eurl-vault-ghostnet.tz b/batcher/michelson/eurl-vault-ghostnet.tz index 59bd1706..4a4efc1e 100644 --- a/batcher/michelson/eurl-vault-ghostnet.tz +++ b/batcher/michelson/eurl-vault-ghostnet.tz @@ -1,9 +1,8 @@ { parameter (or (or (or (or (nat %addLiquidity) (mutez %addReward)) (or (unit %assertBalances) (nat %balance_response_fa12))) - (or (or (pair %balance_response_fa2 - (pair %request (address %owner) (nat %token_id)) - (nat %balance)) + (or (or (list %balance_response_fa2 + (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) (address %change_admin_address)) (or (address %change_batcher_address) (address %change_marketmaker_address)))) (or (or (address %change_tokenmanager_address) (unit %claim)) @@ -248,15 +247,11 @@ UPDATE 2 ; UPDATE 1 } ; DUP 6 ; - CDR ; - CDR ; - CDR ; DUP 7 ; - DIG 7 ; CDR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; @@ -264,20 +259,24 @@ CDR ; DUP ; CDR ; - DUP 4 ; + DIG 7 ; + CDR ; + CDR ; + CDR ; + DUP ; CAR ; DUP 9 ; MEM ; - IF { DUP 4 ; DIG 4 ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } - { DUP 4 ; - DUP 5 ; + IF { DUP ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } + { DUP ; + DUP 2 ; CAR ; DUP 10 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 4 ; + SWAP ; CDR ; DIG 5 ; DIG 8 ; @@ -498,10 +497,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -559,10 +558,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -584,13 +583,17 @@ SWAP ; DROP } { SENDER ; - DUP 3 ; + PUSH nat 101 ; + DUP 4 ; CDR ; CAR ; CAR ; CAR ; GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PAIR ; + DIG 4 ; + SWAP ; + EXEC ; PUSH nat 0 ; DUP 5 ; CDR ; @@ -626,14 +629,10 @@ CAR ; DUP ; ITER { CDR ; - PUSH nat 101 ; - DUP 2 ; + DUP ; CAR ; GET 5 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH nat 0 ; DUP 3 ; CAR ; @@ -649,8 +648,7 @@ { DROP } } ; DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; DIG 2 ; CAR ; @@ -664,88 +662,91 @@ { IF_LEFT { IF_LEFT { SENDER ; - DUP 2 ; - CDR ; - DIG 2 ; - CAR ; - CDR ; - DUP 4 ; - CDR ; - CAR ; - CAR ; - CAR ; - GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - DUP 2 ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - DUP 5 ; - DIG 2 ; - COMPARE ; - EQ ; - AND ; - IF { DUP 4 ; - DUP 5 ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - CDR ; - CAR ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DIG 3 } ; - DUP ; - CAR ; - CDR ; - CAR ; - DUP ; - ITER { CDR ; - PUSH nat 101 ; + DUG 2 ; + ITER { SWAP ; DUP 2 ; + CDR ; + DIG 2 ; + CAR ; + CDR ; + PUSH nat 101 ; + DUP 4 ; + CDR ; + CAR ; + CAR ; CAR ; GET 5 ; PAIR ; - DUP 8 ; + DUP 6 ; SWAP ; EXEC ; + DUP 2 ; DUP 5 ; - DUP 3 ; + CDR ; + CAR ; + CAR ; CAR ; CAR ; COMPARE ; EQ ; - DUP 8 ; + DUP 6 ; DIG 2 ; COMPARE ; EQ ; AND ; - IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } - { DROP } } ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - DUP 2 ; + IF { DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DIG 2 } ; + DUP ; + CAR ; + CDR ; + CAR ; + DUP ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + DUP 5 ; + DUP 3 ; + CAR ; + CAR ; + COMPARE ; + EQ ; + DUP 8 ; + DIG 2 ; + COMPARE ; + EQ ; + AND ; + IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } + { DROP } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP ; DIG 2 ; - CAR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } + DROP 2 } { DIG 2 ; DROP ; DUP 2 ; @@ -890,34 +891,34 @@ { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; DUP 3 ; + DUP 4 ; CDR ; + DUP ; CDR ; - CDR ; - DUP 3 ; - CAR ; - CAR ; - DUP 5 ; DIG 5 ; CDR ; - DUP ; CDR ; - DUP 5 ; + CDR ; + DUP 6 ; CAR ; - DUP 5 ; + CAR ; + DUP 2 ; + CAR ; + DUP 2 ; MEM ; - IF { DUP 5 ; DIG 5 ; CDR ; DIG 7 ; SOME ; DIG 6 ; UPDATE ; UPDATE 2 } - { DUP 5 ; - DUP 6 ; + IF { DUP 2 ; DIG 2 ; CDR ; DIG 7 ; SOME ; DIG 3 ; UPDATE ; UPDATE 2 } + { DUP 2 ; + DUP 3 ; CAR ; - DUP 6 ; + DUP 3 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 5 ; + DIG 2 ; CDR ; DIG 7 ; - DIG 6 ; + DIG 3 ; SWAP ; SOME ; SWAP ; @@ -1125,10 +1126,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1186,10 +1187,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1628,7 +1629,7 @@ CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 2 ; CONTRACT %balance_response_fa2 (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; diff --git a/batcher/michelson/tzbtc-vault-ghostnet.tz b/batcher/michelson/tzbtc-vault-ghostnet.tz index 59bd1706..4a4efc1e 100644 --- a/batcher/michelson/tzbtc-vault-ghostnet.tz +++ b/batcher/michelson/tzbtc-vault-ghostnet.tz @@ -1,9 +1,8 @@ { parameter (or (or (or (or (nat %addLiquidity) (mutez %addReward)) (or (unit %assertBalances) (nat %balance_response_fa12))) - (or (or (pair %balance_response_fa2 - (pair %request (address %owner) (nat %token_id)) - (nat %balance)) + (or (or (list %balance_response_fa2 + (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) (address %change_admin_address)) (or (address %change_batcher_address) (address %change_marketmaker_address)))) (or (or (address %change_tokenmanager_address) (unit %claim)) @@ -248,15 +247,11 @@ UPDATE 2 ; UPDATE 1 } ; DUP 6 ; - CDR ; - CDR ; - CDR ; DUP 7 ; - DIG 7 ; CDR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; @@ -264,20 +259,24 @@ CDR ; DUP ; CDR ; - DUP 4 ; + DIG 7 ; + CDR ; + CDR ; + CDR ; + DUP ; CAR ; DUP 9 ; MEM ; - IF { DUP 4 ; DIG 4 ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } - { DUP 4 ; - DUP 5 ; + IF { DUP ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } + { DUP ; + DUP 2 ; CAR ; DUP 10 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 4 ; + SWAP ; CDR ; DIG 5 ; DIG 8 ; @@ -498,10 +497,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -559,10 +558,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -584,13 +583,17 @@ SWAP ; DROP } { SENDER ; - DUP 3 ; + PUSH nat 101 ; + DUP 4 ; CDR ; CAR ; CAR ; CAR ; GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PAIR ; + DIG 4 ; + SWAP ; + EXEC ; PUSH nat 0 ; DUP 5 ; CDR ; @@ -626,14 +629,10 @@ CAR ; DUP ; ITER { CDR ; - PUSH nat 101 ; - DUP 2 ; + DUP ; CAR ; GET 5 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH nat 0 ; DUP 3 ; CAR ; @@ -649,8 +648,7 @@ { DROP } } ; DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; DIG 2 ; CAR ; @@ -664,88 +662,91 @@ { IF_LEFT { IF_LEFT { SENDER ; - DUP 2 ; - CDR ; - DIG 2 ; - CAR ; - CDR ; - DUP 4 ; - CDR ; - CAR ; - CAR ; - CAR ; - GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - DUP 2 ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - DUP 5 ; - DIG 2 ; - COMPARE ; - EQ ; - AND ; - IF { DUP 4 ; - DUP 5 ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - CDR ; - CAR ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DIG 3 } ; - DUP ; - CAR ; - CDR ; - CAR ; - DUP ; - ITER { CDR ; - PUSH nat 101 ; + DUG 2 ; + ITER { SWAP ; DUP 2 ; + CDR ; + DIG 2 ; + CAR ; + CDR ; + PUSH nat 101 ; + DUP 4 ; + CDR ; + CAR ; + CAR ; CAR ; GET 5 ; PAIR ; - DUP 8 ; + DUP 6 ; SWAP ; EXEC ; + DUP 2 ; DUP 5 ; - DUP 3 ; + CDR ; + CAR ; + CAR ; CAR ; CAR ; COMPARE ; EQ ; - DUP 8 ; + DUP 6 ; DIG 2 ; COMPARE ; EQ ; AND ; - IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } - { DROP } } ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - DUP 2 ; + IF { DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DIG 2 } ; + DUP ; + CAR ; + CDR ; + CAR ; + DUP ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + DUP 5 ; + DUP 3 ; + CAR ; + CAR ; + COMPARE ; + EQ ; + DUP 8 ; + DIG 2 ; + COMPARE ; + EQ ; + AND ; + IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } + { DROP } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP ; DIG 2 ; - CAR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } + DROP 2 } { DIG 2 ; DROP ; DUP 2 ; @@ -890,34 +891,34 @@ { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; DUP 3 ; + DUP 4 ; CDR ; + DUP ; CDR ; - CDR ; - DUP 3 ; - CAR ; - CAR ; - DUP 5 ; DIG 5 ; CDR ; - DUP ; CDR ; - DUP 5 ; + CDR ; + DUP 6 ; CAR ; - DUP 5 ; + CAR ; + DUP 2 ; + CAR ; + DUP 2 ; MEM ; - IF { DUP 5 ; DIG 5 ; CDR ; DIG 7 ; SOME ; DIG 6 ; UPDATE ; UPDATE 2 } - { DUP 5 ; - DUP 6 ; + IF { DUP 2 ; DIG 2 ; CDR ; DIG 7 ; SOME ; DIG 3 ; UPDATE ; UPDATE 2 } + { DUP 2 ; + DUP 3 ; CAR ; - DUP 6 ; + DUP 3 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 5 ; + DIG 2 ; CDR ; DIG 7 ; - DIG 6 ; + DIG 3 ; SWAP ; SOME ; SWAP ; @@ -1125,10 +1126,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1186,10 +1187,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1628,7 +1629,7 @@ CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 2 ; CONTRACT %balance_response_fa2 (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; diff --git a/batcher/michelson/usdt-vault-ghostnet.tz b/batcher/michelson/usdt-vault-ghostnet.tz index 59bd1706..4a4efc1e 100644 --- a/batcher/michelson/usdt-vault-ghostnet.tz +++ b/batcher/michelson/usdt-vault-ghostnet.tz @@ -1,9 +1,8 @@ { parameter (or (or (or (or (nat %addLiquidity) (mutez %addReward)) (or (unit %assertBalances) (nat %balance_response_fa12))) - (or (or (pair %balance_response_fa2 - (pair %request (address %owner) (nat %token_id)) - (nat %balance)) + (or (or (list %balance_response_fa2 + (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) (address %change_admin_address)) (or (address %change_batcher_address) (address %change_marketmaker_address)))) (or (or (address %change_tokenmanager_address) (unit %claim)) @@ -248,15 +247,11 @@ UPDATE 2 ; UPDATE 1 } ; DUP 6 ; - CDR ; - CDR ; - CDR ; DUP 7 ; - DIG 7 ; CDR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; @@ -264,20 +259,24 @@ CDR ; DUP ; CDR ; - DUP 4 ; + DIG 7 ; + CDR ; + CDR ; + CDR ; + DUP ; CAR ; DUP 9 ; MEM ; - IF { DUP 4 ; DIG 4 ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } - { DUP 4 ; - DUP 5 ; + IF { DUP ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } + { DUP ; + DUP 2 ; CAR ; DUP 10 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 4 ; + SWAP ; CDR ; DIG 5 ; DIG 8 ; @@ -498,10 +497,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -559,10 +558,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -584,13 +583,17 @@ SWAP ; DROP } { SENDER ; - DUP 3 ; + PUSH nat 101 ; + DUP 4 ; CDR ; CAR ; CAR ; CAR ; GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PAIR ; + DIG 4 ; + SWAP ; + EXEC ; PUSH nat 0 ; DUP 5 ; CDR ; @@ -626,14 +629,10 @@ CAR ; DUP ; ITER { CDR ; - PUSH nat 101 ; - DUP 2 ; + DUP ; CAR ; GET 5 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH nat 0 ; DUP 3 ; CAR ; @@ -649,8 +648,7 @@ { DROP } } ; DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; DIG 2 ; CAR ; @@ -664,88 +662,91 @@ { IF_LEFT { IF_LEFT { SENDER ; - DUP 2 ; - CDR ; - DIG 2 ; - CAR ; - CDR ; - DUP 4 ; - CDR ; - CAR ; - CAR ; - CAR ; - GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - DUP 2 ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - DUP 5 ; - DIG 2 ; - COMPARE ; - EQ ; - AND ; - IF { DUP 4 ; - DUP 5 ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - CDR ; - CAR ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DIG 3 } ; - DUP ; - CAR ; - CDR ; - CAR ; - DUP ; - ITER { CDR ; - PUSH nat 101 ; + DUG 2 ; + ITER { SWAP ; DUP 2 ; + CDR ; + DIG 2 ; + CAR ; + CDR ; + PUSH nat 101 ; + DUP 4 ; + CDR ; + CAR ; + CAR ; CAR ; GET 5 ; PAIR ; - DUP 8 ; + DUP 6 ; SWAP ; EXEC ; + DUP 2 ; DUP 5 ; - DUP 3 ; + CDR ; + CAR ; + CAR ; CAR ; CAR ; COMPARE ; EQ ; - DUP 8 ; + DUP 6 ; DIG 2 ; COMPARE ; EQ ; AND ; - IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } - { DROP } } ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - DUP 2 ; + IF { DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DIG 2 } ; + DUP ; + CAR ; + CDR ; + CAR ; + DUP ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + DUP 5 ; + DUP 3 ; + CAR ; + CAR ; + COMPARE ; + EQ ; + DUP 8 ; + DIG 2 ; + COMPARE ; + EQ ; + AND ; + IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } + { DROP } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP ; DIG 2 ; - CAR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } + DROP 2 } { DIG 2 ; DROP ; DUP 2 ; @@ -890,34 +891,34 @@ { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; DUP 3 ; + DUP 4 ; CDR ; + DUP ; CDR ; - CDR ; - DUP 3 ; - CAR ; - CAR ; - DUP 5 ; DIG 5 ; CDR ; - DUP ; CDR ; - DUP 5 ; + CDR ; + DUP 6 ; CAR ; - DUP 5 ; + CAR ; + DUP 2 ; + CAR ; + DUP 2 ; MEM ; - IF { DUP 5 ; DIG 5 ; CDR ; DIG 7 ; SOME ; DIG 6 ; UPDATE ; UPDATE 2 } - { DUP 5 ; - DUP 6 ; + IF { DUP 2 ; DIG 2 ; CDR ; DIG 7 ; SOME ; DIG 3 ; UPDATE ; UPDATE 2 } + { DUP 2 ; + DUP 3 ; CAR ; - DUP 6 ; + DUP 3 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 5 ; + DIG 2 ; CDR ; DIG 7 ; - DIG 6 ; + DIG 3 ; SWAP ; SOME ; SWAP ; @@ -1125,10 +1126,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1186,10 +1187,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1628,7 +1629,7 @@ CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 2 ; CONTRACT %balance_response_fa2 (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; diff --git a/batcher/michelson/usdtz-vault-ghostnet.tz b/batcher/michelson/usdtz-vault-ghostnet.tz index 59bd1706..4a4efc1e 100644 --- a/batcher/michelson/usdtz-vault-ghostnet.tz +++ b/batcher/michelson/usdtz-vault-ghostnet.tz @@ -1,9 +1,8 @@ { parameter (or (or (or (or (nat %addLiquidity) (mutez %addReward)) (or (unit %assertBalances) (nat %balance_response_fa12))) - (or (or (pair %balance_response_fa2 - (pair %request (address %owner) (nat %token_id)) - (nat %balance)) + (or (or (list %balance_response_fa2 + (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) (address %change_admin_address)) (or (address %change_batcher_address) (address %change_marketmaker_address)))) (or (or (address %change_tokenmanager_address) (unit %claim)) @@ -248,15 +247,11 @@ UPDATE 2 ; UPDATE 1 } ; DUP 6 ; - CDR ; - CDR ; - CDR ; DUP 7 ; - DIG 7 ; CDR ; DUP ; CDR ; - DIG 6 ; + DIG 5 ; UPDATE 1 ; UPDATE 2 ; UPDATE 2 ; @@ -264,20 +259,24 @@ CDR ; DUP ; CDR ; - DUP 4 ; + DIG 7 ; + CDR ; + CDR ; + CDR ; + DUP ; CAR ; DUP 9 ; MEM ; - IF { DUP 4 ; DIG 4 ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } - { DUP 4 ; - DUP 5 ; + IF { DUP ; CDR ; DIG 5 ; SOME ; DIG 8 ; UPDATE ; UPDATE 2 } + { DUP ; + DUP 2 ; CAR ; DUP 10 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 4 ; + SWAP ; CDR ; DIG 5 ; DIG 8 ; @@ -498,10 +497,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -559,10 +558,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -584,13 +583,17 @@ SWAP ; DROP } { SENDER ; - DUP 3 ; + PUSH nat 101 ; + DUP 4 ; CDR ; CAR ; CAR ; CAR ; GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + PAIR ; + DIG 4 ; + SWAP ; + EXEC ; PUSH nat 0 ; DUP 5 ; CDR ; @@ -626,14 +629,10 @@ CAR ; DUP ; ITER { CDR ; - PUSH nat 101 ; - DUP 2 ; + DUP ; CAR ; GET 5 ; - PAIR ; - DUP 7 ; - SWAP ; - EXEC ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; PUSH nat 0 ; DUP 3 ; CAR ; @@ -649,8 +648,7 @@ { DROP } } ; DIG 2 ; DIG 3 ; - DIG 4 ; - DROP 3 ; + DROP 2 ; DUP 2 ; DIG 2 ; CAR ; @@ -664,88 +662,91 @@ { IF_LEFT { IF_LEFT { SENDER ; - DUP 2 ; - CDR ; - DIG 2 ; - CAR ; - CDR ; - DUP 4 ; - CDR ; - CAR ; - CAR ; - CAR ; - GET 5 ; - IF_NONE { PUSH nat 101 ; FAILWITH } {} ; - DUP 2 ; - DUP 6 ; - CDR ; - CAR ; - CAR ; - CAR ; - CAR ; - COMPARE ; - EQ ; - DUP 5 ; - DIG 2 ; - COMPARE ; - EQ ; - AND ; - IF { DUP 4 ; - DUP 5 ; - CDR ; - DUP ; - CAR ; - DIG 6 ; - CDR ; - CAR ; - CAR ; - DUP 6 ; - UPDATE 2 ; - UPDATE 1 ; - UPDATE 1 ; - UPDATE 2 } - { DIG 3 } ; - DUP ; - CAR ; - CDR ; - CAR ; - DUP ; - ITER { CDR ; - PUSH nat 101 ; + DUG 2 ; + ITER { SWAP ; DUP 2 ; + CDR ; + DIG 2 ; + CAR ; + CDR ; + PUSH nat 101 ; + DUP 4 ; + CDR ; + CAR ; + CAR ; CAR ; GET 5 ; PAIR ; - DUP 8 ; + DUP 6 ; SWAP ; EXEC ; + DUP 2 ; DUP 5 ; - DUP 3 ; + CDR ; + CAR ; + CAR ; CAR ; CAR ; COMPARE ; EQ ; - DUP 8 ; + DUP 6 ; DIG 2 ; COMPARE ; EQ ; AND ; - IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } - { DROP } } ; - DIG 2 ; - DIG 3 ; - DIG 4 ; - DIG 5 ; - DROP 4 ; - DUP 2 ; + IF { DUP 3 ; + DUP 4 ; + CDR ; + DUP ; + CAR ; + DIG 5 ; + CDR ; + CAR ; + CAR ; + DUP 6 ; + UPDATE 2 ; + UPDATE 1 ; + UPDATE 1 ; + UPDATE 2 } + { DIG 2 } ; + DUP ; + CAR ; + CDR ; + CAR ; + DUP ; + ITER { CDR ; + DUP ; + CAR ; + GET 5 ; + IF_NONE { PUSH nat 101 ; FAILWITH } {} ; + DUP 5 ; + DUP 3 ; + CAR ; + CAR ; + COMPARE ; + EQ ; + DUP 8 ; + DIG 2 ; + COMPARE ; + EQ ; + AND ; + IF { DUP 5 ; UPDATE 2 ; SWAP ; DUP 2 ; SOME ; DIG 2 ; CAR ; GET 3 ; UPDATE } + { DROP } } ; + DIG 2 ; + DIG 3 ; + DROP 2 ; + DUP 2 ; + DIG 2 ; + CAR ; + DUP ; + CDR ; + DIG 3 ; + UPDATE 1 ; + UPDATE 2 ; + UPDATE 1 } ; + SWAP ; DIG 2 ; - CAR ; - DUP ; - CDR ; - DIG 3 ; - UPDATE 1 ; - UPDATE 2 ; - UPDATE 1 } + DROP 2 } { DIG 2 ; DROP ; DUP 2 ; @@ -890,34 +891,34 @@ { SWAP ; DROP ; PUSH nat 102 ; FAILWITH } { DIG 2 ; UNIT ; TRANSFER_TOKENS } ; DUP 3 ; + DUP 4 ; CDR ; + DUP ; CDR ; - CDR ; - DUP 3 ; - CAR ; - CAR ; - DUP 5 ; DIG 5 ; CDR ; - DUP ; CDR ; - DUP 5 ; + CDR ; + DUP 6 ; CAR ; - DUP 5 ; + CAR ; + DUP 2 ; + CAR ; + DUP 2 ; MEM ; - IF { DUP 5 ; DIG 5 ; CDR ; DIG 7 ; SOME ; DIG 6 ; UPDATE ; UPDATE 2 } - { DUP 5 ; - DUP 6 ; + IF { DUP 2 ; DIG 2 ; CDR ; DIG 7 ; SOME ; DIG 3 ; UPDATE ; UPDATE 2 } + { DUP 2 ; + DUP 3 ; CAR ; - DUP 6 ; + DUP 3 ; PUSH bool True ; SWAP ; UPDATE ; UPDATE 1 ; - DIG 5 ; + DIG 2 ; CDR ; DIG 7 ; - DIG 6 ; + DIG 3 ; SWAP ; SOME ; SWAP ; @@ -1125,10 +1126,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 3 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1186,10 +1187,10 @@ IF { CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 4 ; CONTRACT %balance_response_fa2 - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))) ; IF_NONE { DIG 2 ; DROP 2 ; PUSH nat 170 ; FAILWITH } { SWAP ; @@ -1628,7 +1629,7 @@ CONTRACT %balance_of (pair (list %requests (pair (address %owner) (nat %token_id))) (contract %callback - (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)))) ; + (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) ; DUP 2 ; CONTRACT %balance_response_fa2 (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; diff --git a/batcher/types.mligo b/batcher/types.mligo index e8d3e652..14277fd7 100644 --- a/batcher/types.mligo +++ b/batcher/types.mligo @@ -634,9 +634,10 @@ type balance_of_response = balance : nat; } +type balance_of_responses = balance_of_response list + type balance_of = [@layout:comb] { requests : balance_request list; - callback : balance_of_response contract; + callback : balance_of_response list contract; } - diff --git a/batcher/utils.mligo b/batcher/utils.mligo index 4fdb27df..2b753275 100644 --- a/batcher/utils.mligo +++ b/batcher/utils.mligo @@ -1087,7 +1087,7 @@ let entrypoints_exist token_id = token_id; } in let bo_opt: balance_of contract option = Tezos.get_entrypoint_opt "%balance_of" token_addr in - let cb_opt: balance_of_response contract option = Tezos.get_entrypoint_opt "%balance_response_fa2" callback in + let cb_opt: balance_of_response list contract option = Tezos.get_entrypoint_opt "%balance_response_fa2" callback in match cb_opt,bo_opt with | None, _ -> failwith unable_to_get_balance_response_fa2_entrypoint_from_vault | _, None -> failwith unable_to_get_balance_of_entrypoint_from_fa2_token diff --git a/batcher/vault.mligo b/batcher/vault.mligo index 36f9afc3..e47fd058 100644 --- a/batcher/vault.mligo +++ b/batcher/vault.mligo @@ -346,13 +346,15 @@ let process_balance_response_fa12 [@inline] let process_balance_response_fa2 - (r: balance_of_response) + (rs: balance_of_response list) (storage:storage): result = let token_contract = Tezos.get_sender () in - let amount = r.balance in - let token_id = r.request.token_id in - let storage = update_native_token_balance token_contract amount token_id storage in - let storage = update_foreign_token_balances token_contract amount token_id storage in + let process_responses (s,r:storage * balance_of_response):storage = + let amount = r.balance in + let token_id = r.request.token_id in + let s = update_native_token_balance token_contract amount token_id s in + update_foreign_token_balances token_contract amount token_id s in + let storage = List.fold process_responses rs storage in no_op storage end @@ -374,7 +376,7 @@ type entrypoint = | AddReward of tez | InjectLiquidity of liquidity_injection_request | AssertBalances - | Balance_response_fa2 of balance_of_response + | Balance_response_fa2 of balance_of_responses | Balance_response_fa12 of nat | Change_admin_address of address | Change_batcher_address of address