tx · 7JoPAmgmrpJCCmwogFEme1tWkkHonnvGaXc4UfzhwHRC

3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH:  -0.03700000 Waves

2023.05.24 21:05 [2592395] smart account 3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH > SELF 0.00000000 Waves

{ "type": 13, "id": "7JoPAmgmrpJCCmwogFEme1tWkkHonnvGaXc4UfzhwHRC", "fee": 3700000, "feeAssetId": null, "timestamp": 1684951553882, "version": 2, "chainId": 84, "sender": "3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH", "senderPublicKey": "3mgJJUcUNFHYP2pNkbkfB2C8D4gSEKEGisFByu2i6xoM", "proofs": [ "5C1rZjKnKSTMSzPmXbeVC66BoNQcDyTa7xVkT7ian5wr9oQ4ck7sBpRk8pPrTHrENm67tVoND2Vv6pkgharohKY1" ], "script": "base64:BgIlCAISBQoDCAgIEgASABIECgIICBIECgIIARIAEgMKAQgSAwoBCBsAB2tfZnVuZHMCB2tfZnVuZHMAF2tfYXNzZXRfbWFuYWdlcl9hZGRyZXNzAhdrX2Fzc2V0X21hbmFnZXJfYWRkcmVzcwAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzABBrX29yZGVyc19hZGRyZXNzAhBrX29yZGVyc19hZGRyZXNzAA9rX3ZhdWx0X2FkZHJlc3MCD2tfdmF1bHRfYWRkcmVzcwAFa19hbW0CBWtfYW1tAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwARa19zdGFraW5nX2FkZHJlc3MCEWtfc3Rha2luZ19hZGRyZXNzAA5rX3Nwb3RfYWRkcmVzcwIOa19zcG90X2FkZHJlc3MAB2tfdmF1bHQCB2tfdmF1bHQADWtfaW5pdGlhbGl6ZWQCDWtfaW5pdGlhbGl6ZWQACGtfcGF1c2VkAghrX3BhdXNlZAEOdG9Db21wb3NpdGVLZXkCBF9rZXkIX2FkZHJlc3MJAKwCAgkArAICBQ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fSW52YWxpZCBjbGFpbVByb2ZpdCByZXN1bHQgdHlwZQkAAgEJAKwCAgkArAICCQCsAgIJAKwCAgkApAMBCQEJYmFsYW5jZU9mAQUIX2Fzc2V0SWQCASwJAKQDAQkAZAIJAQliYWxhbmNlT2YBBQhfYXNzZXRJZAUGcHJvZml0AgEsCQCkAwEFBnByb2ZpdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEDmNvb3JkaW5hdG9yU3RyCQCdCAIFBHRoaXMFFGtfY29vcmRpbmF0b3JBZGRyZXNzAwkBCWlzRGVmaW5lZAEFDmNvb3JkaW5hdG9yU3RyBAVhZG1pbgkAnQgCCQERQGV4dHJOYXRpdmUoMTA2MikBCQEFdmFsdWUBBQ5jb29yZGluYXRvclN0cgUPa19hZG1pbl9hZGRyZXNzAwkBCWlzRGVmaW5lZAEFBWFkbWluCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFBWFkbWluCQCsAgIJAKwCAgkArAICAgdzdGF0dXNfCQClCAEFBHRoaXMCAV8JANgEAQgFAnR4AmlkBwkAAgECLnVuYWJsZSB0byB2ZXJpZnk6IGFkbWluIG5vdCBzZXQgaW4gY29vcmRpbmF0b3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXk2S8TQ", "height": 2592395, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8nmgYaHyfNsaxdAawuxm3ouPqEm241XfRFVwy2LUsoyi Next: GyA5oFz1xtMSFAu3BbLwUP1FXGpbrSF9QSrti3gEJPMY Diff:
OldNewDifferences
170170 @Callable(i)
171171 func claimProfit (_assetId) = if (if (!(initialized()))
172172 then true
173- else (i.caller != vaultAddress()))
173+ else !(if ((i.caller == vaultAddress()))
174+ then true
175+ else isSpotVault(toString(i.caller))))
174176 then throw("Invalid claimProfit params (manager)")
175177 else {
176178 let doClaimProfitResult = invoke(assetManagerAddress(_assetId), "claimProfit", [_assetId], nil)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_funds = "k_funds"
55
66 let k_asset_manager_address = "k_asset_manager_address"
77
88 let k_coordinatorAddress = "k_coordinatorAddress"
99
1010 let k_orders_address = "k_orders_address"
1111
1212 let k_vault_address = "k_vault_address"
1313
1414 let k_amm = "k_amm"
1515
1616 let k_admin_address = "k_admin_address"
1717
1818 let k_staking_address = "k_staking_address"
1919
2020 let k_spot_address = "k_spot_address"
2121
2222 let k_vault = "k_vault"
2323
2424 let k_initialized = "k_initialized"
2525
2626 let k_paused = "k_paused"
2727
2828 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
2929
3030
3131 func balanceOf (_assetId) = valueOrElse(getInteger(this, toCompositeKey(k_funds, _assetId)), 0)
3232
3333
3434 func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set Manager")), "Coordinator address invalid")
3535
3636
3737 func vaultAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_vault_address), "Vault address not set")), "Vault address invalid")
3838
3939
4040 func ordersAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_orders_address), "Orders address not set")), "Orders address invalid")
4141
4242
4343 func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
4444
4545
4646 func stakingAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_staking_address), "Staking address not set")), "Staking address invalid")
4747
4848
4949 func spotAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")), "Spot address invalid")
5050
5151
5252 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
5353
5454
5555 func paused () = valueOrElse(getBoolean(this, k_paused), false)
5656
5757
5858 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))
5959
6060
6161 func isSpotVault (_address) = {
6262 let spot = spotAddress()
6363 valueOrElse(getBoolean(spot, toCompositeKey(k_vault, _address)), false)
6464 }
6565
6666
6767 func isWhitelist (_address) = if (if (if ((_address == toString(stakingAddress())))
6868 then true
6969 else (_address == toString(vaultAddress())))
7070 then true
7171 else (_address == toString(ordersAddress())))
7272 then true
7373 else isSpotVault(_address)
7474
7575
7676 func updateFunds (_assetId,_value) = [IntegerEntry(toCompositeKey(k_funds, _assetId), _value)]
7777
7878
7979 func strAssetId (_asset) = if (isDefined(_asset))
8080 then toBase58String(value(_asset))
8181 else "WAVES"
8282
8383
8484 @Callable(i)
8585 func initialize (_coordinator,_quoteAssetId,_quoteAssetManager) = if (if (initialized())
8686 then true
8787 else (i.caller != this))
8888 then throw("Unable to initialize")
8989 else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), StringEntry(toCompositeKey(k_asset_manager_address, _quoteAssetId), toString(addressFromStringValue(_quoteAssetManager))), BooleanEntry(k_initialized, true)]
9090
9191
9292
9393 @Callable(i)
9494 func unpause () = if ((i.caller != adminAddress()))
9595 then throw("Invalid unpause params")
9696 else [BooleanEntry(k_paused, false)]
9797
9898
9999
100100 @Callable(i)
101101 func pause () = if ((i.caller != adminAddress()))
102102 then throw("Invalid pause params")
103103 else [BooleanEntry(k_paused, true)]
104104
105105
106106
107107 @Callable(i)
108108 func addAssetManager (_assetId,_vaultAddress) = if (if (if (!(initialized()))
109109 then true
110110 else (i.caller != adminAddress()))
111111 then true
112112 else if (isDefined(getString(toCompositeKey(k_asset_manager_address, _assetId))))
113113 then (balanceOf(_assetId) > 0)
114114 else false)
115115 then throw("Invalid addTokenVault params")
116116 else [StringEntry(toCompositeKey(k_asset_manager_address, _assetId), toString(addressFromStringValue(_vaultAddress)))]
117117
118118
119119
120120 @Callable(i)
121121 func withdraw (_assetId,_amount) = if (if (if (if (!(isWhitelist(toString(i.caller))))
122122 then true
123123 else !(initialized()))
124124 then true
125125 else paused())
126126 then true
127127 else (_amount > balanceOf(_assetId)))
128128 then throw(((("Invalid withdraw params (manager) " + toString(_amount)) + " > ") + toString(balanceOf(_assetId))))
129129 else {
130130 let unstake = invoke(assetManagerAddress(_assetId), "withdraw", [_assetId, _amount], nil)
131131 if ((unstake == unstake))
132132 then {
133133 let currentAssetBalance = (balanceOf(_assetId) - _amount)
134134 (updateFunds(_assetId, currentAssetBalance) ++ [ScriptTransfer(i.caller, _amount, if ((_assetId == "WAVES"))
135135 then unit
136136 else fromBase58String(_assetId))])
137137 }
138138 else throw("Strict value is not equal to itself.")
139139 }
140140
141141
142142
143143 @Callable(i)
144144 func deposit () = {
145145 let _amount = i.payments[0].amount
146146 let _assetId = strAssetId(i.payments[0].assetId)
147147 if (if (if (if (!(initialized()))
148148 then true
149149 else if (!(isWhitelist(toString(i.caller))))
150150 then (i.caller != adminAddress())
151151 else false)
152152 then true
153153 else paused())
154154 then true
155155 else (size(i.payments) != 1))
156156 then throw("Invalid deposit params (manager)")
157157 else {
158158 let stake = invoke(assetManagerAddress(_assetId), "deposit", nil, [AttachedPayment(i.payments[0].assetId, _amount)])
159159 if ((stake == stake))
160160 then {
161161 let currentAssetBalance = (balanceOf(_assetId) + _amount)
162162 updateFunds(_assetId, currentAssetBalance)
163163 }
164164 else throw("Strict value is not equal to itself.")
165165 }
166166 }
167167
168168
169169
170170 @Callable(i)
171171 func claimProfit (_assetId) = if (if (!(initialized()))
172172 then true
173- else (i.caller != vaultAddress()))
173+ else !(if ((i.caller == vaultAddress()))
174+ then true
175+ else isSpotVault(toString(i.caller))))
174176 then throw("Invalid claimProfit params (manager)")
175177 else {
176178 let doClaimProfitResult = invoke(assetManagerAddress(_assetId), "claimProfit", [_assetId], nil)
177179 if ((doClaimProfitResult == doClaimProfitResult))
178180 then {
179181 let profit = match doClaimProfitResult {
180182 case t: Int =>
181183 t
182184 case _ =>
183185 throw("Invalid claimProfit result type")
184186 }
185187 $Tuple2([ScriptTransfer(i.caller, profit, if ((_assetId == "WAVES"))
186188 then unit
187189 else fromBase58String(_assetId))], profit)
188190 }
189191 else throw("Strict value is not equal to itself.")
190192 }
191193
192194
193195
194196 @Callable(i)
195197 func view_claimProfit (_assetId) = if (!(initialized()))
196198 then throw("Invalid view_claimProfit params (manager)")
197199 else {
198200 let doClaimProfitResult = invoke(assetManagerAddress(_assetId), "claimProfit", [_assetId], nil)
199201 if ((doClaimProfitResult == doClaimProfitResult))
200202 then {
201203 let profit = match doClaimProfitResult {
202204 case t: Int =>
203205 t
204206 case _ =>
205207 throw("Invalid claimProfit result type")
206208 }
207209 throw(((((toString(balanceOf(_assetId)) + ",") + toString((balanceOf(_assetId) + profit))) + ",") + toString(profit)))
208210 }
209211 else throw("Strict value is not equal to itself.")
210212 }
211213
212214
213215 @Verifier(tx)
214216 func verify () = {
215217 let coordinatorStr = getString(this, k_coordinatorAddress)
216218 if (isDefined(coordinatorStr))
217219 then {
218220 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
219221 if (isDefined(admin))
220222 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
221223 else throw("unable to verify: admin not set in coordinator")
222224 }
223225 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
224226 }
225227

github/deemru/w8io/026f985 
40.72 ms