tx · 5aKkDmQJXcYJEMem543U4ggUzhiF45ruaLEewVAdckWf 3MzMzow9KhPczeJpNACpxRF88oPWaM7Gw7v: -0.01000000 Waves 2019.08.22 17:58 [642475] smart account 3MzMzow9KhPczeJpNACpxRF88oPWaM7Gw7v > SELF 0.00000000 Waves
{ "type": 13, "id": "5aKkDmQJXcYJEMem543U4ggUzhiF45ruaLEewVAdckWf", "fee": 1000000, "feeAssetId": null, "timestamp": 1566485540362, "version": 1, "sender": "3MzMzow9KhPczeJpNACpxRF88oPWaM7Gw7v", "senderPublicKey": "Q5uRpJT9cbVoLWQVUWw5MFE4ZzQZ3PvSUL1YSwXyaez", "proofs": [ "3JLgfDkd5Kt9P3cF1L1tLNSZTGZfSYSKWxYRctqUxSjKSka9uvNFVSazyev7NxDcPUVHjKHL75skiMmeCFXAJkaG" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAR3RVVSAQAAACB04vbmuUkm3D8qTykAKu5mSj1/PnQralZLzyco2qU3ywAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAR3RVVSCQAAAgAAAAECAAAAIGNhbiBob2xkIHdFVVIgb25seSBhdCB0aGUgbW9tZW50BAAAAA1jYWxsZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAB2JhbGFuY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAANY2FsbGVyQWRkcmVzcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAAHYmFsYW5jZQgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADWNhbGxlckFkZHJlc3MFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAWkBAAAACHdpdGhkcmF3AAAAAQAAAAZhbW91bnQEAAAADWNhbGxlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAHYmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAA1jYWxsZXJBZGRyZXNzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGUAAAACBQAAAAdiYWxhbmNlBQAAAAZhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1jYWxsZXJBZGRyZXNzBQAAAAluZXdBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEd0VVUgUAAAADbmlsAAAAAPkCdiE=", "chainId": 84, "height": 642475, "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 wEUR = base58'8sH2FBdhNGtiWPhg5QncFYhYzhqVZQRMZQabwjABJy3G' | |
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if ((pmt.assetId != wEUR)) | |
10 | + | then throw("can hold wEUR only at the moment") | |
11 | + | else { | |
12 | + | let callerAddress = toBase58String(i.caller.bytes) | |
13 | + | let balance = match getInteger(this, callerAddress) { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | let newAmount = (balance + pmt.amount) | |
20 | + | WriteSet([DataEntry(callerAddress, newAmount)]) | |
21 | + | } | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | @Callable(i) | |
27 | + | func withdraw (amount) = { | |
28 | + | let callerAddress = toBase58String(i.caller.bytes) | |
29 | + | let balance = match getInteger(this, callerAddress) { | |
30 | + | case a: Int => | |
31 | + | a | |
32 | + | case _ => | |
33 | + | 0 | |
34 | + | } | |
35 | + | let newAmount = (balance - amount) | |
36 | + | if ((0 > amount)) | |
37 | + | then throw("Can't withdraw negative amount") | |
38 | + | else if ((0 > newAmount)) | |
39 | + | then throw("Not enough balance") | |
40 | + | else ScriptResult(WriteSet([DataEntry(callerAddress, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, wEUR)])) | |
41 | + | } | |
42 | + | ||
43 | + |
github/deemru/w8io/169f3d6 22.79 ms ◑