tx · 9tM5GZExDUDZxWmADzJ4geaGoL52V2VAdUC5GrgLwAwi 3N56TJvH5N3aXJ7erFiUAXXi5aVYHwzLPQw: -0.01000000 Waves 2021.02.18 16:48 [1403656] smart account 3N56TJvH5N3aXJ7erFiUAXXi5aVYHwzLPQw > SELF 0.00000000 Waves
{ "type": 13, "id": "9tM5GZExDUDZxWmADzJ4geaGoL52V2VAdUC5GrgLwAwi", "fee": 1000000, "feeAssetId": null, "timestamp": 1613656124665, "version": 1, "sender": "3N56TJvH5N3aXJ7erFiUAXXi5aVYHwzLPQw", "senderPublicKey": "GmsYW8AwRu24yDbKZHzjNvXsuL5gEm5zrwNYBipwuKLs", "proofs": [ "uBHB88zkv5Rf7nUFzLPQqxGNLqeaVn78kGsbs5xsHC7T1wdeGXNKAzmfGv1vHviJDPkzC8zP4CMAghAhXREUPiV" ], "script": "base64:AAIDAAAAAAAAAA4IARIAEgASBgoEAQQIAgAAAAEBAAAAC2RlcG9zaXRJbXBsAAAAAgAAAANwbXQAAAAGY2FsbGVyAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9kbCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgFAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb3VudAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWw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50CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQMJAQAAAAIhPQAAAAIFAAAAC2V4cGVjdGVkVmVjBQAAAAN2ZWMJAAACAAAAAQIAAAAqdmVjIHBhcmFtZXRlciBkb2Vzbid0IG1hdGNoIGV4cGVjdGVkIHZhbHVlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAABG5hbWUCAAAABiBUb3RhbAUAAAANd2l0aGRyYXdUb3RhbAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAARuYW1lAgAAAAkgRG9uYXRpb24FAAAABmFtb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR1bml0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAD2RvbmF0aW9uQWRkcmVzcwUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABtb+plQ=", "chainId": 84, "height": 1403656, "applicationStatus": "succeeded", "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 | + | func depositImpl (pmt,caller) = if (isDefined(pmt.assetId)) | |
5 | + | then throw("can hodl waves only at the moment") | |
6 | + | else { | |
7 | + | let currentKey = toBase58String(caller.bytes) | |
8 | + | let currentAmount = match getInteger(this, currentKey) { | |
9 | + | case a: Int => | |
10 | + | a | |
11 | + | case _ => | |
12 | + | 0 | |
13 | + | } | |
14 | + | let newAmount = (currentAmount + pmt.amount) | |
15 | + | WriteSet([DataEntry(currentKey, newAmount)]) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | @Callable(i) | |
20 | + | func default () = depositImpl(extract(i.payment), i.caller) | |
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | @Callable(i) | |
25 | + | func deposit () = depositImpl(extract(i.payment), i.caller) | |
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func withdraw (amount,donate,name,vec) = { | |
31 | + | let expectedVec = toBytes("Hello, Ride4DApp!") | |
32 | + | let donationAddress = extract(addressFromString("3N567xithiGP3NCwg7QCW1zAFmNqNxYqVDa")) | |
33 | + | let withdrawTotal = if (donate) | |
34 | + | then (2 * amount) | |
35 | + | else amount | |
36 | + | let currentKey = toBase58String(i.caller.bytes) | |
37 | + | let currentAmount = match getInteger(this, currentKey) { | |
38 | + | case a: Int => | |
39 | + | a | |
40 | + | case _ => | |
41 | + | 0 | |
42 | + | } | |
43 | + | let newAmount = (currentAmount - withdrawTotal) | |
44 | + | if ((0 > withdrawTotal)) | |
45 | + | then throw("Can't withdraw negative amount") | |
46 | + | else if ((0 > newAmount)) | |
47 | + | then throw("Not enough balance") | |
48 | + | else if ((expectedVec != vec)) | |
49 | + | then throw("vec parameter doesn't match expected value") | |
50 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount), DataEntry((name + " Total"), withdrawTotal), DataEntry((name + " Donation"), amount)]), TransferSet([ScriptTransfer(i.caller, amount, unit), ScriptTransfer(donationAddress, amount, unit)])) | |
51 | + | } | |
52 | + | ||
53 | + | ||
54 | + | @Verifier(tx) | |
55 | + | func verify () = true | |
56 | + |
github/deemru/w8io/169f3d6 15.09 ms ◑