tx · AmxgdiqTBFbeeWbRqAzCtMKSk4Q6XAiZQuUCQj2CZcKs 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z: -0.01000000 Waves 2024.12.31 05:35 [3438089] smart account 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z > SELF 0.00000000 Waves
{ "type": 13, "id": "AmxgdiqTBFbeeWbRqAzCtMKSk4Q6XAiZQuUCQj2CZcKs", "fee": 1000000, "feeAssetId": null, "timestamp": 1735612509497, "version": 2, "chainId": 84, "sender": "3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z", "senderPublicKey": "5CoDbXxoqnvJpx9GrS6M4G5GYJXh9rcoiXJz7RYTPVkL", "proofs": [ "45oYoF8bm2UrN99Z2ttYMHnqsciQjyfKKQKmZ8Ynf5sf7hgUGoFkvyKCXEc2TDfyLKKTzduE46cY3VjNa9ghUq3w" ], "script": "base64:BgImCAISCgoIAQgEAhEYFBISBAoCCAgSABIDCgEBEgASABIAEgMKAQgXAANNMTYAgICE/qbe4READlNUQUtFUlNfQU1PVU5UAICAmqbqr+MBAAtURUFNX0FNT1VOVACAgJqm6q/jAQANTUFSS0VUX0FNT1VOVACAgNCx0v6aDgALWUVBUl9CTE9DS1MJAGgCAO0CAKALAAxTVEFLRV9QRVJJT0QJAGgCAAUFC1lFQVJfQkxPQ0tTAAtCTEVTU19QUklDRQCA0NvD9AIAC0ZPTU9fUEVSSU9EADwADmdvcmNBc3NldElkS2V5Agtnb3JjQXNzZXRJZAALZ29yY0Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAoQgBBQ5nb3JjQXNzZXRJZEtleQIWR09SQyBpcyBub3QgaXNzdWVkIHlldAAMaXNzdWVUaW1lS2V5Aglpc3N1ZVRpbWUAFHN0YWtlcnNBbW91bnRMZWZ0S2V5AhFzdGFrZXJzQW1vdW50TGVmdAAUc3Rha2VkQW1vdW50VG90YWxLZXkCC3N0YWtlZFRvdGFsARVzdGFrZWRBb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BBQ9sYXN0Rm9tb1RpbWVLZXkAAAQObGFzdEZvbW9QbGF5ZXIJAQt2YWx1ZU9yRWxzZQIJAKIIAQURbGFzdEZvbW9QbGF5ZXJLZXkCAAkAlAoCBQNuaWwJAMwIAgkArAICAhglcyVkX19nb3JjQXZhaWxUb0NsYWltX18JAKQDAQUKdXNlckFtb3VudAkAzAgCCQCsAgICFSVzJWRfX2phY2twb3RBbW91bnRfXwkApAMBBQ1qYWNrcG90QW1vdW50CQDMCAIJAKwCAgIUJXMlZF9fbGFzdEZvbW9UaW1lX18JAKQDAQUMbGFzdEZvbW9UaW1lCQDMCAIJAKwCAgIWJXMlc19fbGFzdEZvbW9QbGF5ZXJfXwUObGFzdEZvbW9QbGF5ZXIJAMwIAgkArAICAhclcyVkX19hbW91bnRMZWZ0VG90YWxfXwkApAMBBQ9hbW91bnRMZWZ0VG90YWwFA25pbAAn9ru2", "height": 3438089, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DQt4xk4Jmmd4G5RqUeFENbHXh7xgRaazXXQ4AFQhFG1i Next: 9JS3dratRqWYXYu5GHpKL1TrT3qzZQBaqioWBgfUaxp5 Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | let lastFomoTimeKey = "lastFomoTime" | |
37 | 37 | ||
38 | 38 | let currentJackpotKey = "currentJackpot" | |
39 | + | ||
40 | + | let lastFomoPlayerKey = "lastFomoPlayer" | |
39 | 41 | ||
40 | 42 | let teamWalletAddrKey = "teamWalletAddr" | |
41 | 43 | ||
86 | 88 | then [ScriptTransfer(i.caller, change, gorcAssetId)] | |
87 | 89 | else nil | |
88 | 90 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
89 | - | let fomoActions = if ((height > (lastFomoTime + FOMO_PERIOD))) | |
90 | - | then { | |
91 | - | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
92 | - | if ((jackpotAmount > 0)) | |
93 | - | then [ScriptTransfer(i.caller, jackpotAmount, gorcAssetId)] | |
94 | - | else nil | |
95 | - | } | |
91 | + | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
92 | + | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
93 | + | let fomoActions = if (if (if ((height > (lastFomoTime + FOMO_PERIOD))) | |
94 | + | then (jackpotAmount > 0) | |
95 | + | else false) | |
96 | + | then (lastFomoPlayer != "") | |
97 | + | else false) | |
98 | + | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId)] | |
96 | 99 | else nil | |
97 | - | (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height)] ++ changeActions) ++ fomoActions) | |
100 | + | (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height), StringEntry(lastFomoPlayerKey, toString(i.caller))] ++ changeActions) ++ fomoActions) | |
98 | 101 | } | |
99 | 102 | } | |
100 | 103 | } | |
129 | 132 | then throw("GORC payments only!") | |
130 | 133 | else { | |
131 | 134 | let addr = toString(i.caller) | |
132 | - | let $ | |
133 | - | let userAmount = $ | |
134 | - | let amountLeftTotal = $ | |
135 | + | let $t053555406 = gorcStats(addr) | |
136 | + | let userAmount = $t053555406._1 | |
137 | + | let amountLeftTotal = $t053555406._2 | |
135 | 138 | let userAmountKey = stakedAmountByUserKey(addr) | |
136 | 139 | let claimActions = if ((userAmount > 0)) | |
137 | 140 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
155 | 158 | if ((0 > (oldAmount - amount))) | |
156 | 159 | then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8))) | |
157 | 160 | else { | |
158 | - | let $ | |
159 | - | let userAmount = $ | |
160 | - | let amountLeftTotal = $ | |
161 | + | let $t063676418 = gorcStats(addr) | |
162 | + | let userAmount = $t063676418._1 | |
163 | + | let amountLeftTotal = $t063676418._2 | |
161 | 164 | let claimActions = if ((userAmount > 0)) | |
162 | 165 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
163 | 166 | else nil | |
173 | 176 | then throw("No payments required") | |
174 | 177 | else { | |
175 | 178 | let addr = toString(i.caller) | |
176 | - | let $ | |
177 | - | let userAmount = $ | |
178 | - | let amountLeftTotal = $ | |
179 | + | let $t069827033 = gorcStats(addr) | |
180 | + | let userAmount = $t069827033._1 | |
181 | + | let amountLeftTotal = $t069827033._2 | |
179 | 182 | let claimActions = if ((userAmount > 0)) | |
180 | 183 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
181 | 184 | else nil | |
196 | 199 | ||
197 | 200 | @Callable(i) | |
198 | 201 | func statsREADONLY (userAddrOpt) = { | |
199 | - | let $ | |
200 | - | let userAmount = $ | |
201 | - | let amountLeftTotal = $ | |
202 | + | let $t074927550 = gorcStats(userAddrOpt) | |
203 | + | let userAmount = $t074927550._1 | |
204 | + | let amountLeftTotal = $t074927550._2 | |
202 | 205 | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
203 | 206 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
204 | - | $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))]) | |
207 | + | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
208 | + | $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%s__lastFomoPlayer__" + lastFomoPlayer), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))]) | |
205 | 209 | } | |
206 | 210 | ||
207 | 211 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let M16 = 10000000000000000 | |
5 | 5 | ||
6 | 6 | let STAKERS_AMOUNT = 1000000000000000 | |
7 | 7 | ||
8 | 8 | let TEAM_AMOUNT = 1000000000000000 | |
9 | 9 | ||
10 | 10 | let MARKET_AMOUNT = 8000000000000000 | |
11 | 11 | ||
12 | 12 | let YEAR_BLOCKS = (365 * 1440) | |
13 | 13 | ||
14 | 14 | let STAKE_PERIOD = (5 * YEAR_BLOCKS) | |
15 | 15 | ||
16 | 16 | let BLESS_PRICE = 100000000000 | |
17 | 17 | ||
18 | 18 | let FOMO_PERIOD = 60 | |
19 | 19 | ||
20 | 20 | let gorcAssetIdKey = "gorcAssetId" | |
21 | 21 | ||
22 | 22 | let gorcAssetId = valueOrErrorMessage(getBinary(gorcAssetIdKey), "GORC is not issued yet") | |
23 | 23 | ||
24 | 24 | let issueTimeKey = "issueTime" | |
25 | 25 | ||
26 | 26 | let stakersAmountLeftKey = "stakersAmountLeft" | |
27 | 27 | ||
28 | 28 | let stakedAmountTotalKey = "stakedTotal" | |
29 | 29 | ||
30 | 30 | func stakedAmountByUserKey (addr) = ("stakedAmount_" + addr) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func lastClaimTimeByUserKey (addr) = ("lastClaimTime_" + addr) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | let lastFomoTimeKey = "lastFomoTime" | |
37 | 37 | ||
38 | 38 | let currentJackpotKey = "currentJackpot" | |
39 | + | ||
40 | + | let lastFomoPlayerKey = "lastFomoPlayer" | |
39 | 41 | ||
40 | 42 | let teamWalletAddrKey = "teamWalletAddr" | |
41 | 43 | ||
42 | 44 | let brokerAddrKey = "brokerAddr" | |
43 | 45 | ||
44 | 46 | func gorcStats (userAddrOpt) = { | |
45 | 47 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
46 | 48 | let lastUserTime = valueOrElse(getInteger(lastClaimTimeByUserKey(userAddrOpt)), -1) | |
47 | 49 | if ((0 > lastUserTime)) | |
48 | 50 | then $Tuple2(0, amountLeftTotal) | |
49 | 51 | else { | |
50 | 52 | let issueTime = valueOrErrorMessage(getInteger(issueTimeKey), "GORC is not issued yet") | |
51 | 53 | let nowLimited = min([height, (issueTime + STAKE_PERIOD)]) | |
52 | 54 | let userShares = valueOrElse(getInteger(stakedAmountByUserKey(userAddrOpt)), 0) | |
53 | 55 | let totalShares = valueOrElse(getInteger(stakedAmountTotalKey), 0) | |
54 | 56 | let userTemporal = fraction(STAKERS_AMOUNT, (nowLimited - lastUserTime), STAKE_PERIOD) | |
55 | 57 | let userAmount = if ((totalShares != 0)) | |
56 | 58 | then fraction(userTemporal, userShares, totalShares) | |
57 | 59 | else 0 | |
58 | 60 | $Tuple2(userAmount, (amountLeftTotal - userAmount)) | |
59 | 61 | } | |
60 | 62 | } | |
61 | 63 | ||
62 | 64 | ||
63 | 65 | func fixedPoint (val,decimals) = { | |
64 | 66 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
65 | 67 | let lowPart = toString((val % tenPow)) | |
66 | 68 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
67 | 69 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
68 | 70 | } | |
69 | 71 | ||
70 | 72 | ||
71 | 73 | func fomoInternal (i) = if ((size(i.payments) != 1)) | |
72 | 74 | then throw("exactly 1 payment must be attached") | |
73 | 75 | else { | |
74 | 76 | let pmt = i.payments[0] | |
75 | 77 | let amt = pmt.amount | |
76 | 78 | if (if (!(isDefined(pmt.assetId))) | |
77 | 79 | then true | |
78 | 80 | else (value(pmt.assetId) != gorcAssetId)) | |
79 | 81 | then throw("GORC payments only!") | |
80 | 82 | else { | |
81 | 83 | let change = (amt - BLESS_PRICE) | |
82 | 84 | if ((0 > change)) | |
83 | 85 | then throw(((("You need to sacrifice " + fixedPoint(BLESS_PRICE, 8)) + " GORC, but I see only ") + fixedPoint(amt, 8))) | |
84 | 86 | else { | |
85 | 87 | let changeActions = if ((change > 0)) | |
86 | 88 | then [ScriptTransfer(i.caller, change, gorcAssetId)] | |
87 | 89 | else nil | |
88 | 90 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
89 | - | let fomoActions = if ((height > (lastFomoTime + FOMO_PERIOD))) | |
90 | - | then { | |
91 | - | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
92 | - | if ((jackpotAmount > 0)) | |
93 | - | then [ScriptTransfer(i.caller, jackpotAmount, gorcAssetId)] | |
94 | - | else nil | |
95 | - | } | |
91 | + | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
92 | + | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
93 | + | let fomoActions = if (if (if ((height > (lastFomoTime + FOMO_PERIOD))) | |
94 | + | then (jackpotAmount > 0) | |
95 | + | else false) | |
96 | + | then (lastFomoPlayer != "") | |
97 | + | else false) | |
98 | + | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId)] | |
96 | 99 | else nil | |
97 | - | (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height)] ++ changeActions) ++ fomoActions) | |
100 | + | (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height), StringEntry(lastFomoPlayerKey, toString(i.caller))] ++ changeActions) ++ fomoActions) | |
98 | 101 | } | |
99 | 102 | } | |
100 | 103 | } | |
101 | 104 | ||
102 | 105 | ||
103 | 106 | @Callable(i) | |
104 | 107 | func testArgs (intVal,strVal,boolVal,binVal,arrInt,arrStr,arrBool,arrBin) = nil | |
105 | 108 | ||
106 | 109 | ||
107 | 110 | ||
108 | 111 | @Callable(i) | |
109 | 112 | func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this)) | |
110 | 113 | then throw("Permission denied") | |
111 | 114 | else { | |
112 | 115 | let issuedAmount = M16 | |
113 | 116 | let issue = Issue("GORC", "Meme coin by God of Random Chance. Visit https://gorc.meme, sacrifice to the God of Random and you will receive an answer to any question or a blessing. Lucky one gets a Gift of God", issuedAmount, 8, false, unit, 0) | |
114 | 117 | let assetId = calculateAssetId(issue) | |
115 | 118 | [issue, BinaryEntry(gorcAssetIdKey, assetId), IntegerEntry(issueTimeKey, height), IntegerEntry(stakersAmountLeftKey, STAKERS_AMOUNT), StringEntry(teamWalletAddrKey, teamWalletAddr), StringEntry(brokerAddrKey, brokerAddr), ScriptTransfer(addressFromStringValue(teamWalletAddr), TEAM_AMOUNT, assetId), ScriptTransfer(addressFromStringValue(brokerAddr), MARKET_AMOUNT, assetId)] | |
116 | 119 | } | |
117 | 120 | ||
118 | 121 | ||
119 | 122 | ||
120 | 123 | @Callable(i) | |
121 | 124 | func stakeGorc () = if ((size(i.payments) != 1)) | |
122 | 125 | then throw("exactly 1 payment must be attached") | |
123 | 126 | else { | |
124 | 127 | let pmt = i.payments[0] | |
125 | 128 | let amt = pmt.amount | |
126 | 129 | if (if (!(isDefined(pmt.assetId))) | |
127 | 130 | then true | |
128 | 131 | else (value(pmt.assetId) != gorcAssetId)) | |
129 | 132 | then throw("GORC payments only!") | |
130 | 133 | else { | |
131 | 134 | let addr = toString(i.caller) | |
132 | - | let $ | |
133 | - | let userAmount = $ | |
134 | - | let amountLeftTotal = $ | |
135 | + | let $t053555406 = gorcStats(addr) | |
136 | + | let userAmount = $t053555406._1 | |
137 | + | let amountLeftTotal = $t053555406._2 | |
135 | 138 | let userAmountKey = stakedAmountByUserKey(addr) | |
136 | 139 | let claimActions = if ((userAmount > 0)) | |
137 | 140 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
138 | 141 | else nil | |
139 | 142 | $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount) | |
140 | 143 | } | |
141 | 144 | } | |
142 | 145 | ||
143 | 146 | ||
144 | 147 | ||
145 | 148 | @Callable(i) | |
146 | 149 | func unstakeGorc (amount) = if ((0 >= amount)) | |
147 | 150 | then throw("Amount should be positive") | |
148 | 151 | else { | |
149 | 152 | let addr = toString(i.caller) | |
150 | 153 | if ((size(i.payments) != 0)) | |
151 | 154 | then throw("No payments required") | |
152 | 155 | else { | |
153 | 156 | let userAmountKey = stakedAmountByUserKey(addr) | |
154 | 157 | let oldAmount = valueOrElse(getInteger(userAmountKey), 0) | |
155 | 158 | if ((0 > (oldAmount - amount))) | |
156 | 159 | then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8))) | |
157 | 160 | else { | |
158 | - | let $ | |
159 | - | let userAmount = $ | |
160 | - | let amountLeftTotal = $ | |
161 | + | let $t063676418 = gorcStats(addr) | |
162 | + | let userAmount = $t063676418._1 | |
163 | + | let amountLeftTotal = $t063676418._2 | |
161 | 164 | let claimActions = if ((userAmount > 0)) | |
162 | 165 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
163 | 166 | else nil | |
164 | 167 | $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0) | |
165 | 168 | } | |
166 | 169 | } | |
167 | 170 | } | |
168 | 171 | ||
169 | 172 | ||
170 | 173 | ||
171 | 174 | @Callable(i) | |
172 | 175 | func claimGorc () = if ((size(i.payments) != 0)) | |
173 | 176 | then throw("No payments required") | |
174 | 177 | else { | |
175 | 178 | let addr = toString(i.caller) | |
176 | - | let $ | |
177 | - | let userAmount = $ | |
178 | - | let amountLeftTotal = $ | |
179 | + | let $t069827033 = gorcStats(addr) | |
180 | + | let userAmount = $t069827033._1 | |
181 | + | let amountLeftTotal = $t069827033._2 | |
179 | 182 | let claimActions = if ((userAmount > 0)) | |
180 | 183 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
181 | 184 | else nil | |
182 | 185 | $Tuple2((claimActions ++ [IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount) | |
183 | 186 | } | |
184 | 187 | ||
185 | 188 | ||
186 | 189 | ||
187 | 190 | @Callable(i) | |
188 | 191 | func answerMe () = $Tuple2(fomoInternal(i), toInt(i.transactionId)) | |
189 | 192 | ||
190 | 193 | ||
191 | 194 | ||
192 | 195 | @Callable(i) | |
193 | 196 | func blessMe () = $Tuple2(fomoInternal(i), 42) | |
194 | 197 | ||
195 | 198 | ||
196 | 199 | ||
197 | 200 | @Callable(i) | |
198 | 201 | func statsREADONLY (userAddrOpt) = { | |
199 | - | let $ | |
200 | - | let userAmount = $ | |
201 | - | let amountLeftTotal = $ | |
202 | + | let $t074927550 = gorcStats(userAddrOpt) | |
203 | + | let userAmount = $t074927550._1 | |
204 | + | let amountLeftTotal = $t074927550._2 | |
202 | 205 | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
203 | 206 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
204 | - | $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))]) | |
207 | + | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
208 | + | $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%s__lastFomoPlayer__" + lastFomoPlayer), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))]) | |
205 | 209 | } | |
206 | 210 | ||
207 | 211 |
github/deemru/w8io/169f3d6 35.20 ms ◑