tx · G7TsBZUF3bDazTVRXUz4ohaF8m7Bh7udJgCm6sBpTdjT

3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg:  -0.01000000 Waves

2021.07.19 21:35 [1620862] smart account 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg > SELF 0.00000000 Waves

{ "type": 13, "id": "G7TsBZUF3bDazTVRXUz4ohaF8m7Bh7udJgCm6sBpTdjT", "fee": 1000000, "feeAssetId": null, "timestamp": 1626719768090, "version": 2, "chainId": 84, "sender": "3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg", "senderPublicKey": "3dgMH7dCr1W2HyMSf2t3ZvDFstt6YnTvHtvZKUt6Cwgx", "proofs": [ "4gqofsPHT7TSoLsMvqfbHPiiscffbyEqUDwmykV73SWBzjXNQg8FoSUzd9iGmGgMSo1x6Zt8462YosAvjAB3uvi7" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAAAAAAAAgAAAAFpAQAAAA5XYXZlc1N3YXBUb2tlbgAAAAAEAAAACmN1cnJlbnRLZXkJAAEsAAAAAgIAAAANdG90YWxEZXBvc2l0XwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAlzd2FwVG9rZW4BAAAAIOcOzrhZ7nmACRz71uIBzDdZQS4CHzCdrSwGyoWA1CnEBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAlpc0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sV2l0aGRyYXcJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAWbmV3QW1vdW50VG90YWxXaXRoZHJhdwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAMY2FsY1dpdGhkcmF3BQAAAAR1bml0BQAAAANuaWwAAAAAFA6LKQ==", "height": 1620862, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 21Fu3uJmdpFXih65YEEQ75nMaaKGjX11hyKZqfY1Eecm Next: F4KA1rXXMcPG3Mq5pjjEomKawQdEBjg7o5z9DXhFtHmX Diff:
OldNewDifferences
5353 }
5454 let walletProfit = ((currentProfit / percentualParticipacao) * auxiliaPorcentagem)
5555 let totalAuthorizedWithdrawal = (walletProfit - currentAmountWithdraw)
56- let newAmountTotalWithdraw = (currentAmountWithdraw + amount)
5756 let totalTokensForProfit = ((totalAuthorizedWithdrawal / 200) * 100)
57+ let calcWithdraw = ((amount * 200) / 100)
58+ let newAmountTotalWithdraw = (currentAmountWithdraw + calcWithdraw)
5859 let consoleLog = ((((((((((("currentAmountDeposits:" + toString(currentAmountDeposits)) + "/percentualParticipacao:") + toString(percentualParticipacao)) + "/walletProfit:") + toString(walletProfit)) + "totalAuthorizedWithdrawal:") + toString(totalAuthorizedWithdrawal)) + "newAmountTotalWithdraw:") + toString(newAmountTotalWithdraw)) + "totalTokensForProfit:") + toString(totalTokensForProfit))
5960 if ((pmt.assetId != swapToken))
6061 then throw("can hodl Swap Token only.")
61- else if ((amount > totalTokensForProfit))
62- then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalTokensForProfit)))
62+ else if ((calcWithdraw > totalAuthorizedWithdrawal))
63+ then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalAuthorizedWithdrawal)))
6364 else if ((0 > amount))
6465 then throw("Can't withdraw negative amount")
6566 else if ((0 > newAmountTotalWithdraw))
6667 then throw("Not enough balance")
67- else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, totalAuthorizedWithdrawal, unit)]))
68+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, calcWithdraw, unit)]))
6869 }
6970
7071
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func WavesSwapToken () = {
88 let currentKey = ("totalDeposit_" + toBase58String(i.caller.bytes))
99 let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm'
1010 let pmt = extract(i.payment)
1111 let amount = pmt.amount
1212 let currentAmount = match getInteger(this, currentKey) {
1313 case a: Int =>
1414 a
1515 case _ =>
1616 0
1717 }
1818 let newAmount = (currentAmount + pmt.amount)
1919 if (isDefined(pmt.assetId))
2020 then throw("can hodl waves only at the moment")
2121 else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, swapToken)]))
2222 }
2323
2424
2525
2626 @Callable(i)
2727 func TokenSwapWaves () = {
2828 let swapToken = base58'GYxGtmuBa72BShwGRLyf8wNDEzJt7zngMLCRTnuSuhMm'
2929 let currentKey = ("totalWithdrawInWaves_" + toBase58String(i.caller.bytes))
3030 let keyTotalDeposit = ("totalDeposit_" + toBase58String(i.caller.bytes))
3131 let totalTokensEmitidos = 10000000000
3232 let pmt = extract(i.payment)
3333 let amount = pmt.amount
3434 let currentAmountDeposits = match getInteger(this, keyTotalDeposit) {
3535 case a: Int =>
3636 a
3737 case _ =>
3838 0
3939 }
4040 let auxiliaPorcentagem = 100
4141 let percentualParticipacao = ((currentAmountDeposits * auxiliaPorcentagem) / (totalTokensEmitidos / auxiliaPorcentagem))
4242 let currentAmountWithdraw = match getInteger(this, currentKey) {
4343 case a: Int =>
4444 a
4545 case _ =>
4646 0
4747 }
4848 let currentProfit = match getInteger(this, "currentProfit") {
4949 case a: Int =>
5050 a
5151 case _ =>
5252 0
5353 }
5454 let walletProfit = ((currentProfit / percentualParticipacao) * auxiliaPorcentagem)
5555 let totalAuthorizedWithdrawal = (walletProfit - currentAmountWithdraw)
56- let newAmountTotalWithdraw = (currentAmountWithdraw + amount)
5756 let totalTokensForProfit = ((totalAuthorizedWithdrawal / 200) * 100)
57+ let calcWithdraw = ((amount * 200) / 100)
58+ let newAmountTotalWithdraw = (currentAmountWithdraw + calcWithdraw)
5859 let consoleLog = ((((((((((("currentAmountDeposits:" + toString(currentAmountDeposits)) + "/percentualParticipacao:") + toString(percentualParticipacao)) + "/walletProfit:") + toString(walletProfit)) + "totalAuthorizedWithdrawal:") + toString(totalAuthorizedWithdrawal)) + "newAmountTotalWithdraw:") + toString(newAmountTotalWithdraw)) + "totalTokensForProfit:") + toString(totalTokensForProfit))
5960 if ((pmt.assetId != swapToken))
6061 then throw("can hodl Swap Token only.")
61- else if ((amount > totalTokensForProfit))
62- then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalTokensForProfit)))
62+ else if ((calcWithdraw > totalAuthorizedWithdrawal))
63+ then throw(("O valor solicitado ultrapassa o valor autorizado de:" + toString(totalAuthorizedWithdrawal)))
6364 else if ((0 > amount))
6465 then throw("Can't withdraw negative amount")
6566 else if ((0 > newAmountTotalWithdraw))
6667 then throw("Not enough balance")
67- else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, totalAuthorizedWithdrawal, unit)]))
68+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmountTotalWithdraw)]), TransferSet([ScriptTransfer(i.caller, calcWithdraw, unit)]))
6869 }
6970
7071

github/deemru/w8io/169f3d6 
50.76 ms