tx · HZbkjMqT3kWoxWVj6sErpyAf3nazyGtPvEwGe2p3Tp3k 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg: -0.01000000 Waves 2021.07.18 10:26 [1618757] smart account 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg > SELF 0.00000000 Waves
{ "type": 13, "id": "HZbkjMqT3kWoxWVj6sErpyAf3nazyGtPvEwGe2p3Tp3k", "fee": 1000000, "feeAssetId": null, "timestamp": 1626593232971, "version": 2, "chainId": 84, "sender": "3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg", "senderPublicKey": "3dgMH7dCr1W2HyMSf2t3ZvDFstt6YnTvHtvZKUt6Cwgx", "proofs": [ "2uoiDLTXpUe2jwp63FQg3EStTT97koogefV4Db9UnwaAXT4kCz7Pv7NJPETqJfg3CEtbVhwoEXzo1Z9RMiZc7nuA" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAAAAAAAAgAAAAFpAQAAAA5XYXZlc1N3YXBUb2tlbgAAAAAEAAAACmN1cnJlbnRLZXkJAAEsAAAAAgIAAAANdG90YWxEZXBvc2l0XwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAlzd2FwVG9rZW4BAAAAIOcOzrhZ7nmACRz71uIBzDdZQS4CHzCdrSwGyoWA1CnEBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAlpc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AAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAABZuZXdBbW91bnRUb3RhbFdpdGhkcmF3CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAAFm5ld0Ftb3VudFRvdGFsV2l0aGRyYXcFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAGXRvdGFsQXV0aG9yaXplZFdpdGhkcmF3YWwFAAAABHVuaXQFAAAAA25pbAAAAAAe+Z/w", "height": 1618757, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2vF2duMFZqjoqX53QTSXVjWYtvVG7x8WxqF1cKZLZZEt Next: CNJzti9A9XN8AsVSUoqydJGTdxyKchgjxejXbPNXoNpE Diff:
Old | New | Differences | |
---|---|---|---|
43 | 43 | } | |
44 | 44 | else 0 | |
45 | 45 | } | |
46 | - | let m = (l / k) | |
46 | + | let m = ((l * 100) / k) | |
47 | 47 | let n = { | |
48 | 48 | let g = getInteger(this, b) | |
49 | 49 | if ($isInstanceOf(g, "Int")) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(a) | |
7 | 7 | func WavesSwapToken () = { | |
8 | 8 | let b = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
9 | 9 | let c = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
10 | 10 | let d = extract(a.payment) | |
11 | 11 | let e = d.amount | |
12 | 12 | let f = { | |
13 | 13 | let g = getInteger(this, b) | |
14 | 14 | if ($isInstanceOf(g, "Int")) | |
15 | 15 | then { | |
16 | 16 | let h = g | |
17 | 17 | h | |
18 | 18 | } | |
19 | 19 | else 0 | |
20 | 20 | } | |
21 | 21 | let i = (f + d.amount) | |
22 | 22 | if (isDefined(d.assetId)) | |
23 | 23 | then throw("can hodl waves only at the moment") | |
24 | 24 | else ScriptResult(WriteSet([DataEntry(b, i)]), TransferSet([ScriptTransfer(a.caller, e, c)])) | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(a) | |
30 | 30 | func TokenSwapWaves () = { | |
31 | 31 | let c = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
32 | 32 | let b = ("totalWithdrawInWaves_" + toBase58String(a.caller.bytes)) | |
33 | 33 | let j = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
34 | 34 | let k = 10000000000 | |
35 | 35 | let d = extract(a.payment) | |
36 | 36 | let e = d.amount | |
37 | 37 | let l = { | |
38 | 38 | let g = getInteger(this, j) | |
39 | 39 | if ($isInstanceOf(g, "Int")) | |
40 | 40 | then { | |
41 | 41 | let h = g | |
42 | 42 | h | |
43 | 43 | } | |
44 | 44 | else 0 | |
45 | 45 | } | |
46 | - | let m = (l / k) | |
46 | + | let m = ((l * 100) / k) | |
47 | 47 | let n = { | |
48 | 48 | let g = getInteger(this, b) | |
49 | 49 | if ($isInstanceOf(g, "Int")) | |
50 | 50 | then { | |
51 | 51 | let h = g | |
52 | 52 | h | |
53 | 53 | } | |
54 | 54 | else 0 | |
55 | 55 | } | |
56 | 56 | let o = { | |
57 | 57 | let g = getInteger(this, "currentProfit") | |
58 | 58 | if ($isInstanceOf(g, "Int")) | |
59 | 59 | then { | |
60 | 60 | let h = g | |
61 | 61 | h | |
62 | 62 | } | |
63 | 63 | else 0 | |
64 | 64 | } | |
65 | 65 | let p = (o * m) | |
66 | 66 | let q = (p - n) | |
67 | 67 | let r = (n + e) | |
68 | 68 | if ((d.assetId != c)) | |
69 | 69 | then throw("can hodl Swap Token only.") | |
70 | 70 | else if ((e > q)) | |
71 | 71 | then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(m))) | |
72 | 72 | else if ((0 > e)) | |
73 | 73 | then throw("Can't withdraw negative amount") | |
74 | 74 | else if ((0 > r)) | |
75 | 75 | then throw("Not enough balance") | |
76 | 76 | else ScriptResult(WriteSet([DataEntry(b, r)]), TransferSet([ScriptTransfer(a.caller, q, unit)])) | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 |
github/deemru/w8io/169f3d6 26.49 ms ◑