tx · B4E4HJiNJNr8FV3HJs9AChh1j7Ry2vTGr7aaw7FqGNrs

3NCEnW5hTnRQ7J9TFQsHS4W92f54PCCWQvN:  -0.01400000 Waves

2020.02.02 14:34 [881473] smart account 3NCEnW5hTnRQ7J9TFQsHS4W92f54PCCWQvN > SELF 0.00000000 Waves

{ "type": 13, "id": "B4E4HJiNJNr8FV3HJs9AChh1j7Ry2vTGr7aaw7FqGNrs", "fee": 1400000, "feeAssetId": null, "timestamp": 1580643152407, "version": 1, "sender": "3NCEnW5hTnRQ7J9TFQsHS4W92f54PCCWQvN", "senderPublicKey": "8PUyJHGVRUxhY118c4H5isGCGLYgRBmcSzNYooDAqwh", "proofs": [ "32qSjmw6k3dp68V2MapEsnezvCPYvw9UavmMfj3LMNwfJoipyg1p387fjpxcXsy9Ut5HV8ZeXqhm6dxFAFATwCQR" ], "script": "base64:AAIDAAAAAAAAAAgIARIECgIIAQAAAAEAAAAAD25hbWVVbnRpbFN1ZmZ1eAIAAAAGOnVudGlsAAAAAQAAAAFpAQAAAAdnZXRMb2NrAAAAAgAAAAhsb2NrTmFtZQAAAAV1bnRpbAQAAAANbG9ja05hbWVVbnRpbAkAASwAAAACBQAAAAhsb2NrTmFtZQUAAAAPbmFtZVVudGlsU3VmZnV4BAAAAAhub3dVbmlvbgkAA+0AAAABBQAAAAZoZWlnaHQEAAAAA25vdwQAAAAHJG1hdGNoMAUAAAAIbm93VW5pb24DCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACUJsb2NrSW5mbwQAAAABdAUAAAAHJG1hdGNoMAUAAAABdAkAAAIAAAABAgAAABVDYW5ub3QgZ2V0IGxhc3QgYmxvY2sEAAAAAXEDCQAAZwAAAAIIBQAAAANub3cAAAAJdGltZXN0YW1wBQAAAAV1bnRpbAkAAAIAAAABAgAAABlTdXBwbGllZCB1bnRpbCBpcyB0b28gbG93BgQAAAACcXEDCQAAZgAAAAIFAAAABXVudGlsCQAAZAAAAAIIBQAAAANub3cAAAAJdGltZXN0YW1wAAAAAAAACSfACQAAAgAAAAECAAAAGlN1cHBsaWVkIHVudGlsIGlzIHRvbyBoaWdoBgQAAAALY2FuQmVMb2NrZWQEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwUAAAAIbG9ja05hbWUDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAWIFAAAAByRtYXRjaDAJAAAAAAAAAgUAAAABYggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAEVW5pdAUAAAAHJG1hdGNoMAYEAAAADGxhc3RMb2NrVGltZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAA1sb2NrTmFtZVVudGlsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAFAAAAAXQEAAAABFVuaXQFAAAAByRtYXRjaDAAAAAAAAAAAAADAwUAAAALY2FuQmVMb2NrZWQGCQAAZwAAAAIIBQAAAANub3cAAAAJdGltZXN0YW1wBQAAAAxsYXN0TG9ja1RpbWUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACGxvY2tOYW1lCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1sb2NrTmFtZVVudGlsBQAAAAV1bnRpbAUAAAADbmlsCQAAAgAAAAECAAAAE0xvY2sgY2FudCBiZSBsb2NrZWQAAAAAxDSJTg==", "chainId": 84, "height": 881473, "spentComplexity": 0 } View: original | compacted Prev: 9WBeRwUDqtTWgfcrZXsgxMm9uAsBew3bh41YGR2K3omv Next: Masa2LZG6gbvvEtfuM7UhBkbgBxiwrFvZ4FPrHDEtWX Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-
4+let nameUntilSuffux = ":until"
55
66 @Callable(i)
7-func getLock (lockName) = {
8- let ok = match getBinary(this, lockName) {
9- case t: ByteVector =>
10- if ((t == i.caller.bytes))
11- then true
12- else (t == this.bytes)
7+func getLock (lockName,until) = {
8+ let lockNameUntil = (lockName + nameUntilSuffux)
9+ let nowUnion = blockInfoByHeight(height)
10+ let now = match nowUnion {
11+ case t: BlockInfo =>
12+ t
13+ case _ =>
14+ throw("Cannot get last block")
15+ }
16+ let q = if ((now.timestamp >= until))
17+ then throw("Supplied until is too low")
18+ else true
19+ let qq = if ((until > (now.timestamp + 600000)))
20+ then throw("Supplied until is too high")
21+ else true
22+ let canBeLocked = match getBinary(this, lockName) {
23+ case b: ByteVector =>
24+ (b == i.caller.bytes)
1325 case Unit =>
1426 true
1527 }
16- if (ok)
17- then WriteSet([DataEntry(lockName, i.caller.bytes)])
18- else throw("Already locked by another")
28+ let lastLockTime = match getInteger(this, lockNameUntil) {
29+ case t: Int =>
30+ t
31+ case Unit =>
32+ 0
1933 }
20-
21-
22-
23-@Callable(i)
24-func releaseLock (lockName) = {
25- let ok = match getBinary(this, lockName) {
26- case t: ByteVector =>
27- (t == i.caller.bytes)
28- case Unit =>
29- false
30- }
31- if (ok)
32- then WriteSet([DataEntry(lockName, this.bytes)])
33- else throw("Locked by another")
34+ if (if (canBeLocked)
35+ then true
36+ else (now.timestamp >= lastLockTime))
37+ then WriteSet([DataEntry(lockName, i.caller.bytes), DataEntry(lockNameUntil, until)])
38+ else throw("Lock cant be locked")
3439 }
3540
3641

github/deemru/w8io/026f985 
36.38 ms