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:BgKQDQgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIHYWRkcmVzcyIDa2V5IhFrZXlGYWN0b3J5QWRkcmVzcyIZa2V5Vm90aW5nVmVyaWZpZWRDb250cmFjdCIia2V5Vm90aW5nRW1pc3Npb25DYW5kaWRhdGVDb250cmFjdCIUa2V5VXNlclBvb2xzQ29udHJhY3QiFnZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiH3ZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiEXVzZXJQb29sc0NvbnRyYWN0IhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiFElkeEZhY3RvcnlDZmdJZG9EYXBwIhVJZHhGYWN0b3J5Q2ZnVGVhbURhcHAiGUlkeEZhY3RvcnlDZmdFbWlzc2lvbkRhcHAiFUlkeEZhY3RvcnlDZmdSZXN0RGFwcCIZSWR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XJFbnRyeQIJAQJhYQAFAmFICQDMCAIJAQtEZWxldGVFbnRyeQEJAQJhYgAFA25pbAUDbmlsCQCUCgIFAmFKBQJhSQkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgJhawEVZ2V0Qm9vc3RDb2VmZlJFQURPTkxZAAkAlAoCBQNuaWwFAVoBAmFLAQJhTAAEAmFNBAJhZgkBAmFoAAMJAAECBQJhZgIKQnl0ZVZlY3RvcgQCYW0FAmFmBQJhbQMJAAECBQJhZgIEVW5pdAgFAmFLD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJhSwlib2R5Qnl0ZXMJAJEDAggFAmFLBnByb29mcwAABQJhTRrHjZQ=", "height": 2574647, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2r1pMMbvY2SayHU6Q9bLG2vvKAW8Nd8Et7pK4q1eeSgY Next: HwsjgXbVdVHiWR2zTWfQBixHfvVJPYv8TF2Ma28nBz7S Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
9191 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
9292
9393
94+func keyRatePerBlockNext () = "%s%s__ratePerBlock__next"
95+
96+
9497 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
9598
9699
109112 let boostCoeffDefault = 3
110113
111114 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+
112121
113122 func keyManagerPublicKey () = "%s__managerPublicKey"
114123
219228
220229
221230 @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)
222254 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
223255
224256
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func wrapErr (msg) = makeString(["emission.ride:", toString(this), msg], " ")
77
88
99 func throwErr (msg) = throw(wrapErr(msg))
1010
1111
1212 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((("mandatory this." + key) + " is not defined")))
1313
1414
1515 func keyFactoryAddress () = "%s%s__config__factoryAddress"
1616
1717
1818 let keyVotingVerifiedContract = "%s%s__config__votingVerifiedContract"
1919
2020 let keyVotingEmissionCandidateContract = "%s%s__config__votingEmissionCandidateContract"
2121
2222 let keyUserPoolsContract = "%s%s__config__userPoolsContract"
2323
2424 let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
2525
2626 let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
2727
2828 let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
2929
3030 let IdxFactoryCfgStakingDapp = 1
3131
3232 let IdxFactoryCfgBoostingDapp = 2
3333
3434 let IdxFactoryCfgIdoDapp = 3
3535
3636 let IdxFactoryCfgTeamDapp = 4
3737
3838 let IdxFactoryCfgEmissionDapp = 5
3939
4040 let IdxFactoryCfgRestDapp = 6
4141
4242 let IdxFactoryCfgSlippageDapp = 7
4343
4444 let IdxFactoryCfgGwxRewardDapp = 10
4545
4646 func keyFactoryCfg () = "%s__factoryConfig"
4747
4848
4949 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
5050
5151
5252 func keyFactoryLpList () = "%s__lpTokensList"
5353
5454
5555 func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
5656
5757
5858 func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
5959
6060
6161 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
6262
6363
6464 func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
6565
6666
6767 func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
6868
6969
7070 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
7171
7272
7373 func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
7474
7575
7676 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
7777
7878
7979 func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
8080
8181
8282 func keyConfig () = "%s__config"
8383
8484
8585 func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
8686
8787
8888 func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
8989
9090
9191 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
9292
9393
94+func keyRatePerBlockNext () = "%s%s__ratePerBlock__next"
95+
96+
9497 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
9598
9699
97100 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
98101
99102
100103 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
101104
102105
103106 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
104107
105108
106109 func keyBoostCoeff () = "%s__boostCoeff"
107110
108111
109112 let boostCoeffDefault = 3
110113
111114 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+
112121
113122 func keyManagerPublicKey () = "%s__managerPublicKey"
114123
115124
116125 func keyManagerVaultAddress () = "%s__managerVaultAddress"
117126
118127
119128 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
120129 case s: String =>
121130 addressFromStringValue(s)
122131 case _ =>
123132 this
124133 }
125134
126135
127136 func managerPublicKeyOrUnit () = {
128137 let managerVaultAddress = getManagerVaultAddressOrThis()
129138 match getString(managerVaultAddress, keyManagerPublicKey()) {
130139 case s: String =>
131140 fromBase58String(s)
132141 case _: Unit =>
133142 unit
134143 case _ =>
135144 throw("Match error")
136145 }
137146 }
138147
139148
140149 func mustManager (i) = {
141150 let pd = throwErr("Permission denied")
142151 match managerPublicKeyOrUnit() {
143152 case pk: ByteVector =>
144153 if ((i.callerPublicKey == pk))
145154 then true
146155 else pd
147156 case _: Unit =>
148157 if ((i.caller == this))
149158 then true
150159 else pd
151160 case _ =>
152161 throw("Match error")
153162 }
154163 }
155164
156165
157166 @Callable(i)
158167 func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
159168 let checkCaller = mustManager(i)
160169 if ((checkCaller == checkCaller))
161170 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))]
162171 else throw("Strict value is not equal to itself.")
163172 }
164173
165174
166175
167176 @Callable(i)
168177 func constructorV2 (votingVerifiedContractPrm) = {
169178 let checkCaller = mustManager(i)
170179 if ((checkCaller == checkCaller))
171180 then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit)
172181 else throw("Strict value is not equal to itself.")
173182 }
174183
175184
176185
177186 @Callable(i)
178187 func emit (amount) = if ((0 >= amount))
179188 then $Tuple2(nil, nil)
180189 else {
181190 let factoryContract = readFactoryAddressOrFail()
182191 let factoryCfg = readFactoryCfgOrFail(factoryContract)
183192 let stakingContract = getStakingAddressOrFail(factoryCfg)
184193 let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
185194 let caller = i.caller
186195 if (if ((caller != stakingContract))
187196 then (caller != gwxRewardsContract)
188197 else false)
189198 then throwErr("permissions denied")
190199 else {
191200 let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
192201 let wxAssetId = fromBase58String(wxAssetIdStr)
193202 $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
194203 }
195204 }
196205
197206
198207
199208 @Callable(i)
200209 func burn () = {
201210 let factoryContract = readFactoryAddressOrFail()
202211 let factoryCfg = readFactoryCfgOrFail(factoryContract)
203212 let boostingContract = getBoostingAddressOrFail(factoryCfg)
204213 if ((size(i.payments) != 1))
205214 then throwErr("exact one payment is allowed")
206215 else {
207216 let pmt = i.payments[0]
208217 let assetId = value(pmt.assetId)
209218 let pmtAmount = pmt.amount
210219 let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
211220 if ((assetId != wxAssetId))
212221 then throwErr("invalid wxAssetId is passed")
213222 else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller)))
214223 then throwErr("permissions denied")
215224 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))]
216225 }
217226 }
218227
219228
220229
221230 @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)
222254 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
223255
224256
225257 @Verifier(tx)
226258 func verify () = {
227259 let targetPublicKey = match managerPublicKeyOrUnit() {
228260 case pk: ByteVector =>
229261 pk
230262 case _: Unit =>
231263 tx.senderPublicKey
232264 case _ =>
233265 throw("Match error")
234266 }
235267 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
236268 }
237269

github/deemru/w8io/026f985 
34.69 ms