tx · sFW4Lnewh68RQPhByb6LEKLMUDmUhtSb7yMb6Koz9qP 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq: -0.01300000 Waves 2023.02.03 14:38 [2433396] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves
{ "type": 13, "id": "sFW4Lnewh68RQPhByb6LEKLMUDmUhtSb7yMb6Koz9qP", "fee": 1300000, "feeAssetId": null, "timestamp": 1675424363406, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "5pXet6NT6Ts8zoGcbHUpb5VeZKy85YZgFwM8FptggAEU2aJVYDQm3FSyVgo5f2VSacWbupq8867WLgKXhqyo5rxi" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWlsAQkBAm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R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXkVhX33", "chainId": 84, "height": 2433396, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 82u5VUX7c5386UDHzoJ8j66gSVS68Rsb8SnMyUe3YFbC Next: Du9MnSQgpyPbQwWYedpZtyYCXY1VT5on6PeXuV9H1A8B Diff:
Old | New | Differences | |
---|---|---|---|
120 | 120 | let isReverse = $t026413260._1 | |
121 | 121 | let pool = $t026413260._2 | |
122 | 122 | let isPoolOneTokenOperationsDisabled = { | |
123 | - | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x | |
123 | + | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil) | |
124 | 124 | if ($isInstanceOf(@, "Boolean")) | |
125 | 125 | then @ | |
126 | 126 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
163 | 163 | then { | |
164 | 164 | let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil) | |
165 | 165 | let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil) | |
166 | - | let $ | |
166 | + | let $t047295219 = if ((lpNonReverese != unit)) | |
167 | 167 | then { | |
168 | 168 | let isReverse = false | |
169 | 169 | let pool = { | |
181 | 181 | $Tuple2(isReverse, pool) | |
182 | 182 | } | |
183 | 183 | else poolNotExist | |
184 | - | let isReverse = $ | |
185 | - | let pool = $ | |
184 | + | let isReverse = $t047295219._1 | |
185 | + | let pool = $t047295219._2 | |
186 | 186 | let isPoolOneTokenOperationsDisabled = { | |
187 | 187 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil) | |
188 | 188 | if ($isInstanceOf(@, "Boolean")) |
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 | let feeScale = toBigInt(100000) | |
7 | 7 | ||
8 | 8 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | let poolDisabled = throw("Pool disabled") | |
12 | 12 | ||
13 | 13 | let poolNotExist = throw("Pool is not exist") | |
14 | 14 | ||
15 | 15 | let slippageTooBig = throw("Slippage is too big") | |
16 | 16 | ||
17 | 17 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func fc () = "%s__factoryContract" | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | let factoryContract = addressFromStringValue(getStringOrFail(fc())) | |
27 | 27 | ||
28 | 28 | func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func feeLiquidity () = makeString(["%s", "feeLiquidity"], SEP) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func protocolFee () = makeString(["%s", "protocolFee"], SEP) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func asInt (val) = match val { | |
38 | 38 | case valInt: Int => | |
39 | 39 | valInt | |
40 | 40 | case _ => | |
41 | 41 | throw("fail to cast into Int") | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], 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 isManager (i) = match managerPublicKeyOrUnit() { | |
69 | 69 | case pk: ByteVector => | |
70 | 70 | (i.callerPublicKey == pk) | |
71 | 71 | case _: Unit => | |
72 | 72 | (i.caller == this) | |
73 | 73 | case _ => | |
74 | 74 | throw("Match error") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func mustManager (i) = if (isManager(i)) | |
79 | 79 | then true | |
80 | 80 | else throw("permission denied") | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
84 | 84 | then wavesBalance(this).available | |
85 | 85 | else assetBalance(this, fromBase58String(assetId)) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(i) | |
89 | 89 | func swapCalculateREADONLY (amountIn,assetIn,assetOut) = { | |
90 | 90 | let prFee = value(getInteger(protocolFee())) | |
91 | 91 | let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
92 | 92 | let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
93 | 93 | let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount) | |
94 | 94 | let cleanAmountIn = (amountInToPool - feeLiquidityAmount) | |
95 | 95 | let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil) | |
96 | 96 | let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil) | |
97 | 97 | let $t026413260 = if ((lpNonReverese != unit)) | |
98 | 98 | then { | |
99 | 99 | let isReverse = false | |
100 | 100 | let pool = { | |
101 | 101 | let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil) | |
102 | 102 | if ($isInstanceOf(@, "String")) | |
103 | 103 | then @ | |
104 | 104 | else throw(($getType(@) + " couldn't be cast to String")) | |
105 | 105 | } | |
106 | 106 | $Tuple2(isReverse, pool) | |
107 | 107 | } | |
108 | 108 | else if ((lpReverse != unit)) | |
109 | 109 | then { | |
110 | 110 | let isReverse = true | |
111 | 111 | let pool = { | |
112 | 112 | let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil) | |
113 | 113 | if ($isInstanceOf(@, "String")) | |
114 | 114 | then @ | |
115 | 115 | else throw(($getType(@) + " couldn't be cast to String")) | |
116 | 116 | } | |
117 | 117 | $Tuple2(isReverse, pool) | |
118 | 118 | } | |
119 | 119 | else poolNotExist | |
120 | 120 | let isReverse = $t026413260._1 | |
121 | 121 | let pool = $t026413260._2 | |
122 | 122 | let isPoolOneTokenOperationsDisabled = { | |
123 | - | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x | |
123 | + | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", ["3MqGtuaL3yJbKHqUxnSihJmYroyPf6QDp1x"], nil) | |
124 | 124 | if ($isInstanceOf(@, "Boolean")) | |
125 | 125 | then @ | |
126 | 126 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
127 | 127 | } | |
128 | 128 | let check = if (isPoolOneTokenOperationsDisabled) | |
129 | 129 | then true | |
130 | 130 | else poolDisabled | |
131 | 131 | if ((check == check)) | |
132 | 132 | then { | |
133 | 133 | let poolAdr = addressFromStringValue(valueOrElse(pool, "")) | |
134 | 134 | let res = { | |
135 | 135 | let @ = invoke(poolAdr, "calculateAmountOutForSwapREADONLY", [cleanAmountIn, isReverse], nil) | |
136 | 136 | if ($isInstanceOf(@, "Int")) | |
137 | 137 | then @ | |
138 | 138 | else throw(($getType(@) + " couldn't be cast to Int")) | |
139 | 139 | } | |
140 | 140 | $Tuple2(nil, res) | |
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 swap (amountOutMin,assetOut,addressTo) = { | |
149 | 149 | let pmt = value(i.payments[0]) | |
150 | 150 | let assetIn = if ((pmt.assetId == unit)) | |
151 | 151 | then toBytes("WAVES") | |
152 | 152 | else value(pmt.assetId) | |
153 | 153 | let amountIn = value(pmt.amount) | |
154 | 154 | let prFee = value(getInteger(protocolFee())) | |
155 | 155 | let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
156 | 156 | let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
157 | 157 | let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount) | |
158 | 158 | let cleanAmountIn = (amountInToPool - feeLiquidityAmount) | |
159 | 159 | let checks = [if ((size(i.payments) == 1)) | |
160 | 160 | then true | |
161 | 161 | else throw("exactly 1 payment are expected")] | |
162 | 162 | if ((checks == checks)) | |
163 | 163 | then { | |
164 | 164 | let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil) | |
165 | 165 | let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil) | |
166 | - | let $ | |
166 | + | let $t047295219 = if ((lpNonReverese != unit)) | |
167 | 167 | then { | |
168 | 168 | let isReverse = false | |
169 | 169 | let pool = { | |
170 | 170 | let @ = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil) | |
171 | 171 | if ($isInstanceOf(@, "Address")) | |
172 | 172 | then @ | |
173 | 173 | else throw(($getType(@) + " couldn't be cast to Address")) | |
174 | 174 | } | |
175 | 175 | $Tuple2(isReverse, pool) | |
176 | 176 | } | |
177 | 177 | else if ((lpReverse != unit)) | |
178 | 178 | then { | |
179 | 179 | let isReverse = true | |
180 | 180 | let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil) | |
181 | 181 | $Tuple2(isReverse, pool) | |
182 | 182 | } | |
183 | 183 | else poolNotExist | |
184 | - | let isReverse = $ | |
185 | - | let pool = $ | |
184 | + | let isReverse = $t047295219._1 | |
185 | + | let pool = $t047295219._2 | |
186 | 186 | let isPoolOneTokenOperationsDisabled = { | |
187 | 187 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil) | |
188 | 188 | if ($isInstanceOf(@, "Boolean")) | |
189 | 189 | then @ | |
190 | 190 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
191 | 191 | } | |
192 | 192 | let check = if (isPoolOneTokenOperationsDisabled) | |
193 | 193 | then true | |
194 | 194 | else poolDisabled | |
195 | 195 | if ((check == check)) | |
196 | 196 | then { | |
197 | 197 | let poolAdr = addressFromStringValue(valueOrElse(pool, "")) | |
198 | 198 | let res = { | |
199 | 199 | let @ = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))]) | |
200 | 200 | if ($isInstanceOf(@, "Boolean")) | |
201 | 201 | then @ | |
202 | 202 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
203 | 203 | } | |
204 | 204 | $Tuple2(nil, res) | |
205 | 205 | } | |
206 | 206 | else throw("Strict value is not equal to itself.") | |
207 | 207 | } | |
208 | 208 | else throw("Strict value is not equal to itself.") | |
209 | 209 | } | |
210 | 210 | ||
211 | 211 | ||
212 | 212 | ||
213 | 213 | @Callable(i) | |
214 | 214 | func setManager (pendingManagerPublicKey) = { | |
215 | 215 | let checkCaller = mustManager(i) | |
216 | 216 | if ((checkCaller == checkCaller)) | |
217 | 217 | then { | |
218 | 218 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
219 | 219 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
220 | 220 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
221 | 221 | else throw("Strict value is not equal to itself.") | |
222 | 222 | } | |
223 | 223 | else throw("Strict value is not equal to itself.") | |
224 | 224 | } | |
225 | 225 | ||
226 | 226 | ||
227 | 227 | ||
228 | 228 | @Callable(i) | |
229 | 229 | func confirmManager () = { | |
230 | 230 | let pm = pendingManagerPublicKeyOrUnit() | |
231 | 231 | let hasPM = if (isDefined(pm)) | |
232 | 232 | then true | |
233 | 233 | else throw("no pending manager") | |
234 | 234 | if ((hasPM == hasPM)) | |
235 | 235 | then { | |
236 | 236 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
237 | 237 | then true | |
238 | 238 | else throw("you are not pending manager") | |
239 | 239 | if ((checkPM == checkPM)) | |
240 | 240 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
241 | 241 | else throw("Strict value is not equal to itself.") | |
242 | 242 | } | |
243 | 243 | else throw("Strict value is not equal to itself.") | |
244 | 244 | } | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | @Verifier(tx) | |
248 | 248 | func verify () = { | |
249 | 249 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
250 | 250 | case pk: ByteVector => | |
251 | 251 | pk | |
252 | 252 | case _: Unit => | |
253 | 253 | tx.senderPublicKey | |
254 | 254 | case _ => | |
255 | 255 | throw("Match error") | |
256 | 256 | } | |
257 | 257 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
258 | 258 | } | |
259 | 259 |
github/deemru/w8io/026f985 45.09 ms ◑