tx · 95BMFVXcZb3kZdYkULqydLoqLnwQGZYx1TqXWrreWBm8 3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ: -0.01000000 Waves 2023.05.31 01:35 [2601313] smart account 3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ > SELF 0.00000000 Waves
{ "type": 13, "id": "95BMFVXcZb3kZdYkULqydLoqLnwQGZYx1TqXWrreWBm8", "fee": 1000000, "feeAssetId": null, "timestamp": 1685486154942, "version": 2, "chainId": 84, "sender": "3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ", "senderPublicKey": "y5twTW93XMmi75S5bati2cok9QLLFivsrwJedxJeUkX", "proofs": [ "2Pz2FrVV2Li3rKcmScB3LrFnyyhkUzTRezvCTqspVgykp5jWthfmH1wrPijKbshmXkhtK5uuZppq4dW66Y7j6LqQ" ], "script": "base64:BgIHCAISAwoBCAEBBnJhbmRvbQMBaQNtaW4DbWF4BAVvZnNldAkBDXBhcnNlSW50VmFsdWUBCQCyAgIJAKQDAQkAsQkBCAUBaQ10cmFuc2FjdGlvbklkAAEED3JhbmRvbVNlZWRCbG9jawkBBXZhbHVlAQkA7QcBCQBlAgUGaGVpZ2h0BQVvZnNldAQKcmFuZG9tSGFzaAkA1BYBCQEFdmFsdWUBCAUPcmFuZG9tU2VlZEJsb2NrA3ZyZgQIbGFzdENoYXIJALICAgkApAMBCQCxCQEFCnJhbmRvbUhhc2gABQkAZAIJAGoCCQENcGFyc2VJbnRWYWx1ZQEFCGxhc3RDaGFyCQBkAgkAZQIFA21heAUDbWluAAEFA21pbgEBaQEFdGVzdDcBAXgEB2FkZHJlc3MJANgEAQgIBQFpBmNhbGxlcgVieXRlcwQCcjMJAQZyYW5kb20DBQFpAAEADAkAlAoCCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgZyYW5kb20FAnIzBQNuaWwAAQC52jTG", "height": 2601313, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9WRNgwZzkKoMeUf3HUoV1xn6JuNbiKdscPx7vrb7q1So Next: AyLNT8tDb6FFttxqDXyP9vX1pbP8YeZzvPnE4Exr8BGE Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func getRandomNumber () = { | |
5 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
6 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
7 | - | let str = toBase58String(randomHash) | |
8 | - | let lastChar = takeRight(str, 2) | |
9 | - | lastChar | |
10 | - | } | |
11 | - | ||
12 | - | ||
13 | - | func getRandomNumber2 () = { | |
14 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
15 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
16 | - | takeRight(toString(toInt(randomHash)), 1) | |
17 | - | } | |
18 | - | ||
19 | - | ||
20 | - | func random (i) = { | |
21 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
22 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
23 | - | let lastChar = takeRight(toString(toInt(randomHash)), 1) | |
24 | - | let lastChar2 = takeRight(toString(toInt(i.transactionId)), 1) | |
25 | - | (lastChar + lastChar2) | |
26 | - | } | |
27 | - | ||
28 | - | ||
29 | - | func random2 (i,min,max) = { | |
4 | + | func random (i,min,max) = { | |
30 | 5 | let ofset = parseIntValue(takeRight(toString(toInt(i.transactionId)), 1)) | |
31 | 6 | let randomSeedBlock = value(blockInfoByHeight((height - ofset))) | |
32 | 7 | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
33 | 8 | let lastChar = takeRight(toString(toInt(randomHash)), 5) | |
34 | - | let randomNumber = ((parseIntValue(lastChar) % ((max - min) + 1)) + min) | |
35 | - | randomNumber | |
36 | - | } | |
37 | - | ||
38 | - | ||
39 | - | func getRandomNumber4 (i) = { | |
40 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
41 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
42 | - | toString(toInt(randomHash)) | |
9 | + | ((parseIntValue(lastChar) % ((max - min) + 1)) + min) | |
43 | 10 | } | |
44 | 11 | ||
45 | 12 | ||
46 | 13 | @Callable(i) | |
47 | - | func test7 () = { | |
14 | + | func test7 (x) = { | |
48 | 15 | let address = toBase58String(i.caller.bytes) | |
49 | - | let r3 = | |
16 | + | let r3 = random(i, 1, 12) | |
50 | 17 | $Tuple2([IntegerEntry("random", r3)], 1) | |
51 | 18 | } | |
52 | 19 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func getRandomNumber () = { | |
5 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
6 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
7 | - | let str = toBase58String(randomHash) | |
8 | - | let lastChar = takeRight(str, 2) | |
9 | - | lastChar | |
10 | - | } | |
11 | - | ||
12 | - | ||
13 | - | func getRandomNumber2 () = { | |
14 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
15 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
16 | - | takeRight(toString(toInt(randomHash)), 1) | |
17 | - | } | |
18 | - | ||
19 | - | ||
20 | - | func random (i) = { | |
21 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
22 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
23 | - | let lastChar = takeRight(toString(toInt(randomHash)), 1) | |
24 | - | let lastChar2 = takeRight(toString(toInt(i.transactionId)), 1) | |
25 | - | (lastChar + lastChar2) | |
26 | - | } | |
27 | - | ||
28 | - | ||
29 | - | func random2 (i,min,max) = { | |
4 | + | func random (i,min,max) = { | |
30 | 5 | let ofset = parseIntValue(takeRight(toString(toInt(i.transactionId)), 1)) | |
31 | 6 | let randomSeedBlock = value(blockInfoByHeight((height - ofset))) | |
32 | 7 | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
33 | 8 | let lastChar = takeRight(toString(toInt(randomHash)), 5) | |
34 | - | let randomNumber = ((parseIntValue(lastChar) % ((max - min) + 1)) + min) | |
35 | - | randomNumber | |
36 | - | } | |
37 | - | ||
38 | - | ||
39 | - | func getRandomNumber4 (i) = { | |
40 | - | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
41 | - | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
42 | - | toString(toInt(randomHash)) | |
9 | + | ((parseIntValue(lastChar) % ((max - min) + 1)) + min) | |
43 | 10 | } | |
44 | 11 | ||
45 | 12 | ||
46 | 13 | @Callable(i) | |
47 | - | func test7 () = { | |
14 | + | func test7 (x) = { | |
48 | 15 | let address = toBase58String(i.caller.bytes) | |
49 | - | let r3 = | |
16 | + | let r3 = random(i, 1, 12) | |
50 | 17 | $Tuple2([IntegerEntry("random", r3)], 1) | |
51 | 18 | } | |
52 | 19 | ||
53 | 20 |
github/deemru/w8io/03bedc9 26.12 ms ◑![]()