tx · AYFnp5rYW8kJxTU3XfHTS36TQmnTRmvNWWLoDDyZfUDy 3Mx4GxjrawhKHBgMKH9C5Hmbj8ePZDrs8ed: -0.01400000 Waves 2023.04.18 17:01 [2540073] smart account 3Mx4GxjrawhKHBgMKH9C5Hmbj8ePZDrs8ed > SELF 0.00000000 Waves
{ "type": 13, "id": "AYFnp5rYW8kJxTU3XfHTS36TQmnTRmvNWWLoDDyZfUDy", "fee": 1400000, "feeAssetId": null, "timestamp": 1681826148359, "version": 2, "chainId": 84, "sender": "3Mx4GxjrawhKHBgMKH9C5Hmbj8ePZDrs8ed", "senderPublicKey": "9DpEgmia9fGpxtGGDeSMtER4g9qB7WQPPYTKTHzqSFuX", "proofs": [ "55A3Pkg1sZfrSxfFNUnViscLeULjWRXzFLig9eeKbXoyfXir346B8vEHLivJi9q3H2kn7KvY1vizhDafm2H4krgX" ], "script": "base64:BgJNCAISBgoECAgICBIJCgcICAgICAgIEgUKAwEIARIECgIBCBIDCgEIEgQKAgEEEgMKAQgSCwoJAQgIAQEBAQEEEgASABIDCgEIEgMKAQg7AAlTRVBBUkFUT1ICAl9fAAhLRVlfSU5JVAIESU5JVAAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAApLRVlfUEFVU0VEAgZQQVVTRUQACktFWV9QQVVTRVICBlBBVVNFUgAMS0VZX0VYRUNVVE9SAghFWEVDVVRPUgAQS0VZX1JPT1RfQURBUFRFUgIMUk9PVF9BREFQVEVSABNLRVlfQ0FMTEVSX0NPTlRSQUNUAg9DQUxMRVJfQ09OVFJBQ1QACUtFWV9DSEFJTgIFQ0hBSU4AC0tFWV9CSU5ESU5HAgdCSU5ESU5HAAdLRVlfRkVFAgNGRUUAEUtFWV9GRUVfUkVDSVBJRU5UAg1GRUVfUkVDSVBJRU5UABNGVU5DX1JFTEVBU0VfVE9LRU5TAg1yZWxlYXNlVG9rZW5zAAVXQVZFUwIFV0FWRVMADldBVkVTX0RFQ0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aXplZAAHCQEQX3ZhbGlkYXRlQWRkcmVzcwIFB3BhdXNlcl8CFGluaXQ6IGludmFsaWQgcGF1c2VyBwMJAAACBQNlcnIFA2VycgkAlAoCCQELX3NhdmVQYXVzZXIBCQERQGV4dHJOYXRpdmUoMTA2MikBBQdwYXVzZXJfBQR1bml0CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAWkBC3NldE11bHRpc2lnAQltdWx0aXNpZ18EA2VycgMJARFfb25seVRoaXNDb250cmFjdAEIBQFpBmNhbGxlcgkBEF92YWxpZGF0ZUFkZHJlc3MCBQltdWx0aXNpZ18CHXNldE11bHRpc2lnOiBpbnZhbGlkIG11bHRpc2lnBwMJAAACBQNlcnIFA2VycgkAlAoCCQENX3NhdmVNdWx0aXNpZwEJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCW11bHRpc2lnXwUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAKIIAQUMS0VZX01VTFRJU0lHAwkAAQIFByRtYXRjaDACBlN0cmluZwQIbXVsdGlzaWcFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIbXVsdGlzaWcJALkJAgkAzAgCBQpLRVlfU1RBVFVTCQDMCAIJAKUIAQUEdGhpcwkAzAgCCQDYBAEIBQJ0eAJpZAUDbmlsBQlTRVBBUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5HRbLwQ==", "height": 2540073, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EkmnDMW7YNFu146auHdnCg627annJ8gVjiBk9kdQm5GR Next: 5Z1JkyR2dz4cb2Dj5tp9UrMtWcPMpuen9D5L3xvJzgxu Diff:
Old | New | Differences | |
---|---|---|---|
395 | 395 | let percent = if ((amount > thresholdFee)) | |
396 | 396 | then afterPercentFee | |
397 | 397 | else beforePercentFee | |
398 | - | let fee = (minFee + | |
398 | + | let fee = (minFee + fraction(amount, percent, PERCENT_FACTOR)) | |
399 | 399 | let err2 = _validateInt(amount, (fee + 1), MAX_INT, "burn: fee more than amount") | |
400 | 400 | if ((err2 == err2)) | |
401 | 401 | then { | |
425 | 425 | ||
426 | 426 | ||
427 | 427 | @Callable(i) | |
428 | - | func transferFee ( | |
428 | + | func transferFee (executionChainId_,assetId_) = { | |
429 | 429 | let err = if (if (_whenInitialized()) | |
430 | 430 | then _whenNotPaused() | |
431 | 431 | else false) | |
432 | - | then _ | |
432 | + | then _validateAsset(assetId_, "transferFee: invalid asset") | |
433 | 433 | else false | |
434 | 434 | if ((err == err)) | |
435 | 435 | then { | |
436 | - | let assetId = _asBytes(invoke(addressFromStringValue(assetContract_), "getAssetId", nil, nil)) | |
437 | - | if ((assetId == assetId)) | |
436 | + | let assetId = fromBase58String(assetId_) | |
437 | + | let binding = _loadBinding(executionChainId_, assetId) | |
438 | + | let assetContract = binding._1 | |
439 | + | let enabled = binding._8 | |
440 | + | let err1 = if (_validateAddress(toString(assetContract), "transferFee: no such binding")) | |
441 | + | then _validateBool(enabled, true, "transferFee: token is disabled") | |
442 | + | else false | |
443 | + | if ((err1 == err1)) | |
438 | 444 | then $Tuple2((_saveFee(assetId, 0) ++ [ScriptTransfer(_loadFeeRecipient(), _loadFee(assetId), assetId)]), unit) | |
439 | 445 | else throw("Strict value is not equal to itself.") | |
440 | 446 | } |
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 KEY_INIT = "INIT" | |
7 | 7 | ||
8 | 8 | let KEY_MULTISIG = "MULTISIG" | |
9 | 9 | ||
10 | 10 | let KEY_STATUS = "STATUS" | |
11 | 11 | ||
12 | 12 | let KEY_PAUSED = "PAUSED" | |
13 | 13 | ||
14 | 14 | let KEY_PAUSER = "PAUSER" | |
15 | 15 | ||
16 | 16 | let KEY_EXECUTOR = "EXECUTOR" | |
17 | 17 | ||
18 | 18 | let KEY_ROOT_ADAPTER = "ROOT_ADAPTER" | |
19 | 19 | ||
20 | 20 | let KEY_CALLER_CONTRACT = "CALLER_CONTRACT" | |
21 | 21 | ||
22 | 22 | let KEY_CHAIN = "CHAIN" | |
23 | 23 | ||
24 | 24 | let KEY_BINDING = "BINDING" | |
25 | 25 | ||
26 | 26 | let KEY_FEE = "FEE" | |
27 | 27 | ||
28 | 28 | let KEY_FEE_RECIPIENT = "FEE_RECIPIENT" | |
29 | 29 | ||
30 | 30 | let FUNC_RELEASE_TOKENS = "releaseTokens" | |
31 | 31 | ||
32 | 32 | let WAVES = "WAVES" | |
33 | 33 | ||
34 | 34 | let WAVES_DECIMALS = 8 | |
35 | 35 | ||
36 | 36 | let DECIMALS = 6 | |
37 | 37 | ||
38 | 38 | let PERCENT_FACTOR = 1000000 | |
39 | 39 | ||
40 | 40 | let MAX_INT = 9223372036854775807 | |
41 | 41 | ||
42 | 42 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
43 | 43 | case a: Address => | |
44 | 44 | true | |
45 | 45 | case _ => | |
46 | 46 | throw(err_) | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func _validateAsset (assetId_,err_) = match assetInfo(fromBase58String(assetId_)) { | |
51 | 51 | case a: Asset => | |
52 | 52 | true | |
53 | 53 | case _ => | |
54 | 54 | throw(err_) | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
59 | 59 | then true | |
60 | 60 | else (val_ > upperBoundary_)) | |
61 | 61 | then throw(err_) | |
62 | 62 | else true | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func _validateBool (val_,target_,err_) = if ((val_ != target_)) | |
66 | 66 | then throw(err_) | |
67 | 67 | else true | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func _validatePaymentsSize (payments_,target_,err_) = if ((size(payments_) != target_)) | |
71 | 71 | then throw(err_) | |
72 | 72 | else true | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func _normalizeDecimals (amount_,sourceDecimals_,targetDecimals_) = if ((sourceDecimals_ >= targetDecimals_)) | |
76 | 76 | then (amount_ / pow(10, 0, (sourceDecimals_ - targetDecimals_), 0, 0, DOWN)) | |
77 | 77 | else (amount_ * pow(10, 0, (targetDecimals_ - sourceDecimals_), 0, 0, DOWN)) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func _loadInit () = match getBoolean(KEY_INIT) { | |
81 | 81 | case a: Boolean => | |
82 | 82 | a | |
83 | 83 | case _ => | |
84 | 84 | false | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
92 | 92 | case a: Boolean => | |
93 | 93 | a | |
94 | 94 | case _ => | |
95 | 95 | false | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func _loadPauser () = match getString(KEY_PAUSER) { | |
103 | 103 | case a: String => | |
104 | 104 | addressFromStringValue(a) | |
105 | 105 | case _ => | |
106 | 106 | Address(base58'') | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
114 | 114 | case a: String => | |
115 | 115 | addressFromStringValue(a) | |
116 | 116 | case _ => | |
117 | 117 | Address(base58'') | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func _loadExecutor () = match getString(KEY_EXECUTOR) { | |
125 | 125 | case a: String => | |
126 | 126 | addressFromStringValue(a) | |
127 | 127 | case _ => | |
128 | 128 | Address(base58'') | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func _saveExecutor (executor_) = [StringEntry(KEY_EXECUTOR, toString(executor_))] | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func _loadCallerContract () = match getString(KEY_CALLER_CONTRACT) { | |
136 | 136 | case a: String => | |
137 | 137 | a | |
138 | 138 | case _ => | |
139 | 139 | "" | |
140 | 140 | } | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func _saveCallerContract (caller_) = [StringEntry(KEY_CALLER_CONTRACT, caller_)] | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func _loadChain (chainId_) = match getBoolean(makeString([KEY_CHAIN, toString(chainId_)], SEPARATOR)) { | |
147 | 147 | case a: Boolean => | |
148 | 148 | a | |
149 | 149 | case _ => | |
150 | 150 | false | |
151 | 151 | } | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func _saveChain (chainId_,val_) = [BooleanEntry(makeString([KEY_CHAIN, toString(chainId_)], SEPARATOR), val_)] | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func _loadBinding (executionChainId_,assetId_) = match getString(makeString([KEY_BINDING, toString(executionChainId_), toBase58String(assetId_)], SEPARATOR)) { | |
158 | 158 | case a: String => | |
159 | 159 | let struct = split(a, SEPARATOR) | |
160 | 160 | $Tuple8(addressFromStringValue(struct[0]), struct[1], parseIntValue(struct[2]), parseIntValue(struct[3]), parseIntValue(struct[4]), parseIntValue(struct[5]), parseIntValue(struct[6]), if ((struct[7] == "1")) | |
161 | 161 | then true | |
162 | 162 | else false) | |
163 | 163 | case _ => | |
164 | 164 | $Tuple8(Address(base58''), "", 0, 0, 0, 0, 0, false) | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func _saveBinding (executionChainId_,assetId_,binding_) = [StringEntry(makeString([KEY_BINDING, toString(executionChainId_), toBase58String(assetId_)], SEPARATOR), makeString([toString(binding_._1), binding_._2, toString(binding_._3), toString(binding_._4), toString(binding_._5), toString(binding_._6), toString(binding_._7), if (binding_._8) | |
169 | 169 | then "1" | |
170 | 170 | else "0"], SEPARATOR))] | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func _loadFee (assetId_) = match getInteger(makeString([KEY_FEE, toBase58String(assetId_)], SEPARATOR)) { | |
174 | 174 | case a: Int => | |
175 | 175 | a | |
176 | 176 | case _ => | |
177 | 177 | 0 | |
178 | 178 | } | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func _saveFee (assetId_,val_) = [IntegerEntry(makeString([KEY_FEE, toBase58String(assetId_)], SEPARATOR), val_)] | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | func _loadRootAdapter () = match getString(KEY_ROOT_ADAPTER) { | |
185 | 185 | case a: String => | |
186 | 186 | addressFromStringValue(a) | |
187 | 187 | case _ => | |
188 | 188 | Address(base58'') | |
189 | 189 | } | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func _saveRootAdapter (adapter_) = [StringEntry(KEY_ROOT_ADAPTER, toString(adapter_))] | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func _loadFeeRecipient () = match getString(KEY_FEE_RECIPIENT) { | |
196 | 196 | case a: String => | |
197 | 197 | addressFromStringValue(a) | |
198 | 198 | case _ => | |
199 | 199 | Address(base58'') | |
200 | 200 | } | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func _saveFeeRecipient (val_) = [StringEntry(KEY_FEE_RECIPIENT, toString(val_))] | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
207 | 207 | then throw("_onlyThisContract: revert") | |
208 | 208 | else true | |
209 | 209 | ||
210 | 210 | ||
211 | 211 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
212 | 212 | then throw("_whenMultisigSet: revert") | |
213 | 213 | else true | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | func _whenNotInitialized () = if (_loadInit()) | |
217 | 217 | then throw("_whenNotInitialized: revert") | |
218 | 218 | else true | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | func _whenInitialized () = if (!(_loadInit())) | |
222 | 222 | then throw("_whenInitialized: revert") | |
223 | 223 | else true | |
224 | 224 | ||
225 | 225 | ||
226 | 226 | func _whenNotPaused () = if (_loadPause()) | |
227 | 227 | then throw("_whenNotPaused: revert") | |
228 | 228 | else true | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | func _whenPaused () = if (!(_loadPause())) | |
232 | 232 | then throw("_whenPaused: revert") | |
233 | 233 | else true | |
234 | 234 | ||
235 | 235 | ||
236 | 236 | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
237 | 237 | then throw("_onlyPauser: revert") | |
238 | 238 | else true | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | func _asInt (val_) = match val_ { | |
242 | 242 | case a: Int => | |
243 | 243 | a | |
244 | 244 | case _ => | |
245 | 245 | throw("_asInt: revert") | |
246 | 246 | } | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | func _asBytes (val_) = match val_ { | |
250 | 250 | case a: ByteVector => | |
251 | 251 | a | |
252 | 252 | case _ => | |
253 | 253 | throw("_asBytes: revert") | |
254 | 254 | } | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func _validateExecutor (val_,err_) = if ((val_ != _loadExecutor())) | |
258 | 258 | then throw(err_) | |
259 | 259 | else true | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func _validateCaller (val_,err_) = if ((val_ != _loadCallerContract())) | |
263 | 263 | then throw(err_) | |
264 | 264 | else true | |
265 | 265 | ||
266 | 266 | ||
267 | 267 | func _validateChain (executionChainId_,err_) = if (!(_loadChain(executionChainId_))) | |
268 | 268 | then throw(err_) | |
269 | 269 | else true | |
270 | 270 | ||
271 | 271 | ||
272 | 272 | @Callable(i) | |
273 | 273 | func init (executor_,adapter_,pauser_,feeRecipient_) = { | |
274 | 274 | let err = if (if (if (if (if (if (_onlyThisContract(i.caller)) | |
275 | 275 | then _whenNotInitialized() | |
276 | 276 | else false) | |
277 | 277 | then _whenMultisigSet() | |
278 | 278 | else false) | |
279 | 279 | then _validateAddress(executor_, "init: invalid executor") | |
280 | 280 | else false) | |
281 | 281 | then _validateAddress(adapter_, "init: invalid adapter") | |
282 | 282 | else false) | |
283 | 283 | then _validateAddress(pauser_, "init: invalid pauser") | |
284 | 284 | else false) | |
285 | 285 | then _validateAddress(feeRecipient_, "init: invalid feeRecipient") | |
286 | 286 | else false | |
287 | 287 | if ((err == err)) | |
288 | 288 | then $Tuple2(((((_saveInit(true) ++ _saveExecutor(addressFromStringValue(executor_))) ++ _saveRootAdapter(addressFromStringValue(adapter_))) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveFeeRecipient(addressFromStringValue(feeRecipient_))), unit) | |
289 | 289 | else throw("Strict value is not equal to itself.") | |
290 | 290 | } | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | ||
294 | 294 | @Callable(i) | |
295 | 295 | func mintTokens (callerContract_,assetContract_,amount_,recipient_,gaslessReward_,referrer_,referrerFee_) = { | |
296 | 296 | let amount = valueOrErrorMessage(parseInt(amount_), "mint: amount is not Int") | |
297 | 297 | let gaslessReward = valueOrErrorMessage(parseInt(gaslessReward_), "mint: gaslessReward is not Int") | |
298 | 298 | let referrerFee = valueOrErrorMessage(parseInt(referrerFee_), "mint: referrerFee is not Int") | |
299 | 299 | let err = if (if (if (if (if (if (if (if (_whenInitialized()) | |
300 | 300 | then _whenNotPaused() | |
301 | 301 | else false) | |
302 | 302 | then _validateAddress(assetContract_, "mint: invalid asset contract") | |
303 | 303 | else false) | |
304 | 304 | then _validateExecutor(i.caller, "mint: invalid executor") | |
305 | 305 | else false) | |
306 | 306 | then _validateCaller(callerContract_, "mint: invalid caller") | |
307 | 307 | else false) | |
308 | 308 | then _validateAddress(recipient_, "mint: invalid recipient address") | |
309 | 309 | else false) | |
310 | 310 | then _validateInt(amount, 0, MAX_INT, "mint: invalid amount") | |
311 | 311 | else false) | |
312 | 312 | then _validateInt(gaslessReward, 0, MAX_INT, "mint: invalid gaslessReward") | |
313 | 313 | else false) | |
314 | 314 | then _validateInt(referrerFee, 0, MAX_INT, "mint: invalid referrer fee") | |
315 | 315 | else false | |
316 | 316 | if ((err == err)) | |
317 | 317 | then { | |
318 | 318 | let assetId = _asBytes(invoke(addressFromStringValue(assetContract_), "getAssetId", nil, nil)) | |
319 | 319 | if ((assetId == assetId)) | |
320 | 320 | then { | |
321 | 321 | let assetDecimals = _asInt(invoke(addressFromStringValue(assetContract_), "getDecimals", nil, nil)) | |
322 | 322 | if ((assetDecimals == assetDecimals)) | |
323 | 323 | then { | |
324 | 324 | let normalizedAmount = _normalizeDecimals(amount, DECIMALS, assetDecimals) | |
325 | 325 | let normalizedGasless = _normalizeDecimals(gaslessReward, DECIMALS, assetDecimals) | |
326 | 326 | let referrer = match addressFromString(referrer_) { | |
327 | 327 | case refererAddress: Address => | |
328 | 328 | let normalizedReferrerFee = _normalizeDecimals(referrerFee, DECIMALS, assetDecimals) | |
329 | 329 | $Tuple2(normalizedReferrerFee, [ScriptTransfer(refererAddress, normalizedReferrerFee, assetId)]) | |
330 | 330 | case _ => | |
331 | 331 | $Tuple2(0, nil) | |
332 | 332 | } | |
333 | 333 | let normalizedReferrerFee = referrer._1 | |
334 | 334 | let referrerActions = referrer._2 | |
335 | 335 | let invocation = invoke(addressFromStringValue(assetContract_), "mint", [(normalizedAmount + normalizedReferrerFee), toString(this)], nil) | |
336 | 336 | if ((invocation == invocation)) | |
337 | 337 | then { | |
338 | 338 | let actions = if (if ((normalizedGasless > 0)) | |
339 | 339 | then (addressFromStringValue(recipient_) != i.originCaller) | |
340 | 340 | else false) | |
341 | 341 | then [ScriptTransfer(addressFromStringValue(recipient_), (normalizedAmount - normalizedGasless), assetId), ScriptTransfer(i.originCaller, normalizedGasless, assetId)] | |
342 | 342 | else [ScriptTransfer(addressFromStringValue(recipient_), normalizedAmount, assetId)] | |
343 | 343 | $Tuple2((actions ++ referrerActions), unit) | |
344 | 344 | } | |
345 | 345 | else throw("Strict value is not equal to itself.") | |
346 | 346 | } | |
347 | 347 | else throw("Strict value is not equal to itself.") | |
348 | 348 | } | |
349 | 349 | else throw("Strict value is not equal to itself.") | |
350 | 350 | } | |
351 | 351 | else throw("Strict value is not equal to itself.") | |
352 | 352 | } | |
353 | 353 | ||
354 | 354 | ||
355 | 355 | ||
356 | 356 | @Callable(i) | |
357 | 357 | func burnTokens (executionChainId_,recipient_,gaslessReward_) = { | |
358 | 358 | let err = if (if (if (if (_whenInitialized()) | |
359 | 359 | then _whenNotPaused() | |
360 | 360 | else false) | |
361 | 361 | then _validateChain(executionChainId_, "burn: invalid execution chain") | |
362 | 362 | else false) | |
363 | 363 | then _validatePaymentsSize(i.payments, 1, "burn: no payment") | |
364 | 364 | else false) | |
365 | 365 | then _validateInt(i.payments[0].amount, 0, MAX_INT, "burn: invalid payment amount") | |
366 | 366 | else false | |
367 | 367 | if ((err == err)) | |
368 | 368 | then { | |
369 | 369 | let amount = i.payments[0].amount | |
370 | 370 | let assetId = match i.payments[0].assetId { | |
371 | 371 | case a: ByteVector => | |
372 | 372 | a | |
373 | 373 | case _ => | |
374 | 374 | throw("burn: invalid asset") | |
375 | 375 | } | |
376 | 376 | let binding = _loadBinding(executionChainId_, assetId) | |
377 | 377 | let assetContract = binding._1 | |
378 | 378 | let executionAsset = binding._2 | |
379 | 379 | let minAmount = binding._3 | |
380 | 380 | let minFee = binding._4 | |
381 | 381 | let thresholdFee = binding._5 | |
382 | 382 | let beforePercentFee = binding._6 | |
383 | 383 | let afterPercentFee = binding._7 | |
384 | 384 | let enabled = binding._8 | |
385 | 385 | let err1 = if (if (_validateAddress(toString(assetContract), "burn: no such binding")) | |
386 | 386 | then _validateInt(amount, minAmount, MAX_INT, "burn: less than min") | |
387 | 387 | else false) | |
388 | 388 | then _validateBool(enabled, true, "burn: token is disabled") | |
389 | 389 | else false | |
390 | 390 | if ((err1 == err1)) | |
391 | 391 | then { | |
392 | 392 | let assetDecimals = _asInt(invoke(assetContract, "getDecimals", nil, nil)) | |
393 | 393 | if ((assetDecimals == assetDecimals)) | |
394 | 394 | then { | |
395 | 395 | let percent = if ((amount > thresholdFee)) | |
396 | 396 | then afterPercentFee | |
397 | 397 | else beforePercentFee | |
398 | - | let fee = (minFee + | |
398 | + | let fee = (minFee + fraction(amount, percent, PERCENT_FACTOR)) | |
399 | 399 | let err2 = _validateInt(amount, (fee + 1), MAX_INT, "burn: fee more than amount") | |
400 | 400 | if ((err2 == err2)) | |
401 | 401 | then { | |
402 | 402 | let amountToSend = (amount - fee) | |
403 | 403 | let err3 = _validateInt(amountToSend, (gaslessReward_ + 1), MAX_INT, "burn: reward more than amount") | |
404 | 404 | if ((err3 == err3)) | |
405 | 405 | then { | |
406 | 406 | let updateFee = (_loadFee(assetId) + fee) | |
407 | 407 | let normalizedAmount = _normalizeDecimals(amountToSend, assetDecimals, DECIMALS) | |
408 | 408 | let normalizedGasless = _normalizeDecimals(gaslessReward_, assetDecimals, DECIMALS) | |
409 | 409 | let invocation = invoke(_loadRootAdapter(), FUNC_RELEASE_TOKENS, [executionChainId_, executionAsset, normalizedAmount, recipient_, normalizedGasless], nil) | |
410 | 410 | if ((invocation == invocation)) | |
411 | 411 | then $Tuple2((_saveFee(assetId, updateFee) ++ [Burn(assetId, amountToSend)]), unit) | |
412 | 412 | else throw("Strict value is not equal to itself.") | |
413 | 413 | } | |
414 | 414 | else throw("Strict value is not equal to itself.") | |
415 | 415 | } | |
416 | 416 | else throw("Strict value is not equal to itself.") | |
417 | 417 | } | |
418 | 418 | else throw("Strict value is not equal to itself.") | |
419 | 419 | } | |
420 | 420 | else throw("Strict value is not equal to itself.") | |
421 | 421 | } | |
422 | 422 | else throw("Strict value is not equal to itself.") | |
423 | 423 | } | |
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | 427 | @Callable(i) | |
428 | - | func transferFee ( | |
428 | + | func transferFee (executionChainId_,assetId_) = { | |
429 | 429 | let err = if (if (_whenInitialized()) | |
430 | 430 | then _whenNotPaused() | |
431 | 431 | else false) | |
432 | - | then _ | |
432 | + | then _validateAsset(assetId_, "transferFee: invalid asset") | |
433 | 433 | else false | |
434 | 434 | if ((err == err)) | |
435 | 435 | then { | |
436 | - | let assetId = _asBytes(invoke(addressFromStringValue(assetContract_), "getAssetId", nil, nil)) | |
437 | - | if ((assetId == assetId)) | |
436 | + | let assetId = fromBase58String(assetId_) | |
437 | + | let binding = _loadBinding(executionChainId_, assetId) | |
438 | + | let assetContract = binding._1 | |
439 | + | let enabled = binding._8 | |
440 | + | let err1 = if (_validateAddress(toString(assetContract), "transferFee: no such binding")) | |
441 | + | then _validateBool(enabled, true, "transferFee: token is disabled") | |
442 | + | else false | |
443 | + | if ((err1 == err1)) | |
438 | 444 | then $Tuple2((_saveFee(assetId, 0) ++ [ScriptTransfer(_loadFeeRecipient(), _loadFee(assetId), assetId)]), unit) | |
439 | 445 | else throw("Strict value is not equal to itself.") | |
440 | 446 | } | |
441 | 447 | else throw("Strict value is not equal to itself.") | |
442 | 448 | } | |
443 | 449 | ||
444 | 450 | ||
445 | 451 | ||
446 | 452 | @Callable(i) | |
447 | 453 | func updateCallerContract (callerContract_) = { | |
448 | 454 | let err = if (_onlyThisContract(i.caller)) | |
449 | 455 | then _whenInitialized() | |
450 | 456 | else false | |
451 | 457 | if ((err == err)) | |
452 | 458 | then $Tuple2(_saveCallerContract(callerContract_), unit) | |
453 | 459 | else throw("Strict value is not equal to itself.") | |
454 | 460 | } | |
455 | 461 | ||
456 | 462 | ||
457 | 463 | ||
458 | 464 | @Callable(i) | |
459 | 465 | func updateExecutionChain (executionChainId_,enabled_) = { | |
460 | 466 | let err = if (if (_onlyThisContract(i.caller)) | |
461 | 467 | then _whenInitialized() | |
462 | 468 | else false) | |
463 | 469 | then _validateInt(executionChainId_, 0, MAX_INT, "updateExecutionChain: invalid executionChainId") | |
464 | 470 | else false | |
465 | 471 | if ((err == err)) | |
466 | 472 | then $Tuple2(_saveChain(executionChainId_, enabled_), unit) | |
467 | 473 | else throw("Strict value is not equal to itself.") | |
468 | 474 | } | |
469 | 475 | ||
470 | 476 | ||
471 | 477 | ||
472 | 478 | @Callable(i) | |
473 | 479 | func updateFeeRecipient (feeRecipient_) = { | |
474 | 480 | let err = if (if (_onlyThisContract(i.caller)) | |
475 | 481 | then _whenInitialized() | |
476 | 482 | else false) | |
477 | 483 | then _validateAddress(feeRecipient_, "updateFeeRecipient: invalid feeRecipient") | |
478 | 484 | else false | |
479 | 485 | if ((err == err)) | |
480 | 486 | then $Tuple2(_saveFeeRecipient(addressFromStringValue(feeRecipient_)), unit) | |
481 | 487 | else throw("Strict value is not equal to itself.") | |
482 | 488 | } | |
483 | 489 | ||
484 | 490 | ||
485 | 491 | ||
486 | 492 | @Callable(i) | |
487 | 493 | func updateBindingInfo (executionChainId_,assetContract_,executionAsset_,minAmount_,minFee_,thresholdFee_,beforePercentFee_,afterPercentFee_,enabled_) = { | |
488 | 494 | let err = if (if (if (if (if (if (if (if (_onlyThisContract(i.caller)) | |
489 | 495 | then _whenInitialized() | |
490 | 496 | else false) | |
491 | 497 | then _validateAddress(assetContract_, "updateBindingInfo: invalid asset contract") | |
492 | 498 | else false) | |
493 | 499 | then _validateInt(executionChainId_, 0, MAX_INT, "updateBindingInfo: invalid executionChainId") | |
494 | 500 | else false) | |
495 | 501 | then _validateInt(minAmount_, 0, MAX_INT, "updateBindingInfo: invalid minAmount") | |
496 | 502 | else false) | |
497 | 503 | then _validateInt(minFee_, 0, MAX_INT, "updateBindingInfo: invalid minFee") | |
498 | 504 | else false) | |
499 | 505 | then _validateInt(thresholdFee_, 0, MAX_INT, "updateBindingInfo: invalid thresholdFee") | |
500 | 506 | else false) | |
501 | 507 | then _validateInt(beforePercentFee_, 0, MAX_INT, "updateBindingInfo: invalid beforePercentFee") | |
502 | 508 | else false) | |
503 | 509 | then _validateInt(afterPercentFee_, 0, MAX_INT, "updateBindingInfo: invalid afterPercentFee") | |
504 | 510 | else false | |
505 | 511 | if ((err == err)) | |
506 | 512 | then { | |
507 | 513 | let assetId = _asBytes(invoke(addressFromStringValue(assetContract_), "getAssetId", nil, nil)) | |
508 | 514 | if ((assetId == assetId)) | |
509 | 515 | then { | |
510 | 516 | let binding = $Tuple8(addressFromStringValue(assetContract_), executionAsset_, minAmount_, minFee_, thresholdFee_, beforePercentFee_, afterPercentFee_, enabled_) | |
511 | 517 | $Tuple2(_saveBinding(executionChainId_, assetId, binding), unit) | |
512 | 518 | } | |
513 | 519 | else throw("Strict value is not equal to itself.") | |
514 | 520 | } | |
515 | 521 | else throw("Strict value is not equal to itself.") | |
516 | 522 | } | |
517 | 523 | ||
518 | 524 | ||
519 | 525 | ||
520 | 526 | @Callable(i) | |
521 | 527 | func pause () = { | |
522 | 528 | let err = if (if (_onlyPauser(i.caller)) | |
523 | 529 | then _whenInitialized() | |
524 | 530 | else false) | |
525 | 531 | then _whenNotPaused() | |
526 | 532 | else false | |
527 | 533 | if ((err == err)) | |
528 | 534 | then $Tuple2(_savePause(true), unit) | |
529 | 535 | else throw("Strict value is not equal to itself.") | |
530 | 536 | } | |
531 | 537 | ||
532 | 538 | ||
533 | 539 | ||
534 | 540 | @Callable(i) | |
535 | 541 | func unpause () = { | |
536 | 542 | let err = if (if (_onlyPauser(i.caller)) | |
537 | 543 | then _whenInitialized() | |
538 | 544 | else false) | |
539 | 545 | then _whenPaused() | |
540 | 546 | else false | |
541 | 547 | if ((err == err)) | |
542 | 548 | then $Tuple2(_savePause(false), unit) | |
543 | 549 | else throw("Strict value is not equal to itself.") | |
544 | 550 | } | |
545 | 551 | ||
546 | 552 | ||
547 | 553 | ||
548 | 554 | @Callable(i) | |
549 | 555 | func updatePauser (pauser_) = { | |
550 | 556 | let err = if (if (_onlyThisContract(i.caller)) | |
551 | 557 | then _whenInitialized() | |
552 | 558 | else false) | |
553 | 559 | then _validateAddress(pauser_, "init: invalid pauser") | |
554 | 560 | else false | |
555 | 561 | if ((err == err)) | |
556 | 562 | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
557 | 563 | else throw("Strict value is not equal to itself.") | |
558 | 564 | } | |
559 | 565 | ||
560 | 566 | ||
561 | 567 | ||
562 | 568 | @Callable(i) | |
563 | 569 | func setMultisig (multisig_) = { | |
564 | 570 | let err = if (_onlyThisContract(i.caller)) | |
565 | 571 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
566 | 572 | else false | |
567 | 573 | if ((err == err)) | |
568 | 574 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
569 | 575 | else throw("Strict value is not equal to itself.") | |
570 | 576 | } | |
571 | 577 | ||
572 | 578 | ||
573 | 579 | @Verifier(tx) | |
574 | 580 | func verify () = match getString(KEY_MULTISIG) { | |
575 | 581 | case multisig: String => | |
576 | 582 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
577 | 583 | case _ => | |
578 | 584 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
579 | 585 | } | |
580 | 586 |
github/deemru/w8io/026f985 57.94 ms ◑