tx · 8po6AV1JjYfPx8dQvUyfngpxxLdjaUkecPFBhDgVXsvF 3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx: -0.01000000 Waves 2023.07.03 16:58 [2649821] smart account 3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx > SELF 0.00000000 Waves
{ "type": 13, "id": "8po6AV1JjYfPx8dQvUyfngpxxLdjaUkecPFBhDgVXsvF", "fee": 1000000, "feeAssetId": null, "timestamp": 1688392747130, "version": 1, "sender": "3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx", "senderPublicKey": "62CHk4MqTdq3LqeUycy7TPnpvwrjgerSa2FqAY2EafXn", "proofs": [ "5zwWyi9Ts7zPEBNKWhSxeKoYHtckGqpRUEo3Kczs2wru9FfdcNawiHMir7qVfotPVJ2BxJ14uztdEZN32qhxkg52" ], "script": "base64:BwJVCAISBAoCCAgSBAoCCAESBAoCCAQSBAoCCAISAwoBCBIDCgEBEgMKAQESBQoDAgECEgQKAgIBEgQKAgIBEgUKAwEBARIAEgMKAQgSABIAEgMKAQgSAB4AA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCDGZhY3RvcnkucmlkZQEHd3JhcEVycgEBcwkArAICCQCsAgIFEGNvbnRyYWN0RmlsZW5hbWUCAjogBQFzAQh0aHJvd0VycgEBcwkAAgEJAQd3cmFwRXJyAQUBcwEUa2V5Q2FsY3VsYXRvckFkZHJlc3MAAg4lc19fY2FsY3VsYXRvcgESa2V5VHJlYXN1cnlBZGRyZXNzAAIMJXNfX3RyZWFzdXJ5AQ9rZXlDaGlsZEFkZHJlc3MAAgklc19fY2hpbGQBGGtleUJsb2NrUHJvY2Vzc2luZ1Jld2FyZAACGSVzX19ibG9ja1Byb2Nlc3NpbmdSZXdhcmQBFWtleU5leHRCbG9ja1RvUHJvY2VzcwACFiVzX19uZXh0QmxvY2tUb1Byb2Nlc3MBDGtleUxwQXNzZXRJZAACDSVzX19scEFzc2V0SWQAF2NhbGN1bG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CmJ5UHJvcG9zYWwGBQdieU93bmVyBQdieU93bmVyCqggLA==", "chainId": 84, "height": 2649821, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 85cJLXGv9LjPoE9dFmACeAzx3ZVuryNKaDg5zQqTC8T4 Next: 6UzAfASQVx6Ecb3dsUB23K3RdxiobYfiwWjAXX1MSv9x Diff:
Old | New | Differences | |
---|---|---|---|
39 | 39 | } | |
40 | 40 | ||
41 | 41 | let calculatorAddressOrFail = valueOrErrorMessage(calculatorAddressOption, wrapErr("invalid calculator address")) | |
42 | + | ||
43 | + | let treasuryAddressOption = match getString(this, keyTreasuryAddress()) { | |
44 | + | case s: String => | |
45 | + | addressFromString(s) | |
46 | + | case _: Unit => | |
47 | + | unit | |
48 | + | case _ => | |
49 | + | throw("Match error") | |
50 | + | } | |
51 | + | ||
52 | + | let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid proxy treasury address")) | |
42 | 53 | ||
43 | 54 | func keyConfigAddress () = "%s__config" | |
44 | 55 | ||
188 | 199 | ||
189 | 200 | ||
190 | 201 | @Callable(i) | |
191 | - | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, xtnPrice, pwrManagersBonus, treasuryVolumeDiffAllocationCoef], i.payments)) | |
202 | + | func transferFromProxyTreasury (recipientBytes,rewardsAmount) = if (onlyCalculator(i)) | |
203 | + | then $Tuple2(nil, invoke(treasuryAddressOrFail, "transferWaves", [recipientBytes, rewardsAmount], nil)) | |
204 | + | else $Tuple2(nil, unit) | |
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | @Callable(i) | |
209 | + | func finalize (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], i.payments)) | |
192 | 210 | ||
193 | 211 | ||
194 | 212 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let contractFilename = "factory.ride" | |
7 | 7 | ||
8 | 8 | func wrapErr (s) = ((contractFilename + ": ") + s) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func throwErr (s) = throw(wrapErr(s)) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyCalculatorAddress () = "%s__calculator" | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyTreasuryAddress () = "%s__treasury" | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyChildAddress () = "%s__child" | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyBlockProcessingReward () = "%s__blockProcessingReward" | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func keyNextBlockToProcess () = "%s__nextBlockToProcess" | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyLpAssetId () = "%s__lpAssetId" | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | let calculatorAddressOption = match getString(this, keyCalculatorAddress()) { | |
33 | 33 | case s: String => | |
34 | 34 | addressFromString(s) | |
35 | 35 | case _: Unit => | |
36 | 36 | unit | |
37 | 37 | case _ => | |
38 | 38 | throw("Match error") | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | let calculatorAddressOrFail = valueOrErrorMessage(calculatorAddressOption, wrapErr("invalid calculator address")) | |
42 | + | ||
43 | + | let treasuryAddressOption = match getString(this, keyTreasuryAddress()) { | |
44 | + | case s: String => | |
45 | + | addressFromString(s) | |
46 | + | case _: Unit => | |
47 | + | unit | |
48 | + | case _ => | |
49 | + | throw("Match error") | |
50 | + | } | |
51 | + | ||
52 | + | let treasuryAddressOrFail = valueOrErrorMessage(treasuryAddressOption, wrapErr("invalid proxy treasury address")) | |
42 | 53 | ||
43 | 54 | func keyConfigAddress () = "%s__config" | |
44 | 55 | ||
45 | 56 | ||
46 | 57 | func keyChildrenAddress () = "contract_children" | |
47 | 58 | ||
48 | 59 | ||
49 | 60 | func keyVotingResultAddress () = "contract_voting_result" | |
50 | 61 | ||
51 | 62 | ||
52 | 63 | func keyProposalAllowBroadcast (address,txId) = ((("proposal_allow_broadcast_" + toString(address)) + "_") + toBase58String(txId)) | |
53 | 64 | ||
54 | 65 | ||
55 | 66 | func keyInvestedByUser (childAddress,userAddress) = makeString(["investor", toString(childAddress), toString(userAddress)], "_") | |
56 | 67 | ||
57 | 68 | ||
58 | 69 | let configAddressOption = match getString(this, keyConfigAddress()) { | |
59 | 70 | case s: String => | |
60 | 71 | addressFromString(s) | |
61 | 72 | case _: Unit => | |
62 | 73 | unit | |
63 | 74 | case _ => | |
64 | 75 | throw("Match error") | |
65 | 76 | } | |
66 | 77 | ||
67 | 78 | let configAddressOrFail = valueOrErrorMessage(configAddressOption, wrapErr("invalid config address")) | |
68 | 79 | ||
69 | 80 | let votingResultAddressOption = match configAddressOption { | |
70 | 81 | case a: Address => | |
71 | 82 | match getString(a, keyVotingResultAddress()) { | |
72 | 83 | case s: String => | |
73 | 84 | addressFromString(s) | |
74 | 85 | case _: Unit => | |
75 | 86 | unit | |
76 | 87 | case _ => | |
77 | 88 | throw("Match error") | |
78 | 89 | } | |
79 | 90 | case _: Unit => | |
80 | 91 | unit | |
81 | 92 | case _ => | |
82 | 93 | throw("Match error") | |
83 | 94 | } | |
84 | 95 | ||
85 | 96 | let votingResultAddressOrFail = valueOrErrorMessage(votingResultAddressOption, wrapErr("invalid voting result address")) | |
86 | 97 | ||
87 | 98 | let childrenAddressOption = match configAddressOption { | |
88 | 99 | case a: Address => | |
89 | 100 | match getString(a, keyChildrenAddress()) { | |
90 | 101 | case s: String => | |
91 | 102 | addressFromString(s) | |
92 | 103 | case _: Unit => | |
93 | 104 | unit | |
94 | 105 | case _ => | |
95 | 106 | throw("Match error") | |
96 | 107 | } | |
97 | 108 | case _: Unit => | |
98 | 109 | unit | |
99 | 110 | case _ => | |
100 | 111 | throw("Match error") | |
101 | 112 | } | |
102 | 113 | ||
103 | 114 | let childrenAddressOrFail = valueOrErrorMessage(childrenAddressOption, wrapErr("invalid children address")) | |
104 | 115 | ||
105 | 116 | let lpAssetIdOption = match getString(this, keyLpAssetId()) { | |
106 | 117 | case s: String => | |
107 | 118 | fromBase58String(s) | |
108 | 119 | case _: Unit => | |
109 | 120 | unit | |
110 | 121 | case _ => | |
111 | 122 | throw("Match error") | |
112 | 123 | } | |
113 | 124 | ||
114 | 125 | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
115 | 126 | ||
116 | 127 | func onlyAddress (i,address) = if ((i.caller == address)) | |
117 | 128 | then true | |
118 | 129 | else throwErr("permission denied") | |
119 | 130 | ||
120 | 131 | ||
121 | 132 | func onlyThis (i) = onlyAddress(i, this) | |
122 | 133 | ||
123 | 134 | ||
124 | 135 | func onlyCalculator (i) = onlyAddress(i, calculatorAddressOrFail) | |
125 | 136 | ||
126 | 137 | ||
127 | 138 | @Callable(i) | |
128 | 139 | func stringEntry (key,val) = if (onlyCalculator(i)) | |
129 | 140 | then $Tuple2([StringEntry(key, val)], key) | |
130 | 141 | else $Tuple2(nil, unit) | |
131 | 142 | ||
132 | 143 | ||
133 | 144 | ||
134 | 145 | @Callable(i) | |
135 | 146 | func integerEntry (key,val) = if (onlyCalculator(i)) | |
136 | 147 | then $Tuple2([IntegerEntry(key, val)], key) | |
137 | 148 | else $Tuple2(nil, unit) | |
138 | 149 | ||
139 | 150 | ||
140 | 151 | ||
141 | 152 | @Callable(i) | |
142 | 153 | func booleanEntry (key,val) = if (onlyCalculator(i)) | |
143 | 154 | then $Tuple2([BooleanEntry(key, val)], key) | |
144 | 155 | else $Tuple2(nil, unit) | |
145 | 156 | ||
146 | 157 | ||
147 | 158 | ||
148 | 159 | @Callable(i) | |
149 | 160 | func binaryEntry (key,val) = if (onlyCalculator(i)) | |
150 | 161 | then $Tuple2([BinaryEntry(key, val)], key) | |
151 | 162 | else $Tuple2(nil, unit) | |
152 | 163 | ||
153 | 164 | ||
154 | 165 | ||
155 | 166 | @Callable(i) | |
156 | 167 | func deleteEntry (key) = if (onlyCalculator(i)) | |
157 | 168 | then $Tuple2([DeleteEntry(key)], key) | |
158 | 169 | else $Tuple2(nil, unit) | |
159 | 170 | ||
160 | 171 | ||
161 | 172 | ||
162 | 173 | @Callable(i) | |
163 | 174 | func reissue (amount) = if (onlyCalculator(i)) | |
164 | 175 | then $Tuple2([Reissue(lpAssetIdOrFail, amount, true)], amount) | |
165 | 176 | else $Tuple2(nil, unit) | |
166 | 177 | ||
167 | 178 | ||
168 | 179 | ||
169 | 180 | @Callable(i) | |
170 | 181 | func burn (amount) = if (onlyCalculator(i)) | |
171 | 182 | then $Tuple2([Burn(lpAssetIdOrFail, amount)], amount) | |
172 | 183 | else $Tuple2(nil, unit) | |
173 | 184 | ||
174 | 185 | ||
175 | 186 | ||
176 | 187 | @Callable(i) | |
177 | 188 | func transferAsset (recepientBytes,amount,assetId) = if (onlyCalculator(i)) | |
178 | 189 | then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, assetId)], amount) | |
179 | 190 | else $Tuple2(nil, unit) | |
180 | 191 | ||
181 | 192 | ||
182 | 193 | ||
183 | 194 | @Callable(i) | |
184 | 195 | func transferWaves (recepientBytes,amount) = if (onlyCalculator(i)) | |
185 | 196 | then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, unit)], amount) | |
186 | 197 | else $Tuple2(nil, unit) | |
187 | 198 | ||
188 | 199 | ||
189 | 200 | ||
190 | 201 | @Callable(i) | |
191 | - | func finalize (newTreasuryVolumeInWaves,xtnPrice,pwrManagersBonus,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, xtnPrice, pwrManagersBonus, treasuryVolumeDiffAllocationCoef], i.payments)) | |
202 | + | func transferFromProxyTreasury (recipientBytes,rewardsAmount) = if (onlyCalculator(i)) | |
203 | + | then $Tuple2(nil, invoke(treasuryAddressOrFail, "transferWaves", [recipientBytes, rewardsAmount], nil)) | |
204 | + | else $Tuple2(nil, unit) | |
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | @Callable(i) | |
209 | + | func finalize (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], i.payments)) | |
192 | 210 | ||
193 | 211 | ||
194 | 212 | ||
195 | 213 | @Callable(i) | |
196 | 214 | func claimLP () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimLP", [i.caller.bytes], i.payments)) | |
197 | 215 | ||
198 | 216 | ||
199 | 217 | ||
200 | 218 | @Callable(i) | |
201 | 219 | func claimWaves (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimWaves", [i.caller.bytes, fromBase58String(txIdStr)], i.payments)) | |
202 | 220 | ||
203 | 221 | ||
204 | 222 | ||
205 | 223 | @Callable(i) | |
206 | 224 | func invest () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "invest", [i.caller.bytes], i.payments)) | |
207 | 225 | ||
208 | 226 | ||
209 | 227 | ||
210 | 228 | @Callable(i) | |
211 | 229 | func withdraw () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "withdraw", [i.caller.bytes], i.payments)) | |
212 | 230 | ||
213 | 231 | ||
214 | 232 | ||
215 | 233 | @Callable(i) | |
216 | 234 | func cancelWithdraw (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "cancelWithdraw", [i.caller.bytes, fromBase58String(txIdStr)], i.payments)) | |
217 | 235 | ||
218 | 236 | ||
219 | 237 | ||
220 | 238 | @Callable(i) | |
221 | 239 | func processBlocks () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "processBlocks", [i.caller.bytes], i.payments)) | |
222 | 240 | ||
223 | 241 | ||
224 | 242 | @Verifier(tx) | |
225 | 243 | func verify () = { | |
226 | 244 | let byProposal = valueOrElse(getBoolean(votingResultAddressOrFail, keyProposalAllowBroadcast(this, tx.id)), false) | |
227 | 245 | let byOwner = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
228 | 246 | if ((votingResultAddressOption != unit)) | |
229 | 247 | then if (byProposal) | |
230 | 248 | then true | |
231 | 249 | else byOwner | |
232 | 250 | else byOwner | |
233 | 251 | } | |
234 | 252 |
github/deemru/w8io/026f985 44.40 ms ◑