tx · B4bA9uX74UCSjD9ncDCNkXnUynwEX5MdnSxvExWypX1U

3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH:  -0.03700000 Waves

2023.01.09 11:35 [2397170] smart account 3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH > SELF 0.00000000 Waves

{ "type": 13, "id": "B4bA9uX74UCSjD9ncDCNkXnUynwEX5MdnSxvExWypX1U", "fee": 3700000, "feeAssetId": null, "timestamp": 1673253318048, "version": 2, "chainId": 84, "sender": "3NCkVR5gTgfosVUNRTsUHc6kXdhh2V3betH", "senderPublicKey": "3mgJJUcUNFHYP2pNkbkfB2C8D4gSEKEGisFByu2i6xoM", "proofs": [ "4U5X9TbHXp2wMJsPCib9roXwwTbTqVsvWzC6aMnkabtvX63vvTB3iT4nBkKrLxk5xUHxTXYPWsomJepL477j91kd" ], "script": "base64:BgIiCAISBgoECAgICBIECgIICBIECgIIARIAEgMKAQgSAwoBCB8AB2tfZnVuZHMCB2tfZnVuZHMAD2tfdmlyZXNfYWRkcmVzcwIPa192aXJlc19hZGRyZXNzAA1rX3ZpcmVzX3ZhdWx0Ag1rX3ZpcmVzX3ZhdWx0ABZrX2Fzc2V0X2NsYWltZWRfcHJvZml0AhZrX2Fzc2V0X2NsYWltZWRfcHJvZml0ABRrX2Nvb3JkaW5hdG9yQWRkcmVzcwIUa19jb29yZGluYXRvckFkZHJlc3MAE2tfaW5zdXJhbmNlX2FkZHJlc3MCE2tfaW5zdXJhbmNlX2FkZHJlc3MAEGtfb3JkZXJzX2FkZHJlc3MCEGtfb3JkZXJzX2FkZHJlc3MAD2tfdmF1bHRfYWRkcmVzcwIPa192YXVsdF9hZGRyZXNzAAVrX2FtbQIFa19hbW0AD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAPa19xdW90ZV9zdGFra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90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACQEOYWRtaW5QdWJsaWNLZXkA8GGP+g==", "height": 2397170, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3k6jZHZrFD1dioi6GjqhmQeHP4svrf2WGeqbYA6W5SwW Next: 4qa9sF5Ct77GhVPnmvKGw1FueY37QqMAoFcgMEcdessd Diff:
OldNewDifferences
1212 let k_coordinatorAddress = "k_coordinatorAddress"
1313
1414 let k_insurance_address = "k_insurance_address"
15+
16+let k_orders_address = "k_orders_address"
17+
18+let k_vault_address = "k_vault_address"
1519
1620 let k_amm = "k_amm"
1721
3943 func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set")
4044
4145
46+func vaultAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_vault_address)), "Vault not set")
47+
48+
49+func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set")
50+
51+
4252 func isAmm (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
4353
4454
6373 func viresVault (_assetId) = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, toCompositeKey(k_vires_vault, _assetId)), ("No vault for token " + _assetId))), ("Invalid address for token " + _assetId))
6474
6575
66-func isWhitelist (_address) = if (if (isAmm(_address))
76+func isWhitelist (_address) = if (if (if (if (isAmm(_address))
6777 then true
6878 else (_address == toString(insuranceAddress())))
6979 then true
70- else (_address == toString(stakingAddress()))
80+ else (_address == toString(stakingAddress())))
81+ then true
82+ else (_address == toString(vaultAddress())))
83+ then true
84+ else (_address == toString(ordersAddress()))
7185
7286
7387 func updateFunds (_assetId,_value) = [IntegerEntry(toCompositeKey(k_funds, _assetId), _value)]
95109 else !(initialized()))
96110 then true
97111 else (_amount > balanceOf(_assetId)))
98- then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(balanceOf(_assetId))))
112+ then throw(((("Invalid withdraw params (manager) " + toString(_amount)) + " > ") + toString(balanceOf(_assetId))))
99113 else {
100114 let unstake = invoke(viresAddress(), "withdraw", [_assetId, _amount], nil)
101115 if ((unstake == unstake))
119133 else if (!(isWhitelist(toString(i.caller))))
120134 then (i.caller != adminAddress())
121135 else false)
122- then throw("Invalid deposit params")
136+ then throw("Invalid deposit params (manager)")
123137 else {
124138 let vault = viresVault(_assetId)
125139 let stake = invoke(viresAddress(), "deposit", [toString(vault), false], [AttachedPayment(i.payments[0].assetId, _amount)])
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_funds = "k_funds"
55
66 let k_vires_address = "k_vires_address"
77
88 let k_vires_vault = "k_vires_vault"
99
1010 let k_asset_claimed_profit = "k_asset_claimed_profit"
1111
1212 let k_coordinatorAddress = "k_coordinatorAddress"
1313
1414 let k_insurance_address = "k_insurance_address"
15+
16+let k_orders_address = "k_orders_address"
17+
18+let k_vault_address = "k_vault_address"
1519
1620 let k_amm = "k_amm"
1721
1822 let k_admin_address = "k_admin_address"
1923
2024 let k_admin_public_key = "k_admin_public_key"
2125
2226 let k_quote_asset = "k_quote_asset"
2327
2428 let k_quote_staking = "k_quote_staking"
2529
2630 let k_staking_address = "k_staking_address"
2731
2832 let k_initialized = "k_initialized"
2933
3034 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
3135
3236
3337 func balanceOf (_assetId) = valueOrElse(getInteger(this, toCompositeKey(k_funds, _assetId)), 0)
3438
3539
3640 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
3741
3842
3943 func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set")
4044
4145
46+func vaultAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_vault_address)), "Vault not set")
47+
48+
49+func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set")
50+
51+
4252 func isAmm (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
4353
4454
4555 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
4656
4757
4858 func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
4959
5060
5161 func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
5262
5363
5464 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
5565
5666
5767 func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set")
5868
5969
6070 func viresAddress () = valueOrErrorMessage(addressFromString(getStringValue(this, k_vires_address)), "Vires not set")
6171
6272
6373 func viresVault (_assetId) = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, toCompositeKey(k_vires_vault, _assetId)), ("No vault for token " + _assetId))), ("Invalid address for token " + _assetId))
6474
6575
66-func isWhitelist (_address) = if (if (isAmm(_address))
76+func isWhitelist (_address) = if (if (if (if (isAmm(_address))
6777 then true
6878 else (_address == toString(insuranceAddress())))
6979 then true
70- else (_address == toString(stakingAddress()))
80+ else (_address == toString(stakingAddress())))
81+ then true
82+ else (_address == toString(vaultAddress())))
83+ then true
84+ else (_address == toString(ordersAddress()))
7185
7286
7387 func updateFunds (_assetId,_value) = [IntegerEntry(toCompositeKey(k_funds, _assetId), _value)]
7488
7589
7690 @Callable(i)
7791 func initialize (_coordinator,_viresAddress,_quoteAssetId,_quoteAssetVault) = if (initialized())
7892 then throw("Already initialized")
7993 else [StringEntry(k_coordinatorAddress, _coordinator), StringEntry(k_vires_address, _viresAddress), StringEntry(toCompositeKey(k_vires_vault, _quoteAssetId), _quoteAssetVault), BooleanEntry(k_initialized, true)]
8094
8195
8296
8397 @Callable(i)
8498 func addTokenVault (_assetId,_vaultAddress) = if (if (!(initialized()))
8599 then true
86100 else (i.caller != adminAddress()))
87101 then throw("Invalid addTokenVault params")
88102 else [StringEntry(toCompositeKey(k_vires_vault, _assetId), _vaultAddress)]
89103
90104
91105
92106 @Callable(i)
93107 func withdraw (_assetId,_amount) = if (if (if (!(isWhitelist(toString(i.caller))))
94108 then true
95109 else !(initialized()))
96110 then true
97111 else (_amount > balanceOf(_assetId)))
98- then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(balanceOf(_assetId))))
112+ then throw(((("Invalid withdraw params (manager) " + toString(_amount)) + " > ") + toString(balanceOf(_assetId))))
99113 else {
100114 let unstake = invoke(viresAddress(), "withdraw", [_assetId, _amount], nil)
101115 if ((unstake == unstake))
102116 then {
103117 let currentAssetBalance = (balanceOf(_assetId) - _amount)
104118 (updateFunds(_assetId, currentAssetBalance) ++ [ScriptTransfer(i.caller, _amount, fromBase58String(_assetId))])
105119 }
106120 else throw("Strict value is not equal to itself.")
107121 }
108122
109123
110124
111125 @Callable(i)
112126 func deposit () = {
113127 let _amount = i.payments[0].amount
114128 let _assetId = toBase58String(valueOrErrorMessage(i.payments[0].assetId, "No assetId"))
115129 if (if (if ((i.payments[0].assetId != quoteAsset()))
116130 then true
117131 else !(initialized()))
118132 then true
119133 else if (!(isWhitelist(toString(i.caller))))
120134 then (i.caller != adminAddress())
121135 else false)
122- then throw("Invalid deposit params")
136+ then throw("Invalid deposit params (manager)")
123137 else {
124138 let vault = viresVault(_assetId)
125139 let stake = invoke(viresAddress(), "deposit", [toString(vault), false], [AttachedPayment(i.payments[0].assetId, _amount)])
126140 if ((stake == stake))
127141 then {
128142 let currentAssetBalance = (balanceOf(_assetId) + _amount)
129143 updateFunds(_assetId, currentAssetBalance)
130144 }
131145 else throw("Strict value is not equal to itself.")
132146 }
133147 }
134148
135149
136150
137151 @Callable(i)
138152 func claimProfit (_assetId) = if (if (if ((fromBase58String(_assetId) != quoteAsset()))
139153 then true
140154 else !(initialized()))
141155 then true
142156 else (i.caller != adminAddress()))
143157 then throw("Invalid claimProfit params")
144158 else {
145159 let currentAmount = invoke(viresVault(_assetId), "getCurrentTotals", [toString(this)], nil)
146160 if ((currentAmount == currentAmount))
147161 then {
148162 let currentAssetBalance = match currentAmount {
149163 case t: (Int, Int, Int, Int) =>
150164 t._3
151165 case _ =>
152166 throw("Invalid currentAmount type")
153167 }
154168 let profit = (currentAssetBalance - balanceOf(_assetId))
155169 let unstake = invoke(viresAddress(), "withdraw", [_assetId, profit], nil)
156170 if ((unstake == unstake))
157171 then [ScriptTransfer(i.caller, profit, fromBase58String(_assetId))]
158172 else throw("Strict value is not equal to itself.")
159173 }
160174 else throw("Strict value is not equal to itself.")
161175 }
162176
163177
164178
165179 @Callable(i)
166180 func view_claimProfit (_assetId) = if (if ((fromBase58String(_assetId) != quoteAsset()))
167181 then true
168182 else !(initialized()))
169183 then throw("Invalid view_claimProfit params")
170184 else {
171185 let currentAmount = invoke(viresVault(_assetId), "getCurrentTotals", [toString(this)], nil)
172186 if ((currentAmount == currentAmount))
173187 then {
174188 let currentAssetBalance = match currentAmount {
175189 case t: (Int, Int, Int, Int) =>
176190 t._3
177191 case _ =>
178192 throw("Invalid currentAmount type")
179193 }
180194 let profit = (currentAssetBalance - balanceOf(_assetId))
181195 throw(((((toString(balanceOf(_assetId)) + ",") + toString(currentAssetBalance)) + ",") + toString(profit)))
182196 }
183197 else throw("Strict value is not equal to itself.")
184198 }
185199
186200
187201 @Verifier(tx)
188202 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
189203

github/deemru/w8io/026f985 
33.07 ms