tx · 9YowDJ7TTov1pEyDTGHY354Er17zncoR4A15pkC5C9yp

3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA:  -0.03700000 Waves

2022.10.06 10:27 [2260156] smart account 3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA > SELF 0.00000000 Waves

{ "type": 13, "id": "9YowDJ7TTov1pEyDTGHY354Er17zncoR4A15pkC5C9yp", "fee": 3700000, "feeAssetId": null, "timestamp": 1665041225570, "version": 2, "chainId": 84, "sender": "3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA", "senderPublicKey": "A4jJoT1GfErs6Zq9p6jQrT43kuzivydaycZfLbuBCAhq", "proofs": [ "2w2LZ6z94duxoKdNvYZ2PdZhfJ8NknvFHVF2N9BnhRdWrjfWMYrBm7kYkkZsPDhan83qSJ2dZMFfS4d6qkELaxMK" ], "script": "base64:BgIQCAISAwoBCBIDCgEBEgASABQAC2tfaW5zdXJhbmNlAgtrX2luc3VyYW5jZQAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAAVrX2FtbQIFa19hbW0AD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAPa19xdW90ZV9zdGFraW5nAg9rX3F1b3RlX3N0YWtpbmcAEWtfbWFuYWdlcl9hZGRyZXNzAhFrX21hbmFnZXJfYWRkcmVzcwANa19pbml0aWFsaXplZAINa19pbml0aWFsaXplZAEOdG9Db21wb3NpdGVLZXkCBF9rZXkIX2FkZHJlc3MJAKwCAgkArAICBQRfa2V5AgFfBQhfYWRkcmVzcwEJaW5zdXJhbmNlAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQtrX2luc3VyYW5jZQAAAQtjb29yZGluYXRvcgAJARN2YWx1ZU9yRXJyb3JNZXNzYWdlA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IBQJ0eAZwcm9vZnMAAAkBDmFkbWluUHVibGljS2V5AJp4IHE=", "height": 2260156, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DuuY2pVxXseq6kDC3XntURgfVMc1AGAkbmDgFXW7oWpH Next: AWCT2y1W1AWX5PvSkp7Kv9i4w9qrTiYmM2a8Daeh3UGM Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_insurance = "k_insurance"
66 let k_coordinatorAddress = "k_coordinatorAddress"
77
88 let k_amm = "k_amm"
9-
10-let k_insurance_address = "k_insurance_address"
119
1210 let k_admin_address = "k_admin_address"
1311
1715
1816 let k_quote_staking = "k_quote_staking"
1917
20-let k_staking_address = "k_staking_address"
18+let k_manager_address = "k_manager_address"
2119
2220 let k_initialized = "k_initialized"
2321
2725 func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
2826
2927
30-func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
28+func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set")), "Coordinator not set")
3129
3230
3331 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3634 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
3735
3836
39-func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
37+func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
4038
4139
42-func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
40+func adminPublicKey () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_admin_public_key), "Admin public key not set"))
4341
4442
45-func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
43+func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
4644
4745
48-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote assete staking not set")
46+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_quote_staking), "Quote asset staking not set")), "Quote asset staking not set")
4947
5048
51-func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
52-
53-
54-func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set")
49+func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager not set")), "Manager not set")
5550
5651
5752 func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
7267 else (_amount > insurance()))
7368 then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
7469 else {
75- let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
70+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
7671 if ((unstake == unstake))
7772 then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
7873 else throw("Strict value is not equal to itself.")
9287 else false)
9388 then throw("Invalid deposit params")
9489 else {
95- let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
90+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
9691 if ((stake == stake))
9792 then updateInsurance((insurance() + _amount))
9893 else throw("Strict value is not equal to itself.")
9994 }
95+ }
96+
97+
98+
99+@Callable(i)
100+func migrateLiquidity () = {
101+ let amount = insurance()
102+ let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [amount, toBase58String(quoteAsset())], nil)
103+ if ((unstake == unstake))
104+ then {
105+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), amount)])
106+ if ((stake == stake))
107+ then nil
108+ else throw("Strict value is not equal to itself.")
109+ }
110+ else throw("Strict value is not equal to itself.")
100111 }
101112
102113
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_insurance = "k_insurance"
55
66 let k_coordinatorAddress = "k_coordinatorAddress"
77
88 let k_amm = "k_amm"
9-
10-let k_insurance_address = "k_insurance_address"
119
1210 let k_admin_address = "k_admin_address"
1311
1412 let k_admin_public_key = "k_admin_public_key"
1513
1614 let k_quote_asset = "k_quote_asset"
1715
1816 let k_quote_staking = "k_quote_staking"
1917
20-let k_staking_address = "k_staking_address"
18+let k_manager_address = "k_manager_address"
2119
2220 let k_initialized = "k_initialized"
2321
2422 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
2523
2624
2725 func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
2826
2927
30-func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
28+func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set")), "Coordinator not set")
3129
3230
3331 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3432
3533
3634 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
3735
3836
39-func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
37+func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
4038
4139
42-func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
40+func adminPublicKey () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_admin_public_key), "Admin public key not set"))
4341
4442
45-func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
43+func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
4644
4745
48-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote assete staking not set")
46+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_quote_staking), "Quote asset staking not set")), "Quote asset staking not set")
4947
5048
51-func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
52-
53-
54-func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set")
49+func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager not set")), "Manager not set")
5550
5651
5752 func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
5853
5954
6055 @Callable(i)
6156 func initialize (_coordinator) = if (initialized())
6257 then throw("Already initialized")
6358 else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)]
6459
6560
6661
6762 @Callable(i)
6863 func withdraw (_amount) = if (if (if (!(isWhitelist(toString(i.caller))))
6964 then true
7065 else !(initialized()))
7166 then true
7267 else (_amount > insurance()))
7368 then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
7469 else {
75- let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
70+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
7671 if ((unstake == unstake))
7772 then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
7873 else throw("Strict value is not equal to itself.")
7974 }
8075
8176
8277
8378 @Callable(i)
8479 func deposit () = {
8580 let _amount = i.payments[0].amount
8681 if (if (if ((i.payments[0].assetId != quoteAsset()))
8782 then true
8883 else !(initialized()))
8984 then true
9085 else if (!(isWhitelist(toString(i.caller))))
9186 then (i.caller != adminAddress())
9287 else false)
9388 then throw("Invalid deposit params")
9489 else {
95- let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
90+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
9691 if ((stake == stake))
9792 then updateInsurance((insurance() + _amount))
9893 else throw("Strict value is not equal to itself.")
9994 }
95+ }
96+
97+
98+
99+@Callable(i)
100+func migrateLiquidity () = {
101+ let amount = insurance()
102+ let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [amount, toBase58String(quoteAsset())], nil)
103+ if ((unstake == unstake))
104+ then {
105+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), amount)])
106+ if ((stake == stake))
107+ then nil
108+ else throw("Strict value is not equal to itself.")
109+ }
110+ else throw("Strict value is not equal to itself.")
100111 }
101112
102113
103114 @Verifier(tx)
104115 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
105116

github/deemru/w8io/169f3d6 
34.51 ms