tx · 6UbvHYgHuCTqEh3wKduBwchRxXHcMxtZ5GT3v5fXtBnw

3Mt7JpMPDr7HMccCXifDmDbZBzNZGYhgrCH:  -0.00500000 Waves

2023.03.16 14:52 [2492543] smart account 3Mt7JpMPDr7HMccCXifDmDbZBzNZGYhgrCH > SELF 0.00000000 Waves

{ "type": 13, "id": "6UbvHYgHuCTqEh3wKduBwchRxXHcMxtZ5GT3v5fXtBnw", "fee": 500000, "feeAssetId": null, "timestamp": 1678967533339, "version": 2, "chainId": 84, "sender": "3Mt7JpMPDr7HMccCXifDmDbZBzNZGYhgrCH", "senderPublicKey": "9peBFDoYmeypiQRmi2hKYQ2ov4qjxLErcR2se5AJ4zeK", "proofs": [ "46TqSPAe1F1WyUb6e29ictcgHH72KEAm3gnzLRcFmZhpsCi7DppnaiS6BtdKRpZd8MqFgaJWz7Adj1pWraQ1bgxZ" ], "script": null, "height": 2492543, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GT4R2aQpcgVBr3pG1zXrqtppNqcCoiVzMyerFxH9c99C Next: 9YWuC3sGDtA9MaMCcwLL6VGrcsBzXbhmceS5o2nQ1B4Z Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let SEP = "__"
5-
6-func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined"))
7-
8-
9-func keyFactoryAddress () = "%s%s__config__factoryAddress"
10-
11-
12-let keyVotingVerifiedContract = "%s%s__config__votingVerifiedContract"
13-
14-let keyVotingEmissionCandidateContract = "%s%s__config__votingEmissionCandidateContract"
15-
16-let keyUserPoolsContract = "%s%s__config__userPoolsContract"
17-
18-let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract))
19-
20-let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract))
21-
22-let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract))
23-
24-let IdxFactoryCfgStakingDapp = 1
25-
26-let IdxFactoryCfgBoostingDapp = 2
27-
28-let IdxFactoryCfgIdoDapp = 3
29-
30-let IdxFactoryCfgTeamDapp = 4
31-
32-let IdxFactoryCfgEmissionDapp = 5
33-
34-let IdxFactoryCfgRestDapp = 6
35-
36-let IdxFactoryCfgSlippageDapp = 7
37-
38-let IdxFactoryCfgGwxRewardDapp = 10
39-
40-func keyFactoryCfg () = "%s__factoryConfig"
41-
42-
43-func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
44-
45-
46-func keyFactoryLpList () = "%s__lpTokensList"
47-
48-
49-func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP)
50-
51-
52-func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP)
53-
54-
55-func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress()))
56-
57-
58-func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP)
59-
60-
61-func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP)
62-
63-
64-func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp])
65-
66-
67-func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp])
68-
69-
70-func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp])
71-
72-
73-func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp])
74-
75-
76-func keyConfig () = "%s__config"
77-
78-
79-func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current"
80-
81-
82-func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP)
83-
84-
85-func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current"
86-
87-
88-func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP)
89-
90-
91-func keyEmissionStartBlock () = "%s%s__emission__startBlock"
92-
93-
94-func keyEmissionDurationInBlocks () = "%s%s__emission__duration"
95-
96-
97-func keyEmissionEndBlock () = "%s%s__emission__endBlock"
98-
99-
100-func keyManagerPublicKey () = "%s__managerPublicKey"
101-
102-
103-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
104-
105-
106-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
107- case s: String =>
108- fromBase58String(s)
109- case _: Unit =>
110- unit
111- case _ =>
112- throw("Match error")
113-}
114-
115-
116-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
117- case s: String =>
118- fromBase58String(s)
119- case _: Unit =>
120- unit
121- case _ =>
122- throw("Match error")
123-}
124-
125-
126-func mustManager (i) = {
127- let pd = throw("Permission denied")
128- match managerPublicKeyOrUnit() {
129- case pk: ByteVector =>
130- if ((i.callerPublicKey == pk))
131- then true
132- else pd
133- case _: Unit =>
134- if ((i.caller == this))
135- then true
136- else pd
137- case _ =>
138- throw("Match error")
139- }
140- }
141-
142-
143-@Callable(i)
144-func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = {
145- let checkCaller = mustManager(i)
146- if ((checkCaller == checkCaller))
147- 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))]
148- else throw("Strict value is not equal to itself.")
149- }
150-
151-
152-
153-@Callable(i)
154-func constructorV2 (votingVerifiedContractPrm) = {
155- let checkCaller = mustManager(i)
156- if ((checkCaller == checkCaller))
157- then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit)
158- else throw("Strict value is not equal to itself.")
159- }
160-
161-
162-
163-@Callable(i)
164-func emit (amount) = if ((0 >= amount))
165- then $Tuple2(nil, nil)
166- else {
167- let factoryContract = readFactoryAddressOrFail()
168- let factoryCfg = readFactoryCfgOrFail(factoryContract)
169- let stakingContract = getStakingAddressOrFail(factoryCfg)
170- let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg)
171- let caller = i.caller
172- if (if ((caller != stakingContract))
173- then (caller != gwxRewardsContract)
174- else false)
175- then throw("permissions denied")
176- else {
177- let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1]
178- let wxAssetId = fromBase58String(wxAssetIdStr)
179- $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId])
180- }
181- }
182-
183-
184-
185-@Callable(i)
186-func burn () = {
187- let factoryContract = readFactoryAddressOrFail()
188- let factoryCfg = readFactoryCfgOrFail(factoryContract)
189- let boostingContract = getBoostingAddressOrFail(factoryCfg)
190- if ((size(i.payments) != 1))
191- then throw("exact one payment is allowed")
192- else {
193- let pmt = i.payments[0]
194- let assetId = value(pmt.assetId)
195- let pmtAmount = pmt.amount
196- let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1])
197- if ((assetId != wxAssetId))
198- then throw("invalid wxAssetId is passed")
199- else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller)))
200- then throw("permissions denied")
201- 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))]
202- }
203- }
204-
205-
206-
207-@Callable(i)
208-func setManager (pendingManagerPublicKey) = {
209- let checkCaller = mustManager(i)
210- if ((checkCaller == checkCaller))
211- then {
212- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
213- if ((checkManagerPublicKey == checkManagerPublicKey))
214- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
215- else throw("Strict value is not equal to itself.")
216- }
217- else throw("Strict value is not equal to itself.")
218- }
219-
220-
221-
222-@Callable(i)
223-func confirmManager () = {
224- let pm = pendingManagerPublicKeyOrUnit()
225- let hasPM = if (isDefined(pm))
226- then true
227- else throw("No pending manager")
228- if ((hasPM == hasPM))
229- then {
230- let checkPM = if ((i.callerPublicKey == value(pm)))
231- then true
232- else throw("You are not pending manager")
233- if ((checkPM == checkPM))
234- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
235- else throw("Strict value is not equal to itself.")
236- }
237- else throw("Strict value is not equal to itself.")
238- }
239-
240-
241-@Verifier(tx)
242-func verify () = {
243- let targetPublicKey = match managerPublicKeyOrUnit() {
244- case pk: ByteVector =>
245- pk
246- case _: Unit =>
247- tx.senderPublicKey
248- case _ =>
249- throw("Match error")
250- }
251- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
252- }
253-
1+# no script

github/deemru/w8io/169f3d6 
30.66 ms