tx · 7bXPjVxo5UJkRzws11vR8Bc4rQNnx6Emo7JLHGRmnUK3 3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5: -0.01400000 Waves 2022.09.16 19:30 [2231910] smart account 3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5 > SELF 0.00000000 Waves
{ "type": 13, "id": "7bXPjVxo5UJkRzws11vR8Bc4rQNnx6Emo7JLHGRmnUK3", "fee": 1400000, "feeAssetId": null, "timestamp": 1663345850258, "version": 1, "sender": "3MvXnAcEtL9x3i499UcvTQZPufrT5ZZUEd5", "senderPublicKey": "GSAhb4fdky75LiCZ4p4DDK4rmWpmsgGBg1ZVdtPfmRES", "proofs": [ "3LDGr8cUNYCvfvHaA6a6925ZM3b97LRdiuco8qQUxpeUE5QP29V3YtBkZhvWN4EsMFpZTTwY41emKZ8S6T8EipXC" ], "script": "base64:BgIsCAISCgoICAgBAQEBAQESAwoBCBIDCgEIEgUKAwgIARIECgIICBIDCgEIEgAUAANTRVACAl9fARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsaWNLZXkBGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAIbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5ARBrZXlXaXRoZHJhd0RlbGF5AgZhc3NldEEGYXNzZXRCCQC5CQIJAMwIAgIGJXMlcyVzCQDMCAICDXdpdGhkcmF3RGVsYXkJAMwIAgUGYXNzZXRBCQDMCAIFBmFzc2V0QgUDbmlsBQNTRVABFWtleURlcG9zaXRGZWVQZXJtaWxsZQIGYXNzZXRBBmFzc2V0QgkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAhJkZXBvc2l0RmVlUGVybWlsbGUJAMwIAgUGYXNzZXRBCQDMCAIFBmFzc2V0QgUDbmlsBQNTRVABFmtleVdpdGhkcmF3RmVlUGVybWlsbGUCBmFzc2V0QQZhc3NldEIJALkJAgkAzAgCAgYlcyVzJXMJAMwIAgITd2l0aG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UBBQJwbQkAzAgCCQELRGVsZXRlRW50cnkBCQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkABQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABA90YXJnZXRQdWJsaWNLZXkEByRtYXRjaDAJARZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXnP9/up", "chainId": 84, "height": 2231910, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 88Q9PZWhruvsXjkn5kzxLGt7NHAMuhFccib1Tfr58XbS Next: DGecdSHjdG1GaWE3gzw87i9fhzp2LrhjbqZdoSuECG7r Diff:
Old | New | Differences | |
---|---|---|---|
39 | 39 | func keyAssetLockTime (assetA,assetB,userAddress) = makeString(["%s%s%s%s", "assetLockTime", assetA, assetB, userAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | - | func keyProcessInProgress (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s% | |
42 | + | func keyProcessInProgress (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "inProgress", userAddress, assetA, assetB, toString(heightInKey)], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func keyProcessDone (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s% | |
45 | + | func keyProcessDone (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "done", userAddress, assetA, assetB, toString(heightInKey)], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
114 | 114 | let userAddress = toString(i.caller) | |
115 | 115 | let minAmountDeposit = valueOrErrorMessage(getInteger(keyMinAmountDeposit(assetA, assetB)), fmtErr("This asset pair does not exist.")) | |
116 | 116 | let toDeposit = payment.amount | |
117 | - | let depositFee = | |
117 | + | let depositFee = valueOrErrorMessage(getInteger(keyDepositFeePermille(assetA, assetB)), fmtErr("The deposit fee for this pair of assets is not set.")) | |
118 | 118 | let fee = ((toDeposit / 1000) * depositFee) | |
119 | 119 | let currentUserBalance = valueOrElse(getInteger(keyBalance(assetA, assetB, userAddress)), 0) | |
120 | 120 | let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0) | |
151 | 151 | let assetB = toBase58String(value(payment.assetId)) | |
152 | 152 | let userAddress = toString(i.caller) | |
153 | 153 | let minAmountWithdraw = valueOrErrorMessage(getInteger(keyMinAmountWithdraw(assetA, assetB)), fmtErr("The minimum withdrawal amount for this pair of assets is not set.")) | |
154 | - | let assetLockHeight = (height + | |
154 | + | let assetLockHeight = (height + valueOrErrorMessage(getInteger(keyWithdrawDelay(assetA, assetB)), fmtErr("Withdrawal delay is not set for the specified pair."))) | |
155 | 155 | let currentUserBalance = valueOrErrorMessage(getInteger(keyBalance(assetA, assetB, userAddress)), fmtErr("This user balance does not exist.")) | |
156 | 156 | let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0) | |
157 | 157 | let withdrawFeePermilleKey = keyWithdrawFeePermille(assetA, assetB) | |
158 | - | let withdrawFee = | |
158 | + | let withdrawFee = valueOrErrorMessage(getInteger(withdrawFeePermilleKey), fmtErr("The withdrawal fee for this pair of assets is not set.")) | |
159 | 159 | let fee = ((toWithdraw / 1000) * withdrawFee) | |
160 | - | let newBalance = (currentUserBalance - | |
160 | + | let newBalance = (currentUserBalance - toWithdraw) | |
161 | 161 | let checkBalance = if ((newBalance >= 0)) | |
162 | 162 | then true | |
163 | 163 | else throwErr("Swap amount fail, amount is to small.") | |
168 | 168 | else throwErr("The withdraw amount is less than the minimum.") | |
169 | 169 | if ((checkPayment == checkPayment)) | |
170 | 170 | then { | |
171 | - | let | |
171 | + | let checkAssetLockHeight = if ((valueOrElse(getInteger(keyAssetLockTime(assetA, assetB, userAddress)), 0) != assetLockHeight)) | |
172 | 172 | then true | |
173 | 173 | else throwErr("At this height, there is already an exchange of this pair.") | |
174 | - | if (( | |
174 | + | if ((checkAssetLockHeight == checkAssetLockHeight)) | |
175 | 175 | then [IntegerEntry(keyAssetLockTime(assetA, assetB, userAddress), assetLockHeight), IntegerEntry(keyBalance(assetA, assetB, userAddress), newBalance), IntegerEntry(keyProcessInProgress(userAddress, assetA, assetB, assetLockHeight), (toWithdraw - fee)), IntegerEntry(keyTotalFeeCollectedWithdraw(assetA, assetB), (totalCommissions + fee))] | |
176 | 176 | else throw("Strict value is not equal to itself.") | |
177 | 177 | } | |
185 | 185 | @Callable(i) | |
186 | 186 | func withdrawAsset (assetA,assetB,heightInKey) = { | |
187 | 187 | let userAddress = toString(i.caller) | |
188 | - | let assetLockHeight = | |
189 | - | let toWithdraw = | |
188 | + | let assetLockHeight = valueOrErrorMessage(getInteger(keyAssetLockTime(assetA, assetB, userAddress)), fmtErr("An asset pair or height is specified incorrectly.")) | |
189 | + | let toWithdraw = valueOrErrorMessage(getInteger(keyProcessInProgress(userAddress, assetA, assetB, heightInKey)), fmtErr("At this height, withdraw was not initialized with this pair of assets.")) | |
190 | 190 | let asset = fromBase58String(value(assetA)) | |
191 | 191 | let checkHeight = if ((height >= assetLockHeight)) | |
192 | 192 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyWithdrawDelay (assetA,assetB) = makeString(["%s%s%s", "withdrawDelay", assetA, assetB], SEP) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyDepositFeePermille (assetA,assetB) = makeString(["%s%s%s", "depositFeePermille", assetA, assetB], SEP) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func keyWithdrawFeePermille (assetA,assetB) = makeString(["%s%s%s", "withdrawFeePermille", assetA, assetB], SEP) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyMinAmountDeposit (assetA,assetB) = makeString(["%s%s%s", "minAmountDeposit", assetA, assetB], SEP) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyAssetsPairStatus (assetA,assetB) = makeString(["%s%s%s", "assetsPairStatus", assetA, assetB], SEP) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func keyMinAmountWithdraw (assetA,assetB) = makeString(["%s%s%s", "minAmountWithdraw", assetA, assetB], SEP) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func keyBalance (assetA,assetB,userAddress) = makeString(["%s%s%s%s", "balance", assetA, assetB, userAddress], SEP) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func keyTotalFeeCollectedDeposit (assetA,assetB) = makeString(["%s%s%s%s", "totalFeeCollected", "deposit", assetA, assetB], SEP) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyTotalFeeCollectedWithdraw (assetA,assetB) = makeString(["%s%s%s%s", "totalFeeCollected", "withdraw", assetA, assetB], SEP) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyAssetLockTime (assetA,assetB,userAddress) = makeString(["%s%s%s%s", "assetLockTime", assetA, assetB, userAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | - | func keyProcessInProgress (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s% | |
42 | + | func keyProcessInProgress (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "inProgress", userAddress, assetA, assetB, toString(heightInKey)], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func keyProcessDone (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s% | |
45 | + | func keyProcessDone (userAddress,assetA,assetB,heightInKey) = makeString(["%s%s%s%s%s%d", "withdrawProcess", "done", userAddress, assetA, assetB, toString(heightInKey)], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
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 pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
59 | 59 | case s: String => | |
60 | 60 | fromBase58String(s) | |
61 | 61 | case _: Unit => | |
62 | 62 | unit | |
63 | 63 | case _ => | |
64 | 64 | throw("Match error") | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func mustManager (i) = { | |
69 | 69 | let pd = throw("Permission denied") | |
70 | 70 | match managerPublicKeyOrUnit() { | |
71 | 71 | case pk: ByteVector => | |
72 | 72 | if ((i.callerPublicKey == pk)) | |
73 | 73 | then true | |
74 | 74 | else pd | |
75 | 75 | case _: Unit => | |
76 | 76 | if ((i.caller == this)) | |
77 | 77 | then true | |
78 | 78 | else pd | |
79 | 79 | case _ => | |
80 | 80 | throw("Match error") | |
81 | 81 | } | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func fmtErr (msg) = makeString(["otc_multiasset.ride:", msg], " ") | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func throwErr (msg) = throw(fmtErr(msg)) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | @Callable(i) | |
92 | 92 | func registerAsset (assetA,assetB,withdrawDelay,depositFee,withdrawFee,minAmountDeposit,minAmountWithdraw,pairStatus) = { | |
93 | 93 | let checkCaller = mustManager(i) | |
94 | 94 | if ((checkCaller == checkCaller)) | |
95 | 95 | then { | |
96 | 96 | let withdrawDelayKey = keyWithdrawDelay(assetA, assetB) | |
97 | 97 | let depositFeePermilleKey = keyDepositFeePermille(assetA, assetB) | |
98 | 98 | let withdrawFeePermilleKey = keyWithdrawFeePermille(assetA, assetB) | |
99 | 99 | let minAmountDepositKey = keyMinAmountDeposit(assetA, assetB) | |
100 | 100 | let minAmountWithdrawKey = keyMinAmountWithdraw(assetA, assetB) | |
101 | 101 | let pairStatusKey = keyAssetsPairStatus(assetA, assetB) | |
102 | 102 | [IntegerEntry(withdrawDelayKey, withdrawDelay), IntegerEntry(depositFeePermilleKey, depositFee), IntegerEntry(withdrawFeePermilleKey, withdrawFee), IntegerEntry(minAmountDepositKey, minAmountDeposit), IntegerEntry(minAmountWithdrawKey, minAmountWithdraw), IntegerEntry(pairStatusKey, pairStatus)] | |
103 | 103 | } | |
104 | 104 | else throw("Strict value is not equal to itself.") | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(i) | |
110 | 110 | func swapAssetsAToB (assetB) = { | |
111 | 111 | let payment = value(i.payments[0]) | |
112 | 112 | let assetA = toBase58String(value(payment.assetId)) | |
113 | 113 | let asset = fromBase58String(value(assetB)) | |
114 | 114 | let userAddress = toString(i.caller) | |
115 | 115 | let minAmountDeposit = valueOrErrorMessage(getInteger(keyMinAmountDeposit(assetA, assetB)), fmtErr("This asset pair does not exist.")) | |
116 | 116 | let toDeposit = payment.amount | |
117 | - | let depositFee = | |
117 | + | let depositFee = valueOrErrorMessage(getInteger(keyDepositFeePermille(assetA, assetB)), fmtErr("The deposit fee for this pair of assets is not set.")) | |
118 | 118 | let fee = ((toDeposit / 1000) * depositFee) | |
119 | 119 | let currentUserBalance = valueOrElse(getInteger(keyBalance(assetA, assetB, userAddress)), 0) | |
120 | 120 | let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0) | |
121 | 121 | let pairStaus = value(getInteger(keyAssetsPairStatus(assetA, assetB))) | |
122 | 122 | let checkPairStatus = if ((pairStaus == 0)) | |
123 | 123 | then true | |
124 | 124 | else throwErr("The couple's deposit is blocked.") | |
125 | 125 | if ((checkPairStatus == checkPairStatus)) | |
126 | 126 | then { | |
127 | 127 | let checkPayment = if ((toDeposit >= minAmountDeposit)) | |
128 | 128 | then true | |
129 | 129 | else throwErr("The deposit amount is less than the minimum.") | |
130 | 130 | if ((checkPayment == checkPayment)) | |
131 | 131 | then { | |
132 | 132 | let newBalance = ((currentUserBalance + toDeposit) - fee) | |
133 | 133 | let checkBalance = if ((newBalance > 0)) | |
134 | 134 | then true | |
135 | 135 | else throwErr("The final balance is less than or equal to 0.") | |
136 | 136 | if ((checkBalance == checkBalance)) | |
137 | 137 | then [IntegerEntry(keyBalance(assetA, assetB, userAddress), newBalance), IntegerEntry(keyTotalFeeCollectedDeposit(assetA, assetB), (totalCommissions + fee)), ScriptTransfer(i.caller, (toDeposit - fee), asset)] | |
138 | 138 | else throw("Strict value is not equal to itself.") | |
139 | 139 | } | |
140 | 140 | else throw("Strict value is not equal to itself.") | |
141 | 141 | } | |
142 | 142 | else throw("Strict value is not equal to itself.") | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | ||
147 | 147 | @Callable(i) | |
148 | 148 | func initializationSwapAssetsBToA (assetA) = { | |
149 | 149 | let payment = value(i.payments[0]) | |
150 | 150 | let toWithdraw = payment.amount | |
151 | 151 | let assetB = toBase58String(value(payment.assetId)) | |
152 | 152 | let userAddress = toString(i.caller) | |
153 | 153 | let minAmountWithdraw = valueOrErrorMessage(getInteger(keyMinAmountWithdraw(assetA, assetB)), fmtErr("The minimum withdrawal amount for this pair of assets is not set.")) | |
154 | - | let assetLockHeight = (height + | |
154 | + | let assetLockHeight = (height + valueOrErrorMessage(getInteger(keyWithdrawDelay(assetA, assetB)), fmtErr("Withdrawal delay is not set for the specified pair."))) | |
155 | 155 | let currentUserBalance = valueOrErrorMessage(getInteger(keyBalance(assetA, assetB, userAddress)), fmtErr("This user balance does not exist.")) | |
156 | 156 | let totalCommissions = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0) | |
157 | 157 | let withdrawFeePermilleKey = keyWithdrawFeePermille(assetA, assetB) | |
158 | - | let withdrawFee = | |
158 | + | let withdrawFee = valueOrErrorMessage(getInteger(withdrawFeePermilleKey), fmtErr("The withdrawal fee for this pair of assets is not set.")) | |
159 | 159 | let fee = ((toWithdraw / 1000) * withdrawFee) | |
160 | - | let newBalance = (currentUserBalance - | |
160 | + | let newBalance = (currentUserBalance - toWithdraw) | |
161 | 161 | let checkBalance = if ((newBalance >= 0)) | |
162 | 162 | then true | |
163 | 163 | else throwErr("Swap amount fail, amount is to small.") | |
164 | 164 | if ((checkBalance == checkBalance)) | |
165 | 165 | then { | |
166 | 166 | let checkPayment = if ((toWithdraw >= minAmountWithdraw)) | |
167 | 167 | then true | |
168 | 168 | else throwErr("The withdraw amount is less than the minimum.") | |
169 | 169 | if ((checkPayment == checkPayment)) | |
170 | 170 | then { | |
171 | - | let | |
171 | + | let checkAssetLockHeight = if ((valueOrElse(getInteger(keyAssetLockTime(assetA, assetB, userAddress)), 0) != assetLockHeight)) | |
172 | 172 | then true | |
173 | 173 | else throwErr("At this height, there is already an exchange of this pair.") | |
174 | - | if (( | |
174 | + | if ((checkAssetLockHeight == checkAssetLockHeight)) | |
175 | 175 | then [IntegerEntry(keyAssetLockTime(assetA, assetB, userAddress), assetLockHeight), IntegerEntry(keyBalance(assetA, assetB, userAddress), newBalance), IntegerEntry(keyProcessInProgress(userAddress, assetA, assetB, assetLockHeight), (toWithdraw - fee)), IntegerEntry(keyTotalFeeCollectedWithdraw(assetA, assetB), (totalCommissions + fee))] | |
176 | 176 | else throw("Strict value is not equal to itself.") | |
177 | 177 | } | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
179 | 179 | } | |
180 | 180 | else throw("Strict value is not equal to itself.") | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | 185 | @Callable(i) | |
186 | 186 | func withdrawAsset (assetA,assetB,heightInKey) = { | |
187 | 187 | let userAddress = toString(i.caller) | |
188 | - | let assetLockHeight = | |
189 | - | let toWithdraw = | |
188 | + | let assetLockHeight = valueOrErrorMessage(getInteger(keyAssetLockTime(assetA, assetB, userAddress)), fmtErr("An asset pair or height is specified incorrectly.")) | |
189 | + | let toWithdraw = valueOrErrorMessage(getInteger(keyProcessInProgress(userAddress, assetA, assetB, heightInKey)), fmtErr("At this height, withdraw was not initialized with this pair of assets.")) | |
190 | 190 | let asset = fromBase58String(value(assetA)) | |
191 | 191 | let checkHeight = if ((height >= assetLockHeight)) | |
192 | 192 | then true | |
193 | 193 | else throwErr((("Withdrawal is possible after " + toString(heightInKey)) + " height or you have already withdrawn.")) | |
194 | 194 | if ((checkHeight == checkHeight)) | |
195 | 195 | then [DeleteEntry(keyProcessInProgress(userAddress, assetA, assetB, heightInKey)), IntegerEntry(keyProcessDone(userAddress, assetA, assetB, heightInKey), toWithdraw), IntegerEntry(keyBalance(assetA, assetB, userAddress), toWithdraw), ScriptTransfer(i.caller, toWithdraw, asset)] | |
196 | 196 | else throw("Strict value is not equal to itself.") | |
197 | 197 | } | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | ||
201 | 201 | @Callable(i) | |
202 | 202 | func withdrawFee (assetA,assetB) = { | |
203 | 203 | let checkCaller = mustManager(i) | |
204 | 204 | if ((checkCaller == checkCaller)) | |
205 | 205 | then { | |
206 | 206 | let toWithdrawA = valueOrElse(getInteger(keyTotalFeeCollectedDeposit(assetA, assetB)), 0) | |
207 | 207 | let withdrawAssetA = fromBase58String(value(assetA)) | |
208 | 208 | let toWithdrawB = valueOrElse(getInteger(keyTotalFeeCollectedWithdraw(assetA, assetB)), 0) | |
209 | 209 | let withdrawAssetB = fromBase58String(value(assetB)) | |
210 | 210 | [IntegerEntry(keyTotalFeeCollectedDeposit(assetA, assetB), 0), ScriptTransfer(i.caller, toWithdrawA, withdrawAssetA), IntegerEntry(keyTotalFeeCollectedWithdraw(assetA, assetB), 0), ScriptTransfer(i.caller, toWithdrawB, withdrawAssetB)] | |
211 | 211 | } | |
212 | 212 | else throw("Strict value is not equal to itself.") | |
213 | 213 | } | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | ||
217 | 217 | @Callable(i) | |
218 | 218 | func setManager (pendingManagerPublicKey) = { | |
219 | 219 | let checkCaller = mustManager(i) | |
220 | 220 | if ((checkCaller == checkCaller)) | |
221 | 221 | then { | |
222 | 222 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
223 | 223 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
224 | 224 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
225 | 225 | else throw("Strict value is not equal to itself.") | |
226 | 226 | } | |
227 | 227 | else throw("Strict value is not equal to itself.") | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | ||
232 | 232 | @Callable(i) | |
233 | 233 | func confirmManager () = { | |
234 | 234 | let pm = pendingManagerPublicKeyOrUnit() | |
235 | 235 | let hasPM = if (isDefined(pm)) | |
236 | 236 | then true | |
237 | 237 | else throwErr("no pending manager") | |
238 | 238 | if ((hasPM == hasPM)) | |
239 | 239 | then { | |
240 | 240 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
241 | 241 | then true | |
242 | 242 | else throwErr("you are not pending manager") | |
243 | 243 | if ((checkPM == checkPM)) | |
244 | 244 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
245 | 245 | else throw("Strict value is not equal to itself.") | |
246 | 246 | } | |
247 | 247 | else throw("Strict value is not equal to itself.") | |
248 | 248 | } | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | @Verifier(tx) | |
252 | 252 | func verify () = { | |
253 | 253 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
254 | 254 | case pk: ByteVector => | |
255 | 255 | pk | |
256 | 256 | case _: Unit => | |
257 | 257 | tx.senderPublicKey | |
258 | 258 | case _ => | |
259 | 259 | throw("Match error") | |
260 | 260 | } | |
261 | 261 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
262 | 262 | } | |
263 | 263 |
github/deemru/w8io/169f3d6 79.04 ms ◑