tx · BMVasv7fZ5jdn8E5DKk9y35TyBFmLEZnoGD5M6wcSZhP 3MrerouesBAhSFEeaz8ok11iDxb485QT26p: -0.01000000 Waves 2019.08.23 11:34 [643546] smart account 3MrerouesBAhSFEeaz8ok11iDxb485QT26p > SELF 0.00000000 Waves
{ "type": 13, "id": "BMVasv7fZ5jdn8E5DKk9y35TyBFmLEZnoGD5M6wcSZhP", "fee": 1000000, "feeAssetId": null, "timestamp": 1566549331922, "version": 1, "sender": "3MrerouesBAhSFEeaz8ok11iDxb485QT26p", "senderPublicKey": "AHTkw9xnupErRdcDWwGTvG5B6Mu1kwqX6qSCfxyMWtMy", "proofs": [ "dWUnkaPYNqr3Sne8KyMxFAC4wmGzH7mTftXNJC1eyVZGogVCve8r3No8U1ojL3AjNFMw2uz5upWmnfqSasN79mm" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAQAAAAtkZXBvc2l0SW1wbAAAAAIAAAADcG10AAAABmNhbGxlcgMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAhY2FuIGhvZGwgd2F2ZXMgb25seSBhdCB0aGUgbW9tZW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEIBQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAwAAAAFpAQAAAAdkZWZhdWx0AAAAAAkB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IGJhbGFuY2UDCQEAAAACIT0AAAACBQAAAAtleHBlY3RlZFZlYwUAAAADdmVjCQAAAgAAAAECAAAAKnZlYyBwYXJhbWV0ZXIgZG9lc24ndCBtYXRjaCBleHBlY3RlZCB2YWx1ZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAARuYW1lAgAAAAYgVG90YWwFAAAADXdpdGhkcmF3VG90YWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAEbmFtZQIAAAAJIERvbmF0aW9uBQAAAAZhbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA9kb25hdGlvbkFkZHJlc3MFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAZ168vn", "chainId": 84, "height": 643546, "spentComplexity": 0 } View: original | compacted Prev: none Next: 8FZQ7N7ZZA3xPtMUHLoLxufQfE7j1fNcpqWPj3sQo6wx 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("3N4sxBoGovhPyScZ8DyXaXL9tWKtG6kBvSj")) | |
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/026f985 15.93 ms ◑