tx · B9X5fBNrTSELm2WBtrho8A8iip4T5gio5vsi2F9QQaZ3 3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc: -0.05000000 Waves 2019.12.17 21:30 [813268] smart account 3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc > SELF 0.00000000 Waves
{ "type": 13, "id": "B9X5fBNrTSELm2WBtrho8A8iip4T5gio5vsi2F9QQaZ3", "fee": 5000000, "feeAssetId": null, "timestamp": 1576607410883, "version": 1, "sender": "3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc", "senderPublicKey": "5M79Anear5ntQk2bbDdFA2goiPXkv7Xy2UpV4n5RKRv", "proofs": [ "28MV3ZGuUSjQpULKSLoLJw8EjhexYvbxkdDgY9JL5wYe3P3wN4XYNmm3kXJYApLacp4v8vLo8KF5vcVVKfxVMqqp" ], "script": "base64:AAIDAAAAAAAAAAwIARIAEgQKAgEIEgAAAAAIAAAAABJXQkVUUkVTRVJWQVRJT05LRVkCAAAAFSRXQkVUX1JFU0VSVkVEX0FNT1VOVAAAAAATUk9ZQUxSRVNFUlZBVElPTktFWQIAAAAWJFJPWUFMX1JFU0VSVkVEX0FNT1VOVAAAAAAEV0JFVAEAAAAghrQ2qHjTDszY8BetSy4sBB8Hn7rKuRapStdvJa2b0HYAAAAABVJPWUFMAQAAACBD6YqCwiXZdJyVfCBSScajmpCytpVfYmJeyjiJiQxpHAEAAAAWRXh0cmFjdFdCRVRSZXNlcnZlZEFtdAAAAAAEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAASV0JFVFJFU0VSVkFUSU9OS0VZAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAAF0V4dHJhY3RST1lBTFJlc2VydmVkQW10AAAAAAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAABNST1lBTFJFU0VSVkFUSU9OS0VZAwkAAAEAAAACB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AAAAAAAACQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAABNST1lBTFJFU0VSVkFUSU9OS0VZAAAAAAAAAAAACQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZ3YWxsZXQJAQAAABNGb3JtYXRQbGF5ZXJCYWxhbmNlAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAANuaWwAAAAAbBd3dg==", "chainId": 84, "height": 813268, "spentComplexity": 0 } View: original | compacted Prev: HbUVALNH7EwidabbKb8jRpQYdfgR6rP4qmgeBYpauaXP Next: BnVNjbvENMNTxPfGE2jWWrNdKmXi2rCzKLQLZTpDnmQe Diff:
Old | New | Differences | |
---|---|---|---|
86 | 86 | else { | |
87 | 87 | let newROYALReservedAmount = (ExtractROYALReservedAmt() - amount) | |
88 | 88 | let newPlayerROYALAmount = (royalAmount - amount) | |
89 | - | ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance( | |
89 | + | ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(wbetAmount, newPlayerROYALAmount))]), TransferSet(nil)) | |
90 | 90 | } | |
91 | 91 | else throw("invalit asset") | |
92 | 92 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | - | func clock ( | |
97 | + | func clock () = { | |
98 | 98 | let wallet = toString(i.caller) | |
99 | 99 | ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, 0), DataEntry(ROYALRESERVATIONKEY, 0), DataEntry(wallet, FormatPlayerBalance(0, 0))]), TransferSet(nil)) | |
100 | 100 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WBETRESERVATIONKEY = "$WBET_RESERVED_AMOUNT" | |
5 | 5 | ||
6 | 6 | let ROYALRESERVATIONKEY = "$ROYAL_RESERVED_AMOUNT" | |
7 | 7 | ||
8 | 8 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
9 | 9 | ||
10 | 10 | let ROYAL = base58'5a6rvDEiVwvhTvTH6ce2qFwqdCt3VKaHKXEpwLXXVvyy' | |
11 | 11 | ||
12 | 12 | func ExtractWBETReservedAmt () = match getInteger(this, WBETRESERVATIONKEY) { | |
13 | 13 | case a: Int => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func ExtractROYALReservedAmt () = match getInteger(this, ROYALRESERVATIONKEY) { | |
21 | 21 | case a: Int => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | 0 | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func ExtractPlayerAmt (wallet) = match getString(this, wallet) { | |
29 | 29 | case str: String => | |
30 | 30 | str | |
31 | 31 | case _ => | |
32 | 32 | "0_0" | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func FormatPlayerBalance (wbet,royal) = ((toString(wbet) + "_") + toString(royal)) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | @Callable(i) | |
40 | 40 | func lock () = { | |
41 | 41 | let payment = extract(i.payment) | |
42 | 42 | if (if ((payment.assetId != WBET)) | |
43 | 43 | then (payment.assetId != ROYAL) | |
44 | 44 | else false) | |
45 | 45 | then throw("The token should be in WBET or ROYAL.") | |
46 | 46 | else { | |
47 | 47 | let wallet = toString(i.caller) | |
48 | 48 | let playerAmount = split(ExtractPlayerAmt(wallet), "_") | |
49 | 49 | let wbetAmount = parseIntValue(playerAmount[0]) | |
50 | 50 | let royalAmount = parseIntValue(playerAmount[1]) | |
51 | 51 | if ((payment.assetId == WBET)) | |
52 | 52 | then { | |
53 | 53 | let newWBETReservedAmount = (ExtractWBETReservedAmt() + payment.amount) | |
54 | 54 | let newPlayerWBETAmount = (wbetAmount + payment.amount) | |
55 | 55 | ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, royalAmount))]), TransferSet(nil)) | |
56 | 56 | } | |
57 | 57 | else if ((payment.assetId == ROYAL)) | |
58 | 58 | then { | |
59 | 59 | let newROYALReservedAmount = (ExtractROYALReservedAmt() + payment.amount) | |
60 | 60 | let newPlayerRoyalAmount = (royalAmount + payment.amount) | |
61 | 61 | ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(wbetAmount, newPlayerRoyalAmount))]), TransferSet(nil)) | |
62 | 62 | } | |
63 | 63 | else throw("error") | |
64 | 64 | } | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func unlock (amount,asset) = { | |
71 | 71 | let wallet = toString(i.caller) | |
72 | 72 | let playerAmount = split(ExtractPlayerAmt(wallet), "_") | |
73 | 73 | let wbetAmount = parseIntValue(playerAmount[0]) | |
74 | 74 | let royalAmount = parseIntValue(playerAmount[1]) | |
75 | 75 | if ((asset == "WBET")) | |
76 | 76 | then if ((amount > wbetAmount)) | |
77 | 77 | then throw("You dont have enough balance to withdraw the amount requested.") | |
78 | 78 | else { | |
79 | 79 | let newWBETReservedAmount = (ExtractWBETReservedAmt() - amount) | |
80 | 80 | let newPlayerWBETAmount = (wbetAmount - amount) | |
81 | 81 | ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, royalAmount))]), TransferSet(nil)) | |
82 | 82 | } | |
83 | 83 | else if ((asset == "ROYAL")) | |
84 | 84 | then if ((amount > royalAmount)) | |
85 | 85 | then throw("You dont have enough balance to withdraw the amount requested.") | |
86 | 86 | else { | |
87 | 87 | let newROYALReservedAmount = (ExtractROYALReservedAmt() - amount) | |
88 | 88 | let newPlayerROYALAmount = (royalAmount - amount) | |
89 | - | ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance( | |
89 | + | ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(wbetAmount, newPlayerROYALAmount))]), TransferSet(nil)) | |
90 | 90 | } | |
91 | 91 | else throw("invalit asset") | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | - | func clock ( | |
97 | + | func clock () = { | |
98 | 98 | let wallet = toString(i.caller) | |
99 | 99 | ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, 0), DataEntry(ROYALRESERVATIONKEY, 0), DataEntry(wallet, FormatPlayerBalance(0, 0))]), TransferSet(nil)) | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 |
github/deemru/w8io/026f985 43.98 ms ◑