tx · CvSu5MEu2Ubiytf8BouHwABQ6DiJDUj9HjeiUSw73qEy 3MtbzcFZjxhPwaM1HoYr7sSSGDk7bjBsRNN: -0.03700000 Waves 2023.07.19 15:53 [2672772] smart account 3MtbzcFZjxhPwaM1HoYr7sSSGDk7bjBsRNN > SELF 0.00000000 Waves
{ "type": 13, "id": "CvSu5MEu2Ubiytf8BouHwABQ6DiJDUj9HjeiUSw73qEy", "fee": 3700000, "feeAssetId": null, "timestamp": 1689771263231, "version": 2, "chainId": 84, "sender": "3MtbzcFZjxhPwaM1HoYr7sSSGDk7bjBsRNN", "senderPublicKey": "269hMEydX4R6CjK9TRgFMec4TtjsckD91Vxo2pzLVzv4", "proofs": [ "2LpSVCkLcJWwwWpTQV5GYug2BJmPo45dJwUQCGMiYcbEX5vDBPH4fDEfRu9zLUqMKfLoat2JZ7WpfUEBzR338rjh" ], "script": "base64:BgIrCAISBQoDCAgIEgASABIECgIICBIECgIICBIECgIIARIAEgMKAQgSAwoBCCMAB2tfZnVuZHMCB2tfZnVuZHMAF2tfYXNzZXRfbWFuYWdlcl9hZGRyZXNzAhdrX2Fzc2V0X21hbmFnZXJfYWRkcmVzcwAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzABBrX29yZGVyc19hZGRyZXNzAhBrX29yZGVyc19hZGRyZXNzAA9rX3ZhdWx0X2FkZHJlc3MCD2tfdmF1bHRfYWRkcmVzcwAFa19hbW0CBWtfYW1tAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwARa19zdGFraW5nX2FkZHJlc3MCEWtfc3Rha2luZ19hZGRyZXNzAA5rX3Nwb3RfYWRkcmVzcwIOa19zcG90X2FkZHJlc3MAEWtfZmFybWluZ19hZGRyZXNzAhFrX2Zhcm1pbmdfYWRkcmVzcwAOa19yZXdhcmRfYXNzZXQCDmtfcmV3YXJkX2Fzc2V0AAdrX3ZhdWx0AgdrX3ZhdWx0AA1rX2luaXRp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ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEDmNvb3JkaW5hdG9yU3RyCQCdCAIFBHRoaXMFFGtfY29vcmRpbmF0b3JBZGRyZXNzAwkBCWlzRGVmaW5lZAEFDmNvb3JkaW5hdG9yU3RyBAVhZG1pbgkAnQgCCQERQGV4dHJOYXRpdmUoMTA2MikBCQEFdmFsdWUBBQ5jb29yZGluYXRvclN0cgUPa19hZG1pbl9hZGRyZXNzAwkBCWlzRGVmaW5lZAEFBWFkbWluCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFBWFkbWluCQCsAgIJAKwCAgkArAICAgdzdGF0dXNfCQClCAEFBHRoaXMCAV8JANgEAQgFAnR4AmlkBwkAAgECLnVuYWJsZSB0byB2ZXJpZnk6IGFkbWluIG5vdCBzZXQgaW4gY29vcmRpbmF0b3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXlXrUJ9", "height": 2672772, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 96AL2QmC5qpFvHrjqzcpaEVuMgfV6tDWV95jhZWrx3Tw Next: none Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | ||
20 | 20 | let k_spot_address = "k_spot_address" | |
21 | 21 | ||
22 | + | let k_farming_address = "k_farming_address" | |
23 | + | ||
24 | + | let k_reward_asset = "k_reward_asset" | |
25 | + | ||
22 | 26 | let k_vault = "k_vault" | |
23 | 27 | ||
24 | 28 | let k_initialized = "k_initialized" | |
25 | 29 | ||
26 | 30 | let k_paused = "k_paused" | |
31 | + | ||
32 | + | let k_profitDirection = "k_profitDirection" | |
33 | + | ||
34 | + | let PROFIT_LP = 1 | |
35 | + | ||
36 | + | let PROFIT_FARM = 2 | |
27 | 37 | ||
28 | 38 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
29 | 39 | ||
49 | 59 | func spotAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")), "Spot address invalid") | |
50 | 60 | ||
51 | 61 | ||
62 | + | func farmingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_farming_address)), "Farming not set") | |
63 | + | ||
64 | + | ||
65 | + | func rewardAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_reward_asset), "Reward asset not set")) | |
66 | + | ||
67 | + | ||
52 | 68 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
53 | 69 | ||
54 | 70 | ||
56 | 72 | ||
57 | 73 | ||
58 | 74 | func assetManagerAddress (_assetId) = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, toCompositeKey(k_asset_manager_address, _assetId)), ("No asset manager for token " + _assetId))), ("Invalid asset manager address for token " + _assetId)) | |
75 | + | ||
76 | + | ||
77 | + | func profitDirection () = valueOrElse(getInteger(this, k_profitDirection), PROFIT_LP) | |
59 | 78 | ||
60 | 79 | ||
61 | 80 | func isSpotVault (_address) = { | |
114 | 133 | else false) | |
115 | 134 | then throw("Invalid addTokenVault params") | |
116 | 135 | else [StringEntry(toCompositeKey(k_asset_manager_address, _assetId), toString(addressFromStringValue(_vaultAddress)))] | |
136 | + | ||
137 | + | ||
138 | + | ||
139 | + | @Callable(i) | |
140 | + | func changeAssetManager (_assetId,_vaultAddress) = if (if (if (!(initialized())) | |
141 | + | then true | |
142 | + | else (i.caller != adminAddress())) | |
143 | + | then true | |
144 | + | else if (!(isDefined(getString(toCompositeKey(k_asset_manager_address, _assetId))))) | |
145 | + | then (balanceOf(_assetId) > 0) | |
146 | + | else false) | |
147 | + | then throw("Invalid changeAssetManager params") | |
148 | + | else { | |
149 | + | let actualBalance = balanceOf(_assetId) | |
150 | + | if ((actualBalance == actualBalance)) | |
151 | + | then { | |
152 | + | let unstake = invoke(assetManagerAddress(_assetId), "withdraw", [_assetId, actualBalance], nil) | |
153 | + | if ((unstake == unstake)) | |
154 | + | then { | |
155 | + | let stake = invoke(addressFromStringValue(_vaultAddress), "deposit", nil, [AttachedPayment(fromBase58String(_assetId), actualBalance)]) | |
156 | + | if ((stake == stake)) | |
157 | + | then [StringEntry(toCompositeKey(k_asset_manager_address, _assetId), toString(addressFromStringValue(_vaultAddress)))] | |
158 | + | else throw("Strict value is not equal to itself.") | |
159 | + | } | |
160 | + | else throw("Strict value is not equal to itself.") | |
161 | + | } | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
117 | 164 | ||
118 | 165 | ||
119 | 166 | ||
184 | 231 | case _ => | |
185 | 232 | throw("Invalid claimProfit result type") | |
186 | 233 | } | |
187 | - | | |
234 | + | let profitAsset = if ((_assetId == "WAVES")) | |
188 | 235 | then unit | |
189 | - | else fromBase58String(_assetId))], profit) | |
236 | + | else fromBase58String(_assetId) | |
237 | + | let profitReceiver = if (if ((profitAsset == rewardAsset())) | |
238 | + | then (profitDirection() == PROFIT_FARM) | |
239 | + | else false) | |
240 | + | then farmingAddress() | |
241 | + | else i.caller | |
242 | + | $Tuple2([ScriptTransfer(profitReceiver, profit, profitAsset)], profit) | |
190 | 243 | } | |
191 | 244 | else throw("Strict value is not equal to itself.") | |
192 | 245 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_funds = "k_funds" | |
5 | 5 | ||
6 | 6 | let k_asset_manager_address = "k_asset_manager_address" | |
7 | 7 | ||
8 | 8 | let k_coordinatorAddress = "k_coordinatorAddress" | |
9 | 9 | ||
10 | 10 | let k_orders_address = "k_orders_address" | |
11 | 11 | ||
12 | 12 | let k_vault_address = "k_vault_address" | |
13 | 13 | ||
14 | 14 | let k_amm = "k_amm" | |
15 | 15 | ||
16 | 16 | let k_admin_address = "k_admin_address" | |
17 | 17 | ||
18 | 18 | let k_staking_address = "k_staking_address" | |
19 | 19 | ||
20 | 20 | let k_spot_address = "k_spot_address" | |
21 | 21 | ||
22 | + | let k_farming_address = "k_farming_address" | |
23 | + | ||
24 | + | let k_reward_asset = "k_reward_asset" | |
25 | + | ||
22 | 26 | let k_vault = "k_vault" | |
23 | 27 | ||
24 | 28 | let k_initialized = "k_initialized" | |
25 | 29 | ||
26 | 30 | let k_paused = "k_paused" | |
31 | + | ||
32 | + | let k_profitDirection = "k_profitDirection" | |
33 | + | ||
34 | + | let PROFIT_LP = 1 | |
35 | + | ||
36 | + | let PROFIT_FARM = 2 | |
27 | 37 | ||
28 | 38 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
29 | 39 | ||
30 | 40 | ||
31 | 41 | func balanceOf (_assetId) = valueOrElse(getInteger(this, toCompositeKey(k_funds, _assetId)), 0) | |
32 | 42 | ||
33 | 43 | ||
34 | 44 | func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set Manager")), "Coordinator address invalid") | |
35 | 45 | ||
36 | 46 | ||
37 | 47 | func vaultAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_vault_address), "Vault address not set")), "Vault address invalid") | |
38 | 48 | ||
39 | 49 | ||
40 | 50 | func ordersAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_orders_address), "Orders address not set")), "Orders address invalid") | |
41 | 51 | ||
42 | 52 | ||
43 | 53 | func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set")) | |
44 | 54 | ||
45 | 55 | ||
46 | 56 | func stakingAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_staking_address), "Staking address not set")), "Staking address invalid") | |
47 | 57 | ||
48 | 58 | ||
49 | 59 | func spotAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")), "Spot address invalid") | |
50 | 60 | ||
51 | 61 | ||
62 | + | func farmingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_farming_address)), "Farming not set") | |
63 | + | ||
64 | + | ||
65 | + | func rewardAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_reward_asset), "Reward asset not set")) | |
66 | + | ||
67 | + | ||
52 | 68 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
53 | 69 | ||
54 | 70 | ||
55 | 71 | func paused () = valueOrElse(getBoolean(this, k_paused), false) | |
56 | 72 | ||
57 | 73 | ||
58 | 74 | func assetManagerAddress (_assetId) = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, toCompositeKey(k_asset_manager_address, _assetId)), ("No asset manager for token " + _assetId))), ("Invalid asset manager address for token " + _assetId)) | |
75 | + | ||
76 | + | ||
77 | + | func profitDirection () = valueOrElse(getInteger(this, k_profitDirection), PROFIT_LP) | |
59 | 78 | ||
60 | 79 | ||
61 | 80 | func isSpotVault (_address) = { | |
62 | 81 | let spot = spotAddress() | |
63 | 82 | valueOrElse(getBoolean(spot, toCompositeKey(k_vault, _address)), false) | |
64 | 83 | } | |
65 | 84 | ||
66 | 85 | ||
67 | 86 | func isWhitelist (_address) = if (if (if ((_address == toString(stakingAddress()))) | |
68 | 87 | then true | |
69 | 88 | else (_address == toString(vaultAddress()))) | |
70 | 89 | then true | |
71 | 90 | else (_address == toString(ordersAddress()))) | |
72 | 91 | then true | |
73 | 92 | else isSpotVault(_address) | |
74 | 93 | ||
75 | 94 | ||
76 | 95 | func updateFunds (_assetId,_value) = [IntegerEntry(toCompositeKey(k_funds, _assetId), _value)] | |
77 | 96 | ||
78 | 97 | ||
79 | 98 | func strAssetId (_asset) = if (isDefined(_asset)) | |
80 | 99 | then toBase58String(value(_asset)) | |
81 | 100 | else "WAVES" | |
82 | 101 | ||
83 | 102 | ||
84 | 103 | @Callable(i) | |
85 | 104 | func initialize (_coordinator,_quoteAssetId,_quoteAssetManager) = if (if (initialized()) | |
86 | 105 | then true | |
87 | 106 | else (i.caller != this)) | |
88 | 107 | then throw("Unable to initialize") | |
89 | 108 | else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), StringEntry(toCompositeKey(k_asset_manager_address, _quoteAssetId), toString(addressFromStringValue(_quoteAssetManager))), BooleanEntry(k_initialized, true)] | |
90 | 109 | ||
91 | 110 | ||
92 | 111 | ||
93 | 112 | @Callable(i) | |
94 | 113 | func unpause () = if ((i.caller != adminAddress())) | |
95 | 114 | then throw("Invalid unpause params") | |
96 | 115 | else [BooleanEntry(k_paused, false)] | |
97 | 116 | ||
98 | 117 | ||
99 | 118 | ||
100 | 119 | @Callable(i) | |
101 | 120 | func pause () = if ((i.caller != adminAddress())) | |
102 | 121 | then throw("Invalid pause params") | |
103 | 122 | else [BooleanEntry(k_paused, true)] | |
104 | 123 | ||
105 | 124 | ||
106 | 125 | ||
107 | 126 | @Callable(i) | |
108 | 127 | func addAssetManager (_assetId,_vaultAddress) = if (if (if (!(initialized())) | |
109 | 128 | then true | |
110 | 129 | else (i.caller != adminAddress())) | |
111 | 130 | then true | |
112 | 131 | else if (isDefined(getString(toCompositeKey(k_asset_manager_address, _assetId)))) | |
113 | 132 | then (balanceOf(_assetId) > 0) | |
114 | 133 | else false) | |
115 | 134 | then throw("Invalid addTokenVault params") | |
116 | 135 | else [StringEntry(toCompositeKey(k_asset_manager_address, _assetId), toString(addressFromStringValue(_vaultAddress)))] | |
136 | + | ||
137 | + | ||
138 | + | ||
139 | + | @Callable(i) | |
140 | + | func changeAssetManager (_assetId,_vaultAddress) = if (if (if (!(initialized())) | |
141 | + | then true | |
142 | + | else (i.caller != adminAddress())) | |
143 | + | then true | |
144 | + | else if (!(isDefined(getString(toCompositeKey(k_asset_manager_address, _assetId))))) | |
145 | + | then (balanceOf(_assetId) > 0) | |
146 | + | else false) | |
147 | + | then throw("Invalid changeAssetManager params") | |
148 | + | else { | |
149 | + | let actualBalance = balanceOf(_assetId) | |
150 | + | if ((actualBalance == actualBalance)) | |
151 | + | then { | |
152 | + | let unstake = invoke(assetManagerAddress(_assetId), "withdraw", [_assetId, actualBalance], nil) | |
153 | + | if ((unstake == unstake)) | |
154 | + | then { | |
155 | + | let stake = invoke(addressFromStringValue(_vaultAddress), "deposit", nil, [AttachedPayment(fromBase58String(_assetId), actualBalance)]) | |
156 | + | if ((stake == stake)) | |
157 | + | then [StringEntry(toCompositeKey(k_asset_manager_address, _assetId), toString(addressFromStringValue(_vaultAddress)))] | |
158 | + | else throw("Strict value is not equal to itself.") | |
159 | + | } | |
160 | + | else throw("Strict value is not equal to itself.") | |
161 | + | } | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
117 | 164 | ||
118 | 165 | ||
119 | 166 | ||
120 | 167 | @Callable(i) | |
121 | 168 | func withdraw (_assetId,_amount) = if (if (if (if (!(isWhitelist(toString(i.caller)))) | |
122 | 169 | then true | |
123 | 170 | else !(initialized())) | |
124 | 171 | then true | |
125 | 172 | else paused()) | |
126 | 173 | then true | |
127 | 174 | else (_amount > balanceOf(_assetId))) | |
128 | 175 | then throw(((("Invalid withdraw params (manager) " + toString(_amount)) + " > ") + toString(balanceOf(_assetId)))) | |
129 | 176 | else { | |
130 | 177 | let unstake = invoke(assetManagerAddress(_assetId), "withdraw", [_assetId, _amount], nil) | |
131 | 178 | if ((unstake == unstake)) | |
132 | 179 | then { | |
133 | 180 | let currentAssetBalance = (balanceOf(_assetId) - _amount) | |
134 | 181 | (updateFunds(_assetId, currentAssetBalance) ++ [ScriptTransfer(i.caller, _amount, if ((_assetId == "WAVES")) | |
135 | 182 | then unit | |
136 | 183 | else fromBase58String(_assetId))]) | |
137 | 184 | } | |
138 | 185 | else throw("Strict value is not equal to itself.") | |
139 | 186 | } | |
140 | 187 | ||
141 | 188 | ||
142 | 189 | ||
143 | 190 | @Callable(i) | |
144 | 191 | func deposit () = { | |
145 | 192 | let _amount = i.payments[0].amount | |
146 | 193 | let _assetId = strAssetId(i.payments[0].assetId) | |
147 | 194 | if (if (if (if (!(initialized())) | |
148 | 195 | then true | |
149 | 196 | else if (!(isWhitelist(toString(i.caller)))) | |
150 | 197 | then (i.caller != adminAddress()) | |
151 | 198 | else false) | |
152 | 199 | then true | |
153 | 200 | else paused()) | |
154 | 201 | then true | |
155 | 202 | else (size(i.payments) != 1)) | |
156 | 203 | then throw("Invalid deposit params (manager)") | |
157 | 204 | else { | |
158 | 205 | let stake = invoke(assetManagerAddress(_assetId), "deposit", nil, [AttachedPayment(i.payments[0].assetId, _amount)]) | |
159 | 206 | if ((stake == stake)) | |
160 | 207 | then { | |
161 | 208 | let currentAssetBalance = (balanceOf(_assetId) + _amount) | |
162 | 209 | updateFunds(_assetId, currentAssetBalance) | |
163 | 210 | } | |
164 | 211 | else throw("Strict value is not equal to itself.") | |
165 | 212 | } | |
166 | 213 | } | |
167 | 214 | ||
168 | 215 | ||
169 | 216 | ||
170 | 217 | @Callable(i) | |
171 | 218 | func claimProfit (_assetId) = if (if (!(initialized())) | |
172 | 219 | then true | |
173 | 220 | else !(if ((i.caller == vaultAddress())) | |
174 | 221 | then true | |
175 | 222 | else isSpotVault(toString(i.caller)))) | |
176 | 223 | then throw("Invalid claimProfit params (manager)") | |
177 | 224 | else { | |
178 | 225 | let doClaimProfitResult = invoke(assetManagerAddress(_assetId), "claimProfit", [_assetId], nil) | |
179 | 226 | if ((doClaimProfitResult == doClaimProfitResult)) | |
180 | 227 | then { | |
181 | 228 | let profit = match doClaimProfitResult { | |
182 | 229 | case t: Int => | |
183 | 230 | t | |
184 | 231 | case _ => | |
185 | 232 | throw("Invalid claimProfit result type") | |
186 | 233 | } | |
187 | - | | |
234 | + | let profitAsset = if ((_assetId == "WAVES")) | |
188 | 235 | then unit | |
189 | - | else fromBase58String(_assetId))], profit) | |
236 | + | else fromBase58String(_assetId) | |
237 | + | let profitReceiver = if (if ((profitAsset == rewardAsset())) | |
238 | + | then (profitDirection() == PROFIT_FARM) | |
239 | + | else false) | |
240 | + | then farmingAddress() | |
241 | + | else i.caller | |
242 | + | $Tuple2([ScriptTransfer(profitReceiver, profit, profitAsset)], profit) | |
190 | 243 | } | |
191 | 244 | else throw("Strict value is not equal to itself.") | |
192 | 245 | } | |
193 | 246 | ||
194 | 247 | ||
195 | 248 | ||
196 | 249 | @Callable(i) | |
197 | 250 | func view_claimProfit (_assetId) = if (!(initialized())) | |
198 | 251 | then throw("Invalid view_claimProfit params (manager)") | |
199 | 252 | else { | |
200 | 253 | let doClaimProfitResult = invoke(assetManagerAddress(_assetId), "claimProfit", [_assetId], nil) | |
201 | 254 | if ((doClaimProfitResult == doClaimProfitResult)) | |
202 | 255 | then { | |
203 | 256 | let profit = match doClaimProfitResult { | |
204 | 257 | case t: Int => | |
205 | 258 | t | |
206 | 259 | case _ => | |
207 | 260 | throw("Invalid claimProfit result type") | |
208 | 261 | } | |
209 | 262 | throw(((((toString(balanceOf(_assetId)) + ",") + toString((balanceOf(_assetId) + profit))) + ",") + toString(profit))) | |
210 | 263 | } | |
211 | 264 | else throw("Strict value is not equal to itself.") | |
212 | 265 | } | |
213 | 266 | ||
214 | 267 | ||
215 | 268 | @Verifier(tx) | |
216 | 269 | func verify () = { | |
217 | 270 | let coordinatorStr = getString(this, k_coordinatorAddress) | |
218 | 271 | if (isDefined(coordinatorStr)) | |
219 | 272 | then { | |
220 | 273 | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
221 | 274 | if (isDefined(admin)) | |
222 | 275 | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
223 | 276 | else throw("unable to verify: admin not set in coordinator") | |
224 | 277 | } | |
225 | 278 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
226 | 279 | } | |
227 | 280 |
github/deemru/w8io/026f985 42.46 ms ◑