tx · Gv3eid3XXHf8CV2bE62HnT4NejghppzqEpBgdxVTEd3K

3MzscdhSndapW6EnYbcQzX2JV5rPchNPvgm:  -0.03400000 Waves

2022.06.15 21:34 [2097861] smart account 3MzscdhSndapW6EnYbcQzX2JV5rPchNPvgm > SELF 0.00000000 Waves

{ "type": 13, "id": "Gv3eid3XXHf8CV2bE62HnT4NejghppzqEpBgdxVTEd3K", "fee": 3400000, "feeAssetId": null, "timestamp": 1655318067871, "version": 2, "chainId": 84, "sender": "3MzscdhSndapW6EnYbcQzX2JV5rPchNPvgm", "senderPublicKey": "nJidJWD7ST77Je6wUnEJax76jLoZuLkqzzZ6r1y48Qm", "proofs": [ "VurBgcmzKjFWpKE2VRk4CMrNxj3mrs6xeSxBopSfnaTarp2cGP4SSJXyKa2ahfaSVE3ajDZFsyWbFfazLnfsQFA" ], "script": "base64:AAIFAAAAAAAAAAkIAhIDCgEBEgAAAAAUAAAAAAtrX2luc3VyYW5jZQIAAAALa19pbnN1cmFuY2UAAAAAFGtfY29vcmRpbmF0b3JBZGRyZXNzAgAAABRrX2Nvb3JkaW5hdG9yQWRkcmVzcwAAAAAFa19hbW0CAAAABWtfYW1tAAAAABNrX2luc3VyYW5jZV9hZGRyZXNzAgAAABNrX2luc3VyYW5jZV9hZGRyZXNzAAAAAA9rX2FkbWluX2FkZHJlc3MCAAAAD2tfYWRtaW5fYWRkcmVzcwAAAAASa19hZG1pbl9wdWJsaWNfa2V5AgAAABJrX2FkbWluX3B1YmxpY19rZXkAAAAADWtfcXVvdGVfYXNzZXQCAAAADWtfcXVvdGVfYXNzZXQAAAAAD2tfcXVvdGVfc3Rha2luZwIAAAAPa19xdW90ZV9zdGFraW5nAAAAABFrX3N0YWtpbmdfYWRkcmVzcwIAAAARa19zdGFraW5nX2FkZHJlc3MBAAAADnRvQ29tcG9zaXRlS2V5AAAAAgAAAARfa2V5AAAACF9hZGRyZXNzCQABLAAAAAIJAAEsAAAAAgUAAAAEX2tleQIAAAABXwUAAAAIX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Wx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACQEAAAAOYWRtaW5QdWJsaWNLZXkAAAAACWye8Q==", "height": 2097861, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let k_insurance = "k_insurance"
5+
6+let k_coordinatorAddress = "k_coordinatorAddress"
7+
8+let k_amm = "k_amm"
9+
10+let k_insurance_address = "k_insurance_address"
11+
12+let k_admin_address = "k_admin_address"
13+
14+let k_admin_public_key = "k_admin_public_key"
15+
16+let k_quote_asset = "k_quote_asset"
17+
18+let k_quote_staking = "k_quote_staking"
19+
20+let k_staking_address = "k_staking_address"
21+
22+func toCompositeKey (_key,_address) = ((_key + "_") + _address)
23+
24+
25+func insurance () = valueOrElse(getInteger(this, k_insurance), 0)
26+
27+
28+func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
29+
30+
31+func isWhitelist (_address) = valueOrElse(getBoolean(coordinator(), toCompositeKey(k_amm, _address)), false)
32+
33+
34+func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
35+
36+
37+func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
38+
39+
40+func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
41+
42+
43+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote assete staking not set")
44+
45+
46+func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
47+
48+
49+func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set")
50+
51+
52+func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
53+
54+
55+@Callable(i)
56+func withdraw (_amount) = if (if (!(isWhitelist(toString(i.caller))))
57+ then true
58+ else (_amount > insurance()))
59+ then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
60+ else {
61+ let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
62+ if ((unstake == unstake))
63+ then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
64+ else throw("Strict value is not equal to itself.")
65+ }
66+
67+
68+
69+@Callable(i)
70+func deposit () = {
71+ let _amount = i.payments[0].amount
72+ if (if ((i.payments[0].assetId != quoteAsset()))
73+ then true
74+ else if (!(isWhitelist(toString(i.caller))))
75+ then (i.caller != adminAddress())
76+ else false)
77+ then throw("Invalid deposit params")
78+ else {
79+ let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
80+ if ((stake == stake))
81+ then updateInsurance((insurance() + _amount))
82+ else throw("Strict value is not equal to itself.")
83+ }
84+ }
85+
86+
87+@Verifier(tx)
88+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
89+

github/deemru/w8io/169f3d6 
18.25 ms