x
467
parameter (or (or (or (unit %addBalanceCounterparty) (unit %addBalanceOwner)) (or (unit %authAdmin) (bytes %claimCounterparty))) (or (or (unit %claimOwner) (unit %undoWithdrawCounterparty)) (or (unit %undoWithdrawOwner) (or (unit %withdrawCounterparty) (unit %withdrawOwner)))));storage (pair (pair (pair (address %admin) (pair (mutez %balanceCounterparty) (mutez %balanceOwner))) (pair (address %counterparty) (pair (bool %depositedCounterparty) (bool %depositedOwner)))) (pair (pair (timestamp %epoch) (pair (mutez %fromCounterparty) (mutez %fromOwner))) (pair (pair (bytes %hashedSecret) (address %owner)) (pair (bool %withdrewCounterparty) (bool %withdrewOwner)))));code { UNPAIR ; IF_LEFT { IF_LEFT { IF_LEFT { DROP ; DUP ; CAR ; GET 3 ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this commnand." ; FAILWITH } ; DUP ; CAR ; CAR ; GET 3 ; PUSH mutez 0 ; COMPARE ; EQ ; IF {} { PUSH string "You have already a pending balance in the contract. Please ensure that it is your first time depositing." ; FAILWITH } ; DUP ; GET 3 ; GET 3 ; AMOUNT ; COMPARE ; EQ ; IF {} { PUSH string "Inappropriate amount. Please check the correct amount to deposit." ; FAILWITH } ; DUP ; UNPAIR ; UNPAIR ; UNPAIR ; SWAP ; CDR ; DIG 4 ; GET 3 ; GET 3 ; PAIR ; SWAP ; PAIR ; SWAP ; UNPAIR ; SWAP ; CDR ; PUSH bool True ; PAIR ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR } { DROP ; DUP ; GET 5 ; CDR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the owner of the contact. Only the owner can use this command." ; FAILWITH } ; DUP ; CAR ; CAR ; GET 4 ; PUSH mutez 0 ; COMPARE ; EQ ; IF {} { PUSH string "You have already a pending balance in the contract. Please ensure that it is your first time depositing." ; FAILWITH } ; DUP ; GET 3 ; GET 4 ; AMOUNT ; COMPARE ; EQ ; IF {} { PUSH string "Inappropriate amount. Please check the correct amount to deposit." ; FAILWITH } ; DUP ; UNPAIR ; UNPAIR ; UNPAIR ; SWAP ; CAR ; DIG 4 ; GET 3 ; GET 4 ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP ; UNPAIR ; SWAP ; CAR ; PUSH bool True ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR } ; NIL operation } { IF_LEFT { DROP ; DUP ; CAR ; CAR ; CAR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the admin of the contact. Only the admin can can authorize withdrawal.." ; FAILWITH } ; DUP ; GET 8 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The owner (and/or counterparty) has not yet withdrawn from the contract. Withdrawal cannot be authorized yet." ; FAILWITH } ; DUP ; GET 7 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The counterparty has not yet withdrawn from the contract. Withdrawal cannot be authorized yet." ; FAILWITH } ; DUP ; GET 5 ; CDR ; CONTRACT unit ; IF_NONE { PUSH int 90 ; FAILWITH } {} ; NIL operation ; SWAP ; DUP 3 ; GET 3 ; GET 4 ; UNIT ; TRANSFER_TOKENS ; CONS ; SWAP ; DUP ; DUG 2 ; CAR ; GET 3 ; CONTRACT unit ; IF_NONE { PUSH int 91 ; FAILWITH } {} ; DUP 3 ; GET 3 ; GET 3 ; UNIT ; TRANSFER_TOKENS ; CONS ; SWAP ; UNPAIR ; UNPAIR ; SWAP ; CAR ; PUSH (pair bool bool) (Pair False False) ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; PUSH bool False ; UPDATE 8 ; PUSH bool False ; UPDATE 7 ; UNPAIR ; UNPAIR ; CAR ; PUSH (pair mutez mutez) (Pair 0 0) ; SWAP ; PAIR ; PAIR ; PAIR ; SWAP } { BLAKE2B ; SWAP ; DUP ; DUG 2 ; GET 5 ; CAR ; COMPARE ; EQ ; IF {} { PUSH string "Incorrect secret key." ; FAILWITH } ; DUP ; CAR ; GET 3 ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "WrongCondition: sp.sender == self.data.counterparty" ; FAILWITH } ; DUP ; CAR ; GET 6 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The owner (and/or the counterparty) has not yet deposited to the contract. The amount cannot be claimed yet." ; FAILWITH } ; DUP ; CAR ; GET 5 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The counterparty has not yet deposited to the contract. The amount cannot be claimed yet." ; FAILWITH } ; DUP ; CAR ; GET 3 ; CONTRACT unit ; IF_NONE { PUSH int 41 ; FAILWITH } {} ; NIL operation ; SWAP ; DIG 2 ; DUP ; CAR ; CAR ; GET 3 ; SWAP ; DUP ; DUG 4 ; CAR ; CAR ; GET 4 ; ADD ; UNIT ; TRANSFER_TOKENS ; CONS ; SWAP ; UNPAIR ; UNPAIR ; CAR ; PUSH (pair mutez mutez) (Pair 0 0) ; SWAP ; PAIR ; SWAP ; CAR ; PUSH (pair bool bool) (Pair False False) ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; SWAP } } } { IF_LEFT { IF_LEFT { DROP ; DUP ; GET 3 ; CAR ; NOW ; COMPARE ; GT ; IF {} { PUSH string "WrongCondition: self.data.epoch < sp.now" ; FAILWITH } ; DUP ; GET 5 ; CDR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "WrongCondition: sp.sender == self.data.owner" ; FAILWITH } ; DUP ; CAR ; GET 6 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The owner (and/or the counterparty) has not yet deposited to the contract. The amount cannot be claimed yet." ; FAILWITH } ; DUP ; CAR ; GET 5 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "The counterparty has not yet deposited to the contract. The amount cannot be claimed yet." ; FAILWITH } ; DUP ; GET 5 ; CDR ; CONTRACT unit ; IF_NONE { PUSH int 41 ; FAILWITH } {} ; NIL operation ; SWAP ; DIG 2 ; DUP ; CAR ; CAR ; GET 3 ; SWAP ; DUP ; DUG 4 ; CAR ; CAR ; GET 4 ; ADD ; UNIT ; TRANSFER_TOKENS ; CONS ; SWAP ; UNPAIR ; UNPAIR ; CAR ; PUSH (pair mutez mutez) (Pair 0 0) ; SWAP ; PAIR ; SWAP ; CAR ; PUSH (pair bool bool) (Pair False False) ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; SWAP } { DROP ; DUP ; CAR ; GET 3 ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this command." ; FAILWITH } ; DUP ; GET 7 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "You are not originally withdrawing from the contract. There's no need to undo." ; FAILWITH } ; PUSH bool False ; UPDATE 7 ; NIL operation } } { IF_LEFT { DROP ; DUP ; GET 5 ; CDR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the owner of the contact. Only the owner can use this command." ; FAILWITH } ; DUP ; GET 8 ; PUSH bool True ; COMPARE ; EQ ; IF {} { PUSH string "You are not originally withdrawing from the contract. There's no need to undo." ; FAILWITH } ; PUSH bool False ; UPDATE 8 } { IF_LEFT { DROP ; DUP ; CAR ; GET 3 ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the counterparty of the contact. Only the counterparty can use this command." ; FAILWITH } ; DUP ; GET 7 ; PUSH bool False ; COMPARE ; EQ ; IF {} { PUSH string "You are already withdrawing from the contract. There's no need to execute withdraw command again." ; FAILWITH } ; PUSH bool True ; UPDATE 7 } { DROP ; DUP ; GET 5 ; CDR ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "You are not the owner of the contact. Only the owner can use this command." ; FAILWITH } ; DUP ; GET 8 ; PUSH bool False ; COMPARE ; EQ ; IF {} { PUSH string "You are already withdrawing from the contract. There's no need to execute withdraw command again." ; FAILWITH } ; PUSH bool True ; UPDATE 8 } } ; NIL operation } } ; NIL operation ; SWAP ; ITER { CONS } ; PAIR }