x
60
{ parameter (or (or (address %get_inventory_of) (unit %get_my_inventory)) (unit %mint)) ; storage (big_map address (set (pair (string %name) (int %props)))) ; code { LAMBDA (pair address (big_map address (set (pair string int)))) (list operation) { UNPAIR ; PUSH address "KT1KvDaiC7sn6sdYyWncaYFUoivwHoK1pJM7" ; CONTRACT (or (nat %viewNat) (or (int %viewInt) (or (string %viewString) (or (address %viewAddress) (set %viewInventory (pair (string %name) (int %props))))))) ; IF_NONE { PUSH string "Contract not found!!!" ; FAILWITH } {} ; PUSH mutez 0 ; DIG 3 ; DIG 3 ; GET ; IF_NONE { EMPTY_SET (pair string int) } {} ; RIGHT address ; RIGHT string ; RIGHT int ; RIGHT nat ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; SWAP ; UNPAIR ; IF_LEFT { IF_LEFT { DUP 2 ; DUG 2 ; PAIR ; DIG 2 ; SWAP ; EXEC } { DROP ; DUP ; SENDER ; PAIR ; DIG 2 ; SWAP ; EXEC } } { DIG 2 ; DROP 2 ; PUSH timestamp 1661472000 ; NOW ; SUB ; SENDER ; DUP 3 ; DIG 3 ; DUP 3 ; GET ; IF_NONE { EMPTY_SET (pair string int) } {} ; DIG 3 ; PUSH string "some id" ; PAIR ; PUSH bool True ; SWAP ; UPDATE ; SOME ; DIG 2 ; UPDATE ; NIL operation } ; PAIR } ; view "view_inventory_of" address (set (pair (string %name) (int %props))) { UNPAIR ; GET ; IF_NONE { EMPTY_SET (pair string int) } {} } ; view "view_my_inventory" address (set (pair (string %name) (int %props))) { CDR ; SENDER ; GET ; IF_NONE { EMPTY_SET (pair string int) } {} } ; view "view_test" unit int { DROP ; PUSH int 34 } }