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