tx · TNGSjtbGVKhaZFEee4E8MWr22wGjXm6vnBRV63HeQ8K

3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA:  -0.01300000 Waves

2023.06.06 12:31 [2610633] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves

{ "type": 13, "id": "TNGSjtbGVKhaZFEee4E8MWr22wGjXm6vnBRV63HeQ8K", "fee": 1300000, "feeAssetId": null, "timestamp": 1686043873913, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "2th7oszH3iqqiWR82TpqeYfouHuFQTdKZ8acmBDEAm7eJZ4AADCj96RfJYNJgDgpkbPskRtpHMBvr18LnaiXLJ2z" ], "script": "base64:BgKMDggCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQEiA1NFUCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIPZ2V0U3RyaW5nT3JGYWlsIgdhZGRyZXNzIgNrZXkiEWtleUZhY3RvcnlBZGRyZXNzIhlrZXlWb3RpbmdWZXJpZmllZENvbnRyYWN0IiJrZXlWb3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0IhRrZXlVc2VyUG9vbHNDb250cmFjdCIda2V5Vm90aW5nRW1pc3Npb25SYXRlQ29udHJhY3QiFnZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiH3ZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiEXVzZXJQb29sc0NvbnRyYWN0Ihp2b3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIYSWR4RmFjdG9yeUNmZ1N0YWtpbmdEYXBwIhlJZHhGYWN0b3J5Q2ZnQm9vc3RpbmdEYXBwIhRJZHhGYWN0b3J5Q2ZnSWRvRGFwcCIVSWR4RmFjdG9yeUN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BlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJhUgECYVMABAJhVAQCYWgJAQJhagADCQABAgUCYWgCCkJ5dGVWZWN0b3IEAmFvBQJhaAUCYW8DCQABAgUCYWgCBFVuaXQIBQJhUg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCYVIJYm9keUJ5dGVzCQCRAwIIBQJhUgZwcm9vZnMAAAUCYVQS84Eq", "height": 2610633, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BSNgrMg4mT4g7KrnKGQHVECrtzrXftLm6K6MQqcu1VZw Next: none 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
9195 func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
9296
9397
98+func keyRatePerBlockNext () = "%s%s__ratePerBlock__next"
99+
100+
94101 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
95102
96103
109116 let boostCoeffDefault = 3
110117
111118 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
119+
120+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
121+
122+
123+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
124+
112125
113126 func keyManagerPublicKey () = "%s__managerPublicKey"
114127
219232
220233
221234 @Callable(i)
235+func gwxHoldersRewardUpdate () = {
236+ let factoryContract = readFactoryAddressOrFail()
237+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
238+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
239+ let checkCaller = if ((i.caller == gwxRewardsContract))
240+ then true
241+ else mustManager(i)
242+ if ((checkCaller == checkCaller))
243+ then {
244+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
245+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
246+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
247+ let actions = if (shouldBeUpdated)
248+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
249+ else nil
250+ $Tuple2(actions, shouldBeUpdated)
251+ }
252+ else throw("Strict value is not equal to itself.")
253+ }
254+
255+
256+
257+@Callable(i)
222258 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
259+
260+
261+
262+@Callable(i)
263+func changeRatePerBlock (newRatePerBlock) = {
264+ let check = if (if ((i.caller == votingEmissionRateContract))
265+ then true
266+ else mustManager(i))
267+ then true
268+ else throwErr("should be invoked by votingEmissionRateContract")
269+ if ((check == check))
270+ then {
271+ let factoryContract = readFactoryAddressOrFail()
272+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
273+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
274+ let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil)
275+ if ((boostingInvoke == boostingInvoke))
276+ then {
277+ let blockTimestamp = match blockInfoByHeight(height) {
278+ case bi: BlockInfo =>
279+ bi.timestamp
280+ case _ =>
281+ throwErr("BlockInfo.timestamp error")
282+ }
283+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
284+ }
285+ else throw("Strict value is not equal to itself.")
286+ }
287+ else throw("Strict value is not equal to itself.")
288+ }
223289
224290
225291 @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
98+func keyRatePerBlockNext () = "%s%s__ratePerBlock__next"
99+
100+
94101 func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
95102
96103
97104 func keyEmissionStartBlock () = "%s%s__emission__startBlock"
98105
99106
100107 func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
101108
102109
103110 func keyEmissionEndBlock () = "%s%s__emission__endBlock"
104111
105112
106113 func keyBoostCoeff () = "%s__boostCoeff"
107114
108115
109116 let boostCoeffDefault = 3
110117
111118 let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault)
119+
120+func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current"
121+
122+
123+func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next"
124+
112125
113126 func keyManagerPublicKey () = "%s__managerPublicKey"
114127
115128
116129 func keyManagerVaultAddress () = "%s__managerVaultAddress"
117130
118131
119132 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
120133 case s: String =>
121134 addressFromStringValue(s)
122135 case _ =>
123136 this
124137 }
125138
126139
127140 func managerPublicKeyOrUnit () = {
128141 let managerVaultAddress = getManagerVaultAddressOrThis()
129142 match getString(managerVaultAddress, keyManagerPublicKey()) {
130143 case s: String =>
131144 fromBase58String(s)
132145 case _: Unit =>
133146 unit
134147 case _ =>
135148 throw("Match error")
136149 }
137150 }
138151
139152
140153 func mustManager (i) = {
141154 let pd = throwErr("Permission denied")
142155 match managerPublicKeyOrUnit() {
143156 case pk: ByteVector =>
144157 if ((i.callerPublicKey == pk))
145158 then true
146159 else pd
147160 case _: Unit =>
148161 if ((i.caller == this))
149162 then true
150163 else pd
151164 case _ =>
152165 throw("Match error")
153166 }
154167 }
155168
156169
157170 @Callable(i)
158171 func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
159172 let checkCaller = mustManager(i)
160173 if ((checkCaller == checkCaller))
161174 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))]
162175 else throw("Strict value is not equal to itself.")
163176 }
164177
165178
166179
167180 @Callable(i)
168181 func constructorV2 (votingVerifiedContractPrm) = {
169182 let checkCaller = mustManager(i)
170183 if ((checkCaller == checkCaller))
171184 then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit)
172185 else throw("Strict value is not equal to itself.")
173186 }
174187
175188
176189
177190 @Callable(i)
178191 func emit (amount) = if ((0 >= amount))
179192 then $Tuple2(nil, nil)
180193 else {
181194 let factoryContract = readFactoryAddressOrFail()
182195 let factoryCfg = readFactoryCfgOrFail(factoryContract)
183196 let stakingContract = getStakingAddressOrFail(factoryCfg)
184197 let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
185198 let caller = i.caller
186199 if (if ((caller != stakingContract))
187200 then (caller != gwxRewardsContract)
188201 else false)
189202 then throwErr("permissions denied")
190203 else {
191204 let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
192205 let wxAssetId = fromBase58String(wxAssetIdStr)
193206 $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
194207 }
195208 }
196209
197210
198211
199212 @Callable(i)
200213 func burn () = {
201214 let factoryContract = readFactoryAddressOrFail()
202215 let factoryCfg = readFactoryCfgOrFail(factoryContract)
203216 let boostingContract = getBoostingAddressOrFail(factoryCfg)
204217 if ((size(i.payments) != 1))
205218 then throwErr("exact one payment is allowed")
206219 else {
207220 let pmt = i.payments[0]
208221 let assetId = value(pmt.assetId)
209222 let pmtAmount = pmt.amount
210223 let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
211224 if ((assetId != wxAssetId))
212225 then throwErr("invalid wxAssetId is passed")
213226 else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller)))
214227 then throwErr("permissions denied")
215228 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))]
216229 }
217230 }
218231
219232
220233
221234 @Callable(i)
235+func gwxHoldersRewardUpdate () = {
236+ let factoryContract = readFactoryAddressOrFail()
237+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
238+ let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
239+ let checkCaller = if ((i.caller == gwxRewardsContract))
240+ then true
241+ else mustManager(i)
242+ if ((checkCaller == checkCaller))
243+ then {
244+ let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0)
245+ let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent)
246+ let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext)
247+ let actions = if (shouldBeUpdated)
248+ then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())]
249+ else nil
250+ $Tuple2(actions, shouldBeUpdated)
251+ }
252+ else throw("Strict value is not equal to itself.")
253+ }
254+
255+
256+
257+@Callable(i)
222258 func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff)
259+
260+
261+
262+@Callable(i)
263+func changeRatePerBlock (newRatePerBlock) = {
264+ let check = if (if ((i.caller == votingEmissionRateContract))
265+ then true
266+ else mustManager(i))
267+ then true
268+ else throwErr("should be invoked by votingEmissionRateContract")
269+ if ((check == check))
270+ then {
271+ let factoryContract = readFactoryAddressOrFail()
272+ let factoryCfg = readFactoryCfgOrFail(factoryContract)
273+ let boostingContract = getBoostingAddressOrFail(factoryCfg)
274+ let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil)
275+ if ((boostingInvoke == boostingInvoke))
276+ then {
277+ let blockTimestamp = match blockInfoByHeight(height) {
278+ case bi: BlockInfo =>
279+ bi.timestamp
280+ case _ =>
281+ throwErr("BlockInfo.timestamp error")
282+ }
283+[IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)]
284+ }
285+ else throw("Strict value is not equal to itself.")
286+ }
287+ else throw("Strict value is not equal to itself.")
288+ }
223289
224290
225291 @Verifier(tx)
226292 func verify () = {
227293 let targetPublicKey = match managerPublicKeyOrUnit() {
228294 case pk: ByteVector =>
229295 pk
230296 case _: Unit =>
231297 tx.senderPublicKey
232298 case _ =>
233299 throw("Match error")
234300 }
235301 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
236302 }
237303

github/deemru/w8io/026f985 
44.75 ms