tx · Ga5wcD8sxwhMegh1rA5yGDpoz3bEWX633Hgg2fDPDhSe 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV: -0.01400000 Waves 2022.02.04 04:31 [1908209] smart account 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV > SELF 0.00000000 Waves
{ "type": 13, "id": "Ga5wcD8sxwhMegh1rA5yGDpoz3bEWX633Hgg2fDPDhSe", "fee": 1400000, "feeAssetId": null, "timestamp": 1643938266110, "version": 2, "chainId": 84, "sender": "3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV", "senderPublicKey": "7ycxALbgfzht9z36iWCgRauBfWzQGSgkc3HMwu7wDwNX", "proofs": [ "4QYvf6oLk7sznbfS9KrjHUpSxJxyvxEa9urYquFC39f3FwkbJHmAPyHNHTqaJSMPNH2qehwNWxSZHUtaMV3x6Gkp" ], "script": "base64:AAIFAAAAAAAAAhEIAhIDCgEIEgUKAwgBCBIFCgMICAgSAwoBCBIDCgEIEgMKAQgaDAoBQRIHcGF5bWVudBoRCgFCEgxjdXN0b21lckFkZHIaBgoBQxIBcBoMCgFEEgdzb2xkb3V0GgcKAUUSAnR4GgsKAUYSBnZlcmlmeRoJCgFhEgROT05FGg0KAWISCGN1c3RvbWVyGg0KAWMSCHN1cHBsaWVyGg8KAWQSCmVyaWNQdWJLZXkaEwoBZRIOZ2V0U3RyaW5nQnlLZXkaCAoBZhIDa2V5GgwKAWcSByRtYXRjaDAaBgoBaBIBYRoQCgFpEgtnZXRJdGVtSGFzaBoKCgFqEgV0aXRsZRoPCgFrEgpjb21ib1RpdGxlGg8KAWwSCmdldE5hbWVLZXkaCQoBbRIEdHlwZRoJCgFuEgRhZGRyGhcKAW8SEmdldEl0ZW1TdXBwbGllcktleRoJCgFwEgRpdGVtGhQKAXESD2dldEl0ZW1QcmljZUtleRoWCgFyEhFnZXRJdGVtU29sZE91dEtleRoTCgFzEg5nZXRJdGVtRGF0YUtleRoZCgF0EhRnZXRWYWx1ZUl0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AAAAEJAQAAAAFzAAAAAQUAAAABcAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAABcgAAAAEFAAAAAXAFAAAAA25pbAkAAAIAAAABAgAAABRObyBzdWNoIGl0ZW0gcHJlc2VudAAAAAF3AQAAAAtkZWxldGVFbnRyeQAAAAEAAAABZgMJAAAAAAAAAggFAAAAAXcAAAAPY2FsbGVyUHVibGljS2V5BQAAAAFkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAAWYFAAAAA25pbAkAAAIAAAABAgAAABxPbmx5IEVyaWMgY2FuIGRlbGV0ZSBlbnRyaWVzAAAAAXcBAAAACnVucmVnaXN0ZXIAAAABAAAAAW0DAwkAAAAAAAACBQAAAAFtBQAAAAFjBgkAAAAAAAACBQAAAAFtBQAAAAFiBAAAAAFuCQACWAAAAAEICAUAAAABdwAAAAZjYWxsZXIAAAAFYnl0ZXMJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAWwAAAACBQAAAAFtBQAAAAFuBQAAAANuaWwJAAACAAAAAQIAAAAQSWxsZWdhbCBhcmd1bWVudAAAAAEAAAABRQEAAAABRgAAAAAJAAH0AAAAAwgFAAAAAUUAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFFAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAUUAAAAPc2VuZGVyUHVibGljS2V50idhPw==", "height": 1908209, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HRXA72GWLbTeHMQBpZme4fnekwwPi2p71Wnk5ZQ9aiTC Next: none Diff:
Old | New | Differences | |
---|---|---|---|
49 | 49 | ||
50 | 50 | func v (p) = { | |
51 | 51 | let f = r(p) | |
52 | - | if (true) | |
53 | - | then throw(("SoldKey: " + f)) | |
54 | - | else { | |
55 | - | let g = getInteger(this, f) | |
56 | - | if ($isInstanceOf(g, "Int")) | |
57 | - | then { | |
58 | - | let h = g | |
59 | - | h | |
60 | - | } | |
61 | - | else 2 | |
52 | + | let g = getInteger(this, f) | |
53 | + | if ($isInstanceOf(g, "Int")) | |
54 | + | then { | |
55 | + | let h = g | |
56 | + | h | |
62 | 57 | } | |
58 | + | else 2 | |
63 | 59 | } | |
64 | 60 | ||
65 | 61 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "NONE" | |
5 | 5 | ||
6 | 6 | let b = "CUSTOMER" | |
7 | 7 | ||
8 | 8 | let c = "SUPPLIER" | |
9 | 9 | ||
10 | 10 | let d = base58'8haEN2a7ZmkzawLmnr5rFX14X1oHi5kjt8NQUDNjSDLG' | |
11 | 11 | ||
12 | 12 | func e (f) = { | |
13 | 13 | let g = getString(f) | |
14 | 14 | if ($isInstanceOf(g, "String")) | |
15 | 15 | then { | |
16 | 16 | let h = g | |
17 | 17 | h | |
18 | 18 | } | |
19 | 19 | else a | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func i (c,j) = { | |
24 | 24 | let k = (c + j) | |
25 | 25 | ("item_" + toBase58String(sha256(toBytes(k)))) | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func l (m,n) = (((m + "_") + n) + "_name") | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func o (p) = (p + "_owner") | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func q (p) = (p + "_price") | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func r (p) = (p + "_soldout") | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func s (p) = (p + "_data") | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func t (p) = { | |
45 | 45 | let u = o(p) | |
46 | 46 | e(u) | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func v (p) = { | |
51 | 51 | let f = r(p) | |
52 | - | if (true) | |
53 | - | then throw(("SoldKey: " + f)) | |
54 | - | else { | |
55 | - | let g = getInteger(this, f) | |
56 | - | if ($isInstanceOf(g, "Int")) | |
57 | - | then { | |
58 | - | let h = g | |
59 | - | h | |
60 | - | } | |
61 | - | else 2 | |
52 | + | let g = getInteger(this, f) | |
53 | + | if ($isInstanceOf(g, "Int")) | |
54 | + | then { | |
55 | + | let h = g | |
56 | + | h | |
62 | 57 | } | |
58 | + | else 2 | |
63 | 59 | } | |
64 | 60 | ||
65 | 61 | ||
66 | 62 | @Callable(w) | |
67 | 63 | func register (m) = { | |
68 | 64 | let n = toBase58String(w.caller.bytes) | |
69 | 65 | if (if (isDefined(m)) | |
70 | 66 | then if ((m == b)) | |
71 | 67 | then true | |
72 | 68 | else (m == c) | |
73 | 69 | else false) | |
74 | 70 | then [StringEntry(l(m, n), n)] | |
75 | 71 | else throw("Invalid func parameters") | |
76 | 72 | } | |
77 | 73 | ||
78 | 74 | ||
79 | 75 | ||
80 | 76 | @Callable(w) | |
81 | 77 | func createItem (j,x,y) = { | |
82 | 78 | let z = toBase58String(w.caller.bytes) | |
83 | 79 | let p = i(z, j) | |
84 | 80 | if ((0 >= x)) | |
85 | 81 | then throw("Price can not be negative value or zero") | |
86 | 82 | else if ((t(p) != a)) | |
87 | 83 | then throw("Item already exists") | |
88 | 84 | else [StringEntry(o(p), z), IntegerEntry(q(p), x), IntegerEntry(r(p), 0), StringEntry(s(p), y)] | |
89 | 85 | } | |
90 | 86 | ||
91 | 87 | ||
92 | 88 | ||
93 | 89 | @Callable(w) | |
94 | 90 | func purchase (j,c,y) = if ((size(w.payments) > 0)) | |
95 | 91 | then { | |
96 | 92 | let A = w.payments[0] | |
97 | 93 | if (if (isDefined(j)) | |
98 | 94 | then isDefined(c) | |
99 | 95 | else false) | |
100 | 96 | then if (isDefined(A.assetId)) | |
101 | 97 | then throw("Only should pay in waves") | |
102 | 98 | else { | |
103 | 99 | let B = toBase58String(w.caller.bytes) | |
104 | 100 | let p = i(c, j) | |
105 | 101 | let x = { | |
106 | 102 | let g = getInteger(this, q(p)) | |
107 | 103 | if ($isInstanceOf(g, "Int")) | |
108 | 104 | then { | |
109 | 105 | let C = g | |
110 | 106 | C | |
111 | 107 | } | |
112 | 108 | else 0 | |
113 | 109 | } | |
114 | 110 | let D = v(p) | |
115 | 111 | if ((D != 0)) | |
116 | 112 | then throw(("Item is already sold, res: " + toString(D))) | |
117 | 113 | else if ((A.amount > x)) | |
118 | 114 | then throw("payment cant be higher than price") | |
119 | 115 | else if ((x > A.amount)) | |
120 | 116 | then throw("payment cant be lower than price") | |
121 | 117 | else [DeleteEntry(o(p)), DeleteEntry(q(p)), DeleteEntry(s(p)), DeleteEntry(r(p)), StringEntry(o(p), B), IntegerEntry(q(p), x), IntegerEntry(r(p), 1), StringEntry(s(p), y), StringEntry(((((("status:purchase_" + p) + "_supplier_") + c) + "_customer_") + B), "confirmed"), IntegerEntry(((((("price:purchase_" + p) + "_supplier_") + c) + "_customer_") + B), x)] | |
122 | 118 | } | |
123 | 119 | else throw("Coupon title and supplier address should be present") | |
124 | 120 | } | |
125 | 121 | else throw("Please attach payment") | |
126 | 122 | ||
127 | 123 | ||
128 | 124 | ||
129 | 125 | @Callable(w) | |
130 | 126 | func deleteItem (j) = { | |
131 | 127 | let z = toBase58String(w.caller.bytes) | |
132 | 128 | let p = i(z, j) | |
133 | 129 | if ((t(p) != a)) | |
134 | 130 | then [DeleteEntry(o(p)), DeleteEntry(q(p)), DeleteEntry(s(p)), DeleteEntry(r(p))] | |
135 | 131 | else throw("No such item present") | |
136 | 132 | } | |
137 | 133 | ||
138 | 134 | ||
139 | 135 | ||
140 | 136 | @Callable(w) | |
141 | 137 | func deleteEntry (f) = if ((w.callerPublicKey == d)) | |
142 | 138 | then [DeleteEntry(f)] | |
143 | 139 | else throw("Only Eric can delete entries") | |
144 | 140 | ||
145 | 141 | ||
146 | 142 | ||
147 | 143 | @Callable(w) | |
148 | 144 | func unregister (m) = if (if ((m == c)) | |
149 | 145 | then true | |
150 | 146 | else (m == b)) | |
151 | 147 | then { | |
152 | 148 | let n = toBase58String(w.caller.bytes) | |
153 | 149 | [DeleteEntry(l(m, n))] | |
154 | 150 | } | |
155 | 151 | else throw("Illegal argument") | |
156 | 152 | ||
157 | 153 | ||
158 | 154 | @Verifier(E) | |
159 | 155 | func F () = sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) | |
160 | 156 |
github/deemru/w8io/026f985 34.24 ms ◑