tx · 2KEhBJAeP6LrJ8adBYX2cFV1j1cmaHxtnA2GPEtLD1zt

3Mx3SF6VN2FXZp6iBuLsLwFABtveMmd4T3q:  -0.01000000 Waves

2021.07.19 19:40 [1620740] smart account 3Mx3SF6VN2FXZp6iBuLsLwFABtveMmd4T3q > SELF 0.00000000 Waves

{ "type": 13, "id": "2KEhBJAeP6LrJ8adBYX2cFV1j1cmaHxtnA2GPEtLD1zt", "fee": 1000000, "feeAssetId": null, "timestamp": 1626712852107, "version": 2, "chainId": 84, "sender": "3Mx3SF6VN2FXZp6iBuLsLwFABtveMmd4T3q", "senderPublicKey": "6LBSuvjdMMcUY8ndT92zHnqZk1BqRdXHimUaQfMf3Vq5", "proofs": [ "CiBbfnvRSyqEJ3wym6a4YvjbUTYjVDust3s6fdeMzweDdgTyqDAMPCsQnNUVpuySPLkNHzyCVscMNv8MRTXM9Cq" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAAAAAAAAgAAAAFpAQAAAA5XYXZlc1N3YXBUb2tlbgAAAAAEAAAACmN1cnJlbnRLZXkJAAEsAAAAAgIAAAANdG90YWxEZXBvc2l0XwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAlzd2FwVG9rZW4BAAAAIOcOzrhZ7nmACRz71uIBzDdZQS4CHzCdrSwGyoWA1CnEBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAlpc0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WNhbiBob2RsIFN3YXAgVG9rZW4gb25seS4DCQAAZwAAAAIFAAAAFHRvdGFsVG9rZW5zRm9yUHJvZml0BQAAAAZhbW91bnQJAAACAAAAAQkAASwAAAACAgAAADRPIHZhbG9yIHNvbGljaXRhZG8gdWx0cmFwYXNzYSBvIHZhbG9yIGF1dG9yaXphZG8gZGU6CQABpAAAAAEFAAAAFHRvdGFsVG9rZW5zRm9yUHJvZml0AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAABZuZXdBbW91bnRUb3RhbFdpdGhkcmF3CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAAFm5ld0Ftb3VudFRvdGFsV2l0aGRyYXcFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAGXRvdGFsQXV0aG9yaXplZFdpdGhkcmF3YWwFAAAABHVuaXQFAAAAA25pbAAAAADp+fpi", "height": 1620740, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: CzBC48Rze2MTssz92mnvR9dTtNRPaUu5y2E1ehcKGZ2N Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+
5+
6+@Callable(i)
7+func WavesSwapToken () = {
8+ let currentKey = ("totalDeposit_" + toBase58String(i.caller.bytes))
9+ let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm'
10+ let pmt = extract(i.payment)
11+ let amount = pmt.amount
12+ let currentAmount = match getInteger(this, currentKey) {
13+ case a: Int =>
14+ a
15+ case _ =>
16+ 0
17+ }
18+ let newAmount = (currentAmount + pmt.amount)
19+ if (isDefined(pmt.assetId))
20+ then throw("can hodl waves only at the moment")
21+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, swapToken)]))
22+ }
23+
24+
25+
26+@Callable(i)
27+func TokenSwapWaves () = {
28+ let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm'
29+ let currentKey = ("totalWithdrawInWaves_" + toBase58String(i.caller.bytes))
30+ let keyTotalDeposit = ("totalDeposit_" + toBase58String(i.caller.bytes))
31+ let totalTokensEmitidos = 10000000000
32+ let pmt = extract(i.payment)
33+ let amount = pmt.amount
34+ let currentAmountDeposits = match getInteger(this, keyTotalDeposit) {
35+ case a: Int =>
36+ a
37+ case _ =>
38+ 0
39+ }
40+ let auxiliaPorcentagem = 100
41+ let percentualParticipacao = ((currentAmountDeposits * 100) / (totalTokensEmitidos / auxiliaPorcentagem))
42+ let currentAmountWithdraw = match getInteger(this, currentKey) {
43+ case a: Int =>
44+ a
45+ case _ =>
46+ 0
47+ }
48+ let currentProfit = match getInteger(this, "currentProfit") {
49+ case a: Int =>
50+ a
51+ case _ =>
52+ 0
53+ }
54+ let walletProfit = ((currentProfit / percentualParticipacao) * auxiliaPorcentagem)
55+ let totalAuthorizedWithdrawal = (walletProfit - currentAmountWithdraw)
56+ let newAmountTotalWithdraw = (currentAmountWithdraw + amount)
57+ let totalTokensForProfit = (((totalAuthorizedWithdrawal / auxiliaPorcentagem) / 200) * 100)
58+ if ((pmt.assetId != swapToken))
59+ then throw("can hodl Swap Token only.")
60+ else if ((totalTokensForProfit >= amount))
61+ then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalTokensForProfit)))
62+ else if ((0 > amount))
63+ then throw("Can't withdraw negative amount")
64+ else if ((0 > newAmountTotalWithdraw))
65+ then throw("Not enough balance")
66+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, totalAuthorizedWithdrawal, unit)]))
67+ }
68+
69+

github/deemru/w8io/169f3d6 
18.00 ms