tx · DfP7TK3LyqzVc8rPHPvsYGdsJWRgakB31z4xEK97vevq 3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8: -0.03400000 Waves 2023.04.17 19:59 [2538833] smart account 3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8 > SELF 0.00000000 Waves
{ "type": 13, "id": "DfP7TK3LyqzVc8rPHPvsYGdsJWRgakB31z4xEK97vevq", "fee": 3400000, "feeAssetId": null, "timestamp": 1681750803365, "version": 2, "chainId": 84, "sender": "3MzdomR4UkWKtVXq6YGouPJsYXDunjCvSJ8", "senderPublicKey": "HjRpGGPsru1jMvZDVG83rQfzQRHCWNnrpMaqTpHogxyn", "proofs": [ "5insn4xLVYzTfCXr3juC7D24Z41HhmKsnnmk5X3CxYxwxf3tbdW3d9y582zxozwBWp4Vm7vuZXzqzWnBW9qqmuNJ" ], "script": "base64:BgJiCAISAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIEgMKAQgZABNrX2luc3VyYW5jZV9hZGRyZXNzAhNrX2luc3VyYW5jZV9hZGRyZXNzAA9rX3ZhdWx0X2FkZHJlc3MCD2tfdmF1bHRfYWRkcmVzcwAPa19hZG1pbl9hZGRyZXNzAg9rX2FkbWluX2FkZHJlc3MADWtfcXVvdGVfYXNzZXQCDWtfcXVvdGVfYXNzZXQADmtfcmV3YXJkX2Fzc2V0Ag5rX3Jld2FyZF9hc3NldAAOa19zd2FwX2FkZHJlc3MCDmtfc3dhcF9hZGRyZXNzABFrX3N0YWtpbmdfYWRkcmVzcwIRa19zdGFraW5nX2FkZHJlc3MAEWtfZmFybWluZ19hZGRyZXNzAhFrX2Zhcm1pbmdfYWRkcmVzcwAQa19wcml6ZXNfYWRkcmVzcwIQa19wcml6ZXNfYWRkcmVzcwAVa19ob3VzZWtlZXBlcl9hZGRyZXNzAhV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YW4ndCBmaW5kIGFzc2V0AQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAkAnQgCBQR0aGlzBQ9rX2FkbWluX2FkZHJlc3MDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAh2ZXJpZmllcgUHJG1hdGNoMAkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBBQh2ZXJpZmllcgkArAICCQCsAgIJAKwCAgIHc3RhdHVzXwkApQgBBQR0aGlzAgFfCQDYBAEIBQJ0eAJpZAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXmJcs8p", "height": 2538833, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: TyLj6wFsizsbhkPksHmB9B1F72QRNPYJbowNnSZBveT Next: none Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let k_admin_address = "k_admin_address" | |
9 | 9 | ||
10 | - | let k_admin_public_key = "k_admin_public_key" | |
11 | - | ||
12 | 10 | let k_quote_asset = "k_quote_asset" | |
13 | 11 | ||
14 | - | let k_quote_staking = "k_quote_staking" | |
12 | + | let k_reward_asset = "k_reward_asset" | |
13 | + | ||
14 | + | let k_swap_address = "k_swap_address" | |
15 | 15 | ||
16 | 16 | let k_staking_address = "k_staking_address" | |
17 | 17 | ||
37 | 37 | ||
38 | 38 | let k_nft_manager_address = "k_nft_manager_address" | |
39 | 39 | ||
40 | - | let k_collateral_address = "k_collateral_address" | |
41 | - | ||
42 | - | let k_exchange_address = "k_exchange_address" | |
40 | + | let k_child = "k_child" | |
43 | 41 | ||
44 | 42 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
45 | 43 | ||
46 | 44 | ||
47 | 45 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
48 | - | ||
49 | - | ||
50 | - | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
51 | 46 | ||
52 | 47 | ||
53 | 48 | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
56 | 51 | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
57 | 52 | ||
58 | 53 | ||
59 | - | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
54 | + | func isNoAdminOrAdmin (i) = if (if (if (isNoAdmin()) | |
55 | + | then (i.caller == this) | |
56 | + | else false) | |
60 | 57 | then true | |
61 | 58 | else (i.caller == admin())) | |
62 | 59 | then unit | |
69 | 66 | ||
70 | 67 | ||
71 | 68 | @Callable(i) | |
72 | - | func setAdmin (_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
73 | - | let bytes = fromBase58String(_adminPublicKey) | |
74 | - | let address = addressFromPublicKey(bytes) | |
75 | - | [StringEntry(k_admin_address, toString(address)), StringEntry(k_admin_public_key, _adminPublicKey)] | |
69 | + | func setAdmin (_adminAddress) = valueOrElse(isNoAdminOrAdmin(i), { | |
70 | + | let address = addressFromStringValue(_adminAddress) | |
71 | + | [StringEntry(k_admin_address, toString(address))] | |
76 | 72 | }) | |
77 | 73 | ||
78 | 74 | ||
150 | 146 | ||
151 | 147 | ||
152 | 148 | @Callable(i) | |
153 | - | func | |
154 | - | let | |
155 | - | [StringEntry(k_ | |
149 | + | func setSwap (_swap) = valueOrElse(isAdmin(i), { | |
150 | + | let address = getAddressIfValid(_swap) | |
151 | + | [StringEntry(k_swap_address, address)] | |
156 | 152 | }) | |
153 | + | ||
154 | + | ||
155 | + | ||
156 | + | @Callable(i) | |
157 | + | func setQuoteAsset (_assetId) = valueOrElse(isAdmin(i), [StringEntry(k_quote_asset, _assetId)]) | |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func setRewardAsset (_assetId) = valueOrElse(isAdmin(i), [StringEntry(k_reward_asset, _assetId)]) | |
157 | 163 | ||
158 | 164 | ||
159 | 165 | ||
166 | 172 | ||
167 | 173 | ||
168 | 174 | @Callable(i) | |
169 | - | func | |
170 | - | let | |
171 | - | [StringEntry(k_ | |
175 | + | func setVaultAddress (_vaultAddress) = valueOrElse(isAdmin(i), { | |
176 | + | let exchangeAddress = getAddressIfValid(_vaultAddress) | |
177 | + | [StringEntry(k_vault_address, _vaultAddress)] | |
172 | 178 | }) | |
173 | 179 | ||
174 | 180 | ||
175 | 181 | ||
176 | 182 | @Callable(i) | |
177 | - | func setExchangeAddress (_exchangeAddress) = valueOrElse(isAdmin(i), { | |
178 | - | let exchangeAddress = getAddressIfValid(_exchangeAddress) | |
179 | - | [StringEntry(k_exchange_address, _exchangeAddress)] | |
180 | - | }) | |
181 | - | ||
182 | - | ||
183 | - | ||
184 | - | @Callable(i) | |
185 | - | func setVaultAddress (_vaultAddress) = valueOrElse(isAdmin(i), { | |
186 | - | let exchangeAddress = getAddressIfValid(_vaultAddress) | |
187 | - | [StringEntry(k_vault_address, _vaultAddress)] | |
183 | + | func addChild (_childAddress) = valueOrElse(isAdmin(i), { | |
184 | + | let childAddress = getAddressIfValid(_childAddress) | |
185 | + | [BooleanEntry(toCompositeKey(k_child, _childAddress), true)] | |
188 | 186 | }) | |
189 | 187 | ||
190 | 188 | ||
217 | 215 | ||
218 | 216 | ||
219 | 217 | @Verifier(tx) | |
220 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
218 | + | func verify () = match getString(this, k_admin_address) { | |
219 | + | case verifier: String => | |
220 | + | valueOrElse(getBoolean(addressFromStringValue(verifier), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
221 | + | case _ => | |
222 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
223 | + | } | |
221 | 224 |
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_vault_address = "k_vault_address" | |
7 | 7 | ||
8 | 8 | let k_admin_address = "k_admin_address" | |
9 | 9 | ||
10 | - | let k_admin_public_key = "k_admin_public_key" | |
11 | - | ||
12 | 10 | let k_quote_asset = "k_quote_asset" | |
13 | 11 | ||
14 | - | let k_quote_staking = "k_quote_staking" | |
12 | + | let k_reward_asset = "k_reward_asset" | |
13 | + | ||
14 | + | let k_swap_address = "k_swap_address" | |
15 | 15 | ||
16 | 16 | let k_staking_address = "k_staking_address" | |
17 | 17 | ||
18 | 18 | let k_farming_address = "k_farming_address" | |
19 | 19 | ||
20 | 20 | let k_prizes_address = "k_prizes_address" | |
21 | 21 | ||
22 | 22 | let k_housekeeper_address = "k_housekeeper_address" | |
23 | 23 | ||
24 | 24 | let k_amm = "k_amm" | |
25 | 25 | ||
26 | 26 | let k_amm_data = "k_amm_data" | |
27 | 27 | ||
28 | 28 | let k_governance_asset = "k_gov_asset" | |
29 | 29 | ||
30 | 30 | let k_miner_address = "k_miner_address" | |
31 | 31 | ||
32 | 32 | let k_orders_address = "k_orders_address" | |
33 | 33 | ||
34 | 34 | let k_referral_address = "k_referral_address" | |
35 | 35 | ||
36 | 36 | let k_manager_address = "k_manager_address" | |
37 | 37 | ||
38 | 38 | let k_nft_manager_address = "k_nft_manager_address" | |
39 | 39 | ||
40 | - | let k_collateral_address = "k_collateral_address" | |
41 | - | ||
42 | - | let k_exchange_address = "k_exchange_address" | |
40 | + | let k_child = "k_child" | |
43 | 41 | ||
44 | 42 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
45 | 43 | ||
46 | 44 | ||
47 | 45 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
48 | - | ||
49 | - | ||
50 | - | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
51 | 46 | ||
52 | 47 | ||
53 | 48 | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
54 | 49 | ||
55 | 50 | ||
56 | 51 | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
57 | 52 | ||
58 | 53 | ||
59 | - | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
54 | + | func isNoAdminOrAdmin (i) = if (if (if (isNoAdmin()) | |
55 | + | then (i.caller == this) | |
56 | + | else false) | |
60 | 57 | then true | |
61 | 58 | else (i.caller == admin())) | |
62 | 59 | then unit | |
63 | 60 | else throw("Only the Admin itself can invoke this function") | |
64 | 61 | ||
65 | 62 | ||
66 | 63 | func isAdmin (i) = if ((i.caller == admin())) | |
67 | 64 | then unit | |
68 | 65 | else throw("Only the Admin itself can invoke this function") | |
69 | 66 | ||
70 | 67 | ||
71 | 68 | @Callable(i) | |
72 | - | func setAdmin (_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
73 | - | let bytes = fromBase58String(_adminPublicKey) | |
74 | - | let address = addressFromPublicKey(bytes) | |
75 | - | [StringEntry(k_admin_address, toString(address)), StringEntry(k_admin_public_key, _adminPublicKey)] | |
69 | + | func setAdmin (_adminAddress) = valueOrElse(isNoAdminOrAdmin(i), { | |
70 | + | let address = addressFromStringValue(_adminAddress) | |
71 | + | [StringEntry(k_admin_address, toString(address))] | |
76 | 72 | }) | |
77 | 73 | ||
78 | 74 | ||
79 | 75 | ||
80 | 76 | @Callable(i) | |
81 | 77 | func setInsuranceFund (_insuranceFund) = valueOrElse(isAdmin(i), { | |
82 | 78 | let address = getAddressIfValid(_insuranceFund) | |
83 | 79 | [StringEntry(k_insurance_address, address)] | |
84 | 80 | }) | |
85 | 81 | ||
86 | 82 | ||
87 | 83 | ||
88 | 84 | @Callable(i) | |
89 | 85 | func setLiquidityMiner (_liquidityMiner) = valueOrElse(isAdmin(i), { | |
90 | 86 | let address = getAddressIfValid(_liquidityMiner) | |
91 | 87 | [StringEntry(k_miner_address, address)] | |
92 | 88 | }) | |
93 | 89 | ||
94 | 90 | ||
95 | 91 | ||
96 | 92 | @Callable(i) | |
97 | 93 | func setOrders (_orders) = valueOrElse(isAdmin(i), { | |
98 | 94 | let address = getAddressIfValid(_orders) | |
99 | 95 | [StringEntry(k_orders_address, address)] | |
100 | 96 | }) | |
101 | 97 | ||
102 | 98 | ||
103 | 99 | ||
104 | 100 | @Callable(i) | |
105 | 101 | func setReferral (_referral) = valueOrElse(isAdmin(i), { | |
106 | 102 | let address = getAddressIfValid(_referral) | |
107 | 103 | [StringEntry(k_referral_address, address)] | |
108 | 104 | }) | |
109 | 105 | ||
110 | 106 | ||
111 | 107 | ||
112 | 108 | @Callable(i) | |
113 | 109 | func setFarming (_farming) = valueOrElse(isAdmin(i), { | |
114 | 110 | let address = getAddressIfValid(_farming) | |
115 | 111 | [StringEntry(k_farming_address, address)] | |
116 | 112 | }) | |
117 | 113 | ||
118 | 114 | ||
119 | 115 | ||
120 | 116 | @Callable(i) | |
121 | 117 | func setManager (_manager) = valueOrElse(isAdmin(i), { | |
122 | 118 | let address = getAddressIfValid(_manager) | |
123 | 119 | [StringEntry(k_manager_address, address)] | |
124 | 120 | }) | |
125 | 121 | ||
126 | 122 | ||
127 | 123 | ||
128 | 124 | @Callable(i) | |
129 | 125 | func setHousekeeper (_housekeeper) = valueOrElse(isAdmin(i), { | |
130 | 126 | let address = getAddressIfValid(_housekeeper) | |
131 | 127 | [StringEntry(k_housekeeper_address, address)] | |
132 | 128 | }) | |
133 | 129 | ||
134 | 130 | ||
135 | 131 | ||
136 | 132 | @Callable(i) | |
137 | 133 | func setPrizes (_prizes) = valueOrElse(isAdmin(i), { | |
138 | 134 | let address = getAddressIfValid(_prizes) | |
139 | 135 | [StringEntry(k_prizes_address, address)] | |
140 | 136 | }) | |
141 | 137 | ||
142 | 138 | ||
143 | 139 | ||
144 | 140 | @Callable(i) | |
145 | 141 | func setNftManager (_nftManager) = valueOrElse(isAdmin(i), { | |
146 | 142 | let address = getAddressIfValid(_nftManager) | |
147 | 143 | [StringEntry(k_nft_manager_address, address)] | |
148 | 144 | }) | |
149 | 145 | ||
150 | 146 | ||
151 | 147 | ||
152 | 148 | @Callable(i) | |
153 | - | func | |
154 | - | let | |
155 | - | [StringEntry(k_ | |
149 | + | func setSwap (_swap) = valueOrElse(isAdmin(i), { | |
150 | + | let address = getAddressIfValid(_swap) | |
151 | + | [StringEntry(k_swap_address, address)] | |
156 | 152 | }) | |
153 | + | ||
154 | + | ||
155 | + | ||
156 | + | @Callable(i) | |
157 | + | func setQuoteAsset (_assetId) = valueOrElse(isAdmin(i), [StringEntry(k_quote_asset, _assetId)]) | |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func setRewardAsset (_assetId) = valueOrElse(isAdmin(i), [StringEntry(k_reward_asset, _assetId)]) | |
157 | 163 | ||
158 | 164 | ||
159 | 165 | ||
160 | 166 | @Callable(i) | |
161 | 167 | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
162 | 168 | let stakingAddress = getAddressIfValid(_stakingAddress) | |
163 | 169 | [StringEntry(k_staking_address, _stakingAddress)] | |
164 | 170 | }) | |
165 | 171 | ||
166 | 172 | ||
167 | 173 | ||
168 | 174 | @Callable(i) | |
169 | - | func | |
170 | - | let | |
171 | - | [StringEntry(k_ | |
175 | + | func setVaultAddress (_vaultAddress) = valueOrElse(isAdmin(i), { | |
176 | + | let exchangeAddress = getAddressIfValid(_vaultAddress) | |
177 | + | [StringEntry(k_vault_address, _vaultAddress)] | |
172 | 178 | }) | |
173 | 179 | ||
174 | 180 | ||
175 | 181 | ||
176 | 182 | @Callable(i) | |
177 | - | func setExchangeAddress (_exchangeAddress) = valueOrElse(isAdmin(i), { | |
178 | - | let exchangeAddress = getAddressIfValid(_exchangeAddress) | |
179 | - | [StringEntry(k_exchange_address, _exchangeAddress)] | |
180 | - | }) | |
181 | - | ||
182 | - | ||
183 | - | ||
184 | - | @Callable(i) | |
185 | - | func setVaultAddress (_vaultAddress) = valueOrElse(isAdmin(i), { | |
186 | - | let exchangeAddress = getAddressIfValid(_vaultAddress) | |
187 | - | [StringEntry(k_vault_address, _vaultAddress)] | |
183 | + | func addChild (_childAddress) = valueOrElse(isAdmin(i), { | |
184 | + | let childAddress = getAddressIfValid(_childAddress) | |
185 | + | [BooleanEntry(toCompositeKey(k_child, _childAddress), true)] | |
188 | 186 | }) | |
189 | 187 | ||
190 | 188 | ||
191 | 189 | ||
192 | 190 | @Callable(i) | |
193 | 191 | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
194 | 192 | let ammAddress = getAddressIfValid(_ammAddress) | |
195 | 193 | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
196 | 194 | }) | |
197 | 195 | ||
198 | 196 | ||
199 | 197 | ||
200 | 198 | @Callable(i) | |
201 | 199 | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
202 | 200 | ||
203 | 201 | ||
204 | 202 | ||
205 | 203 | @Callable(i) | |
206 | 204 | func setGovernanceAsset (_assetId) = valueOrElse(isAdmin(i), { | |
207 | 205 | let assetBytes = fromBase58String(_assetId) | |
208 | 206 | match assetInfo(assetBytes) { | |
209 | 207 | case asset: Asset => | |
210 | 208 | if ((asset.decimals != 8)) | |
211 | 209 | then throw("Invalid asset decimals, should be 8") | |
212 | 210 | else [StringEntry(k_governance_asset, _assetId)] | |
213 | 211 | case _ => | |
214 | 212 | throw("Can't find asset") | |
215 | 213 | } | |
216 | 214 | }) | |
217 | 215 | ||
218 | 216 | ||
219 | 217 | @Verifier(tx) | |
220 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
218 | + | func verify () = match getString(this, k_admin_address) { | |
219 | + | case verifier: String => | |
220 | + | valueOrElse(getBoolean(addressFromStringValue(verifier), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
221 | + | case _ => | |
222 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
223 | + | } | |
221 | 224 |
github/deemru/w8io/169f3d6 45.27 ms ◑