tx · 2CFHkSbk3xy6gFKy2tRSrJ8fRjzzmG8cHYfu6VCBvkDU
3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.00100000 Waves
2022.08.21 16:09 [2194263] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{
"type": 13,
"id": "2CFHkSbk3xy6gFKy2tRSrJ8fRjzzmG8cHYfu6VCBvkDU",
"fee": 100000,
"feeAssetId": null,
"timestamp": 1661087461341,
"version": 2,
"chainId": 84,
"sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H",
"senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu",
"proofs": [
"2x6Yam2S7nkgZfxuWRnNFrM7ZYBYA8mHpeQmZPd6d2UEBGARkZMSm4wCCwT2uDDhEVEVbGNC1Jj9VHDUNhTWq89t"
],
"script": "base64:BgIGCAISABIABAAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24BCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCGNvdW50aW5nAQVieXRlcwQFY291bnQJAQlyYW5kb21pemUCBQVieXRlcwAKAwkAZwIFBWNvdW50AAQJAQxCb29sZWFuRW50cnkCBQRrV29uBwkBDEJvb2xlYW5FbnRyeQIFBGtXb24GAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAGYCBQZhbW91bnQAFAkAAgECHFlvdSBjYW5ub3QgYmV0IG1vcmUgdGhhbiAyMCEDCQECIT0CCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQFBHVuaXQJAAIBAgxQYXkgaW4gd2F2ZXMEDW51bGxJbml0U3RvcmUJAPwHBAUEdGhpcwILcGFyc2VTdHJ1Y3QFA25pbAUDbmlsAwkAAAIFDW51bGxJbml0U3RvcmUFDW51bGxJbml0U3RvcmUEA3dvbgkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCbCAIFBHRoaXMFBGtXb24CElN0b3JhZ2UgcmVhZCBlcnJvcgMFA3dvbgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIJAGgCBQZhbW91bnQAAgUEdW5pdAUDbmlsBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4ASzFvuQ==",
"height": 2194263,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6cVfMR5CzMZpHZJNrqFrMuh6t53wzkP7ho4pJCEs53QL
Next: 8um1kaQxHSi7JQKysUUV1sXXN9J9weYWsQUiVCawNfk2
Diff:
Old | New | | Differences |
---|
33 | 33 | | @Callable(i) |
---|
34 | 34 | | func startGame () = { |
---|
35 | 35 | | let amount = value(i.payments[0].amount) |
---|
36 | | - | if ((i.payments[0].assetId != unit)) |
---|
37 | | - | then throw("Pay in waves") |
---|
38 | | - | else if ((amount > 20)) |
---|
39 | | - | then throw("You cannot bet more than 20") |
---|
| 36 | + | if ((amount > 20)) |
---|
| 37 | + | then throw("You cannot bet more than 20!") |
---|
| 38 | + | else if ((i.payments[0].assetId != unit)) |
---|
| 39 | + | then throw("Pay in waves") |
---|
40 | 40 | | else { |
---|
41 | 41 | | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
42 | 42 | | if ((nullInitStore == nullInitStore)) |
---|
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 | | - | if ((i.payments[0].assetId != unit)) |
---|
37 | | - | then throw("Pay in waves") |
---|
38 | | - | else if ((amount > 20)) |
---|
39 | | - | then throw("You cannot bet more than 20") |
---|
| 36 | + | if ((amount > 20)) |
---|
| 37 | + | then throw("You cannot bet more than 20!") |
---|
| 38 | + | else if ((i.payments[0].assetId != unit)) |
---|
| 39 | + | then throw("Pay in waves") |
---|
40 | 40 | | else { |
---|
41 | 41 | | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
42 | 42 | | if ((nullInitStore == nullInitStore)) |
---|
43 | 43 | | then { |
---|
44 | 44 | | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") |
---|
45 | 45 | | if (won) |
---|
46 | 46 | | then [ScriptTransfer(i.caller, (amount * 2), unit)] |
---|
47 | 47 | | else nil |
---|
48 | 48 | | } |
---|
49 | 49 | | else throw("Strict value is not equal to itself.") |
---|
50 | 50 | | } |
---|
51 | 51 | | } |
---|
52 | 52 | | |
---|
53 | 53 | | |
---|