tx · CanczYRYLF9TgkCw4jLwbrr5S1AuNHq1REQyx3HsLNTp 3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk: -0.01400000 Waves 2019.09.08 10:31 [666808] smart account 3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk > SELF 0.00000000 Waves
{ "type": 13, "id": "CanczYRYLF9TgkCw4jLwbrr5S1AuNHq1REQyx3HsLNTp", "fee": 1400000, "feeAssetId": null, "timestamp": 1567927848010, "version": 1, "sender": "3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk", "senderPublicKey": "4zBZb7taw23PGE9E91m2Kav1ZZGExTVYZkrxt8aPUtRt", "proofs": [ "5QnB98xBKTKwxGensZqLjwBahsJCyt15icGYE2khXE2rRCGG4pPgroqYbXBnUtus4FxowPTP8T8LzKQ6MxgKuGqj" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAQAAAAtpc0FjdGl2YXRlZAAAAAAEAAAABHVzZXIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABHVzZXIJAQAAAAIhPQAAAAIFAAAABHVzZXICAAAAAAEAAAAQdmVyaWZ5TWluRGVwb3NpdAAAAAAEAAAAB2RlcG9zaXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAB2RlcG9zaXQEAAAADnByaWNlUGVyTWludXRlCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAA5wcmljZVBlck1pbnV0ZQQAAAALbWluaW11bVRpbWUJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC01pbmltdW1UaW1lCQAAZgAAAAIJAABpAAAAAgUAAAAHZGVwb3NpdAUAAAAOcHJpY2VQZXJNaW51dGUFAAAAC21pbmltdW1UaW1lAQAAABBpc1RpbWVMb2NrT3BlbmVkAAAAAQAAAAtjdXJyZW50VGltZQQAAAAJdGltZXN0YXJ0CQ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Py2 Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(j) | |
27 | - | func init () = if ((this == j.caller)) | |
27 | + | func init () = if (if ((this == j.caller)) | |
28 | + | then !(isDefined(getInteger(this, "pricePerMinute"))) | |
29 | + | else false) | |
28 | 30 | then WriteSet([DataEntry("pricePerMinute", 10000000), DataEntry("user", ""), DataEntry("timestart", ""), DataEntry("deposit", 0), DataEntry("withDrawAddress", "")]) | |
29 | 31 | else throw("contract is already inited") | |
30 | 32 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func a () = { | |
5 | 5 | let b = getStringValue(this, "user") | |
6 | 6 | (b != "") | |
7 | 7 | } | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func c () = { | |
11 | 11 | let d = getIntegerValue(this, "deposit") | |
12 | 12 | let e = getIntegerValue(this, "pricePerMinute") | |
13 | 13 | let f = getIntegerValue(this, "MinimumTime") | |
14 | 14 | ((d / e) > f) | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func g (h) = { | |
19 | 19 | let i = getIntegerValue(this, "timestart") | |
20 | 20 | let e = getIntegerValue(this, "pricePerMinute") | |
21 | 21 | let d = getIntegerValue(this, "deposit") | |
22 | 22 | ((h - i) > (d / e)) | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(j) | |
27 | - | func init () = if ((this == j.caller)) | |
27 | + | func init () = if (if ((this == j.caller)) | |
28 | + | then !(isDefined(getInteger(this, "pricePerMinute"))) | |
29 | + | else false) | |
28 | 30 | then WriteSet([DataEntry("pricePerMinute", 10000000), DataEntry("user", ""), DataEntry("timestart", ""), DataEntry("deposit", 0), DataEntry("withDrawAddress", "")]) | |
29 | 31 | else throw("contract is already inited") | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | ||
33 | 35 | @Callable(j) | |
34 | 36 | func activate (d,k) = if (a()) | |
35 | 37 | then throw("The scooter is already activated") | |
36 | 38 | else if (!(c())) | |
37 | 39 | then throw("Your deposit should be for 30 minutes minimum") | |
38 | 40 | else WriteSet([DataEntry("deposit", d), DataEntry("user", k), DataEntry("timestart", lastBlock.timestamp)]) | |
39 | 41 | ||
40 | 42 | ||
41 | 43 | ||
42 | 44 | @Callable(j) | |
43 | 45 | func payAndStop (l) = { | |
44 | 46 | let m = addressFromPublicKey(toBytes(getStringValue(this, "user"))) | |
45 | 47 | let n = getStringValue(this, "withdrawal") | |
46 | 48 | let d = getIntegerValue(this, "deposit") | |
47 | 49 | let o = (d - l) | |
48 | 50 | if ((j.caller == m)) | |
49 | 51 | then TransferSet([ScriptTransfer(m, o, unit), ScriptTransfer(Address(toBytes(n)), l, unit)]) | |
50 | 52 | else throw("not the adress of the renter") | |
51 | 53 | } | |
52 | 54 | ||
53 | 55 | ||
54 | 56 | ||
55 | 57 | @Callable(j) | |
56 | 58 | func withdraw () = if (if (g(lastBlock.timestamp)) | |
57 | 59 | then (this == j.caller) | |
58 | 60 | else false) | |
59 | 61 | then { | |
60 | 62 | let d = getIntegerValue(this, "deposit") | |
61 | 63 | ScriptResult(WriteSet([DataEntry("deposit", 0), DataEntry("user", ""), DataEntry("timestart", "")]), TransferSet([ScriptTransfer(Address(toBytes(getStringValue(this, "withDrawalAddress"))), d, unit)])) | |
62 | 64 | } | |
63 | 65 | else throw("withdraw rejected because timelock is still active") | |
64 | 66 | ||
65 | 67 | ||
66 | 68 | @Verifier(p) | |
67 | 69 | func q () = true | |
68 | 70 |
github/deemru/w8io/169f3d6 36.71 ms ◑