tx · CAR2m5ja2HCzeMUZAmpv77SL8vSFGqZuM9MdAF16ZAmY 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc: -0.01000000 Waves 2021.10.22 00:10 [1756577] smart account 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc > SELF 0.00000000 Waves
{ "type": 13, "id": "CAR2m5ja2HCzeMUZAmpv77SL8vSFGqZuM9MdAF16ZAmY", "fee": 1000000, "feeAssetId": null, "timestamp": 1634850681834, "version": 2, "chainId": 84, "sender": "3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc", "senderPublicKey": "6LrPmGtwuADhwHYcxBouLzwfSTGgucbwYG5Pja7LUrcd", "proofs": [ "5riiM1BhNncg8YjPLumhrbAoP9QUwHB72zvTST6vgdBZS7JBkDCNis9ybp3cN1b5Rzc5yXV21aZCYAgcpjJ14Sq7" ], "script": "base64:AAIFAAAAAAAAABcIAhIECgIIGRIDCgEBEgMKAQESAwoBAQAAABUAAAAACm9mZmVySWRLZXkCAAAADSRPRkZFUl9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAA9vZmZlck9wZW5TdGF0dXMAAAAAAAAAAAEAAAAAE29mZmVyQ2FuY2VsZWRTdGF0dXMAAAAAAAAAAAIAAAAAE29mZmVyQWNjZXB0ZWRTdGF0dXMAAAAAAAAAAAMAAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAAAAAAAQAAAAAEndhdmVzU3RhbmRJblN0cmluZwIAAAAFV0FWRVMAAAAAFndhdmVzU3RhbmRJbkJ5dGVWZWN0b3IJAAGbAAAAAQUAAAASd2F2ZXNTdGFuZEluU3RyaW5nAAAAABJ3YXZlc1N0YW5kSW5CYXNlNjQJAAJaAAAAAQUAAAAWd2F2ZXNTdGFuZEluQnl0ZVZlY3RvcgEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABAAAAB29mZmVySWQJAAEsAAAAAgkAAaQAAAABBQAAAAdvZmZlcklkAgAAAAdfc3Rh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SBtYWRlIHRvIGNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQUAAAAHb2ZmZXJJZAUAAAATb2ZmZXJBY2NlcHRlZFN0YXR1cwUAAAADbmlsAAAAAWkBAAAAC3JlamVjdE9mZmVyAAAAAQAAAAdvZmZlcklkBAAAAAtvZmZlclN0YXR1cwkBAAAADXRyeUdldEludGVnZXIAAAABCQEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABBQAAAAdvZmZlcklkAwkBAAAAAiE9AAAAAgUAAAALb2ZmZXJTdGF0dXMFAAAAD29mZmVyT3BlblN0YXR1cwkAAAIAAAABAgAAABlvZmZlciBzdGF0dXMgbXVzdCBiZSBvcGVuBAAAAAlhZGRyZXNzVG8JAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAQAAABRnZXRPZmZlckFkZHJlc3NUb0tleQAAAAEFAAAAB29mZmVySWQEAAAACWNhbGxlclN0cgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAJYWRkcmVzc1RvBQAAAAljYWxsZXJTdHIJAAACAAAAAQIAAAAcb2ZmZXIgbXVzdCBiZSBtYWRlIHRvIGNhbGxlcgkBAAAACWRyb3BPZmZlcgAAAAIFAAAAB29mZmVySWQFAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAcf6/uA==", "height": 1756577, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5F3R3xJbF2ppjFAHPNKT66mK4ratLMndQXkW9QWQBA2B Next: trJuHoX1NitFuvuN9RLQ4nq5rCwRBmH4qXBDwrvjfFu Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let f = 4 | |
15 | 15 | ||
16 | - | let g = | |
16 | + | let g = "WAVES" | |
17 | 17 | ||
18 | - | func h (i) = (toString(i) + "_status") | |
18 | + | let h = toBytes(g) | |
19 | + | ||
20 | + | let i = toBase64String(h) | |
21 | + | ||
22 | + | func j (k) = (toString(k) + "_status") | |
19 | 23 | ||
20 | 24 | ||
21 | - | func | |
25 | + | func l (k) = (toString(k) + "_from") | |
22 | 26 | ||
23 | 27 | ||
24 | - | func | |
28 | + | func m (k) = (toString(k) + "_to") | |
25 | 29 | ||
26 | 30 | ||
27 | - | func | |
31 | + | func n (k,o) = (((toString(k) + "_") + toString(o)) + "_offered_asset_id") | |
28 | 32 | ||
29 | 33 | ||
30 | - | func | |
34 | + | func p (k,o) = (((toString(k) + "_") + toString(o)) + "_offered_asset_amount") | |
31 | 35 | ||
32 | 36 | ||
33 | - | func | |
37 | + | func q (k,o) = (((toString(k) + "_") + toString(o)) + "_asked_asset_id") | |
34 | 38 | ||
35 | 39 | ||
36 | - | func | |
40 | + | func r (k,o) = (((toString(k) + "_") + toString(o)) + "_asked_asset_amount") | |
37 | 41 | ||
38 | 42 | ||
39 | - | func | |
40 | - | let | |
41 | - | let | |
42 | - | if ($isInstanceOf( | |
43 | + | func s (t) = { | |
44 | + | let u = { | |
45 | + | let v = getInteger(this, t) | |
46 | + | if ($isInstanceOf(v, "Int")) | |
43 | 47 | then { | |
44 | - | let | |
45 | - | | |
48 | + | let w = v | |
49 | + | w | |
46 | 50 | } | |
47 | 51 | else 0 | |
48 | 52 | } | |
49 | - | | |
53 | + | u | |
50 | 54 | } | |
51 | 55 | ||
52 | 56 | ||
53 | - | func v (i,m) = { | |
54 | - | let s = fromBase64String(getStringValue(this, l(i, m))) | |
55 | - | if ((s == g)) | |
56 | - | then unit | |
57 | - | else s | |
57 | + | func x (y) = { | |
58 | + | let z = { | |
59 | + | let v = y[0] | |
60 | + | if ($isInstanceOf(v, "String")) | |
61 | + | then { | |
62 | + | let w = v | |
63 | + | fromBase64String(w) | |
64 | + | } | |
65 | + | else throw("must have an assetId") | |
66 | + | } | |
67 | + | z | |
58 | 68 | } | |
59 | 69 | ||
60 | 70 | ||
61 | - | func w (i,x) = { | |
62 | - | let y = Address(fromBase58String(getStringValue(this, j(i)))) | |
63 | - | let z = v(i, 0) | |
64 | - | let A = q(n(i, 0)) | |
65 | - | [IntegerEntry(h(i), x), ScriptTransfer(y, A, z)] | |
71 | + | func A (y) = { | |
72 | + | let z = { | |
73 | + | let v = y[1] | |
74 | + | if ($isInstanceOf(v, "Int")) | |
75 | + | then { | |
76 | + | let w = v | |
77 | + | w | |
78 | + | } | |
79 | + | else throw("must have an amount") | |
80 | + | } | |
81 | + | z | |
66 | 82 | } | |
67 | 83 | ||
68 | 84 | ||
69 | - | @Callable(B) | |
70 | - | func createOffer (C,D) = { | |
71 | - | let i = (q(a) + 1) | |
72 | - | let E = value(B.payments[0]) | |
73 | - | if (!(isDefined(E))) | |
85 | + | func B (k,o) = { | |
86 | + | let u = fromBase64String(getStringValue(this, n(k, o))) | |
87 | + | if ((u == h)) | |
88 | + | then unit | |
89 | + | else u | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | func C (k,D) = { | |
94 | + | let E = Address(fromBase58String(getStringValue(this, l(k)))) | |
95 | + | let F = B(k, 0) | |
96 | + | let G = s(p(k, 0)) | |
97 | + | [IntegerEntry(j(k), D), ScriptTransfer(E, G, F)] | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | @Callable(H) | |
102 | + | func createOffer (I,J) = { | |
103 | + | let k = (s(a) + 1) | |
104 | + | let K = value(H.payments[0]) | |
105 | + | if (!(isDefined(K))) | |
74 | 106 | then throw("no payment") | |
75 | - | else [IntegerEntry(a, | |
107 | + | else [IntegerEntry(a, k), IntegerEntry(j(k), c), StringEntry(l(k), toBase58String(H.caller.bytes)), StringEntry(m(k), I), StringEntry(n(k, 0), toBase64String(valueOrElse(K.assetId, h))), IntegerEntry(p(k, 0), K.amount), StringEntry(q(k, 0), toBase64String(x(J))), IntegerEntry(r(k, 0), A(J))] | |
76 | 108 | } | |
77 | 109 | ||
78 | 110 | ||
79 | 111 | ||
80 | - | @Callable( | |
81 | - | func cancelOffer ( | |
82 | - | let | |
83 | - | if (( | |
112 | + | @Callable(H) | |
113 | + | func cancelOffer (k) = { | |
114 | + | let L = s(j(k)) | |
115 | + | if ((L != c)) | |
84 | 116 | then throw("offer status must be open") | |
85 | 117 | else { | |
86 | - | let | |
87 | - | let | |
88 | - | if (( | |
118 | + | let E = getStringValue(this, l(k)) | |
119 | + | let M = toBase58String(H.caller.bytes) | |
120 | + | if ((E != M)) | |
89 | 121 | then throw("offer must be made by caller") | |
90 | - | else | |
122 | + | else C(k, d) | |
91 | 123 | } | |
92 | 124 | } | |
93 | 125 | ||
94 | 126 | ||
95 | 127 | ||
96 | - | @Callable( | |
97 | - | func acceptOffer ( | |
98 | - | let | |
99 | - | if (( | |
128 | + | @Callable(H) | |
129 | + | func acceptOffer (k) = { | |
130 | + | let L = s(j(k)) | |
131 | + | if ((L != c)) | |
100 | 132 | then throw("offer status must be open") | |
101 | 133 | else { | |
102 | - | let | |
103 | - | let | |
104 | - | if (( | |
134 | + | let N = getStringValue(this, m(k)) | |
135 | + | let M = toBase58String(H.caller.bytes) | |
136 | + | if ((N != M)) | |
105 | 137 | then throw("offer must be made to caller") | |
106 | - | else [IntegerEntry( | |
138 | + | else [IntegerEntry(j(k), e)] | |
107 | 139 | } | |
108 | 140 | } | |
109 | 141 | ||
110 | 142 | ||
111 | 143 | ||
112 | - | @Callable( | |
113 | - | func rejectOffer ( | |
114 | - | let | |
115 | - | if (( | |
144 | + | @Callable(H) | |
145 | + | func rejectOffer (k) = { | |
146 | + | let L = s(j(k)) | |
147 | + | if ((L != c)) | |
116 | 148 | then throw("offer status must be open") | |
117 | 149 | else { | |
118 | - | let | |
119 | - | let | |
120 | - | if (( | |
150 | + | let N = getStringValue(this, m(k)) | |
151 | + | let M = toBase58String(H.caller.bytes) | |
152 | + | if ((N != M)) | |
121 | 153 | then throw("offer must be made to caller") | |
122 | - | else | |
154 | + | else C(k, f) | |
123 | 155 | } | |
124 | 156 | } | |
125 | 157 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "$OFFER_NUMBER" | |
5 | 5 | ||
6 | 6 | let b = "$TEST" | |
7 | 7 | ||
8 | 8 | let c = 1 | |
9 | 9 | ||
10 | 10 | let d = 2 | |
11 | 11 | ||
12 | 12 | let e = 3 | |
13 | 13 | ||
14 | 14 | let f = 4 | |
15 | 15 | ||
16 | - | let g = | |
16 | + | let g = "WAVES" | |
17 | 17 | ||
18 | - | func h (i) = (toString(i) + "_status") | |
18 | + | let h = toBytes(g) | |
19 | + | ||
20 | + | let i = toBase64String(h) | |
21 | + | ||
22 | + | func j (k) = (toString(k) + "_status") | |
19 | 23 | ||
20 | 24 | ||
21 | - | func | |
25 | + | func l (k) = (toString(k) + "_from") | |
22 | 26 | ||
23 | 27 | ||
24 | - | func | |
28 | + | func m (k) = (toString(k) + "_to") | |
25 | 29 | ||
26 | 30 | ||
27 | - | func | |
31 | + | func n (k,o) = (((toString(k) + "_") + toString(o)) + "_offered_asset_id") | |
28 | 32 | ||
29 | 33 | ||
30 | - | func | |
34 | + | func p (k,o) = (((toString(k) + "_") + toString(o)) + "_offered_asset_amount") | |
31 | 35 | ||
32 | 36 | ||
33 | - | func | |
37 | + | func q (k,o) = (((toString(k) + "_") + toString(o)) + "_asked_asset_id") | |
34 | 38 | ||
35 | 39 | ||
36 | - | func | |
40 | + | func r (k,o) = (((toString(k) + "_") + toString(o)) + "_asked_asset_amount") | |
37 | 41 | ||
38 | 42 | ||
39 | - | func | |
40 | - | let | |
41 | - | let | |
42 | - | if ($isInstanceOf( | |
43 | + | func s (t) = { | |
44 | + | let u = { | |
45 | + | let v = getInteger(this, t) | |
46 | + | if ($isInstanceOf(v, "Int")) | |
43 | 47 | then { | |
44 | - | let | |
45 | - | | |
48 | + | let w = v | |
49 | + | w | |
46 | 50 | } | |
47 | 51 | else 0 | |
48 | 52 | } | |
49 | - | | |
53 | + | u | |
50 | 54 | } | |
51 | 55 | ||
52 | 56 | ||
53 | - | func v (i,m) = { | |
54 | - | let s = fromBase64String(getStringValue(this, l(i, m))) | |
55 | - | if ((s == g)) | |
56 | - | then unit | |
57 | - | else s | |
57 | + | func x (y) = { | |
58 | + | let z = { | |
59 | + | let v = y[0] | |
60 | + | if ($isInstanceOf(v, "String")) | |
61 | + | then { | |
62 | + | let w = v | |
63 | + | fromBase64String(w) | |
64 | + | } | |
65 | + | else throw("must have an assetId") | |
66 | + | } | |
67 | + | z | |
58 | 68 | } | |
59 | 69 | ||
60 | 70 | ||
61 | - | func w (i,x) = { | |
62 | - | let y = Address(fromBase58String(getStringValue(this, j(i)))) | |
63 | - | let z = v(i, 0) | |
64 | - | let A = q(n(i, 0)) | |
65 | - | [IntegerEntry(h(i), x), ScriptTransfer(y, A, z)] | |
71 | + | func A (y) = { | |
72 | + | let z = { | |
73 | + | let v = y[1] | |
74 | + | if ($isInstanceOf(v, "Int")) | |
75 | + | then { | |
76 | + | let w = v | |
77 | + | w | |
78 | + | } | |
79 | + | else throw("must have an amount") | |
80 | + | } | |
81 | + | z | |
66 | 82 | } | |
67 | 83 | ||
68 | 84 | ||
69 | - | @Callable(B) | |
70 | - | func createOffer (C,D) = { | |
71 | - | let i = (q(a) + 1) | |
72 | - | let E = value(B.payments[0]) | |
73 | - | if (!(isDefined(E))) | |
85 | + | func B (k,o) = { | |
86 | + | let u = fromBase64String(getStringValue(this, n(k, o))) | |
87 | + | if ((u == h)) | |
88 | + | then unit | |
89 | + | else u | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | func C (k,D) = { | |
94 | + | let E = Address(fromBase58String(getStringValue(this, l(k)))) | |
95 | + | let F = B(k, 0) | |
96 | + | let G = s(p(k, 0)) | |
97 | + | [IntegerEntry(j(k), D), ScriptTransfer(E, G, F)] | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | @Callable(H) | |
102 | + | func createOffer (I,J) = { | |
103 | + | let k = (s(a) + 1) | |
104 | + | let K = value(H.payments[0]) | |
105 | + | if (!(isDefined(K))) | |
74 | 106 | then throw("no payment") | |
75 | - | else [IntegerEntry(a, | |
107 | + | else [IntegerEntry(a, k), IntegerEntry(j(k), c), StringEntry(l(k), toBase58String(H.caller.bytes)), StringEntry(m(k), I), StringEntry(n(k, 0), toBase64String(valueOrElse(K.assetId, h))), IntegerEntry(p(k, 0), K.amount), StringEntry(q(k, 0), toBase64String(x(J))), IntegerEntry(r(k, 0), A(J))] | |
76 | 108 | } | |
77 | 109 | ||
78 | 110 | ||
79 | 111 | ||
80 | - | @Callable( | |
81 | - | func cancelOffer ( | |
82 | - | let | |
83 | - | if (( | |
112 | + | @Callable(H) | |
113 | + | func cancelOffer (k) = { | |
114 | + | let L = s(j(k)) | |
115 | + | if ((L != c)) | |
84 | 116 | then throw("offer status must be open") | |
85 | 117 | else { | |
86 | - | let | |
87 | - | let | |
88 | - | if (( | |
118 | + | let E = getStringValue(this, l(k)) | |
119 | + | let M = toBase58String(H.caller.bytes) | |
120 | + | if ((E != M)) | |
89 | 121 | then throw("offer must be made by caller") | |
90 | - | else | |
122 | + | else C(k, d) | |
91 | 123 | } | |
92 | 124 | } | |
93 | 125 | ||
94 | 126 | ||
95 | 127 | ||
96 | - | @Callable( | |
97 | - | func acceptOffer ( | |
98 | - | let | |
99 | - | if (( | |
128 | + | @Callable(H) | |
129 | + | func acceptOffer (k) = { | |
130 | + | let L = s(j(k)) | |
131 | + | if ((L != c)) | |
100 | 132 | then throw("offer status must be open") | |
101 | 133 | else { | |
102 | - | let | |
103 | - | let | |
104 | - | if (( | |
134 | + | let N = getStringValue(this, m(k)) | |
135 | + | let M = toBase58String(H.caller.bytes) | |
136 | + | if ((N != M)) | |
105 | 137 | then throw("offer must be made to caller") | |
106 | - | else [IntegerEntry( | |
138 | + | else [IntegerEntry(j(k), e)] | |
107 | 139 | } | |
108 | 140 | } | |
109 | 141 | ||
110 | 142 | ||
111 | 143 | ||
112 | - | @Callable( | |
113 | - | func rejectOffer ( | |
114 | - | let | |
115 | - | if (( | |
144 | + | @Callable(H) | |
145 | + | func rejectOffer (k) = { | |
146 | + | let L = s(j(k)) | |
147 | + | if ((L != c)) | |
116 | 148 | then throw("offer status must be open") | |
117 | 149 | else { | |
118 | - | let | |
119 | - | let | |
120 | - | if (( | |
150 | + | let N = getStringValue(this, m(k)) | |
151 | + | let M = toBase58String(H.caller.bytes) | |
152 | + | if ((N != M)) | |
121 | 153 | then throw("offer must be made to caller") | |
122 | - | else | |
154 | + | else C(k, f) | |
123 | 155 | } | |
124 | 156 | } | |
125 | 157 | ||
126 | 158 |
github/deemru/w8io/169f3d6 133.30 ms ◑