tx · 6NvDoC5DjDT2zk9cn17Zn8fKkrh9SzTDqBFQmtbeHi1L 3N99iJ7nhpJnb7RyucdZREx2ESs3XhKfBNh: -0.01400000 Waves 2022.04.08 17:25 [1999708] smart account 3N99iJ7nhpJnb7RyucdZREx2ESs3XhKfBNh > SELF 0.00000000 Waves
{ "type": 13, "id": "6NvDoC5DjDT2zk9cn17Zn8fKkrh9SzTDqBFQmtbeHi1L", "fee": 1400000, "feeAssetId": null, "timestamp": 1649427987910, "version": 2, "chainId": 84, "sender": "3N99iJ7nhpJnb7RyucdZREx2ESs3XhKfBNh", "senderPublicKey": "5dVaH8nPwDJRpMtdDcdrNMLtiQ51d1VfH6GEKtPQCbDb", "proofs": [ "3VtQH3Bjef8oiy1k8JVT7aK4yzVZ86A5wuA8chDL6du2f4iLqLp9i4W4BfsCh9hBCKf3dLVz9ygbevUFLKiqG9kx" ], "script": "base64:AAIFAAAAAAAAAB8IAhIFCgMIAQQSAwoBCBIDCgEIEgQKAggIEgQKAggIAAAAFAAAAAAQa1Byb3Bvc2VkQXNzZXRJZAIAAAATX3Byb3Bvc2VkX2Fzc2V0MV9pZAAAAAAUa1Byb3Bvc2VkQXNzZXRBbW91bnQCAAAAF19wcm9wb3NlZF9hc3NldDFfYW1vdW50AAAAAA9rRGVzaXJlZEFzc2V0SWQCAAAAEV9kZXNpcmVkX2Fzc2V0X2lkAAAAAA5rRGVzaXJlZEFtb3VudAIAAAAVX2Rlc2lyZWRfYXNzZXRfYW1vdW50AAAAAAdrU3RhdHVzAgAAAAdfc3RhdHVzAAAAAAZrT3duZXICAAAABl9vd25lcgAAAAAKa0Nsb3NlVHhJZAIAAAAMX2Nsb3NlX3R4X2lkAAAAAAhrUGFydGlhbAIAAAAIX3BhcnRpYWwAAAAAB2tGaWxsZWQCAAAAD19kZXNpcmVkX2ZpbGxlZAAAAAAFa1VzZWQCAAAADl9wcm9wb3NlZF91c2VkAAAAAAlrUHJvcG9zYWwCAAAABXByb3BfAAAAAA5rUHJv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} View: original | compacted Prev: 3vUWVRiGHz5beGktkxojmdre1ZwApK8WtHG8z31bMjVS Next: AK5pg2Tg4QuVWnDKuJjE8eCmUaGTLeRH5cVS6kdgsK5P Diff:
Old | New | Differences | |
---|---|---|---|
252 | 252 | then throw(((("Unable to swop. Pay = " + toString(toPay)) + ", Get = ") + toString(toGet))) | |
253 | 253 | else { | |
254 | 254 | let tradeRatio = fraction(toGet, scale8, toPay) | |
255 | - | if (( | |
255 | + | if ((proposalRatio > tradeRatio)) | |
256 | 256 | then throw("RATIO fucked up") | |
257 | 257 | else { | |
258 | 258 | let res = invoke(poolAddr, "exchange", [1], [AttachedPayment(proposedAssetId, toPay)]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kProposedAssetId = "_proposed_asset1_id" | |
5 | 5 | ||
6 | 6 | let kProposedAssetAmount = "_proposed_asset1_amount" | |
7 | 7 | ||
8 | 8 | let kDesiredAssetId = "_desired_asset_id" | |
9 | 9 | ||
10 | 10 | let kDesiredAmount = "_desired_asset_amount" | |
11 | 11 | ||
12 | 12 | let kStatus = "_status" | |
13 | 13 | ||
14 | 14 | let kOwner = "_owner" | |
15 | 15 | ||
16 | 16 | let kCloseTxId = "_close_tx_id" | |
17 | 17 | ||
18 | 18 | let kPartial = "_partial" | |
19 | 19 | ||
20 | 20 | let kFilled = "_desired_filled" | |
21 | 21 | ||
22 | 22 | let kUsed = "_proposed_used" | |
23 | 23 | ||
24 | 24 | let kProposal = "prop_" | |
25 | 25 | ||
26 | 26 | let kProposalTotal = "prop_total" | |
27 | 27 | ||
28 | 28 | let statusActive = "Active" | |
29 | 29 | ||
30 | 30 | let statusCanceled = "Canceled" | |
31 | 31 | ||
32 | 32 | let statusDone = "Done" | |
33 | 33 | ||
34 | 34 | let scale8 = 100000000 | |
35 | 35 | ||
36 | 36 | let poolFee = 30 | |
37 | 37 | ||
38 | 38 | let orderFee = 5 | |
39 | 39 | ||
40 | 40 | let feeDelimiter = 10000 | |
41 | 41 | ||
42 | 42 | func readProposalData (id) = { | |
43 | 43 | let status = valueOrErrorMessage(getString(this, (id + kStatus)), (("Proposal with id '" + id) + "' not found")) | |
44 | 44 | let ownerAddr = addressFromStringValue(valueOrErrorMessage(getString(this, (id + kOwner)), "owner not set")) | |
45 | 45 | let proposedAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kProposedAssetId)), "Proposed asset not found")), "Incorrect proposed asset id") | |
46 | 46 | let proposedAssetAmount = valueOrErrorMessage(getInteger(this, (id + kProposedAssetAmount)), "Proposed amount not found") | |
47 | 47 | let desiredAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kDesiredAssetId)), "Desired asset not found")), "Incorrect desired asset id") | |
48 | 48 | let desiredAssetAmount = valueOrErrorMessage(getInteger(this, (id + kDesiredAmount)), "Desired amount not found") | |
49 | 49 | let partialAllowed = valueOrErrorMessage(getBoolean(this, (id + kPartial)), "Partial setting isn't set") | |
50 | 50 | let desFilled = valueOrElse(getInteger(this, (id + kFilled)), 0) | |
51 | 51 | let propUsed = valueOrElse(getInteger(this, (id + kUsed)), 0) | |
52 | 52 | let txs = valueOrElse(getString(this, (id + kCloseTxId)), "") | |
53 | 53 | $Tuple10(status, ownerAddr, proposedAssetId, proposedAssetAmount, desiredAssetId, desiredAssetAmount, partialAllowed, desFilled, propUsed, txs) | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func placeProposal (desireToGetAssetId,desireToGetAmount,partial) = { | |
59 | 59 | let $t020742173 = $Tuple2(i.payments[0].amount, toBase58String(value(i.payments[0].assetId))) | |
60 | 60 | let pmtAmount = $t020742173._1 | |
61 | 61 | let pmtAssetId = $t020742173._2 | |
62 | 62 | let id = toBase58String(i.transactionId) | |
63 | 63 | if (isDefined(getString(this, (id + kStatus)))) | |
64 | 64 | then throw("ID already registered") | |
65 | 65 | else { | |
66 | 66 | let prop_total = valueOrElse(getInteger(this, kProposalTotal), 0) | |
67 | 67 | [StringEntry((kProposal + toString((prop_total + 1))), id), IntegerEntry(kProposalTotal, (prop_total + 1)), StringEntry((id + kOwner), toString(i.caller)), StringEntry((id + kProposedAssetId), pmtAssetId), IntegerEntry((id + kProposedAssetAmount), pmtAmount), StringEntry((id + kDesiredAssetId), desireToGetAssetId), IntegerEntry((id + kDesiredAmount), desireToGetAmount), BooleanEntry((id + kPartial), partial), StringEntry((id + kStatus), statusActive), IntegerEntry((id + kFilled), 0), IntegerEntry((id + kUsed), 0)] | |
68 | 68 | } | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func cancelProposal (id) = { | |
75 | 75 | let $t029783140 = readProposalData(id) | |
76 | 76 | let status = $t029783140._1 | |
77 | 77 | let ownerAddr = $t029783140._2 | |
78 | 78 | let proposedAssetId = $t029783140._3 | |
79 | 79 | let proposedAssetAmount = $t029783140._4 | |
80 | 80 | let desiredAssetId = $t029783140._5 | |
81 | 81 | let desiredAssetAmount = $t029783140._6 | |
82 | 82 | let partialAllowed = $t029783140._7 | |
83 | 83 | let desFilled = $t029783140._8 | |
84 | 84 | let propUsed = $t029783140._9 | |
85 | 85 | let txs = $t029783140._10 | |
86 | 86 | if ((status != statusActive)) | |
87 | 87 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
88 | 88 | else if ((i.caller != ownerAddr)) | |
89 | 89 | then throw("Only owner can cancel") | |
90 | 90 | else [ScriptTransfer(ownerAddr, (proposedAssetAmount - propUsed), proposedAssetId), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | @Callable(i) | |
96 | 96 | func acceptProposal (id) = { | |
97 | 97 | let $t035923675 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
98 | 98 | let pmtAmount = $t035923675._1 | |
99 | 99 | let pmtAssetId = $t035923675._2 | |
100 | 100 | let $t036793841 = readProposalData(id) | |
101 | 101 | let status = $t036793841._1 | |
102 | 102 | let ownerAddr = $t036793841._2 | |
103 | 103 | let proposedAssetId = $t036793841._3 | |
104 | 104 | let proposedAssetAmount = $t036793841._4 | |
105 | 105 | let desiredAssetId = $t036793841._5 | |
106 | 106 | let desiredAssetAmount = $t036793841._6 | |
107 | 107 | let partialAllowed = $t036793841._7 | |
108 | 108 | let desFilled = $t036793841._8 | |
109 | 109 | let propUsed = $t036793841._9 | |
110 | 110 | let txs = $t036793841._10 | |
111 | 111 | if ((status != statusActive)) | |
112 | 112 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
113 | 113 | else if ((desiredAssetId != pmtAssetId)) | |
114 | 114 | then throw("Atatched asset doesn't match desired") | |
115 | 115 | else { | |
116 | 116 | let $t040534385 = if (!(partialAllowed)) | |
117 | 117 | then if ((desiredAssetAmount != pmtAmount)) | |
118 | 118 | then throw("Attached asset amount doesn't match") | |
119 | 119 | else $Tuple2(pmtAmount, desiredAssetAmount) | |
120 | 120 | else { | |
121 | 121 | let a1 = min([pmtAmount, (desiredAssetAmount - desFilled)]) | |
122 | 122 | $Tuple2(a1, fraction(proposedAssetAmount, a1, desiredAssetAmount)) | |
123 | 123 | } | |
124 | 124 | let amount1 = $t040534385._1 | |
125 | 125 | let amount2 = $t040534385._2 | |
126 | 126 | if ((amount2 == 0)) | |
127 | 127 | then throw("Payment amount is not enough to get something in change") | |
128 | 128 | else { | |
129 | 129 | let filledNew = (desFilled + amount1) | |
130 | 130 | let usedNew = (propUsed + amount2) | |
131 | 131 | let statusNew = if ((filledNew == desiredAssetAmount)) | |
132 | 132 | then statusDone | |
133 | 133 | else statusActive | |
134 | 134 | [ScriptTransfer(ownerAddr, amount1, desiredAssetId), ScriptTransfer(i.caller, amount2, proposedAssetId), ScriptTransfer(i.caller, (pmtAmount - amount1), desiredAssetId), IntegerEntry((id + kFilled), filledNew), IntegerEntry((id + kUsed), usedNew), StringEntry((id + kStatus), statusNew), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
135 | 135 | } | |
136 | 136 | } | |
137 | 137 | } | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | 141 | @Callable(i) | |
142 | 142 | func matchProposals (id1,id2) = { | |
143 | 143 | let $t051045277 = readProposalData(id1) | |
144 | 144 | let status1 = $t051045277._1 | |
145 | 145 | let ownerAddr1 = $t051045277._2 | |
146 | 146 | let proposedAssetId1 = $t051045277._3 | |
147 | 147 | let proposedAssetAmount1 = $t051045277._4 | |
148 | 148 | let desiredAssetId1 = $t051045277._5 | |
149 | 149 | let desiredAssetAmount1 = $t051045277._6 | |
150 | 150 | let partialAllowed1 = $t051045277._7 | |
151 | 151 | let desFilled1 = $t051045277._8 | |
152 | 152 | let propUsed1 = $t051045277._9 | |
153 | 153 | let txs1 = $t051045277._10 | |
154 | 154 | let $t052805453 = readProposalData(id2) | |
155 | 155 | let status2 = $t052805453._1 | |
156 | 156 | let ownerAddr2 = $t052805453._2 | |
157 | 157 | let proposedAssetId2 = $t052805453._3 | |
158 | 158 | let proposedAssetAmount2 = $t052805453._4 | |
159 | 159 | let desiredAssetId2 = $t052805453._5 | |
160 | 160 | let desiredAssetAmount2 = $t052805453._6 | |
161 | 161 | let partialAllowed2 = $t052805453._7 | |
162 | 162 | let desFilled2 = $t052805453._8 | |
163 | 163 | let propUsed2 = $t052805453._9 | |
164 | 164 | let txs2 = $t052805453._10 | |
165 | 165 | if ((status1 != statusActive)) | |
166 | 166 | then throw(((("Proposal with id '" + id1) + "' is not active. Status: ") + status1)) | |
167 | 167 | else if ((status2 != statusActive)) | |
168 | 168 | then throw(((("Proposal with id '" + id2) + "' is not active. Status: ") + status2)) | |
169 | 169 | else if (if ((desiredAssetId1 != proposedAssetId2)) | |
170 | 170 | then true | |
171 | 171 | else (desiredAssetId2 != proposedAssetId1)) | |
172 | 172 | then throw("Assets in proposals doesn't match") | |
173 | 173 | else { | |
174 | 174 | let price1 = fraction(proposedAssetAmount1, scale8, desiredAssetAmount1) | |
175 | 175 | let price2 = fraction(desiredAssetAmount2, scale8, proposedAssetAmount2) | |
176 | 176 | if ((price2 > price1)) | |
177 | 177 | then throw(((("Price doesn't match. price1 = " + toString(price1)) + ", price2 = ") + toString(price2))) | |
178 | 178 | else { | |
179 | 179 | let usedPrice = ((price1 + price2) / 2) | |
180 | 180 | let amount0 = min([proposedAssetAmount1, (desiredAssetAmount2 - desFilled2)]) | |
181 | 181 | let amount2 = min([fraction(amount0, scale8, usedPrice), (desiredAssetAmount1 - desFilled1)]) | |
182 | 182 | let amount1 = fraction(amount2, usedPrice, scale8) | |
183 | 183 | let newFilled1 = (desFilled1 + amount2) | |
184 | 184 | let newFilled2 = (desFilled2 + amount1) | |
185 | 185 | let newUsed1 = (propUsed1 + amount1) | |
186 | 186 | let newUsed2 = (propUsed2 + amount2) | |
187 | 187 | let result0 = [ScriptTransfer(ownerAddr1, amount2, desiredAssetId1), ScriptTransfer(ownerAddr2, amount1, desiredAssetId2), IntegerEntry((id1 + kFilled), newFilled1), IntegerEntry((id2 + kFilled), newFilled2), IntegerEntry((id1 + kUsed), newUsed1), IntegerEntry((id2 + kUsed), newUsed2), StringEntry((id1 + kCloseTxId), ((txs1 + ":") + toBase58String(i.transactionId))), StringEntry((id2 + kCloseTxId), ((txs2 + ":") + toBase58String(i.transactionId)))] | |
188 | 188 | func appendResult (r0,ownerAddr,id,proposedAmountLeft,desiredAmountLeft,proposedAssetId) = if (if ((0 > proposedAmountLeft)) | |
189 | 189 | then true | |
190 | 190 | else (0 > desiredAmountLeft)) | |
191 | 191 | then throw("Internal error with calculation") | |
192 | 192 | else if ((proposedAmountLeft == 0)) | |
193 | 193 | then (r0 :+ StringEntry((id + kStatus), statusDone)) | |
194 | 194 | else if ((desiredAmountLeft == 0)) | |
195 | 195 | then (r0 ++ [ScriptTransfer(ownerAddr, proposedAmountLeft, proposedAssetId), StringEntry((id + kStatus), statusDone)]) | |
196 | 196 | else r0 | |
197 | 197 | ||
198 | 198 | let proposedAmountLeft1 = (proposedAssetAmount1 - amount1) | |
199 | 199 | let desiredAmountLeft1 = (desiredAssetAmount1 - amount2) | |
200 | 200 | let proposedAmountLeft2 = (proposedAssetAmount1 - amount2) | |
201 | 201 | let desiredAmountLeft2 = (desiredAssetAmount1 - amount1) | |
202 | 202 | let result1 = appendResult(result0, ownerAddr1, id1, proposedAmountLeft1, desiredAmountLeft1, proposedAssetId1) | |
203 | 203 | let result2 = appendResult(result1, ownerAddr2, id2, proposedAmountLeft2, desiredAmountLeft2, proposedAssetId2) | |
204 | 204 | result2 | |
205 | 205 | } | |
206 | 206 | } | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(i) | |
212 | 212 | func executeOnSwopfi (id,pool) = { | |
213 | 213 | let $t087278889 = readProposalData(id) | |
214 | 214 | let status = $t087278889._1 | |
215 | 215 | let ownerAddr = $t087278889._2 | |
216 | 216 | let proposedAssetId = $t087278889._3 | |
217 | 217 | let proposedAssetAmount = $t087278889._4 | |
218 | 218 | let desiredAssetId = $t087278889._5 | |
219 | 219 | let desiredAssetAmount = $t087278889._6 | |
220 | 220 | let partialAllowed = $t087278889._7 | |
221 | 221 | let desFilled = $t087278889._8 | |
222 | 222 | let propUsed = $t087278889._9 | |
223 | 223 | let txs = $t087278889._10 | |
224 | 224 | if ((status != statusActive)) | |
225 | 225 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
226 | 226 | else { | |
227 | 227 | let poolAddr = valueOrErrorMessage(addressFromString(pool), "Wrong pool address") | |
228 | 228 | let poolAssetA = getStringValue(poolAddr, "A_asset_id") | |
229 | 229 | let poolAssetB = getStringValue(poolAddr, "B_asset_id") | |
230 | 230 | let t = if (if ((poolAssetA == toBase58String(proposedAssetId))) | |
231 | 231 | then (poolAssetB == toBase58String(desiredAssetId)) | |
232 | 232 | else false) | |
233 | 233 | then "Sell" | |
234 | 234 | else if (if ((poolAssetB == toBase58String(proposedAssetId))) | |
235 | 235 | then (poolAssetA == toBase58String(desiredAssetId)) | |
236 | 236 | else false) | |
237 | 237 | then "Buy" | |
238 | 238 | else throw("Pool doesn't match proposal") | |
239 | 239 | let poolBalA = getIntegerValue(poolAddr, "A_asset_balance") | |
240 | 240 | let poolBalB = getIntegerValue(poolAddr, "B_asset_balance") | |
241 | 241 | let bal1 = if ((t == "Sell")) | |
242 | 242 | then poolBalA | |
243 | 243 | else poolBalB | |
244 | 244 | let bal2 = if ((t == "Sell")) | |
245 | 245 | then poolBalB | |
246 | 246 | else poolBalA | |
247 | 247 | let proposalRatio = fraction(desiredAssetAmount, scale8, proposedAssetAmount) | |
248 | 248 | let maxPay = (fraction(bal2, ((feeDelimiter - poolFee) * scale8), (feeDelimiter * proposalRatio)) - bal1) | |
249 | 249 | let toPay = min([maxPay, proposedAssetAmount]) | |
250 | 250 | let toGet = fraction(fraction(bal2, toPay, (bal1 + toPay)), (feeDelimiter - poolFee), feeDelimiter) | |
251 | 251 | if ((0 > toGet)) | |
252 | 252 | then throw(((("Unable to swop. Pay = " + toString(toPay)) + ", Get = ") + toString(toGet))) | |
253 | 253 | else { | |
254 | 254 | let tradeRatio = fraction(toGet, scale8, toPay) | |
255 | - | if (( | |
255 | + | if ((proposalRatio > tradeRatio)) | |
256 | 256 | then throw("RATIO fucked up") | |
257 | 257 | else { | |
258 | 258 | let res = invoke(poolAddr, "exchange", [1], [AttachedPayment(proposedAssetId, toPay)]) | |
259 | 259 | if ((res == res)) | |
260 | 260 | then match res { | |
261 | 261 | case r: (Int, ByteVector) => | |
262 | 262 | if (if ((r._1 != toGet)) | |
263 | 263 | then true | |
264 | 264 | else (r._2 != desiredAssetId)) | |
265 | 265 | then throw(((("exchanger returned unexpected amount of token. Expected: " + toString(toGet)) + ", received: ") + toString(r._1))) | |
266 | 266 | else [ScriptTransfer(ownerAddr, toGet, desiredAssetId), IntegerEntry((id + kFilled), (desFilled + toGet)), IntegerEntry((id + kUsed), (propUsed + toPay)), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
267 | 267 | case _ => | |
268 | 268 | throw("Incorrect invoke of 'exchange' result") | |
269 | 269 | } | |
270 | 270 | else throw("Strict value is not equal to itself.") | |
271 | 271 | } | |
272 | 272 | } | |
273 | 273 | } | |
274 | 274 | } | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | @Verifier(tx) | |
278 | 278 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
279 | 279 |
github/deemru/w8io/169f3d6 103.44 ms ◑