tx · 6RfHKzS6MuMML4XmMgHgVQJRFSegKtaZqzkzLDSN7KWq 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg: -0.01000000 Waves 2021.07.18 05:03 [1618424] smart account 3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg > SELF 0.00000000 Waves
{ "type": 13, "id": "6RfHKzS6MuMML4XmMgHgVQJRFSegKtaZqzkzLDSN7KWq", "fee": 1000000, "feeAssetId": null, "timestamp": 1626573855923, "version": 2, "chainId": 84, "sender": "3N7hBLNCFEhtWwSWkk7Pbd5qoCdYhABdAPg", "senderPublicKey": "3dgMH7dCr1W2HyMSf2t3ZvDFstt6YnTvHtvZKUt6Cwgx", "proofs": [ "25CUJP3PSWYtYEuzMYeJhWX6oSysqf4aRdwH36NB4CpY3xLzsw7R5yhnQQfxoQgN1geKZ9iPX1u4UKCEnPefXSNM" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAAAAAAAAgAAAAFpAQAAAA5XYXZlc1N3YXBUb2tlbgAAAAAEAAAACmN1cnJlbnRLZXkJAAEsAAAAAgIAAAANdG90YWxEZXBvc2l0XwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAlzd2FwVG9rZW4BAAAAIOcOzrhZ7nmACRz71uIBzDdZQS4CHzCdrSwGyoWA1CnEBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAlpc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AAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAAAdq86aQ==", "height": 1618424, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HFeUrGFcGj2bF6X3btp1tGBJ56xMdymwqEjvjQKLn3fe Full:
Old | New | Differences | |
---|---|---|---|
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 pmt = extract(i.payment) | |
31 | + | let amount = pmt.amount | |
32 | + | let currentAmount = match getInteger(this, currentKey) { | |
33 | + | case a: Int => | |
34 | + | a | |
35 | + | case _ => | |
36 | + | 0 | |
37 | + | } | |
38 | + | let newAmount = (currentAmount + amount) | |
39 | + | if ((pmt.assetId != swapToken)) | |
40 | + | then throw("can hodl Swap Token only.") | |
41 | + | else if ((0 > amount)) | |
42 | + | then throw("Can't withdraw negative amount") | |
43 | + | else if ((0 > newAmount)) | |
44 | + | then throw("Not enough balance") | |
45 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
46 | + | } | |
47 | + | ||
48 | + |
github/deemru/w8io/169f3d6 56.26 ms ◑