tx · 22iAgtg8xCHx5adVyxLGAv5tWQKJ682BjqeSoN2eYzLL 3NCCbzmJYurqgXL9bh85G7gzASswGVjkfRU: -0.01400000 Waves 2024.03.22 15:25 [3029240] smart account 3NCCbzmJYurqgXL9bh85G7gzASswGVjkfRU > SELF 0.00000000 Waves
{ "type": 13, "id": "22iAgtg8xCHx5adVyxLGAv5tWQKJ682BjqeSoN2eYzLL", "fee": 1400000, "feeAssetId": null, "timestamp": 1711110362964, "version": 2, "chainId": 84, "sender": "3NCCbzmJYurqgXL9bh85G7gzASswGVjkfRU", "senderPublicKey": "7dYS4cBUtMS3qg16og5S9C9U6ygyVxgTqhJGoYcsuYzr", "proofs": [ "3YBR4ANHWXMAw5YpYibrh6sA5bM4udGAy5NBvyTnqCoEBNinTcqH3vbkTQmQddBPjALvyeoNH1shNSbg6M2dHxBb" ], "script": "base64:BwJPCAISBgoECAgICBIICgYICAgICAgSCQoHCAgBCAgBCBIICgYICAEICAgSCAoGCAgBCAgIEgUKAwEICBIFCgMBCAgSABIAEgMKAQgSAwoBCD4ACVNFUEFSQVRPUgICX18ADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAIS0VZX0lOSVQCBElOSVQACktFWV9QQVVTRUQCBlBBVVNFRAAKS0VZX1BBVVNFUgIGUEFVU0VSAAxLRVlfRVhFQ1VUT1ICCEVYRUNVVE9SABNLRVlfQ0FMTEVSX0NPTlRSQUNUAg9DQUxMRVJfQ09OVFJBQ1QAD0tFWV9XQVZFU19WQVVMVAILV0FWRVNfVkFVTFQAE0tFWV9BQ0NPVU5UX1NUT1JBR0UCD0FDQ09VTlRfU1RPUkFHRQAJS0VZX0NIQUlOAgVDSEFJTgASS0VZX0FTU0VUX0NVUlJFTkNZAg5BU1NFVF9DVVJSRU5DWQASS0VZX0FTU0VUX1JFU0VSVkVTAg5BU1NFVF9SRVNFUlZFUwAVS0VZX0NVUlJFTkNZX1JFU0VSVkVTAhFDVVJSRU5D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mluZwQIbXVsdGlzaWcFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIbXVsdGlzaWcJALkJAgkAzAgCBQpLRVlfU1RBVFVTCQDMCAIJAKUIAQUEdGhpcwkAzAgCCQDYBAEIBQJ0eAJpZAUDbmlsBQlTRVBBUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5JVk0yw==", "height": 3029240, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CLk4CVvdQTVRU3ieWRkRFxpCDa1h1QrAJPCPCMGJaSTo Next: none Diff:
Old | New | Differences | |
---|---|---|---|
23 | 23 | ||
24 | 24 | let KEY_CHAIN = "CHAIN" | |
25 | 25 | ||
26 | - | let KEY_ASSET_ | |
26 | + | let KEY_ASSET_CURRENCY = "ASSET_CURRENCY" | |
27 | 27 | ||
28 | 28 | let KEY_ASSET_RESERVES = "ASSET_RESERVES" | |
29 | 29 | ||
30 | - | let KEY_ | |
30 | + | let KEY_CURRENCY_RESERVES = "CURRENCY_RESERVES" | |
31 | 31 | ||
32 | 32 | let FUNC_DEPOSIT = "deposit" | |
33 | 33 | ||
167 | 167 | func _saveChain (chainId_,name_) = [StringEntry(makeString([KEY_CHAIN, toString(chainId_)], SEPARATOR), name_)] | |
168 | 168 | ||
169 | 169 | ||
170 | - | func _ | |
170 | + | func _loadAssetCurrency (chainId_,asset_) = match getString(makeString([KEY_ASSET_CURRENCY, toString(chainId_), asset_], SEPARATOR)) { | |
171 | 171 | case a: String => | |
172 | 172 | a | |
173 | 173 | case _ => | |
175 | 175 | } | |
176 | 176 | ||
177 | 177 | ||
178 | - | func _ | |
178 | + | func _saveAssetCurrency (chainId_,asset_,currency_) = [StringEntry(makeString([KEY_ASSET_CURRENCY, toString(chainId_), asset_], SEPARATOR), currency_)] | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func _loadAssetReserves (chainId_,asset_) = match getString(makeString([KEY_ASSET_RESERVES, toString(chainId_), asset_], SEPARATOR)) { | |
189 | 189 | func _saveAssetReserves (chainId_,asset_,reserves_) = [StringEntry(makeString([KEY_ASSET_RESERVES, toString(chainId_), asset_], SEPARATOR), toString(reserves_))] | |
190 | 190 | ||
191 | 191 | ||
192 | - | func _ | |
192 | + | func _loadCurrencyReserves (currency_) = match getString(makeString([KEY_CURRENCY_RESERVES, currency_], SEPARATOR)) { | |
193 | 193 | case a: String => | |
194 | 194 | parseBigIntValue(a) | |
195 | 195 | case _ => | |
197 | 197 | } | |
198 | 198 | ||
199 | 199 | ||
200 | - | func _ | |
200 | + | func _saveCurrencyReserves (currency_,reserves_) = [StringEntry(makeString([KEY_CURRENCY_RESERVES, currency_], SEPARATOR), toString(reserves_))] | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
255 | 255 | else true | |
256 | 256 | ||
257 | 257 | ||
258 | - | func _ | |
258 | + | func _assetCurrencyExists (chainId_,asset_,err_) = if ((0 >= size(_loadAssetCurrency(chainId_, asset_)))) | |
259 | 259 | then throw(err_) | |
260 | 260 | else true | |
261 | 261 | ||
262 | 262 | ||
263 | - | func _ | |
263 | + | func _assetCurrencyNotExist (chainId_,asset_,err_) = if ((size(_loadAssetCurrency(chainId_, asset_)) > 0)) | |
264 | 264 | then throw(err_) | |
265 | 265 | else true | |
266 | 266 | ||
305 | 305 | else false) | |
306 | 306 | then _validateString(to_, "deposit: invalid to") | |
307 | 307 | else false) | |
308 | - | then _ | |
308 | + | then _assetCurrencyExists(chainId, asset_, "deposit: invalid asset") | |
309 | 309 | else false) | |
310 | 310 | then _validateBigInt(amount, ZERO_BIGINT, "deposit: invalid amount") | |
311 | 311 | else false | |
319 | 319 | if ((err1 == err1)) | |
320 | 320 | then { | |
321 | 321 | let newAssetReserves = (_loadAssetReserves(chainId, asset_) + amount) | |
322 | - | let | |
323 | - | let | |
324 | - | let invocation = invoke(_loadAccountStorage(), FUNC_DEPOSIT, [to_, SPOT_WALLET, | |
322 | + | let currency = _loadAssetCurrency(chainId, asset_) | |
323 | + | let newCurrencyReserves = (_loadCurrencyReserves(currency) + amount) | |
324 | + | let invocation = invoke(_loadAccountStorage(), FUNC_DEPOSIT, [to_, SPOT_WALLET, currency, amount_], nil) | |
325 | 325 | if ((invocation == invocation)) | |
326 | - | then $Tuple2((_saveAssetReserves(chainId, asset_, newAssetReserves) ++ _ | |
326 | + | then $Tuple2((_saveAssetReserves(chainId, asset_, newAssetReserves) ++ _saveCurrencyReserves(currency, newCurrencyReserves)), unit) | |
327 | 327 | else throw("Strict value is not equal to itself.") | |
328 | 328 | } | |
329 | 329 | else throw("Strict value is not equal to itself.") | |
369 | 369 | ||
370 | 370 | ||
371 | 371 | @Callable(i) | |
372 | - | func addAsset (chainId_,asset_, | |
372 | + | func addAsset (chainId_,asset_,currency_) = { | |
373 | 373 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
374 | 374 | then _whenInitialized() | |
375 | 375 | else false) | |
377 | 377 | else false) | |
378 | 378 | then _validateString(asset_, "addAsset: invalid asset") | |
379 | 379 | else false) | |
380 | - | then _validateString( | |
380 | + | then _validateString(currency_, "addAsset: invalid currency") | |
381 | 381 | else false) | |
382 | - | then _ | |
382 | + | then _assetCurrencyNotExist(chainId_, asset_, "addAsset: already exists") | |
383 | 383 | else false | |
384 | 384 | if ((err == err)) | |
385 | - | then $Tuple2(_ | |
385 | + | then $Tuple2(_saveAssetCurrency(chainId_, asset_, currency_), unit) | |
386 | 386 | else throw("Strict value is not equal to itself.") | |
387 | 387 | } | |
388 | 388 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEPARATOR = "__" | |
5 | 5 | ||
6 | 6 | let KEY_MULTISIG = "MULTISIG" | |
7 | 7 | ||
8 | 8 | let KEY_STATUS = "STATUS" | |
9 | 9 | ||
10 | 10 | let KEY_INIT = "INIT" | |
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_CALLER_CONTRACT = "CALLER_CONTRACT" | |
19 | 19 | ||
20 | 20 | let KEY_WAVES_VAULT = "WAVES_VAULT" | |
21 | 21 | ||
22 | 22 | let KEY_ACCOUNT_STORAGE = "ACCOUNT_STORAGE" | |
23 | 23 | ||
24 | 24 | let KEY_CHAIN = "CHAIN" | |
25 | 25 | ||
26 | - | let KEY_ASSET_ | |
26 | + | let KEY_ASSET_CURRENCY = "ASSET_CURRENCY" | |
27 | 27 | ||
28 | 28 | let KEY_ASSET_RESERVES = "ASSET_RESERVES" | |
29 | 29 | ||
30 | - | let KEY_ | |
30 | + | let KEY_CURRENCY_RESERVES = "CURRENCY_RESERVES" | |
31 | 31 | ||
32 | 32 | let FUNC_DEPOSIT = "deposit" | |
33 | 33 | ||
34 | 34 | let WAVES = "WAVES" | |
35 | 35 | ||
36 | 36 | let SPOT_WALLET = "SPOT" | |
37 | 37 | ||
38 | 38 | let MAX_INT = 9223372036854775807 | |
39 | 39 | ||
40 | 40 | let ZERO_BIGINT = toBigInt(0) | |
41 | 41 | ||
42 | 42 | let ONE_BIGINT = toBigInt(1) | |
43 | 43 | ||
44 | 44 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
45 | 45 | case a: Address => | |
46 | 46 | true | |
47 | 47 | case _ => | |
48 | 48 | throw(err_) | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
53 | 53 | then true | |
54 | 54 | else (val_ > upperBoundary_)) | |
55 | 55 | then throw(err_) | |
56 | 56 | else true | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func _validateBigInt (val_,lowerBoundary_,err_) = if ((lowerBoundary_ > val_)) | |
60 | 60 | then throw(err_) | |
61 | 61 | else true | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
65 | 65 | then true | |
66 | 66 | else contains(val_, SEPARATOR)) | |
67 | 67 | then throw(err_) | |
68 | 68 | else true | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func _loadInit () = match getBoolean(KEY_INIT) { | |
72 | 72 | case a: Boolean => | |
73 | 73 | a | |
74 | 74 | case _ => | |
75 | 75 | false | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
83 | 83 | case a: Boolean => | |
84 | 84 | a | |
85 | 85 | case _ => | |
86 | 86 | false | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func _loadPauser () = match getString(KEY_PAUSER) { | |
94 | 94 | case a: String => | |
95 | 95 | addressFromStringValue(a) | |
96 | 96 | case _ => | |
97 | 97 | Address(base58'') | |
98 | 98 | } | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
105 | 105 | case a: String => | |
106 | 106 | addressFromStringValue(a) | |
107 | 107 | case _ => | |
108 | 108 | Address(base58'') | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func _loadCallerContract (chainId_) = match getString(makeString([KEY_CALLER_CONTRACT, toString(chainId_)], SEPARATOR)) { | |
116 | 116 | case a: String => | |
117 | 117 | a | |
118 | 118 | case _ => | |
119 | 119 | "" | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func _saveCallerContract (chainId_,callerContract_) = [StringEntry(makeString([KEY_CALLER_CONTRACT, toString(chainId_)], SEPARATOR), callerContract_)] | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func _loadExecutor () = match getString(KEY_EXECUTOR) { | |
127 | 127 | case a: String => | |
128 | 128 | addressFromStringValue(a) | |
129 | 129 | case _ => | |
130 | 130 | Address(base58'') | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func _saveExecutor (executor_) = [StringEntry(KEY_EXECUTOR, toString(executor_))] | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func _loadAccountStorage () = match getString(KEY_ACCOUNT_STORAGE) { | |
138 | 138 | case a: String => | |
139 | 139 | addressFromStringValue(a) | |
140 | 140 | case _ => | |
141 | 141 | Address(base58'') | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func _saveAccountStorage (accountStorage_) = [StringEntry(KEY_ACCOUNT_STORAGE, toString(accountStorage_))] | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func _loadWavesVault () = match getString(KEY_WAVES_VAULT) { | |
149 | 149 | case a: String => | |
150 | 150 | addressFromStringValue(a) | |
151 | 151 | case _ => | |
152 | 152 | Address(base58'') | |
153 | 153 | } | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func _saveWavesVault (wavesVault_) = [StringEntry(KEY_WAVES_VAULT, toString(wavesVault_))] | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func _loadChain (chainId_) = match getString(makeString([KEY_CHAIN, toString(chainId_)], SEPARATOR)) { | |
160 | 160 | case a: String => | |
161 | 161 | a | |
162 | 162 | case _ => | |
163 | 163 | "" | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | func _saveChain (chainId_,name_) = [StringEntry(makeString([KEY_CHAIN, toString(chainId_)], SEPARATOR), name_)] | |
168 | 168 | ||
169 | 169 | ||
170 | - | func _ | |
170 | + | func _loadAssetCurrency (chainId_,asset_) = match getString(makeString([KEY_ASSET_CURRENCY, toString(chainId_), asset_], SEPARATOR)) { | |
171 | 171 | case a: String => | |
172 | 172 | a | |
173 | 173 | case _ => | |
174 | 174 | "" | |
175 | 175 | } | |
176 | 176 | ||
177 | 177 | ||
178 | - | func _ | |
178 | + | func _saveAssetCurrency (chainId_,asset_,currency_) = [StringEntry(makeString([KEY_ASSET_CURRENCY, toString(chainId_), asset_], SEPARATOR), currency_)] | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | func _loadAssetReserves (chainId_,asset_) = match getString(makeString([KEY_ASSET_RESERVES, toString(chainId_), asset_], SEPARATOR)) { | |
182 | 182 | case a: String => | |
183 | 183 | parseBigIntValue(a) | |
184 | 184 | case _ => | |
185 | 185 | ZERO_BIGINT | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func _saveAssetReserves (chainId_,asset_,reserves_) = [StringEntry(makeString([KEY_ASSET_RESERVES, toString(chainId_), asset_], SEPARATOR), toString(reserves_))] | |
190 | 190 | ||
191 | 191 | ||
192 | - | func _ | |
192 | + | func _loadCurrencyReserves (currency_) = match getString(makeString([KEY_CURRENCY_RESERVES, currency_], SEPARATOR)) { | |
193 | 193 | case a: String => | |
194 | 194 | parseBigIntValue(a) | |
195 | 195 | case _ => | |
196 | 196 | ZERO_BIGINT | |
197 | 197 | } | |
198 | 198 | ||
199 | 199 | ||
200 | - | func _ | |
200 | + | func _saveCurrencyReserves (currency_,reserves_) = [StringEntry(makeString([KEY_CURRENCY_RESERVES, currency_], SEPARATOR), toString(reserves_))] | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
204 | 204 | then throw("_onlyThisContract: revert") | |
205 | 205 | else true | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
209 | 209 | then throw("_whenMultisigSet: revert") | |
210 | 210 | else true | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func _whenNotInitialized () = if (_loadInit()) | |
214 | 214 | then throw("_whenNotInitialized: revert") | |
215 | 215 | else true | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | func _whenInitialized () = if (!(_loadInit())) | |
219 | 219 | then throw("_whenInitialized: revert") | |
220 | 220 | else true | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func _whenNotPaused () = if (_loadPause()) | |
224 | 224 | then throw("_whenNotPaused: revert") | |
225 | 225 | else true | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | func _whenPaused () = if (!(_loadPause())) | |
229 | 229 | then throw("_whenPaused: revert") | |
230 | 230 | else true | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
234 | 234 | then throw("_onlyPauser: revert") | |
235 | 235 | else true | |
236 | 236 | ||
237 | 237 | ||
238 | 238 | func _validateExecutor (val_,err_) = if ((val_ != _loadExecutor())) | |
239 | 239 | then throw(err_) | |
240 | 240 | else true | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | func _validateCallerContract (chainId_,callerContract_,err_) = if ((_loadCallerContract(chainId_) != callerContract_)) | |
244 | 244 | then throw(err_) | |
245 | 245 | else true | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | func _chainExists (chainId_,err_) = if ((0 >= size(_loadChain(chainId_)))) | |
249 | 249 | then throw(err_) | |
250 | 250 | else true | |
251 | 251 | ||
252 | 252 | ||
253 | 253 | func _chainNotExist (chainId_,err_) = if ((size(_loadChain(chainId_)) > 0)) | |
254 | 254 | then throw(err_) | |
255 | 255 | else true | |
256 | 256 | ||
257 | 257 | ||
258 | - | func _ | |
258 | + | func _assetCurrencyExists (chainId_,asset_,err_) = if ((0 >= size(_loadAssetCurrency(chainId_, asset_)))) | |
259 | 259 | then throw(err_) | |
260 | 260 | else true | |
261 | 261 | ||
262 | 262 | ||
263 | - | func _ | |
263 | + | func _assetCurrencyNotExist (chainId_,asset_,err_) = if ((size(_loadAssetCurrency(chainId_, asset_)) > 0)) | |
264 | 264 | then throw(err_) | |
265 | 265 | else true | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func _validateWavesVault (caller,err_) = if ((_loadWavesVault() != caller)) | |
269 | 269 | then throw(err_) | |
270 | 270 | else true | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | @Callable(i) | |
274 | 274 | func init (executor_,pauser_,accountStorage_,wavesVault_) = { | |
275 | 275 | let err = if (if (if (if (if (if (_onlyThisContract(i.caller)) | |
276 | 276 | then _whenNotInitialized() | |
277 | 277 | else false) | |
278 | 278 | then _whenMultisigSet() | |
279 | 279 | else false) | |
280 | 280 | then _validateAddress(executor_, "init: invalid executor") | |
281 | 281 | else false) | |
282 | 282 | then _validateAddress(pauser_, "init: invalid pauser") | |
283 | 283 | else false) | |
284 | 284 | then _validateAddress(accountStorage_, "init: invalid accountStorage") | |
285 | 285 | else false) | |
286 | 286 | then _validateAddress(wavesVault_, "init: invalid wavesVault") | |
287 | 287 | else false | |
288 | 288 | if ((err == err)) | |
289 | 289 | then $Tuple2(((((_saveInit(true) ++ _saveExecutor(addressFromStringValue(executor_))) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveAccountStorage(addressFromStringValue(accountStorage_))) ++ _saveWavesVault(addressFromStringValue(wavesVault_))), unit) | |
290 | 290 | else throw("Strict value is not equal to itself.") | |
291 | 291 | } | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | ||
295 | 295 | @Callable(i) | |
296 | 296 | func deposit (callerContract_,from_,to_,chainId_,asset_,amount_) = { | |
297 | 297 | let chainId = valueOrErrorMessage(parseInt(chainId_), "deposit: chainId not int") | |
298 | 298 | let amount = valueOrErrorMessage(parseBigInt(amount_), "deposit: amount not int") | |
299 | 299 | let err = if (if (if (if (if (if (_whenInitialized()) | |
300 | 300 | then _whenNotPaused() | |
301 | 301 | else false) | |
302 | 302 | then _chainExists(chainId, "deposit: invalid chainId") | |
303 | 303 | else false) | |
304 | 304 | then _validateString(from_, "deposit: invalid from") | |
305 | 305 | else false) | |
306 | 306 | then _validateString(to_, "deposit: invalid to") | |
307 | 307 | else false) | |
308 | - | then _ | |
308 | + | then _assetCurrencyExists(chainId, asset_, "deposit: invalid asset") | |
309 | 309 | else false) | |
310 | 310 | then _validateBigInt(amount, ZERO_BIGINT, "deposit: invalid amount") | |
311 | 311 | else false | |
312 | 312 | if ((err == err)) | |
313 | 313 | then { | |
314 | 314 | let err1 = if ((_loadChain(chainId) == WAVES)) | |
315 | 315 | then _validateWavesVault(i.caller, "deposit: invalid waves vault") | |
316 | 316 | else if (_validateExecutor(i.caller, "deposit: invalid executor")) | |
317 | 317 | then _validateCallerContract(chainId, callerContract_, "deposit: invalid caller contract") | |
318 | 318 | else false | |
319 | 319 | if ((err1 == err1)) | |
320 | 320 | then { | |
321 | 321 | let newAssetReserves = (_loadAssetReserves(chainId, asset_) + amount) | |
322 | - | let | |
323 | - | let | |
324 | - | let invocation = invoke(_loadAccountStorage(), FUNC_DEPOSIT, [to_, SPOT_WALLET, | |
322 | + | let currency = _loadAssetCurrency(chainId, asset_) | |
323 | + | let newCurrencyReserves = (_loadCurrencyReserves(currency) + amount) | |
324 | + | let invocation = invoke(_loadAccountStorage(), FUNC_DEPOSIT, [to_, SPOT_WALLET, currency, amount_], nil) | |
325 | 325 | if ((invocation == invocation)) | |
326 | - | then $Tuple2((_saveAssetReserves(chainId, asset_, newAssetReserves) ++ _ | |
326 | + | then $Tuple2((_saveAssetReserves(chainId, asset_, newAssetReserves) ++ _saveCurrencyReserves(currency, newCurrencyReserves)), unit) | |
327 | 327 | else throw("Strict value is not equal to itself.") | |
328 | 328 | } | |
329 | 329 | else throw("Strict value is not equal to itself.") | |
330 | 330 | } | |
331 | 331 | else throw("Strict value is not equal to itself.") | |
332 | 332 | } | |
333 | 333 | ||
334 | 334 | ||
335 | 335 | ||
336 | 336 | @Callable(i) | |
337 | 337 | func withdraw (from_,to_,chainId_,asset_,amount_,timestamp_,signature_) = $Tuple2(nil, unit) | |
338 | 338 | ||
339 | 339 | ||
340 | 340 | ||
341 | 341 | @Callable(i) | |
342 | 342 | func requestWithdrawal (from_,to_,chainId_,asset_,amount_,signature_) = $Tuple2(nil, unit) | |
343 | 343 | ||
344 | 344 | ||
345 | 345 | ||
346 | 346 | @Callable(i) | |
347 | 347 | func executeWithdrawal (from_,to_,chainId_,asset_,amount_,signature_) = $Tuple2(nil, unit) | |
348 | 348 | ||
349 | 349 | ||
350 | 350 | ||
351 | 351 | @Callable(i) | |
352 | 352 | func addChain (chainId_,name_,callerContract_) = { | |
353 | 353 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
354 | 354 | then _whenInitialized() | |
355 | 355 | else false) | |
356 | 356 | then _validateInt(chainId_, 0, MAX_INT, "addChain: invalid chainId") | |
357 | 357 | else false) | |
358 | 358 | then _validateString(name_, "addChain: invalid name") | |
359 | 359 | else false) | |
360 | 360 | then _validateString(callerContract_, "addChain: invalid callerContract") | |
361 | 361 | else false) | |
362 | 362 | then _chainNotExist(chainId_, "addChain: already exists") | |
363 | 363 | else false | |
364 | 364 | if ((err == err)) | |
365 | 365 | then $Tuple2((_saveChain(chainId_, name_) ++ _saveCallerContract(chainId_, callerContract_)), unit) | |
366 | 366 | else throw("Strict value is not equal to itself.") | |
367 | 367 | } | |
368 | 368 | ||
369 | 369 | ||
370 | 370 | ||
371 | 371 | @Callable(i) | |
372 | - | func addAsset (chainId_,asset_, | |
372 | + | func addAsset (chainId_,asset_,currency_) = { | |
373 | 373 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
374 | 374 | then _whenInitialized() | |
375 | 375 | else false) | |
376 | 376 | then _chainExists(chainId_, "addAsset: invalid chainId") | |
377 | 377 | else false) | |
378 | 378 | then _validateString(asset_, "addAsset: invalid asset") | |
379 | 379 | else false) | |
380 | - | then _validateString( | |
380 | + | then _validateString(currency_, "addAsset: invalid currency") | |
381 | 381 | else false) | |
382 | - | then _ | |
382 | + | then _assetCurrencyNotExist(chainId_, asset_, "addAsset: already exists") | |
383 | 383 | else false | |
384 | 384 | if ((err == err)) | |
385 | - | then $Tuple2(_ | |
385 | + | then $Tuple2(_saveAssetCurrency(chainId_, asset_, currency_), unit) | |
386 | 386 | else throw("Strict value is not equal to itself.") | |
387 | 387 | } | |
388 | 388 | ||
389 | 389 | ||
390 | 390 | ||
391 | 391 | @Callable(i) | |
392 | 392 | func pause () = { | |
393 | 393 | let err = if (if (_onlyPauser(i.caller)) | |
394 | 394 | then _whenInitialized() | |
395 | 395 | else false) | |
396 | 396 | then _whenNotPaused() | |
397 | 397 | else false | |
398 | 398 | if ((err == err)) | |
399 | 399 | then $Tuple2(_savePause(true), unit) | |
400 | 400 | else throw("Strict value is not equal to itself.") | |
401 | 401 | } | |
402 | 402 | ||
403 | 403 | ||
404 | 404 | ||
405 | 405 | @Callable(i) | |
406 | 406 | func unpause () = { | |
407 | 407 | let err = if (if (_onlyPauser(i.caller)) | |
408 | 408 | then _whenInitialized() | |
409 | 409 | else false) | |
410 | 410 | then _whenPaused() | |
411 | 411 | else false | |
412 | 412 | if ((err == err)) | |
413 | 413 | then $Tuple2(_savePause(false), unit) | |
414 | 414 | else throw("Strict value is not equal to itself.") | |
415 | 415 | } | |
416 | 416 | ||
417 | 417 | ||
418 | 418 | ||
419 | 419 | @Callable(i) | |
420 | 420 | func updatePauser (pauser_) = { | |
421 | 421 | let err = if (if (_onlyThisContract(i.caller)) | |
422 | 422 | then _whenInitialized() | |
423 | 423 | else false) | |
424 | 424 | then _validateAddress(pauser_, "updatePauser: invalid pauser") | |
425 | 425 | else false | |
426 | 426 | if ((err == err)) | |
427 | 427 | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
428 | 428 | else throw("Strict value is not equal to itself.") | |
429 | 429 | } | |
430 | 430 | ||
431 | 431 | ||
432 | 432 | ||
433 | 433 | @Callable(i) | |
434 | 434 | func setMultisig (multisig_) = { | |
435 | 435 | let err = if (_onlyThisContract(i.caller)) | |
436 | 436 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
437 | 437 | else false | |
438 | 438 | if ((err == err)) | |
439 | 439 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
440 | 440 | else throw("Strict value is not equal to itself.") | |
441 | 441 | } | |
442 | 442 | ||
443 | 443 | ||
444 | 444 | @Verifier(tx) | |
445 | 445 | func verify () = match getString(KEY_MULTISIG) { | |
446 | 446 | case multisig: String => | |
447 | 447 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
448 | 448 | case _ => | |
449 | 449 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
450 | 450 | } | |
451 | 451 |
github/deemru/w8io/169f3d6 54.80 ms ◑