tx · DQt4xk4Jmmd4G5RqUeFENbHXh7xgRaazXXQ4AFQhFG1i

3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z:  -0.01000000 Waves

2024.12.31 05:02 [3438057] smart account 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z > SELF 0.00000000 Waves

{ "type": 13, "id": "DQt4xk4Jmmd4G5RqUeFENbHXh7xgRaazXXQ4AFQhFG1i", "fee": 1000000, "feeAssetId": null, "timestamp": 1735610590936, "version": 2, "chainId": 84, "sender": "3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z", "senderPublicKey": "5CoDbXxoqnvJpx9GrS6M4G5GYJXh9rcoiXJz7RYTPVkL", "proofs": [ "G4jHRRbub2Jo39Hg2HacUCuJPYTyThVeXSrdbrkusHDnUc2Q7jDMpL6HKLF6mdbieC62QuREtt8kTMmDxcBdUBH" ], "script": "base64:BgImCAISCgoIAQgEAhEYFBISBAoCCAgSABIDCgEBEgASABIAEgMKAQgWAANNMTYAgICE/qbe4READlNUQUtFUlNfQU1PVU5UAICAmqbqr+MBAAtURUFNX0FNT1VOVACAgJqm6q/jAQANTUFSS0VUX0FNT1VOVACAgNCx0v6aDgALWUVBUl9CTE9DS1MJAGgCAO0CAKALAAxTVEFLRV9QRVJJT0QJAGgCAAUFC1lFQVJfQkxPQ0tTAAtCTEVTU19QUklDRQCA0NvD9AIAC0ZPTU9fUEVSSU9EADwADmdvcmNBc3NldElkS2V5Agtnb3JjQXNzZXRJZAALZ29yY0Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAoQgBBQ5nb3JjQXNzZXRJZEtleQIWR09SQyBpcyBub3QgaXNzdWVkIHlldAAMaXNzdWVUaW1lS2V5Aglpc3N1ZVRpbWUAFHN0YWtlcnNBbW91bnRMZWZ0S2V5AhFzdGFrZXJzQW1vdW50TGVmdAAUc3Rha2VkQW1vdW50VG90YWxLZXkCC3N0YWtlZFRvdGFsARVzdGFrZWRBbW91bnR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vdGFsX18JAKQDAQUPYW1vdW50TGVmdFRvdGFsBQNuaWwAwNEaOQ==", "height": 3438057, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 313dui9xvkTyESCyFrLr3X3YvrmiX2FTR7HF4iY6sXFW Next: AmxgdiqTBFbeeWbRqAzCtMKSk4Q6XAiZQuUCQj2CZcKs Diff:
OldNewDifferences
3030 func stakedAmountByUserKey (addr) = ("stakedAmount_" + addr)
3131
3232
33-func keyLastClaimTimeByUser (addr) = ("lastClaimTime_" + addr)
33+func lastClaimTimeByUserKey (addr) = ("lastClaimTime_" + addr)
3434
3535
3636 let lastFomoTimeKey = "lastFomoTime"
3737
3838 let currentJackpotKey = "currentJackpot"
3939
40+let teamWalletAddrKey = "teamWalletAddr"
41+
42+let brokerAddrKey = "brokerAddr"
43+
4044 func gorcStats (userAddrOpt) = {
4145 let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0)
42- let lastUserTime = valueOrElse(getInteger(keyLastClaimTimeByUser(userAddrOpt)), -1)
46+ let lastUserTime = valueOrElse(getInteger(lastClaimTimeByUserKey(userAddrOpt)), -1)
4347 if ((0 > lastUserTime))
4448 then $Tuple2(0, amountLeftTotal)
4549 else {
108112 let issuedAmount = M16
109113 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)
110114 let assetId = calculateAssetId(issue)
111-[issue, BinaryEntry(gorcAssetIdKey, assetId), IntegerEntry(issueTimeKey, height), IntegerEntry(stakersAmountLeftKey, STAKERS_AMOUNT), ScriptTransfer(addressFromStringValue(teamWalletAddr), TEAM_AMOUNT, assetId), ScriptTransfer(addressFromStringValue(brokerAddr), MARKET_AMOUNT, assetId)]
115+[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)]
112116 }
113117
114118
125129 then throw("GORC payments only!")
126130 else {
127131 let addr = toString(i.caller)
128- let $t050115062 = gorcStats(addr)
129- let userAmount = $t050115062._1
130- let amountLeftTotal = $t050115062._2
132+ let $t051815232 = gorcStats(addr)
133+ let userAmount = $t051815232._1
134+ let amountLeftTotal = $t051815232._2
131135 let userAmountKey = stakedAmountByUserKey(addr)
132136 let claimActions = if ((userAmount > 0))
133137 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
134138 else nil
135- $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
139+ $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
136140 }
137141 }
138142
151155 if ((0 > (oldAmount - amount)))
152156 then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8)))
153157 else {
154- let $t060236074 = gorcStats(addr)
155- let userAmount = $t060236074._1
156- let amountLeftTotal = $t060236074._2
158+ let $t061936244 = gorcStats(addr)
159+ let userAmount = $t061936244._1
160+ let amountLeftTotal = $t061936244._2
157161 let claimActions = if ((userAmount > 0))
158162 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
159163 else nil
160- $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0)
164+ $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0)
161165 }
162166 }
163167 }
169173 then throw("No payments required")
170174 else {
171175 let addr = toString(i.caller)
172- let $t066386689 = gorcStats(addr)
173- let userAmount = $t066386689._1
174- let amountLeftTotal = $t066386689._2
176+ let $t068086859 = gorcStats(addr)
177+ let userAmount = $t068086859._1
178+ let amountLeftTotal = $t068086859._2
175179 let claimActions = if ((userAmount > 0))
176180 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
177181 else nil
178- $Tuple2((claimActions ++ [IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
182+ $Tuple2((claimActions ++ [IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
179183 }
180184
181185
192196
193197 @Callable(i)
194198 func statsREADONLY (userAddrOpt) = {
195- let $t071487206 = gorcStats(userAddrOpt)
196- let userAmount = $t071487206._1
197- let amountLeftTotal = $t071487206._2
199+ let $t073187376 = gorcStats(userAddrOpt)
200+ let userAmount = $t073187376._1
201+ let amountLeftTotal = $t073187376._2
198202 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
199203 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
200204 $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))])
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let M16 = 10000000000000000
55
66 let STAKERS_AMOUNT = 1000000000000000
77
88 let TEAM_AMOUNT = 1000000000000000
99
1010 let MARKET_AMOUNT = 8000000000000000
1111
1212 let YEAR_BLOCKS = (365 * 1440)
1313
1414 let STAKE_PERIOD = (5 * YEAR_BLOCKS)
1515
1616 let BLESS_PRICE = 100000000000
1717
1818 let FOMO_PERIOD = 60
1919
2020 let gorcAssetIdKey = "gorcAssetId"
2121
2222 let gorcAssetId = valueOrErrorMessage(getBinary(gorcAssetIdKey), "GORC is not issued yet")
2323
2424 let issueTimeKey = "issueTime"
2525
2626 let stakersAmountLeftKey = "stakersAmountLeft"
2727
2828 let stakedAmountTotalKey = "stakedTotal"
2929
3030 func stakedAmountByUserKey (addr) = ("stakedAmount_" + addr)
3131
3232
33-func keyLastClaimTimeByUser (addr) = ("lastClaimTime_" + addr)
33+func lastClaimTimeByUserKey (addr) = ("lastClaimTime_" + addr)
3434
3535
3636 let lastFomoTimeKey = "lastFomoTime"
3737
3838 let currentJackpotKey = "currentJackpot"
3939
40+let teamWalletAddrKey = "teamWalletAddr"
41+
42+let brokerAddrKey = "brokerAddr"
43+
4044 func gorcStats (userAddrOpt) = {
4145 let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0)
42- let lastUserTime = valueOrElse(getInteger(keyLastClaimTimeByUser(userAddrOpt)), -1)
46+ let lastUserTime = valueOrElse(getInteger(lastClaimTimeByUserKey(userAddrOpt)), -1)
4347 if ((0 > lastUserTime))
4448 then $Tuple2(0, amountLeftTotal)
4549 else {
4650 let issueTime = valueOrErrorMessage(getInteger(issueTimeKey), "GORC is not issued yet")
4751 let nowLimited = min([height, (issueTime + STAKE_PERIOD)])
4852 let userShares = valueOrElse(getInteger(stakedAmountByUserKey(userAddrOpt)), 0)
4953 let totalShares = valueOrElse(getInteger(stakedAmountTotalKey), 0)
5054 let userTemporal = fraction(STAKERS_AMOUNT, (nowLimited - lastUserTime), STAKE_PERIOD)
5155 let userAmount = if ((totalShares != 0))
5256 then fraction(userTemporal, userShares, totalShares)
5357 else 0
5458 $Tuple2(userAmount, (amountLeftTotal - userAmount))
5559 }
5660 }
5761
5862
5963 func fixedPoint (val,decimals) = {
6064 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
6165 let lowPart = toString((val % tenPow))
6266 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
6367 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
6468 }
6569
6670
6771 func fomoInternal (i) = if ((size(i.payments) != 1))
6872 then throw("exactly 1 payment must be attached")
6973 else {
7074 let pmt = i.payments[0]
7175 let amt = pmt.amount
7276 if (if (!(isDefined(pmt.assetId)))
7377 then true
7478 else (value(pmt.assetId) != gorcAssetId))
7579 then throw("GORC payments only!")
7680 else {
7781 let change = (amt - BLESS_PRICE)
7882 if ((0 > change))
7983 then throw(((("You need to sacrifice " + fixedPoint(BLESS_PRICE, 8)) + " GORC, but I see only ") + fixedPoint(amt, 8)))
8084 else {
8185 let changeActions = if ((change > 0))
8286 then [ScriptTransfer(i.caller, change, gorcAssetId)]
8387 else nil
8488 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
8589 let fomoActions = if ((height > (lastFomoTime + FOMO_PERIOD)))
8690 then {
8791 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
8892 if ((jackpotAmount > 0))
8993 then [ScriptTransfer(i.caller, jackpotAmount, gorcAssetId)]
9094 else nil
9195 }
9296 else nil
9397 (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height)] ++ changeActions) ++ fomoActions)
9498 }
9599 }
96100 }
97101
98102
99103 @Callable(i)
100104 func testArgs (intVal,strVal,boolVal,binVal,arrInt,arrStr,arrBool,arrBin) = nil
101105
102106
103107
104108 @Callable(i)
105109 func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this))
106110 then throw("Permission denied")
107111 else {
108112 let issuedAmount = M16
109113 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)
110114 let assetId = calculateAssetId(issue)
111-[issue, BinaryEntry(gorcAssetIdKey, assetId), IntegerEntry(issueTimeKey, height), IntegerEntry(stakersAmountLeftKey, STAKERS_AMOUNT), ScriptTransfer(addressFromStringValue(teamWalletAddr), TEAM_AMOUNT, assetId), ScriptTransfer(addressFromStringValue(brokerAddr), MARKET_AMOUNT, assetId)]
115+[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)]
112116 }
113117
114118
115119
116120 @Callable(i)
117121 func stakeGorc () = if ((size(i.payments) != 1))
118122 then throw("exactly 1 payment must be attached")
119123 else {
120124 let pmt = i.payments[0]
121125 let amt = pmt.amount
122126 if (if (!(isDefined(pmt.assetId)))
123127 then true
124128 else (value(pmt.assetId) != gorcAssetId))
125129 then throw("GORC payments only!")
126130 else {
127131 let addr = toString(i.caller)
128- let $t050115062 = gorcStats(addr)
129- let userAmount = $t050115062._1
130- let amountLeftTotal = $t050115062._2
132+ let $t051815232 = gorcStats(addr)
133+ let userAmount = $t051815232._1
134+ let amountLeftTotal = $t051815232._2
131135 let userAmountKey = stakedAmountByUserKey(addr)
132136 let claimActions = if ((userAmount > 0))
133137 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
134138 else nil
135- $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
139+ $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
136140 }
137141 }
138142
139143
140144
141145 @Callable(i)
142146 func unstakeGorc (amount) = if ((0 >= amount))
143147 then throw("Amount should be positive")
144148 else {
145149 let addr = toString(i.caller)
146150 if ((size(i.payments) != 0))
147151 then throw("No payments required")
148152 else {
149153 let userAmountKey = stakedAmountByUserKey(addr)
150154 let oldAmount = valueOrElse(getInteger(userAmountKey), 0)
151155 if ((0 > (oldAmount - amount)))
152156 then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8)))
153157 else {
154- let $t060236074 = gorcStats(addr)
155- let userAmount = $t060236074._1
156- let amountLeftTotal = $t060236074._2
158+ let $t061936244 = gorcStats(addr)
159+ let userAmount = $t061936244._1
160+ let amountLeftTotal = $t061936244._2
157161 let claimActions = if ((userAmount > 0))
158162 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
159163 else nil
160- $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0)
164+ $Tuple2((claimActions ++ [IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), 0)
161165 }
162166 }
163167 }
164168
165169
166170
167171 @Callable(i)
168172 func claimGorc () = if ((size(i.payments) != 0))
169173 then throw("No payments required")
170174 else {
171175 let addr = toString(i.caller)
172- let $t066386689 = gorcStats(addr)
173- let userAmount = $t066386689._1
174- let amountLeftTotal = $t066386689._2
176+ let $t068086859 = gorcStats(addr)
177+ let userAmount = $t068086859._1
178+ let amountLeftTotal = $t068086859._2
175179 let claimActions = if ((userAmount > 0))
176180 then [ScriptTransfer(i.caller, userAmount, gorcAssetId)]
177181 else nil
178- $Tuple2((claimActions ++ [IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
182+ $Tuple2((claimActions ++ [IntegerEntry(lastClaimTimeByUserKey(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)]), userAmount)
179183 }
180184
181185
182186
183187 @Callable(i)
184188 func answerMe () = $Tuple2(fomoInternal(i), toInt(i.transactionId))
185189
186190
187191
188192 @Callable(i)
189193 func blessMe () = $Tuple2(fomoInternal(i), 42)
190194
191195
192196
193197 @Callable(i)
194198 func statsREADONLY (userAddrOpt) = {
195- let $t071487206 = gorcStats(userAddrOpt)
196- let userAmount = $t071487206._1
197- let amountLeftTotal = $t071487206._2
199+ let $t073187376 = gorcStats(userAddrOpt)
200+ let userAmount = $t073187376._1
201+ let amountLeftTotal = $t073187376._2
198202 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
199203 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
200204 $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))])
201205 }
202206
203207

github/deemru/w8io/169f3d6 
40.35 ms