tx · 7bLkhTLYM1UZWF91TKLDp9eJNWr2brhKyuzSUiDwWaZY
3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq: -0.01000000 Waves
2024.03.05 23:57 [3005225] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves
{
"type": 13,
"id": "7bLkhTLYM1UZWF91TKLDp9eJNWr2brhKyuzSUiDwWaZY",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1709672241235,
"version": 2,
"chainId": 84,
"sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq",
"senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf",
"proofs": [
"41hDEWuU1Nxf5i7NUkDhbbABX3Fn4S5hcbH4n6WVYEC7rGKtgekACjbqrtyM2Z89GZQKXoveFfph176MGeimHoNj"
],
"script": "base64:BgIOCAISABIDCgEBEgMKAQgPABBhbW91bnRBc3NldElkS2V5Ag1hbW91bnRBc3NldElkAA9wcmljZUFzc2V0SWRLZXkCDHByaWNlQXNzZXRJZAAKZmVlUmF0ZUtleQIHZmVlUmF0ZQEKZ2V0QXNzZXRJZAENYXNzZXRJZFN0cmluZwMJAAACBQ1hc3NldElkU3RyaW5nAgVXQVZFUwUEdW5pdAkA2QQBBQ1hc3NldElkU3RyaW5nAQ9nZXRBc3NldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCaWQFByRtYXRjaDAJAPAHAgUEdGhpcwUCaWQICQDvBwEFBHRoaXMJYXZhaWxhYmxlABNhbW91bnRBc3NldElkU3RyaW5nCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBRBhbW91bnRBc3NldElkS2V5AA1hbW91bnRBc3NldElkCQEKZ2V0QXNzZXRJZAEFE2Ftb3VudEFzc2V0SWRTdHJpbmcAEnByaWNlQXNzZXRJZFN0cmluZwkBEUB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ZvcgEHYWRkcmVzcwkBDHN3YXBJbnRlcm5hbAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MFAWkAe/KElw==",
"height": 3005225,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 62q9vi4LD3HiJ5WcLB9THCwBaxTnGJojVLAywVhPULra
Next: Dsqx1vYTXVkoXgB9eMjse8rbhQVLaRQWBXzWRvWnPsp
Diff:
Old | New | | Differences |
---|
46 | 46 | | } |
---|
47 | 47 | | |
---|
48 | 48 | | |
---|
49 | | - | func x (y,t) = { |
---|
50 | | - | let z = if ((y == k)) |
---|
| 49 | + | func x (y,t,z) = { |
---|
| 50 | + | let A = if ((y == k)) |
---|
51 | 51 | | then $Tuple2(m, k) |
---|
52 | 52 | | else $Tuple2(k, m) |
---|
53 | | - | let A = z._1 |
---|
54 | | - | let B = z._2 |
---|
55 | | - | let r = f(A) |
---|
56 | | - | let s = f(B) |
---|
57 | | - | let C = q(r, s, t) |
---|
58 | | - | let D = fraction(C, o, n) |
---|
59 | | - | let w = (C - D) |
---|
60 | | - | let E = if ((y == k)) |
---|
| 53 | + | let B = A._1 |
---|
| 54 | + | let C = A._2 |
---|
| 55 | + | let r = f(B) |
---|
| 56 | + | let s = (f(C) - (if (z) |
---|
| 57 | + | then 0 |
---|
| 58 | + | else t)) |
---|
| 59 | + | let D = q(r, s, t) |
---|
| 60 | + | let E = fraction(D, o, n) |
---|
| 61 | + | let w = (D - E) |
---|
| 62 | + | let F = if ((y == k)) |
---|
61 | 63 | | then fraction(w, n, t) |
---|
62 | 64 | | else fraction(t, n, w) |
---|
63 | | - | $Tuple4(w, D, A, E) |
---|
| 65 | + | $Tuple4(w, E, B, F) |
---|
64 | 66 | | } |
---|
65 | 67 | | |
---|
66 | 68 | | |
---|
67 | | - | func F (G,H) = { |
---|
68 | | - | let I = [if ((size(H.payments) > 0)) |
---|
| 69 | + | func G (H,I) = { |
---|
| 70 | + | let J = [if ((size(I.payments) > 0)) |
---|
69 | 71 | | then true |
---|
70 | | - | else throw("should be with 1 payment"), if (containsElement([k, m], H.payments[0].assetId)) |
---|
| 72 | + | else throw("should be with 1 payment"), if (containsElement([k, m], I.payments[0].assetId)) |
---|
71 | 73 | | then true |
---|
72 | 74 | | else throw(makeString(["payment assetId should be", j, "or", l], " "))] |
---|
73 | | - | if ((I == I)) |
---|
| 75 | + | if ((J == J)) |
---|
74 | 76 | | then { |
---|
75 | | - | let y = H.payments[0].assetId |
---|
76 | | - | let t = H.payments[0].amount |
---|
77 | | - | let J = x(y, t) |
---|
78 | | - | let w = J._1 |
---|
79 | | - | let D = J._2 |
---|
80 | | - | let K = J._3 |
---|
81 | | - | let E = J._4 |
---|
82 | | - | let L = if ((D > 0)) |
---|
83 | | - | then [ScriptTransfer(G, w, K)] |
---|
| 77 | + | let y = I.payments[0].assetId |
---|
| 78 | + | let t = I.payments[0].amount |
---|
| 79 | + | let K = x(y, t, false) |
---|
| 80 | + | let w = K._1 |
---|
| 81 | + | let E = K._2 |
---|
| 82 | + | let L = K._3 |
---|
| 83 | + | let F = K._4 |
---|
| 84 | + | let M = if ((E > 0)) |
---|
| 85 | + | then [ScriptTransfer(H, w, L)] |
---|
84 | 86 | | else throw("amount is too low") |
---|
85 | | - | $Tuple2(L, $Tuple4(w, D, K, E)) |
---|
| 87 | + | $Tuple2(M, $Tuple4(w, E, L, F)) |
---|
86 | 88 | | } |
---|
87 | 89 | | else throw("Strict value is not equal to itself.") |
---|
88 | 90 | | } |
---|
89 | 91 | | |
---|
90 | 92 | | |
---|
91 | | - | @Callable(H) |
---|
92 | | - | func swap () = F(H.caller, H) |
---|
| 93 | + | @Callable(I) |
---|
| 94 | + | func swap () = G(I.caller, I) |
---|
93 | 95 | | |
---|
94 | 96 | | |
---|
95 | 97 | | |
---|
96 | | - | @Callable(H) |
---|
97 | | - | func swapNoLess (M) = { |
---|
98 | | - | let N = F(H.caller, H) |
---|
99 | | - | let L = N._1 |
---|
100 | | - | let O = N._2 |
---|
101 | | - | let P = O |
---|
102 | | - | let w = P._1 |
---|
103 | | - | let D = P._2 |
---|
104 | | - | let K = P._3 |
---|
105 | | - | let E = P._4 |
---|
106 | | - | if ((M > w)) |
---|
107 | | - | then throw(makeString(["Price slipped. minAmount: ", toString(M), " swapAmount: ", toString(w)], "")) |
---|
108 | | - | else $Tuple2(L, O) |
---|
| 98 | + | @Callable(I) |
---|
| 99 | + | func swapNoLess (N) = { |
---|
| 100 | + | let O = G(I.caller, I) |
---|
| 101 | + | let M = O._1 |
---|
| 102 | + | let P = O._2 |
---|
| 103 | + | let Q = P |
---|
| 104 | + | let w = Q._1 |
---|
| 105 | + | let E = Q._2 |
---|
| 106 | + | let L = Q._3 |
---|
| 107 | + | let F = Q._4 |
---|
| 108 | + | if ((N > w)) |
---|
| 109 | + | then throw(makeString(["Price slipped. minAmount: ", toString(N), " swapAmount: ", toString(w)], "")) |
---|
| 110 | + | else $Tuple2(M, P) |
---|
109 | 111 | | } |
---|
110 | 112 | | |
---|
111 | 113 | | |
---|
112 | 114 | | |
---|
113 | | - | @Callable(H) |
---|
114 | | - | func swapFor (G) = F(addressFromStringValue(G), H) |
---|
| 115 | + | @Callable(I) |
---|
| 116 | + | func swapFor (H) = G(addressFromStringValue(H), I) |
---|
115 | 117 | | |
---|
116 | 118 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = "amountAssetId" |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "priceAssetId" |
---|
7 | 7 | | |
---|
8 | 8 | | let c = "feeRate" |
---|
9 | 9 | | |
---|
10 | 10 | | func d (e) = if ((e == "WAVES")) |
---|
11 | 11 | | then unit |
---|
12 | 12 | | else fromBase58String(e) |
---|
13 | 13 | | |
---|
14 | 14 | | |
---|
15 | 15 | | func f (g) = { |
---|
16 | 16 | | let h = g |
---|
17 | 17 | | if ($isInstanceOf(h, "ByteVector")) |
---|
18 | 18 | | then { |
---|
19 | 19 | | let i = h |
---|
20 | 20 | | assetBalance(this, i) |
---|
21 | 21 | | } |
---|
22 | 22 | | else wavesBalance(this).available |
---|
23 | 23 | | } |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | let j = getStringValue(this, a) |
---|
27 | 27 | | |
---|
28 | 28 | | let k = d(j) |
---|
29 | 29 | | |
---|
30 | 30 | | let l = getStringValue(this, b) |
---|
31 | 31 | | |
---|
32 | 32 | | let m = d(l) |
---|
33 | 33 | | |
---|
34 | 34 | | let n = 100000000 |
---|
35 | 35 | | |
---|
36 | 36 | | let o = valueOrElse(getInteger(this, c), 200000) |
---|
37 | 37 | | |
---|
38 | 38 | | func p () = fraction(f(m), n, f(k)) |
---|
39 | 39 | | |
---|
40 | 40 | | |
---|
41 | 41 | | func q (r,s,t) = { |
---|
42 | 42 | | let u = (s + t) |
---|
43 | 43 | | let v = fraction(r, s, u) |
---|
44 | 44 | | let w = (r - v) |
---|
45 | 45 | | w |
---|
46 | 46 | | } |
---|
47 | 47 | | |
---|
48 | 48 | | |
---|
49 | | - | func x (y,t) = { |
---|
50 | | - | let z = if ((y == k)) |
---|
| 49 | + | func x (y,t,z) = { |
---|
| 50 | + | let A = if ((y == k)) |
---|
51 | 51 | | then $Tuple2(m, k) |
---|
52 | 52 | | else $Tuple2(k, m) |
---|
53 | | - | let A = z._1 |
---|
54 | | - | let B = z._2 |
---|
55 | | - | let r = f(A) |
---|
56 | | - | let s = f(B) |
---|
57 | | - | let C = q(r, s, t) |
---|
58 | | - | let D = fraction(C, o, n) |
---|
59 | | - | let w = (C - D) |
---|
60 | | - | let E = if ((y == k)) |
---|
| 53 | + | let B = A._1 |
---|
| 54 | + | let C = A._2 |
---|
| 55 | + | let r = f(B) |
---|
| 56 | + | let s = (f(C) - (if (z) |
---|
| 57 | + | then 0 |
---|
| 58 | + | else t)) |
---|
| 59 | + | let D = q(r, s, t) |
---|
| 60 | + | let E = fraction(D, o, n) |
---|
| 61 | + | let w = (D - E) |
---|
| 62 | + | let F = if ((y == k)) |
---|
61 | 63 | | then fraction(w, n, t) |
---|
62 | 64 | | else fraction(t, n, w) |
---|
63 | | - | $Tuple4(w, D, A, E) |
---|
| 65 | + | $Tuple4(w, E, B, F) |
---|
64 | 66 | | } |
---|
65 | 67 | | |
---|
66 | 68 | | |
---|
67 | | - | func F (G,H) = { |
---|
68 | | - | let I = [if ((size(H.payments) > 0)) |
---|
| 69 | + | func G (H,I) = { |
---|
| 70 | + | let J = [if ((size(I.payments) > 0)) |
---|
69 | 71 | | then true |
---|
70 | | - | else throw("should be with 1 payment"), if (containsElement([k, m], H.payments[0].assetId)) |
---|
| 72 | + | else throw("should be with 1 payment"), if (containsElement([k, m], I.payments[0].assetId)) |
---|
71 | 73 | | then true |
---|
72 | 74 | | else throw(makeString(["payment assetId should be", j, "or", l], " "))] |
---|
73 | | - | if ((I == I)) |
---|
| 75 | + | if ((J == J)) |
---|
74 | 76 | | then { |
---|
75 | | - | let y = H.payments[0].assetId |
---|
76 | | - | let t = H.payments[0].amount |
---|
77 | | - | let J = x(y, t) |
---|
78 | | - | let w = J._1 |
---|
79 | | - | let D = J._2 |
---|
80 | | - | let K = J._3 |
---|
81 | | - | let E = J._4 |
---|
82 | | - | let L = if ((D > 0)) |
---|
83 | | - | then [ScriptTransfer(G, w, K)] |
---|
| 77 | + | let y = I.payments[0].assetId |
---|
| 78 | + | let t = I.payments[0].amount |
---|
| 79 | + | let K = x(y, t, false) |
---|
| 80 | + | let w = K._1 |
---|
| 81 | + | let E = K._2 |
---|
| 82 | + | let L = K._3 |
---|
| 83 | + | let F = K._4 |
---|
| 84 | + | let M = if ((E > 0)) |
---|
| 85 | + | then [ScriptTransfer(H, w, L)] |
---|
84 | 86 | | else throw("amount is too low") |
---|
85 | | - | $Tuple2(L, $Tuple4(w, D, K, E)) |
---|
| 87 | + | $Tuple2(M, $Tuple4(w, E, L, F)) |
---|
86 | 88 | | } |
---|
87 | 89 | | else throw("Strict value is not equal to itself.") |
---|
88 | 90 | | } |
---|
89 | 91 | | |
---|
90 | 92 | | |
---|
91 | | - | @Callable(H) |
---|
92 | | - | func swap () = F(H.caller, H) |
---|
| 93 | + | @Callable(I) |
---|
| 94 | + | func swap () = G(I.caller, I) |
---|
93 | 95 | | |
---|
94 | 96 | | |
---|
95 | 97 | | |
---|
96 | | - | @Callable(H) |
---|
97 | | - | func swapNoLess (M) = { |
---|
98 | | - | let N = F(H.caller, H) |
---|
99 | | - | let L = N._1 |
---|
100 | | - | let O = N._2 |
---|
101 | | - | let P = O |
---|
102 | | - | let w = P._1 |
---|
103 | | - | let D = P._2 |
---|
104 | | - | let K = P._3 |
---|
105 | | - | let E = P._4 |
---|
106 | | - | if ((M > w)) |
---|
107 | | - | then throw(makeString(["Price slipped. minAmount: ", toString(M), " swapAmount: ", toString(w)], "")) |
---|
108 | | - | else $Tuple2(L, O) |
---|
| 98 | + | @Callable(I) |
---|
| 99 | + | func swapNoLess (N) = { |
---|
| 100 | + | let O = G(I.caller, I) |
---|
| 101 | + | let M = O._1 |
---|
| 102 | + | let P = O._2 |
---|
| 103 | + | let Q = P |
---|
| 104 | + | let w = Q._1 |
---|
| 105 | + | let E = Q._2 |
---|
| 106 | + | let L = Q._3 |
---|
| 107 | + | let F = Q._4 |
---|
| 108 | + | if ((N > w)) |
---|
| 109 | + | then throw(makeString(["Price slipped. minAmount: ", toString(N), " swapAmount: ", toString(w)], "")) |
---|
| 110 | + | else $Tuple2(M, P) |
---|
109 | 111 | | } |
---|
110 | 112 | | |
---|
111 | 113 | | |
---|
112 | 114 | | |
---|
113 | | - | @Callable(H) |
---|
114 | | - | func swapFor (G) = F(addressFromStringValue(G), H) |
---|
| 115 | + | @Callable(I) |
---|
| 116 | + | func swapFor (H) = G(addressFromStringValue(H), I) |
---|
115 | 117 | | |
---|
116 | 118 | | |
---|