tx · 4wzA2pgMgLEnTW3524qw8GoWkEA6U3YDGKqZzSSg5TNG 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.01000000 Waves 2022.11.03 15:30 [2300940] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{ "type": 13, "id": "4wzA2pgMgLEnTW3524qw8GoWkEA6U3YDGKqZzSSg5TNG", "fee": 1000000, "feeAssetId": null, "timestamp": 1667478671097, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "LWX44RsRhxAMrBDj1zFBKeVCetbE2gD7YSBDqMDbAREh15Zd4uzTBUZq7NxfLhDyy18Ftj16nEgXTF1KFtBdyxK" ], "script": "base64:BgIGCAISABIABAAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24BCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCGNvdW50aW5nAQVieXRlcwQFY291bnQJAQlyYW5kb21pemUCBQVieXRlcwAKAwkAZwIFBWNvdW50AAQJAQxCb29sZWFuRW50cnkCBQRrV29uBwkBDEJvb2xlYW5FbnRyeQIFBGtXb24GAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAZzlM7", "height": 2300940, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4M25nG2EekvaEe7Lpg19MC8vmMT9HGJVtWgTHUofyTfx Next: G2jpkvs23rvUiNtwGXFhXnAka56MmC7u5spY7akq24Uv 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 | func randomize (bytes,range) = { | |
9 | 9 | let hash = sha256(bytes) | |
10 | 10 | let index = toInt(hash) | |
11 | 11 | (index % range) | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func counting (bytes) = { | |
16 | 16 | let count = randomize(bytes, 10) | |
17 | 17 | if ((count >= 4)) | |
18 | 18 | then BooleanEntry(kWon, false) | |
19 | 19 | else BooleanEntry(kWon, true) | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func parseStruct () = if ((i.caller != this)) | |
25 | 25 | then throw("Only owner") | |
26 | 26 | else { | |
27 | 27 | let winnerStruct = counting(i.transactionId) | |
28 | 28 | [winnerStruct] | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func startGame () = { | |
35 | 35 | let amount = value(i.payments[0].amount) | |
36 | 36 | if ((i.payments[0].assetId != unit)) | |
37 | 37 | then throw("Pay in waves") | |
38 | 38 | else { | |
39 | 39 | let nullInitStore = invoke(this, "parseStruct", nil, nil) | |
40 | 40 | if ((nullInitStore == nullInitStore)) | |
41 | 41 | then { | |
42 | 42 | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") | |
43 | 43 | if (won) | |
44 | 44 | then [ScriptTransfer(i.caller, (amount * 2), unit)] | |
45 | 45 | else nil | |
46 | 46 | } | |
47 | 47 | else throw("Strict value is not equal to itself.") | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 |
github/deemru/w8io/026f985 32.40 ms ◑