tx · E2AHDVsdo9hLL4FN1wT6FRC3CHziXBgpKdpqCuN87Pxt
3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc: -0.01000000 Waves
2021.10.21 23:42 [1756548] smart account 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc > SELF 0.00000000 Waves
{
"type": 13,
"id": "E2AHDVsdo9hLL4FN1wT6FRC3CHziXBgpKdpqCuN87Pxt",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1634848965479,
"version": 2,
"chainId": 84,
"sender": "3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc",
"senderPublicKey": "6LrPmGtwuADhwHYcxBouLzwfSTGgucbwYG5Pja7LUrcd",
"proofs": [
"fkxCFwVy6PqfhZY1qcuMsH9Y1hnFZCRfAFsWK2FK1NrhbZQiLNbUakKHyShjMVE51C5eGn9s6Mt2hc4YzzctHbK"
],
"script": "base64:AAIFAAAAAAAAABcIAhIECgIIGBIDCgEBEgMKAQESAwoBAQAAABAAAAAACm9mZmVySWRLZXkCAAAADSRPRkZFUl9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAA9vZmZlck9wZW5TdGF0dXMAAAAAAAAAAAEAAAAAE29mZmVyQ2FuY2VsZWRTdGF0dXMAAAAAAAAAAAIAAAAAE29mZmVyQWNjZXB0ZWRTdGF0dXMAAAAAAAAAAAMAAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAAAAAAAQAAAAAFndhdmVzU3RhbmRJbkJ5dGVWZWN0b3IJAAGbAAAAAQIAAAAFV0FWRVMBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQAAAAdvZmZlcklkCQABLAAAAAIJAAGkAAAAAQUAAAAHb2ZmZXJJZAIAAAAHX3N0YXR1cwEAAAAWZ2V0T2ZmZXJBZGRyZXNzRnJvbUtleQAAAAEAAAAHb2ZmZXJJZAkAASwAAAACCQABpAAAAAEFAAAAB29mZmVySWQCAAAABV9mcm9tAQAAABRnZXRPZmZl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ZXJTdGF0dXNLZXkAAAABBQAAAAdvZmZlcklkAwkBAAAAAiE9AAAAAgUAAAALb2ZmZXJTdGF0dXMFAAAAD29mZmVyT3BlblN0YXR1cwkAAAIAAAABAgAAABlvZmZlciBzdGF0dXMgbXVzdCBiZSBvcGVuBAAAAAlhZGRyZXNzVG8JAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAQAAABRnZXRPZmZlckFkZHJlc3NUb0tleQAAAAEFAAAAB29mZmVySWQEAAAACWNhbGxlclN0cgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAJYWRkcmVzc1RvBQAAAAljYWxsZXJTdHIJAAACAAAAAQIAAAAcb2ZmZXIgbXVzdCBiZSBtYWRlIHRvIGNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQUAAAAHb2ZmZXJJZAUAAAATb2ZmZXJSZWplY3RlZFN0YXR1cwUAAAADbmlsAAAAAGd8nhQ=",
"height": 1756548,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: AshK3p7zNscKXJwKwy5AH9Zk25mqgcq55zf9ztdZvjnH
Next: 9N8EDBLqcnWxKYnRMt6jJHLYw1wzjsmUVfR7xcdVxpGx
Diff:
Old | New | | Differences |
---|
13 | 13 | | |
---|
14 | 14 | | let f = 4 |
---|
15 | 15 | | |
---|
16 | | - | func g (h) = (toString(h) + "_status") |
---|
| 16 | + | let g = toBytes("WAVES") |
---|
| 17 | + | |
---|
| 18 | + | func h (i) = (toString(i) + "_status") |
---|
17 | 19 | | |
---|
18 | 20 | | |
---|
19 | | - | func i (h) = (toString(h) + "_from") |
---|
| 21 | + | func j (i) = (toString(i) + "_from") |
---|
20 | 22 | | |
---|
21 | 23 | | |
---|
22 | | - | func j (h) = (toString(h) + "_to") |
---|
| 24 | + | func k (i) = (toString(i) + "_to") |
---|
23 | 25 | | |
---|
24 | 26 | | |
---|
25 | | - | func k (h,l) = (((toString(h) + "_") + toString(l)) + "_offered_asset_id") |
---|
| 27 | + | func l (i,m) = (((toString(i) + "_") + toString(m)) + "_offered_asset_id") |
---|
26 | 28 | | |
---|
27 | 29 | | |
---|
28 | | - | func m (h,l) = (((toString(h) + "_") + toString(l)) + "_offered_asset_amount") |
---|
| 30 | + | func n (i,m) = (((toString(i) + "_") + toString(m)) + "_offered_asset_amount") |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|
31 | | - | func n (h,l) = (((toString(h) + "_") + toString(l)) + "_asked_asset_id") |
---|
| 33 | + | func o (i,m) = (((toString(i) + "_") + toString(m)) + "_asked_asset_id") |
---|
32 | 34 | | |
---|
33 | 35 | | |
---|
34 | | - | func o (h,l) = (((toString(h) + "_") + toString(l)) + "_asked_asset_amount") |
---|
| 36 | + | func p (i,m) = (((toString(i) + "_") + toString(m)) + "_asked_asset_amount") |
---|
35 | 37 | | |
---|
36 | 38 | | |
---|
37 | | - | func p (q) = { |
---|
38 | | - | let r = { |
---|
39 | | - | let s = getInteger(this, q) |
---|
40 | | - | if ($isInstanceOf(s, "Int")) |
---|
| 39 | + | func q (r) = { |
---|
| 40 | + | let s = { |
---|
| 41 | + | let t = getInteger(this, r) |
---|
| 42 | + | if ($isInstanceOf(t, "Int")) |
---|
41 | 43 | | then { |
---|
42 | | - | let t = s |
---|
43 | | - | t |
---|
| 44 | + | let u = t |
---|
| 45 | + | u |
---|
44 | 46 | | } |
---|
45 | 47 | | else 0 |
---|
46 | 48 | | } |
---|
47 | | - | r |
---|
| 49 | + | s |
---|
48 | 50 | | } |
---|
49 | 51 | | |
---|
50 | 52 | | |
---|
51 | | - | @Callable(u) |
---|
52 | | - | func createOffer (v,w) = { |
---|
53 | | - | let h = p(a) |
---|
54 | | - | let x = value(u.payments[0]) |
---|
55 | | - | if (!(isDefined(x))) |
---|
| 53 | + | func v (i,m) = { |
---|
| 54 | + | let s = fromBase64String(getStringValue(this, l(i, m))) |
---|
| 55 | + | if ((s == g)) |
---|
| 56 | + | then unit |
---|
| 57 | + | else s |
---|
| 58 | + | } |
---|
| 59 | + | |
---|
| 60 | + | |
---|
| 61 | + | @Callable(w) |
---|
| 62 | + | func createOffer (x,y) = { |
---|
| 63 | + | let i = q(a) |
---|
| 64 | + | let z = value(w.payments[0]) |
---|
| 65 | + | if (!(isDefined(z))) |
---|
56 | 66 | | then throw("no payment") |
---|
57 | | - | else [IntegerEntry(g(h), c), StringEntry(i(h), toBase58String(u.caller.bytes)), StringEntry(j(h), v), StringEntry(k(h, 0), toBase58String(valueOrElse(x.assetId, toBytes("WAVES")))), IntegerEntry(m(h, 0), x.amount)] |
---|
| 67 | + | else [IntegerEntry(h(i), c), StringEntry(j(i), toBase58String(w.caller.bytes)), StringEntry(k(i), x), StringEntry(l(i, 0), toBase64String(valueOrElse(z.assetId, g))), IntegerEntry(n(i, 0), z.amount)] |
---|
58 | 68 | | } |
---|
59 | 69 | | |
---|
60 | 70 | | |
---|
61 | 71 | | |
---|
62 | | - | @Callable(u) |
---|
63 | | - | func cancelOffer (h) = { |
---|
64 | | - | let y = p(g(h)) |
---|
65 | | - | if ((y != c)) |
---|
| 72 | + | @Callable(w) |
---|
| 73 | + | func cancelOffer (i) = { |
---|
| 74 | + | let A = q(h(i)) |
---|
| 75 | + | if ((A != c)) |
---|
66 | 76 | | then throw("offer status must be open") |
---|
67 | 77 | | else { |
---|
68 | | - | let z = getStringValue(this, i(h)) |
---|
69 | | - | let A = toBase58String(u.caller.bytes) |
---|
70 | | - | if ((z != A)) |
---|
| 78 | + | let B = getStringValue(this, j(i)) |
---|
| 79 | + | let C = toBase58String(w.caller.bytes) |
---|
| 80 | + | if ((B != C)) |
---|
71 | 81 | | then throw("offer must be made by caller") |
---|
72 | | - | else [IntegerEntry(g(h), d)] |
---|
| 82 | + | else { |
---|
| 83 | + | let D = v(i, 0) |
---|
| 84 | + | let E = q(n(i, 0)) |
---|
| 85 | + | [IntegerEntry(h(i), d), ScriptTransfer(w.caller, E, D)] |
---|
| 86 | + | } |
---|
73 | 87 | | } |
---|
74 | 88 | | } |
---|
75 | 89 | | |
---|
76 | 90 | | |
---|
77 | 91 | | |
---|
78 | | - | @Callable(u) |
---|
79 | | - | func acceptOffer (h) = { |
---|
80 | | - | let y = p(g(h)) |
---|
81 | | - | if ((y != c)) |
---|
| 92 | + | @Callable(w) |
---|
| 93 | + | func acceptOffer (i) = { |
---|
| 94 | + | let A = q(h(i)) |
---|
| 95 | + | if ((A != c)) |
---|
82 | 96 | | then throw("offer status must be open") |
---|
83 | 97 | | else { |
---|
84 | | - | let B = getStringValue(this, j(h)) |
---|
85 | | - | let A = toBase58String(u.caller.bytes) |
---|
86 | | - | if ((B != A)) |
---|
| 98 | + | let F = getStringValue(this, k(i)) |
---|
| 99 | + | let C = toBase58String(w.caller.bytes) |
---|
| 100 | + | if ((F != C)) |
---|
87 | 101 | | then throw("offer must be made to caller") |
---|
88 | | - | else [IntegerEntry(g(h), e)] |
---|
| 102 | + | else [IntegerEntry(h(i), e)] |
---|
89 | 103 | | } |
---|
90 | 104 | | } |
---|
91 | 105 | | |
---|
92 | 106 | | |
---|
93 | 107 | | |
---|
94 | | - | @Callable(u) |
---|
95 | | - | func rejectOffer (h) = { |
---|
96 | | - | let y = p(g(h)) |
---|
97 | | - | if ((y != c)) |
---|
| 108 | + | @Callable(w) |
---|
| 109 | + | func rejectOffer (i) = { |
---|
| 110 | + | let A = q(h(i)) |
---|
| 111 | + | if ((A != c)) |
---|
98 | 112 | | then throw("offer status must be open") |
---|
99 | 113 | | else { |
---|
100 | | - | let B = getStringValue(this, j(h)) |
---|
101 | | - | let A = toBase58String(u.caller.bytes) |
---|
102 | | - | if ((B != A)) |
---|
| 114 | + | let F = getStringValue(this, k(i)) |
---|
| 115 | + | let C = toBase58String(w.caller.bytes) |
---|
| 116 | + | if ((F != C)) |
---|
103 | 117 | | then throw("offer must be made to caller") |
---|
104 | | - | else [IntegerEntry(g(h), f)] |
---|
| 118 | + | else [IntegerEntry(h(i), f)] |
---|
105 | 119 | | } |
---|
106 | 120 | | } |
---|
107 | 121 | | |
---|
Full:
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 | | - | func g (h) = (toString(h) + "_status") |
---|
| 16 | + | let g = toBytes("WAVES") |
---|
| 17 | + | |
---|
| 18 | + | func h (i) = (toString(i) + "_status") |
---|
17 | 19 | | |
---|
18 | 20 | | |
---|
19 | | - | func i (h) = (toString(h) + "_from") |
---|
| 21 | + | func j (i) = (toString(i) + "_from") |
---|
20 | 22 | | |
---|
21 | 23 | | |
---|
22 | | - | func j (h) = (toString(h) + "_to") |
---|
| 24 | + | func k (i) = (toString(i) + "_to") |
---|
23 | 25 | | |
---|
24 | 26 | | |
---|
25 | | - | func k (h,l) = (((toString(h) + "_") + toString(l)) + "_offered_asset_id") |
---|
| 27 | + | func l (i,m) = (((toString(i) + "_") + toString(m)) + "_offered_asset_id") |
---|
26 | 28 | | |
---|
27 | 29 | | |
---|
28 | | - | func m (h,l) = (((toString(h) + "_") + toString(l)) + "_offered_asset_amount") |
---|
| 30 | + | func n (i,m) = (((toString(i) + "_") + toString(m)) + "_offered_asset_amount") |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|
31 | | - | func n (h,l) = (((toString(h) + "_") + toString(l)) + "_asked_asset_id") |
---|
| 33 | + | func o (i,m) = (((toString(i) + "_") + toString(m)) + "_asked_asset_id") |
---|
32 | 34 | | |
---|
33 | 35 | | |
---|
34 | | - | func o (h,l) = (((toString(h) + "_") + toString(l)) + "_asked_asset_amount") |
---|
| 36 | + | func p (i,m) = (((toString(i) + "_") + toString(m)) + "_asked_asset_amount") |
---|
35 | 37 | | |
---|
36 | 38 | | |
---|
37 | | - | func p (q) = { |
---|
38 | | - | let r = { |
---|
39 | | - | let s = getInteger(this, q) |
---|
40 | | - | if ($isInstanceOf(s, "Int")) |
---|
| 39 | + | func q (r) = { |
---|
| 40 | + | let s = { |
---|
| 41 | + | let t = getInteger(this, r) |
---|
| 42 | + | if ($isInstanceOf(t, "Int")) |
---|
41 | 43 | | then { |
---|
42 | | - | let t = s |
---|
43 | | - | t |
---|
| 44 | + | let u = t |
---|
| 45 | + | u |
---|
44 | 46 | | } |
---|
45 | 47 | | else 0 |
---|
46 | 48 | | } |
---|
47 | | - | r |
---|
| 49 | + | s |
---|
48 | 50 | | } |
---|
49 | 51 | | |
---|
50 | 52 | | |
---|
51 | | - | @Callable(u) |
---|
52 | | - | func createOffer (v,w) = { |
---|
53 | | - | let h = p(a) |
---|
54 | | - | let x = value(u.payments[0]) |
---|
55 | | - | if (!(isDefined(x))) |
---|
| 53 | + | func v (i,m) = { |
---|
| 54 | + | let s = fromBase64String(getStringValue(this, l(i, m))) |
---|
| 55 | + | if ((s == g)) |
---|
| 56 | + | then unit |
---|
| 57 | + | else s |
---|
| 58 | + | } |
---|
| 59 | + | |
---|
| 60 | + | |
---|
| 61 | + | @Callable(w) |
---|
| 62 | + | func createOffer (x,y) = { |
---|
| 63 | + | let i = q(a) |
---|
| 64 | + | let z = value(w.payments[0]) |
---|
| 65 | + | if (!(isDefined(z))) |
---|
56 | 66 | | then throw("no payment") |
---|
57 | | - | else [IntegerEntry(g(h), c), StringEntry(i(h), toBase58String(u.caller.bytes)), StringEntry(j(h), v), StringEntry(k(h, 0), toBase58String(valueOrElse(x.assetId, toBytes("WAVES")))), IntegerEntry(m(h, 0), x.amount)] |
---|
| 67 | + | else [IntegerEntry(h(i), c), StringEntry(j(i), toBase58String(w.caller.bytes)), StringEntry(k(i), x), StringEntry(l(i, 0), toBase64String(valueOrElse(z.assetId, g))), IntegerEntry(n(i, 0), z.amount)] |
---|
58 | 68 | | } |
---|
59 | 69 | | |
---|
60 | 70 | | |
---|
61 | 71 | | |
---|
62 | | - | @Callable(u) |
---|
63 | | - | func cancelOffer (h) = { |
---|
64 | | - | let y = p(g(h)) |
---|
65 | | - | if ((y != c)) |
---|
| 72 | + | @Callable(w) |
---|
| 73 | + | func cancelOffer (i) = { |
---|
| 74 | + | let A = q(h(i)) |
---|
| 75 | + | if ((A != c)) |
---|
66 | 76 | | then throw("offer status must be open") |
---|
67 | 77 | | else { |
---|
68 | | - | let z = getStringValue(this, i(h)) |
---|
69 | | - | let A = toBase58String(u.caller.bytes) |
---|
70 | | - | if ((z != A)) |
---|
| 78 | + | let B = getStringValue(this, j(i)) |
---|
| 79 | + | let C = toBase58String(w.caller.bytes) |
---|
| 80 | + | if ((B != C)) |
---|
71 | 81 | | then throw("offer must be made by caller") |
---|
72 | | - | else [IntegerEntry(g(h), d)] |
---|
| 82 | + | else { |
---|
| 83 | + | let D = v(i, 0) |
---|
| 84 | + | let E = q(n(i, 0)) |
---|
| 85 | + | [IntegerEntry(h(i), d), ScriptTransfer(w.caller, E, D)] |
---|
| 86 | + | } |
---|
73 | 87 | | } |
---|
74 | 88 | | } |
---|
75 | 89 | | |
---|
76 | 90 | | |
---|
77 | 91 | | |
---|
78 | | - | @Callable(u) |
---|
79 | | - | func acceptOffer (h) = { |
---|
80 | | - | let y = p(g(h)) |
---|
81 | | - | if ((y != c)) |
---|
| 92 | + | @Callable(w) |
---|
| 93 | + | func acceptOffer (i) = { |
---|
| 94 | + | let A = q(h(i)) |
---|
| 95 | + | if ((A != c)) |
---|
82 | 96 | | then throw("offer status must be open") |
---|
83 | 97 | | else { |
---|
84 | | - | let B = getStringValue(this, j(h)) |
---|
85 | | - | let A = toBase58String(u.caller.bytes) |
---|
86 | | - | if ((B != A)) |
---|
| 98 | + | let F = getStringValue(this, k(i)) |
---|
| 99 | + | let C = toBase58String(w.caller.bytes) |
---|
| 100 | + | if ((F != C)) |
---|
87 | 101 | | then throw("offer must be made to caller") |
---|
88 | | - | else [IntegerEntry(g(h), e)] |
---|
| 102 | + | else [IntegerEntry(h(i), e)] |
---|
89 | 103 | | } |
---|
90 | 104 | | } |
---|
91 | 105 | | |
---|
92 | 106 | | |
---|
93 | 107 | | |
---|
94 | | - | @Callable(u) |
---|
95 | | - | func rejectOffer (h) = { |
---|
96 | | - | let y = p(g(h)) |
---|
97 | | - | if ((y != c)) |
---|
| 108 | + | @Callable(w) |
---|
| 109 | + | func rejectOffer (i) = { |
---|
| 110 | + | let A = q(h(i)) |
---|
| 111 | + | if ((A != c)) |
---|
98 | 112 | | then throw("offer status must be open") |
---|
99 | 113 | | else { |
---|
100 | | - | let B = getStringValue(this, j(h)) |
---|
101 | | - | let A = toBase58String(u.caller.bytes) |
---|
102 | | - | if ((B != A)) |
---|
| 114 | + | let F = getStringValue(this, k(i)) |
---|
| 115 | + | let C = toBase58String(w.caller.bytes) |
---|
| 116 | + | if ((F != C)) |
---|
103 | 117 | | then throw("offer must be made to caller") |
---|
104 | | - | else [IntegerEntry(g(h), f)] |
---|
| 118 | + | else [IntegerEntry(h(i), f)] |
---|
105 | 119 | | } |
---|
106 | 120 | | } |
---|
107 | 121 | | |
---|
108 | 122 | | |
---|