tx · AyLNT8tDb6FFttxqDXyP9vX1pbP8YeZzvPnE4Exr8BGE

3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ:  -0.01000000 Waves

2023.05.31 13:06 [2601996] smart account 3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ > SELF 0.00000000 Waves

{ "type": 13, "id": "AyLNT8tDb6FFttxqDXyP9vX1pbP8YeZzvPnE4Exr8BGE", "fee": 1000000, "feeAssetId": null, "timestamp": 1685527576393, "version": 2, "chainId": 84, "sender": "3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ", "senderPublicKey": "y5twTW93XMmi75S5bati2cok9QLLFivsrwJedxJeUkX", "proofs": [ "29vb1Dek8Hv3iSYGDRX5KFcKwkeZg6zwYi5eWeqJJBE352GGqTsozkdrys9MqhSW8sc6yQvaDW3AaXqeLFbf4ZR7" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEBEgMKAQgAAAABAAAAAAFOAAAAAAAAAAAKAAAAAgAAAAFpAQAAAAZjb21taXQAAAABAAAAA2JldAMDCQAAZgAAAAIAAAAAAAAAAAAFAAAAA2JldAYJAABmAAAAAgUAAAADYmV0AAAAAAAAAAD/CQAAAgAAAAECAAAADzAgPD0gYmV0IDw9IDI1NQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAANiZXQFAAAAA25pbAAAAAFpAQAAAAZyZXZlYWwAAAABAAAAAmlkAwkAAGYAAAACAAAAAAAAAAABBQAAAAFOCQAAAgAAAAECAAAAD04gY2Fubm90IGJlIDwgMQQAAAAMY29tbWl0SGVpZ2h0CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAPpAAAAAQkAAlkAAAABBQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAKIG5vdCBmb3VuZAQAAAAMcmV2ZWFsSGVpZ2h0CQAAZAAAAAIFAAAADGNvbW1pdEhlaWdodAUAAAABTgMJAABmAAAAAgUAAAAMcmV2ZWFsSGVpZ2h0BQAAAAZoZWlnaHQJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAABXdhaXQgCQABpAAAAAEJAABlAAAAAgUAAAAMcmV2ZWFsSGVpZ2h0BQAAAAZoZWlnaHQCAAAAGSBibG9ja3MgdG8gcmV2ZWFsIHRoaXMgaWQEAAAAC3JldmVhbEJsb2NrCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAPtAAAAAQUAAAAMcmV2ZWFsSGVpZ2h0AgAAABF1bmV4Y3BlY3RlZCBlcnJvcgQAAAADdnJmCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIIBQAAAAtyZXZlYWxCbG9jawAAAAN2cmYCAAAAEXVuZXhjcGVjdGVkIGVycm9yBAAAAANiZXQJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB8AAAABBQAAAAJpZAIAAAAPY2Fubm90IGZpbmQgYmV0BAAAAAZyZXZlYWwJAAH3AAAAAQkAAMsAAAACCQAAywAAAAIFAAAAA3ZyZgkAAZsAAAABBQAAAAJpZAkAAZoAAAABBQAAAANiZXQEAAAABGdvYWwJAABqAAAAAgkABLEAAAABBQAAAAZyZXZlYWwAAAAAAAAAAQAEAAAAA3dpbgkAAAAAAAACBQAAAANiZXQFAAAABGdvYWwJAAUUAAAAAgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAJpZAUAAAADbmlsBQAAAAN3aW4AAAAAABfmbg==", "height": 2601996, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 95BMFVXcZb3kZdYkULqydLoqLnwQGZYx1TqXWrreWBm8 Next: 7hr8dYfJXTuyUFKhjfrPzg4dR438Da2UXnpvR7dLA6DQ Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func random (i,min,max) = {
5- let ofset = parseIntValue(takeRight(toString(toInt(i.transactionId)), 1))
6- let randomSeedBlock = value(blockInfoByHeight((height - ofset)))
7- let randomHash = sha256_16Kb(value(randomSeedBlock.vrf))
8- let lastChar = takeRight(toString(toInt(randomHash)), 5)
9- ((parseIntValue(lastChar) % ((max - min) + 1)) + min)
10- }
4+let N = 10
5+
6+@Callable(i)
7+func commit (bet) = if (if ((0 > bet))
8+ then true
9+ else (bet > 255))
10+ then throw("0 <= bet <= 255")
11+ else [IntegerEntry(toBase58String(i.transactionId), bet)]
12+
1113
1214
1315 @Callable(i)
14-func test7 (x) = {
15- let address = toBase58String(i.caller.bytes)
16- let r3 = random(i, 1, 12)
17- $Tuple2([IntegerEntry("random", r3)], 1)
18- }
16+func reveal (id) = if ((1 > N))
17+ then throw("N cannot be < 1")
18+ else {
19+ let commitHeight = valueOrErrorMessage(transactionHeightById(fromBase58String(id)), (id + " not found"))
20+ let revealHeight = (commitHeight + N)
21+ if ((revealHeight > height))
22+ then throw((("wait " + toString((revealHeight - height))) + " blocks to reveal this id"))
23+ else {
24+ let revealBlock = valueOrErrorMessage(blockInfoByHeight(revealHeight), "unexcpected error")
25+ let vrf = valueOrErrorMessage(revealBlock.vrf, "unexcpected error")
26+ let bet = valueOrErrorMessage(getInteger(id), "cannot find bet")
27+ let reveal = sha256(((vrf + toBytes(id)) + toBytes(bet)))
28+ let goal = (toInt(reveal) % 256)
29+ let win = (bet == goal)
30+ $Tuple2([DeleteEntry(id)], win)
31+ }
32+ }
1933
2034

github/deemru/w8io/169f3d6 
25.51 ms