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