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:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let kUserPayment = "Payment"
55
66 let kWon = "Won"
77
88 let separator = "_"
99
1010 func randomize (bytes,range) = {
1111 let hash = sha256(bytes)
1212 let index = toInt(hash)
1313 (index % range)
1414 }
1515
1616
1717 func counting (bytes) = {
1818 let count = randomize(bytes, 10)
1919 if ((count >= 3))
2020 then false
2121 else true
2222 }
2323
2424
2525 @Callable(i)
2626 func parseStruct () = if ((i.caller != this))
2727 then throw("Only owner")
2828 else {
2929 let winnerStruct = counting(i.transactionId)
3030 [BooleanEntry((((kWon + separator) + toString(i.caller)) + toString(randomize(i.transactionId, 1000))), winnerStruct), BooleanEntry(kWon, winnerStruct)]
3131 }
3232
3333
3434
3535 @Callable(i)
3636 func startGame () = {
3737 let amount = value(i.payments[0].amount)
3838 if ((i.payments[0].assetId != unit))
3939 then throw("Pay in waves")
4040 else if ((amount > 10))
4141 then throw("Too much amount")
4242 else {
4343 let nullInitStore = invoke(this, "parseStruct", nil, nil)
4444 if ((nullInitStore == nullInitStore))
4545 then {
4646 let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error")
4747 if (won)
4848 then [ScriptTransfer(i.caller, (amount * 2), unit)]
4949 else nil
5050 }
5151 else throw("Strict value is not equal to itself.")
5252 }
5353 }
5454
5555

github/deemru/w8io/026f985 
22.20 ms