tx · CY1zC1EEC1hPY7M8Bn62DaKGKX61pk4jg2Tt2NBbWmdw
3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.00200000 Waves
2022.08.21 13:28 [2194095] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{
"type": 13,
"id": "CY1zC1EEC1hPY7M8Bn62DaKGKX61pk4jg2Tt2NBbWmdw",
"fee": 200000,
"feeAssetId": null,
"timestamp": 1661077764384,
"version": 2,
"chainId": 84,
"sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H",
"senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu",
"proofs": [
"31upUMe63F9wHhC1tdFjHJBoPgnpaXJsfrbbFEVoGTViQUkZ2QXgPpyvipNnduZsa6rgakj3mZ8nYfBityX7Apdy"
],
"script": "base64:BgIICAISABIAEgAGAAxrVXNlclBheW1lbnQCB1BheW1lbnQABGtXb24CA1dvbgAJc2VwYXJhdG9yAgEvAA9zZXBhcmF0b3JTZWNvbmQCAXwBCXJhbmRvbWl6ZQIFYnl0ZXMFcmFuZ2UEBGhhc2gJAPcDAQUFYnl0ZXMEBWluZGV4CQCxCQEFBGhhc2gJAGoCBQVpbmRleAUFcmFuZ2UBCGNvdW50aW5nAgVieXRlcwZjYWxsZXIEBWNvdW50CQEJcmFuZG9taXplAgUFYnl0ZXMACgMJAGcCBQVjb3VudAAECQELU3RyaW5nRW50cnkCBQRrV29uCQCsAgIJAKwCAgkArAICCQCsAgIJAKUIAQUGY2FsbGVyBQlzZXBhcmF0b3ICBWZhbHNlBQ9zZXBhcmF0b3JTZWNvbmQJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMFBGtXb24JAQtTdHJpbmdFbnRyeQIFBGtXb24JAKwCAgkArAICCQCsAgIJAKwCAgkApQgBBQZjYWxsZXIFCXNlcGFyYXRvcgIEdHJ1ZQUPc2VwYXJhdG9yU2Vjb25kCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBQRrV29uAwFpAQlpbml0U3RvcmUACQDMCAIJAQtTdHJpbmdFbnRyeQIFBGtXb24CATAFA25pbAFpAQtwYXJzZVN0cnVjdAAEDW51bGxJbml0U3RvcmUJAP0HBAUEdGhpcwIJaW5pdFN0b3JlBQNuaWwFA25pbAMJAAACBQ1udWxsSW5pdFN0b3JlBQ1udWxsSW5pdFN0b3JlAwkBAiE9AggFAWkGY2FsbGVyBQR0aGlzCQACAQIKT25seSBvd25lcgQMd2lubmVyU3RydWN0CQEIY291bnRpbmcCCAUBaQ10cmFuc2FjdGlvbklkCAUBaQZjYWxsZXIJAMwIAgUMd2lubmVyU3RydWN0BQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwMJAGYCBQZhbW91bnQAFAkAAgECG1lvdSBjYW5ub3QgYmV0IG1vcmUgdGhhbiAyMAQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgDBLmj0",
"height": 2194095,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: G5HsWEG4PSvPz3RHYLs256AAF6n9Vgcnoesi12ECVouG
Next: He1ntbKUnrKrALKpgj6xSt5nPfnjJX5ra5dKz9NEMZrL
Diff:
Old | New | | Differences |
---|
4 | 4 | | let kUserPayment = "Payment" |
---|
5 | 5 | | |
---|
6 | 6 | | let kWon = "Won" |
---|
| 7 | + | |
---|
| 8 | + | let separator = "/" |
---|
| 9 | + | |
---|
| 10 | + | let separatorSecond = "|" |
---|
7 | 11 | | |
---|
8 | 12 | | func randomize (bytes,range) = { |
---|
9 | 13 | | let hash = sha256(bytes) |
---|
|
12 | 16 | | } |
---|
13 | 17 | | |
---|
14 | 18 | | |
---|
15 | | - | func counting (bytes) = { |
---|
| 19 | + | func counting (bytes,caller) = { |
---|
16 | 20 | | let count = randomize(bytes, 10) |
---|
17 | 21 | | if ((count >= 4)) |
---|
18 | | - | then BooleanEntry(kWon, false) |
---|
19 | | - | else BooleanEntry(kWon, true) |
---|
| 22 | + | then StringEntry(kWon, ((((toString(caller) + separator) + "false") + separatorSecond) + getStringValue(this, kWon))) |
---|
| 23 | + | else StringEntry(kWon, ((((toString(caller) + separator) + "true") + separatorSecond) + getStringValue(this, kWon))) |
---|
20 | 24 | | } |
---|
21 | 25 | | |
---|
22 | 26 | | |
---|
23 | 27 | | @Callable(i) |
---|
24 | | - | func parseStruct () = if ((i.caller != this)) |
---|
25 | | - | then throw("Only owner") |
---|
26 | | - | else { |
---|
27 | | - | let winnerStruct = counting(i.transactionId) |
---|
| 28 | + | func initStore () = [StringEntry(kWon, "0")] |
---|
| 29 | + | |
---|
| 30 | + | |
---|
| 31 | + | |
---|
| 32 | + | @Callable(i) |
---|
| 33 | + | func parseStruct () = { |
---|
| 34 | + | let nullInitStore = reentrantInvoke(this, "initStore", nil, nil) |
---|
| 35 | + | if ((nullInitStore == nullInitStore)) |
---|
| 36 | + | then if ((i.caller != this)) |
---|
| 37 | + | then throw("Only owner") |
---|
| 38 | + | else { |
---|
| 39 | + | let winnerStruct = counting(i.transactionId, i.caller) |
---|
28 | 40 | | [winnerStruct] |
---|
29 | | - | } |
---|
| 41 | + | } |
---|
| 42 | + | else throw("Strict value is not equal to itself.") |
---|
| 43 | + | } |
---|
30 | 44 | | |
---|
31 | 45 | | |
---|
32 | 46 | | |
---|
|
35 | 49 | | let amount = value(i.payments[0].amount) |
---|
36 | 50 | | if ((i.payments[0].assetId != unit)) |
---|
37 | 51 | | then throw("Pay in waves") |
---|
38 | | - | else { |
---|
39 | | - | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
40 | | - | if ((nullInitStore == nullInitStore)) |
---|
41 | | - | then { |
---|
42 | | - | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") |
---|
43 | | - | if ((amount >= 10)) |
---|
44 | | - | then nil |
---|
45 | | - | else if (won) |
---|
| 52 | + | else if ((amount > 20)) |
---|
| 53 | + | then throw("You cannot bet more than 20") |
---|
| 54 | + | else { |
---|
| 55 | + | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
| 56 | + | if ((nullInitStore == nullInitStore)) |
---|
| 57 | + | then { |
---|
| 58 | + | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") |
---|
| 59 | + | if (won) |
---|
46 | 60 | | then [ScriptTransfer(i.caller, (amount * 2), unit)] |
---|
47 | 61 | | else nil |
---|
48 | | - | } |
---|
49 | | - | else throw("Strict value is not equal to itself.") |
---|
50 | | - | } |
---|
| 62 | + | } |
---|
| 63 | + | else throw("Strict value is not equal to itself.") |
---|
| 64 | + | } |
---|
51 | 65 | | } |
---|
52 | 66 | | |
---|
53 | 67 | | |
---|
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 | + | |
---|
| 8 | + | let separator = "/" |
---|
| 9 | + | |
---|
| 10 | + | let separatorSecond = "|" |
---|
7 | 11 | | |
---|
8 | 12 | | func randomize (bytes,range) = { |
---|
9 | 13 | | let hash = sha256(bytes) |
---|
10 | 14 | | let index = toInt(hash) |
---|
11 | 15 | | (index % range) |
---|
12 | 16 | | } |
---|
13 | 17 | | |
---|
14 | 18 | | |
---|
15 | | - | func counting (bytes) = { |
---|
| 19 | + | func counting (bytes,caller) = { |
---|
16 | 20 | | let count = randomize(bytes, 10) |
---|
17 | 21 | | if ((count >= 4)) |
---|
18 | | - | then BooleanEntry(kWon, false) |
---|
19 | | - | else BooleanEntry(kWon, true) |
---|
| 22 | + | then StringEntry(kWon, ((((toString(caller) + separator) + "false") + separatorSecond) + getStringValue(this, kWon))) |
---|
| 23 | + | else StringEntry(kWon, ((((toString(caller) + separator) + "true") + separatorSecond) + getStringValue(this, kWon))) |
---|
20 | 24 | | } |
---|
21 | 25 | | |
---|
22 | 26 | | |
---|
23 | 27 | | @Callable(i) |
---|
24 | | - | func parseStruct () = if ((i.caller != this)) |
---|
25 | | - | then throw("Only owner") |
---|
26 | | - | else { |
---|
27 | | - | let winnerStruct = counting(i.transactionId) |
---|
| 28 | + | func initStore () = [StringEntry(kWon, "0")] |
---|
| 29 | + | |
---|
| 30 | + | |
---|
| 31 | + | |
---|
| 32 | + | @Callable(i) |
---|
| 33 | + | func parseStruct () = { |
---|
| 34 | + | let nullInitStore = reentrantInvoke(this, "initStore", nil, nil) |
---|
| 35 | + | if ((nullInitStore == nullInitStore)) |
---|
| 36 | + | then if ((i.caller != this)) |
---|
| 37 | + | then throw("Only owner") |
---|
| 38 | + | else { |
---|
| 39 | + | let winnerStruct = counting(i.transactionId, i.caller) |
---|
28 | 40 | | [winnerStruct] |
---|
29 | | - | } |
---|
| 41 | + | } |
---|
| 42 | + | else throw("Strict value is not equal to itself.") |
---|
| 43 | + | } |
---|
30 | 44 | | |
---|
31 | 45 | | |
---|
32 | 46 | | |
---|
33 | 47 | | @Callable(i) |
---|
34 | 48 | | func startGame () = { |
---|
35 | 49 | | let amount = value(i.payments[0].amount) |
---|
36 | 50 | | if ((i.payments[0].assetId != unit)) |
---|
37 | 51 | | then throw("Pay in waves") |
---|
38 | | - | else { |
---|
39 | | - | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
40 | | - | if ((nullInitStore == nullInitStore)) |
---|
41 | | - | then { |
---|
42 | | - | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") |
---|
43 | | - | if ((amount >= 10)) |
---|
44 | | - | then nil |
---|
45 | | - | else if (won) |
---|
| 52 | + | else if ((amount > 20)) |
---|
| 53 | + | then throw("You cannot bet more than 20") |
---|
| 54 | + | else { |
---|
| 55 | + | let nullInitStore = invoke(this, "parseStruct", nil, nil) |
---|
| 56 | + | if ((nullInitStore == nullInitStore)) |
---|
| 57 | + | then { |
---|
| 58 | + | let won = valueOrErrorMessage(getBoolean(this, kWon), "Storage read error") |
---|
| 59 | + | if (won) |
---|
46 | 60 | | then [ScriptTransfer(i.caller, (amount * 2), unit)] |
---|
47 | 61 | | else nil |
---|
48 | | - | } |
---|
49 | | - | else throw("Strict value is not equal to itself.") |
---|
50 | | - | } |
---|
| 62 | + | } |
---|
| 63 | + | else throw("Strict value is not equal to itself.") |
---|
| 64 | + | } |
---|
51 | 65 | | } |
---|
52 | 66 | | |
---|
53 | 67 | | |
---|