tx · 84HimeExGbNgyFFNkU9A4yjPrvhocm7dgrGYy3yxz3vb
3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq: -0.01000000 Waves
2024.03.04 12:50 [3003098] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves
{
"type": 13,
"id": "84HimeExGbNgyFFNkU9A4yjPrvhocm7dgrGYy3yxz3vb",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1709545848145,
"version": 2,
"chainId": 84,
"sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq",
"senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf",
"proofs": [
"5weY6zttZekUUD8rUUuaL1BUstuziaGZHy8QueDs4ZKqvc4fwKR8ZZx21Av9qJtxpAFtWJGMMmLi3WoJgWffyC2"
],
"script": "base64:BgIJCAISABIDCgEIEAAQYW1vdW50QXNzZXRJZEtleQINYW1vdW50QXNzZXRJZAAPcHJpY2VBc3NldElkS2V5AgxwcmljZUFzc2V0SWQACmZlZVJhdGVLZXkCB2ZlZVJhdGUBCmdldEFzc2V0SWQBDWFzc2V0SWRTdHJpbmcDCQAAAgUNYXNzZXRJZFN0cmluZwIFV0FWRVMFBHVuaXQJANkEAQUNYXNzZXRJZFN0cmluZwEPZ2V0QXNzZXRCYWxhbmNlAQdhc3NldElkBAckbWF0Y2gwBQdhc3NldElkAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAmlkBQckbWF0Y2gwCQDwBwIFBHRoaXMFAmlkCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQATYW1vdW50QXNzZXRJZFN0cmluZwkBEUBleHRyTmF0aXZlKDEwNTMpAgUEdGhpcwUQYW1vdW50QXNzZXRJZEtleQANYW1vdW50QXNzZXRJZAkBCmdldEFzc2V0SWQBBRNhbW91bnRBc3NldElkU3RyaW5nABJhbW91bnRBc3NldEJhbGFuY2UJAQ9nZXRBc3NldEJhbGFu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gyNTkxAl8xBAlmZWVBbW91bnQIBQskdDAyNDg4MjU5MQJfMgQLc2VuZEFzc2V0SWQIBQskdDAyNDg4MjU5MQJfMwQNdXNlclJlYWxQcmljZQgFCyR0MDI0ODgyNTkxAl80BAtzZW5kQWN0aW9ucwMJAQIhPQIFCWZlZUFtb3VudAAACQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFB2FkZHJlc3MFCnNlbmRBbW91bnQFC3NlbmRBc3NldElkBQNuaWwJAAIBAhFhbW91bnQgaXMgdG9vIGxvdwkAlAoCBQtzZW5kQWN0aW9ucwkAlgoEBQpzZW5kQW1vdW50BQlmZWVBbW91bnQFC3NlbmRBc3NldElkBQ11c2VyUmVhbFByaWNlCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAgFpAQRzd2FwAAkBDHN3YXBJbnRlcm5hbAIIBQFpBmNhbGxlcgUBaQFpAQdzd2FwRm9yAQdhZGRyZXNzCQEMc3dhcEludGVybmFsAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUHYWRkcmVzcwUBaQBLIh4h",
"height": 3003098,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6KYVAw5XzxsofqQhM5rsfFRR6im2PGwTENNmbNiZmJiA
Next: 33HXGRTLEydx9ES2EZ4HPKc3u7QdfMKTFKGnGxDSqMfc
Diff:
Old | New | | Differences |
---|
43 | 43 | | let v = (t + u) |
---|
44 | 44 | | let w = fraction(s, t, v) |
---|
45 | 45 | | let x = (s - w) |
---|
46 | | - | let y = (w * v) |
---|
47 | | - | let z = (s * t) |
---|
48 | | - | $Tuple7(x, s, t, z, w, v, y) |
---|
49 | | - | } |
---|
50 | | - | |
---|
51 | | - | |
---|
52 | | - | func A (B,C,u) = { |
---|
53 | | - | let D = r(B, C, u) |
---|
54 | | - | let x = D._1 |
---|
55 | | - | let s = D._2 |
---|
56 | | - | let t = D._3 |
---|
57 | | - | let z = D._4 |
---|
58 | | - | let w = D._5 |
---|
59 | | - | let v = D._6 |
---|
60 | | - | let y = D._7 |
---|
61 | 46 | | x |
---|
62 | 47 | | } |
---|
63 | 48 | | |
---|
64 | 49 | | |
---|
65 | | - | func E (F,u) = { |
---|
66 | | - | let G = if ((F == k)) |
---|
| 50 | + | func y (z,u) = { |
---|
| 51 | + | let A = if ((z == k)) |
---|
67 | 52 | | then $Tuple2(n, k) |
---|
68 | 53 | | else $Tuple2(k, n) |
---|
69 | | - | let H = G._1 |
---|
70 | | - | let I = G._2 |
---|
71 | | - | let s = f(H) |
---|
72 | | - | let t = (f(I) - u) |
---|
73 | | - | let J = A(s, t, u) |
---|
74 | | - | let K = fraction(J, q, p) |
---|
75 | | - | let x = (J - K) |
---|
76 | | - | let L = if ((F == k)) |
---|
| 54 | + | let B = A._1 |
---|
| 55 | + | let C = A._2 |
---|
| 56 | + | let s = f(B) |
---|
| 57 | + | let t = (f(C) - u) |
---|
| 58 | + | let D = r(s, t, u) |
---|
| 59 | + | let E = fraction(D, q, p) |
---|
| 60 | + | let x = (D - E) |
---|
| 61 | + | let F = if ((z == k)) |
---|
77 | 62 | | then fraction(x, p, u) |
---|
78 | 63 | | else fraction(u, p, x) |
---|
79 | | - | $Tuple4(x, K, H, L) |
---|
| 64 | + | $Tuple4(x, E, B, F) |
---|
80 | 65 | | } |
---|
81 | 66 | | |
---|
82 | 67 | | |
---|
83 | | - | func M (N,O) = { |
---|
84 | | - | let P = [if ((size(O.payments) > 0)) |
---|
| 68 | + | func G (H,I) = { |
---|
| 69 | + | let J = [if ((size(I.payments) > 0)) |
---|
85 | 70 | | then true |
---|
86 | | - | else throw("should be with 1 payment"), if (if ((O.payments[0].assetId == k)) |
---|
| 71 | + | else throw("should be with 1 payment"), if (if ((I.payments[0].assetId == k)) |
---|
87 | 72 | | then true |
---|
88 | | - | else (O.payments[0].assetId == n)) |
---|
| 73 | + | else (I.payments[0].assetId == n)) |
---|
89 | 74 | | then true |
---|
90 | 75 | | else throw(makeString(["payment assetId should be (", j, ") or (", m, ")"], " "))] |
---|
91 | | - | if ((P == P)) |
---|
| 76 | + | if ((J == J)) |
---|
92 | 77 | | then { |
---|
93 | | - | let F = O.payments[0].assetId |
---|
94 | | - | let u = O.payments[0].amount |
---|
95 | | - | let Q = E(F, u) |
---|
96 | | - | let x = Q._1 |
---|
97 | | - | let K = Q._2 |
---|
98 | | - | let R = Q._3 |
---|
99 | | - | let L = Q._4 |
---|
100 | | - | let S = if ((K != 0)) |
---|
101 | | - | then [ScriptTransfer(N, x, R)] |
---|
| 78 | + | let z = I.payments[0].assetId |
---|
| 79 | + | let u = I.payments[0].amount |
---|
| 80 | + | let K = y(z, u) |
---|
| 81 | + | let x = K._1 |
---|
| 82 | + | let E = K._2 |
---|
| 83 | + | let L = K._3 |
---|
| 84 | + | let F = K._4 |
---|
| 85 | + | let M = if ((E != 0)) |
---|
| 86 | + | then [ScriptTransfer(H, x, L)] |
---|
102 | 87 | | else throw("amount is too low") |
---|
103 | | - | $Tuple2(S, $Tuple4(x, K, R, L)) |
---|
| 88 | + | $Tuple2(M, $Tuple4(x, E, L, F)) |
---|
104 | 89 | | } |
---|
105 | 90 | | else throw("Strict value is not equal to itself.") |
---|
106 | 91 | | } |
---|
107 | 92 | | |
---|
108 | 93 | | |
---|
109 | | - | @Callable(O) |
---|
110 | | - | func swap () = M(O.caller, O) |
---|
| 94 | + | @Callable(I) |
---|
| 95 | + | func swap () = G(I.caller, I) |
---|
111 | 96 | | |
---|
112 | 97 | | |
---|
113 | 98 | | |
---|
114 | | - | @Callable(O) |
---|
115 | | - | func swapFor (N) = M(addressFromStringValue(N), O) |
---|
| 99 | + | @Callable(I) |
---|
| 100 | + | func swapFor (H) = G(addressFromStringValue(H), I) |
---|
116 | 101 | | |
---|
117 | 102 | | |
---|
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 = f(k) |
---|
31 | 31 | | |
---|
32 | 32 | | let m = getStringValue(this, b) |
---|
33 | 33 | | |
---|
34 | 34 | | let n = d(m) |
---|
35 | 35 | | |
---|
36 | 36 | | let o = f(n) |
---|
37 | 37 | | |
---|
38 | 38 | | let p = 100000000 |
---|
39 | 39 | | |
---|
40 | 40 | | let q = valueOrElse(getInteger(this, c), 1000000) |
---|
41 | 41 | | |
---|
42 | 42 | | func r (s,t,u) = { |
---|
43 | 43 | | let v = (t + u) |
---|
44 | 44 | | let w = fraction(s, t, v) |
---|
45 | 45 | | let x = (s - w) |
---|
46 | | - | let y = (w * v) |
---|
47 | | - | let z = (s * t) |
---|
48 | | - | $Tuple7(x, s, t, z, w, v, y) |
---|
49 | | - | } |
---|
50 | | - | |
---|
51 | | - | |
---|
52 | | - | func A (B,C,u) = { |
---|
53 | | - | let D = r(B, C, u) |
---|
54 | | - | let x = D._1 |
---|
55 | | - | let s = D._2 |
---|
56 | | - | let t = D._3 |
---|
57 | | - | let z = D._4 |
---|
58 | | - | let w = D._5 |
---|
59 | | - | let v = D._6 |
---|
60 | | - | let y = D._7 |
---|
61 | 46 | | x |
---|
62 | 47 | | } |
---|
63 | 48 | | |
---|
64 | 49 | | |
---|
65 | | - | func E (F,u) = { |
---|
66 | | - | let G = if ((F == k)) |
---|
| 50 | + | func y (z,u) = { |
---|
| 51 | + | let A = if ((z == k)) |
---|
67 | 52 | | then $Tuple2(n, k) |
---|
68 | 53 | | else $Tuple2(k, n) |
---|
69 | | - | let H = G._1 |
---|
70 | | - | let I = G._2 |
---|
71 | | - | let s = f(H) |
---|
72 | | - | let t = (f(I) - u) |
---|
73 | | - | let J = A(s, t, u) |
---|
74 | | - | let K = fraction(J, q, p) |
---|
75 | | - | let x = (J - K) |
---|
76 | | - | let L = if ((F == k)) |
---|
| 54 | + | let B = A._1 |
---|
| 55 | + | let C = A._2 |
---|
| 56 | + | let s = f(B) |
---|
| 57 | + | let t = (f(C) - u) |
---|
| 58 | + | let D = r(s, t, u) |
---|
| 59 | + | let E = fraction(D, q, p) |
---|
| 60 | + | let x = (D - E) |
---|
| 61 | + | let F = if ((z == k)) |
---|
77 | 62 | | then fraction(x, p, u) |
---|
78 | 63 | | else fraction(u, p, x) |
---|
79 | | - | $Tuple4(x, K, H, L) |
---|
| 64 | + | $Tuple4(x, E, B, F) |
---|
80 | 65 | | } |
---|
81 | 66 | | |
---|
82 | 67 | | |
---|
83 | | - | func M (N,O) = { |
---|
84 | | - | let P = [if ((size(O.payments) > 0)) |
---|
| 68 | + | func G (H,I) = { |
---|
| 69 | + | let J = [if ((size(I.payments) > 0)) |
---|
85 | 70 | | then true |
---|
86 | | - | else throw("should be with 1 payment"), if (if ((O.payments[0].assetId == k)) |
---|
| 71 | + | else throw("should be with 1 payment"), if (if ((I.payments[0].assetId == k)) |
---|
87 | 72 | | then true |
---|
88 | | - | else (O.payments[0].assetId == n)) |
---|
| 73 | + | else (I.payments[0].assetId == n)) |
---|
89 | 74 | | then true |
---|
90 | 75 | | else throw(makeString(["payment assetId should be (", j, ") or (", m, ")"], " "))] |
---|
91 | | - | if ((P == P)) |
---|
| 76 | + | if ((J == J)) |
---|
92 | 77 | | then { |
---|
93 | | - | let F = O.payments[0].assetId |
---|
94 | | - | let u = O.payments[0].amount |
---|
95 | | - | let Q = E(F, u) |
---|
96 | | - | let x = Q._1 |
---|
97 | | - | let K = Q._2 |
---|
98 | | - | let R = Q._3 |
---|
99 | | - | let L = Q._4 |
---|
100 | | - | let S = if ((K != 0)) |
---|
101 | | - | then [ScriptTransfer(N, x, R)] |
---|
| 78 | + | let z = I.payments[0].assetId |
---|
| 79 | + | let u = I.payments[0].amount |
---|
| 80 | + | let K = y(z, u) |
---|
| 81 | + | let x = K._1 |
---|
| 82 | + | let E = K._2 |
---|
| 83 | + | let L = K._3 |
---|
| 84 | + | let F = K._4 |
---|
| 85 | + | let M = if ((E != 0)) |
---|
| 86 | + | then [ScriptTransfer(H, x, L)] |
---|
102 | 87 | | else throw("amount is too low") |
---|
103 | | - | $Tuple2(S, $Tuple4(x, K, R, L)) |
---|
| 88 | + | $Tuple2(M, $Tuple4(x, E, L, F)) |
---|
104 | 89 | | } |
---|
105 | 90 | | else throw("Strict value is not equal to itself.") |
---|
106 | 91 | | } |
---|
107 | 92 | | |
---|
108 | 93 | | |
---|
109 | | - | @Callable(O) |
---|
110 | | - | func swap () = M(O.caller, O) |
---|
| 94 | + | @Callable(I) |
---|
| 95 | + | func swap () = G(I.caller, I) |
---|
111 | 96 | | |
---|
112 | 97 | | |
---|
113 | 98 | | |
---|
114 | | - | @Callable(O) |
---|
115 | | - | func swapFor (N) = M(addressFromStringValue(N), O) |
---|
| 99 | + | @Callable(I) |
---|
| 100 | + | func swapFor (H) = G(addressFromStringValue(H), I) |
---|
116 | 101 | | |
---|
117 | 102 | | |
---|