tx · 9jHv5oDfMCDxpgAAs7dhEV46ZZx6TXN1qpXqFqX6p2av 3Mzj8MyE3E3G55SLVE6Dgd6ew2uERLxiE4U: -0.01300000 Waves 2022.10.06 13:00 [2260312] smart account 3Mzj8MyE3E3G55SLVE6Dgd6ew2uERLxiE4U > SELF 0.00000000 Waves
{ "type": 13, "id": "9jHv5oDfMCDxpgAAs7dhEV46ZZx6TXN1qpXqFqX6p2av", "fee": 1300000, "feeAssetId": null, "timestamp": 1665050450953, "version": 1, "sender": "3Mzj8MyE3E3G55SLVE6Dgd6ew2uERLxiE4U", "senderPublicKey": "8E1ZoUTJyyA7ybXtP2NxUZKdAwvR1ruiQUxZD2bYJJMF", "proofs": [ "4T7ZkPNMySRf67wwFzyQin1XdJ5bfb5T6UsXJbH9ToGexiPuKeqGgajneMGh1EuouTv6jhjdzrkDTiGqbev9Leut" ], "script": "base64:BgIyCAISAwoBARIDCgEBEgMKAQESAwoBARIDCgEBEgQKAggIEgASABIECgIBARIDCgEIEgAdAA9kZWNpbWFsUGFydFVTRE4AwIQ9AA9kZWNpbWFsUGFydFVTRFQAwIQ9ARBrZXlXaXRoZHJhd0RlbGF5AAIRJXNfX3dpdGhkcmF3RGVsYXkBDXdpdGhkcmF3RGVsYXkACQEFdmFsdWUBCQCfCAEJARBrZXlXaXRoZHJhd0RlbGF5AAEaa2V5TWluaW1hbEFtb3VudFRvU3dhcFVzZHQAAhslc19fbWluaW1hbEFtb3VudFRvU3dhcFVzZHQBGmtleU1pbmltYWxBbW91bnRUb1N3YXBVc2RuAAIbJXNfX21pbmltYWxBbW91bnRUb1N3YXBVc2RuAQdtaW5Vc2R0AAkBBXZhbHVlAQkAnwgBCQEaa2V5TWluaW1hbEFtb3VudFRvU3dhcFVzZHQAAQdtaW5Vc2RuAAkBBXZhbHVlAQkAnwgBCQEaa2V5TWluaW1hbEFtb3VudFRvU3dhcFVzZG4AARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsa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nZXRQdWJsaWNLZXnjqRI8", "chainId": 84, "height": 2260312, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BgAWhTVAB8txyCkXQynBZC4vz46AgD4QrHb5Pw4yU2kt Next: 9Lf5GmCuun9BS4LwrKkw5dmLhePGexTRFDuwtAbp1jnn Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let decimalPartUSDN = 1000000 | |
5 | + | ||
6 | + | let decimalPartUSDT = 1000000 | |
7 | + | ||
8 | + | func keyWithdrawDelay () = "%s__withdrawDelay" | |
9 | + | ||
10 | + | ||
11 | + | func withdrawDelay () = value(getInteger(keyWithdrawDelay())) | |
12 | + | ||
13 | + | ||
14 | + | func keyMinimalAmountToSwapUsdt () = "%s__minimalAmountToSwapUsdt" | |
15 | + | ||
16 | + | ||
17 | + | func keyMinimalAmountToSwapUsdn () = "%s__minimalAmountToSwapUsdn" | |
18 | + | ||
19 | + | ||
20 | + | func minUsdt () = value(getInteger(keyMinimalAmountToSwapUsdt())) | |
21 | + | ||
22 | + | ||
23 | + | func minUsdn () = value(getInteger(keyMinimalAmountToSwapUsdn())) | |
24 | + | ||
25 | + | ||
4 | 26 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
5 | 27 | ||
6 | 28 | ||
7 | 29 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
30 | + | ||
31 | + | ||
32 | + | func keyUsdtAssetId () = "%s__usdtAssetId" | |
33 | + | ||
34 | + | ||
35 | + | func keyUsdnAssetId () = "%s__usdnAssetId" | |
36 | + | ||
37 | + | ||
38 | + | func keyDepositFee () = "%s__depositFee" | |
39 | + | ||
40 | + | ||
41 | + | func keyWithdrawFee () = "%s__withdrawFee" | |
42 | + | ||
43 | + | ||
44 | + | func usdt () = fromBase58String(value(getString(keyUsdtAssetId()))) | |
45 | + | ||
46 | + | ||
47 | + | func usdn () = fromBase58String(value(getString(keyUsdnAssetId()))) | |
8 | 48 | ||
9 | 49 | ||
10 | 50 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
27 | 67 | } | |
28 | 68 | ||
29 | 69 | ||
70 | + | func collectKey (address,amountToSwapInKey,allowToWithdrawHeight) = makeString([address, "WITHDRAW", toString(amountToSwapInKey), "HEIGHT", toString(allowToWithdrawHeight)], "_") | |
71 | + | ||
72 | + | ||
73 | + | func collectBalanceKey (address) = makeString([address, "balance"], "_") | |
74 | + | ||
75 | + | ||
76 | + | func collectBalanceKeyWithFee (address) = makeString([address, "balance_with_fee"], "_") | |
77 | + | ||
78 | + | ||
79 | + | func usdtToUsdnAssetError () = throw("To swap USDT to USDN you need attach payment in USDT") | |
80 | + | ||
81 | + | ||
82 | + | func usdnToUsdtAssetError () = throw("To swap USDN to USDT you need attach payment in USDN") | |
83 | + | ||
84 | + | ||
85 | + | func usdtToUsdnLowLimitError () = throw((("you can swap at least " + toString((minUsdt() / decimalPartUSDT))) + " tokens")) | |
86 | + | ||
87 | + | ||
88 | + | func abs (n) = if ((0 > n)) | |
89 | + | then (n * -1) | |
90 | + | else n | |
91 | + | ||
92 | + | ||
93 | + | func getWithoutFeeWithdraw (amount,balanceWithoutFee) = min([amount, balanceWithoutFee]) | |
94 | + | ||
95 | + | ||
96 | + | func getListElementOrDefault (list,index,default) = if ((size(list) > index)) | |
97 | + | then list[index] | |
98 | + | else default | |
99 | + | ||
100 | + | ||
101 | + | func currentWithdrawals (address,amount) = { | |
102 | + | let balanceKey = collectBalanceKey(address) | |
103 | + | let balanceWithFeeKey = collectBalanceKeyWithFee(address) | |
104 | + | let currentClientBalance = valueOrElse(getInteger(this, balanceKey), 0) | |
105 | + | let currentClientBalanceWithFee = valueOrElse(getInteger(this, balanceWithFeeKey), 0) | |
106 | + | let userBalance = (currentClientBalance + currentClientBalanceWithFee) | |
107 | + | if (if ((amount > userBalance)) | |
108 | + | then true | |
109 | + | else (minUsdn() > amount)) | |
110 | + | then throw("Swap amount fail, amount is to small or to big.") | |
111 | + | else { | |
112 | + | let toWithdrawWithoutFee = getWithoutFeeWithdraw(amount, currentClientBalance) | |
113 | + | let toWithdrawWithFee = (amount - toWithdrawWithoutFee) | |
114 | + | let fee = ((toWithdrawWithFee / 100) * value(getInteger(keyWithdrawFee()))) | |
115 | + | [toWithdrawWithoutFee, toWithdrawWithFee, fee] | |
116 | + | } | |
117 | + | } | |
118 | + | ||
119 | + | ||
30 | 120 | func mustManager (i) = { | |
31 | 121 | let pd = throw("Permission denied") | |
32 | 122 | match managerPublicKeyOrUnit() { | |
42 | 132 | throw("Match error") | |
43 | 133 | } | |
44 | 134 | } | |
135 | + | ||
136 | + | ||
137 | + | @Callable(i) | |
138 | + | func setWithdrawDelay (newWithdrawDelay) = { | |
139 | + | let checkCaller = mustManager(i) | |
140 | + | if ((checkCaller == checkCaller)) | |
141 | + | then [IntegerEntry(keyWithdrawDelay(), newWithdrawDelay)] | |
142 | + | else throw("Strict value is not equal to itself.") | |
143 | + | } | |
144 | + | ||
145 | + | ||
146 | + | ||
147 | + | @Callable(i) | |
148 | + | func setMinimalAmountToSwapUsdt (newMinimalAmount) = { | |
149 | + | let checkCaller = mustManager(i) | |
150 | + | if ((checkCaller == checkCaller)) | |
151 | + | then [IntegerEntry(keyMinimalAmountToSwapUsdt(), newMinimalAmount)] | |
152 | + | else throw("Strict value is not equal to itself.") | |
153 | + | } | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func setMinimalAmountToSwapUsdn (newMinimalAmount) = { | |
159 | + | let checkCaller = mustManager(i) | |
160 | + | if ((checkCaller == checkCaller)) | |
161 | + | then [IntegerEntry(keyMinimalAmountToSwapUsdn(), newMinimalAmount)] | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(i) | |
168 | + | func setWithdrawFee (newFee) = { | |
169 | + | let checkCaller = mustManager(i) | |
170 | + | if ((checkCaller == checkCaller)) | |
171 | + | then [IntegerEntry(keyWithdrawFee(), newFee)] | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | @Callable(i) | |
178 | + | func setDepositFee (newFee) = { | |
179 | + | let checkCaller = mustManager(i) | |
180 | + | if ((checkCaller == checkCaller)) | |
181 | + | then [IntegerEntry(keyDepositFee(), newFee)] | |
182 | + | else throw("Strict value is not equal to itself.") | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | @Callable(i) | |
188 | + | func constructor (usdtAssetId,usdnAssetId) = { | |
189 | + | let checkCaller = mustManager(i) | |
190 | + | if ((checkCaller == checkCaller)) | |
191 | + | then [StringEntry(keyUsdtAssetId(), usdtAssetId), StringEntry(keyUsdnAssetId(), usdnAssetId)] | |
192 | + | else throw("Strict value is not equal to itself.") | |
193 | + | } | |
194 | + | ||
195 | + | ||
196 | + | ||
197 | + | @Callable(invoke) | |
198 | + | func swapUSDTtoUSDN () = { | |
199 | + | let balanceKey = collectBalanceKeyWithFee(toString(invoke.caller)) | |
200 | + | let payment = value(invoke.payments[0]) | |
201 | + | if ((payment.assetId != usdt())) | |
202 | + | then usdtToUsdnAssetError() | |
203 | + | else { | |
204 | + | let amount = payment.amount | |
205 | + | let fee = ((amount / 100) * value(getInteger(keyDepositFee()))) | |
206 | + | let currentClientBalanceUSDT = valueOrElse(getInteger(this, balanceKey), 0) | |
207 | + | if ((minUsdt() > amount)) | |
208 | + | then usdtToUsdnLowLimitError() | |
209 | + | else [IntegerEntry(balanceKey, (currentClientBalanceUSDT + amount)), ScriptTransfer(invoke.caller, (amount - fee), usdn())] | |
210 | + | } | |
211 | + | } | |
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | @Callable(invoke) | |
216 | + | func initializationUSDNtoUSDTswap () = { | |
217 | + | let payment = value(invoke.payments[0]) | |
218 | + | let address = toString(invoke.caller) | |
219 | + | if ((payment.assetId != usdn())) | |
220 | + | then usdnToUsdtAssetError() | |
221 | + | else { | |
222 | + | let amount = payment.amount | |
223 | + | let balanceKey = collectBalanceKey(address) | |
224 | + | let balanceWithFeeKey = collectBalanceKeyWithFee(address) | |
225 | + | let currentClientBalance = valueOrElse(getInteger(this, balanceKey), 0) | |
226 | + | let currentClientBalanceWithFee = valueOrElse(getInteger(this, balanceWithFeeKey), 0) | |
227 | + | let userBalance = (currentClientBalance + currentClientBalanceWithFee) | |
228 | + | let data = currentWithdrawals(toString(invoke.caller), amount) | |
229 | + | let toWithdrawWithoutFee = valueOrErrorMessage(data[0], "Wrong 'currentWithdrawals' method!") | |
230 | + | let toWithdrawWithFee = valueOrErrorMessage(data[1], "Wrong 'currentWithdrawals' method!") | |
231 | + | let fee = valueOrErrorMessage(data[2], "Wrong 'currentWithdrawals' method!") | |
232 | + | let total = ((toWithdrawWithFee + toWithdrawWithoutFee) - fee) | |
233 | + | let allowToWithDrawHeight = (height + withdrawDelay()) | |
234 | + | if (isDefined(getString(this, collectKey(toString(invoke.caller), amount, allowToWithDrawHeight)))) | |
235 | + | then throw("You have already started withdrawal process, wait next block.") | |
236 | + | else [IntegerEntry(balanceKey, (currentClientBalance - toWithdrawWithoutFee)), IntegerEntry(balanceWithFeeKey, (currentClientBalanceWithFee - toWithdrawWithFee)), StringEntry(collectKey(toString(invoke.caller), amount, allowToWithDrawHeight), makeString(["not_withdrawn", toString((amount - fee))], "_"))] | |
237 | + | } | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | @Callable(invoke) | |
243 | + | func swapUSDNtoUSDT (amount,heightInKey) = { | |
244 | + | let key = collectKey(toString(invoke.caller), amount, heightInKey) | |
245 | + | let withdrawnInfo = valueOrErrorMessage(getString(this, key), ((("This key doesn't exists " + key) + " at address ") + toString(this))) | |
246 | + | let toWithdraw = getListElementOrDefault(split(withdrawnInfo, "_"), 2, toString(amount)) | |
247 | + | if (if ((height >= heightInKey)) | |
248 | + | then contains(withdrawnInfo, "not_withdrawn") | |
249 | + | else false) | |
250 | + | then [DeleteEntry(key), ScriptTransfer(invoke.caller, valueOrErrorMessage(parseInt(toWithdraw), "Wrong withdraw data!"), usdt())] | |
251 | + | else throw((("Withdrawal is possible after " + toString(heightInKey)) + " height or you have already withdrawn USDT.")) | |
252 | + | } | |
253 | + | ||
45 | 254 | ||
46 | 255 | ||
47 | 256 | @Callable(i) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let decimalPartUSDN = 1000000 | |
5 | + | ||
6 | + | let decimalPartUSDT = 1000000 | |
7 | + | ||
8 | + | func keyWithdrawDelay () = "%s__withdrawDelay" | |
9 | + | ||
10 | + | ||
11 | + | func withdrawDelay () = value(getInteger(keyWithdrawDelay())) | |
12 | + | ||
13 | + | ||
14 | + | func keyMinimalAmountToSwapUsdt () = "%s__minimalAmountToSwapUsdt" | |
15 | + | ||
16 | + | ||
17 | + | func keyMinimalAmountToSwapUsdn () = "%s__minimalAmountToSwapUsdn" | |
18 | + | ||
19 | + | ||
20 | + | func minUsdt () = value(getInteger(keyMinimalAmountToSwapUsdt())) | |
21 | + | ||
22 | + | ||
23 | + | func minUsdn () = value(getInteger(keyMinimalAmountToSwapUsdn())) | |
24 | + | ||
25 | + | ||
4 | 26 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
5 | 27 | ||
6 | 28 | ||
7 | 29 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
30 | + | ||
31 | + | ||
32 | + | func keyUsdtAssetId () = "%s__usdtAssetId" | |
33 | + | ||
34 | + | ||
35 | + | func keyUsdnAssetId () = "%s__usdnAssetId" | |
36 | + | ||
37 | + | ||
38 | + | func keyDepositFee () = "%s__depositFee" | |
39 | + | ||
40 | + | ||
41 | + | func keyWithdrawFee () = "%s__withdrawFee" | |
42 | + | ||
43 | + | ||
44 | + | func usdt () = fromBase58String(value(getString(keyUsdtAssetId()))) | |
45 | + | ||
46 | + | ||
47 | + | func usdn () = fromBase58String(value(getString(keyUsdnAssetId()))) | |
8 | 48 | ||
9 | 49 | ||
10 | 50 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
11 | 51 | case s: String => | |
12 | 52 | fromBase58String(s) | |
13 | 53 | case _: Unit => | |
14 | 54 | unit | |
15 | 55 | case _ => | |
16 | 56 | throw("Match error") | |
17 | 57 | } | |
18 | 58 | ||
19 | 59 | ||
20 | 60 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
21 | 61 | case s: String => | |
22 | 62 | fromBase58String(s) | |
23 | 63 | case _: Unit => | |
24 | 64 | unit | |
25 | 65 | case _ => | |
26 | 66 | throw("Match error") | |
27 | 67 | } | |
28 | 68 | ||
29 | 69 | ||
70 | + | func collectKey (address,amountToSwapInKey,allowToWithdrawHeight) = makeString([address, "WITHDRAW", toString(amountToSwapInKey), "HEIGHT", toString(allowToWithdrawHeight)], "_") | |
71 | + | ||
72 | + | ||
73 | + | func collectBalanceKey (address) = makeString([address, "balance"], "_") | |
74 | + | ||
75 | + | ||
76 | + | func collectBalanceKeyWithFee (address) = makeString([address, "balance_with_fee"], "_") | |
77 | + | ||
78 | + | ||
79 | + | func usdtToUsdnAssetError () = throw("To swap USDT to USDN you need attach payment in USDT") | |
80 | + | ||
81 | + | ||
82 | + | func usdnToUsdtAssetError () = throw("To swap USDN to USDT you need attach payment in USDN") | |
83 | + | ||
84 | + | ||
85 | + | func usdtToUsdnLowLimitError () = throw((("you can swap at least " + toString((minUsdt() / decimalPartUSDT))) + " tokens")) | |
86 | + | ||
87 | + | ||
88 | + | func abs (n) = if ((0 > n)) | |
89 | + | then (n * -1) | |
90 | + | else n | |
91 | + | ||
92 | + | ||
93 | + | func getWithoutFeeWithdraw (amount,balanceWithoutFee) = min([amount, balanceWithoutFee]) | |
94 | + | ||
95 | + | ||
96 | + | func getListElementOrDefault (list,index,default) = if ((size(list) > index)) | |
97 | + | then list[index] | |
98 | + | else default | |
99 | + | ||
100 | + | ||
101 | + | func currentWithdrawals (address,amount) = { | |
102 | + | let balanceKey = collectBalanceKey(address) | |
103 | + | let balanceWithFeeKey = collectBalanceKeyWithFee(address) | |
104 | + | let currentClientBalance = valueOrElse(getInteger(this, balanceKey), 0) | |
105 | + | let currentClientBalanceWithFee = valueOrElse(getInteger(this, balanceWithFeeKey), 0) | |
106 | + | let userBalance = (currentClientBalance + currentClientBalanceWithFee) | |
107 | + | if (if ((amount > userBalance)) | |
108 | + | then true | |
109 | + | else (minUsdn() > amount)) | |
110 | + | then throw("Swap amount fail, amount is to small or to big.") | |
111 | + | else { | |
112 | + | let toWithdrawWithoutFee = getWithoutFeeWithdraw(amount, currentClientBalance) | |
113 | + | let toWithdrawWithFee = (amount - toWithdrawWithoutFee) | |
114 | + | let fee = ((toWithdrawWithFee / 100) * value(getInteger(keyWithdrawFee()))) | |
115 | + | [toWithdrawWithoutFee, toWithdrawWithFee, fee] | |
116 | + | } | |
117 | + | } | |
118 | + | ||
119 | + | ||
30 | 120 | func mustManager (i) = { | |
31 | 121 | let pd = throw("Permission denied") | |
32 | 122 | match managerPublicKeyOrUnit() { | |
33 | 123 | case pk: ByteVector => | |
34 | 124 | if ((i.callerPublicKey == pk)) | |
35 | 125 | then true | |
36 | 126 | else pd | |
37 | 127 | case _: Unit => | |
38 | 128 | if ((i.caller == this)) | |
39 | 129 | then true | |
40 | 130 | else pd | |
41 | 131 | case _ => | |
42 | 132 | throw("Match error") | |
43 | 133 | } | |
44 | 134 | } | |
135 | + | ||
136 | + | ||
137 | + | @Callable(i) | |
138 | + | func setWithdrawDelay (newWithdrawDelay) = { | |
139 | + | let checkCaller = mustManager(i) | |
140 | + | if ((checkCaller == checkCaller)) | |
141 | + | then [IntegerEntry(keyWithdrawDelay(), newWithdrawDelay)] | |
142 | + | else throw("Strict value is not equal to itself.") | |
143 | + | } | |
144 | + | ||
145 | + | ||
146 | + | ||
147 | + | @Callable(i) | |
148 | + | func setMinimalAmountToSwapUsdt (newMinimalAmount) = { | |
149 | + | let checkCaller = mustManager(i) | |
150 | + | if ((checkCaller == checkCaller)) | |
151 | + | then [IntegerEntry(keyMinimalAmountToSwapUsdt(), newMinimalAmount)] | |
152 | + | else throw("Strict value is not equal to itself.") | |
153 | + | } | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func setMinimalAmountToSwapUsdn (newMinimalAmount) = { | |
159 | + | let checkCaller = mustManager(i) | |
160 | + | if ((checkCaller == checkCaller)) | |
161 | + | then [IntegerEntry(keyMinimalAmountToSwapUsdn(), newMinimalAmount)] | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(i) | |
168 | + | func setWithdrawFee (newFee) = { | |
169 | + | let checkCaller = mustManager(i) | |
170 | + | if ((checkCaller == checkCaller)) | |
171 | + | then [IntegerEntry(keyWithdrawFee(), newFee)] | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | @Callable(i) | |
178 | + | func setDepositFee (newFee) = { | |
179 | + | let checkCaller = mustManager(i) | |
180 | + | if ((checkCaller == checkCaller)) | |
181 | + | then [IntegerEntry(keyDepositFee(), newFee)] | |
182 | + | else throw("Strict value is not equal to itself.") | |
183 | + | } | |
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | @Callable(i) | |
188 | + | func constructor (usdtAssetId,usdnAssetId) = { | |
189 | + | let checkCaller = mustManager(i) | |
190 | + | if ((checkCaller == checkCaller)) | |
191 | + | then [StringEntry(keyUsdtAssetId(), usdtAssetId), StringEntry(keyUsdnAssetId(), usdnAssetId)] | |
192 | + | else throw("Strict value is not equal to itself.") | |
193 | + | } | |
194 | + | ||
195 | + | ||
196 | + | ||
197 | + | @Callable(invoke) | |
198 | + | func swapUSDTtoUSDN () = { | |
199 | + | let balanceKey = collectBalanceKeyWithFee(toString(invoke.caller)) | |
200 | + | let payment = value(invoke.payments[0]) | |
201 | + | if ((payment.assetId != usdt())) | |
202 | + | then usdtToUsdnAssetError() | |
203 | + | else { | |
204 | + | let amount = payment.amount | |
205 | + | let fee = ((amount / 100) * value(getInteger(keyDepositFee()))) | |
206 | + | let currentClientBalanceUSDT = valueOrElse(getInteger(this, balanceKey), 0) | |
207 | + | if ((minUsdt() > amount)) | |
208 | + | then usdtToUsdnLowLimitError() | |
209 | + | else [IntegerEntry(balanceKey, (currentClientBalanceUSDT + amount)), ScriptTransfer(invoke.caller, (amount - fee), usdn())] | |
210 | + | } | |
211 | + | } | |
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | @Callable(invoke) | |
216 | + | func initializationUSDNtoUSDTswap () = { | |
217 | + | let payment = value(invoke.payments[0]) | |
218 | + | let address = toString(invoke.caller) | |
219 | + | if ((payment.assetId != usdn())) | |
220 | + | then usdnToUsdtAssetError() | |
221 | + | else { | |
222 | + | let amount = payment.amount | |
223 | + | let balanceKey = collectBalanceKey(address) | |
224 | + | let balanceWithFeeKey = collectBalanceKeyWithFee(address) | |
225 | + | let currentClientBalance = valueOrElse(getInteger(this, balanceKey), 0) | |
226 | + | let currentClientBalanceWithFee = valueOrElse(getInteger(this, balanceWithFeeKey), 0) | |
227 | + | let userBalance = (currentClientBalance + currentClientBalanceWithFee) | |
228 | + | let data = currentWithdrawals(toString(invoke.caller), amount) | |
229 | + | let toWithdrawWithoutFee = valueOrErrorMessage(data[0], "Wrong 'currentWithdrawals' method!") | |
230 | + | let toWithdrawWithFee = valueOrErrorMessage(data[1], "Wrong 'currentWithdrawals' method!") | |
231 | + | let fee = valueOrErrorMessage(data[2], "Wrong 'currentWithdrawals' method!") | |
232 | + | let total = ((toWithdrawWithFee + toWithdrawWithoutFee) - fee) | |
233 | + | let allowToWithDrawHeight = (height + withdrawDelay()) | |
234 | + | if (isDefined(getString(this, collectKey(toString(invoke.caller), amount, allowToWithDrawHeight)))) | |
235 | + | then throw("You have already started withdrawal process, wait next block.") | |
236 | + | else [IntegerEntry(balanceKey, (currentClientBalance - toWithdrawWithoutFee)), IntegerEntry(balanceWithFeeKey, (currentClientBalanceWithFee - toWithdrawWithFee)), StringEntry(collectKey(toString(invoke.caller), amount, allowToWithDrawHeight), makeString(["not_withdrawn", toString((amount - fee))], "_"))] | |
237 | + | } | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | @Callable(invoke) | |
243 | + | func swapUSDNtoUSDT (amount,heightInKey) = { | |
244 | + | let key = collectKey(toString(invoke.caller), amount, heightInKey) | |
245 | + | let withdrawnInfo = valueOrErrorMessage(getString(this, key), ((("This key doesn't exists " + key) + " at address ") + toString(this))) | |
246 | + | let toWithdraw = getListElementOrDefault(split(withdrawnInfo, "_"), 2, toString(amount)) | |
247 | + | if (if ((height >= heightInKey)) | |
248 | + | then contains(withdrawnInfo, "not_withdrawn") | |
249 | + | else false) | |
250 | + | then [DeleteEntry(key), ScriptTransfer(invoke.caller, valueOrErrorMessage(parseInt(toWithdraw), "Wrong withdraw data!"), usdt())] | |
251 | + | else throw((("Withdrawal is possible after " + toString(heightInKey)) + " height or you have already withdrawn USDT.")) | |
252 | + | } | |
253 | + | ||
45 | 254 | ||
46 | 255 | ||
47 | 256 | @Callable(i) | |
48 | 257 | func setManager (pendingManagerPublicKey) = { | |
49 | 258 | let checkCaller = mustManager(i) | |
50 | 259 | if ((checkCaller == checkCaller)) | |
51 | 260 | then { | |
52 | 261 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
53 | 262 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
54 | 263 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
55 | 264 | else throw("Strict value is not equal to itself.") | |
56 | 265 | } | |
57 | 266 | else throw("Strict value is not equal to itself.") | |
58 | 267 | } | |
59 | 268 | ||
60 | 269 | ||
61 | 270 | ||
62 | 271 | @Callable(i) | |
63 | 272 | func confirmManager () = { | |
64 | 273 | let pm = pendingManagerPublicKeyOrUnit() | |
65 | 274 | let hasPM = if (isDefined(pm)) | |
66 | 275 | then true | |
67 | 276 | else throw("No pending manager") | |
68 | 277 | if ((hasPM == hasPM)) | |
69 | 278 | then { | |
70 | 279 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
71 | 280 | then true | |
72 | 281 | else throw("You are not pending manager") | |
73 | 282 | if ((checkPM == checkPM)) | |
74 | 283 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
75 | 284 | else throw("Strict value is not equal to itself.") | |
76 | 285 | } | |
77 | 286 | else throw("Strict value is not equal to itself.") | |
78 | 287 | } | |
79 | 288 | ||
80 | 289 | ||
81 | 290 | @Verifier(tx) | |
82 | 291 | func verify () = { | |
83 | 292 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
84 | 293 | case pk: ByteVector => | |
85 | 294 | pk | |
86 | 295 | case _: Unit => | |
87 | 296 | tx.senderPublicKey | |
88 | 297 | case _ => | |
89 | 298 | throw("Match error") | |
90 | 299 | } | |
91 | 300 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
92 | 301 | } | |
93 | 302 |
github/deemru/w8io/169f3d6 36.07 ms ◑