tx · 4okyA9gs8PXLfYhfdto5m9HMC1pvQetxUbfMY5H9S82o 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01300000 Waves 2023.04.18 13:16 [2539861] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "4okyA9gs8PXLfYhfdto5m9HMC1pvQetxUbfMY5H9S82o", "fee": 1300000, "feeAssetId": null, "timestamp": 1681812989419, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "5aEH93GkvHEPoSTztwm1YuD4ZXtXG86opoD7pCosx9AEMWBzrcgLGE4kUivvuD1iwrwSxWjKVjmVmNgM7j9MqH7j" ], "script": "base64:BgLLDQgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIDCgEIEgASACIDU0VQIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIRa2V5RmFjdG9yeUFkZHJlc3MiGWtleVZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiImtleVZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiFGtleVVzZXJQb29sc0NvbnRyYWN0IhZ2b3RpbmdWZXJpZmllZENvbnRyYWN0Ih92b3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0IhF1c2VyUG9vbHNDb250cmFjdCIYSWR4RmFjdG9yeUNmZ1N0YWtpbmdEYXBwIhlJZHhGYWN0b3J5Q2ZnQm9vc3RpbmdEYXBwIhRJZHhGYWN0b3J5Q2ZnSWRvRGFwcCIVSWR4RmFjdG9yeUNmZ1RlYW1EYXBwIhlJZHhGYWN0b3J5Q2ZnRW1pc3Npb25EYXBwIhVJZHhGYWN0b3J5Q2ZnUmVzdER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FAmFmBQJhbAMJAAECBQJhZgIEVW5pdAgFAmFPD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJhTwlib2R5Qnl0ZXMJAJEDAggFAmFPBnByb29mcwAABQJhUbB0XpA=", "height": 2539861, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4M8AEUuhVe2LGh2AJayJAGKCnMvfzgTKfU11XeJZbQcC Next: 9vzsiqofpS5Cj8Ny4cxoArxyzgs9jg7YRVSWb5bUC3tW Diff:
Old | New | Differences | |
---|---|---|---|
238 | 238 | then { | |
239 | 239 | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
240 | 240 | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
241 | - | let actions = if ((gwxHolderRewardCurrent == gwxHolderRewardNext)) | |
242 | - | then nil | |
243 | - | else [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
244 | - | $Tuple2(actions, unit) | |
241 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
242 | + | let actions = if (shouldBeUpdated) | |
243 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
244 | + | else nil | |
245 | + | $Tuple2(actions, shouldBeUpdated) | |
245 | 246 | } | |
246 | 247 | else throw("Strict value is not equal to itself.") | |
247 | 248 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func wrapErr (msg) = makeString(["emission.ride:", toString(this), msg], " ") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func throwErr (msg) = throw(wrapErr(msg)) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined"))) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | let keyVotingVerifiedContract = "%s%s__config__votingVerifiedContract" | |
19 | 19 | ||
20 | 20 | let keyVotingEmissionCandidateContract = "%s%s__config__votingEmissionCandidateContract" | |
21 | 21 | ||
22 | 22 | let keyUserPoolsContract = "%s%s__config__userPoolsContract" | |
23 | 23 | ||
24 | 24 | let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract)) | |
25 | 25 | ||
26 | 26 | let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract)) | |
27 | 27 | ||
28 | 28 | let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract)) | |
29 | 29 | ||
30 | 30 | let IdxFactoryCfgStakingDapp = 1 | |
31 | 31 | ||
32 | 32 | let IdxFactoryCfgBoostingDapp = 2 | |
33 | 33 | ||
34 | 34 | let IdxFactoryCfgIdoDapp = 3 | |
35 | 35 | ||
36 | 36 | let IdxFactoryCfgTeamDapp = 4 | |
37 | 37 | ||
38 | 38 | let IdxFactoryCfgEmissionDapp = 5 | |
39 | 39 | ||
40 | 40 | let IdxFactoryCfgRestDapp = 6 | |
41 | 41 | ||
42 | 42 | let IdxFactoryCfgSlippageDapp = 7 | |
43 | 43 | ||
44 | 44 | let IdxFactoryCfgGwxRewardDapp = 10 | |
45 | 45 | ||
46 | 46 | func keyFactoryCfg () = "%s__factoryConfig" | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyFactoryLpList () = "%s__lpTokensList" | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func keyConfig () = "%s__config" | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func keyBoostCoeff () = "%s__boostCoeff" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | let boostCoeffDefault = 3 | |
113 | 113 | ||
114 | 114 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
115 | 115 | ||
116 | 116 | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
129 | 129 | case s: String => | |
130 | 130 | fromBase58String(s) | |
131 | 131 | case _: Unit => | |
132 | 132 | unit | |
133 | 133 | case _ => | |
134 | 134 | throw("Match error") | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
139 | 139 | case s: String => | |
140 | 140 | fromBase58String(s) | |
141 | 141 | case _: Unit => | |
142 | 142 | unit | |
143 | 143 | case _ => | |
144 | 144 | throw("Match error") | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func mustManager (i) = { | |
149 | 149 | let pd = throwErr("Permission denied") | |
150 | 150 | match managerPublicKeyOrUnit() { | |
151 | 151 | case pk: ByteVector => | |
152 | 152 | if ((i.callerPublicKey == pk)) | |
153 | 153 | then true | |
154 | 154 | else pd | |
155 | 155 | case _: Unit => | |
156 | 156 | if ((i.caller == this)) | |
157 | 157 | then true | |
158 | 158 | else pd | |
159 | 159 | case _ => | |
160 | 160 | throw("Match error") | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
167 | 167 | let checkCaller = mustManager(i) | |
168 | 168 | if ((checkCaller == checkCaller)) | |
169 | 169 | then [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))] | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | @Callable(i) | |
176 | 176 | func constructorV2 (votingVerifiedContractPrm) = { | |
177 | 177 | let checkCaller = mustManager(i) | |
178 | 178 | if ((checkCaller == checkCaller)) | |
179 | 179 | then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit) | |
180 | 180 | else throw("Strict value is not equal to itself.") | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | 185 | @Callable(i) | |
186 | 186 | func emit (amount) = if ((0 >= amount)) | |
187 | 187 | then $Tuple2(nil, nil) | |
188 | 188 | else { | |
189 | 189 | let factoryContract = readFactoryAddressOrFail() | |
190 | 190 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
191 | 191 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
192 | 192 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
193 | 193 | let caller = i.caller | |
194 | 194 | if (if ((caller != stakingContract)) | |
195 | 195 | then (caller != gwxRewardsContract) | |
196 | 196 | else false) | |
197 | 197 | then throwErr("permissions denied") | |
198 | 198 | else { | |
199 | 199 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
200 | 200 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
201 | 201 | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
202 | 202 | } | |
203 | 203 | } | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | ||
207 | 207 | @Callable(i) | |
208 | 208 | func burn () = { | |
209 | 209 | let factoryContract = readFactoryAddressOrFail() | |
210 | 210 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
211 | 211 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
212 | 212 | if ((size(i.payments) != 1)) | |
213 | 213 | then throwErr("exact one payment is allowed") | |
214 | 214 | else { | |
215 | 215 | let pmt = i.payments[0] | |
216 | 216 | let assetId = value(pmt.assetId) | |
217 | 217 | let pmtAmount = pmt.amount | |
218 | 218 | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
219 | 219 | if ((assetId != wxAssetId)) | |
220 | 220 | then throwErr("invalid wxAssetId is passed") | |
221 | 221 | else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller))) | |
222 | 222 | then throwErr("permissions denied") | |
223 | 223 | else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))] | |
224 | 224 | } | |
225 | 225 | } | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Callable(i) | |
230 | 230 | func gwxHoldersRewardUpdate () = { | |
231 | 231 | let factoryContract = readFactoryAddressOrFail() | |
232 | 232 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
233 | 233 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
234 | 234 | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
235 | 235 | then true | |
236 | 236 | else mustManager(i) | |
237 | 237 | if ((checkCaller == checkCaller)) | |
238 | 238 | then { | |
239 | 239 | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
240 | 240 | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
241 | - | let actions = if ((gwxHolderRewardCurrent == gwxHolderRewardNext)) | |
242 | - | then nil | |
243 | - | else [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
244 | - | $Tuple2(actions, unit) | |
241 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
242 | + | let actions = if (shouldBeUpdated) | |
243 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
244 | + | else nil | |
245 | + | $Tuple2(actions, shouldBeUpdated) | |
245 | 246 | } | |
246 | 247 | else throw("Strict value is not equal to itself.") | |
247 | 248 | } | |
248 | 249 | ||
249 | 250 | ||
250 | 251 | ||
251 | 252 | @Callable(i) | |
252 | 253 | func setManager (pendingManagerPublicKey) = { | |
253 | 254 | let checkCaller = mustManager(i) | |
254 | 255 | if ((checkCaller == checkCaller)) | |
255 | 256 | then { | |
256 | 257 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
257 | 258 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
258 | 259 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
259 | 260 | else throw("Strict value is not equal to itself.") | |
260 | 261 | } | |
261 | 262 | else throw("Strict value is not equal to itself.") | |
262 | 263 | } | |
263 | 264 | ||
264 | 265 | ||
265 | 266 | ||
266 | 267 | @Callable(i) | |
267 | 268 | func confirmManager () = { | |
268 | 269 | let pm = pendingManagerPublicKeyOrUnit() | |
269 | 270 | let hasPM = if (isDefined(pm)) | |
270 | 271 | then true | |
271 | 272 | else throwErr("No pending manager") | |
272 | 273 | if ((hasPM == hasPM)) | |
273 | 274 | then { | |
274 | 275 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
275 | 276 | then true | |
276 | 277 | else throwErr("You are not pending manager") | |
277 | 278 | if ((checkPM == checkPM)) | |
278 | 279 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
279 | 280 | else throw("Strict value is not equal to itself.") | |
280 | 281 | } | |
281 | 282 | else throw("Strict value is not equal to itself.") | |
282 | 283 | } | |
283 | 284 | ||
284 | 285 | ||
285 | 286 | ||
286 | 287 | @Callable(i) | |
287 | 288 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
288 | 289 | ||
289 | 290 | ||
290 | 291 | @Verifier(tx) | |
291 | 292 | func verify () = { | |
292 | 293 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
293 | 294 | case pk: ByteVector => | |
294 | 295 | pk | |
295 | 296 | case _: Unit => | |
296 | 297 | tx.senderPublicKey | |
297 | 298 | case _ => | |
298 | 299 | throw("Match error") | |
299 | 300 | } | |
300 | 301 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
301 | 302 | } | |
302 | 303 |
github/deemru/w8io/026f985 54.20 ms ◑