tx · E2vKMkohJmUV57Qp1ShDoCseSkxr2582Kpgmn9mPPMRW

3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA:  -0.03700000 Waves

2022.11.25 19:31 [2332866] smart account 3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA > SELF 0.00000000 Waves

{ "type": 13, "id": "E2vKMkohJmUV57Qp1ShDoCseSkxr2582Kpgmn9mPPMRW", "fee": 3700000, "feeAssetId": null, "timestamp": 1669393860880, "version": 2, "chainId": 84, "sender": "3MzhpxAKSeCcAYnwEQzd4v8xhuxEa7H79mA", "senderPublicKey": "A4jJoT1GfErs6Zq9p6jQrT43kuzivydaycZfLbuBCAhq", "proofs": [ "2EkoYhwTvEoJaeGD84UW7pBNMyyHnjNBjRWnPCSLJvRhASzGrifeNeu2oDZSyAJ2TFScEtdXhHo5LYvZAQzTmmcD" ], "script": "base64:BgIQCAISAwoBCBIDCgEBEgASABYAC2tfaW5zdXJhbmNlAgtrX2luc3VyYW5jZQAUa19jb29yZGluYXRvckFkZHJlc3MCFGtfY29vcmRpbmF0b3JBZGRyZXNzAAVrX2FtbQIFa19hbW0AD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzABJrX2FkbWluX3B1YmxpY19rZXkCEmtfYWRtaW5fcHVibGljX2tleQANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAPa19xdW90ZV9zdGFraW5nAg9rX3F1b3RlX3N0YWtpbmcAEWtfbWFuYWdlcl9hZGRyZXNzAhFrX21hbmFnZXJfYWRkcmVzcwAUa19jb2xsYXRlcmFsX2FkZHJlc3MCFGtfY29sbGF0ZXJhbF9hZGRyZXNzAA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkAQ50b0NvbXBvc2l0ZUtleQIEX2tleQhfYWRkcmVzcwkArAICCQCsAgIFBF9rZXkCAV8FCF9hZGRyZXNzAQlpbnN1cmFuY2UACQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFC2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AMwIAgkA2AQBCQEKcXVvdGVBc3NldAAFA25pbAUDbmlsAwkAAAIFB3Vuc3Rha2UFB3Vuc3Rha2UEBXN0YWtlCQD8BwQJAQ5tYW5hZ2VyQWRkcmVzcwACB2RlcG9zaXQFA25pbAkAzAgCCQEPQXR0YWNoZWRQYXltZW50AgkBCnF1b3RlQXNzZXQABQZhbW91bnQFA25pbAMJAAACBQVzdGFrZQUFc3Rha2UFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJAQ5hZG1pblB1YmxpY0tleQBuR7Tn", "height": 2332866, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AWCT2y1W1AWX5PvSkp7Kv9i4w9qrTiYmM2a8Daeh3UGM Next: none Diff:
OldNewDifferences
9494 else (i.caller == collateralAddress()))
9595 then true
9696 else (i.caller == adminAddress())))
97- then throw("Invalid deposit params")
97+ then throw("Invalid deposit params (insurance)")
9898 else {
9999 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
100100 if ((stake == stake))
Full:
OldNewDifferences
11 {-# 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
1818 let k_manager_address = "k_manager_address"
1919
2020 let k_collateral_address = "k_collateral_address"
2121
2222 let k_initialized = "k_initialized"
2323
2424 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
2525
2626
2727 func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
2828
2929
3030 func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set")), "Coordinator not set")
3131
3232
3333 func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
3434
3535
3636 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
3737
3838
3939 func adminAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_admin_address), "Admin address not set"))
4040
4141
4242 func adminPublicKey () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_admin_public_key), "Admin public key not set"))
4343
4444
4545 func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
4646
4747
4848 func quoteAssetStaking () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_quote_staking), "Quote asset staking not set")), "Quote asset staking not set")
4949
5050
5151 func managerAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_manager_address), "Manager not set")), "Manager not set")
5252
5353
5454 func collateralAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_collateral_address), "Collateral not set")), "Collateral not set")
5555
5656
5757 func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
5858
5959
6060 @Callable(i)
6161 func initialize (_coordinator) = if (initialized())
6262 then throw("Already initialized")
6363 else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)]
6464
6565
6666
6767 @Callable(i)
6868 func withdraw (_amount) = if (if (if (!(if (isWhitelist(toString(i.caller)))
6969 then true
7070 else (i.caller == collateralAddress())))
7171 then true
7272 else !(initialized()))
7373 then true
7474 else (_amount > insurance()))
7575 then throw(((("Invalid withdraw params (insurance) " + toString(_amount)) + " > ") + toString(insurance())))
7676 else {
7777 let unstake = invoke(managerAddress(), "withdraw", [toBase58String(quoteAsset()), _amount], nil)
7878 if ((unstake == unstake))
7979 then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
8080 else throw("Strict value is not equal to itself.")
8181 }
8282
8383
8484
8585 @Callable(i)
8686 func deposit () = {
8787 let _amount = i.payments[0].amount
8888 if (if (if ((i.payments[0].assetId != quoteAsset()))
8989 then true
9090 else !(initialized()))
9191 then true
9292 else !(if (if (isWhitelist(toString(i.caller)))
9393 then true
9494 else (i.caller == collateralAddress()))
9595 then true
9696 else (i.caller == adminAddress())))
97- then throw("Invalid deposit params")
97+ then throw("Invalid deposit params (insurance)")
9898 else {
9999 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), _amount)])
100100 if ((stake == stake))
101101 then updateInsurance((insurance() + _amount))
102102 else throw("Strict value is not equal to itself.")
103103 }
104104 }
105105
106106
107107
108108 @Callable(i)
109109 func migrateLiquidity () = {
110110 let amount = insurance()
111111 let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [amount, toBase58String(quoteAsset())], nil)
112112 if ((unstake == unstake))
113113 then {
114114 let stake = invoke(managerAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), amount)])
115115 if ((stake == stake))
116116 then nil
117117 else throw("Strict value is not equal to itself.")
118118 }
119119 else throw("Strict value is not equal to itself.")
120120 }
121121
122122
123123 @Verifier(tx)
124124 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
125125

github/deemru/w8io/026f985 
43.55 ms