tx · 21Fu3uJmdpFXih65YEEQ75nMaaKGjX11hyKZqfY1Eecm 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg: -0.01000000 Waves 2021.07.19 20:40 [1620804] smart account 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg > SELF 0.00000000 Waves
{ "type": 13, "id": "21Fu3uJmdpFXih65YEEQ75nMaaKGjX11hyKZqfY1Eecm", "fee": 1000000, "feeAssetId": null, "timestamp": 1626716472391, "version": 2, "chainId": 84, "sender": "3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg", "senderPublicKey": "3dgMH7dCr1W2HyMSf2t3ZvDFstt6YnTvHtvZKUt6Cwgx", "proofs": [ "496QmhCDTUhMCKxiwyejsbRVtPUH9faUJVu7GZfMtY5XJMQZ83Bk6Y1o4Tx3ez1ebGYUDCiPbYewZWgVtJWnMqkx" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAAAAAAAAgAAAAFpAQAAAA5XYXZlc1N3YXBUb2tlbgAAAAAEAAAACmN1cnJlbnRLZXkJAAEsAAAAAgIAAAANdG90YWxEZXBvc2l0XwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAlzd2FwVG9rZW4BAAAAIOcOzrhZ7nmACRz71uIBzDdZQS4CHzCdrSwGyoWA1CnEBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAlpc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QkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAWbmV3QW1vdW50VG90YWxXaXRoZHJhdwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAZdG90YWxBdXRob3JpemVkV2l0aGRyYXdhbAUAAAAEdW5pdAUAAAADbmlsAAAAAPmzIGE=", "height": 1620804, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DDUZ5NTg2yaTDw9TksZjEi1k9DfVJ3ffeuWdvUbJKwpo Next: G7TsBZUF3bDazTVRXUz4ohaF8m7Bh7udJgCm6sBpTdjT Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | let consoleLog = ((((((((((("currentAmountDeposits:" + toString(currentAmountDeposits)) + "/percentualParticipacao:") + toString(percentualParticipacao)) + "/walletProfit:") + toString(walletProfit)) + "totalAuthorizedWithdrawal:") + toString(totalAuthorizedWithdrawal)) + "newAmountTotalWithdraw:") + toString(newAmountTotalWithdraw)) + "totalTokensForProfit:") + toString(totalTokensForProfit)) | |
59 | 59 | if ((pmt.assetId != swapToken)) | |
60 | 60 | then throw("can hodl Swap Token only.") | |
61 | - | else if ((amount > | |
61 | + | else if ((amount > totalTokensForProfit)) | |
62 | 62 | then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalTokensForProfit))) | |
63 | 63 | else if ((0 > amount)) | |
64 | 64 | then throw("Can't withdraw negative amount") |
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(i) | |
7 | 7 | func WavesSwapToken () = { | |
8 | 8 | let currentKey = ("totalDeposit_" + toBase58String(i.caller.bytes)) | |
9 | 9 | let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
10 | 10 | let pmt = extract(i.payment) | |
11 | 11 | let amount = pmt.amount | |
12 | 12 | let currentAmount = match getInteger(this, currentKey) { | |
13 | 13 | case a: Int => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | let newAmount = (currentAmount + pmt.amount) | |
19 | 19 | if (isDefined(pmt.assetId)) | |
20 | 20 | then throw("can hodl waves only at the moment") | |
21 | 21 | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, swapToken)])) | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func TokenSwapWaves () = { | |
28 | 28 | let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm' | |
29 | 29 | let currentKey = ("totalWithdrawInWaves_" + toBase58String(i.caller.bytes)) | |
30 | 30 | let keyTotalDeposit = ("totalDeposit_" + toBase58String(i.caller.bytes)) | |
31 | 31 | let totalTokensEmitidos = 10000000000 | |
32 | 32 | let pmt = extract(i.payment) | |
33 | 33 | let amount = pmt.amount | |
34 | 34 | let currentAmountDeposits = match getInteger(this, keyTotalDeposit) { | |
35 | 35 | case a: Int => | |
36 | 36 | a | |
37 | 37 | case _ => | |
38 | 38 | 0 | |
39 | 39 | } | |
40 | 40 | let auxiliaPorcentagem = 100 | |
41 | 41 | let percentualParticipacao = ((currentAmountDeposits * auxiliaPorcentagem) / (totalTokensEmitidos / auxiliaPorcentagem)) | |
42 | 42 | let currentAmountWithdraw = match getInteger(this, currentKey) { | |
43 | 43 | case a: Int => | |
44 | 44 | a | |
45 | 45 | case _ => | |
46 | 46 | 0 | |
47 | 47 | } | |
48 | 48 | let currentProfit = match getInteger(this, "currentProfit") { | |
49 | 49 | case a: Int => | |
50 | 50 | a | |
51 | 51 | case _ => | |
52 | 52 | 0 | |
53 | 53 | } | |
54 | 54 | let walletProfit = ((currentProfit / percentualParticipacao) * auxiliaPorcentagem) | |
55 | 55 | let totalAuthorizedWithdrawal = (walletProfit - currentAmountWithdraw) | |
56 | 56 | let newAmountTotalWithdraw = (currentAmountWithdraw + amount) | |
57 | 57 | let totalTokensForProfit = ((totalAuthorizedWithdrawal / 200) * 100) | |
58 | 58 | let consoleLog = ((((((((((("currentAmountDeposits:" + toString(currentAmountDeposits)) + "/percentualParticipacao:") + toString(percentualParticipacao)) + "/walletProfit:") + toString(walletProfit)) + "totalAuthorizedWithdrawal:") + toString(totalAuthorizedWithdrawal)) + "newAmountTotalWithdraw:") + toString(newAmountTotalWithdraw)) + "totalTokensForProfit:") + toString(totalTokensForProfit)) | |
59 | 59 | if ((pmt.assetId != swapToken)) | |
60 | 60 | then throw("can hodl Swap Token only.") | |
61 | - | else if ((amount > | |
61 | + | else if ((amount > totalTokensForProfit)) | |
62 | 62 | then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalTokensForProfit))) | |
63 | 63 | else if ((0 > amount)) | |
64 | 64 | then throw("Can't withdraw negative amount") | |
65 | 65 | else if ((0 > newAmountTotalWithdraw)) | |
66 | 66 | then throw("Not enough balance") | |
67 | 67 | else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, totalAuthorizedWithdrawal, unit)])) | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 |
github/deemru/w8io/169f3d6 53.39 ms ◑