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