tx · 3YzZr6vnD6D7LZ1t4ih11zb7Q8h7BMZRAea5C9Rs68PJ 3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh: -0.01600000 Waves 2022.07.29 10:51 [2160832] smart account 3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh > SELF 0.00000000 Waves
{ "type": 13, "id": "3YzZr6vnD6D7LZ1t4ih11zb7Q8h7BMZRAea5C9Rs68PJ", "fee": 1600000, "feeAssetId": null, "timestamp": 1659081170054, "version": 1, "sender": "3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh", "senderPublicKey": "33fpjdpM9FMu87RZKePniPardKqQXM96sm7VhAk3JEVQ", "proofs": [ "4GpMDwu8zz7NGExyMXuzegJjCPiBqYEZASiKC2at5TzpVsCmKBrU9b7HK2j8kAiH9wsQYNjsn7Yf7QoT7uiRYpGB" ], "script": "base64:BgIzCAISBgoECAgICBIGCgQICAgCEgUKAwgIBBIGCgQICAEBEgMKAQgSBAoCCAgSAwoBCBIAFwAJc2VwYXJhdG9yAgJfXwATa2V5QmFja2VuZFB1YmxpY0tleQkAuQkCCQDMCAICAiVzCQDMCAICEGJhY2tlbmRQdWJsaWNLZXkFA25pbAUJc2VwYXJhdG9yARtrZXlFeGlzdHNSZWZlcnJlclRvUmVmZXJyYWwDC3Byb2dyYW1OYW1lD3JlZmVycmVyQWRkcmVzcw9yZWZlcnJhbEFkZHJlc3MJALkJAgkAzAgCAgglcyVzJXMlcwkAzAgCAhhleGlzdHNSZWZlcnJlclRvUmVmZXJyYWwJAMwIAgULcHJvZ3JhbU5hbWUJAMwIAgUPcmVmZXJyZXJBZGRyZXNzCQDMCAIFD3JlZmVycmFsQWRkcmVzcwUDbmlsBQlzZXBhcmF0b3IBCmtleUNsYWltZWQCC3Byb2dyYW1OYW1lDmNsYWltZXJBZGRyZXNzCQC5CQIJAMwIAgIIJXMlcyVzJXMJAMwIAgIHY2xhaW1lZAkAzAgCBQtwcm9ncmFtTmFtZQkAzA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m90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABA90YXJnZXRQdWJsaWNLZXkEByRtYXRjaDAJARZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXmSdaE+", "chainId": 84, "height": 2160832, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Eav31zkrUGEnpbGEEGBSVks1QwMtRLDaPsqX1PcZ9Krr Next: GsS7t7aBcAqRaMLwTKj3TdyDCzqF3Suqix8h4bMpN1LZ Diff:
Old | New | Differences | |
---|---|---|---|
137 | 137 | else throwErr("program does not exist") | |
138 | 138 | if ((checkProgramExists == checkProgramExists)) | |
139 | 139 | then { | |
140 | - | let pairReferrerToReferralExistCheck = if (( | |
140 | + | let pairReferrerToReferralExistCheck = if ((getBoolean(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress)) == unit)) | |
141 | 141 | then true | |
142 | 142 | else throwErr("pair already exists") | |
143 | 143 | if ((pairReferrerToReferralExistCheck == pairReferrerToReferralExistCheck)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let keyBackendPublicKey = makeString(["%s", "backendPublicKey"], separator) | |
7 | 7 | ||
8 | 8 | func keyExistsReferrerToReferral (programName,referrerAddress,referralAddress) = makeString(["%s%s%s%s", "existsReferrerToReferral", programName, referrerAddress, referralAddress], separator) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func keyClaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "claimed", programName, claimerAddress], separator) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyUnclaimed (programName,claimerAddress) = makeString(["%s%s%s%s", "unclaimed", programName, claimerAddress], separator) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyReferrer (programName,referralAddress) = makeString(["%s%s%s", "referrer", programName, referralAddress], separator) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyProgramName (programName) = makeString(["%s%s", "programName", programName], separator) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyTotalReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "totalReferralCount", programName, referrerAddress], separator) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func keyActiveReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "activeReferralCount", programName, referrerAddress], separator) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyIsReferralActive (programName,referralAddress) = makeString(["%s%s%s", "activeReferral", programName, referralAddress], separator) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keyClaimedTotal (programName) = makeString(["%s%s", "claimedTotal", programName], separator) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyRewardsTotal (programName) = makeString(["%s%s", "rewardsTotal", programName], separator) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyRewardAssetId (programName) = makeString(["%s%s", "rewardAssetId", programName], separator) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyTreasuryContract (programName) = makeString(["%s%s", "treasuryContract", programName], separator) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyImplementationContract (programName) = makeString(["%s%s", "implementationContract", programName], separator) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func keyClaimHistory (programName,userAddress,transactionId) = makeString(["%s%s%s%s%s", "history", "claim", programName, userAddress, transactionId], separator) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func formatClaimHistory (amount) = makeString(["%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], separator) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func throwErr (msg) = throw(makeString(["referral.ride:", msg], " ")) | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
63 | 63 | case s: String => | |
64 | 64 | fromBase58String(s) | |
65 | 65 | case _: Unit => | |
66 | 66 | unit | |
67 | 67 | case _ => | |
68 | 68 | throw("Match error") | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
73 | 73 | case s: String => | |
74 | 74 | fromBase58String(s) | |
75 | 75 | case _: Unit => | |
76 | 76 | unit | |
77 | 77 | case _ => | |
78 | 78 | throw("Match error") | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func mustManager (i) = { | |
83 | 83 | let pd = throwErr("permission denied") | |
84 | 84 | match managerPublicKeyOrUnit() { | |
85 | 85 | case pk: ByteVector => | |
86 | 86 | if ((i.callerPublicKey == pk)) | |
87 | 87 | then true | |
88 | 88 | else pd | |
89 | 89 | case _: Unit => | |
90 | 90 | if ((i.caller == this)) | |
91 | 91 | then true | |
92 | 92 | else pd | |
93 | 93 | case _ => | |
94 | 94 | throw("Match error") | |
95 | 95 | } | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func createReferralProgram (programName,treasuryContract,implementationContract,rewardAssetId) = { | |
101 | 101 | let checkCaller = mustManager(i) | |
102 | 102 | if ((checkCaller == checkCaller)) | |
103 | 103 | then { | |
104 | 104 | let checkProgramName = if ((getBoolean(keyProgramName(programName)) == unit)) | |
105 | 105 | then true | |
106 | 106 | else throwErr("program name already exists") | |
107 | 107 | if ((checkProgramName == checkProgramName)) | |
108 | 108 | then { | |
109 | 109 | let programNameIsValid = if (!(contains(programName, separator))) | |
110 | 110 | then !(contains(programName, " ")) | |
111 | 111 | else false | |
112 | 112 | let checkProgramExists = if (programNameIsValid) | |
113 | 113 | then true | |
114 | 114 | else throwErr("invalid program name") | |
115 | 115 | if ((checkProgramExists == checkProgramExists)) | |
116 | 116 | then { | |
117 | 117 | let checkRewardAsset = if ((assetInfo(fromBase58String(rewardAssetId)) != unit)) | |
118 | 118 | then true | |
119 | 119 | else throwErr("invalid reward asset id") | |
120 | 120 | if ((checkRewardAsset == checkRewardAsset)) | |
121 | 121 | then $Tuple2([BooleanEntry(keyProgramName(programName), true), StringEntry(keyTreasuryContract(programName), treasuryContract), StringEntry(keyImplementationContract(programName), implementationContract), StringEntry(keyRewardAssetId(programName), rewardAssetId), IntegerEntry(keyRewardsTotal(programName), 0)], unit) | |
122 | 122 | else throw("Strict value is not equal to itself.") | |
123 | 123 | } | |
124 | 124 | else throw("Strict value is not equal to itself.") | |
125 | 125 | } | |
126 | 126 | else throw("Strict value is not equal to itself.") | |
127 | 127 | } | |
128 | 128 | else throw("Strict value is not equal to itself.") | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | 134 | func createPair (programName,referrerAddress,referralAddress,signature) = { | |
135 | 135 | let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false)) | |
136 | 136 | then true | |
137 | 137 | else throwErr("program does not exist") | |
138 | 138 | if ((checkProgramExists == checkProgramExists)) | |
139 | 139 | then { | |
140 | - | let pairReferrerToReferralExistCheck = if (( | |
140 | + | let pairReferrerToReferralExistCheck = if ((getBoolean(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress)) == unit)) | |
141 | 141 | then true | |
142 | 142 | else throwErr("pair already exists") | |
143 | 143 | if ((pairReferrerToReferralExistCheck == pairReferrerToReferralExistCheck)) | |
144 | 144 | then { | |
145 | 145 | let noRefSelf = if ((referrerAddress != referralAddress)) | |
146 | 146 | then true | |
147 | 147 | else throwErr("cannot refer to self") | |
148 | 148 | if ((noRefSelf == noRefSelf)) | |
149 | 149 | then { | |
150 | 150 | let pair = toBytes(makeString([programName, referrerAddress, referralAddress], ":")) | |
151 | 151 | let backendPublicKey = fromBase58String(value(getString(keyBackendPublicKey))) | |
152 | 152 | let validateSignature = if (sigVerify(pair, signature, backendPublicKey)) | |
153 | 153 | then true | |
154 | 154 | else throwErr("bad signature") | |
155 | 155 | if ((validateSignature == validateSignature)) | |
156 | 156 | then { | |
157 | 157 | let totalReferralCount = valueOrElse(getInteger(keyTotalReferralCount(programName, referrerAddress)), 0) | |
158 | 158 | let newTotalReferralCount = (totalReferralCount + 1) | |
159 | 159 | $Tuple2([BooleanEntry(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress), true), IntegerEntry(keyTotalReferralCount(programName, referrerAddress), newTotalReferralCount), StringEntry(keyReferrer(programName, referralAddress), referrerAddress)], unit) | |
160 | 160 | } | |
161 | 161 | else throw("Strict value is not equal to itself.") | |
162 | 162 | } | |
163 | 163 | else throw("Strict value is not equal to itself.") | |
164 | 164 | } | |
165 | 165 | else throw("Strict value is not equal to itself.") | |
166 | 166 | } | |
167 | 167 | else throw("Strict value is not equal to itself.") | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | ||
172 | 172 | @Callable(i) | |
173 | 173 | func updateReferralActivity (programName,referralAddress,isActive) = { | |
174 | 174 | let implementationContract = value(getString(keyImplementationContract(programName))) | |
175 | 175 | let isReferralActive = (getBoolean(keyIsReferralActive(programName, referralAddress)) != unit) | |
176 | 176 | let referrerAddress = value(getString(keyReferrer(programName, referralAddress))) | |
177 | 177 | let checkCaller = if ((toString(i.caller) == implementationContract)) | |
178 | 178 | then true | |
179 | 179 | else throwErr("permission denied") | |
180 | 180 | if ((checkCaller == checkCaller)) | |
181 | 181 | then { | |
182 | 182 | let update = if ((isReferralActive == isActive)) | |
183 | 183 | then $Tuple2(nil, unit) | |
184 | 184 | else { | |
185 | 185 | let update = if ((isActive == true)) | |
186 | 186 | then { | |
187 | 187 | let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) + 1) | |
188 | 188 | $Tuple2([BooleanEntry(keyIsReferralActive(programName, referralAddress), true), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit) | |
189 | 189 | } | |
190 | 190 | else { | |
191 | 191 | let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) - 1) | |
192 | 192 | $Tuple2([DeleteEntry(keyIsReferralActive(programName, referralAddress)), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit) | |
193 | 193 | } | |
194 | 194 | update | |
195 | 195 | } | |
196 | 196 | update | |
197 | 197 | } | |
198 | 198 | else throw("Strict value is not equal to itself.") | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | ||
203 | 203 | @Callable(i) | |
204 | 204 | func incUnclaimed (programName,referralAddress,referrerReward,referralReward) = { | |
205 | 205 | let implementationContract = value(getString(keyImplementationContract(programName))) | |
206 | 206 | let checkCaller = if ((toString(i.caller) == implementationContract)) | |
207 | 207 | then true | |
208 | 208 | else throwErr("permission denied") | |
209 | 209 | if ((checkCaller == checkCaller)) | |
210 | 210 | then { | |
211 | 211 | let referrerAddress = value(getString(keyReferrer(programName, referralAddress))) | |
212 | 212 | let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referrerAddress)), 0) | |
213 | 213 | let referralUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, referralAddress)), 0) | |
214 | 214 | let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0) | |
215 | 215 | let newReferrerUnclaimed = (referrerUnclaimed + referrerReward) | |
216 | 216 | let newReferralUnclaimed = (referralUnclaimed + referralReward) | |
217 | 217 | $Tuple2([IntegerEntry(keyUnclaimed(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimed(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit) | |
218 | 218 | } | |
219 | 219 | else throw("Strict value is not equal to itself.") | |
220 | 220 | } | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | ||
224 | 224 | @Callable(i) | |
225 | 225 | func claim (programName) = { | |
226 | 226 | let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false)) | |
227 | 227 | then true | |
228 | 228 | else throwErr("program does not exist") | |
229 | 229 | if ((checkProgramExists == checkProgramExists)) | |
230 | 230 | then { | |
231 | 231 | let userAddressStr = toString(i.caller) | |
232 | 232 | let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0) | |
233 | 233 | let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddressStr)), 0) | |
234 | 234 | let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddressStr)), 0) | |
235 | 235 | let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName))))) | |
236 | 236 | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
237 | 237 | let checkCanClaim = if ((claimerUnclaimed > 0)) | |
238 | 238 | then true | |
239 | 239 | else throwErr("nothing to claim") | |
240 | 240 | if ((checkCanClaim == checkCanClaim)) | |
241 | 241 | then { | |
242 | 242 | let newClaimerClaimed = (claimerClaimed + claimerUnclaimed) | |
243 | 243 | let newClaimedTotal = (claimedTotal + claimerUnclaimed) | |
244 | 244 | let balanceBefore = value(assetBalance(this, rewardAssetId)) | |
245 | 245 | if ((balanceBefore == balanceBefore)) | |
246 | 246 | then { | |
247 | 247 | let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil) | |
248 | 248 | if ((res == res)) | |
249 | 249 | then { | |
250 | 250 | let balanceAfter = value(assetBalance(this, rewardAssetId)) | |
251 | 251 | if ((balanceAfter == balanceAfter)) | |
252 | 252 | then { | |
253 | 253 | let balanceDiff = (balanceAfter - balanceBefore) | |
254 | 254 | if ((balanceDiff == balanceDiff)) | |
255 | 255 | then { | |
256 | 256 | let checkBalance = if ((balanceDiff == claimerUnclaimed)) | |
257 | 257 | then true | |
258 | 258 | else throwErr("insufficient balance on referral contract") | |
259 | 259 | if ((checkBalance == checkBalance)) | |
260 | 260 | then $Tuple2([IntegerEntry(keyClaimed(programName, userAddressStr), newClaimerClaimed), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyUnclaimed(programName, userAddressStr), 0), ScriptTransfer(i.caller, claimerUnclaimed, rewardAssetId), StringEntry(keyClaimHistory(programName, userAddressStr, toBase58String(i.transactionId)), formatClaimHistory(claimerUnclaimed))], unit) | |
261 | 261 | else throw("Strict value is not equal to itself.") | |
262 | 262 | } | |
263 | 263 | else throw("Strict value is not equal to itself.") | |
264 | 264 | } | |
265 | 265 | else throw("Strict value is not equal to itself.") | |
266 | 266 | } | |
267 | 267 | else throw("Strict value is not equal to itself.") | |
268 | 268 | } | |
269 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 270 | } | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | else throw("Strict value is not equal to itself.") | |
274 | 274 | } | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | ||
278 | 278 | @Callable(i) | |
279 | 279 | func claimREADONLY (programName,userAddress) = { | |
280 | 280 | let claimerClaimed = valueOrElse(getInteger(keyClaimed(programName, userAddress)), 0) | |
281 | 281 | let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimed(programName, userAddress)), 0) | |
282 | 282 | $Tuple2(nil, [claimerUnclaimed, claimerClaimed]) | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | ||
287 | 287 | @Callable(i) | |
288 | 288 | func setManager (pendingManagerPublicKey) = { | |
289 | 289 | let checkCaller = mustManager(i) | |
290 | 290 | if ((checkCaller == checkCaller)) | |
291 | 291 | then { | |
292 | 292 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
293 | 293 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
294 | 294 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
295 | 295 | else throw("Strict value is not equal to itself.") | |
296 | 296 | } | |
297 | 297 | else throw("Strict value is not equal to itself.") | |
298 | 298 | } | |
299 | 299 | ||
300 | 300 | ||
301 | 301 | ||
302 | 302 | @Callable(i) | |
303 | 303 | func confirmManager () = { | |
304 | 304 | let pm = pendingManagerPublicKeyOrUnit() | |
305 | 305 | let hasPM = if (isDefined(pm)) | |
306 | 306 | then true | |
307 | 307 | else throwErr("no pending manager") | |
308 | 308 | if ((hasPM == hasPM)) | |
309 | 309 | then { | |
310 | 310 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
311 | 311 | then true | |
312 | 312 | else throwErr("you are not pending manager") | |
313 | 313 | if ((checkPM == checkPM)) | |
314 | 314 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
315 | 315 | else throw("Strict value is not equal to itself.") | |
316 | 316 | } | |
317 | 317 | else throw("Strict value is not equal to itself.") | |
318 | 318 | } | |
319 | 319 | ||
320 | 320 | ||
321 | 321 | @Verifier(tx) | |
322 | 322 | func verify () = { | |
323 | 323 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
324 | 324 | case pk: ByteVector => | |
325 | 325 | pk | |
326 | 326 | case _: Unit => | |
327 | 327 | tx.senderPublicKey | |
328 | 328 | case _ => | |
329 | 329 | throw("Match error") | |
330 | 330 | } | |
331 | 331 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
332 | 332 | } | |
333 | 333 |
github/deemru/w8io/169f3d6 47.37 ms ◑