tx · 2r8vySBdn2SvwpGppuXn7VyaDBsZr1UsKMTDMMoxoMvA 3MuNdeQyTQVrdStwprvCEgPgC2vjqRvbX6o: -0.00200000 Waves 2022.08.11 17:48 [2179965] smart account 3MuNdeQyTQVrdStwprvCEgPgC2vjqRvbX6o > SELF 0.00000000 Waves
{ "type": 13, "id": "2r8vySBdn2SvwpGppuXn7VyaDBsZr1UsKMTDMMoxoMvA", "fee": 200000, "feeAssetId": null, "timestamp": 1660229355258, "version": 2, "chainId": 84, "sender": "3MuNdeQyTQVrdStwprvCEgPgC2vjqRvbX6o", "senderPublicKey": "CJJANoX2M5vQtitZCKU1TGULEY3aZyDBdAp6XESFVH8F", "proofs": [ "5UZ6aTu2nUbWR2pgKdtPJe3fvTdybTLDKrvw6PHE5xFk57ELKtBW7nMF8bekXGsmcZYNqJigfETbNQT6pLfepFNi" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAHEF0dGFjaGVkIHBheW1lbnQgaXMgcmVxdWlyZWQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAFXdvcmtzIHdpdGggd2F2ZXMgb25seQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZAAAAAIFAAAADWN1cnJlbnRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50CQAFFAAAAAIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsBQAAAAR1bml0AAAAAWkBAAAACHdpdGhkcmF3AAAAAQAAAAZhbW91bnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGUAAAACBQAAAA1jdXJyZW50QW1vdW50BQAAAAZhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UJAAUUAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwFAAAABHVuaXQAAAAAYiVoQg==", "height": 2179965, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: Cx664tGxnZRWGQWCiy8SzzQukNFeyUUHNQSXwVVB1DiD Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let pmt = if ((size(i.payments) == 1)) | |
9 | + | then i.payments[0] | |
10 | + | else throw("Attached payment is required") | |
11 | + | if (isDefined(pmt.assetId)) | |
12 | + | then throw("works with waves only") | |
13 | + | else { | |
14 | + | let currentKey = toBase58String(i.caller.bytes) | |
15 | + | let currentAmount = match getInteger(this, currentKey) { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | + | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
23 | + | } | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | @Callable(i) | |
29 | + | func withdraw (amount) = { | |
30 | + | let currentKey = toBase58String(i.caller.bytes) | |
31 | + | let currentAmount = match getInteger(this, currentKey) { | |
32 | + | case a: Int => | |
33 | + | a | |
34 | + | case _ => | |
35 | + | 0 | |
36 | + | } | |
37 | + | let newAmount = (currentAmount - amount) | |
38 | + | if ((0 > amount)) | |
39 | + | then throw("Can't withdraw negative amount") | |
40 | + | else if ((0 > newAmount)) | |
41 | + | then throw("Not enough balance") | |
42 | + | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
43 | + | } | |
44 | + | ||
45 | + |
github/deemru/w8io/169f3d6 27.46 ms ◑