tx · HPf1wbu6qkvid1Jyr6HwUmxtqHXwRPTkVj37KvxCcjS5 3MzVAJ3tWZmeg3otJ2GLn3M9eNG9HG4jhwr: -0.01000000 Waves 2019.07.03 17:31 [569362] smart account 3MzVAJ3tWZmeg3otJ2GLn3M9eNG9HG4jhwr > SELF 0.00000000 Waves
{ "type": 13, "id": "HPf1wbu6qkvid1Jyr6HwUmxtqHXwRPTkVj37KvxCcjS5", "fee": 1000000, "feeAssetId": null, "timestamp": 1562164220109, "version": 1, "sender": "3MzVAJ3tWZmeg3otJ2GLn3M9eNG9HG4jhwr", "senderPublicKey": "FTe8N67RNvr1Ur41wxiSzYhtEGJwYpeqbjDKYE7aNLRb", "proofs": [ "5ku6ggk2EnT6EiquNcVoxiNTkaTcNRE3P7drKwVZPSGCAidRKp7Z1dMDryvefg2JhnhawgZEiV98xFX1PFwhQjts" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAANhbXQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAHm5vIGN1c3RvbSB0b2tlbnMgZm9yIHRoaXMgZGVtbwgFAAAAA3BtdAAAAAZhbW91bnQEAAAAA2tleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF4BQAAAAckbWF0Y2gwBQAAAAF4AAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAADYW10CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAANrZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAWkBAAAACHdpdGhkcmF3AAAAAQAAAANhbXQEAAAAA2tleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF4BQAAAAckbWF0Y2gwBQAAAAF4AAAAAAAAAAAAAwkAAGcAAAACAAAAAAAAAAAABQAAAANhbXQJAAACAAAAAQIAAAAXY2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUDCQAAZgAAAAIFAAAAA2FtdAUAAAANY3VycmVudEFtb3VudAkAAAIAAAABAgAAABxjYW4ndCB3aXRoZHJhdyBtb3JlIHRoYW4gb3duCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAADa2V5CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQFAAAAA2FtdAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAADYW10BQAAAAR1bml0BQAAAANuaWwAAAAASsgIsg==", "chainId": 84, "height": 569362, "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 pmt = value(i.payment) | |
9 | + | let amt = if (isDefined(pmt.assetId)) | |
10 | + | then throw("no custom tokens for this demo") | |
11 | + | else pmt.amount | |
12 | + | let key = toBase58String(i.caller.bytes) | |
13 | + | let currentAmount = match getInteger(this, key) { | |
14 | + | case x: Int => | |
15 | + | x | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | let newAmount = (currentAmount + amt) | |
20 | + | WriteSet([DataEntry(key, newAmount)]) | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | @Callable(i) | |
26 | + | func withdraw (amt) = { | |
27 | + | let key = toBase58String(i.caller.bytes) | |
28 | + | let currentAmount = match getInteger(this, key) { | |
29 | + | case x: Int => | |
30 | + | x | |
31 | + | case _ => | |
32 | + | 0 | |
33 | + | } | |
34 | + | if ((0 >= amt)) | |
35 | + | then throw("can't withdraw negative") | |
36 | + | else if ((amt > currentAmount)) | |
37 | + | then throw("can't withdraw more than own") | |
38 | + | else ScriptResult(WriteSet([DataEntry(key, (currentAmount - amt))]), TransferSet([ScriptTransfer(i.caller, amt, unit)])) | |
39 | + | } | |
40 | + | ||
41 | + |
github/deemru/w8io/169f3d6 20.91 ms ◑