tx · FEzvvvkhm6XxPJQLEH2u3REURnSBt6rd6JRKNbLXRnWi 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01400000 Waves 2023.05.31 10:59 [2601879] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "FEzvvvkhm6XxPJQLEH2u3REURnSBt6rd6JRKNbLXRnWi", "fee": 1400000, "feeAssetId": null, "timestamp": 1685519951241, "version": 2, "chainId": 84, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "4kDLfueWUYmkZK7GwEzAfPwyFHdLvEZtsusC9MvifTdUHmbC1LJMd955BDuTYCTdDiQCge6c9PM1KMUix13vMQMJ" ], "script": "base64:BgLgCwgCEgkKBwgBAQEBAQgSAwoBCBIDCgEBEgASABIAEgMKAQESAwoBASIDU0VQIgd3cmFwRXJyIgNtc2ciCHRocm93RXJyIg9nZXRTdHJpbmdPckZhaWwiB2FkZHJlc3MiA2tleSIRa2V5RmFjdG9yeUFkZHJlc3MiGWtleVZvdGluZ1ZlcmlmaWVkQ29udHJhY3QiImtleVZvdGluZ0VtaXNzaW9uQ2FuZGlkYXRlQ29udHJhY3QiFGtleVVzZXJQb29sc0NvbnRyYWN0Ih1rZXlWb3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCIWdm90aW5nVmVyaWZpZWRDb250cmFjdCIfdm90aW5nRW1pc3Npb25DYW5kaWRhdGVDb250cmFjdCIRdXNlclBvb2xzQ29udHJhY3QiGnZvdGluZ0VtaXNzaW9uUmF0ZUNvbnRyYWN0IhhJZHhGYWN0b3J5Q2ZnU3Rha2luZ0RhcHAiGUlkeEZhY3RvcnlDZmdCb29zdGluZ0RhcHAiGklkeEZhY3RvcnlDZmdHd3hSZXdhcmREYXBwIg1rZXlGYWN0b3J5Q2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bGVyBQFwBgkBAVgBBQFZBgkBAWQBAi9zaG91bGQgYmUgaW52b2tlZCBieSB2b3RpbmdFbWlzc2lvblJhdGVDb250cmFjdAMJAAACBQJhegUCYXoEAmFsCQEBdQAEAXkJAQF2AQUCYWwEAmFxCQEBeAEFAXkEAmFDCQD9BwQFAmFxAhVvbkJvb3N0RW1pc3Npb25VcGRhdGUFA25pbAUDbmlsAwkAAAIFAmFDBQJhQwQCYUQJAPwHBAUEdGhpcwIaY2hhbmdlUmF0ZVBlckJsb2NrSU5URVJOQUwJAMwIAgUCYXkFA25pbAUDbmlsAwkAAAIFAmFEBQJhRAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJhRQECYUYABAJhRwQBVAkBAVYAAwkAAQIFAVQCCkJ5dGVWZWN0b3IEAmFhBQFUBQJhYQMJAAECBQFUAgRVbml0CAUCYUUPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmFFCWJvZHlCeXRlcwkAkQMCCAUCYUUGcHJvb2ZzAAAFAmFHqnIf+g==", "height": 2601879, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 86V7ovYsNMTAbaA99dhcFUvhMdSrbAGPcYJrXYTf1wpY Next: 2PN4HQmJLtq1kKcwvUud8MjAVQjns96pqt8fgewNrQrW Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
21 | 21 | ||
22 | 22 | let keyUserPoolsContract = "%s%s__config__userPoolsContract" | |
23 | 23 | ||
24 | + | let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract" | |
25 | + | ||
24 | 26 | let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract)) | |
25 | 27 | ||
26 | 28 | let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract)) | |
27 | 29 | ||
28 | 30 | let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract)) | |
29 | 31 | ||
32 | + | let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract)) | |
33 | + | ||
30 | 34 | let IdxFactoryCfgStakingDapp = 1 | |
31 | 35 | ||
32 | 36 | let IdxFactoryCfgBoostingDapp = 2 | |
33 | - | ||
34 | - | let IdxFactoryCfgIdoDapp = 3 | |
35 | - | ||
36 | - | let IdxFactoryCfgTeamDapp = 4 | |
37 | - | ||
38 | - | let IdxFactoryCfgEmissionDapp = 5 | |
39 | - | ||
40 | - | let IdxFactoryCfgRestDapp = 6 | |
41 | - | ||
42 | - | let IdxFactoryCfgSlippageDapp = 7 | |
43 | 37 | ||
44 | 38 | let IdxFactoryCfgGwxRewardDapp = 10 | |
45 | 39 | ||
46 | 40 | func keyFactoryCfg () = "%s__factoryConfig" | |
47 | 41 | ||
48 | 42 | ||
49 | - | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
50 | - | ||
51 | - | ||
52 | - | func keyFactoryLpList () = "%s__lpTokensList" | |
53 | - | ||
54 | - | ||
55 | - | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
56 | - | ||
57 | - | ||
58 | - | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
59 | - | ||
60 | - | ||
61 | 43 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
62 | - | ||
63 | - | ||
64 | - | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
65 | 44 | ||
66 | 45 | ||
67 | 46 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
68 | 47 | ||
69 | 48 | ||
70 | 49 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
71 | - | ||
72 | - | ||
73 | - | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
74 | 50 | ||
75 | 51 | ||
76 | 52 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
109 | 85 | let boostCoeffDefault = 3 | |
110 | 86 | ||
111 | 87 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
88 | + | ||
89 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
90 | + | ||
91 | + | ||
92 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
93 | + | ||
112 | 94 | ||
113 | 95 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 96 | ||
219 | 201 | ||
220 | 202 | ||
221 | 203 | @Callable(i) | |
204 | + | func gwxHoldersRewardUpdate () = { | |
205 | + | let factoryContract = readFactoryAddressOrFail() | |
206 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
207 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
208 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
209 | + | then true | |
210 | + | else mustManager(i) | |
211 | + | if ((checkCaller == checkCaller)) | |
212 | + | then { | |
213 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
214 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
215 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
216 | + | let actions = if (shouldBeUpdated) | |
217 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
218 | + | else nil | |
219 | + | $Tuple2(actions, shouldBeUpdated) | |
220 | + | } | |
221 | + | else throw("Strict value is not equal to itself.") | |
222 | + | } | |
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | @Callable(i) | |
222 | 227 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | @Callable(i) | |
232 | + | func changeRatePerBlockINTERNAL (newRatePerBlock) = { | |
233 | + | let check = if ((i.caller == this)) | |
234 | + | then true | |
235 | + | else throwErr("should be invoked internally") | |
236 | + | if ((check == check)) | |
237 | + | then { | |
238 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
239 | + | case bi: BlockInfo => | |
240 | + | bi.timestamp | |
241 | + | case _ => | |
242 | + | throwErr("BlockInfo.timestamp error") | |
243 | + | } | |
244 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
245 | + | } | |
246 | + | else throw("Strict value is not equal to itself.") | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | @Callable(i) | |
252 | + | func changeRatePerBlock (newRatePerBlock) = { | |
253 | + | let check = if (if ((i.caller == votingEmissionRateContract)) | |
254 | + | then true | |
255 | + | else mustManager(i)) | |
256 | + | then true | |
257 | + | else throwErr("should be invoked by votingEmissionRateContract") | |
258 | + | if ((check == check)) | |
259 | + | then { | |
260 | + | let factoryContract = readFactoryAddressOrFail() | |
261 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
262 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
263 | + | let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
264 | + | if ((boostingInvoke == boostingInvoke)) | |
265 | + | then { | |
266 | + | let internalInv = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil) | |
267 | + | if ((internalInv == internalInv)) | |
268 | + | then nil | |
269 | + | else throw("Strict value is not equal to itself.") | |
270 | + | } | |
271 | + | else throw("Strict value is not equal to itself.") | |
272 | + | } | |
273 | + | else throw("Strict value is not equal to itself.") | |
274 | + | } | |
223 | 275 | ||
224 | 276 | ||
225 | 277 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
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 | + | let keyVotingEmissionRateContract = "%s%s__config__votingEmissionRateContract" | |
25 | + | ||
24 | 26 | let votingVerifiedContract = addressFromStringValue(getStringOrFail(this, keyVotingVerifiedContract)) | |
25 | 27 | ||
26 | 28 | let votingEmissionCandidateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionCandidateContract)) | |
27 | 29 | ||
28 | 30 | let userPoolsContract = addressFromStringValue(getStringOrFail(this, keyUserPoolsContract)) | |
29 | 31 | ||
32 | + | let votingEmissionRateContract = addressFromStringValue(getStringOrFail(this, keyVotingEmissionRateContract)) | |
33 | + | ||
30 | 34 | let IdxFactoryCfgStakingDapp = 1 | |
31 | 35 | ||
32 | 36 | let IdxFactoryCfgBoostingDapp = 2 | |
33 | - | ||
34 | - | let IdxFactoryCfgIdoDapp = 3 | |
35 | - | ||
36 | - | let IdxFactoryCfgTeamDapp = 4 | |
37 | - | ||
38 | - | let IdxFactoryCfgEmissionDapp = 5 | |
39 | - | ||
40 | - | let IdxFactoryCfgRestDapp = 6 | |
41 | - | ||
42 | - | let IdxFactoryCfgSlippageDapp = 7 | |
43 | 37 | ||
44 | 38 | let IdxFactoryCfgGwxRewardDapp = 10 | |
45 | 39 | ||
46 | 40 | func keyFactoryCfg () = "%s__factoryConfig" | |
47 | 41 | ||
48 | 42 | ||
49 | - | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
50 | - | ||
51 | - | ||
52 | - | func keyFactoryLpList () = "%s__lpTokensList" | |
53 | - | ||
54 | - | ||
55 | - | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
56 | - | ||
57 | - | ||
58 | - | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
59 | - | ||
60 | - | ||
61 | 43 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
62 | - | ||
63 | - | ||
64 | - | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
65 | 44 | ||
66 | 45 | ||
67 | 46 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
68 | 47 | ||
69 | 48 | ||
70 | 49 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
71 | - | ||
72 | - | ||
73 | - | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
74 | 50 | ||
75 | 51 | ||
76 | 52 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
77 | 53 | ||
78 | 54 | ||
79 | 55 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
80 | 56 | ||
81 | 57 | ||
82 | 58 | func keyConfig () = "%s__config" | |
83 | 59 | ||
84 | 60 | ||
85 | 61 | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
86 | 62 | ||
87 | 63 | ||
88 | 64 | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
89 | 65 | ||
90 | 66 | ||
91 | 67 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
92 | 68 | ||
93 | 69 | ||
94 | 70 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
95 | 71 | ||
96 | 72 | ||
97 | 73 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
98 | 74 | ||
99 | 75 | ||
100 | 76 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
101 | 77 | ||
102 | 78 | ||
103 | 79 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
104 | 80 | ||
105 | 81 | ||
106 | 82 | func keyBoostCoeff () = "%s__boostCoeff" | |
107 | 83 | ||
108 | 84 | ||
109 | 85 | let boostCoeffDefault = 3 | |
110 | 86 | ||
111 | 87 | let boostCoeff = valueOrElse(getInteger(this, keyBoostCoeff()), boostCoeffDefault) | |
88 | + | ||
89 | + | func keyGwxHoldersRewardCurrent () = "%s%s__gwxHoldersReward__current" | |
90 | + | ||
91 | + | ||
92 | + | func keyGwxHoldersRewardNext () = "%s%s__gwxHoldersReward__next" | |
93 | + | ||
112 | 94 | ||
113 | 95 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
114 | 96 | ||
115 | 97 | ||
116 | 98 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
117 | 99 | ||
118 | 100 | ||
119 | 101 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
120 | 102 | case s: String => | |
121 | 103 | addressFromStringValue(s) | |
122 | 104 | case _ => | |
123 | 105 | this | |
124 | 106 | } | |
125 | 107 | ||
126 | 108 | ||
127 | 109 | func managerPublicKeyOrUnit () = { | |
128 | 110 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
129 | 111 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
130 | 112 | case s: String => | |
131 | 113 | fromBase58String(s) | |
132 | 114 | case _: Unit => | |
133 | 115 | unit | |
134 | 116 | case _ => | |
135 | 117 | throw("Match error") | |
136 | 118 | } | |
137 | 119 | } | |
138 | 120 | ||
139 | 121 | ||
140 | 122 | func mustManager (i) = { | |
141 | 123 | let pd = throwErr("Permission denied") | |
142 | 124 | match managerPublicKeyOrUnit() { | |
143 | 125 | case pk: ByteVector => | |
144 | 126 | if ((i.callerPublicKey == pk)) | |
145 | 127 | then true | |
146 | 128 | else pd | |
147 | 129 | case _: Unit => | |
148 | 130 | if ((i.caller == this)) | |
149 | 131 | then true | |
150 | 132 | else pd | |
151 | 133 | case _ => | |
152 | 134 | throw("Match error") | |
153 | 135 | } | |
154 | 136 | } | |
155 | 137 | ||
156 | 138 | ||
157 | 139 | @Callable(i) | |
158 | 140 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
159 | 141 | let checkCaller = mustManager(i) | |
160 | 142 | if ((checkCaller == checkCaller)) | |
161 | 143 | 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))] | |
162 | 144 | else throw("Strict value is not equal to itself.") | |
163 | 145 | } | |
164 | 146 | ||
165 | 147 | ||
166 | 148 | ||
167 | 149 | @Callable(i) | |
168 | 150 | func constructorV2 (votingVerifiedContractPrm) = { | |
169 | 151 | let checkCaller = mustManager(i) | |
170 | 152 | if ((checkCaller == checkCaller)) | |
171 | 153 | then $Tuple2([StringEntry(keyVotingVerifiedContract, votingVerifiedContractPrm)], unit) | |
172 | 154 | else throw("Strict value is not equal to itself.") | |
173 | 155 | } | |
174 | 156 | ||
175 | 157 | ||
176 | 158 | ||
177 | 159 | @Callable(i) | |
178 | 160 | func emit (amount) = if ((0 >= amount)) | |
179 | 161 | then $Tuple2(nil, nil) | |
180 | 162 | else { | |
181 | 163 | let factoryContract = readFactoryAddressOrFail() | |
182 | 164 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
183 | 165 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
184 | 166 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
185 | 167 | let caller = i.caller | |
186 | 168 | if (if ((caller != stakingContract)) | |
187 | 169 | then (caller != gwxRewardsContract) | |
188 | 170 | else false) | |
189 | 171 | then throwErr("permissions denied") | |
190 | 172 | else { | |
191 | 173 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
192 | 174 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
193 | 175 | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
194 | 176 | } | |
195 | 177 | } | |
196 | 178 | ||
197 | 179 | ||
198 | 180 | ||
199 | 181 | @Callable(i) | |
200 | 182 | func burn () = { | |
201 | 183 | let factoryContract = readFactoryAddressOrFail() | |
202 | 184 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
203 | 185 | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
204 | 186 | if ((size(i.payments) != 1)) | |
205 | 187 | then throwErr("exact one payment is allowed") | |
206 | 188 | else { | |
207 | 189 | let pmt = i.payments[0] | |
208 | 190 | let assetId = value(pmt.assetId) | |
209 | 191 | let pmtAmount = pmt.amount | |
210 | 192 | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
211 | 193 | if ((assetId != wxAssetId)) | |
212 | 194 | then throwErr("invalid wxAssetId is passed") | |
213 | 195 | else if (!(containsElement([boostingContract, votingVerifiedContract, votingEmissionCandidateContract, userPoolsContract], i.caller))) | |
214 | 196 | then throwErr("permissions denied") | |
215 | 197 | 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))] | |
216 | 198 | } | |
217 | 199 | } | |
218 | 200 | ||
219 | 201 | ||
220 | 202 | ||
221 | 203 | @Callable(i) | |
204 | + | func gwxHoldersRewardUpdate () = { | |
205 | + | let factoryContract = readFactoryAddressOrFail() | |
206 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
207 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
208 | + | let checkCaller = if ((i.caller == gwxRewardsContract)) | |
209 | + | then true | |
210 | + | else mustManager(i) | |
211 | + | if ((checkCaller == checkCaller)) | |
212 | + | then { | |
213 | + | let gwxHolderRewardCurrent = valueOrElse(getInteger(keyGwxHoldersRewardCurrent()), 0) | |
214 | + | let gwxHolderRewardNext = valueOrElse(getInteger(keyGwxHoldersRewardNext()), gwxHolderRewardCurrent) | |
215 | + | let shouldBeUpdated = (gwxHolderRewardCurrent != gwxHolderRewardNext) | |
216 | + | let actions = if (shouldBeUpdated) | |
217 | + | then [IntegerEntry(keyGwxHoldersRewardCurrent(), gwxHolderRewardNext), DeleteEntry(keyGwxHoldersRewardNext())] | |
218 | + | else nil | |
219 | + | $Tuple2(actions, shouldBeUpdated) | |
220 | + | } | |
221 | + | else throw("Strict value is not equal to itself.") | |
222 | + | } | |
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | @Callable(i) | |
222 | 227 | func getBoostCoeffREADONLY () = $Tuple2(nil, boostCoeff) | |
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | @Callable(i) | |
232 | + | func changeRatePerBlockINTERNAL (newRatePerBlock) = { | |
233 | + | let check = if ((i.caller == this)) | |
234 | + | then true | |
235 | + | else throwErr("should be invoked internally") | |
236 | + | if ((check == check)) | |
237 | + | then { | |
238 | + | let blockTimestamp = match blockInfoByHeight(height) { | |
239 | + | case bi: BlockInfo => | |
240 | + | bi.timestamp | |
241 | + | case _ => | |
242 | + | throwErr("BlockInfo.timestamp error") | |
243 | + | } | |
244 | + | [IntegerEntry(keyRatePerBlockStartFrom(blockTimestamp, height), newRatePerBlock), IntegerEntry(keyRatePerBlockCurrent(), newRatePerBlock)] | |
245 | + | } | |
246 | + | else throw("Strict value is not equal to itself.") | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | @Callable(i) | |
252 | + | func changeRatePerBlock (newRatePerBlock) = { | |
253 | + | let check = if (if ((i.caller == votingEmissionRateContract)) | |
254 | + | then true | |
255 | + | else mustManager(i)) | |
256 | + | then true | |
257 | + | else throwErr("should be invoked by votingEmissionRateContract") | |
258 | + | if ((check == check)) | |
259 | + | then { | |
260 | + | let factoryContract = readFactoryAddressOrFail() | |
261 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
262 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
263 | + | let boostingInvoke = reentrantInvoke(boostingContract, "onBoostEmissionUpdate", nil, nil) | |
264 | + | if ((boostingInvoke == boostingInvoke)) | |
265 | + | then { | |
266 | + | let internalInv = invoke(this, "changeRatePerBlockINTERNAL", [newRatePerBlock], nil) | |
267 | + | if ((internalInv == internalInv)) | |
268 | + | then nil | |
269 | + | else throw("Strict value is not equal to itself.") | |
270 | + | } | |
271 | + | else throw("Strict value is not equal to itself.") | |
272 | + | } | |
273 | + | else throw("Strict value is not equal to itself.") | |
274 | + | } | |
223 | 275 | ||
224 | 276 | ||
225 | 277 | @Verifier(tx) | |
226 | 278 | func verify () = { | |
227 | 279 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
228 | 280 | case pk: ByteVector => | |
229 | 281 | pk | |
230 | 282 | case _: Unit => | |
231 | 283 | tx.senderPublicKey | |
232 | 284 | case _ => | |
233 | 285 | throw("Match error") | |
234 | 286 | } | |
235 | 287 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
236 | 288 | } | |
237 | 289 |
github/deemru/w8io/026f985 42.45 ms ◑