tx · FvJG7TBYA4268yPjgm76YEVfUV44LX18ywVbbVjQmJj9

3N5MDZSz9RsNfTEevPgj1BV7e3YQCZ38KgC:  -0.03400000 Waves

2022.07.05 15:48 [2126397] smart account 3N5MDZSz9RsNfTEevPgj1BV7e3YQCZ38KgC > SELF 0.00000000 Waves

{ "type": 13, "id": "FvJG7TBYA4268yPjgm76YEVfUV44LX18ywVbbVjQmJj9", "fee": 3400000, "feeAssetId": null, "timestamp": 1657025354259, "version": 2, "chainId": 84, "sender": "3N5MDZSz9RsNfTEevPgj1BV7e3YQCZ38KgC", "senderPublicKey": "zzUTcRufBzvKzQq8QkhTVTXywza4PokmTzS6q5iRHan", "proofs": [ "5ynmEQ5RWWP5V7NXLMUHXgAfYyTXaDZELmmYsPKekbVmmj3VvhyhJBCui1qNwhEcWyXnqkJwdhaWmujsqMVNkoVi" ], "script": "base64:AAIFAAAAAAAAAA4IAhIDCgEIEgMKAQESAAAAABQAAAAAC2tfaW5zdXJhbmNlAgAAAAtrX2luc3VyYW5jZQAAAAAUa19jb29yZGluYXRvckFkZHJlc3MCAAAAFGtfY29vcmRpbmF0b3JBZGRyZXNzAAAAAAVrX2FtbQIAAAAFa19hbW0AAAAAD2tfYWRtaW5fYWRkcmVzcwIAAAAPa19hZG1pbl9hZGRyZXNzAAAAABJrX2FkbWluX3B1YmxpY19rZXkCAAAAEmtfYWRtaW5fcHVibGljX2tleQAAAAANa19xdW90ZV9hc3NldAIAAAANa19xdW90ZV9hc3NldAAAAAAPa19xdW90ZV9zdGFraW5nAgAAAA9rX3F1b3RlX3N0YWtpbmcAAAAAEWtfc3Rha2luZ19hZGRyZXNzAgAAABFrX3N0YWtpbmdfYWRkcmVzcwAAAAANa19pbml0aWFsaXplZAIAAAANa19pbml0aWFsaXplZAEAAAAOdG9Db21wb3NpdGVLZXkAAAACAAAABF9rZXkAAAAIX2FkZHJlc3MJAAEsAAAAAgkAASwAAAACBQAAAARfa2V5AgAAAAFfBQAAAAhfYWRkcmVzcwE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A25pbAkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgkBAAAACnF1b3RlQXNzZXQAAAAABQAAAAdfYW1vdW50BQAAAANuaWwDCQAAAAAAAAIFAAAABXN0YWtlBQAAAAVzdGFrZQkBAAAAD3VwZGF0ZUluc3VyYW5jZQAAAAEJAABkAAAAAgkBAAAACWluc3VyYW5jZQAAAAAFAAAAB19hbW91bnQJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAQAAAA5hZG1pblB1YmxpY0tleQAAAABs+eQR", "height": 2126397, "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_admin_address = "k_admin_address"
11+
12+let k_admin_public_key = "k_admin_public_key"
13+
14+let k_quote_asset = "k_quote_asset"
15+
16+let k_quote_staking = "k_quote_staking"
17+
18+let k_staking_address = "k_staking_address"
19+
20+let k_initialized = "k_initialized"
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 initialized () = valueOrElse(getBoolean(this, k_initialized), false)
35+
36+
37+func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
38+
39+
40+func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
41+
42+
43+func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
44+
45+
46+func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
47+
48+
49+func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set")
50+
51+
52+func updateInsurance (i) = [IntegerEntry(k_insurance, i)]
53+
54+
55+@Callable(i)
56+func initialize (_coordinator) = if (initialized())
57+ then throw("Already initialized")
58+ else [StringEntry(k_coordinatorAddress, _coordinator), BooleanEntry(k_initialized, true)]
59+
60+
61+
62+@Callable(i)
63+func withdraw (_amount) = if (if (if (!(isWhitelist(toString(i.caller))))
64+ then true
65+ else !(initialized()))
66+ then true
67+ else (_amount > insurance()))
68+ then throw(((("Invalid withdraw params " + toString(_amount)) + " > ") + toString(insurance())))
69+ else {
70+ let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil)
71+ if ((unstake == unstake))
72+ then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, quoteAsset())])
73+ else throw("Strict value is not equal to itself.")
74+ }
75+
76+
77+
78+@Callable(i)
79+func deposit () = {
80+ let _amount = i.payments[0].amount
81+ if (if (if ((i.payments[0].assetId != quoteAsset()))
82+ then true
83+ else !(initialized()))
84+ then true
85+ else if (!(isWhitelist(toString(i.caller))))
86+ then (i.caller != adminAddress())
87+ else false)
88+ then throw("Invalid deposit params")
89+ else {
90+ let stake = invoke(quoteAssetStaking(), "lockNeutrino", nil, [AttachedPayment(quoteAsset(), _amount)])
91+ if ((stake == stake))
92+ then updateInsurance((insurance() + _amount))
93+ else throw("Strict value is not equal to itself.")
94+ }
95+ }
96+
97+
98+@Verifier(tx)
99+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
100+

github/deemru/w8io/026f985 
16.42 ms