tx · 62q9vi4LD3HiJ5WcLB9THCwBaxTnGJojVLAywVhPULra 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq: -0.01000000 Waves 2024.03.05 23:54 [3005221] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves
{ "type": 13, "id": "62q9vi4LD3HiJ5WcLB9THCwBaxTnGJojVLAywVhPULra", "fee": 1000000, "feeAssetId": null, "timestamp": 1709672097201, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "2aq6JnDe57FtT28GoyHfVmh2niConaUbXDUoRhiSVS369pJfhjivmb66BmMAbx2w9jKAT71TC92AKrPqqcq2NSig" ], "script": "base64:BgIOCAISABIDCgEBEgMKAQgPABBhbW91bnRBc3NldElkS2V5Ag1hbW91bnRBc3NldElkAA9wcmljZUFzc2V0SWRLZXkCDHByaWNlQXNzZXRJZAAKZmVlUmF0ZUtleQIHZmVlUmF0ZQEKZ2V0QXNzZXRJZAENYXNzZXRJZFN0cmluZwMJAAACBQ1hc3NldElkU3RyaW5nAgVXQVZFUwUEdW5pdAkA2QQBBQ1hc3NldElkU3RyaW5nAQ9nZXRBc3NldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCaWQFByRtYXRjaDAJAPAHAgUEdGhpcwUCaWQICQDvBwEFBHRoaXMJYXZhaWxhYmxlABNhbW91bnRBc3NldElkU3RyaW5nCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBRBhbW91bnRBc3NldElkS2V5AA1hbW91bnRBc3NldElkCQEKZ2V0QXNzZXRJZAEFE2Ftb3VudEFzc2V0SWRTdHJpbmcAEnByaWNlQXNzZXRJZFN0cmluZwkBEUBleHRyTmF0aXZlKDEwNTMpA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kALKVwLA==", "height": 3005221, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AUT1JaVsQcktijNetUsnNgs9p94j3aQHep5BLzF3mtAF Next: 7bLkhTLYM1UZWF91TKLDp9eJNWr2brhKyuzSUiDwWaZY Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | let A = z._1 | |
54 | 54 | let B = z._2 | |
55 | 55 | let r = f(A) | |
56 | - | let s = | |
56 | + | let s = f(B) | |
57 | 57 | let C = q(r, s, t) | |
58 | 58 | let D = fraction(C, o, n) | |
59 | 59 | let w = (C - D) |
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 | 49 | func x (y,t) = { | |
50 | 50 | let z = if ((y == k)) | |
51 | 51 | then $Tuple2(m, k) | |
52 | 52 | else $Tuple2(k, m) | |
53 | 53 | let A = z._1 | |
54 | 54 | let B = z._2 | |
55 | 55 | let r = f(A) | |
56 | - | let s = | |
56 | + | let s = f(B) | |
57 | 57 | let C = q(r, s, t) | |
58 | 58 | let D = fraction(C, o, n) | |
59 | 59 | let w = (C - D) | |
60 | 60 | let E = if ((y == k)) | |
61 | 61 | then fraction(w, n, t) | |
62 | 62 | else fraction(t, n, w) | |
63 | 63 | $Tuple4(w, D, A, E) | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func F (G,H) = { | |
68 | 68 | let I = [if ((size(H.payments) > 0)) | |
69 | 69 | then true | |
70 | 70 | else throw("should be with 1 payment"), if (containsElement([k, m], H.payments[0].assetId)) | |
71 | 71 | then true | |
72 | 72 | else throw(makeString(["payment assetId should be", j, "or", l], " "))] | |
73 | 73 | if ((I == I)) | |
74 | 74 | then { | |
75 | 75 | let y = H.payments[0].assetId | |
76 | 76 | let t = H.payments[0].amount | |
77 | 77 | let J = x(y, t) | |
78 | 78 | let w = J._1 | |
79 | 79 | let D = J._2 | |
80 | 80 | let K = J._3 | |
81 | 81 | let E = J._4 | |
82 | 82 | let L = if ((D > 0)) | |
83 | 83 | then [ScriptTransfer(G, w, K)] | |
84 | 84 | else throw("amount is too low") | |
85 | 85 | $Tuple2(L, $Tuple4(w, D, K, E)) | |
86 | 86 | } | |
87 | 87 | else throw("Strict value is not equal to itself.") | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | @Callable(H) | |
92 | 92 | func swap () = F(H.caller, H) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(H) | |
97 | 97 | func swapNoLess (M) = { | |
98 | 98 | let N = F(H.caller, H) | |
99 | 99 | let L = N._1 | |
100 | 100 | let O = N._2 | |
101 | 101 | let P = O | |
102 | 102 | let w = P._1 | |
103 | 103 | let D = P._2 | |
104 | 104 | let K = P._3 | |
105 | 105 | let E = P._4 | |
106 | 106 | if ((M > w)) | |
107 | 107 | then throw(makeString(["Price slipped. minAmount: ", toString(M), " swapAmount: ", toString(w)], "")) | |
108 | 108 | else $Tuple2(L, O) | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(H) | |
114 | 114 | func swapFor (G) = F(addressFromStringValue(G), H) | |
115 | 115 | ||
116 | 116 |
github/deemru/w8io/169f3d6 26.44 ms ◑