tx · E1t2f8ivUBNzS5n4anzwnXF4M5X19xqNydmrgtkxfHFW 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.00100000 Waves 2022.09.13 20:55 [2227653] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{ "type": 13, "id": "E1t2f8ivUBNzS5n4anzwnXF4M5X19xqNydmrgtkxfHFW", "fee": 100000, "feeAssetId": null, "timestamp": 1663091732434, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "3bQxUXTVszw6fwZKCEuZPgUwE8oBQYBrvCDJEvRDKxQcG2jSgN1bJ7TnLj17RdgsVQ3iQh2EnCw13MhSz83mx6ik" ], "script": "base64:BgIGCAISABIABAAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24BCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCGNvdW50aW5nAQVieXRlcwQFY291bnQJAQlyYW5kb21pemUCBQVieXRlcwAKAwkAZwIFBWNvdW50AAQJAQxCb29sZWFuRW50cnkCBQRrV29uBwkBDEJvb2xlYW5FbnRyeQIFBGtXb24GAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAZzlM7", "height": 2227653, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4ok5mZo25s1fKumHAB6qVcwf1yRWYHAWxyUw3jStafmC Next: GsizKh7j4ggip5T1gJgTWa6ZCXBZiJ7cAAwJrQvE8Qx8 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/169f3d6 45.52 ms ◑