tx · 5GsF51n9PDbisRegVjXX2ftBUGmvucwoeazWzmJ1Vcuh 3N7MsRDHzKwQJNMrbMcimpx9pRX94nuAcBQ: -0.03400000 Waves 2022.08.16 10:41 [2186727] smart account 3N7MsRDHzKwQJNMrbMcimpx9pRX94nuAcBQ > SELF 0.00000000 Waves
{ "type": 13, "id": "5GsF51n9PDbisRegVjXX2ftBUGmvucwoeazWzmJ1Vcuh", "fee": 3400000, "feeAssetId": null, "timestamp": 1660635725372, "version": 2, "chainId": 84, "sender": "3N7MsRDHzKwQJNMrbMcimpx9pRX94nuAcBQ", "senderPublicKey": "7oHgJtCipzJkiUPUenbjuMPMv9haz3DyYJ88FFFGCdF2", "proofs": [ "47E4mS8jpBCPhsEv2jL25FvN74Ph1Ee6hYNqBwDw3sQkw8cqGFy8GE135TxchqmijzV1rEFr6UtzYwM7noiRWoiU" ], "script": "base64:BgIsCAISAwoBCBIDCgEIEgMKAQgSBAoCCAgSAwoBCBIECgIICBIDCgEIEgMKAQgRABNrX2luc3VyYW5jZV9hZGRyZXNzAhNrX2luc3VyYW5jZV9hZGRyZXNzAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwASa19hZG1pbl9wdWJsaWNfa2V5AhJrX2FkbWluX3B1YmxpY19rZXkADWtfcXVvdGVfYXNzZXQCDWtfcXVvdGVfYXNzZXQAD2tfcXVvdGVfc3Rha2luZwIPa19xdW90ZV9zdGFraW5nABFrX3N0YWtpbmdfYWRkcmVzcwIRa19zdGFraW5nX2FkZHJlc3MABWtfYW1tAgVrX2FtbQAKa19hbW1fZGF0YQIKa19hbW1fZGF0YQASa19nb3Zlcm5hbmNlX2Fzc2V0AgtrX2dvdl9hc3NldAAPa19taW5lcl9hZGRyZXNzAg9rX21pbmVyX2FkZHJlc3MBDnRvQ29tcG9zaXRlS2V5AgRfa2V5CF9hZGRyZXNzCQCsAgIJAKwCAgUEX2tleQIBXwUIX2FkZHJlc3MBEWdldEFkZHJlc3NJZlZhbG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WdldEFkZHJlc3NJZlZhbGlkAQULX2FtbUFkZHJlc3MJAMwIAgkBDEJvb2xlYW5FbnRyeQIJAQ50b0NvbXBvc2l0ZUtleQIFBWtfYW1tBQtfYW1tQWRkcmVzcwYJAMwIAgkBC1N0cmluZ0VudHJ5AgkBDnRvQ29tcG9zaXRlS2V5AgUKa19hbW1fZGF0YQULX2FtbUFkZHJlc3MFBV9kYXRhBQNuaWwBaQEJcmVtb3ZlQW1tAQtfYW1tQWRkcmVzcwkBC3ZhbHVlT3JFbHNlAgkBB2lzQWRtaW4BBQFpCQDMCAIJAQtEZWxldGVFbnRyeQEJAQ50b0NvbXBvc2l0ZUtleQIFBWtfYW1tBQtfYW1tQWRkcmVzcwUDbmlsAWkBEnNldEdvdmVybmFuY2VBc3NldAEIX2Fzc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAQdpc0FkbWluAQUBaQQKYXNzZXRCeXRlcwkA2QQBBQhfYXNzZXRJZAQHJG1hdGNoMAkA7AcBBQphc3NldEJ5dGVzAwkAAQIFByRtYXRjaDACBUFzc2V0BAVhc3NldAUHJG1hdGNoMAMJAQIhPQIIBQVhc3NldAhkZWNpbWFscwAICQACAQIjSW52YWxpZCBhc3NldCBkZWNpbWFscywgc2hvdWxkIGJlIDgJAMwIAgkBC1N0cmluZ0VudHJ5AgUSa19nb3Zlcm5hbmNlX2Fzc2V0BQhfYXNzZXRJZAUDbmlsCQACAQIQQ2FuJ3QgZmluZCBhc3NldAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBDmFkbWluUHVibGljS2V5AKa3jdo=", "height": 2186727, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
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 | + | let k_governance_asset = "k_gov_asset" | |
21 | + | ||
22 | + | let k_miner_address = "k_miner_address" | |
23 | + | ||
24 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
25 | + | ||
26 | + | ||
27 | + | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
28 | + | ||
29 | + | ||
30 | + | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
31 | + | ||
32 | + | ||
33 | + | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
34 | + | ||
35 | + | ||
36 | + | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
37 | + | ||
38 | + | ||
39 | + | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
40 | + | then true | |
41 | + | else (i.caller == admin())) | |
42 | + | then unit | |
43 | + | else throw("Only the Admin itself can invoke this function") | |
44 | + | ||
45 | + | ||
46 | + | func isAdmin (i) = if ((i.caller == admin())) | |
47 | + | then unit | |
48 | + | else throw("Only the Admin itself can invoke this function") | |
49 | + | ||
50 | + | ||
51 | + | @Callable(i) | |
52 | + | func setAdmin (_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
53 | + | let bytes = fromBase58String(_adminPublicKey) | |
54 | + | let address = addressFromPublicKey(bytes) | |
55 | + | [StringEntry(k_admin_address, toString(address)), StringEntry(k_admin_public_key, _adminPublicKey)] | |
56 | + | }) | |
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | @Callable(i) | |
61 | + | func setInsuranceFund (_insuranceFund) = valueOrElse(isAdmin(i), { | |
62 | + | let address = getAddressIfValid(_insuranceFund) | |
63 | + | [StringEntry(k_insurance_address, address)] | |
64 | + | }) | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(i) | |
69 | + | func setLiquidityMiner (_liquidityMiner) = valueOrElse(isAdmin(i), { | |
70 | + | let address = getAddressIfValid(_liquidityMiner) | |
71 | + | [StringEntry(k_miner_address, address)] | |
72 | + | }) | |
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | @Callable(i) | |
77 | + | func setQuoteAsset (_assetId,_stakingAddress) = valueOrElse(isAdmin(i), { | |
78 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
79 | + | [StringEntry(k_quote_asset, _assetId), StringEntry(k_quote_staking, _stakingAddress)] | |
80 | + | }) | |
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | @Callable(i) | |
85 | + | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
86 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
87 | + | [StringEntry(k_staking_address, _stakingAddress)] | |
88 | + | }) | |
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | @Callable(i) | |
93 | + | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
94 | + | let ammAddress = getAddressIfValid(_ammAddress) | |
95 | + | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
96 | + | }) | |
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | @Callable(i) | |
101 | + | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | @Callable(i) | |
106 | + | func setGovernanceAsset (_assetId) = valueOrElse(isAdmin(i), { | |
107 | + | let assetBytes = fromBase58String(_assetId) | |
108 | + | match assetInfo(assetBytes) { | |
109 | + | case asset: Asset => | |
110 | + | if ((asset.decimals != 8)) | |
111 | + | then throw("Invalid asset decimals, should be 8") | |
112 | + | else [StringEntry(k_governance_asset, _assetId)] | |
113 | + | case _ => | |
114 | + | throw("Can't find asset") | |
115 | + | } | |
116 | + | }) | |
117 | + | ||
118 | + | ||
119 | + | @Verifier(tx) | |
120 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
121 | + |
github/deemru/w8io/169f3d6 15.36 ms ◑