Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
OCaml code generated from KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ
open Inst
let main param_st =
let x0 = "FA2_TOKEN_UNDEFINED" in
let x9 =
(x2 :
((address, address) pair,
((nat, unit) big_map, address option) pair) pair)
(if neq (compare sender (car (car x2))) then failwith "NOT_AN_ADMIN";
x2 : ((address, address) pair,
((nat, unit) big_map, address option) pair) pair)) in
let x17 =
(x10 :
((address, nat) pair, ((address, nat) pair, nat) big_map) pair)
(let (x11, x12) = unpair x10 in
match get x11 x12 with | None -> 0 | Some x15 -> x15 : nat)) in
let x40 =
apply x17
(x18 :
((((address, nat) pair, ((address, nat) pair, nat) big_map)
nat) lambda,
((address, nat) pair,
(nat, ((address, nat) pair, nat) big_map) pair) pair)
(let (x19, x20) = unpair x18 in
let (x21, x22) = unpair x20 in
let (x23, x24) = unpair x21 in
let (x25, x26) = unpair x22 in
let x27 = pair x23 x24 in
let x30 = add x25 (exec (pair x27 x26) x19) in
if eq (compare x30 0)
then update x27 none x26
else update x27 (some x30) x26 : ((address, nat) pair, nat)
big_map))) in
let x69 =
apply (pair x17 x1)
(x42 :
(((((address, nat) pair, ((address, nat) pair, nat) big_map)
nat) lambda,
string) pair,
((address, nat) pair,
(nat, ((address, nat) pair, nat) big_map) pair) pair)
(let (x43, x44) = unpair x42 in
let (x45, x46) = unpair x43 in
let (x47, x48) = unpair x44 in
let (x49, x50) = unpair x47 in
let (x51, x52) = unpair x48 in
let x53 = pair x49 x50 in
match isnat (sub (exec (pair x53 x52) x45) x51) with
| None -> failwith x46
| Some x58 ->
if eq (compare x58 0)
then update x53 none x52
else update x53 (some x58) x52 : ((address, nat) pair,
nat) big_map))) in
let (x70, x71) = unpair param_st in
match x70 with
| Left x72 ->
(match x72 with
| Left x73 ->
(match x73 with
| Left x74 ->
let x77 = cdr (car x71) in
let x78 = car x74 in
pair nil
(pair (car (car x71))
(match get x78 (car (cdr x77)) with
| None ->
let x90 =
pair (car x77)
(update x78 (some x74) (car (cdr x77)))
(cdr (cdr x77))) in
pair (car x90)
(pair (car (cdr x90))
(update x78 (some 0) (cdr (cdr x77))))
| Some x101 -> failwith "FA2_DUP_TOKEN_ID"))
(cdr x71))
| Right x110 ->
let x112 = car (car x71) in
let (x187, x188) =
match x110 with
| Left x113 ->
let (x163, x164) =
match x113 with
| Left x114 ->
((pair nil
(match cdr (cdr x112) with
| None -> failwith "NO_PENDING_ADMIN"
| Some x118 ->
if eq (compare sender x118)
pair (pair sender (cdr (car x112)))
(pair (car (cdr x112)) none)
else failwith "NOT_A_PENDING_ADMIN")),
| Right x136 ->
let x137 = exec x112 x9 in
((pair nil
(pair (car x137)
(fun (x143, x140) ->
if cdr x143
update (car x143) (some unit)
else update (car x143) none x140)
(x136, (car (cdr x137))))
(cdr (cdr x137))))), x71) in
(x163, x164)
| Right x165 ->
let (x185, x186) =
match x165 with
| Left x166 ->
let x167 = exec x112 x9 in
((pair nil
(pair (car x167)
(pair (car (cdr x167)) (some x166)))),
| Right x176 ->
let x177 = exec x112 x9 in
((pair nil
(pair (pair (car (car x177)) x176) (cdr x177))),
x71) in
(x185, x186) in
let (x189, x190) = unpair x187 in
pair x189 (pair (pair x190 (cdr (car x188))) (cdr x188)))
| Right x198 ->
let x248 = cdr (car x71) in
let (x436, x437) =
match x198 with
| Left x249 ->
let (x385, x386) =
match x249 with
| Left x250 ->
let (x278, (x272, x273, x276, x277)) =
(fun (x263, (x257, x258, x261, x262)) ->
((if not (mem (cdr x263) x258)
then failwith x262
else pair x263 (exec (pair x263 x257) x261)),
(x257, x258, x261, x262)))
((car x250),
((car (car x248)), (car (cdr x248)), x17, x0)) in
((pair (cons (transfer_tokens x278 0 (cdr x250)) nil)
x248), x71)
| Right x285 ->
let (x370, x371, x372, x375, x376, x377) =
(fun (x314, (x306, x307, x308, x311, x312, x313))
let (x361, x362, x363, x364, x367, x368, x369)
(x316, x317, x318, x319, x322, x323,
(mem (car (cdr x325))
(car (cdr x319)))
then failwith x324
(pair (car x325)
(car (cdr x325)))
(pair (cdr (cdr x325))
(pair (car x317)
(car (cdr x325)))
(pair (cdr (cdr x325))
x316)) x322))) x323),
x317, x318, x319, x322, x323, x324))
((cdr x314),
(x306, x314, x307, x308, x311, x312,
x313)) in
(x361, x363, x364, x367, x368, x369))
((car (car x248)),
(x286 :
((address, address) pair,
((address, (address, nat) pair)
unit) big_map)
(let (x287, x288) = unpair x286 in
let (x289, x290) = unpair x287 in
let (x291, x292) = unpair x288 in
if eq (compare x289 x290)
then unit
mem (pair x289 (pair x290 x291))
then unit
else failwith "FA2_NOT_OPERATOR" :
unit))), x248, x69, x40, x0)) in
((pair nil
(pair (pair x370 (cdr (car x248))) (cdr x248))),
x71) in
(x385, x386)
| Right x387 ->
let (x425, x426) =
(fun (x395, (x391, x392)) ->
(match x395 with
| Left x396 -> x396
| Right x397 -> x397)) x392))
then failwith "FA2_NOT_OWNER";
(((match x395 with
| Left x403 ->
(pair (car x403)
(pair (car (cdr x403)) (cdr (cdr x403))))
(some unit) x391
| Right x414 ->
(pair (car x414)
(pair (car (cdr x414)) (cdr (cdr x414))))
none x391)), x392))
(x387, ((cdr (car x248)), sender)) in
((pair nil (pair (pair (car (car x248)) x425) (cdr x248))),
x71) in
let (x438, x439) = unpair x436 in
pair x438 (pair (pair (car (car x437)) x439) (cdr x437)))
| Right x447 ->
(if neq (compare sender (cdr (car (car (car x71)))))
then failwith "NOT_A_MINTER";
(let x457 = cdr (car x71) in
let (x589, x590) =
match x447 with
| Left x458 ->
let (x478, x482) =
(fun (x468, (x461, x465)) ->
(pair (pair (car x468) (car (cdr x468)))
(pair (cdr (cdr x468)) x461)) x465), x465))
(x458, ((car (car x457)), x69)) in
let (x509, x513, x514) =
(fun (x493, (x487, x491, x492)) ->
((match get (car (cdr x493)) x487 with
| None -> failwith x492
| Some x497 ->
update (car (cdr x493))
(match isnat (sub x497 (cdr (cdr x493))) with
| None -> failwith x491
| Some x502 -> x502)) x487), x491, x492))
(x458, ((cdr (cdr x457)), x1, x0)) in
let x519 = pair (pair x478 (cdr (car x457))) (cdr x457) in
((pair nil (pair (car x519) (pair (car (cdr x519)) x509))),
| Right x527 ->
let (x546, x550) =
(fun (x536, (x530, x534)) ->
(pair (pair (car x536) (car (cdr x536)))
(pair (cdr (cdr x536)) x530)) x534), x534))
(x527, ((car (car x457)), x40)) in
let (x572, x576) =
(fun (x559, (x554, x558)) ->
((match get (car (cdr x559)) x554 with
| None -> failwith x558
| Some x563 ->
update (car (cdr x559))
(some (add (cdr (cdr x559)) x563)) x554), x558))
(x527, ((cdr (cdr x457)), x0)) in
let x581 = pair (pair x546 (cdr (car x457))) (cdr x457) in
((pair nil (pair (car x581) (pair (car (cdr x581)) x572))),
x71) in
let (x591, x592) = unpair x589 in
pair x591 (pair (pair (car (car x590)) x592) (cdr x590))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment