tx · 3qdYSrekJpjh5vFcBepDAe5TAfkPg2B3JncpvnyV7yjp

3N8j9eAYBv8qa4q2UggwvykZmfN9sLaEyGQ:  -0.01400000 Waves

2019.11.03 13:57 [748599] smart account 3N8j9eAYBv8qa4q2UggwvykZmfN9sLaEyGQ > SELF 0.00000000 Waves

{ "type": 13, "id": "3qdYSrekJpjh5vFcBepDAe5TAfkPg2B3JncpvnyV7yjp", "fee": 1400000, "feeAssetId": null, "timestamp": 1572778686685, "version": 1, "sender": "3N8j9eAYBv8qa4q2UggwvykZmfN9sLaEyGQ", "senderPublicKey": "4z5JAqGUwcJ6TdnmG41r6Xg519kD5pris4PbjmX5ipAx", "proofs": [ "2YXrooyiVWBg6wHF57Bd4TKSxbVAcUUhu9hGEcejyLL8z4U3BjJ8zuGjmLdeYxgcAeG1QnoRCUoLwRaAUP8HTYUU" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAAAwEAAAALaXNBY3RpdmF0ZWQAAAAABAAAAAR1c2VyCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAR1c2VyCQEAAAACIT0AAAACBQAAAAR1c2VyAgAAAAABAAAAEHZlcmlmeU1pbkRlcG9zaXQAAAABAAAAB2RlcG9zaXQEAAAADnByaWNlUGVyTWludXRlCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAA5wcmljZVBlck1pbnV0ZQQAAAALbWluaW11bVRpbWUJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC21pbmltdW1UaW1lCQAAZgAAAAIJAABpAAAAAgUAAAAHZGVwb3NpdAUAAAAOcHJpY2VQZXJNaW51dGUFAAAAC21pbmltdW1UaW1lAQAAABBpc1RpbWVMb2NrT3BlbmVkAAAAAQAAAAtjdXJyZW50VGltZQQAAAAJdGltZXN0YXJ0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR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AAOKK1+A==", "chainId": 84, "height": 748599, "spentComplexity": 0 } View: original | compacted Prev: 9dtMXz9HTpnNMMoweJeDmFGxAUz2pAp6kCZdi9zMZAkB Next: none 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 (deposit) = {
1111 let pricePerMinute = getIntegerValue(this, "pricePerMinute")
1212 let minimumTime = getIntegerValue(this, "minimumTime")
1313 ((deposit / pricePerMinute) > minimumTime)
1414 }
1515
1616
1717 func isTimeLockOpened (currentTime) = {
1818 let timestart = getIntegerValue(this, "timestart")
1919 let pricePerMinute = getIntegerValue(this, "pricePerMinute")
2020 let deposit = getIntegerValue(this, "deposit")
2121 ((currentTime - timestart) > (deposit / pricePerMinute))
2222 }
2323
2424
2525 @Callable(i)
2626 func init () = if (if ((this == i.caller))
2727 then !(isDefined(getInteger(this, "pricePerMinute")))
2828 else false)
2929 then WriteSet([DataEntry("minimumTime", 30), DataEntry("pricePerMinute", 1), DataEntry("user", ""), DataEntry("timestart", ""), DataEntry("deposit", 0), DataEntry("withDrawAddress", "3N5KacfEg3N5155jWmxVY39rpdox566YxXa")])
3030 else throw("contract is already inited")
3131
3232
3333
3434 @Callable(i)
3535 func activate () = {
3636 let pmt = extract(i.payment)
3737 if (isActivated())
3838 then throw("The scooter is already activated")
3939 else if (!(verifyMinDeposit(pmt.amount)))
4040 then throw("Your deposit should be for 30 minutes minimum")
4141 else WriteSet([DataEntry("deposit", pmt.amount), DataEntry("user", toBase58String(i.callerPublicKey)), DataEntry("timestart", lastBlock.timestamp)])
4242 }
4343
4444
4545
4646 @Callable(i)
4747 func payAndStop (amount) = {
4848 let userAddress = value(addressFromPublicKey(fromBase58String(getStringValue(this, "user"))))
4949 let withDrawalAddress = getStringValue(this, "withDrawAddress")
5050 let deposit = getIntegerValue(this, "deposit")
5151 let remainder = (deposit - amount)
5252 if ((i.caller == userAddress))
5353 then TransferSet([ScriptTransfer(userAddress, remainder, unit), ScriptTransfer(Address(fromBase58String(withDrawalAddress)), amount, unit)])
5454 else throw("not the adress of the renter")
5555 }
5656
5757
5858
5959 @Callable(i)
6060 func withdraw () = if (if (isTimeLockOpened(lastBlock.timestamp))
6161 then (this == i.caller)
6262 else false)
6363 then {
6464 let deposit = getIntegerValue(this, "deposit")
6565 ScriptResult(WriteSet([DataEntry("deposit", 0), DataEntry("user", ""), DataEntry("timestart", "")]), TransferSet([ScriptTransfer(Address(toBytes(getStringValue(this, "withDrawAddress"))), deposit, unit)]))
6666 }
6767 else throw("withdraw rejected because timelock is still active")
6868
6969

github/deemru/w8io/169f3d6 
61.39 ms