tx · FecnB2t2t1tnm7CExkFGJSt9vGjZCS3Uoqzo8Sy1nELb

3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5:  -0.01300000 Waves

2022.10.20 11:14 [2280469] smart account 3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5 > SELF 0.00000000 Waves

{ "type": 13, "id": "FecnB2t2t1tnm7CExkFGJSt9vGjZCS3Uoqzo8Sy1nELb", "fee": 1300000, "feeAssetId": null, "timestamp": 1666253777913, "version": 1, "sender": "3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5", "senderPublicKey": "GSAhb4fdky75LiCZ4p4DDK4rmWpmsgGBg1ZVdtPfmRES", "proofs": [ "MpiwNHqYPTLjNKJGQsowUG3Krzedn8rtEwfqZBAUkrDw125iWDU4PoF5VDdg8xnFWM3DbQGJcFvFcc2ENVC1PmA" ], "script": "base64:BgKpCAgCEgoKCAgIAQEBAQEBEgMKAQgSAwoBCBIFCgMICAESBAoCCAgSAwoBCBIAIgNTRVAiE2tleU1hbmFnZXJQdWJsaWNLZXkiGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5IhBrZXlXaXRoZHJhd0RlbGF5IgZhc3NldEEiBmFzc2V0QiIVa2V5RGVwb3NpdEZlZVBlcm1pbGxlIhZrZXlXaXRoZHJhd0ZlZVBlcm1pbGxlIhNrZXlNaW5BbW91bnREZXBvc2l0IhNrZXlBc3NldHNQYWlyU3RhdHVzIhRrZXlNaW5BbW91bnRXaXRoZHJhdyIKa2V5QmFsYW5jZSILdXNlckFkZHJlc3MiG2tleVRvdGFsRmVlQ29sbGVjdGVkRGVwb3NpdCIca2V5VG90YWxGZWVDb2xsZWN0ZWRXaXRoZHJhdyIUa2V5UHJvY2Vzc0luUHJvZ3Jlc3MiC2hlaWdodEluS2V5Ig5rZXlQcm9jZXNzRG9uZSIWbWFuYWdlclB1YmxpY0tleU9yVW5pdCIHJG1hdGNoMCIBcyIdcGVuZGluZ01hbmFnZXJQdWJsaWNLZ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3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BeAEOY29uZmlybU1hbmFnZXIABAJhawkBAXYABAJhbAMJAQlpc0RlZmluZWQBBQJhawYJAQFDAQITTm8gcGVuZGluZyBtYW5hZ2VyLgMJAAACBQJhbAUCYWwEAmFtAwkAAAIIBQF4D2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCYWsGCQEBQwECHFlvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlci4DCQAAAgUCYW0FAmFtCQDMCAIJAQtTdHJpbmdFbnRyeQIJAQFiAAkA2AQBCQEFdmFsdWUBBQJhawkAzAgCCQELRGVsZXRlRW50cnkBCQEBYwAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECYW4BAmFvAAQCYXAEAXQJAQFzAAMJAAECBQF0AgpCeXRlVmVjdG9yBAF6BQF0BQF6AwkAAQIFAXQCBFVuaXQIBQJhbg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCYW4JYm9keUJ5dGVzCQCRAwIIBQJhbgZwcm9vZnMAAAUCYXBkdaWj", "chainId": 84, "height": 2280469, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: dHmWccVV24gUFnqycf5Mkma6NsgHntaad9Z5ZjjwpRm Next: 84gnY6HC6ERQjGTitcx2UbHM8DgAh1LMJJ85xiRB2b6t Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 func keyManagerPublicKey () = "%s__managerPublicKey"
77
88
99 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
1010
1111
1212 func keyWithdrawDelay (assetA,assetB) = makeString(["%s%s%s", "withdrawDelay", assetA, assetB], SEP)
1313
1414
1515 func keyDepositFeePermille (assetA,assetB) = makeString(["%s%s%s", "depositFeePermille", assetA, assetB], SEP)
1616
1717
1818 func keyWithdrawFeePermille (assetA,assetB) = makeString(["%s%s%s", "withdrawFeePermille", assetA, assetB], SEP)
1919
2020
2121 func keyMinAmountDeposit (assetA,assetB) = makeString(["%s%s%s", "minAmountDeposit", assetA, assetB], SEP)
2222
2323
2424 func keyAssetsPairStatus (assetA,assetB) = makeString(["%s%s%s", "assetsPairStatus", assetA, assetB], SEP)
2525
2626
2727 func keyMinAmountWithdraw (assetA,assetB) = makeString(["%s%s%s", "minAmountWithdraw", assetA, assetB], SEP)
2828
2929
3030 func keyBalance (assetA,assetB,userAddress) = makeString(["%s%s%s%s", "balance", assetA, assetB, userAddress], SEP)
3131
3232
3333 func keyTotalFeeCollectedDeposit (assetA,assetB) = makeString(["%s%s%s%s", "totalFeeCollected", "deposit", assetA, assetB], SEP)
3434
3535
3636 func keyTotalFeeCollectedWithdraw (assetA,assetB) = makeString(["%s%s%s%s", "totalFeeCollected", "withdraw", assetA, assetB], SEP)
3737
3838
3939 func keyProcessInProgress (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "inProgress", userAddress, assetA, assetB, toString(heightInKey)], SEP)
4040
4141
4242 func keyProcessDone (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "done", userAddress, assetA, assetB, toString(heightInKey)], SEP)
4343
4444
4545 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
4646 case s: String =>
4747 fromBase58String(s)
4848 case _: Unit =>
4949 unit
5050 case _ =>
5151 throw("Match error")
5252 }
5353
5454
5555 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
5656 case s: String =>
5757 fromBase58String(s)
5858 case _: Unit =>
5959 unit
6060 case _ =>
6161 throw("Match error")
6262 }
6363
6464
6565 func mustManager (i) = {
6666 let pd = throw("Permission denied.")
6767 match managerPublicKeyOrUnit() {
6868 case pk: ByteVector =>
6969 if ((i.callerPublicKey == pk))
7070 then true
7171 else pd
7272 case _: Unit =>
7373 if ((i.caller == this))
7474 then true
7575 else pd
7676 case _ =>
7777 throw("Match error")
7878 }
7979 }
8080
8181
8282 func fmtErr (msg) = makeString(["otc_multiasset.ride:", msg], " ")
8383
8484
8585 func throwErr (msg) = throw(fmtErr(msg))
8686
8787
8888 @Callable(i)
8989 func registerAsset (assetA,assetB,withdrawDelay,depositFee,withdrawFee,minAmountDeposit,minAmountWithdraw,pairStatus) = {
9090 let checkCaller = mustManager(i)
9191 if ((checkCaller == checkCaller))
9292 then {
9393 let withdrawDelayKey = keyWithdrawDelay(assetA, assetB)
9494 let depositFeePermilleKey = keyDepositFeePermille(assetA, assetB)
9595 let withdrawFeePermilleKey = keyWithdrawFeePermille(assetA, assetB)
9696 let minAmountDepositKey = keyMinAmountDeposit(assetA, assetB)
9797 let minAmountWithdrawKey = keyMinAmountWithdraw(assetA, assetB)
9898 let pairStatusKey = keyAssetsPairStatus(assetA, assetB)
9999 [IntegerEntry(withdrawDelayKey, withdrawDelay), IntegerEntry(depositFeePermilleKey, depositFee), IntegerEntry(withdrawFeePermilleKey, withdrawFee), IntegerEntry(minAmountDepositKey, minAmountDeposit), IntegerEntry(minAmountWithdrawKey, minAmountWithdraw), IntegerEntry(pairStatusKey, pairStatus)]
100100 }
101101 else throw("Strict value is not equal to itself.")
102102 }
103103
104104
105105
106106 @Callable(i)
107107 func swapAssetsAToB (assetB) = {
108108 let payment = value(i.payments[0])
109109 let assetA = toBase58String(value(payment.assetId))
110110 let asset = fromBase58String(value(assetB))
111111 let userAddress = toString(i.caller)
112112 let minAmountDeposit = valueOrErrorMessage(getInteger(keyMinAmountDeposit(assetA, assetB)), fmtErr("This asset pair does not exist."))
113113 let toDeposit = payment.amount
114114 let depositFee = valueOrErrorMessage(getInteger(keyDepositFeePermille(assetA, assetB)), fmtErr("The deposit fee for this pair of assets is not set."))
115115 let fee = ((toDeposit / 1000) * depositFee)
116116 let currentUserBalance = valueOrElse(getInteger(keyBalance(assetA, assetB, userAddress)), 0)
117117 let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0)
118118 let pairStatus = valueOrErrorMessage(getInteger(keyAssetsPairStatus(assetA, assetB)), fmtErr("The asset pair status for this pair of assets is not set."))
119119 let checkPairStatus = if ((pairStatus == 0))
120120 then true
121121 else throwErr("The couple's deposit is blocked.")
122122 if ((checkPairStatus == checkPairStatus))
123123 then {
124124 let checkPayment = if ((toDeposit >= minAmountDeposit))
125125 then true
126126 else throwErr("The deposit amount is less than the minimum.")
127127 if ((checkPayment == checkPayment))
128128 then {
129129 let newBalance = ((currentUserBalance + toDeposit) - fee)
130130 let checkBalance = if ((newBalance > 0))
131131 then true
132132 else throwErr("The final balance is less than or equal to 0.")
133133 if ((checkBalance == checkBalance))
134134 then [IntegerEntry(keyBalance(assetA, assetB, userAddress), newBalance), IntegerEntry(keyTotalFeeCollectedDeposit(assetA, assetB), (totalCommissions + fee)), ScriptTransfer(i.caller, (toDeposit - fee), asset)]
135135 else throw("Strict value is not equal to itself.")
136136 }
137137 else throw("Strict value is not equal to itself.")
138138 }
139139 else throw("Strict value is not equal to itself.")
140140 }
141141
142142
143143
144144 @Callable(i)
145145 func initializationSwapAssetsBToA (assetA) = {
146146 let payment = value(i.payments[0])
147147 let toWithdraw = payment.amount
148148 let assetB = toBase58String(value(payment.assetId))
149149 let userAddress = toString(i.caller)
150150 let minAmountWithdraw = valueOrErrorMessage(getInteger(keyMinAmountWithdraw(assetA, assetB)), fmtErr("The minimum withdrawal amount for this pair of assets is not set."))
151151 let assetLockHeight = (height + valueOrErrorMessage(getInteger(keyWithdrawDelay(assetA, assetB)), fmtErr("Withdrawal delay is not set for the specified pair.")))
152152 let currentUserBalance = valueOrErrorMessage(getInteger(keyBalance(assetA, assetB, userAddress)), fmtErr("This user balance does not exist."))
153153 let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedWithdraw(assetA, assetB)), 0)
154154 let withdrawFeePermilleKey = keyWithdrawFeePermille(assetA, assetB)
155155 let withdrawFee = valueOrErrorMessage(getInteger(withdrawFeePermilleKey), fmtErr("The withdrawal fee for this pair of assets is not set."))
156156 let fee = ((toWithdraw / 1000) * withdrawFee)
157157 let newBalance = (currentUserBalance - toWithdraw)
158158 let checkBalance = if ((newBalance >= 0))
159159 then true
160160 else throwErr("Swap amount fail, amount is to small.")
161161 if ((checkBalance == checkBalance))
162162 then {
163163 let checkPayment = if ((toWithdraw >= minAmountWithdraw))
164164 then true
165165 else throwErr("The withdraw amount is less than the minimum.")
166166 if ((checkPayment == checkPayment))
167167 then {
168168 let checkProcessInProgress = if ((getInteger(keyProcessInProgress(userAddress, assetA, assetB, assetLockHeight)) == unit))
169169 then true
170170 else throwErr("At this height, there is already an exchange of this pair.")
171171 if ((checkProcessInProgress == checkProcessInProgress))
172172 then [IntegerEntry(keyBalance(assetA, assetB, userAddress), newBalance), IntegerEntry(keyProcessInProgress(userAddress, assetA, assetB, assetLockHeight), (toWithdraw - fee)), IntegerEntry(keyTotalFeeCollectedWithdraw(assetA, assetB), (totalCommissions + fee))]
173173 else throw("Strict value is not equal to itself.")
174174 }
175175 else throw("Strict value is not equal to itself.")
176176 }
177177 else throw("Strict value is not equal to itself.")
178178 }
179179
180180
181181
182182 @Callable(i)
183183 func withdrawAsset (assetA,assetB,heightInKey) = {
184184 let userAddress = toString(i.caller)
185185 let toWithdraw = valueOrErrorMessage(getInteger(keyProcessInProgress(userAddress, assetA, assetB, heightInKey)), fmtErr("At this height, withdraw was not initialized with this pair of assets."))
186186 let asset = fromBase58String(value(assetA))
187187 let checkHeight = if ((height >= heightInKey))
188188 then true
189189 else throwErr((("Withdrawal is possible after " + toString(heightInKey)) + " height or you have already withdrawn."))
190190 if ((checkHeight == checkHeight))
191191 then [DeleteEntry(keyProcessInProgress(userAddress, assetA, assetB, heightInKey)), IntegerEntry(keyProcessDone(userAddress, assetA, assetB, heightInKey), toWithdraw), ScriptTransfer(i.caller, toWithdraw, asset)]
192192 else throw("Strict value is not equal to itself.")
193193 }
194194
195195
196196
197197 @Callable(i)
198198 func withdrawFee (assetA,assetB) = {
199199 let checkCaller = mustManager(i)
200200 if ((checkCaller == checkCaller))
201201 then {
202202 let toWithdrawB = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0)
203203 let withdrawAssetB = fromBase58String(value(assetB))
204204 let toWithdrawA = valueOrElse(getInteger(keyTotalFeeCollectedWithdraw(assetA, assetB)), 0)
205205 let withdrawAssetA = fromBase58String(value(assetA))
206206 [IntegerEntry(keyTotalFeeCollectedDeposit(assetA, assetB), 0), ScriptTransfer(i.caller, toWithdrawA, withdrawAssetA), IntegerEntry(keyTotalFeeCollectedWithdraw(assetA, assetB), 0), ScriptTransfer(i.caller, toWithdrawB, withdrawAssetB)]
207207 }
208208 else throw("Strict value is not equal to itself.")
209209 }
210210
211211
212212
213213 @Callable(i)
214214 func setManager (pendingManagerPublicKey) = {
215215 let checkCaller = mustManager(i)
216216 if ((checkCaller == checkCaller))
217217 then {
218218 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
219219 if ((checkManagerPublicKey == checkManagerPublicKey))
220220 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
221221 else throw("Strict value is not equal to itself.")
222222 }
223223 else throw("Strict value is not equal to itself.")
224224 }
225225
226226
227227
228228 @Callable(i)
229229 func confirmManager () = {
230230 let pm = pendingManagerPublicKeyOrUnit()
231231 let hasPM = if (isDefined(pm))
232232 then true
233233 else throwErr("No pending manager.")
234234 if ((hasPM == hasPM))
235235 then {
236236 let checkPM = if ((i.callerPublicKey == value(pm)))
237237 then true
238238 else throwErr("You are not pending manager.")
239239 if ((checkPM == checkPM))
240240 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
241241 else throw("Strict value is not equal to itself.")
242242 }
243243 else throw("Strict value is not equal to itself.")
244244 }
245245
246246
247247 @Verifier(tx)
248248 func verify () = {
249249 let targetPublicKey = match managerPublicKeyOrUnit() {
250250 case pk: ByteVector =>
251251 pk
252252 case _: Unit =>
253253 tx.senderPublicKey
254254 case _ =>
255255 throw("Match error")
256256 }
257257 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
258258 }
259259

github/deemru/w8io/169f3d6 
37.53 ms