tx · EuyqCcEoAAFYgX74pS5AhjzCd3TKhprbrZ2irLWfNr8z 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq: -0.01000000 Waves 2024.03.04 14:35 [3003214] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves
{ "type": 13, "id": "EuyqCcEoAAFYgX74pS5AhjzCd3TKhprbrZ2irLWfNr8z", "fee": 1000000, "feeAssetId": null, "timestamp": 1709552145192, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "3DMfFFTrFBc9a6qugDgJwb8EUDw29HzuYeSkdRcV1j5hVmMyCwE1sn12dnR7mubMmHzKJhuQn6gn4KgVXikQ99Ea" ], "script": "base64:BgIJCAISABIDCgEIDgAQYW1vdW50QXNzZXRJZEtleQINYW1vdW50QXNzZXRJZAAPcHJpY2VBc3NldElkS2V5AgxwcmljZUFzc2V0SWQACmZlZVJhdGVLZXkCB2ZlZVJhdGUBCmdldEFzc2V0SWQBDWFzc2V0SWRTdHJpbmcDCQAAAgUNYXNzZXRJZFN0cmluZwIFV0FWRVMFBHVuaXQJANkEAQUNYXNzZXRJZFN0cmluZwEPZ2V0QXNzZXRCYWxhbmNlAQdhc3NldElkBAckbWF0Y2gwBQdhc3NldElkAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAmlkBQckbWF0Y2gwCQDwBwIFBHRoaXMFAmlkCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQATYW1vdW50QXNzZXRJZFN0cmluZwkBEUBleHRyTmF0aXZlKDEwNTMpAgUEdGhpcwUQYW1vdW50QXNzZXRJZEtleQANYW1vdW50QXNzZXRJZAkBCmdldEFzc2V0SWQBBRNhbW91bnRBc3NldElkU3RyaW5nABJwcmljZUFzc2V0SWRTdHJpbmcJARFAZXh0ck5hdGl2ZSgxMDU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lNjcmlwdFRyYW5zZmVyAwUHYWRkcmVzcwUKc2VuZEFtb3VudAULc2VuZEFzc2V0SWQFA25pbAkAAgECEWFtb3VudCBpcyB0b28gbG93CQCUCgIFC3NlbmRBY3Rpb25zCQCWCgQFCnNlbmRBbW91bnQFCWZlZUFtb3VudAULc2VuZEFzc2V0SWQFDXVzZXJSZWFsUHJpY2UJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4CAWkBBHN3YXAACQEMc3dhcEludGVybmFsAggFAWkGY2FsbGVyBQFpAWkBB3N3YXBGb3IBB2FkZHJlc3MJAQxzd2FwSW50ZXJuYWwCCQERQGV4dHJOYXRpdmUoMTA2MikBBQdhZGRyZXNzBQFpAOgoPyY=", "height": 3003214, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8uyPT7s4kuon3CLduEBBzpLXB9X6G1GyWGN9Fq94bVjd Next: 7KgSYbDidQ1pC6WWZLTPHFsv2oYMaLdLx6BcXrkuVCGN Diff:
Old | New | Differences | |
---|---|---|---|
76 | 76 | let C = I._2 | |
77 | 77 | let J = I._3 | |
78 | 78 | let D = I._4 | |
79 | - | let K = if (( | |
79 | + | let K = if ((C > 0)) | |
80 | 80 | then [ScriptTransfer(F, v, J)] | |
81 | 81 | else throw("amount is too low") | |
82 | 82 | $Tuple2(K, $Tuple4(v, C, J, 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 (q,r,s) = { | |
39 | 39 | let t = (r + s) | |
40 | 40 | let u = fraction(q, r, t) | |
41 | 41 | let v = (q - u) | |
42 | 42 | v | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func w (x,s) = { | |
47 | 47 | let y = if ((x == k)) | |
48 | 48 | then $Tuple2(m, k) | |
49 | 49 | else $Tuple2(k, m) | |
50 | 50 | let z = y._1 | |
51 | 51 | let A = y._2 | |
52 | 52 | let q = f(z) | |
53 | 53 | let r = (f(A) - s) | |
54 | 54 | let B = p(q, r, s) | |
55 | 55 | let C = fraction(B, o, n) | |
56 | 56 | let v = (B - C) | |
57 | 57 | let D = if ((x == k)) | |
58 | 58 | then fraction(v, n, s) | |
59 | 59 | else fraction(s, n, v) | |
60 | 60 | $Tuple4(v, C, z, D) | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func E (F,G) = { | |
65 | 65 | let H = [if ((size(G.payments) > 0)) | |
66 | 66 | then true | |
67 | 67 | else throw("should be with 1 payment"), if (containsElement([k, m], G.payments[0].assetId)) | |
68 | 68 | then true | |
69 | 69 | else throw(makeString(["payment assetId should be", j, "or", l], " "))] | |
70 | 70 | if ((H == H)) | |
71 | 71 | then { | |
72 | 72 | let x = G.payments[0].assetId | |
73 | 73 | let s = G.payments[0].amount | |
74 | 74 | let I = w(x, s) | |
75 | 75 | let v = I._1 | |
76 | 76 | let C = I._2 | |
77 | 77 | let J = I._3 | |
78 | 78 | let D = I._4 | |
79 | - | let K = if (( | |
79 | + | let K = if ((C > 0)) | |
80 | 80 | then [ScriptTransfer(F, v, J)] | |
81 | 81 | else throw("amount is too low") | |
82 | 82 | $Tuple2(K, $Tuple4(v, C, J, D)) | |
83 | 83 | } | |
84 | 84 | else throw("Strict value is not equal to itself.") | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(G) | |
89 | 89 | func swap () = E(G.caller, G) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | 93 | @Callable(G) | |
94 | 94 | func swapFor (F) = E(addressFromStringValue(F), G) | |
95 | 95 | ||
96 | 96 |
github/deemru/w8io/169f3d6 23.72 ms ◑