8 | | - | let c = "price" |
---|
9 | | - | |
---|
10 | | - | let d = "sell" |
---|
11 | | - | |
---|
12 | | - | let e = 7 |
---|
13 | | - | |
---|
14 | | - | let f = "bid" |
---|
15 | | - | |
---|
16 | | - | let g = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED") |
---|
17 | | - | |
---|
18 | | - | let h = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq' |
---|
19 | | - | |
---|
20 | | - | func i (j) = { |
---|
21 | | - | let k = assetInfo(j) |
---|
22 | | - | if ($isInstanceOf(k, "Asset")) |
---|
23 | | - | then { |
---|
24 | | - | let l = k |
---|
25 | | - | if (if ((l.decimals == 0)) |
---|
26 | | - | then (l.quantity == 1) |
---|
27 | | - | else false) |
---|
28 | | - | then (l.reissuable == false) |
---|
29 | | - | else false |
---|
30 | | - | } |
---|
31 | | - | else false |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func token () = { |
---|
| 8 | + | let b = Issue("shub", "This is an ordinary token", 1000000, 2, true) |
---|
| 9 | + | let c = calculateAssetId(b) |
---|
| 10 | + | [b] |
---|
35 | | - | @Callable(m) |
---|
36 | | - | func createNft (n,o,p,q,r,s,t,u,v) = { |
---|
37 | | - | let w = Issue(n, t, 1, 0, false) |
---|
38 | | - | let x = calculateAssetId(w) |
---|
39 | | - | let y = m.transactionId |
---|
40 | | - | [w, ScriptTransfer(m.caller, 1, x), StringEntry(((toBase58String(x) + a) + "Owner"), toString(m.caller)), StringEntry(((toBase58String(x) + a) + "nft_type"), q), StringEntry(((toBase58String(x) + a) + "nft_tags"), r), StringEntry(((toBase58String(x) + a) + "nft_dAppAddress"), p), IntegerEntry(((toBase58String(x) + a) + "nft_selling_price"), s), StringEntry(((toBase58String(x) + a) + "nft_onSell"), u), StringEntry(((toBase58String(x) + a) + "nft_data"), v), StringEntry(((toBase58String(y) + a) + "issue_nft"), toBase58String(x))] |
---|
41 | | - | } |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | |
---|
45 | | - | @Callable(m) |
---|
46 | | - | func sellNFT (z) = { |
---|
47 | | - | let y = m.transactionId |
---|
48 | | - | let A = m.caller.bytes |
---|
49 | | - | let B = $Tuple2(value(m.payments[0].assetId), value(m.payments[0].amount)) |
---|
50 | | - | let C = B._1 |
---|
51 | | - | let D = B._2 |
---|
52 | | - | if (!(i(C))) |
---|
53 | | - | then throw("Token is not NFT") |
---|
54 | | - | else [StringEntry(((c + a) + toBase58String(value(m.payments[0].assetId))), toString(z)), StringEntry(((toString(m.caller) + a) + d), ((toBase58String(C) + a) + toString(D)))] |
---|
55 | | - | } |
---|
56 | | - | |
---|
57 | | - | |
---|
58 | | - | |
---|
59 | | - | @Callable(m) |
---|
60 | | - | func buyNFT (E,F) = { |
---|
61 | | - | let j = fromBase58String(E) |
---|
62 | | - | let G = value(m.payments[0].amount) |
---|
63 | | - | let H = { |
---|
64 | | - | let k = getString(this, (("nft_" + F) + "_owner")) |
---|
65 | | - | if ($isInstanceOf(k, "String")) |
---|
66 | | - | then { |
---|
67 | | - | let I = k |
---|
68 | | - | I |
---|
69 | | - | } |
---|
70 | | - | else false |
---|
71 | | - | } |
---|
72 | | - | let z = getStringValue(((((c + a) + E) + "_") + F)) |
---|
73 | | - | if ((m.payments[0].assetId != unit)) |
---|
74 | | - | then throw("Pay in waves") |
---|
75 | | - | else if ((F == toString(m.caller))) |
---|
76 | | - | then throw("current Owner of NFT not able to purchase") |
---|
77 | | - | else [ScriptTransfer(m.caller, 1, j), ScriptTransfer(Address(fromBase58String(F)), G, unit), StringEntry(((toString(m.caller) + a) + b), ((E + a) + toString(G))), DeleteEntry((("nft_" + F) + "_owner")), StringEntry((("nft_" + F) + "_owner"), toString(m.caller)), StringEntry(((E + a) + "_owner"), toString(m.caller))] |
---|
78 | | - | } |
---|
79 | | - | |
---|
| 14 | + | @Verifier(d) |
---|
| 15 | + | func e () = sigVerify(d.bodyBytes, d.proofs[0], d.senderPublicKey) |
---|