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