tx · G2Zj4b9i7UYRfpZiDww9hLhskkgkarz92A7arSiWW2hu

3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA:  -0.01300000 Waves

2023.05.19 16:09 [2584884] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves

{ "type": 13, "id": "G2Zj4b9i7UYRfpZiDww9hLhskkgkarz92A7arSiWW2hu", "fee": 1300000, "feeAssetId": null, "timestamp": 1684501777046, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "PPCNHxjZyNRdnmDbVHGWwfg5rTsnBQFc1qWFcGkp8quNh1J1AdaDz8T4mYXyMTeJNzWUjwrhM3Syfk71R6etJn5" ], "script": "base64:BgLnDQgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQEiA1NFUCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIPZ2V0U3RyaW5nT3JGYWlsIgdhZGRyZXNzIgNrZXkiEWtleUZhY3RvcnlBZGRyZXNzIhlrZXlWb3RpbmdWZXJpZmllZENvbnRyYWN0IiJrZXlWb3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0IhRrZXlVc2VyUG9vbHNDb250cmFjdCIda2V5Vm90aW5nRW1pc3Npb25SYXRlQ29udHJhY3QiFnZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiH3ZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiEXVzZXJQb29sc0NvbnRyYWN0Ihp2b3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIYSWR4RmFjdG9yeUNmZ1N0YWtpbmdEYXBwIhlJZHhGYWN0b3J5Q2ZnQm9vc3RpbmdEYXBwIhRJZHhGYWN0b3J5Q2ZnSWRvRGFwcCIVSWR4RmFjdG9yeU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 0 } View: original | compacted Prev: CTsXi4T5zn3gHE44ezhGzyM5cbX64cfZvBRH9yhw3gAM Next: AgGZW6MSatzv6iQWTaWBqxsj7dyLLwqGHqg2wPG5nP5F Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
2121
2222 let keyUserPoolsContract = "%s%s__config__userPoolsContract"
2323
24+let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract"
25+
2426 let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
2527
2628 let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
2729
2830 let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
31+
32+let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract))
2933
3034 let IdxFactoryCfgStakingDapp = 1
3135
109113 let boostCoeffDefault = 3
110114
111115 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
116+
117+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
118+
119+
120+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
121+
112122
113123 func keyManagerPublicKey () = "%s__managerPublicKey"
114124
219229
220230
221231 @Callable(i)
232+func gwxHoldersRewardUpdate () = {
233+ let factoryContract = readFactoryAddressOrFail()
234+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
235+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
236+ let checkCaller = if ((i.caller == gwxRewardsContract))
237+ then true
238+ else mustManager(i)
239+ if ((checkCaller == checkCaller))
240+ then {
241+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
242+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
243+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
244+ let actions = if (shouldBeUpdated)
245+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
246+ else nil
247+ $Tuple2(actions, shouldBeUpdated)
248+ }
249+ else throw("Strict value is not equal to itself.")
250+ }
251+
252+
253+
254+@Callable(i)
222255 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
256+
257+
258+
259+@Callable(i)
260+func changeRatePerBlock (newRatePerBlock) = {
261+ let check = if ((i.caller == votingEmissionRateContract))
262+ then true
263+ else throwErr("should be invoked internally")
264+ if ((check == check))
265+ then {
266+ let blockTimestamp = match blockInfoByHeight(height) {
267+ case bi: BlockInfo =>
268+ bi.timestamp
269+ case _ =>
270+ throwErr("BlockInfo.timestamp error")
271+ }
272+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
273+ }
274+ else throw("Strict value is not equal to itself.")
275+ }
223276
224277
225278 @Verifier(tx)
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
24+let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract"
25+
2426 let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
2527
2628 let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
2729
2830 let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
31+
32+let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract))
2933
3034 let IdxFactoryCfgStakingDapp = 1
3135
3236 let IdxFactoryCfgBoostingDapp = 2
3337
3438 let IdxFactoryCfgIdoDapp = 3
3539
3640 let IdxFactoryCfgTeamDapp = 4
3741
3842 let IdxFactoryCfgEmissionDapp = 5
3943
4044 let IdxFactoryCfgRestDapp = 6
4145
4246 let IdxFactoryCfgSlippageDapp = 7
4347
4448 let IdxFactoryCfgGwxRewardDapp = 10
4549
4650 func keyFactoryCfg () = "%s__factoryConfig"
4751
4852
4953 func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
5054
5155
5256 func keyFactoryLpList () = "%s__lpTokensList"
5357
5458
5559 func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
5660
5761
5862 func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
5963
6064
6165 func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
6266
6367
6468 func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
6569
6670
6771 func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
6872
6973
7074 func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
7175
7276
7377 func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
7478
7579
7680 func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
7781
7882
7983 func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
8084
8185
8286 func keyConfig () = "%s__config"
8387
8488
8589 func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
8690
8791
8892 func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
8993
9094
9195 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
9296
9397
9498 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
9599
96100
97101 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
98102
99103
100104 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
101105
102106
103107 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
104108
105109
106110 func keyBoostCoeff () = "%s__boostCoeff"
107111
108112
109113 let boostCoeffDefault = 3
110114
111115 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
116+
117+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
118+
119+
120+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
121+
112122
113123 func keyManagerPublicKey () = "%s__managerPublicKey"
114124
115125
116126 func keyManagerVaultAddress () = "%s__managerVaultAddress"
117127
118128
119129 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
120130 case s: String =>
121131 addressFromStringValue(s)
122132 case _ =>
123133 this
124134 }
125135
126136
127137 func managerPublicKeyOrUnit () = {
128138 let managerVaultAddress = getManagerVaultAddressOrThis()
129139 match getString(managerVaultAddress, keyManagerPublicKey()) {
130140 case s: String =>
131141 fromBase58String(s)
132142 case _: Unit =>
133143 unit
134144 case _ =>
135145 throw("Match error")
136146 }
137147 }
138148
139149
140150 func mustManager (i) = {
141151 let pd = throwErr("Permission denied")
142152 match managerPublicKeyOrUnit() {
143153 case pk: ByteVector =>
144154 if ((i.callerPublicKey == pk))
145155 then true
146156 else pd
147157 case _: Unit =>
148158 if ((i.caller == this))
149159 then true
150160 else pd
151161 case _ =>
152162 throw("Match error")
153163 }
154164 }
155165
156166
157167 @Callable(i)
158168 func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
159169 let checkCaller = mustManager(i)
160170 if ((checkCaller == checkCaller))
161171 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))]
162172 else throw("Strict value is not equal to itself.")
163173 }
164174
165175
166176
167177 @Callable(i)
168178 func constructorV2 (votingVerifiedContractPrm) = {
169179 let checkCaller = mustManager(i)
170180 if ((checkCaller == checkCaller))
171181 then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit)
172182 else throw("Strict value is not equal to itself.")
173183 }
174184
175185
176186
177187 @Callable(i)
178188 func emit (amount) = if ((0 >= amount))
179189 then $Tuple2(nil, nil)
180190 else {
181191 let factoryContract = readFactoryAddressOrFail()
182192 let factoryCfg = readFactoryCfgOrFail(factoryContract)
183193 let stakingContract = getStakingAddressOrFail(factoryCfg)
184194 let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
185195 let caller = i.caller
186196 if (if ((caller != stakingContract))
187197 then (caller != gwxRewardsContract)
188198 else false)
189199 then throwErr("permissions denied")
190200 else {
191201 let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
192202 let wxAssetId = fromBase58String(wxAssetIdStr)
193203 $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
194204 }
195205 }
196206
197207
198208
199209 @Callable(i)
200210 func burn () = {
201211 let factoryContract = readFactoryAddressOrFail()
202212 let factoryCfg = readFactoryCfgOrFail(factoryContract)
203213 let boostingContract = getBoostingAddressOrFail(factoryCfg)
204214 if ((size(i.payments) != 1))
205215 then throwErr("exact one payment is allowed")
206216 else {
207217 let pmt = i.payments[0]
208218 let assetId = value(pmt.assetId)
209219 let pmtAmount = pmt.amount
210220 let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
211221 if ((assetId != wxAssetId))
212222 then throwErr("invalid wxAssetId is passed")
213223 else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller)))
214224 then throwErr("permissions denied")
215225 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))]
216226 }
217227 }
218228
219229
220230
221231 @Callable(i)
232+func gwxHoldersRewardUpdate () = {
233+ let factoryContract = readFactoryAddressOrFail()
234+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
235+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
236+ let checkCaller = if ((i.caller == gwxRewardsContract))
237+ then true
238+ else mustManager(i)
239+ if ((checkCaller == checkCaller))
240+ then {
241+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
242+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
243+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
244+ let actions = if (shouldBeUpdated)
245+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
246+ else nil
247+ $Tuple2(actions, shouldBeUpdated)
248+ }
249+ else throw("Strict value is not equal to itself.")
250+ }
251+
252+
253+
254+@Callable(i)
222255 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
256+
257+
258+
259+@Callable(i)
260+func changeRatePerBlock (newRatePerBlock) = {
261+ let check = if ((i.caller == votingEmissionRateContract))
262+ then true
263+ else throwErr("should be invoked internally")
264+ if ((check == check))
265+ then {
266+ let blockTimestamp = match blockInfoByHeight(height) {
267+ case bi: BlockInfo =>
268+ bi.timestamp
269+ case _ =>
270+ throwErr("BlockInfo.timestamp error")
271+ }
272+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
273+ }
274+ else throw("Strict value is not equal to itself.")
275+ }
223276
224277
225278 @Verifier(tx)
226279 func verify () = {
227280 let targetPublicKey = match managerPublicKeyOrUnit() {
228281 case pk: ByteVector =>
229282 pk
230283 case _: Unit =>
231284 tx.senderPublicKey
232285 case _ =>
233286 throw("Match error")
234287 }
235288 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
236289 }
237290

github/deemru/w8io/026f985 
36.72 ms