tx · 6afjE2GJ9yrFhZynkCRYQMpTg4h59YgJNMsjumUhWxLP

3N4aFcsnij7Y1qGaQTLFNN2px73fHsXQHe9:  -0.03700000 Waves

2022.10.06 10:42 [2260170] smart account 3N4aFcsnij7Y1qGaQTLFNN2px73fHsXQHe9 > SELF 0.00000000 Waves

{ "type": 13, "id": "6afjE2GJ9yrFhZynkCRYQMpTg4h59YgJNMsjumUhWxLP", "fee": 3700000, "feeAssetId": null, "timestamp": 1665042166528, "version": 2, "chainId": 84, "sender": "3N4aFcsnij7Y1qGaQTLFNN2px73fHsXQHe9", "senderPublicKey": "9tSn5bcPwQj2eR4oxkB2oUpmEoBqc2on24JrNhCgFoTK", "proofs": [ "59uBek37EHVRJALjpxCxh6VNHXgWD5a81ia3gCK4qaBimNiskjqR3J2JpzpJem54yBCvLN3FM8fWE9UW1fabTezZ" ], "script": "base64:BgIQCAISAwoBCBIDCgEBEgASABQAC2tfaW5zdXJhbmNlAgtrX2luc3VyYW5jZQAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAAVrX2FtbQIFa19hbW0AD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAPa19xdW90ZV9zdGFraW5nAg9rX3F1b3RlX3N0YWtpbmcAEWtfbWFuYWdlcl9hZGRyZXNzAhFrX21hbmFnZXJfYWRkcmVzcwANa19pbml0aWFsaXplZAINa19pbml0aWFsaXplZAEOdG9Db21wb3NpdGVLZXkCBF9rZXkIX2FkZHJlc3MJAKwCAgkArAICBQRfa2V5AgFfBQhfYWRkcmVzcwEJaW5zdXJhbmNlAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQtrX2luc3VyYW5jZQAAAQtjb29yZGluYXRvcgAJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgk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QJ0eAZwcm9vZnMAAAkBDmFkbWluUHVibGljS2V5AJp4IHE=", "height": 2260170, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AzwYdTNQpQJC2qTbgndBAFuYFZhPrpWnETmrS1Hrh2or Next: 2X8Wi8q659CMUgK4Uc9UTxRzqBFzq7MyFUkiw9Vag4Ad Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_insurance = "k_insurance"
1515
1616 let k_quote_staking = "k_quote_staking"
1717
18-let k_staking_address = "k_staking_address"
18+let k_manager_address = "k_manager_address"
1919
2020 let k_initialized = "k_initialized"
2121
2525 func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
2626
2727
28-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")
2929
3030
3131 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3434 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
3535
3636
37-func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
37+func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
3838
3939
40-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"))
4141
4242
43-func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
43+func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
4444
4545
46-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
46+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_quote_staking), "Quote asset staking not set")), "Quote asset staking not set")
4747
4848
49-func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
49+func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager not set")), "Manager not set")
5050
5151
5252 func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
6767 else (_amount > insurance()))
6868 then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
6969 else {
70- let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
70+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
7171 if ((unstake == unstake))
7272 then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
7373 else throw("Strict value is not equal to itself.")
8787 else false)
8888 then throw("Invalid deposit params")
8989 else {
90- let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
90+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
9191 if ((stake == stake))
9292 then updateInsurance((insurance() + _amount))
9393 else throw("Strict value is not equal to itself.")
9494 }
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.")
95111 }
96112
97113
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"
99
1010 let k_admin_address = "k_admin_address"
1111
1212 let k_admin_public_key = "k_admin_public_key"
1313
1414 let k_quote_asset = "k_quote_asset"
1515
1616 let k_quote_staking = "k_quote_staking"
1717
18-let k_staking_address = "k_staking_address"
18+let k_manager_address = "k_manager_address"
1919
2020 let k_initialized = "k_initialized"
2121
2222 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
2323
2424
2525 func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
2626
2727
28-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")
2929
3030
3131 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3232
3333
3434 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
3535
3636
37-func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
37+func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
3838
3939
40-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"))
4141
4242
43-func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
43+func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
4444
4545
46-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
46+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_quote_staking), "Quote asset staking not set")), "Quote asset staking not set")
4747
4848
49-func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
49+func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager not set")), "Manager not set")
5050
5151
5252 func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
5353
5454
5555 @Callable(i)
5656 func initialize (_coordinator) = if (initialized())
5757 then throw("Already initialized")
5858 else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)]
5959
6060
6161
6262 @Callable(i)
6363 func withdraw (_amount) = if (if (if (!(isWhitelist(toString(i.caller))))
6464 then true
6565 else !(initialized()))
6666 then true
6767 else (_amount > insurance()))
6868 then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
6969 else {
70- let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
70+ let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
7171 if ((unstake == unstake))
7272 then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
7373 else throw("Strict value is not equal to itself.")
7474 }
7575
7676
7777
7878 @Callable(i)
7979 func deposit () = {
8080 let _amount = i.payments[0].amount
8181 if (if (if ((i.payments[0].assetId != quoteAsset()))
8282 then true
8383 else !(initialized()))
8484 then true
8585 else if (!(isWhitelist(toString(i.caller))))
8686 then (i.caller != adminAddress())
8787 else false)
8888 then throw("Invalid deposit params")
8989 else {
90- let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
90+ let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
9191 if ((stake == stake))
9292 then updateInsurance((insurance() + _amount))
9393 else throw("Strict value is not equal to itself.")
9494 }
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.")
95111 }
96112
97113
98114 @Verifier(tx)
99115 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
100116

github/deemru/w8io/169f3d6 
53.08 ms