tx · DkPRq3NNQvmBma34QbfS3iAZPTU9v8oCsam3qT2syCHo 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg: -0.01000000 Waves 2021.07.20 20:23 [1622231] smart account 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg > SELF 0.00000000 Waves
{ "type": 13, "id": "DkPRq3NNQvmBma34QbfS3iAZPTU9v8oCsam3qT2syCHo", "fee": 1000000, "feeAssetId": null, "timestamp": 1626801890076, "version": 2, "chainId": 84, "sender": "3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg", "senderPublicKey": "3dgMH7dCr1W2HyMSf2t3ZvDFstt6YnTvHtvZKUt6Cwgx", "proofs": [ "4UpZ3mnT9bcRmxNsFT9QgvSHvJSGcdctE7jc4vQHUc7qJbDRgaWNDZAtKcSEpeuRHM8GrWULKypzGhL7oUKYrzTD" ], "script": "base64:AAIDAAAAAAAAAZ0IARIAGgcKAmExEgFpGg8KAmEyEglzd2FwVG9rZW4aEAoCYTMSCmN1cnJlbnRLZXkaFQoCYTQSD2tleVRvdGFsRGVwb3NpdBoZCgJhNRITdG90YWxUb2tlbnNFbWl0aWRvcxoJCgJhNhIDcG10GgwKAmE3EgZhbW91bnQaGwoCYTgSFWN1cnJlbnRBbW91bnREZXBvc2l0cxoNCgJhORIHJG1hdGNoMBoHCgJiMRIBYRoYCgJiMhISYXV4aWxpYVBvcmNlbnRhZ2VtGhwKAmIzEhZwZXJjZW50dWFsUGFydGljaXBhY2FvGhsKAmI0EhVjdXJyZW50QW1vdW50V2l0aGRyYXcaEwoCYjUSDWN1cnJlbnRQcm9maXQaEgoCYjYSDHdhbGxldFByb2ZpdBofCgJiNxIZdG90YWxBdXRob3JpemVkV2l0aGRyYXdhbBoaCgJiOBIUdG90YWxUb2tlbnNGb3JQcm9maXQaEgoCYjkSDGNhbGNXaXRoZHJhdxocCgJjMRIWbmV3QW1vdW50VG90YWxXaXRoZHJhdwAAAAAAAAABAAAAAmExAQAAAA5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AAAAADIAAAAAAAAAABkBAAAAAJjMQkAAGQAAAACBQAAAAJiNAUAAAACYjkDCQEAAAACIT0AAAACCAUAAAACYTYAAAAHYXNzZXRJZAUAAAACYTIJAAACAAAAAQIAAAAZY2FuIGhvZGwgU3dhcCBUb2tlbiBvbmx5LgMJAABmAAAAAgAAAAAAAAAAAAUAAAACYTcJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACBQAAAAJiOQUAAAACYjcJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAD1PIHZhbG9yIHNvbGljaXRhZG8gdWx0cmFwYXNzYSBvIHZhbG9yIGRhIHRyb2NhIGF1dG9yaXphZGEgZGU6CQABpAAAAAEFAAAAAmI4AgAAAAwgdG9rZW5zIHBvciAJAAGkAAAAAQUAAAACYjcCAAAABiB3YXZlcwMJAABmAAAAAgAAAAAAAAAAAAUAAAACYzEJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAACYTMFAAAAAmMxBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAmExAAAABmNhbGxlcgUAAAACYjkFAAAABHVuaXQFAAAAA25pbAAAAAAMthWx", "height": 1622231, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2XEPx4EHpwBATncq6wmu2yafiSW2cz3evBtTCK73cABd Next: none Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(a) | |
7 | - | func WavesSwapToken () = { | |
8 | - | let b = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
9 | - | let c = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
10 | - | let d = extract(a.payment) | |
11 | - | let e = d.amount | |
12 | - | let f = { | |
13 | - | let g = getInteger(this, b) | |
14 | - | if ($isInstanceOf(g, "Int")) | |
7 | + | func TokenSwapWaves () = { | |
8 | + | let b = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
9 | + | let c = ("totalWithdrawInWaves_" + toBase58String(a.caller.bytes)) | |
10 | + | let d = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
11 | + | let e = 10000000000 | |
12 | + | let f = extract(a.payment) | |
13 | + | let g = f.amount | |
14 | + | let h = { | |
15 | + | let i = getInteger(this, d) | |
16 | + | if ($isInstanceOf(i, "Int")) | |
15 | 17 | then { | |
16 | - | let | |
17 | - | | |
18 | + | let j = i | |
19 | + | j | |
18 | 20 | } | |
19 | 21 | else 0 | |
20 | 22 | } | |
21 | - | let i = (f + d.amount) | |
22 | - | if (isDefined(d.assetId)) | |
23 | - | then throw("can hodl waves only at the moment") | |
24 | - | else ScriptResult(WriteSet([DataEntry(b, i)]), TransferSet([ScriptTransfer(a.caller, e, c)])) | |
23 | + | let k = 100 | |
24 | + | let l = ((h * k) / (e / k)) | |
25 | + | let m = { | |
26 | + | let i = getInteger(this, c) | |
27 | + | if ($isInstanceOf(i, "Int")) | |
28 | + | then { | |
29 | + | let j = i | |
30 | + | j | |
31 | + | } | |
32 | + | else 0 | |
33 | + | } | |
34 | + | let n = { | |
35 | + | let i = getInteger(this, "currentProfit") | |
36 | + | if ($isInstanceOf(i, "Int")) | |
37 | + | then { | |
38 | + | let j = i | |
39 | + | j | |
40 | + | } | |
41 | + | else 0 | |
42 | + | } | |
43 | + | let o = ((n / l) * k) | |
44 | + | let p = (o - m) | |
45 | + | let q = ((p / 200) * 100) | |
46 | + | let r = ((g * 200) / 100) | |
47 | + | let s = (m + r) | |
48 | + | if ((f.assetId != b)) | |
49 | + | then throw("can hodl Swap Token only.") | |
50 | + | else if ((0 > g)) | |
51 | + | then throw("Can't withdraw negative amount") | |
52 | + | else if ((r > p)) | |
53 | + | then throw((((("O valor solicitado ultrapassa o valor da troca autorizada de:" + toString(q)) + " tokens por ") + toString(p)) + " waves")) | |
54 | + | else if ((0 > s)) | |
55 | + | then throw("Not enough balance") | |
56 | + | else ScriptResult(WriteSet([DataEntry(c, s)]), TransferSet([ScriptTransfer(a.caller, r, unit)])) | |
25 | 57 | } | |
26 | 58 | ||
27 | 59 |
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 | - | func WavesSwapToken () = { | |
8 | - | let b = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
9 | - | let c = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
10 | - | let d = extract(a.payment) | |
11 | - | let e = d.amount | |
12 | - | let f = { | |
13 | - | let g = getInteger(this, b) | |
14 | - | if ($isInstanceOf(g, "Int")) | |
7 | + | func TokenSwapWaves () = { | |
8 | + | let b = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
9 | + | let c = ("totalWithdrawInWaves_" + toBase58String(a.caller.bytes)) | |
10 | + | let d = ("totalDeposit_" + toBase58String(a.caller.bytes)) | |
11 | + | let e = 10000000000 | |
12 | + | let f = extract(a.payment) | |
13 | + | let g = f.amount | |
14 | + | let h = { | |
15 | + | let i = getInteger(this, d) | |
16 | + | if ($isInstanceOf(i, "Int")) | |
15 | 17 | then { | |
16 | - | let | |
17 | - | | |
18 | + | let j = i | |
19 | + | j | |
18 | 20 | } | |
19 | 21 | else 0 | |
20 | 22 | } | |
21 | - | let i = (f + d.amount) | |
22 | - | if (isDefined(d.assetId)) | |
23 | - | then throw("can hodl waves only at the moment") | |
24 | - | else ScriptResult(WriteSet([DataEntry(b, i)]), TransferSet([ScriptTransfer(a.caller, e, c)])) | |
23 | + | let k = 100 | |
24 | + | let l = ((h * k) / (e / k)) | |
25 | + | let m = { | |
26 | + | let i = getInteger(this, c) | |
27 | + | if ($isInstanceOf(i, "Int")) | |
28 | + | then { | |
29 | + | let j = i | |
30 | + | j | |
31 | + | } | |
32 | + | else 0 | |
33 | + | } | |
34 | + | let n = { | |
35 | + | let i = getInteger(this, "currentProfit") | |
36 | + | if ($isInstanceOf(i, "Int")) | |
37 | + | then { | |
38 | + | let j = i | |
39 | + | j | |
40 | + | } | |
41 | + | else 0 | |
42 | + | } | |
43 | + | let o = ((n / l) * k) | |
44 | + | let p = (o - m) | |
45 | + | let q = ((p / 200) * 100) | |
46 | + | let r = ((g * 200) / 100) | |
47 | + | let s = (m + r) | |
48 | + | if ((f.assetId != b)) | |
49 | + | then throw("can hodl Swap Token only.") | |
50 | + | else if ((0 > g)) | |
51 | + | then throw("Can't withdraw negative amount") | |
52 | + | else if ((r > p)) | |
53 | + | then throw((((("O valor solicitado ultrapassa o valor da troca autorizada de:" + toString(q)) + " tokens por ") + toString(p)) + " waves")) | |
54 | + | else if ((0 > s)) | |
55 | + | then throw("Not enough balance") | |
56 | + | else ScriptResult(WriteSet([DataEntry(c, s)]), TransferSet([ScriptTransfer(a.caller, r, unit)])) | |
25 | 57 | } | |
26 | 58 | ||
27 | 59 |
github/deemru/w8io/169f3d6 422.88 ms ◑