tx · 9idrWeaZjmVTjCAjpG4LDD2d6okaYVXCToR5NXtFwch3 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01300000 Waves 2023.05.12 14:13 [2574647] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "9idrWeaZjmVTjCAjpG4LDD2d6okaYVXCToR5NXtFwch3", "fee": 1300000, "feeAssetId": null, "timestamp": 1683890061327, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "5MaxmHNH8Ub2ndJBPuJq2CmXB5eYBhqNKQbgD5wUwduxTTkiTcdQiXF2x9SowdSEUvZqVjvjBMxrgBHau4kVBbBJ" ], "script": "base64:BgKQDQgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IhFrZXlGYWN0b3J5QWRkcmVzcyIZa2V5Vm90aW5nVmVyaWZpZWRDb250cmFjdCIia2V5Vm90aW5nRW1pc3Npb25DYW5kaWRhdGVDb250cmFjdCIUa2V5VXNlclBvb2xzQ29udHJhY3QiFnZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiH3ZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiEXVzZXJQb29sc0NvbnRyYWN0IhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZhY3RvcnlDZmdJZG9EYXBwIhVJZHhGYWN0b3J5Q2ZnVGVhbURhcHAiGUlkeEZhY3RvcnlDZmdFbWlzc2lvbkRhcHAiFUlkeEZhY3RvcnlDZmdSZXN0RGFwcCIZSWR4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JFbnRyeQIJAQJhYQAFAmFICQDMCAIJAQtEZWxldGVFbnRyeQEJAQJhYgAFA25pbAUDbmlsCQCUCgIFAmFKBQJhSQkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgJhawEVZ2V0Qm9vc3RDb2VmZlJFQURPTkxZAAkAlAoCBQNuaWwFAVoBAmFLAQJhTAAEAmFNBAJhZgkBAmFoAAMJAAECBQJhZgIKQnl0ZVZlY3RvcgQCYW0FAmFmBQJhbQMJAAECBQJhZgIEVW5pdAgFAmFLD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJhSwlib2R5Qnl0ZXMJAJEDAggFAmFLBnByb29mcwAABQJhTRrHjZQ=", "height": 2574647, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2r1pMMbvY2SayHU6Q9bLG2vvKAW8Nd8Et7pK4q1eeSgY Next: HwsjgXbVdVHiWR2zTWfQBixHfvVJPYv8TF2Ma28nBz7S Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
91 | 91 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | 92 | ||
93 | 93 | ||
94 | + | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
95 | + | ||
96 | + | ||
94 | 97 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
95 | 98 | ||
96 | 99 | ||
109 | 112 | let boostCoeffDefault = 3 | |
110 | 113 | ||
111 | 114 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
115 | + | ||
116 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
117 | + | ||
118 | + | ||
119 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
120 | + | ||
112 | 121 | ||
113 | 122 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 123 | ||
219 | 228 | ||
220 | 229 | ||
221 | 230 | @Callable(i) | |
231 | + | func gwxHoldersRewardUpdate () = { | |
232 | + | let factoryContract = readFactoryAddressOrFail() | |
233 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
234 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
235 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
236 | + | then true | |
237 | + | else mustManager(i) | |
238 | + | if ((checkCaller == checkCaller)) | |
239 | + | then { | |
240 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
241 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
242 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
243 | + | let actions = if (shouldBeUpdated) | |
244 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
245 | + | else nil | |
246 | + | $Tuple2(actions, shouldBeUpdated) | |
247 | + | } | |
248 | + | else throw("Strict value is not equal to itself.") | |
249 | + | } | |
250 | + | ||
251 | + | ||
252 | + | ||
253 | + | @Callable(i) | |
222 | 254 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
223 | 255 | ||
224 | 256 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | + | func keyRatePerBlockNext () = "%s%s__ratePerBlock__next" | |
95 | + | ||
96 | + | ||
94 | 97 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
95 | 98 | ||
96 | 99 | ||
97 | 100 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
98 | 101 | ||
99 | 102 | ||
100 | 103 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
101 | 104 | ||
102 | 105 | ||
103 | 106 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
104 | 107 | ||
105 | 108 | ||
106 | 109 | func keyBoostCoeff () = "%s__boostCoeff" | |
107 | 110 | ||
108 | 111 | ||
109 | 112 | let boostCoeffDefault = 3 | |
110 | 113 | ||
111 | 114 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
115 | + | ||
116 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
117 | + | ||
118 | + | ||
119 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
120 | + | ||
112 | 121 | ||
113 | 122 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 123 | ||
115 | 124 | ||
116 | 125 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
117 | 126 | ||
118 | 127 | ||
119 | 128 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
120 | 129 | case s: String => | |
121 | 130 | addressFromStringValue(s) | |
122 | 131 | case _ => | |
123 | 132 | this | |
124 | 133 | } | |
125 | 134 | ||
126 | 135 | ||
127 | 136 | func managerPublicKeyOrUnit () = { | |
128 | 137 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
129 | 138 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
130 | 139 | case s: String => | |
131 | 140 | fromBase58String(s) | |
132 | 141 | case _: Unit => | |
133 | 142 | unit | |
134 | 143 | case _ => | |
135 | 144 | throw("Match error") | |
136 | 145 | } | |
137 | 146 | } | |
138 | 147 | ||
139 | 148 | ||
140 | 149 | func mustManager (i) = { | |
141 | 150 | let pd = throwErr("Permission denied") | |
142 | 151 | match managerPublicKeyOrUnit() { | |
143 | 152 | case pk: ByteVector => | |
144 | 153 | if ((i.callerPublicKey == pk)) | |
145 | 154 | then true | |
146 | 155 | else pd | |
147 | 156 | case _: Unit => | |
148 | 157 | if ((i.caller == this)) | |
149 | 158 | then true | |
150 | 159 | else pd | |
151 | 160 | case _ => | |
152 | 161 | throw("Match error") | |
153 | 162 | } | |
154 | 163 | } | |
155 | 164 | ||
156 | 165 | ||
157 | 166 | @Callable(i) | |
158 | 167 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
159 | 168 | let checkCaller = mustManager(i) | |
160 | 169 | if ((checkCaller == checkCaller)) | |
161 | 170 | 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))] | |
162 | 171 | else throw("Strict value is not equal to itself.") | |
163 | 172 | } | |
164 | 173 | ||
165 | 174 | ||
166 | 175 | ||
167 | 176 | @Callable(i) | |
168 | 177 | func constructorV2 (votingVerifiedContractPrm) = { | |
169 | 178 | let checkCaller = mustManager(i) | |
170 | 179 | if ((checkCaller == checkCaller)) | |
171 | 180 | then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit) | |
172 | 181 | else throw("Strict value is not equal to itself.") | |
173 | 182 | } | |
174 | 183 | ||
175 | 184 | ||
176 | 185 | ||
177 | 186 | @Callable(i) | |
178 | 187 | func emit (amount) = if ((0 >= amount)) | |
179 | 188 | then $Tuple2(nil, nil) | |
180 | 189 | else { | |
181 | 190 | let factoryContract = readFactoryAddressOrFail() | |
182 | 191 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
183 | 192 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
184 | 193 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
185 | 194 | let caller = i.caller | |
186 | 195 | if (if ((caller != stakingContract)) | |
187 | 196 | then (caller != gwxRewardsContract) | |
188 | 197 | else false) | |
189 | 198 | then throwErr("permissions denied") | |
190 | 199 | else { | |
191 | 200 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
192 | 201 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
193 | 202 | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
194 | 203 | } | |
195 | 204 | } | |
196 | 205 | ||
197 | 206 | ||
198 | 207 | ||
199 | 208 | @Callable(i) | |
200 | 209 | func burn () = { | |
201 | 210 | let factoryContract = readFactoryAddressOrFail() | |
202 | 211 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
203 | 212 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
204 | 213 | if ((size(i.payments) != 1)) | |
205 | 214 | then throwErr("exact one payment is allowed") | |
206 | 215 | else { | |
207 | 216 | let pmt = i.payments[0] | |
208 | 217 | let assetId = value(pmt.assetId) | |
209 | 218 | let pmtAmount = pmt.amount | |
210 | 219 | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
211 | 220 | if ((assetId != wxAssetId)) | |
212 | 221 | then throwErr("invalid wxAssetId is passed") | |
213 | 222 | else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller))) | |
214 | 223 | then throwErr("permissions denied") | |
215 | 224 | 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))] | |
216 | 225 | } | |
217 | 226 | } | |
218 | 227 | ||
219 | 228 | ||
220 | 229 | ||
221 | 230 | @Callable(i) | |
231 | + | func gwxHoldersRewardUpdate () = { | |
232 | + | let factoryContract = readFactoryAddressOrFail() | |
233 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
234 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
235 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
236 | + | then true | |
237 | + | else mustManager(i) | |
238 | + | if ((checkCaller == checkCaller)) | |
239 | + | then { | |
240 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
241 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
242 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
243 | + | let actions = if (shouldBeUpdated) | |
244 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
245 | + | else nil | |
246 | + | $Tuple2(actions, shouldBeUpdated) | |
247 | + | } | |
248 | + | else throw("Strict value is not equal to itself.") | |
249 | + | } | |
250 | + | ||
251 | + | ||
252 | + | ||
253 | + | @Callable(i) | |
222 | 254 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
223 | 255 | ||
224 | 256 | ||
225 | 257 | @Verifier(tx) | |
226 | 258 | func verify () = { | |
227 | 259 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
228 | 260 | case pk: ByteVector => | |
229 | 261 | pk | |
230 | 262 | case _: Unit => | |
231 | 263 | tx.senderPublicKey | |
232 | 264 | case _ => | |
233 | 265 | throw("Match error") | |
234 | 266 | } | |
235 | 267 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
236 | 268 | } | |
237 | 269 |
github/deemru/w8io/026f985 33.19 ms ◑