tx · 41L72vHuLQ6A8Z5AZHVeSXVBLSp1X1MxLXrpWVPswSFF

3MtjjEoEs6Rcqkh8tYjPmBxZND58FuMtRWN:  -0.05000000 Waves

2022.09.07 00:35 [2217811] smart account 3MtjjEoEs6Rcqkh8tYjPmBxZND58FuMtRWN > SELF 0.00000000 Waves

{ "type": 13, "id": "41L72vHuLQ6A8Z5AZHVeSXVBLSp1X1MxLXrpWVPswSFF", "fee": 5000000, "feeAssetId": null, "timestamp": 1662500166880, "version": 2, "chainId": 84, "sender": "3MtjjEoEs6Rcqkh8tYjPmBxZND58FuMtRWN", "senderPublicKey": "GR35NTmt1JUgBMwuwSK6aFSmLN7g6eZKbYvfSV3ThdWR", "proofs": [ "3sj6Hg1JTTSGTDbrLb2G51KASMdazbscrrcjacvXXTRzAaHugyLV94NeMcGEA57ijDA9aGG14y6BuL8ZKBcHXNaE" ], "script": "base64:AAIFAAAAAAAAABIIAhIECgIIARIDCgEIEgMKAQgAAAAEAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAAAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAADmdldEFzc2V0U3RyaW5nAAAAAQAAAAdhc3NldElkBAAAAAckbWF0Y2gwBQAAAAdhc3NldElkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFiBQAAAAckbWF0Y2gwCQACWAAAAAEFAAAAAWICAAAABVdBVkVTAQAAAA1nZXRBc3NldEJ5dGVzAAAAAQAAA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YyKQAAAAEFAAAACm9yZGVyT3duZXIFAAAAEG9yZGVyQW1vdW50MExlZnQJAQAAAA1nZXRBc3NldEJ5dGVzAAAAAQUAAAALb3JkZXJBc3NldDAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAABm9yZGVyXwUAAAAHb3JkZXJJZAIAAAAHX3N0YXR1cwIAAAAIY2FuY2VsZWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V54W7cDA==", "height": 2217811, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 7uGWx3sRs8RYca7CtvSaHUeoDb9LyQSh5w1dEWYP9Eif Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+func a (b) = {
5+ let c = getString(this, b)
6+ if ($isInstanceOf(c, "String"))
7+ then {
8+ let d = c
9+ d
10+ }
11+ else ""
12+ }
13+
14+
15+func e (b) = {
16+ let c = getInteger(this, b)
17+ if ($isInstanceOf(c, "Int"))
18+ then {
19+ let d = c
20+ d
21+ }
22+ else 0
23+ }
24+
25+
26+func f (g) = {
27+ let c = g
28+ if ($isInstanceOf(c, "ByteVector"))
29+ then {
30+ let d = c
31+ toBase58String(d)
32+ }
33+ else "WAVES"
34+ }
35+
36+
37+func h (i) = if ((i == "WAVES"))
38+ then unit
39+ else fromBase58String(i)
40+
41+
42+@Callable(j)
43+func createOrder (k,l) = {
44+ let m = (e("global_ordersAmount") + 1)
45+ let n = toString(m)
46+ if ((size(j.payments) != 1))
47+ then throw("You should to provide payment")
48+ else if ((0 >= l))
49+ then throw("Amount1 cannot be less or equals 0")
50+ else {
51+ let o = f(j.payments[0].assetId)
52+ let p = j.payments[0].amount
53+ let q = a((("user_" + toString(j.caller)) + "_orders"))
54+ let r = {
55+ let c = q
56+ if (("" == c))
57+ then n
58+ else ((q + ",") + n)
59+ }
60+[IntegerEntry("global_ordersAmount", m), StringEntry((("order_" + n) + "_token0"), o), IntegerEntry((("order_" + n) + "_amount0"), p), IntegerEntry((("order_" + n) + "_amount1"), l), StringEntry((("order_" + n) + "_token1"), k), IntegerEntry((("order_" + n) + "_fulfilled0"), 0), IntegerEntry((("order_" + n) + "_fulfilled1"), 0), StringEntry((("order_" + n) + "_owner"), toString(j.caller)), StringEntry((("order_" + n) + "_status"), "active"), StringEntry((("user_" + toString(j.caller)) + "_orders"), r)]
61+ }
62+ }
63+
64+
65+
66+@Callable(j)
67+func fulfillOrder (n) = {
68+ let s = valueOrErrorMessage(getString((("order_" + n) + "_owner")), "Cannot find order owner")
69+ let t = getString((("order_" + n) + "_status"))
70+ let u = valueOrErrorMessage(getString((("order_" + n) + "_token0")), "Cannot find token0")
71+ let v = valueOrErrorMessage(getInteger((("order_" + n) + "_amount0")), "Cannot find amount0")
72+ let w = valueOrErrorMessage(getInteger((("order_" + n) + "_fulfilled0")), "Cannot find fulfilled0")
73+ let x = (v - w)
74+ let y = valueOrErrorMessage(getString((("order_" + n) + "_token1")), "Cannot find token1")
75+ let z = valueOrErrorMessage(getInteger((("order_" + n) + "_amount1")), "Cannot find amount1")
76+ let A = valueOrErrorMessage(getInteger((("order_" + n) + "_fulfilled1")), "Cannot find fulfilled1")
77+ let B = (z - A)
78+ if ((t != "active"))
79+ then throw("Order already closed or canceled")
80+ else if ((size(j.payments) != 1))
81+ then throw("You should to provide payment")
82+ else {
83+ let C = j.caller
84+ let D = addressFromStringValue(s)
85+ let E = f(j.payments[0].assetId)
86+ let F = j.payments[0].amount
87+ if ((E != y))
88+ then throw("Wrong payment asset")
89+ else if ((F >= B))
90+ then [ScriptTransfer(C, (F - B), h(y)), ScriptTransfer(C, x, h(u)), ScriptTransfer(D, B, h(E)), IntegerEntry((("order_" + n) + "_fulfilled0"), (w + x)), IntegerEntry((("order_" + n) + "_fulfilled1"), (A + B)), StringEntry((("order_" + n) + "_status"), "closed")]
91+ else {
92+ let p = fraction(v, F, z, FLOOR)
93+[ScriptTransfer(D, F, h(E)), ScriptTransfer(C, p, h(u)), IntegerEntry((("order_" + n) + "_fulfilled0"), (w + p)), IntegerEntry((("order_" + n) + "_fulfilled1"), (A + F))]
94+ }
95+ }
96+ }
97+
98+
99+
100+@Callable(j)
101+func cancelOrder (n) = {
102+ let s = valueOrErrorMessage(getString((("order_" + n) + "_owner")), "Cannot find order owner")
103+ let t = getString((("order_" + n) + "_status"))
104+ let u = valueOrErrorMessage(getString((("order_" + n) + "_token0")), "Cannot find token0")
105+ let v = valueOrErrorMessage(getInteger((("order_" + n) + "_amount0")), "Cannot find amount0")
106+ let w = valueOrErrorMessage(getInteger((("order_" + n) + "_fulfilled0")), "Cannot find fulfilled0")
107+ let x = (v - w)
108+ if ((toBase58String(j.caller.bytes) != s))
109+ then throw("You cannot cancel order")
110+ else if ((t != "active"))
111+ then throw("order is closed or canceled")
112+ else [ScriptTransfer(addressFromStringValue(s), x, h(u)), StringEntry((("order_" + n) + "_status"), "canceled")]
113+ }
114+
115+
116+@Verifier(G)
117+func H () = sigVerify(G.bodyBytes, G.proofs[0], G.senderPublicKey)
118+

github/deemru/w8io/026f985 
30.51 ms