tx · GKcv2oYdn8wCF25xBedSsBRTsuUioj6NnBDzBdMNYQDy 3MxXA443AARoS3rQ9RNdPeBur74yBTCTyxJ: -0.03400000 Waves 2023.02.04 14:52 [2434846] smart account 3MxXA443AARoS3rQ9RNdPeBur74yBTCTyxJ > SELF 0.00000000 Waves
{ "type": 13, "id": "GKcv2oYdn8wCF25xBedSsBRTsuUioj6NnBDzBdMNYQDy", "fee": 3400000, "feeAssetId": null, "timestamp": 1675511550171, "version": 2, "chainId": 84, "sender": "3MxXA443AARoS3rQ9RNdPeBur74yBTCTyxJ", "senderPublicKey": "Dhf95pPhxwKtWsqgf6tyeDW2xpQA7TvM8nTwbwgqKjkd", "proofs": [ "2GWxi5RwFrzxxBZDUaXdPUzXH46Y8h1jbikvkNdz6YHbQEKSSg3Bv8PRBGgYwT8ULor4MpnREW5Zw6ZrKMQkhVQM" ], "script": "base64:BgJeCAISAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIEgMKAQgSAwoBCBIDCgEIEgQKAggIEgMKAQgSAwoBCBkAE2tfaW5zdXJhbmNlX2FkZHJlc3MCE2tfaW5zdXJhbmNlX2FkZHJlc3MAD2tfdmF1bHRfYWRkcmVzcwIPa192YXVsdF9hZGRyZXNzAA9rX2FkbWluX2FkZHJlc3MCD2tfYWRtaW5fYWRkcmVzcwANa19xdW90ZV9hc3NldAINa19xdW90ZV9hc3NldAAPa19xdW90ZV9zdGFraW5nAg9rX3F1b3RlX3N0YWtpbmcAEWtfc3Rha2luZ19hZGRyZXNzAhFrX3N0YWtpbmdfYWRkcmVzcwARa19mYXJtaW5nX2FkZHJlc3MCEWtfZmFybWluZ19hZGRyZXNzABBrX3ByaXplc19hZGRyZXNzAhBrX3ByaXplc19hZGRyZXNzABVrX2hvdXNla2VlcGVyX2FkZHJlc3MCFWtfaG91c2VrZWVwZXJfYWRkcmVzcwAFa19hbW0CBWtfYW1tAAprX2F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IBQVhc3NldAhkZWNpbWFscwAICQACAQIjSW52YWxpZCBhc3NldCBkZWNpbWFscywgc2hvdWxkIGJlIDgJAMwIAgkBC1N0cmluZ0VudHJ5AgUSa19nb3Zlcm5hbmNlX2Fzc2V0BQhfYXNzZXRJZAUDbmlsCQACAQIQQ2FuJ3QgZmluZCBhc3NldAECdHgBBnZlcmlmeQAEByRtYXRjaDAJAJ0IAgUEdGhpcwUPa19hZG1pbl9hZGRyZXNzAwkAAQIFByRtYXRjaDACBlN0cmluZwQIdmVyaWZpZXIFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIdmVyaWZpZXIJAKwCAgkArAICCQCsAgICB3N0YXR1c18JAKUIAQUEdGhpcwIBXwkA2AQBCAUCdHgCaWQHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V55dUkTQ==", "height": 2434846, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FR9hkoL5DYtMkN9PmCmvHF2wymRKksghPECaUoje9zQS Next: Gq3wnqz1kuA29QcKk11eXYWU9X7NFgExjmPDNWj5ptTA Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let k_vault_address = "k_vault_address" | |
7 | 7 | ||
8 | 8 | let k_admin_address = "k_admin_address" | |
9 | - | ||
10 | - | let k_admin_public_key = "k_admin_public_key" | |
11 | 9 | ||
12 | 10 | let k_quote_asset = "k_quote_asset" | |
13 | 11 | ||
47 | 45 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
48 | 46 | ||
49 | 47 | ||
50 | - | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
51 | - | ||
52 | - | ||
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 | |
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 | ||
217 | 213 | ||
218 | 214 | ||
219 | 215 | @Verifier(tx) | |
220 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
216 | + | func verify () = match getString(this, k_admin_address) { | |
217 | + | case verifier: String => | |
218 | + | valueOrElse(getBoolean(addressFromStringValue(verifier), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
219 | + | case _ => | |
220 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
221 | + | } | |
221 | 222 |
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 | - | ||
10 | - | let k_admin_public_key = "k_admin_public_key" | |
11 | 9 | ||
12 | 10 | let k_quote_asset = "k_quote_asset" | |
13 | 11 | ||
14 | 12 | let k_quote_staking = "k_quote_staking" | |
15 | 13 | ||
16 | 14 | let k_staking_address = "k_staking_address" | |
17 | 15 | ||
18 | 16 | let k_farming_address = "k_farming_address" | |
19 | 17 | ||
20 | 18 | let k_prizes_address = "k_prizes_address" | |
21 | 19 | ||
22 | 20 | let k_housekeeper_address = "k_housekeeper_address" | |
23 | 21 | ||
24 | 22 | let k_amm = "k_amm" | |
25 | 23 | ||
26 | 24 | let k_amm_data = "k_amm_data" | |
27 | 25 | ||
28 | 26 | let k_governance_asset = "k_gov_asset" | |
29 | 27 | ||
30 | 28 | let k_miner_address = "k_miner_address" | |
31 | 29 | ||
32 | 30 | let k_orders_address = "k_orders_address" | |
33 | 31 | ||
34 | 32 | let k_referral_address = "k_referral_address" | |
35 | 33 | ||
36 | 34 | let k_manager_address = "k_manager_address" | |
37 | 35 | ||
38 | 36 | let k_nft_manager_address = "k_nft_manager_address" | |
39 | 37 | ||
40 | 38 | let k_collateral_address = "k_collateral_address" | |
41 | 39 | ||
42 | 40 | let k_exchange_address = "k_exchange_address" | |
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 | 46 | ||
49 | 47 | ||
50 | - | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
51 | - | ||
52 | - | ||
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 | 149 | func setQuoteAsset (_assetId,_stakingAddress) = valueOrElse(isAdmin(i), { | |
154 | 150 | let stakingAddress = getAddressIfValid(_stakingAddress) | |
155 | 151 | [StringEntry(k_quote_asset, _assetId), StringEntry(k_quote_staking, _stakingAddress)] | |
156 | 152 | }) | |
157 | 153 | ||
158 | 154 | ||
159 | 155 | ||
160 | 156 | @Callable(i) | |
161 | 157 | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
162 | 158 | let stakingAddress = getAddressIfValid(_stakingAddress) | |
163 | 159 | [StringEntry(k_staking_address, _stakingAddress)] | |
164 | 160 | }) | |
165 | 161 | ||
166 | 162 | ||
167 | 163 | ||
168 | 164 | @Callable(i) | |
169 | 165 | func setCollateralAddress (_collateralAddress) = valueOrElse(isAdmin(i), { | |
170 | 166 | let collateralAddress = getAddressIfValid(_collateralAddress) | |
171 | 167 | [StringEntry(k_collateral_address, _collateralAddress)] | |
172 | 168 | }) | |
173 | 169 | ||
174 | 170 | ||
175 | 171 | ||
176 | 172 | @Callable(i) | |
177 | 173 | func setExchangeAddress (_exchangeAddress) = valueOrElse(isAdmin(i), { | |
178 | 174 | let exchangeAddress = getAddressIfValid(_exchangeAddress) | |
179 | 175 | [StringEntry(k_exchange_address, _exchangeAddress)] | |
180 | 176 | }) | |
181 | 177 | ||
182 | 178 | ||
183 | 179 | ||
184 | 180 | @Callable(i) | |
185 | 181 | func setVaultAddress (_vaultAddress) = valueOrElse(isAdmin(i), { | |
186 | 182 | let exchangeAddress = getAddressIfValid(_vaultAddress) | |
187 | 183 | [StringEntry(k_vault_address, _vaultAddress)] | |
188 | 184 | }) | |
189 | 185 | ||
190 | 186 | ||
191 | 187 | ||
192 | 188 | @Callable(i) | |
193 | 189 | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
194 | 190 | let ammAddress = getAddressIfValid(_ammAddress) | |
195 | 191 | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
196 | 192 | }) | |
197 | 193 | ||
198 | 194 | ||
199 | 195 | ||
200 | 196 | @Callable(i) | |
201 | 197 | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
202 | 198 | ||
203 | 199 | ||
204 | 200 | ||
205 | 201 | @Callable(i) | |
206 | 202 | func setGovernanceAsset (_assetId) = valueOrElse(isAdmin(i), { | |
207 | 203 | let assetBytes = fromBase58String(_assetId) | |
208 | 204 | match assetInfo(assetBytes) { | |
209 | 205 | case asset: Asset => | |
210 | 206 | if ((asset.decimals != 8)) | |
211 | 207 | then throw("Invalid asset decimals, should be 8") | |
212 | 208 | else [StringEntry(k_governance_asset, _assetId)] | |
213 | 209 | case _ => | |
214 | 210 | throw("Can't find asset") | |
215 | 211 | } | |
216 | 212 | }) | |
217 | 213 | ||
218 | 214 | ||
219 | 215 | @Verifier(tx) | |
220 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
216 | + | func verify () = match getString(this, k_admin_address) { | |
217 | + | case verifier: String => | |
218 | + | valueOrElse(getBoolean(addressFromStringValue(verifier), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
219 | + | case _ => | |
220 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
221 | + | } | |
221 | 222 |
github/deemru/w8io/026f985 54.30 ms ◑