tx · FsxsWNHLDenjoguS3T1wJwoGzsEwTodGV1C9idxeu8qf 3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta: -0.01000000 Waves 2023.12.01 18:20 [2867749] smart account 3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta > SELF 0.00000000 Waves
{ "type": 13, "id": "FsxsWNHLDenjoguS3T1wJwoGzsEwTodGV1C9idxeu8qf", "fee": 1000000, "feeAssetId": null, "timestamp": 1701444059452, "version": 2, "chainId": 84, "sender": "3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta", "senderPublicKey": "4rSYGN3SSXzknh6jLyLqqGdGor584DXdjdP2BAbz7kgt", "proofs": [ "47ZSZCYx5aViwtdULTPvgSrHcfVAem6GghiyvXJ6vC6a61kR88NG2P9uk2et7X4K9x54oPcz5vbTkYiM7p6cjo33" ], "script": "base64:AAIFAAAAAAAAABcIAhIGCgQIAQgBEgMKAQgSBgoECAgBAQAAAAsAAAAACWRldmVsb3BlcgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM1A5bVRDcEJ0dUF6TWtIb2RiNFh3Z1g0ektZQWNoMnBnd2EBAAAACmtleVBhcnRuZXIAAAABAAAAB2FkZHJlc3MJAAEsAAAAAgIAAAAPJXMlc19fcGFydG5lcl9fBQAAAAdhZGRyZXNzAQAAABBrZXlXYW50ZWRBc3NldElkAAAAAQAAAAdhZGRyZXNzCQABLAAAAAICAAAAFSVzJXNfX3dhbnRlZEFzc2V0SWRfXwUAAAAHYWRkcmVzcwEAAAAPa2V5V2FudGVkQW1vdW50AAAAAQAAAAdhZGRyZXNzCQABLAAAAAICAAAAFCVzJXNfX3dhbnRlZEFtb3VudF9fBQAAAAdhZGRyZXNzAQAAAAprZXlBc3NldElkAAAAAQAAAAdvcmRlcklkCQABLAAAAAICAAAADyVzJXNfX2Fzc2V0SWRfXwUAAAAHb3JkZXJJZAEAAAAJa2V5QW1vdW50AAAAAQAAAAdvcmRlcklkCQABLAAA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AARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAdhZGRyZXNzBQAAAAZhbW91bnQFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAApyZXN0QW1vdW50BQAAAAdhc3NldElkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAA1rZXlTZXJ2aWNlRmVlAAAAAQUAAAAHb3JkZXJJZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAJa2V5QW1vdW50AAAAAQUAAAAHb3JkZXJJZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAKa2V5T3JkZXJJZAAAAAEFAAAAB29yZGVySWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAACmtleUFzc2V0SWQAAAABBQAAAAdvcmRlcklkBQAAAANuaWwJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAHYWRkcmVzcwUAAAAGYW1vdW50BQAAAAdhc3NldElkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAAlrZXlBbW91bnQAAAABBQAAAAdvcmRlcklkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAJa2V5QW1vdW50AAAAAQUAAAAHb3JkZXJJZAUAAAAKcmVzdEFtb3VudAUAAAADbmlsAAAAAEQ5NbE=", "height": 2867749, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EPm2tt48aCwdS6tqKXadRcRCaUZvxXB8BUAkW5yQ3sdZ Next: Ga8M349XXYJwVGRnNtEXPgEaWq8czAHxyAhe7RPiUJVi Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func a (b) = ("%s%s__assetId__" + b) | |
4 | + | let a = addressFromStringValue("3P9mTCpBtuAzMkHodb4XwgX4zKYAch2pgwa") | |
5 | + | ||
6 | + | func b (c) = ("%s%s__partner__" + c) | |
5 | 7 | ||
6 | 8 | ||
7 | - | func | |
9 | + | func d (c) = ("%s%s__wantedAssetId__" + c) | |
8 | 10 | ||
9 | 11 | ||
10 | - | func | |
12 | + | func e (c) = ("%s%s__wantedAmount__" + c) | |
11 | 13 | ||
12 | 14 | ||
13 | - | func | |
15 | + | func f (g) = ("%s%s__assetId__" + g) | |
14 | 16 | ||
15 | 17 | ||
16 | - | func | |
18 | + | func h (g) = ("%s%s__amount__" + g) | |
17 | 19 | ||
18 | 20 | ||
19 | - | func g (h) = if ((h == unit)) | |
20 | - | then "WAVES" | |
21 | - | else toBase58String(value(h)) | |
21 | + | func i (g) = ("%s%s__orderId__" + g) | |
22 | 22 | ||
23 | 23 | ||
24 | - | func i (j) = if ((j == "WAVES")) | |
25 | - | then unit | |
26 | - | else fromBase58String(j) | |
24 | + | func j (g) = ("%s%s__serviceFee__" + g) | |
27 | 25 | ||
28 | 26 | ||
29 | - | func k (l,m,n,o,p) = if (if ((o != n)) | |
30 | - | then true | |
31 | - | else (p != m)) | |
32 | - | then throw(((((((((("AssetIds don't match: you want " + n) + " and pay ") + m) + ", but ") + l) + " wants ") + p) + " and pays ") + o)) | |
33 | - | else true | |
27 | + | func k (l) = if ((l == unit)) | |
28 | + | then "WAVES" | |
29 | + | else toBase58String(value(l)) | |
34 | 30 | ||
35 | 31 | ||
36 | - | func q (l,r,s,t,u) = if (if ((t != s)) | |
37 | - | then true | |
38 | - | else (u != r)) | |
39 | - | then throw(((((((((("Amounts don't match: you want " + toString(s)) + " and pay ") + toString(r)) + ", but ") + l) + " wants ") + toString(u)) + " and pays ") + toString(t))) | |
40 | - | else true | |
32 | + | func m (n) = if ((n == "WAVES")) | |
33 | + | then unit | |
34 | + | else fromBase58String(n) | |
41 | 35 | ||
42 | 36 | ||
43 | - | func | |
44 | - | let | |
45 | - | if (if (( | |
46 | - | then (assetInfo(value( | |
37 | + | func o (l) = { | |
38 | + | let p = m(l) | |
39 | + | if (if ((p != unit)) | |
40 | + | then (assetInfo(value(p)) == unit) | |
47 | 41 | else false) | |
48 | - | then throw("Invalid | |
49 | - | else | |
42 | + | then throw("Invalid assetId: assetInfo missing") | |
43 | + | else k(p) | |
50 | 44 | } | |
51 | 45 | ||
52 | 46 | ||
53 | - | @Callable(y) | |
54 | - | func escrow (w,z,l) = { | |
55 | - | let A = toString(y.caller) | |
56 | - | if (isDefined(getString(this, a(A)))) | |
57 | - | then throw("You already have an active deal, please cancel it first") | |
58 | - | else if ((size(y.payments) != 1)) | |
59 | - | then throw("Exactly 1 payment expected") | |
60 | - | else { | |
61 | - | let B = addressFromStringValue(l) | |
62 | - | if ((B == B)) | |
63 | - | then { | |
64 | - | let C = v(w) | |
65 | - | if ((0 >= z)) | |
66 | - | then throw("Non-positive wantAmount") | |
67 | - | else { | |
68 | - | let D = getString(this, a(l)) | |
69 | - | let E = value(y.payments[0]).assetId | |
70 | - | let F = value(y.payments[0]).amount | |
71 | - | if (isDefined(D)) | |
72 | - | then if ((value(getString(this, d(l))) != A)) | |
73 | - | then throw(("You are not a partner of " + l)) | |
74 | - | else { | |
75 | - | let G = if (k(l, g(E), C, value(D), value(getString(this, e(l))))) | |
76 | - | then q(l, F, z, value(getInteger(this, c(l))), value(getInteger(this, f(l)))) | |
77 | - | else false | |
78 | - | if ((G == G)) | |
79 | - | then [ScriptTransfer(B, F, E), ScriptTransfer(y.caller, z, i(C)), DeleteEntry(a(l)), DeleteEntry(c(l)), DeleteEntry(d(l)), DeleteEntry(e(l)), DeleteEntry(f(l))] | |
80 | - | else throw("Strict value is not equal to itself.") | |
81 | - | } | |
82 | - | else [StringEntry(a(A), g(E)), IntegerEntry(c(A), F), StringEntry(d(A), l), StringEntry(e(A), C), IntegerEntry(f(A), z)] | |
83 | - | } | |
84 | - | } | |
85 | - | else throw("Strict value is not equal to itself.") | |
86 | - | } | |
87 | - | } | |
47 | + | @Callable(q) | |
48 | + | func escrow (g,r,l,s) = if (isDefined(getString(this, i(g)))) | |
49 | + | then throw(("You already have an order with this id: " + g)) | |
50 | + | else if ((0 >= r)) | |
51 | + | then throw("Non-positive order amount") | |
52 | + | else [IntegerEntry(j(g), s), IntegerEntry(h(g), r), StringEntry(i(g), g), StringEntry(f(g), l)] | |
88 | 53 | ||
89 | 54 | ||
90 | 55 | ||
91 | - | @Callable(y) | |
92 | - | func cancel () = { | |
93 | - | let A = toString(y.caller) | |
94 | - | let H = a(A) | |
95 | - | let I = getString(this, H) | |
96 | - | if (!(isDefined(I))) | |
97 | - | then throw("You don't have an active deal") | |
56 | + | @Callable(q) | |
57 | + | func cancel (g) = if (!(isDefined(i(g)))) | |
58 | + | then throw(("You don't have an order with this id: " + g)) | |
59 | + | else { | |
60 | + | let l = toBytes(value(f(g))) | |
61 | + | let t = toBytes(value(h(g))) | |
62 | + | [ScriptTransfer(q.caller, toInt(t), l), DeleteEntry(j(g)), DeleteEntry(h(g)), DeleteEntry(i(g)), DeleteEntry(f(g))] | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(q) | |
68 | + | func deal (g,c,r,u) = if (!(isDefined(i(g)))) | |
69 | + | then throw(("You don't have an order with this id: " + g)) | |
70 | + | else if ((r > toInt(toBytes(value(h(g)))))) | |
71 | + | then throw("The transaction cannot be executed because the seller does not have enough funds") | |
98 | 72 | else { | |
99 | - | let j = value(I) | |
100 | - | [ScriptTransfer(y.caller, value(getInteger(this, c(A))), i(j)), DeleteEntry(H), DeleteEntry(c(A)), DeleteEntry(d(A)), DeleteEntry(e(A)), DeleteEntry(f(A))] | |
73 | + | let t = (toInt(toBytes(value(h(g)))) - r) | |
74 | + | let l = toBytes(value(f(g))) | |
75 | + | if ((u > t)) | |
76 | + | then [ScriptTransfer(addressFromStringValue(c), r, l), ScriptTransfer(q.caller, t, l), DeleteEntry(j(g)), DeleteEntry(h(g)), DeleteEntry(i(g)), DeleteEntry(f(g))] | |
77 | + | else [ScriptTransfer(addressFromStringValue(c), r, l), DeleteEntry(h(g)), IntegerEntry(h(g), t)] | |
101 | 78 | } | |
102 | - | } | |
103 | 79 | ||
104 | 80 |
github/deemru/w8io/169f3d6 39.27 ms ◑