tx · HnhxemX4mo4ViFDNpdev1YunSJb8SCvQwZsznb2fhfP1 3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8: -0.03400000 Waves 2022.09.21 12:56 [2238741] smart account 3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8 > SELF 0.00000000 Waves
{ "type": 13, "id": "HnhxemX4mo4ViFDNpdev1YunSJb8SCvQwZsznb2fhfP1", "fee": 3400000, "feeAssetId": null, "timestamp": 1663754252807, "version": 2, "chainId": 84, "sender": "3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8", "senderPublicKey": "HjRpGGPsru1jMvZDVG83rQfzQRHCWNnrpMaqTpHogxyn", "proofs": [ "43J5cYomihJnkFC3Z3mUTBWhRFPzU3VkPnAwxeFD8H1WUvfjTfqmceqPFnFEvCAAJGPo9Ak4F9gkutL3htQvPW3d" ], "script": "base64:BgI7CAISAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgSAwoBCBIECgIICBIDCgEIEgMKAQgUABNrX2luc3VyYW5jZV9hZGRyZXNzAhNrX2luc3VyYW5jZV9hZGRyZXNzAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwASa19hZG1pbl9wdWJsaWNfa2V5AhJrX2FkbWluX3B1YmxpY19rZXkADWtfcXVvdGVfYXNzZXQCDWtfcXVvdGVfYXNzZXQAD2tfcXVvdGVfc3Rha2luZwIPa19xdW90ZV9zdGFraW5nABFrX3N0YWtpbmdfYWRkcmVzcwIRa19zdGFraW5nX2FkZHJlc3MAEWtfZmFybWluZ19hZGRyZXNzAhFrX2Zhcm1pbmdfYWRkcmVzcwAFa19hbW0CBWtfYW1tAAprX2FtbV9kYXRhAgprX2FtbV9kYXRhABJrX2dvdmVybmFuY2VfYXNzZXQCC2tfZ292X2Fzc2V0AA9rX21pbmVyX2FkZHJlc3MCD2tfbWluZXJfYWRkcmVzcwAQa19vcmRlcnNfYWRkcmVzcwIQa19vcmRlcn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FpCQDMCAIJAQtEZWxldGVFbnRyeQEJAQ50b0NvbXBvc2l0ZUtleQIFBWtfYW1tBQtfYW1tQWRkcmVzcwUDbmlsAWkBEnNldEdvdmVybmFuY2VBc3NldAEIX2Fzc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAQdpc0FkbWluAQUBaQQKYXNzZXRCeXRlcwkA2QQBBQhfYXNzZXRJZAQHJG1hdGNoMAkA7AcBBQphc3NldEJ5dGVzAwkAAQIFByRtYXRjaDACBUFzc2V0BAVhc3NldAUHJG1hdGNoMAMJAQIhPQIIBQVhc3NldAhkZWNpbWFscwAICQACAQIjSW52YWxpZCBhc3NldCBkZWNpbWFscywgc2hvdWxkIGJlIDgJAMwIAgkBC1N0cmluZ0VudHJ5AgUSa19nb3Zlcm5hbmNlX2Fzc2V0BQhfYXNzZXRJZAUDbmlsCQACAQIQQ2FuJ3QgZmluZCBhc3NldAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBDmFkbWluUHVibGljS2V5ADCKvbY=", "height": 2238741, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8PL3GsH7e2gYrgqxxA8jDfqMwrj7uQwDNh6X6jPhUe1T Next: EmtuEqNC6isXGSipviwMueWQPhUP9W7bPb3SW9DsiGff Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_insurance_address = "k_insurance_address" | |
5 | 5 | ||
6 | 6 | let k_admin_address = "k_admin_address" | |
7 | 7 | ||
8 | 8 | let k_admin_public_key = "k_admin_public_key" | |
9 | 9 | ||
10 | 10 | let k_quote_asset = "k_quote_asset" | |
11 | 11 | ||
12 | 12 | let k_quote_staking = "k_quote_staking" | |
13 | 13 | ||
14 | 14 | let k_staking_address = "k_staking_address" | |
15 | 15 | ||
16 | 16 | let k_farming_address = "k_farming_address" | |
17 | 17 | ||
18 | 18 | let k_amm = "k_amm" | |
19 | 19 | ||
20 | 20 | let k_amm_data = "k_amm_data" | |
21 | 21 | ||
22 | 22 | let k_governance_asset = "k_gov_asset" | |
23 | 23 | ||
24 | 24 | let k_miner_address = "k_miner_address" | |
25 | 25 | ||
26 | 26 | let k_orders_address = "k_orders_address" | |
27 | 27 | ||
28 | 28 | let k_referral_address = "k_referral_address" | |
29 | 29 | ||
30 | 30 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
46 | 46 | then true | |
47 | 47 | else (i.caller == admin())) | |
48 | 48 | then unit | |
49 | 49 | else throw("Only the Admin itself can invoke this function") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func isAdmin (i) = if ((i.caller == admin())) | |
53 | 53 | then unit | |
54 | 54 | else throw("Only the Admin itself can invoke this function") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func setAdmin (_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
59 | 59 | let bytes = fromBase58String(_adminPublicKey) | |
60 | 60 | let address = addressFromPublicKey(bytes) | |
61 | 61 | [StringEntry(k_admin_address, toString(address)), StringEntry(k_admin_public_key, _adminPublicKey)] | |
62 | 62 | }) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
66 | 66 | @Callable(i) | |
67 | 67 | func setInsuranceFund (_insuranceFund) = valueOrElse(isAdmin(i), { | |
68 | 68 | let address = getAddressIfValid(_insuranceFund) | |
69 | 69 | [StringEntry(k_insurance_address, address)] | |
70 | 70 | }) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(i) | |
75 | 75 | func setLiquidityMiner (_liquidityMiner) = valueOrElse(isAdmin(i), { | |
76 | 76 | let address = getAddressIfValid(_liquidityMiner) | |
77 | 77 | [StringEntry(k_miner_address, address)] | |
78 | 78 | }) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func setOrders (_orders) = valueOrElse(isAdmin(i), { | |
84 | 84 | let address = getAddressIfValid(_orders) | |
85 | 85 | [StringEntry(k_orders_address, address)] | |
86 | 86 | }) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func setReferral (_referral) = valueOrElse(isAdmin(i), { | |
92 | 92 | let address = getAddressIfValid(_referral) | |
93 | 93 | [StringEntry(k_referral_address, address)] | |
94 | 94 | }) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | ||
98 | 98 | @Callable(i) | |
99 | 99 | func setFarming (_farming) = valueOrElse(isAdmin(i), { | |
100 | 100 | let address = getAddressIfValid(_farming) | |
101 | 101 | [StringEntry(k_farming_address, address)] | |
102 | 102 | }) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(i) | |
107 | 107 | func setQuoteAsset (_assetId,_stakingAddress) = valueOrElse(isAdmin(i), { | |
108 | 108 | let stakingAddress = getAddressIfValid(_stakingAddress) | |
109 | 109 | [StringEntry(k_quote_asset, _assetId), StringEntry(k_quote_staking, _stakingAddress)] | |
110 | 110 | }) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | 115 | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
116 | 116 | let stakingAddress = getAddressIfValid(_stakingAddress) | |
117 | 117 | [StringEntry(k_staking_address, _stakingAddress)] | |
118 | 118 | }) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | 123 | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
124 | 124 | let ammAddress = getAddressIfValid(_ammAddress) | |
125 | 125 | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
126 | 126 | }) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | ||
130 | 130 | @Callable(i) | |
131 | 131 | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(i) | |
136 | 136 | func setGovernanceAsset (_assetId) = valueOrElse(isAdmin(i), { | |
137 | 137 | let assetBytes = fromBase58String(_assetId) | |
138 | 138 | match assetInfo(assetBytes) { | |
139 | 139 | case asset: Asset => | |
140 | 140 | if ((asset.decimals != 8)) | |
141 | 141 | then throw("Invalid asset decimals, should be 8") | |
142 | 142 | else [StringEntry(k_governance_asset, _assetId)] | |
143 | 143 | case _ => | |
144 | 144 | throw("Can't find asset") | |
145 | 145 | } | |
146 | 146 | }) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Verifier(tx) | |
150 | 150 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
151 | 151 |
github/deemru/w8io/026f985 32.27 ms ◑