tx · GrEfnBjnMB6CdYR3WTQrMS3qAjaq8UBDJHNTtoSy4BGw

3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z:  -0.01000000 Waves

2024.12.31 04:31 [3438025] smart account 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z > SELF 0.00000000 Waves

{ "type": 13, "id": "GrEfnBjnMB6CdYR3WTQrMS3qAjaq8UBDJHNTtoSy4BGw", "fee": 1000000, "feeAssetId": null, "timestamp": 1735608658447, "version": 2, "chainId": 84, "sender": "3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z", "senderPublicKey": "5CoDbXxoqnvJpx9GrS6M4G5GYJXh9rcoiXJz7RYTPVkL", "proofs": [ "2McSmkYVD7xsrwerGRRCB3UEEnNtXAGSJmzbxmAFyQk2V6x1sfNuhLU6a8eW6WCxD1pgaW1ckVxQLconE3RuC7rd" ], "script": "base64:BgImCAISCgoIAQgEAhEYFBISBAoCCAgSABIDCgEBEgASABIAEgMKAQgUAANNMTYAgICE/qbe4READlNUQUtFUlNfQU1PVU5UAICAmqbqr+MBAAtURUFNX0FNT1VOVACAgJqm6q/jAQANTUFSS0VUX0FNT1VOVACAgNCx0v6aDgALWUVBUl9CTE9DS1MJAGgCAO0CAKALAAxTVEFLRV9QRVJJT0QJAGgCAAUFC1lFQVJfQkxPQ0tTAAtCTEVTU19QUklDRQCA0NvD9AIAC0ZPTU9fUEVSSU9EADwADmdvcmNBc3NldElkS2V5Agtnb3JjQXNzZXRJZAALZ29yY0Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAoQgBBQ5nb3JjQXNzZXRJZEtleQIWR09SQyBpcyBub3QgaXNzdWVkIHlldAAMaXNzdWVUaW1lS2V5Aglpc3N1ZVRpbWUAFHN0YWtlcnNBbW91bnRMZWZ0S2V5AhFzdGFrZXJzQW1vdW50TGVmdAAUc3Rha2VkQW1vdW50VG90YWxLZXkCC3N0YWtlZFRvdGFsARVzdGFrZWRBbW91b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QBaQEHYmxlc3NNZQAJAJQKAgkBDGZvbW9JbnRlcm5hbAEFAWkAKgFpAQ1zdGF0c1JFQURPTkxZAQt1c2VyQWRkck9wdAQLJHQwNjk0NzcwMDUJAQlnb3JjU3RhdHMBBQt1c2VyQWRkck9wdAQKdXNlckFtb3VudAgFCyR0MDY5NDc3MDA1Al8xBA9hbW91bnRMZWZ0VG90YWwIBQskdDA2OTQ3NzAwNQJfMgQNamFja3BvdEFtb3VudAkBC3ZhbHVlT3JFbHNlAgkAnwgBBRFjdXJyZW50SmFja3BvdEtleQAABAxsYXN0Rm9tb1RpbWUJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUPbGFzdEZvbW9UaW1lS2V5AAAJAJQKAgUDbmlsCQDMCAIJAKwCAgIYJXMlZF9fZ29yY0F2YWlsVG9DbGFpbV9fCQCkAwEFCnVzZXJBbW91bnQJAMwIAgkArAICAhUlcyVkX19qYWNrcG90QW1vdW50X18JAKQDAQUNamFja3BvdEFtb3VudAkAzAgCCQCsAgICFCVzJWRfX2xhc3RGb21vVGltZV9fCQCkAwEFDGxhc3RGb21vVGltZQkAzAgCCQCsAgICFyVzJWRfX2Ftb3VudExlZnRUb3RhbF9fCQCkAwEFD2Ftb3VudExlZnRUb3RhbAUDbmlsAEBKdDo=", "height": 3438025, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9v6YSerM4jk41h3kEvSxwgg5rBD5QeQ9kqetHRVx4NqL Next: 313dui9xvkTyESCyFrLr3X3YvrmiX2FTR7HF4iY6sXFW Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let M8 = 100000000
4+let M16 = 10000000000000000
55
6-let STAKERS_AMOUNT = 10000000
6+let STAKERS_AMOUNT = 1000000000000000
77
8-let TEAM_AMOUNT = 10000000
8+let TEAM_AMOUNT = 1000000000000000
99
10-let MARKET_AMOUNT = 80000000
10+let MARKET_AMOUNT = 8000000000000000
1111
1212 let YEAR_BLOCKS = (365 * 1440)
1313
105105 func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this))
106106 then throw("Permission denied")
107107 else {
108- let issuedAmount = M8
108+ let issuedAmount = M16
109109 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)
110110 let assetId = calculateAssetId(issue)
111111 [issue, BinaryEntry(gorcAssetIdKey, assetId), IntegerEntry(issueTimeKey, height), IntegerEntry(stakersAmountLeftKey, STAKERS_AMOUNT), ScriptTransfer(addressFromStringValue(teamWalletAddr), TEAM_AMOUNT, assetId), ScriptTransfer(addressFromStringValue(brokerAddr), MARKET_AMOUNT, assetId)]
125125 then throw("GORC payments only!")
126126 else {
127127 let addr = toString(i.caller)
128- let $t049695020 = gorcStats(addr)
129- let userAmount = $t049695020._1
130- let amountLeftTotal = $t049695020._2
128+ let $t050115062 = gorcStats(addr)
129+ let userAmount = $t050115062._1
130+ let amountLeftTotal = $t050115062._2
131131 let userAmountKey = stakedAmountByUserKey(addr)
132132 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], userAmount)
133133 }
148148 if ((0 > (oldAmount - amount)))
149149 then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8)))
150150 else {
151- let $t059145965 = gorcStats(addr)
152- let userAmount = $t059145965._1
153- let amountLeftTotal = $t059145965._2
151+ let $t059566007 = gorcStats(addr)
152+ let userAmount = $t059566007._1
153+ let amountLeftTotal = $t059566007._2
154154 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], 0)
155155 }
156156 }
163163 then throw("No payments required")
164164 else {
165165 let addr = toString(i.caller)
166- let $t064626513 = gorcStats(addr)
167- let userAmount = $t064626513._1
168- let amountLeftTotal = $t064626513._2
166+ let $t065046555 = gorcStats(addr)
167+ let userAmount = $t065046555._1
168+ let amountLeftTotal = $t065046555._2
169169 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], userAmount)
170170 }
171171
183183
184184 @Callable(i)
185185 func statsREADONLY (userAddrOpt) = {
186- let $t069056963 = gorcStats(userAddrOpt)
187- let userAmount = $t069056963._1
188- let amountLeftTotal = $t069056963._2
186+ let $t069477005 = gorcStats(userAddrOpt)
187+ let userAmount = $t069477005._1
188+ let amountLeftTotal = $t069477005._2
189189 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
190190 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
191191 $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 #-}
4-let M8 = 100000000
4+let M16 = 10000000000000000
55
6-let STAKERS_AMOUNT = 10000000
6+let STAKERS_AMOUNT = 1000000000000000
77
8-let TEAM_AMOUNT = 10000000
8+let TEAM_AMOUNT = 1000000000000000
99
10-let MARKET_AMOUNT = 80000000
10+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
3333 func keyLastClaimTimeByUser (addr) = ("lastClaimTime_" + addr)
3434
3535
3636 let lastFomoTimeKey = "lastFomoTime"
3737
3838 let currentJackpotKey = "currentJackpot"
3939
4040 func gorcStats (userAddrOpt) = {
4141 let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0)
4242 let lastUserTime = valueOrElse(getInteger(keyLastClaimTimeByUser(userAddrOpt)), -1)
4343 if ((0 > lastUserTime))
4444 then $Tuple2(0, amountLeftTotal)
4545 else {
4646 let issueTime = valueOrErrorMessage(getInteger(issueTimeKey), "GORC is not issued yet")
4747 let nowLimited = min([height, (issueTime + STAKE_PERIOD)])
4848 let userShares = valueOrElse(getInteger(stakedAmountByUserKey(userAddrOpt)), 0)
4949 let totalShares = valueOrElse(getInteger(stakedAmountTotalKey), 0)
5050 let userTemporal = fraction(STAKERS_AMOUNT, (nowLimited - lastUserTime), STAKE_PERIOD)
5151 let userAmount = if ((totalShares != 0))
5252 then fraction(userTemporal, userShares, totalShares)
5353 else 0
5454 $Tuple2(userAmount, (amountLeftTotal - userAmount))
5555 }
5656 }
5757
5858
5959 func fixedPoint (val,decimals) = {
6060 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
6161 let lowPart = toString((val % tenPow))
6262 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
6363 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
6464 }
6565
6666
6767 func fomoInternal (i) = if ((size(i.payments) != 1))
6868 then throw("exactly 1 payment must be attached")
6969 else {
7070 let pmt = i.payments[0]
7171 let amt = pmt.amount
7272 if (if (!(isDefined(pmt.assetId)))
7373 then true
7474 else (value(pmt.assetId) != gorcAssetId))
7575 then throw("GORC payments only!")
7676 else {
7777 let change = (amt - BLESS_PRICE)
7878 if ((0 > change))
7979 then throw(((("You need to sacrifice " + fixedPoint(BLESS_PRICE, 8)) + " GORC, but I see only ") + fixedPoint(amt, 8)))
8080 else {
8181 let changeActions = if ((change > 0))
8282 then [ScriptTransfer(i.caller, change, gorcAssetId)]
8383 else nil
8484 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
8585 let fomoActions = if ((height > (lastFomoTime + FOMO_PERIOD)))
8686 then {
8787 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
8888 if ((jackpotAmount > 0))
8989 then [ScriptTransfer(i.caller, jackpotAmount, gorcAssetId)]
9090 else nil
9191 }
9292 else nil
9393 (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height)] ++ changeActions) ++ fomoActions)
9494 }
9595 }
9696 }
9797
9898
9999 @Callable(i)
100100 func testArgs (intVal,strVal,boolVal,binVal,arrInt,arrStr,arrBool,arrBin) = nil
101101
102102
103103
104104 @Callable(i)
105105 func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this))
106106 then throw("Permission denied")
107107 else {
108- let issuedAmount = M8
108+ let issuedAmount = M16
109109 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)
110110 let assetId = calculateAssetId(issue)
111111 [issue, BinaryEntry(gorcAssetIdKey, assetId), IntegerEntry(issueTimeKey, height), IntegerEntry(stakersAmountLeftKey, STAKERS_AMOUNT), ScriptTransfer(addressFromStringValue(teamWalletAddr), TEAM_AMOUNT, assetId), ScriptTransfer(addressFromStringValue(brokerAddr), MARKET_AMOUNT, assetId)]
112112 }
113113
114114
115115
116116 @Callable(i)
117117 func stakeGorc () = if ((size(i.payments) != 1))
118118 then throw("exactly 1 payment must be attached")
119119 else {
120120 let pmt = i.payments[0]
121121 let amt = pmt.amount
122122 if (if (!(isDefined(pmt.assetId)))
123123 then true
124124 else (value(pmt.assetId) != gorcAssetId))
125125 then throw("GORC payments only!")
126126 else {
127127 let addr = toString(i.caller)
128- let $t049695020 = gorcStats(addr)
129- let userAmount = $t049695020._1
130- let amountLeftTotal = $t049695020._2
128+ let $t050115062 = gorcStats(addr)
129+ let userAmount = $t050115062._1
130+ let amountLeftTotal = $t050115062._2
131131 let userAmountKey = stakedAmountByUserKey(addr)
132132 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(stakedAmountTotalKey, (valueOrElse(getInteger(stakedAmountTotalKey), 0) + amt)), IntegerEntry(userAmountKey, (valueOrElse(getInteger(userAmountKey), 0) + amt)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], userAmount)
133133 }
134134 }
135135
136136
137137
138138 @Callable(i)
139139 func unstakeGorc (amount) = if ((0 >= amount))
140140 then throw("Amount should be positive")
141141 else {
142142 let addr = toString(i.caller)
143143 if ((size(i.payments) != 0))
144144 then throw("No payments required")
145145 else {
146146 let userAmountKey = stakedAmountByUserKey(addr)
147147 let oldAmount = valueOrElse(getInteger(userAmountKey), 0)
148148 if ((0 > (oldAmount - amount)))
149149 then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8)))
150150 else {
151- let $t059145965 = gorcStats(addr)
152- let userAmount = $t059145965._1
153- let amountLeftTotal = $t059145965._2
151+ let $t059566007 = gorcStats(addr)
152+ let userAmount = $t059566007._1
153+ let amountLeftTotal = $t059566007._2
154154 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(stakedAmountTotalKey, (valueOrErrorMessage(getInteger(stakedAmountTotalKey), "No GORC staked") - amount)), IntegerEntry(userAmountKey, (oldAmount - amount)), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], 0)
155155 }
156156 }
157157 }
158158
159159
160160
161161 @Callable(i)
162162 func claimGorc () = if ((size(i.payments) != 0))
163163 then throw("No payments required")
164164 else {
165165 let addr = toString(i.caller)
166- let $t064626513 = gorcStats(addr)
167- let userAmount = $t064626513._1
168- let amountLeftTotal = $t064626513._2
166+ let $t065046555 = gorcStats(addr)
167+ let userAmount = $t065046555._1
168+ let amountLeftTotal = $t065046555._2
169169 $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], userAmount)
170170 }
171171
172172
173173
174174 @Callable(i)
175175 func answerMe () = $Tuple2(fomoInternal(i), toInt(i.transactionId))
176176
177177
178178
179179 @Callable(i)
180180 func blessMe () = $Tuple2(fomoInternal(i), 42)
181181
182182
183183
184184 @Callable(i)
185185 func statsREADONLY (userAddrOpt) = {
186- let $t069056963 = gorcStats(userAddrOpt)
187- let userAmount = $t069056963._1
188- let amountLeftTotal = $t069056963._2
186+ let $t069477005 = gorcStats(userAddrOpt)
187+ let userAmount = $t069477005._1
188+ let amountLeftTotal = $t069477005._2
189189 let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0)
190190 let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0)
191191 $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))])
192192 }
193193
194194

github/deemru/w8io/169f3d6 
39.28 ms