tx · 8GCZ6CNGoSZFTsa3PcX1VHwWX5LfN7GCiB997W2Wmqus 3Mt5yUtJ2AK925mL7tJ86dqxh1zqsAEeepm: -0.01000000 Waves 2021.12.02 11:47 [1816438] smart account 3Mt5yUtJ2AK925mL7tJ86dqxh1zqsAEeepm > SELF 0.00000000 Waves
{ "type": 13, "id": "8GCZ6CNGoSZFTsa3PcX1VHwWX5LfN7GCiB997W2Wmqus", "fee": 1000000, "feeAssetId": null, "timestamp": 1638434867292, "version": 2, "chainId": 84, "sender": "3Mt5yUtJ2AK925mL7tJ86dqxh1zqsAEeepm", "senderPublicKey": "C5iVZCYkopz2U9o64upfCmpgSjrtpzFV73rvbnprfen1", "proofs": [ "4t9yZrXNp8jfcwsKWiyFoBn65UJ5y9UMzdKQyuLUjpG8UXspGjUQXxTCXW2jyGkW8wSog5uVGs3B6Eo7xQPrWaNB" ], "script": "base64:AAIEAAAAAAAAAJwIAhIAEgMKAQEaDQoCYTESB2dldFVzZXIaFgoCYTISEGdldEN1cnJlbnRBbW91bnQaCgoCYTMSBHVzZXIaDQoCYTQSByRtYXRjaDAaDQoCYTUSB3BheW1lbnQaEwoCYTYSDWN1cnJlbnRBbW91bnQaDwoCYTcSCW5ld0Ftb3VudBoMCgJhOBIGYW1vdW50GgwKAmE5EgZ2ZXJpZnkAAAACAQAAAAJhMQAAAAEAAAABaQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAQAAAAJhMgAAAAEAAAACYTMEAAAAAmE0CQAEGgAAAAIFAAAABHRoaXMFAAAAAmEzAwkAAAEAAAACBQAAAAJhNAIAAAADSW50BAAAAAF0BQAAAAJhNAUAAAABdAAAAAAAAAAAAAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAAmEzCQEAAAACYTEAAAABBQAAAAFpBAAAAAJhNQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAACYTYJAQAAAAJhMgAAAAEFAAAAAmEzBAAAAAJhNwkAAGQAAAACBQAAAAJhNggFAAAAAmE1AAAABmFtb3VudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAACYTUAAAAHYXNzZXRJZAkAAAIAAAABAgAAAB93b3JrcyBvbmx5IHdpdGggV0FWRVMgdG9rZW4gbm93CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAJhMwUAAAACYTcFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAACYTgEAAAAAmEzCQEAAAACYTEAAAABBQAAAAFpBAAAAAJhNgkBAAAAAmEyAAAAAQUAAAACYTMEAAAAAmE3CQAAZQAAAAIFAAAAAmE2BQAAAAJhOAMJAABmAAAAAgAAAAAAAAAAAAUAAAACYTgJAAACAAAAAQIAAAAJaWRpIG5hZmlnAwkAAGYAAAACAAAAAAAAAAAABQAAAAJhNwkAAAIAAAABAgAAAAlpZGkgbmFmaWcJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAAmEzBQAAAAJhNwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAAmE4BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAJhOQAAAAAHjexeVA==", "height": 1816438, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getUser (i) = toBase58String(i.caller.bytes) | |
5 | + | ||
6 | + | ||
7 | + | func getCurrentAmount (user) = match getInteger(this, user) { | |
8 | + | case t: Int => | |
9 | + | t | |
10 | + | case _ => | |
11 | + | 0 | |
12 | + | } | |
13 | + | ||
14 | + | ||
15 | + | @Callable(i) | |
16 | + | func deposit () = { | |
17 | + | let user = getUser(i) | |
18 | + | let payment = i.payments[0] | |
19 | + | let currentAmount = getCurrentAmount(user) | |
20 | + | let newAmount = (currentAmount + payment.amount) | |
21 | + | if (isDefined(payment.assetId)) | |
22 | + | then throw("works only with WAVES token now") | |
23 | + | else [IntegerEntry(user, newAmount)] | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | @Callable(i) | |
29 | + | func withdraw (amount) = { | |
30 | + | let user = getUser(i) | |
31 | + | let currentAmount = getCurrentAmount(user) | |
32 | + | let newAmount = (currentAmount - amount) | |
33 | + | if ((0 > amount)) | |
34 | + | then throw("idi nafig") | |
35 | + | else if ((0 > newAmount)) | |
36 | + | then throw("idi nafig") | |
37 | + | else [IntegerEntry(user, newAmount), ScriptTransfer(i.caller, amount, unit)] | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | @Verifier(tx) | |
42 | + | func verify () = false | |
43 | + |
github/deemru/w8io/169f3d6 19.58 ms ◑