tx · 9L2pMki1nWhTwMZAm6A8HqqkNU25mBYmFiK3BLik9f8q 3N553U1mNiC2qXswrmCtng9NG9LisEfb8UZ: -0.01000000 Waves 2019.07.19 12:54 [592606] smart account 3N553U1mNiC2qXswrmCtng9NG9LisEfb8UZ > SELF 0.00000000 Waves
{ "type": 13, "id": "9L2pMki1nWhTwMZAm6A8HqqkNU25mBYmFiK3BLik9f8q", "fee": 1000000, "feeAssetId": null, "timestamp": 1563530160909, "version": 1, "sender": "3N553U1mNiC2qXswrmCtng9NG9LisEfb8UZ", "senderPublicKey": "CnPHTxcJrxEvmRTkfL7RWG9aWwxcvHLUDe1vfK9CFMzD", "proofs": [ "5xHXu9U3FeuEq1xotioTMwMdjr3rZevKTdDShCJWjF4KiN2rKjeE7R6WmVYyMSK2As41h2P1sMNVR7L7yHjjfHRG" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAQAAAAZwbGF5ZXIEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9sZCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmFkZHJlc3NLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAJYW1vdW50S2V5CQABLAAAAAIFAAAACmFkZHJlc3NLZXkCAAAABy5hbW91bnQEAAAACXBsYXllcktleQkAASwAAAACBQAAAAphZGRyZXNzS2V5AgAAAAcucGxheWVyBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACWFtb3VudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABk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9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnNoPPw", "chainId": 84, "height": 592606, "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 (player) = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if (isDefined(pmt.assetId)) | |
10 | + | then throw("can hold waves only at the moment") | |
11 | + | else { | |
12 | + | let addressKey = toBase58String(i.caller.bytes) | |
13 | + | let amountKey = (addressKey + ".amount") | |
14 | + | let playerKey = (addressKey + ".player") | |
15 | + | let currentAmount = match getInteger(this, amountKey) { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | + | WriteSet([DataEntry(amountKey, newAmount), DataEntry(playerKey, player)]) | |
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 ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
43 | + | } | |
44 | + | ||
45 | + | ||
46 | + | @Verifier(tx) | |
47 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
48 | + |
github/deemru/w8io/169f3d6 19.81 ms ◑