tx · GjbDVL2zfsGX1tmivudb6dFrgZyC3p4Q3N9sDX9XDo6t

3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk:  -0.01400000 Waves

2019.09.08 10:28 [666807] smart account 3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk > SELF 0.00000000 Waves

{ "type": 13, "id": "GjbDVL2zfsGX1tmivudb6dFrgZyC3p4Q3N9sDX9XDo6t", "fee": 1400000, "feeAssetId": null, "timestamp": 1567927739222, "version": 1, "sender": "3MwRiKHmomSqxzrws6x5KYLtgnaBM1hhnRk", "senderPublicKey": "4zBZb7taw23PGE9E91m2Kav1ZZGExTVYZkrxt8aPUtRt", "proofs": [ "2g11hUDDeFxZky5kkZsj8qW79Nqcg1YUacNKWHb2o7pMLZBpnZF9c2gU14i4gHS7SegewWhVcf2vUGHP9mJbLZrp" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAQAAAAtpc0FjdGl2YXRlZAAAAAAEAAAABHVzZXIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABHVzZXIJAQAAAAIhPQAAAAIFAAAABHVzZXICAAAAAAEAAAAQdmVyaWZ5TWluRGVwb3NpdAAAAAAEAAAAB2RlcG9zaXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAB2RlcG9zaXQEAAAADnByaWNlUGVyTWludXRlCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAA5wcmljZVBlck1pbnV0ZQQAAAALbWluaW11bVRpbWUJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC01pbmltdW1UaW1lCQAAZgAAAAIJAABpAAAAAgUAAAAHZGVwb3NpdAUAAAAOcHJpY2VQZXJNaW51dGUFAAAAC21pbmltdW1UaW1lAQAAABBpc1RpbWVMb2NrT3BlbmVkAAAAAQAAAAtjdXJyZW50VGltZQQAAAAJdGltZXN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IHRoZSByZW50ZXIAAAABaQEAAAAId2l0aGRyYXcAAAAAAwMJAQAAABBpc1RpbWVMb2NrT3BlbmVkAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAAAAAAAAAgUAAAAEdGhpcwgFAAAAAWkAAAAGY2FsbGVyBwQAAAAHZGVwb3NpdAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAHZGVwb3NpdAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAAB2RlcG9zaXQAAAAAAAAAAAAJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABHVzZXICAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAJdGltZXN0YXJ0AgAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEJAAGbAAAAAQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAARd2l0aERyYXdhbEFkZHJlc3MFAAAAB2RlcG9zaXQFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAADJ3aXRoZHJhdyByZWplY3RlZCBiZWNhdXNlIHRpbWVsb2NrIGlzIHN0aWxsIGFjdGl2ZQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAGxA5azg==", "chainId": 84, "height": 666807, "spentComplexity": 0 } View: original | compacted Prev: C1SvhTHknh3aZp8PUhpMkFxrzGtSm9mDgyYiGFLiGQkh Next: CanczYRYLF9TgkCw4jLwbrr5S1AuNHq1REQyx3HsLNTp Diff:
OldNewDifferences
2424
2525
2626 @Callable(i)
27-func init () = if (if ((this == i.caller))
28- then !(isDefined(getInteger(this, "pricePerMinute")))
29- else false)
27+func init () = if ((this == i.caller))
3028 then WriteSet([DataEntry("pricePerMinute", 10000000), DataEntry("user", ""), DataEntry("timestart", ""), DataEntry("deposit", 0), DataEntry("withDrawAddress", "")])
3129 else throw("contract is already inited")
3230
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func isActivated () = {
55 let user = getStringValue(this, "user")
66 (user != "")
77 }
88
99
1010 func verifyMinDeposit () = {
1111 let deposit = getIntegerValue(this, "deposit")
1212 let pricePerMinute = getIntegerValue(this, "pricePerMinute")
1313 let minimumTime = getIntegerValue(this, "MinimumTime")
1414 ((deposit / pricePerMinute) > minimumTime)
1515 }
1616
1717
1818 func isTimeLockOpened (currentTime) = {
1919 let timestart = getIntegerValue(this, "timestart")
2020 let pricePerMinute = getIntegerValue(this, "pricePerMinute")
2121 let deposit = getIntegerValue(this, "deposit")
2222 ((currentTime - timestart) > (deposit / pricePerMinute))
2323 }
2424
2525
2626 @Callable(i)
27-func init () = if (if ((this == i.caller))
28- then !(isDefined(getInteger(this, "pricePerMinute")))
29- else false)
27+func init () = if ((this == i.caller))
3028 then WriteSet([DataEntry("pricePerMinute", 10000000), DataEntry("user", ""), DataEntry("timestart", ""), DataEntry("deposit", 0), DataEntry("withDrawAddress", "")])
3129 else throw("contract is already inited")
3230
3331
3432
3533 @Callable(i)
3634 func activate (deposit,userPk) = if (isActivated())
3735 then throw("The scooter is already activated")
3836 else if (!(verifyMinDeposit()))
3937 then throw("Your deposit should be for 30 minutes minimum")
4038 else WriteSet([DataEntry("deposit", deposit), DataEntry("user", userPk), DataEntry("timestart", lastBlock.timestamp)])
4139
4240
4341
4442 @Callable(i)
4543 func payAndStop (amount) = {
4644 let userAddress = addressFromPublicKey(toBytes(getStringValue(this, "user")))
4745 let withDrawalAddress = getStringValue(this, "withdrawal")
4846 let deposit = getIntegerValue(this, "deposit")
4947 let remainder = (deposit - amount)
5048 if ((i.caller == userAddress))
5149 then TransferSet([ScriptTransfer(userAddress, remainder, unit), ScriptTransfer(Address(toBytes(withDrawalAddress)), amount, unit)])
5250 else throw("not the adress of the renter")
5351 }
5452
5553
5654
5755 @Callable(i)
5856 func withdraw () = if (if (isTimeLockOpened(lastBlock.timestamp))
5957 then (this == i.caller)
6058 else false)
6159 then {
6260 let deposit = getIntegerValue(this, "deposit")
6361 ScriptResult(WriteSet([DataEntry("deposit", 0), DataEntry("user", ""), DataEntry("timestart", "")]), TransferSet([ScriptTransfer(Address(toBytes(getStringValue(this, "withDrawalAddress"))), deposit, unit)]))
6462 }
6563 else throw("withdraw rejected because timelock is still active")
6664
6765
6866 @Verifier(tx)
6967 func verify () = true
7068

github/deemru/w8io/169f3d6 
37.55 ms