tx · AyYiw9Ubx4nVpk6A5d3LVvR1fnZHu88VapxMrtZPotsH 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.01000000 Waves 2022.11.13 15:02 [2315329] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{ "type": 13, "id": "AyYiw9Ubx4nVpk6A5d3LVvR1fnZHu88VapxMrtZPotsH", "fee": 1000000, "feeAssetId": null, "timestamp": 1668340966336, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "5LRDbvvzp287TJzxWEzcQdXz3LJvPKNHy28wX1xDYdksqw69Zj97dnEQDbH3Z6YH38QDgMQhRzW3MhnkRJBqHi6U" ], "script": "base64:BgIGCAISABIABQAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24ACXNlcGFyYXRvcgIBXwEJcmFuZG9taXplAgVieXRlcwVyYW5nZQQEaGFzaAkA9wMBBQVieXRlcwQFaW5kZXgJALEJAQUEaGFzaAkAagIFBWluZGV4BQVyYW5nZQEIY291bnRpbmcBBWJ5dGVzBAVjb3VudAkBCXJhbmRvbWl6ZQIFBWJ5dGVzAAoDCQBnAgUFY291bnQAAwcGAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgkBDEJvb2xlYW5FbnRyeQIJAKwCAgkArAICCQCsAgIFBGtXb24FCXNlcGFyYXRvcgkApQgBCAUBaQZjYWxsZXIJAKQDAQkBCXJhbmRvbWl6ZQIIBQFpDXRyYW5zYWN0aW9uSWQA6AcFDHdpbm5lclN0cnVjdAkAzAgCCQEMQm9vbGVhbkVudHJ5AgUEa1dvbgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwMJAGYCBQZhbW91bnQACgkAAgECD1RvbyBtdWNoIGFtb3VudAQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgA6xAXo", "height": 2315329, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E8HzhmX6gT8ikkWCo1GU8PNzmTgnYumZdpeXmZRQmQAF Next: 5uE2vW9iEFmqNoC62DKaDkhKz6WxV3cNcJK3XVnZqoRf Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kUserPayment = "Payment" | |
5 | 5 | ||
6 | 6 | let kWon = "Won" | |
7 | 7 | ||
8 | 8 | let separator = "_" | |
9 | 9 | ||
10 | 10 | func randomize (bytes,range) = { | |
11 | 11 | let hash = sha256(bytes) | |
12 | 12 | let index = toInt(hash) | |
13 | 13 | (index % range) | |
14 | 14 | } | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func counting (bytes) = { | |
18 | 18 | let count = randomize(bytes, 10) | |
19 | 19 | if ((count >= 3)) | |
20 | 20 | then false | |
21 | 21 | else true | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | @Callable(i) | |
26 | 26 | func parseStruct () = if ((i.caller != this)) | |
27 | 27 | then throw("Only owner") | |
28 | 28 | else { | |
29 | 29 | let winnerStruct = counting(i.transactionId) | |
30 | 30 | [BooleanEntry((((kWon + separator) + toString(i.caller)) + toString(randomize(i.transactionId, 1000))), winnerStruct), BooleanEntry(kWon, winnerStruct)] | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func startGame () = { | |
37 | 37 | let amount = value(i.payments[0].amount) | |
38 | 38 | if ((i.payments[0].assetId != unit)) | |
39 | 39 | then throw("Pay in waves") | |
40 | 40 | else if ((amount > 10)) | |
41 | 41 | then throw("Too much amount") | |
42 | 42 | else { | |
43 | 43 | let nullInitStore = invoke(this, "parseStruct", nil, nil) | |
44 | 44 | if ((nullInitStore == nullInitStore)) | |
45 | 45 | then { | |
46 | 46 | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") | |
47 | 47 | if (won) | |
48 | 48 | then [ScriptTransfer(i.caller, (amount * 2), unit)] | |
49 | 49 | else nil | |
50 | 50 | } | |
51 | 51 | else throw("Strict value is not equal to itself.") | |
52 | 52 | } | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 |
github/deemru/w8io/026f985 22.20 ms ◑