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