tx · H7s4ReZktXKs4iyxDWtdBea7dToGqwQhQ7JYvhvBBgg2 3MzCxx3HQhveT7EPtxKiavzeG5NaWfdWaqG: -0.01000000 Waves 2022.11.27 23:37 [2336011] smart account 3MzCxx3HQhveT7EPtxKiavzeG5NaWfdWaqG > SELF 0.00000000 Waves
{ "type": 13, "id": "H7s4ReZktXKs4iyxDWtdBea7dToGqwQhQ7JYvhvBBgg2", "fee": 1000000, "feeAssetId": null, "timestamp": 1669581440460, "version": 2, "chainId": 84, "sender": "3MzCxx3HQhveT7EPtxKiavzeG5NaWfdWaqG", "senderPublicKey": "GsZLD13DqBHEqBVXCDjp7KqkLz78GSfeRJR8LFQnSFzu", "proofs": [ "XWVUhDTf9AFtibHPyjkXJ9qHa61zqgGxZbZhWFHRwBtJ1dgBALFDAgoq32xUyyWuQX6rVheBm4yJcdBxqmgdSVR" ], "script": "base64:AAIFAAAAAAAAAA8IAhIFCgMICAgSBAoCAQEAAAACAQAAAANhYnMAAAABAAAAAXYDCQAAZgAAAAIAAAAAAAAAAAAFAAAAAXYJAABoAAAAAgD//////////wUAAAABdgUAAAABdgEAAAAEcmFuZAAAAAIAAAAEc2VlZAAAAANtYXgJAAGkAAAAAQkAAGoAAAACCQEAAAADYWJzAAAAAQkABLEAAAABBQAAAARzZWVkBQAAAANtYXgAAAACAAAAAWkBAAAACXNwbGl0VGVzdAAAAAMAAAAEbGlzdAAAAAZvbGRTdHIAAAAGbmV3U3RyBAAAAAduZXdMaXN0CQAEuQAAAAIJAAS1AAAAAgUAAAAEbGlzdAUAAAAGb2xkU3RyBQAAAAZuZXdTdHIJAAACAAAAAQUAAAAHbmV3TGlzdAAAAAFpAQAAAAhyYW5kVGVzdAAAAAIAAAAIYmxvY2tOdW0AAAADbnVtBAAAAAlibG9ja0luZm8JAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkAA+0AAAABBQAAAAhibG9ja051bQIAAAAddnJmIGlzIG5vdCBzdXBwb3J0ZWQgYnkgYm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AVyYW5kNwIAAAACX18JAQAAAARyYW5kAAAAAgkAAMoAAAACBQAAAARzZWVkAAAAAAAAAAAIBQAAAANudW0EAAAABXJhbmQ5CQABLAAAAAIJAAEsAAAAAgUAAAAFcmFuZDgCAAAAAl9fCQEAAAAEcmFuZAAAAAIJAADKAAAAAgUAAAAEc2VlZAAAAAAAAAAACQUAAAADbnVtBAAAAAZyYW5kMTAJAAEsAAAAAgkAASwAAAACBQAAAAVyYW5kOQIAAAACX18JAQAAAARyYW5kAAAAAgkAAMoAAAACBQAAAARzZWVkAAAAAAAAAAAKBQAAAANudW0JAAACAAAAAQUAAAAGcmFuZDEwAAAAAGqzNsw=", "height": 2336011, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CzQFMFyfvDQgaNmZmBJC95ssNkXXGF1kDgsJvFQkyFfd Next: Bh999ub9LDNjErs44byLQ6FTpHVfEDNCBrTcrEum59WH Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func abs (v) = if ((0 > v)) | |
5 | + | then (-1 * v) | |
6 | + | else v | |
7 | + | ||
8 | + | ||
9 | + | func rand (seed,max) = toString((abs(toInt(seed)) % max)) | |
4 | 10 | ||
5 | 11 | ||
6 | 12 | @Callable(i) | |
12 | 18 | ||
13 | 19 | ||
14 | 20 | @Callable(i) | |
15 | - | func randTest (blockNum) = { | |
21 | + | func randTest (blockNum,num) = { | |
16 | 22 | let blockInfo = valueOrErrorMessage(blockInfoByHeight(blockNum), "vrf is not supported by block") | |
17 | 23 | let vrf = valueOrErrorMessage(blockInfo.vrf, "vrf is empty") | |
18 | - | let | |
19 | - | let rand0 = | |
20 | - | let rand1 = ((rand0 + "__") + | |
21 | - | let rand2 = ((rand1 + "__") + | |
22 | - | let rand3 = ((rand2 + "__") + | |
23 | - | let rand4 = ((rand3 + "__") + | |
24 | - | let rand5 = ((rand4 + "__") + | |
25 | - | let rand6 = ((rand5 + "__") + | |
26 | - | let rand7 = ((rand6 + "__") + | |
27 | - | let rand8 = ((rand7 + "__") + | |
28 | - | let rand9 = ((rand8 + "__") + | |
29 | - | let rand10 = ((rand9 + "__") + | |
24 | + | let seed = sha256(vrf) | |
25 | + | let rand0 = rand(seed, num) | |
26 | + | let rand1 = ((rand0 + "__") + rand(drop(seed, 1), num)) | |
27 | + | let rand2 = ((rand1 + "__") + rand(drop(seed, 2), num)) | |
28 | + | let rand3 = ((rand2 + "__") + rand(drop(seed, 3), num)) | |
29 | + | let rand4 = ((rand3 + "__") + rand(drop(seed, 4), num)) | |
30 | + | let rand5 = ((rand4 + "__") + rand(drop(seed, 5), num)) | |
31 | + | let rand6 = ((rand5 + "__") + rand(drop(seed, 6), num)) | |
32 | + | let rand7 = ((rand6 + "__") + rand(drop(seed, 7), num)) | |
33 | + | let rand8 = ((rand7 + "__") + rand(drop(seed, 8), num)) | |
34 | + | let rand9 = ((rand8 + "__") + rand(drop(seed, 9), num)) | |
35 | + | let rand10 = ((rand9 + "__") + rand(drop(seed, 10), num)) | |
30 | 36 | throw(rand10) | |
31 | 37 | } | |
32 | 38 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func abs (v) = if ((0 > v)) | |
5 | + | then (-1 * v) | |
6 | + | else v | |
7 | + | ||
8 | + | ||
9 | + | func rand (seed,max) = toString((abs(toInt(seed)) % max)) | |
4 | 10 | ||
5 | 11 | ||
6 | 12 | @Callable(i) | |
7 | 13 | func splitTest (list,oldStr,newStr) = { | |
8 | 14 | let newList = makeString(split(list, oldStr), newStr) | |
9 | 15 | throw(newList) | |
10 | 16 | } | |
11 | 17 | ||
12 | 18 | ||
13 | 19 | ||
14 | 20 | @Callable(i) | |
15 | - | func randTest (blockNum) = { | |
21 | + | func randTest (blockNum,num) = { | |
16 | 22 | let blockInfo = valueOrErrorMessage(blockInfoByHeight(blockNum), "vrf is not supported by block") | |
17 | 23 | let vrf = valueOrErrorMessage(blockInfo.vrf, "vrf is empty") | |
18 | - | let | |
19 | - | let rand0 = | |
20 | - | let rand1 = ((rand0 + "__") + | |
21 | - | let rand2 = ((rand1 + "__") + | |
22 | - | let rand3 = ((rand2 + "__") + | |
23 | - | let rand4 = ((rand3 + "__") + | |
24 | - | let rand5 = ((rand4 + "__") + | |
25 | - | let rand6 = ((rand5 + "__") + | |
26 | - | let rand7 = ((rand6 + "__") + | |
27 | - | let rand8 = ((rand7 + "__") + | |
28 | - | let rand9 = ((rand8 + "__") + | |
29 | - | let rand10 = ((rand9 + "__") + | |
24 | + | let seed = sha256(vrf) | |
25 | + | let rand0 = rand(seed, num) | |
26 | + | let rand1 = ((rand0 + "__") + rand(drop(seed, 1), num)) | |
27 | + | let rand2 = ((rand1 + "__") + rand(drop(seed, 2), num)) | |
28 | + | let rand3 = ((rand2 + "__") + rand(drop(seed, 3), num)) | |
29 | + | let rand4 = ((rand3 + "__") + rand(drop(seed, 4), num)) | |
30 | + | let rand5 = ((rand4 + "__") + rand(drop(seed, 5), num)) | |
31 | + | let rand6 = ((rand5 + "__") + rand(drop(seed, 6), num)) | |
32 | + | let rand7 = ((rand6 + "__") + rand(drop(seed, 7), num)) | |
33 | + | let rand8 = ((rand7 + "__") + rand(drop(seed, 8), num)) | |
34 | + | let rand9 = ((rand8 + "__") + rand(drop(seed, 9), num)) | |
35 | + | let rand10 = ((rand9 + "__") + rand(drop(seed, 10), num)) | |
30 | 36 | throw(rand10) | |
31 | 37 | } | |
32 | 38 | ||
33 | 39 |
github/deemru/w8io/169f3d6 51.89 ms ◑