tx · 9v4qjRjJKqBWyxjDGtJ7XwH985SXTb2Y91riYqkD5rzp 3Mq6Xi74TdKAn4Tc2z94XFNFHW4wTzcjzrv: -0.01000000 Waves 2020.10.15 19:52 [1221950] smart account 3Mq6Xi74TdKAn4Tc2z94XFNFHW4wTzcjzrv > SELF 0.00000000 Waves
{ "type": 13, "id": "9v4qjRjJKqBWyxjDGtJ7XwH985SXTb2Y91riYqkD5rzp", "fee": 1000000, "feeAssetId": null, "timestamp": 1602780762958, "version": 2, "chainId": 84, "sender": "3Mq6Xi74TdKAn4Tc2z94XFNFHW4wTzcjzrv", "senderPublicKey": "oPX9GuojrJHmxZUmx5kbqpoAQjrH9rYhzbQv6bXVcvC", "proofs": [ "4y8jog2DHL3GNCwMAiSb4A4tM4YJw7VQoTThUTnb66EjjL89L3HJZS5DZR3v6jeuSLWkZNcTPqrM1oDcHsX56qeR" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAAHTXlUb2tlbgEAAAAgRcBshwjyRR7E4jbQIGP2jvCbtpj52Gvg2osXltv2/UMEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAAAAAAAAgkBAAAAB2V4dHJhY3QAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAB015VG9rZW4HBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQAAAgAAAAECAAAAGENhbiBkZXBvc2l0IG9ubHkgTXlUb2tlbgAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAAxKV2K", "height": 1221950, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none 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 deposit () = { | |
8 | + | let MyToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
9 | + | let pmt = extract(i.payment) | |
10 | + | if (if (isDefined(pmt.assetId)) | |
11 | + | then (extract(pmt.assetId) == MyToken) | |
12 | + | else false) | |
13 | + | then { | |
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 | + | WriteSet([DataEntry(currentKey, newAmount)]) | |
23 | + | } | |
24 | + | else throw("Can deposit only MyToken") | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func withdraw (amount) = { | |
31 | + | let currentKey = toBase58String(i.caller.bytes) | |
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 ((0 > amount)) | |
40 | + | then throw("Can't withdraw negative amount") | |
41 | + | else if ((0 > newAmount)) | |
42 | + | then throw("Not enough balance") | |
43 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
44 | + | } | |
45 | + | ||
46 | + |
github/deemru/w8io/169f3d6 22.66 ms ◑