tx · GvhZNZwcJLxtzaYbjVhyWXqoS27XNkDXay2gKpT7yPTv 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa: -0.01400000 Waves 2024.11.21 12:55 [3381056] smart account 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa > SELF 0.00000000 Waves
{ "type": 13, "id": "GvhZNZwcJLxtzaYbjVhyWXqoS27XNkDXay2gKpT7yPTv", "fee": 1400000, "feeAssetId": null, "timestamp": 1732182852170, "version": 2, "chainId": 84, "sender": "3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa", "senderPublicKey": "tinwq3CCsobvKT9fhHjTjbxXQdTDmXW9KtgPvR94m1H", "proofs": [ "5X2qWPR52avMqPyVvTwhsv1vwP4qm4tUPypZzkZh1y82Rbvu1xGhCzS7HY7QDr2zavK5YmHSLEmcDfc5rdhMkZVs" ], "script": "base64:BwJFCAISBAoCCAgSBQoDCAgIEgcKBQgICAgIEgUKAwgICBIJCgcICAgICAgIEgUKAwgICBIGCgQICAgIEgUKAwgICBIDCgEIIQAJU0VQQVJBVE9SAgJfXwAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAAhLRVlfSU5JVAIESU5JVAAUS0VZX0dBVEVXQVlfQ09OVFJBQ1QCEEdBVEVXQVlfQ09OVFJBQ1QAFEtFWV9NQVRDSEVSX0NPTlRSQUNUAhBNQVRDSEVSX0NPTlRSQUNUABBLRVlfVVNFUl9CQUxBTkNFAgxVU0VSX0JBTEFOQ0UAEUtFWV9UT1RBTF9CQUxBTkNFAg1UT1RBTF9CQUxBTkNFAAtTUE9UX1dBTExFVAIEU1BPVAAVU1RBS0lOR19SRVdBUkRfV0FMTEVUAg5TVEFLSU5HX1JFV0FSRAALWkVST19CSUdJTlQJALYCAQAAARBfdmFsaWRhdGVBZGRyZXNzAghhZGRyZXNzXwRlcnJfBAckbWF0Y2gwCQCmCAEFCGFkZHJlc3NfAwkAAQIFByRtYXR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BUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5fQO9bw==", "height": 3381056, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FFDt51UGQUxwE3127Cu5DhPAigdsPYuibeSofwCzwexu Next: none Diff:
Old | New | Differences | |
---|---|---|---|
18 | 18 | let KEY_TOTAL_BALANCE = "TOTAL_BALANCE" | |
19 | 19 | ||
20 | 20 | let SPOT_WALLET = "SPOT" | |
21 | - | ||
22 | - | let WITHDRAWALS_WALLET = "WITHDRAWALS" | |
23 | 21 | ||
24 | 22 | let STAKING_REWARD_WALLET = "STAKING_REWARD" | |
25 | 23 | ||
200 | 198 | else false) | |
201 | 199 | then _validateBigInt(amount, ZERO_BIGINT, "internalTransfer: invalid amount") | |
202 | 200 | else false) | |
203 | - | then if ((targetWallet_ == WITHDRAWALS_WALLET)) | |
204 | - | then _validateGateway(i.caller, "internalTransfer: invalid gw caller") | |
205 | - | else _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
201 | + | then _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
206 | 202 | else false | |
207 | 203 | if ((err == err)) | |
208 | 204 | then { | |
234 | 230 | else false | |
235 | 231 | if ((err == err)) | |
236 | 232 | then { | |
237 | - | let userBalance = _loadUserBalance(user_, | |
233 | + | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
238 | 234 | let newUserBalance = (userBalance - amount) | |
239 | 235 | let newTotalBalance = (_loadTotalBalance(currency_) - amount) | |
240 | 236 | let err1 = if (_validateBigInt(newUserBalance, ZERO_BIGINT, "withdraw: insufficient amount")) | |
241 | 237 | then _validateBigInt(newTotalBalance, ZERO_BIGINT, "withdraw: negative total balance") | |
242 | 238 | else false | |
243 | 239 | if ((err1 == err1)) | |
244 | - | then $Tuple2((_saveUserBalance(user_, | |
240 | + | then $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, newUserBalance) ++ _saveTotalBalance(currency_, newTotalBalance)), unit) | |
245 | 241 | else throw("Strict value is not equal to itself.") | |
246 | 242 | } | |
247 | 243 | else throw("Strict value is not equal to itself.") |
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_GATEWAY_CONTRACT = "GATEWAY_CONTRACT" | |
13 | 13 | ||
14 | 14 | let KEY_MATCHER_CONTRACT = "MATCHER_CONTRACT" | |
15 | 15 | ||
16 | 16 | let KEY_USER_BALANCE = "USER_BALANCE" | |
17 | 17 | ||
18 | 18 | let KEY_TOTAL_BALANCE = "TOTAL_BALANCE" | |
19 | 19 | ||
20 | 20 | let SPOT_WALLET = "SPOT" | |
21 | - | ||
22 | - | let WITHDRAWALS_WALLET = "WITHDRAWALS" | |
23 | 21 | ||
24 | 22 | let STAKING_REWARD_WALLET = "STAKING_REWARD" | |
25 | 23 | ||
26 | 24 | let ZERO_BIGINT = toBigInt(0) | |
27 | 25 | ||
28 | 26 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
29 | 27 | case a: Address => | |
30 | 28 | true | |
31 | 29 | case _ => | |
32 | 30 | throw(err_) | |
33 | 31 | } | |
34 | 32 | ||
35 | 33 | ||
36 | 34 | func _validateBigInt (val_,lowerBoundary_,err_) = if ((lowerBoundary_ > val_)) | |
37 | 35 | then throw(err_) | |
38 | 36 | else true | |
39 | 37 | ||
40 | 38 | ||
41 | 39 | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
42 | 40 | then true | |
43 | 41 | else contains(val_, SEPARATOR)) | |
44 | 42 | then throw(err_) | |
45 | 43 | else true | |
46 | 44 | ||
47 | 45 | ||
48 | 46 | func _validateStringEqual (val1_,val2_,err_) = if ((val1_ != val2_)) | |
49 | 47 | then throw(err_) | |
50 | 48 | else true | |
51 | 49 | ||
52 | 50 | ||
53 | 51 | func _loadInit () = match getBoolean(KEY_INIT) { | |
54 | 52 | case a: Boolean => | |
55 | 53 | a | |
56 | 54 | case _ => | |
57 | 55 | false | |
58 | 56 | } | |
59 | 57 | ||
60 | 58 | ||
61 | 59 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
62 | 60 | ||
63 | 61 | ||
64 | 62 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
65 | 63 | case a: String => | |
66 | 64 | addressFromStringValue(a) | |
67 | 65 | case _ => | |
68 | 66 | Address(base58'') | |
69 | 67 | } | |
70 | 68 | ||
71 | 69 | ||
72 | 70 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
73 | 71 | ||
74 | 72 | ||
75 | 73 | func _loadGatewayContract () = match getString(KEY_GATEWAY_CONTRACT) { | |
76 | 74 | case a: String => | |
77 | 75 | addressFromStringValue(a) | |
78 | 76 | case _ => | |
79 | 77 | Address(base58'') | |
80 | 78 | } | |
81 | 79 | ||
82 | 80 | ||
83 | 81 | func _saveGatewayContract (gatewayContract_) = [StringEntry(KEY_GATEWAY_CONTRACT, toString(gatewayContract_))] | |
84 | 82 | ||
85 | 83 | ||
86 | 84 | func _loadMatcherContract () = match getString(KEY_MATCHER_CONTRACT) { | |
87 | 85 | case a: String => | |
88 | 86 | addressFromStringValue(a) | |
89 | 87 | case _ => | |
90 | 88 | Address(base58'') | |
91 | 89 | } | |
92 | 90 | ||
93 | 91 | ||
94 | 92 | func _saveMatcherContract (matcherContract_) = [StringEntry(KEY_MATCHER_CONTRACT, toString(matcherContract_))] | |
95 | 93 | ||
96 | 94 | ||
97 | 95 | func _loadUserBalance (user_,wallet_,currency_) = match getString(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR)) { | |
98 | 96 | case a: String => | |
99 | 97 | parseBigIntValue(a) | |
100 | 98 | case _ => | |
101 | 99 | ZERO_BIGINT | |
102 | 100 | } | |
103 | 101 | ||
104 | 102 | ||
105 | 103 | func _saveUserBalance (user_,wallet_,currency_,balance_) = [StringEntry(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR), toString(balance_))] | |
106 | 104 | ||
107 | 105 | ||
108 | 106 | func _loadTotalBalance (currency_) = match getString(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR)) { | |
109 | 107 | case a: String => | |
110 | 108 | parseBigIntValue(a) | |
111 | 109 | case _ => | |
112 | 110 | ZERO_BIGINT | |
113 | 111 | } | |
114 | 112 | ||
115 | 113 | ||
116 | 114 | func _saveTotalBalance (currency_,balance_) = [StringEntry(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR), toString(balance_))] | |
117 | 115 | ||
118 | 116 | ||
119 | 117 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
120 | 118 | then throw("_onlyThisContract: revert") | |
121 | 119 | else true | |
122 | 120 | ||
123 | 121 | ||
124 | 122 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
125 | 123 | then throw("_whenMultisigSet: revert") | |
126 | 124 | else true | |
127 | 125 | ||
128 | 126 | ||
129 | 127 | func _whenNotInitialized () = if (_loadInit()) | |
130 | 128 | then throw("_whenNotInitialized: revert") | |
131 | 129 | else true | |
132 | 130 | ||
133 | 131 | ||
134 | 132 | func _whenInitialized () = if (!(_loadInit())) | |
135 | 133 | then throw("_whenInitialized: revert") | |
136 | 134 | else true | |
137 | 135 | ||
138 | 136 | ||
139 | 137 | func _validateGateway (caller,err_) = if ((_loadGatewayContract() != caller)) | |
140 | 138 | then throw(err_) | |
141 | 139 | else true | |
142 | 140 | ||
143 | 141 | ||
144 | 142 | func _validateMatcher (caller,err_) = if ((_loadMatcherContract() != caller)) | |
145 | 143 | then throw(err_) | |
146 | 144 | else true | |
147 | 145 | ||
148 | 146 | ||
149 | 147 | @Callable(i) | |
150 | 148 | func init (gatewayContract_,matcherContract_) = { | |
151 | 149 | let err = if (if (if (if (_onlyThisContract(i.caller)) | |
152 | 150 | then _whenNotInitialized() | |
153 | 151 | else false) | |
154 | 152 | then _whenMultisigSet() | |
155 | 153 | else false) | |
156 | 154 | then _validateAddress(gatewayContract_, "init: invalid gatewayContract") | |
157 | 155 | else false) | |
158 | 156 | then _validateAddress(matcherContract_, "init: invalid matcherContract") | |
159 | 157 | else false | |
160 | 158 | if ((err == err)) | |
161 | 159 | then $Tuple2(((_saveInit(true) ++ _saveGatewayContract(addressFromStringValue(gatewayContract_))) ++ _saveMatcherContract(addressFromStringValue(matcherContract_))), unit) | |
162 | 160 | else throw("Strict value is not equal to itself.") | |
163 | 161 | } | |
164 | 162 | ||
165 | 163 | ||
166 | 164 | ||
167 | 165 | @Callable(i) | |
168 | 166 | func deposit (user_,currency_,amount_) = { | |
169 | 167 | let amount = valueOrErrorMessage(parseBigInt(amount_), "deposit: amount not int") | |
170 | 168 | let err = if (if (if (if (_whenInitialized()) | |
171 | 169 | then _validateString(user_, "deposit: invalid user") | |
172 | 170 | else false) | |
173 | 171 | then _validateString(currency_, "deposit: invalid currency") | |
174 | 172 | else false) | |
175 | 173 | then _validateBigInt(amount, ZERO_BIGINT, "deposit: invalid amount") | |
176 | 174 | else false) | |
177 | 175 | then _validateGateway(i.caller, "deposit: invalid caller") | |
178 | 176 | else false | |
179 | 177 | if ((err == err)) | |
180 | 178 | then { | |
181 | 179 | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
182 | 180 | $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
183 | 181 | } | |
184 | 182 | else throw("Strict value is not equal to itself.") | |
185 | 183 | } | |
186 | 184 | ||
187 | 185 | ||
188 | 186 | ||
189 | 187 | @Callable(i) | |
190 | 188 | func internalTransfer (user_,sourceWallet_,targetWallet_,currency_,amount_) = { | |
191 | 189 | let amount = valueOrErrorMessage(parseBigInt(amount_), "internalTransfer: amount not int") | |
192 | 190 | let err = if (if (if (if (if (if (_whenInitialized()) | |
193 | 191 | then _validateString(user_, "internalTransfer: invalid user") | |
194 | 192 | else false) | |
195 | 193 | then _validateString(sourceWallet_, "internalTransfer: invalid sourceWallet") | |
196 | 194 | else false) | |
197 | 195 | then _validateString(targetWallet_, "internalTransfer: invalid targetWallet") | |
198 | 196 | else false) | |
199 | 197 | then _validateString(currency_, "internalTransfer: invalid currency") | |
200 | 198 | else false) | |
201 | 199 | then _validateBigInt(amount, ZERO_BIGINT, "internalTransfer: invalid amount") | |
202 | 200 | else false) | |
203 | - | then if ((targetWallet_ == WITHDRAWALS_WALLET)) | |
204 | - | then _validateGateway(i.caller, "internalTransfer: invalid gw caller") | |
205 | - | else _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
201 | + | then _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
206 | 202 | else false | |
207 | 203 | if ((err == err)) | |
208 | 204 | then { | |
209 | 205 | let userSourceBalance = _loadUserBalance(user_, sourceWallet_, currency_) | |
210 | 206 | let userTargetBalance = _loadUserBalance(user_, targetWallet_, currency_) | |
211 | 207 | let newUserSourceBalance = (userSourceBalance - amount) | |
212 | 208 | let newUserTargetBalance = (userTargetBalance + amount) | |
213 | 209 | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "internalTransfer: insufficient amount") | |
214 | 210 | if ((err1 == err1)) | |
215 | 211 | then $Tuple2((_saveUserBalance(user_, sourceWallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(user_, targetWallet_, currency_, newUserTargetBalance)), unit) | |
216 | 212 | else throw("Strict value is not equal to itself.") | |
217 | 213 | } | |
218 | 214 | else throw("Strict value is not equal to itself.") | |
219 | 215 | } | |
220 | 216 | ||
221 | 217 | ||
222 | 218 | ||
223 | 219 | @Callable(i) | |
224 | 220 | func withdraw (user_,currency_,amount_) = { | |
225 | 221 | let amount = valueOrErrorMessage(parseBigInt(amount_), "withdraw: amount not int") | |
226 | 222 | let err = if (if (if (if (_whenInitialized()) | |
227 | 223 | then _validateString(user_, "withdraw: invalid user") | |
228 | 224 | else false) | |
229 | 225 | then _validateString(currency_, "withdraw: invalid currency") | |
230 | 226 | else false) | |
231 | 227 | then _validateBigInt(amount, ZERO_BIGINT, "withdraw: invalid amount") | |
232 | 228 | else false) | |
233 | 229 | then _validateGateway(i.caller, "withdraw: invalid caller") | |
234 | 230 | else false | |
235 | 231 | if ((err == err)) | |
236 | 232 | then { | |
237 | - | let userBalance = _loadUserBalance(user_, | |
233 | + | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
238 | 234 | let newUserBalance = (userBalance - amount) | |
239 | 235 | let newTotalBalance = (_loadTotalBalance(currency_) - amount) | |
240 | 236 | let err1 = if (_validateBigInt(newUserBalance, ZERO_BIGINT, "withdraw: insufficient amount")) | |
241 | 237 | then _validateBigInt(newTotalBalance, ZERO_BIGINT, "withdraw: negative total balance") | |
242 | 238 | else false | |
243 | 239 | if ((err1 == err1)) | |
244 | - | then $Tuple2((_saveUserBalance(user_, | |
240 | + | then $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, newUserBalance) ++ _saveTotalBalance(currency_, newTotalBalance)), unit) | |
245 | 241 | else throw("Strict value is not equal to itself.") | |
246 | 242 | } | |
247 | 243 | else throw("Strict value is not equal to itself.") | |
248 | 244 | } | |
249 | 245 | ||
250 | 246 | ||
251 | 247 | ||
252 | 248 | @Callable(i) | |
253 | 249 | func externalTransfer (wallet_,currency_,from_,to_,amount_,fee_,dex_) = { | |
254 | 250 | let amount = valueOrErrorMessage(parseBigInt(amount_), "externalTransfer: amount not int") | |
255 | 251 | let fee = valueOrErrorMessage(parseBigInt(fee_), "externalTransfer: fee not int") | |
256 | 252 | let err = if (if (if (if (if (if (if (if (_whenInitialized()) | |
257 | 253 | then _validateString(wallet_, "externalTransfer: invalid wallet") | |
258 | 254 | else false) | |
259 | 255 | then _validateString(currency_, "externalTransfer: invalid currency") | |
260 | 256 | else false) | |
261 | 257 | then _validateString(from_, "externalTransfer: invalid from") | |
262 | 258 | else false) | |
263 | 259 | then _validateString(to_, "externalTransfer: invalid to") | |
264 | 260 | else false) | |
265 | 261 | then _validateBigInt(amount, ZERO_BIGINT, "externalTransfer: invalid amount") | |
266 | 262 | else false) | |
267 | 263 | then _validateBigInt(fee, ZERO_BIGINT, "externalTransfer: invalid fee") | |
268 | 264 | else false) | |
269 | 265 | then _validateString(dex_, "externalTransfer: invalid dex") | |
270 | 266 | else false) | |
271 | 267 | then _validateMatcher(i.caller, "externalTransfer: invalid matcher caller") | |
272 | 268 | else false | |
273 | 269 | if ((err == err)) | |
274 | 270 | then { | |
275 | 271 | let userSourceBalance = _loadUserBalance(from_, wallet_, currency_) | |
276 | 272 | let userTargetBalance = _loadUserBalance(to_, wallet_, currency_) | |
277 | 273 | let dexTargetBalance = _loadUserBalance(dex_, wallet_, currency_) | |
278 | 274 | let newUserSourceBalance = ((userSourceBalance - amount) - fee) | |
279 | 275 | let newUserTargetBalance = (userTargetBalance + amount) | |
280 | 276 | let newDexTargetBalance = (dexTargetBalance + fee) | |
281 | 277 | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "externalTransfer: insufficient amount") | |
282 | 278 | if ((err1 == err1)) | |
283 | 279 | then $Tuple2(((_saveUserBalance(from_, wallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(to_, wallet_, currency_, newUserTargetBalance)) ++ _saveUserBalance(dex_, wallet_, currency_, newDexTargetBalance)), unit) | |
284 | 280 | else throw("Strict value is not equal to itself.") | |
285 | 281 | } | |
286 | 282 | else throw("Strict value is not equal to itself.") | |
287 | 283 | } | |
288 | 284 | ||
289 | 285 | ||
290 | 286 | ||
291 | 287 | @Callable(i) | |
292 | 288 | func depositStakingReward (dex_,currency_,amount_) = { | |
293 | 289 | let amount = valueOrErrorMessage(parseBigInt(amount_), "depositStakingReward: amount not int") | |
294 | 290 | let err = if (if (if (if (_whenInitialized()) | |
295 | 291 | then _validateString(dex_, "depositStakingReward: invalid dex") | |
296 | 292 | else false) | |
297 | 293 | then _validateString(currency_, "depositStakingReward: invalid currency") | |
298 | 294 | else false) | |
299 | 295 | then _validateBigInt(amount, ZERO_BIGINT, "depositStakingReward: invalid amount") | |
300 | 296 | else false) | |
301 | 297 | then _validateGateway(i.caller, "depositStakingReward: invalid caller") | |
302 | 298 | else false | |
303 | 299 | if ((err == err)) | |
304 | 300 | then { | |
305 | 301 | let userBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
306 | 302 | $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
307 | 303 | } | |
308 | 304 | else throw("Strict value is not equal to itself.") | |
309 | 305 | } | |
310 | 306 | ||
311 | 307 | ||
312 | 308 | ||
313 | 309 | @Callable(i) | |
314 | 310 | func claimReward (dex_,user_,currency_,amount_) = { | |
315 | 311 | let amount = valueOrErrorMessage(parseBigInt(amount_), "claimReward: amount not int") | |
316 | 312 | let err = if (if (if (if (if (_whenInitialized()) | |
317 | 313 | then _validateString(dex_, "claimReward: invalid dex") | |
318 | 314 | else false) | |
319 | 315 | then _validateString(user_, "claimReward: invalid user") | |
320 | 316 | else false) | |
321 | 317 | then _validateString(currency_, "claimReward: invalid currency") | |
322 | 318 | else false) | |
323 | 319 | then _validateBigInt(amount, ZERO_BIGINT, "claimReward: invalid amount") | |
324 | 320 | else false) | |
325 | 321 | then _validateMatcher(i.caller, "claimReward: invalid matcher caller") | |
326 | 322 | else false | |
327 | 323 | if ((err == err)) | |
328 | 324 | then { | |
329 | 325 | let dexSourceBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
330 | 326 | let userTargetBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
331 | 327 | let newDexSourceBalance = (dexSourceBalance - amount) | |
332 | 328 | let newUserTargetBalance = (userTargetBalance + amount) | |
333 | 329 | let err1 = _validateBigInt(newDexSourceBalance, ZERO_BIGINT, "claimReward: insufficient amount") | |
334 | 330 | if ((err1 == err1)) | |
335 | 331 | then $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, newDexSourceBalance) ++ _saveUserBalance(user_, SPOT_WALLET, currency_, newUserTargetBalance)), unit) | |
336 | 332 | else throw("Strict value is not equal to itself.") | |
337 | 333 | } | |
338 | 334 | else throw("Strict value is not equal to itself.") | |
339 | 335 | } | |
340 | 336 | ||
341 | 337 | ||
342 | 338 | ||
343 | 339 | @Callable(i) | |
344 | 340 | func getUserBalance (user_,wallet_,currency_) = $Tuple2(nil, toString(_loadUserBalance(user_, wallet_, currency_))) | |
345 | 341 | ||
346 | 342 | ||
347 | 343 | ||
348 | 344 | @Callable(i) | |
349 | 345 | func setMultisig (multisig_) = { | |
350 | 346 | let err = if (_onlyThisContract(i.caller)) | |
351 | 347 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
352 | 348 | else false | |
353 | 349 | if ((err == err)) | |
354 | 350 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
355 | 351 | else throw("Strict value is not equal to itself.") | |
356 | 352 | } | |
357 | 353 | ||
358 | 354 | ||
359 | 355 | @Verifier(tx) | |
360 | 356 | func verify () = match tx { | |
361 | 357 | case _ => | |
362 | 358 | match getString(KEY_MULTISIG) { | |
363 | 359 | case multisig: String => | |
364 | 360 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
365 | 361 | case _ => | |
366 | 362 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
367 | 363 | } | |
368 | 364 | } | |
369 | 365 |
github/deemru/w8io/026f985 36.64 ms ◑