x
44
{ parameter (or (unit %default) (contract %get_price nat)) ; storage (pair (string %base_symbol) (pair (address %oracle) (string %quote_symbol))) ; code { UNPAIR ; IF_LEFT { DROP ; NIL operation ; SENDER ; CONTRACT unit ; IF_NONE { PUSH int 235 ; FAILWITH } {} ; AMOUNT ; UNIT ; TRANSFER_TOKENS ; CONS } { NIL operation ; SWAP ; PUSH mutez 0 ; SELF_ADDRESS ; UNIT ; VIEW "view_price" nat ; IF_NONE { PUSH int 502 ; FAILWITH } {} ; TRANSFER_TOKENS ; CONS } ; PAIR } ; view "view_price" unit nat { CDR ; DUP ; GET 3 ; SWAP ; DUP ; DUG 2 ; GET 4 ; VIEW "get_price" nat ; IF_NONE { PUSH int 502 ; FAILWITH } {} ; PUSH nat 1000000 ; DIG 2 ; DUP ; GET 3 ; SWAP ; CAR ; VIEW "get_price" nat ; IF_NONE { PUSH int 502 ; FAILWITH } {} ; MUL ; EDIV ; IF_NONE { PUSH int 262 ; FAILWITH } { CAR } } }