tx · 9v6YSerM4jk41h3kEvSxwgg5rBD5QeQ9kqetHRVx4NqL 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z: -0.01000000 Waves 2024.12.31 04:14 [3438009] smart account 3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z > SELF 0.00000000 Waves
{ "type": 13, "id": "9v6YSerM4jk41h3kEvSxwgg5rBD5QeQ9kqetHRVx4NqL", "fee": 1000000, "feeAssetId": null, "timestamp": 1735607691374, "version": 2, "chainId": 84, "sender": "3NCGjbgqZVk7eaqrLMEnEnqRhozNm1KTG5z", "senderPublicKey": "5CoDbXxoqnvJpx9GrS6M4G5GYJXh9rcoiXJz7RYTPVkL", "proofs": [ "pc1bt8VvzSke5kGgPQF24XKCGNzS5iMFxoiLvzfH9qFGGZrytTURniNwnSLWhvndg8HZeKT4Fc8kYTfpyQsvkfT" ], "script": "base64:BgImCAISCgoIAQgEAhEYFBISBAoCCAgSABIDCgEBEgASABIAEgMKAQgUAAJNOACAwtcvAA5TVEFLRVJTX0FNT1VOVACAreIEAAtURUFNX0FNT1VOVACAreIEAA1NQVJLRVRfQU1PVU5UAIDokiYAC1lFQVJfQkxPQ0tTCQBoAgDtAgCgCwAMU1RBS0VfUEVSSU9ECQBoAgAFBQtZRUFSX0JMT0NLUwALQkxFU1NfUFJJQ0UAgNDbw/QCAAtGT01PX1BFUklPRAA8AA5nb3JjQXNzZXRJZEtleQILZ29yY0Fzc2V0SWQAC2dvcmNBc3NldElkCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAKEIAQUOZ29yY0Fzc2V0SWRLZXkCFkdPUkMgaXMgbm90IGlzc3VlZCB5ZXQADGlzc3VlVGltZUtleQIJaXNzdWVUaW1lABRzdGFrZXJzQW1vdW50TGVmdEtleQIRc3Rha2Vyc0Ftb3VudExlZnQAFHN0YWtlZEFtb3VudFRvdGFsS2V5AgtzdGFrZWRUb3RhbAEVc3Rha2VkQW1vdW50QnlVc2VyS2V5AQRhZGRyCQCsA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m5hbAEFAWkAKgFpAQ1zdGF0c1JFQURPTkxZAQt1c2VyQWRkck9wdAQLJHQwNjkwNTY5NjMJAQlnb3JjU3RhdHMBBQt1c2VyQWRkck9wdAQKdXNlckFtb3VudAgFCyR0MDY5MDU2OTYzAl8xBA9hbW91bnRMZWZ0VG90YWwIBQskdDA2OTA1Njk2MwJfMgQNamFja3BvdEFtb3VudAkBC3ZhbHVlT3JFbHNlAgkAnwgBBRFjdXJyZW50SmFja3BvdEtleQAABAxsYXN0Rm9tb1RpbWUJAQt2YWx1ZU9yRWxzZQIJAJ8IAQUPbGFzdEZvbW9UaW1lS2V5AAAJAJQKAgUDbmlsCQDMCAIJAKwCAgIYJXMlZF9fZ29yY0F2YWlsVG9DbGFpbV9fCQCkAwEFCnVzZXJBbW91bnQJAMwIAgkArAICAhUlcyVkX19qYWNrcG90QW1vdW50X18JAKQDAQUNamFja3BvdEFtb3VudAkAzAgCCQCsAgICFCVzJWRfX2xhc3RGb21vVGltZV9fCQCkAwEFDGxhc3RGb21vVGltZQkAzAgCCQCsAgICFyVzJWRfX2Ftb3VudExlZnRUb3RhbF9fCQCkAwEFD2Ftb3VudExlZnRUb3RhbAUDbmlsAIh49d0=", "height": 3438009, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Das6Z2hX4mhoW5udzZvdyptL8qapbqPTA7yn5JhgiikL Next: GrEfnBjnMB6CdYR3WTQrMS3qAjaq8UBDJHNTtoSy4BGw Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let M8 = 100000000 | |
5 | + | ||
6 | + | let STAKERS_AMOUNT = 10000000 | |
7 | + | ||
8 | + | let TEAM_AMOUNT = 10000000 | |
9 | + | ||
10 | + | let MARKET_AMOUNT = 80000000 | |
11 | + | ||
12 | + | let YEAR_BLOCKS = (365 * 1440) | |
13 | + | ||
14 | + | let STAKE_PERIOD = (5 * YEAR_BLOCKS) | |
15 | + | ||
16 | + | let BLESS_PRICE = 100000000000 | |
17 | + | ||
18 | + | let FOMO_PERIOD = 60 | |
19 | + | ||
20 | + | let gorcAssetIdKey = "gorcAssetId" | |
21 | + | ||
22 | + | let gorcAssetId = valueOrErrorMessage(getBinary(gorcAssetIdKey), "GORC is not issued yet") | |
23 | + | ||
24 | + | let issueTimeKey = "issueTime" | |
25 | + | ||
26 | + | let stakersAmountLeftKey = "stakersAmountLeft" | |
27 | + | ||
28 | + | let stakedAmountTotalKey = "stakedTotal" | |
29 | + | ||
30 | + | func stakedAmountByUserKey (addr) = ("stakedAmount_" + addr) | |
31 | + | ||
32 | + | ||
33 | + | func keyLastClaimTimeByUser (addr) = ("lastClaimTime_" + addr) | |
34 | + | ||
35 | + | ||
36 | + | let lastFomoTimeKey = "lastFomoTime" | |
37 | + | ||
38 | + | let currentJackpotKey = "currentJackpot" | |
39 | + | ||
40 | + | func gorcStats (userAddrOpt) = { | |
41 | + | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
42 | + | let lastUserTime = valueOrElse(getInteger(keyLastClaimTimeByUser(userAddrOpt)), -1) | |
43 | + | if ((0 > lastUserTime)) | |
44 | + | then $Tuple2(0, amountLeftTotal) | |
45 | + | else { | |
46 | + | let issueTime = valueOrErrorMessage(getInteger(issueTimeKey), "GORC is not issued yet") | |
47 | + | let nowLimited = min([height, (issueTime + STAKE_PERIOD)]) | |
48 | + | let userShares = valueOrElse(getInteger(stakedAmountByUserKey(userAddrOpt)), 0) | |
49 | + | let totalShares = valueOrElse(getInteger(stakedAmountTotalKey), 0) | |
50 | + | let userTemporal = fraction(STAKERS_AMOUNT, (nowLimited - lastUserTime), STAKE_PERIOD) | |
51 | + | let userAmount = if ((totalShares != 0)) | |
52 | + | then fraction(userTemporal, userShares, totalShares) | |
53 | + | else 0 | |
54 | + | $Tuple2(userAmount, (amountLeftTotal - userAmount)) | |
55 | + | } | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func fixedPoint (val,decimals) = { | |
60 | + | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
61 | + | let lowPart = toString((val % tenPow)) | |
62 | + | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
63 | + | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func fomoInternal (i) = if ((size(i.payments) != 1)) | |
68 | + | then throw("exactly 1 payment must be attached") | |
69 | + | else { | |
70 | + | let pmt = i.payments[0] | |
71 | + | let amt = pmt.amount | |
72 | + | if (if (!(isDefined(pmt.assetId))) | |
73 | + | then true | |
74 | + | else (value(pmt.assetId) != gorcAssetId)) | |
75 | + | then throw("GORC payments only!") | |
76 | + | else { | |
77 | + | let change = (amt - BLESS_PRICE) | |
78 | + | if ((0 > change)) | |
79 | + | then throw(((("You need to sacrifice " + fixedPoint(BLESS_PRICE, 8)) + " GORC, but I see only ") + fixedPoint(amt, 8))) | |
80 | + | else { | |
81 | + | let changeActions = if ((change > 0)) | |
82 | + | then [ScriptTransfer(i.caller, change, gorcAssetId)] | |
83 | + | else nil | |
84 | + | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
85 | + | let fomoActions = if ((height > (lastFomoTime + FOMO_PERIOD))) | |
86 | + | then { | |
87 | + | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
88 | + | if ((jackpotAmount > 0)) | |
89 | + | then [ScriptTransfer(i.caller, jackpotAmount, gorcAssetId)] | |
90 | + | else nil | |
91 | + | } | |
92 | + | else nil | |
93 | + | (([IntegerEntry(currentJackpotKey, BLESS_PRICE), IntegerEntry(lastFomoTimeKey, height)] ++ changeActions) ++ fomoActions) | |
94 | + | } | |
95 | + | } | |
96 | + | } | |
4 | 97 | ||
5 | 98 | ||
6 | 99 | @Callable(i) | |
7 | 100 | func testArgs (intVal,strVal,boolVal,binVal,arrInt,arrStr,arrBool,arrBin) = nil | |
8 | 101 | ||
9 | 102 | ||
103 | + | ||
104 | + | @Callable(i) | |
105 | + | func constructorV1 (teamWalletAddr,brokerAddr) = if ((i.caller != this)) | |
106 | + | then throw("Permission denied") | |
107 | + | else { | |
108 | + | let issuedAmount = M8 | |
109 | + | 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) | |
110 | + | 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)] | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(i) | |
117 | + | func stakeGorc () = if ((size(i.payments) != 1)) | |
118 | + | then throw("exactly 1 payment must be attached") | |
119 | + | else { | |
120 | + | let pmt = i.payments[0] | |
121 | + | let amt = pmt.amount | |
122 | + | if (if (!(isDefined(pmt.assetId))) | |
123 | + | then true | |
124 | + | else (value(pmt.assetId) != gorcAssetId)) | |
125 | + | then throw("GORC payments only!") | |
126 | + | else { | |
127 | + | let addr = toString(i.caller) | |
128 | + | let $t049695020 = gorcStats(addr) | |
129 | + | let userAmount = $t049695020._1 | |
130 | + | let amountLeftTotal = $t049695020._2 | |
131 | + | let userAmountKey = stakedAmountByUserKey(addr) | |
132 | + | $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) | |
133 | + | } | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func unstakeGorc (amount) = if ((0 >= amount)) | |
140 | + | then throw("Amount should be positive") | |
141 | + | else { | |
142 | + | let addr = toString(i.caller) | |
143 | + | if ((size(i.payments) != 0)) | |
144 | + | then throw("No payments required") | |
145 | + | else { | |
146 | + | let userAmountKey = stakedAmountByUserKey(addr) | |
147 | + | let oldAmount = valueOrElse(getInteger(userAmountKey), 0) | |
148 | + | if ((0 > (oldAmount - amount))) | |
149 | + | then throw(((("You have only " + fixedPoint(oldAmount, 8)) + " GORC staked, tried to unstake ") + fixedPoint(amount, 8))) | |
150 | + | else { | |
151 | + | let $t059145965 = gorcStats(addr) | |
152 | + | let userAmount = $t059145965._1 | |
153 | + | let amountLeftTotal = $t059145965._2 | |
154 | + | $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) | |
155 | + | } | |
156 | + | } | |
157 | + | } | |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func claimGorc () = if ((size(i.payments) != 0)) | |
163 | + | then throw("No payments required") | |
164 | + | else { | |
165 | + | let addr = toString(i.caller) | |
166 | + | let $t064626513 = gorcStats(addr) | |
167 | + | let userAmount = $t064626513._1 | |
168 | + | let amountLeftTotal = $t064626513._2 | |
169 | + | $Tuple2([ScriptTransfer(i.caller, userAmount, gorcAssetId), IntegerEntry(keyLastClaimTimeByUser(addr), height), IntegerEntry(stakersAmountLeftKey, amountLeftTotal)], userAmount) | |
170 | + | } | |
171 | + | ||
172 | + | ||
173 | + | ||
174 | + | @Callable(i) | |
175 | + | func answerMe () = $Tuple2(fomoInternal(i), toInt(i.transactionId)) | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func blessMe () = $Tuple2(fomoInternal(i), 42) | |
181 | + | ||
182 | + | ||
183 | + | ||
184 | + | @Callable(i) | |
185 | + | func statsREADONLY (userAddrOpt) = { | |
186 | + | let $t069056963 = gorcStats(userAddrOpt) | |
187 | + | let userAmount = $t069056963._1 | |
188 | + | let amountLeftTotal = $t069056963._2 | |
189 | + | let jackpotAmount = valueOrElse(getInteger(currentJackpotKey), 0) | |
190 | + | let lastFomoTime = valueOrElse(getInteger(lastFomoTimeKey), 0) | |
191 | + | $Tuple2(nil, [("%s%d__gorcAvailToClaim__" + toString(userAmount)), ("%s%d__jackpotAmount__" + toString(jackpotAmount)), ("%s%d__lastFomoTime__" + toString(lastFomoTime)), ("%s%d__amountLeftTotal__" + toString(amountLeftTotal))]) | |
192 | + | } | |
193 | + | ||
194 | + |
github/deemru/w8io/169f3d6 21.78 ms ◑