tx · 9JS3dratRqWYXYu5GHpKL1TrT3qzZQBaqioWBgfUaxp5 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z: -0.01000000 Waves 2024.12.31 05:40 [3438094] smart account 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z > SELF 0.00000000 Waves
{ "type": 13, "id": "9JS3dratRqWYXYu5GHpKL1TrT3qzZQBaqioWBgfUaxp5", "fee": 1000000, "feeAssetId": null, "timestamp": 1735612899519, "version": 2, "chainId": 84, "sender": "3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z", "senderPublicKey": "5CoDbXxoqnvJpx9GrS6M4G5GYJXh9rcoiXJz7RYTPVkL", "proofs": [ "2ruM6eSaBv3PShcGJ53rwJM2SdpE4ndPv7oZ6shv3wCRibaGm3tk4VinWf8rVSonqGa9oraoNrLoZj8mWQfKemXZ" ], "script": "base64:BgImCAISCgoIAQgEAhEYFBISBAoCCAgSABIDCgEBEgASABIAEgMKAQgXAANNMTYAgICE/qbe4READlNUQUtFUlNfQU1PVU5UAICAmqbqr+MBAAtURUFNX0FNT1VOVACAgJqm6q/jAQANTUFSS0VUX0FNT1VOVACAgNCx0v6aDgALWUVBUl9CTE9DS1MJAGgCAO0CAKALAAxTVEFLRV9QRVJJT0QJAGgCAAUFC1lFQVJfQkxPQ0tTAAtCTEVTU19QUklDRQCA0NvD9AIAC0ZPTU9fUEVSSU9EADwADmdvcmNBc3NldElkS2V5Agtnb3JjQXNzZXRJZAALZ29yY0Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAoQgBBQ5nb3JjQXNzZXRJZEtleQIWR09SQyBpcyBub3QgaXNzdWVkIHlldAAMaXNzdWVUaW1lS2V5Aglpc3N1ZVRpbWUAFHN0YWtlcnNBbW91bnRMZWZ0S2V5AhFzdGFrZXJzQW1vdW50TGVmdAAUc3Rha2VkQW1vdW50VG90YWxLZXkCC3N0YWtlZFRvdGFsARVzdGFrZWRBbW91bnRCeVVz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2UCCQCfCAEFEWN1cnJlbnRKYWNrcG90S2V5AAAEDGxhc3RGb21vVGltZQkBC3ZhbHVlT3JFbHNlAgkAnwgBBQ9sYXN0Rm9tb1RpbWVLZXkAAAQObGFzdEZvbW9QbGF5ZXIJAQt2YWx1ZU9yRWxzZQIJAKIIAQURbGFzdEZvbW9QbGF5ZXJLZXkCAAkAlAoCBQNuaWwJAMwIAgkArAICAhglcyVkX19nb3JjQXZhaWxUb0NsYWltX18JAKQDAQUKdXNlckFtb3VudAkAzAgCCQCsAgICFSVzJWRfX2phY2twb3RBbW91bnRfXwkApAMBBQ1qYWNrcG90QW1vdW50CQDMCAIJAKwCAgIUJXMlZF9fbGFzdEZvbW9UaW1lX18JAKQDAQUMbGFzdEZvbW9UaW1lCQDMCAIJAKwCAgIWJXMlc19fbGFzdEZvbW9QbGF5ZXJfXwUObGFzdEZvbW9QbGF5ZXIJAMwIAgkArAICAhclcyVkX19hbW91bnRMZWZ0VG90YWxfXwkApAMBBQ9hbW91bnRMZWZ0VG90YWwFA25pbABrjq1W", "height": 3438094, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AmxgdiqTBFbeeWbRqAzCtMKSk4Q6XAiZQuUCQj2CZcKs Next: 6ozQ3mkGfpZQNF9Jy1XBNJVvR2c33mQKVpvSyFMXm2uq Diff:
Old | New | Differences | |
---|---|---|---|
95 | 95 | else false) | |
96 | 96 | then (lastFomoPlayer != "") | |
97 | 97 | else false) | |
98 | - | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId)] | |
99 | - | else | |
100 | - | (([ | |
98 | + | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId), IntegerEntry(currentJackpotKey, BLESS_PRICE)] | |
99 | + | else [IntegerEntry(currentJackpotKey, (jackpotAmount + BLESS_PRICE))] | |
100 | + | (([IntegerEntry(lastFomoTimeKey, height), StringEntry(lastFomoPlayerKey, toString(i.caller))] ++ changeActions) ++ fomoActions) | |
101 | 101 | } | |
102 | 102 | } | |
103 | 103 | } | |
132 | 132 | then throw("GORC payments only!") | |
133 | 133 | else { | |
134 | 134 | let addr = toString(i.caller) | |
135 | - | let $ | |
136 | - | let userAmount = $ | |
137 | - | let amountLeftTotal = $ | |
135 | + | let $t054215472 = gorcStats(addr) | |
136 | + | let userAmount = $t054215472._1 | |
137 | + | let amountLeftTotal = $t054215472._2 | |
138 | 138 | let userAmountKey = stakedAmountByUserKey(addr) | |
139 | 139 | let claimActions = if ((userAmount > 0)) | |
140 | 140 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
158 | 158 | if ((0 > (oldAmount - amount))) | |
159 | 159 | then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8))) | |
160 | 160 | else { | |
161 | - | let $ | |
162 | - | let userAmount = $ | |
163 | - | let amountLeftTotal = $ | |
161 | + | let $t064336484 = gorcStats(addr) | |
162 | + | let userAmount = $t064336484._1 | |
163 | + | let amountLeftTotal = $t064336484._2 | |
164 | 164 | let claimActions = if ((userAmount > 0)) | |
165 | 165 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
166 | 166 | else nil | |
176 | 176 | then throw("No payments required") | |
177 | 177 | else { | |
178 | 178 | let addr = toString(i.caller) | |
179 | - | let $ | |
180 | - | let userAmount = $ | |
181 | - | let amountLeftTotal = $ | |
179 | + | let $t070487099 = gorcStats(addr) | |
180 | + | let userAmount = $t070487099._1 | |
181 | + | let amountLeftTotal = $t070487099._2 | |
182 | 182 | let claimActions = if ((userAmount > 0)) | |
183 | 183 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
184 | 184 | else nil | |
199 | 199 | ||
200 | 200 | @Callable(i) | |
201 | 201 | func statsREADONLY (userAddrOpt) = { | |
202 | - | let $ | |
203 | - | let userAmount = $ | |
204 | - | let amountLeftTotal = $ | |
202 | + | let $t075587616 = gorcStats(userAddrOpt) | |
203 | + | let userAmount = $t075587616._1 | |
204 | + | let amountLeftTotal = $t075587616._2 | |
205 | 205 | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
206 | 206 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
207 | 207 | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") |
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 | 39 | ||
40 | 40 | let lastFomoPlayerKey = "lastFomoPlayer" | |
41 | 41 | ||
42 | 42 | let teamWalletAddrKey = "teamWalletAddr" | |
43 | 43 | ||
44 | 44 | let brokerAddrKey = "brokerAddr" | |
45 | 45 | ||
46 | 46 | func gorcStats (userAddrOpt) = { | |
47 | 47 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
48 | 48 | let lastUserTime = valueOrElse(getInteger(lastClaimTimeByUserKey(userAddrOpt)), -1) | |
49 | 49 | if ((0 > lastUserTime)) | |
50 | 50 | then $Tuple2(0, amountLeftTotal) | |
51 | 51 | else { | |
52 | 52 | let issueTime = valueOrErrorMessage(getInteger(issueTimeKey), "GORC is not issued yet") | |
53 | 53 | let nowLimited = min([height, (issueTime + STAKE_PERIOD)]) | |
54 | 54 | let userShares = valueOrElse(getInteger(stakedAmountByUserKey(userAddrOpt)), 0) | |
55 | 55 | let totalShares = valueOrElse(getInteger(stakedAmountTotalKey), 0) | |
56 | 56 | let userTemporal = fraction(STAKERS_AMOUNT, (nowLimited - lastUserTime), STAKE_PERIOD) | |
57 | 57 | let userAmount = if ((totalShares != 0)) | |
58 | 58 | then fraction(userTemporal, userShares, totalShares) | |
59 | 59 | else 0 | |
60 | 60 | $Tuple2(userAmount, (amountLeftTotal - userAmount)) | |
61 | 61 | } | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func fixedPoint (val,decimals) = { | |
66 | 66 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
67 | 67 | let lowPart = toString((val % tenPow)) | |
68 | 68 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
69 | 69 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func fomoInternal (i) = if ((size(i.payments) != 1)) | |
74 | 74 | then throw("exactly 1 payment must be attached") | |
75 | 75 | else { | |
76 | 76 | let pmt = i.payments[0] | |
77 | 77 | let amt = pmt.amount | |
78 | 78 | if (if (!(isDefined(pmt.assetId))) | |
79 | 79 | then true | |
80 | 80 | else (value(pmt.assetId) != gorcAssetId)) | |
81 | 81 | then throw("GORC payments only!") | |
82 | 82 | else { | |
83 | 83 | let change = (amt - BLESS_PRICE) | |
84 | 84 | if ((0 > change)) | |
85 | 85 | then throw(((("You need to sacrifice " + fixedPoint(BLESS_PRICE, 8)) + " GORC, but I see only ") + fixedPoint(amt, 8))) | |
86 | 86 | else { | |
87 | 87 | let changeActions = if ((change > 0)) | |
88 | 88 | then [ScriptTransfer(i.caller, change, gorcAssetId)] | |
89 | 89 | else nil | |
90 | 90 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
91 | 91 | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
92 | 92 | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
93 | 93 | let fomoActions = if (if (if ((height > (lastFomoTime + FOMO_PERIOD))) | |
94 | 94 | then (jackpotAmount > 0) | |
95 | 95 | else false) | |
96 | 96 | then (lastFomoPlayer != "") | |
97 | 97 | else false) | |
98 | - | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId)] | |
99 | - | else | |
100 | - | (([ | |
98 | + | then [ScriptTransfer(addressFromStringValue(lastFomoPlayer), jackpotAmount, gorcAssetId), IntegerEntry(currentJackpotKey, BLESS_PRICE)] | |
99 | + | else [IntegerEntry(currentJackpotKey, (jackpotAmount + BLESS_PRICE))] | |
100 | + | (([IntegerEntry(lastFomoTimeKey, height), StringEntry(lastFomoPlayerKey, toString(i.caller))] ++ changeActions) ++ fomoActions) | |
101 | 101 | } | |
102 | 102 | } | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(i) | |
107 | 107 | func testArgs (intVal,strVal,boolVal,binVal,arrInt,arrStr,arrBool,arrBin) = nil | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | @Callable(i) | |
112 | 112 | func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this)) | |
113 | 113 | then throw("Permission denied") | |
114 | 114 | else { | |
115 | 115 | let issuedAmount = M16 | |
116 | 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) | |
117 | 117 | let assetId = calculateAssetId(issue) | |
118 | 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)] | |
119 | 119 | } | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func stakeGorc () = if ((size(i.payments) != 1)) | |
125 | 125 | then throw("exactly 1 payment must be attached") | |
126 | 126 | else { | |
127 | 127 | let pmt = i.payments[0] | |
128 | 128 | let amt = pmt.amount | |
129 | 129 | if (if (!(isDefined(pmt.assetId))) | |
130 | 130 | then true | |
131 | 131 | else (value(pmt.assetId) != gorcAssetId)) | |
132 | 132 | then throw("GORC payments only!") | |
133 | 133 | else { | |
134 | 134 | let addr = toString(i.caller) | |
135 | - | let $ | |
136 | - | let userAmount = $ | |
137 | - | let amountLeftTotal = $ | |
135 | + | let $t054215472 = gorcStats(addr) | |
136 | + | let userAmount = $t054215472._1 | |
137 | + | let amountLeftTotal = $t054215472._2 | |
138 | 138 | let userAmountKey = stakedAmountByUserKey(addr) | |
139 | 139 | let claimActions = if ((userAmount > 0)) | |
140 | 140 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
141 | 141 | else nil | |
142 | 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) | |
143 | 143 | } | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | 148 | @Callable(i) | |
149 | 149 | func unstakeGorc (amount) = if ((0 >= amount)) | |
150 | 150 | then throw("Amount should be positive") | |
151 | 151 | else { | |
152 | 152 | let addr = toString(i.caller) | |
153 | 153 | if ((size(i.payments) != 0)) | |
154 | 154 | then throw("No payments required") | |
155 | 155 | else { | |
156 | 156 | let userAmountKey = stakedAmountByUserKey(addr) | |
157 | 157 | let oldAmount = valueOrElse(getInteger(userAmountKey), 0) | |
158 | 158 | if ((0 > (oldAmount - amount))) | |
159 | 159 | then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8))) | |
160 | 160 | else { | |
161 | - | let $ | |
162 | - | let userAmount = $ | |
163 | - | let amountLeftTotal = $ | |
161 | + | let $t064336484 = gorcStats(addr) | |
162 | + | let userAmount = $t064336484._1 | |
163 | + | let amountLeftTotal = $t064336484._2 | |
164 | 164 | let claimActions = if ((userAmount > 0)) | |
165 | 165 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
166 | 166 | else nil | |
167 | 167 | $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0) | |
168 | 168 | } | |
169 | 169 | } | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(i) | |
175 | 175 | func claimGorc () = if ((size(i.payments) != 0)) | |
176 | 176 | then throw("No payments required") | |
177 | 177 | else { | |
178 | 178 | let addr = toString(i.caller) | |
179 | - | let $ | |
180 | - | let userAmount = $ | |
181 | - | let amountLeftTotal = $ | |
179 | + | let $t070487099 = gorcStats(addr) | |
180 | + | let userAmount = $t070487099._1 | |
181 | + | let amountLeftTotal = $t070487099._2 | |
182 | 182 | let claimActions = if ((userAmount > 0)) | |
183 | 183 | then [ScriptTransfer(i.caller, userAmount, gorcAssetId)] | |
184 | 184 | else nil | |
185 | 185 | $Tuple2((claimActions ++ [IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount) | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(i) | |
191 | 191 | func answerMe () = $Tuple2(fomoInternal(i), toInt(i.transactionId)) | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | ||
195 | 195 | @Callable(i) | |
196 | 196 | func blessMe () = $Tuple2(fomoInternal(i), 42) | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | ||
200 | 200 | @Callable(i) | |
201 | 201 | func statsREADONLY (userAddrOpt) = { | |
202 | - | let $ | |
203 | - | let userAmount = $ | |
204 | - | let amountLeftTotal = $ | |
202 | + | let $t075587616 = gorcStats(userAddrOpt) | |
203 | + | let userAmount = $t075587616._1 | |
204 | + | let amountLeftTotal = $t075587616._2 | |
205 | 205 | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
206 | 206 | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
207 | 207 | let lastFomoPlayer = valueOrElse(getString(lastFomoPlayerKey), "") | |
208 | 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))]) | |
209 | 209 | } | |
210 | 210 | ||
211 | 211 |
github/deemru/w8io/169f3d6 35.56 ms ◑