tx · 3G9SuV8saJ3JWGug5NJaCGoVmtXkahHkynycwzhkewDk 3NCQykCT3GGzTQMW3pLuSt4ZSg3m7FjKrTM: -0.03400000 Waves 2022.06.16 11:47 [2098707] smart account 3NCQykCT3GGzTQMW3pLuSt4ZSg3m7FjKrTM > SELF 0.00000000 Waves
{ "type": 13, "id": "3G9SuV8saJ3JWGug5NJaCGoVmtXkahHkynycwzhkewDk", "fee": 3400000, "feeAssetId": null, "timestamp": 1655369252453, "version": 2, "chainId": 84, "sender": "3NCQykCT3GGzTQMW3pLuSt4ZSg3m7FjKrTM", "senderPublicKey": "3Hq1mR8H6AjERF7EAkssXCJS8vuoy2JVg1VQeKSjZXgZ", "proofs": [ "5NXmR1j4c2PF89fF6idAazCmY9ejABSCiVRDzvSAsbz9E9xmQ2eZVrMTMK8ktn8Qbo4DKCcGa48bDASvacpitXmt" ], "script": "base64:AAIFAAAAAAAAACMIAhIECgIICBIDCgEIEgQKAggIEgMKAQgSBAoCCAgSAwoBCAAAAA8AAAAAE2tfaW5zdXJhbmNlX2FkZHJlc3MCAAAAE2tfaW5zdXJhbmNlX2FkZHJlc3MAAAAAD2tfYWRtaW5fYWRkcmVzcwIAAAAPa19hZG1pbl9hZGRyZXNzAAAAABJrX2FkbWluX3B1YmxpY19rZXkCAAAAEmtfYWRtaW5fcHVibGljX2tleQAAAAANa19xdW90ZV9hc3NldAIAAAANa19xdW90ZV9hc3NldAAAAAAPa19xdW90ZV9zdGFraW5nAgAAAA9rX3F1b3RlX3N0YWtpbmcAAAAAEWtfc3Rha2luZ19hZGRyZXNzAgAAABFrX3N0YWtpbmdfYWRkcmVzcwAAAAAFa19hbW0CAAAABWtfYW1tAAAAAAprX2FtbV9kYXRhAgAAAAprX2FtbV9kYXRhAQAAAA50b0NvbXBvc2l0ZUtleQAAAAIAAAAEX2tleQAAAAhfYWRkcmVzcwkAASwAAAACCQABLAAAAAIFAAAABF9rZXkCAAAAAV8FAAAACF9hZGRyZXNzAQAAABFnZXRBZG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nkAAAABCQEAAAAOdG9Db21wb3NpdGVLZXkAAAACBQAAAAVrX2FtbQUAAAALX2FtbUFkZHJlc3MFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACQACWQAAAAEJAQAAAA5hZG1pblB1YmxpY0tleQAAAACbcS7j", "height": 2098707, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let k_insurance_address = "k_insurance_address" | |
5 | + | ||
6 | + | let k_admin_address = "k_admin_address" | |
7 | + | ||
8 | + | let k_admin_public_key = "k_admin_public_key" | |
9 | + | ||
10 | + | let k_quote_asset = "k_quote_asset" | |
11 | + | ||
12 | + | let k_quote_staking = "k_quote_staking" | |
13 | + | ||
14 | + | let k_staking_address = "k_staking_address" | |
15 | + | ||
16 | + | let k_amm = "k_amm" | |
17 | + | ||
18 | + | let k_amm_data = "k_amm_data" | |
19 | + | ||
20 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
21 | + | ||
22 | + | ||
23 | + | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
24 | + | ||
25 | + | ||
26 | + | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
27 | + | ||
28 | + | ||
29 | + | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
30 | + | ||
31 | + | ||
32 | + | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
33 | + | ||
34 | + | ||
35 | + | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
36 | + | then true | |
37 | + | else (i.caller == admin())) | |
38 | + | then unit | |
39 | + | else throw("Only the Admin itself can invoke this function") | |
40 | + | ||
41 | + | ||
42 | + | func isAdmin (i) = if ((i.caller == admin())) | |
43 | + | then unit | |
44 | + | else throw("Only the Admin itself can invoke this function") | |
45 | + | ||
46 | + | ||
47 | + | @Callable(i) | |
48 | + | func setAdmin (_adminAddress,_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
49 | + | let address = getAddressIfValid(_adminAddress) | |
50 | + | let bytes = fromBase58String(_adminPublicKey) | |
51 | + | let x = addressFromPublicKey(bytes) | |
52 | + | if ((toString(x) != address)) | |
53 | + | then throw("Address and public key do not match") | |
54 | + | else [StringEntry(k_admin_address, _adminAddress), StringEntry(k_admin_public_key, _adminPublicKey)] | |
55 | + | }) | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(i) | |
60 | + | func setInsuranceFund (_insuranceFund) = valueOrElse(isAdmin(i), { | |
61 | + | let address = getAddressIfValid(_insuranceFund) | |
62 | + | [StringEntry(k_insurance_address, address)] | |
63 | + | }) | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func setQuoteAsset (_assetId,_stakingAddress) = valueOrElse(isAdmin(i), { | |
69 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
70 | + | [StringEntry(k_quote_asset, _assetId), StringEntry(k_quote_staking, _stakingAddress)] | |
71 | + | }) | |
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | @Callable(i) | |
76 | + | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
77 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
78 | + | [StringEntry(k_staking_address, _stakingAddress)] | |
79 | + | }) | |
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | @Callable(i) | |
84 | + | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
85 | + | let ammAddress = getAddressIfValid(_ammAddress) | |
86 | + | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
87 | + | }) | |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | @Callable(i) | |
92 | + | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
93 | + | ||
94 | + | ||
95 | + | @Verifier(tx) | |
96 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
97 | + |
github/deemru/w8io/026f985 17.57 ms ◑