tx · 5kMZvCZBY6yXAnHtgBRRb48qdd4b6HRKx9EEfpemJeKY 3Mp9GHXEwgTFq1AcxyvEUoWcvepa4CJuJ8w: -0.01000000 Waves 2019.10.22 09:16 [730904] smart account 3Mp9GHXEwgTFq1AcxyvEUoWcvepa4CJuJ8w > SELF 0.00000000 Waves
{ "type": 13, "id": "5kMZvCZBY6yXAnHtgBRRb48qdd4b6HRKx9EEfpemJeKY", "fee": 1000000, "feeAssetId": null, "timestamp": 1571724980775, "version": 1, "sender": "3Mp9GHXEwgTFq1AcxyvEUoWcvepa4CJuJ8w", "senderPublicKey": "BfmrbsjM6xhdWzG5WFyjhpDGgLiDC2WaxA6sSGWi3uXC", "proofs": [ "2W5w3Th8dcjUb3kTdmLd7t1oGssj5vVwqwQxAvTUpwHYctNaXZgiy92FHMJBnm9R8n3KunwzTzTRM3gQKXiYXRo4" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAABAAAAAAhpY2VDcmVhbQEAAAAgf+2sBccJl8wu9KpXghMDPt/ooWXn/5PrfV6f35TMyswAAAACAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAIaWNlQ3JlYW0JAAACAAAAAQIAAAAPb25seSBpY2UgY3JlYW1zBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAWkBAAAACHdpdGhkcmF3AAAAAQAAAAZhbW91bnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGUAAAACBQAAAA1jdXJyZW50QW1vdW50BQAAAAZhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABNOb3QgZW5vdWJnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAACGljZUNyZWFtBQAAAANuaWwAAAAASw276Q==", "chainId": 84, "height": 730904, "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 | + | let iceCream = base58'9cNybwj8yAcZeEMBw6DneC6cBEW6UgHMZiXBurhkPX1u' | |
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if ((pmt.assetId != iceCream)) | |
10 | + | then throw("only ice creams") | |
11 | + | else { | |
12 | + | let currentKey = toBase58String(i.caller.bytes) | |
13 | + | let currentAmount = match getInteger(this, currentKey) { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | let newAmount = (currentAmount + pmt.amount) | |
20 | + | WriteSet([DataEntry(currentKey, newAmount)]) | |
21 | + | } | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | @Callable(i) | |
27 | + | func withdraw (amount) = { | |
28 | + | let currentKey = toBase58String(i.caller.bytes) | |
29 | + | let currentAmount = match getInteger(this, currentKey) { | |
30 | + | case a: Int => | |
31 | + | a | |
32 | + | case _ => | |
33 | + | 0 | |
34 | + | } | |
35 | + | let newAmount = (currentAmount - amount) | |
36 | + | if ((0 > amount)) | |
37 | + | then throw("Can't withdraw negative amount") | |
38 | + | else if ((0 > newAmount)) | |
39 | + | then throw("Not enoubgh balance") | |
40 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, iceCream)])) | |
41 | + | } | |
42 | + | ||
43 | + |
github/deemru/w8io/169f3d6 18.54 ms ◑