tx · GiC63WVTWqW7wXixU8rjmYBdnpYbKyTpqyYPuiduiwbu 3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr: -0.01400000 Waves 2022.04.07 18:25 [1998324] smart account 3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr > SELF 0.00000000 Waves
{ "type": 13, "id": "GiC63WVTWqW7wXixU8rjmYBdnpYbKyTpqyYPuiduiwbu", "fee": 1400000, "feeAssetId": null, "timestamp": 1649345173699, "version": 2, "chainId": 84, "sender": "3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr", "senderPublicKey": "He9ZSnjQZGhUkdUsMVVz4t6eAU1c2owedXGCfY1WZvnU", "proofs": [ "3rv6MWs2R9Y13ViBvwCkkD4qvAW6vLdH7FeXpD92JLKJe3gGQVoGRYZy37RFPQLtVuX5nknxXHiDbZ1MEgVBnE2L" ], "script": "base64:AAIFAAAAAAAAAB8IAhIFCgMIAQQSAwoBCBIDCgEIEgQKAggIEgQKAggIAAAAEwAAAAAQa1Byb3Bvc2VkQXNzZXRJZAIAAAATX3Byb3Bvc2VkX2Fzc2V0MV9pZAAAAAAUa1Byb3Bvc2VkQXNzZXRBbW91bnQCAAAAF19wcm9wb3NlZF9hc3NldDFfYW1vdW50AAAAAA9rRGVzaXJlZEFzc2V0SWQCAAAAEV9kZXNpcmVkX2Fzc2V0X2lkAAAAAA5rRGVzaXJlZEFtb3VudAIAAAAVX2Rlc2lyZWRfYXNzZXRfYW1vdW50AAAAAAdrU3RhdHVzAgAAAAdfc3RhdHVzAAAAAAZrT3duZXICAAAABl9vd25lcgAAAAAKa0Nsb3NlVHhJZAIAAAAMX2Nsb3NlX3R4X2lkAAAAAAhrUGFydGlhbAIAAAAIX3BhcnRpYWwAAAAAB2tGaWxsZWQCAAAAB19maWxsZWQAAAAACWtQcm9wb3NhbAIAAAAFcHJvcF8AAAAADmtQcm9wb3NhbFRvdGFsAgAAAApwcm9wX3RvdGFsAAAAAAxzdGF0dXNBY3RpdmUCAAAAB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AABBQAAAAhwb29sQmFsQQUAAAAIcG9vbEJhbEIEAAAABGJhbDIDCQAAAAAAAAIFAAAAAXQAAAAAAAAAAAEFAAAACHBvb2xCYWxCBQAAAAhwb29sQmFsQQQAAAAFcmF0aW8JAABrAAAAAwUAAAASZGVzaXJlZEFzc2V0QW1vdW50BQAAAAZzY2FsZTgFAAAAE3Byb3Bvc2VkQXNzZXRBbW91bnQEAAAABm1heFBheQkAAGUAAAACCQAAawAAAAMFAAAABGJhbDIJAABoAAAAAgkAAGUAAAACCQAAZQAAAAIFAAAADGZlZURlbGltaXRlcgUAAAAHcG9vbEZlZQUAAAAIb3JkZXJGZWUFAAAABnNjYWxlOAkAAGgAAAACBQAAAAxmZWVEZWxpbWl0ZXIFAAAABXJhdGlvBQAAAARiYWwxBAAAAAV0b1BheQkAAZcAAAABCQAETAAAAAIFAAAABm1heFBheQkABEwAAAACBQAAABNwcm9wb3NlZEFzc2V0QW1vdW50BQAAAANuaWwEAAAABXRvR2V0CQAAawAAAAMFAAAABGJhbDIFAAAABXRvUGF5CQAAZAAAAAIFAAAABGJhbDEFAAAABXRvUGF5BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQR/gXw=", "height": 1998324, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8gN7ajwZJL5gjqsiwtrx5vR78dRwSvusHyAnCTNgkC6k Next: none Diff:
Old | New | Differences | |
---|---|---|---|
79 | 79 | let partialAllowed = $t029103059._7 | |
80 | 80 | let filled = $t029103059._8 | |
81 | 81 | let txs = $t029103059._9 | |
82 | - | if (( | |
83 | - | then throw(" | |
84 | - | else if (( | |
85 | - | then throw( | |
82 | + | if ((status != statusActive)) | |
83 | + | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
84 | + | else if ((i.caller != ownerAddr)) | |
85 | + | then throw("Only owner can cancel") | |
86 | 86 | else { | |
87 | 87 | let proposedAssetUsedAmount = fraction(filled, proposedAssetAmount, desiredAssetAmount) | |
88 | 88 | [ScriptTransfer(ownerAddr, (proposedAssetAmount - proposedAssetUsedAmount), proposedAssetId), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] |
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 = "_filled" | |
21 | 21 | ||
22 | 22 | let kProposal = "prop_" | |
23 | 23 | ||
24 | 24 | let kProposalTotal = "prop_total" | |
25 | 25 | ||
26 | 26 | let statusActive = "Active" | |
27 | 27 | ||
28 | 28 | let statusCanceled = "Canceled" | |
29 | 29 | ||
30 | 30 | let statusDone = "Done" | |
31 | 31 | ||
32 | 32 | let scale8 = 100000000 | |
33 | 33 | ||
34 | 34 | let poolFee = 30 | |
35 | 35 | ||
36 | 36 | let orderFee = 5 | |
37 | 37 | ||
38 | 38 | let feeDelimiter = 10000 | |
39 | 39 | ||
40 | 40 | func readProposalData (id) = { | |
41 | 41 | let status = valueOrErrorMessage(getString(this, (id + kStatus)), (("Proposal with id '" + id) + "' not found")) | |
42 | 42 | let ownerAddr = addressFromStringValue(valueOrErrorMessage(getString(this, (id + kOwner)), "owner not set")) | |
43 | 43 | let proposedAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kProposedAssetId)), "Proposed asset not found")), "Incorrect proposed asset id") | |
44 | 44 | let proposedAssetAmount = valueOrErrorMessage(getInteger(this, (id + kProposedAssetAmount)), "Proposed amount not found") | |
45 | 45 | let desiredAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kDesiredAssetId)), "Desired asset not found")), "Incorrect desired asset id") | |
46 | 46 | let desiredAssetAmount = valueOrErrorMessage(getInteger(this, (id + kDesiredAmount)), "Desired amount not found") | |
47 | 47 | let partialAllowed = valueOrErrorMessage(getBoolean(this, (id + kPartial)), "Partial setting isn't set") | |
48 | 48 | let filled = valueOrElse(getInteger(this, (id + kFilled)), 0) | |
49 | 49 | let txs = valueOrElse(getString(this, (id + kCloseTxId)), "") | |
50 | 50 | $Tuple9(status, ownerAddr, proposedAssetId, proposedAssetAmount, desiredAssetId, desiredAssetAmount, partialAllowed, filled, txs) | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | @Callable(i) | |
55 | 55 | func placeProposal (desireToGetAssetId,desireToGetAmount,partial) = { | |
56 | 56 | let $t019602059 = $Tuple2(i.payments[0].amount, toBase58String(value(i.payments[0].assetId))) | |
57 | 57 | let pmtAmount = $t019602059._1 | |
58 | 58 | let pmtAssetId = $t019602059._2 | |
59 | 59 | let id = toBase58String(i.transactionId) | |
60 | 60 | if (isDefined(getString(this, (id + kStatus)))) | |
61 | 61 | then throw("ID already registered") | |
62 | 62 | else { | |
63 | 63 | let prop_total = valueOrElse(getInteger(this, kProposalTotal), 0) | |
64 | 64 | [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(("6HWWAqci8fPbnQf6DMGgPcHgzkzHnaJNHjsskLEJypjJ" + kFilled), 0)] | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func cancelProposal (id) = { | |
72 | 72 | let $t029103059 = readProposalData(id) | |
73 | 73 | let status = $t029103059._1 | |
74 | 74 | let ownerAddr = $t029103059._2 | |
75 | 75 | let proposedAssetId = $t029103059._3 | |
76 | 76 | let proposedAssetAmount = $t029103059._4 | |
77 | 77 | let desiredAssetId = $t029103059._5 | |
78 | 78 | let desiredAssetAmount = $t029103059._6 | |
79 | 79 | let partialAllowed = $t029103059._7 | |
80 | 80 | let filled = $t029103059._8 | |
81 | 81 | let txs = $t029103059._9 | |
82 | - | if (( | |
83 | - | then throw(" | |
84 | - | else if (( | |
85 | - | then throw( | |
82 | + | if ((status != statusActive)) | |
83 | + | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
84 | + | else if ((i.caller != ownerAddr)) | |
85 | + | then throw("Only owner can cancel") | |
86 | 86 | else { | |
87 | 87 | let proposedAssetUsedAmount = fraction(filled, proposedAssetAmount, desiredAssetAmount) | |
88 | 88 | [ScriptTransfer(ownerAddr, (proposedAssetAmount - proposedAssetUsedAmount), proposedAssetId), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func acceptProposal (id) = { | |
96 | 96 | let $t036173700 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
97 | 97 | let pmtAmount = $t036173700._1 | |
98 | 98 | let pmtAssetId = $t036173700._2 | |
99 | 99 | let $t037043853 = readProposalData(id) | |
100 | 100 | let status = $t037043853._1 | |
101 | 101 | let ownerAddr = $t037043853._2 | |
102 | 102 | let proposedAssetId = $t037043853._3 | |
103 | 103 | let proposedAssetAmount = $t037043853._4 | |
104 | 104 | let desiredAssetId = $t037043853._5 | |
105 | 105 | let desiredAssetAmount = $t037043853._6 | |
106 | 106 | let partialAllowed = $t037043853._7 | |
107 | 107 | let filled = $t037043853._8 | |
108 | 108 | let txs = $t037043853._9 | |
109 | 109 | if ((status != statusActive)) | |
110 | 110 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
111 | 111 | else if ((desiredAssetId != pmtAssetId)) | |
112 | 112 | then throw("Atatched asset doesn't match desired") | |
113 | 113 | else { | |
114 | 114 | let $t040654394 = if (!(partialAllowed)) | |
115 | 115 | then if ((desiredAssetAmount != pmtAmount)) | |
116 | 116 | then throw("Attached asset amount doesn't match") | |
117 | 117 | else $Tuple2(pmtAmount, desiredAssetAmount) | |
118 | 118 | else { | |
119 | 119 | let a1 = min([pmtAmount, (desiredAssetAmount - filled)]) | |
120 | 120 | $Tuple2(a1, fraction(proposedAssetAmount, a1, desiredAssetAmount)) | |
121 | 121 | } | |
122 | 122 | let amount1 = $t040654394._1 | |
123 | 123 | let amount2 = $t040654394._2 | |
124 | 124 | if ((amount2 == 0)) | |
125 | 125 | then throw("Payment amount is not enough to get something in change") | |
126 | 126 | else { | |
127 | 127 | let filledNew = (filled + amount1) | |
128 | 128 | let statusNew = if ((filledNew == desiredAssetAmount)) | |
129 | 129 | then statusDone | |
130 | 130 | else statusActive | |
131 | 131 | [ScriptTransfer(ownerAddr, amount1, desiredAssetId), ScriptTransfer(i.caller, amount2, proposedAssetId), ScriptTransfer(i.caller, (pmtAmount - amount1), desiredAssetId), IntegerEntry((id + kFilled), filledNew), StringEntry((id + kStatus), statusNew), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
132 | 132 | } | |
133 | 133 | } | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Callable(i) | |
139 | 139 | func matchProposals (id1,id2) = { | |
140 | 140 | let $t050365195 = readProposalData(id1) | |
141 | 141 | let status1 = $t050365195._1 | |
142 | 142 | let ownerAddr1 = $t050365195._2 | |
143 | 143 | let proposedAssetId1 = $t050365195._3 | |
144 | 144 | let proposedAssetAmount1 = $t050365195._4 | |
145 | 145 | let desiredAssetId1 = $t050365195._5 | |
146 | 146 | let desiredAssetAmount1 = $t050365195._6 | |
147 | 147 | let partialAllowed1 = $t050365195._7 | |
148 | 148 | let filled1 = $t050365195._8 | |
149 | 149 | let txs1 = $t050365195._9 | |
150 | 150 | let $t051985357 = readProposalData(id2) | |
151 | 151 | let status2 = $t051985357._1 | |
152 | 152 | let ownerAddr2 = $t051985357._2 | |
153 | 153 | let proposedAssetId2 = $t051985357._3 | |
154 | 154 | let proposedAssetAmount2 = $t051985357._4 | |
155 | 155 | let desiredAssetId2 = $t051985357._5 | |
156 | 156 | let desiredAssetAmount2 = $t051985357._6 | |
157 | 157 | let partialAllowed2 = $t051985357._7 | |
158 | 158 | let filled2 = $t051985357._8 | |
159 | 159 | let txs2 = $t051985357._9 | |
160 | 160 | if ((status1 != statusActive)) | |
161 | 161 | then throw(((("Proposal with id '" + id1) + "' is not active. Status: ") + status1)) | |
162 | 162 | else if ((status2 != statusActive)) | |
163 | 163 | then throw(((("Proposal with id '" + id2) + "' is not active. Status: ") + status2)) | |
164 | 164 | else if (if ((desiredAssetId1 != proposedAssetId2)) | |
165 | 165 | then true | |
166 | 166 | else (desiredAssetId2 != proposedAssetId1)) | |
167 | 167 | then throw("Assets in proposals doesn't match") | |
168 | 168 | else { | |
169 | 169 | let price1 = fraction(proposedAssetAmount1, scale8, desiredAssetAmount1) | |
170 | 170 | let price2 = fraction(desiredAssetAmount2, scale8, proposedAssetAmount2) | |
171 | 171 | if ((price2 > price1)) | |
172 | 172 | then throw(((("Price doesn't match. price1 = " + toString(price1)) + ", price2 = ") + toString(price2))) | |
173 | 173 | else { | |
174 | 174 | let usedPrice = ((price1 + price2) / 2) | |
175 | 175 | let amount0 = min([proposedAssetAmount1, (desiredAssetAmount2 - filled2)]) | |
176 | 176 | let amount2 = min([fraction(amount0, scale8, usedPrice), (desiredAssetAmount1 - filled1)]) | |
177 | 177 | let amount1 = fraction(amount2, usedPrice, scale8) | |
178 | 178 | let newFilled1 = (filled1 + amount2) | |
179 | 179 | let newFilled2 = (filled2 + amount1) | |
180 | 180 | let result0 = [ScriptTransfer(ownerAddr1, amount2, desiredAssetId1), ScriptTransfer(ownerAddr2, amount1, desiredAssetId2), IntegerEntry((id1 + kFilled), newFilled1), IntegerEntry((id2 + kFilled), newFilled2), StringEntry((id1 + kCloseTxId), ((txs1 + ":") + toBase58String(i.transactionId))), StringEntry((id2 + kCloseTxId), ((txs2 + ":") + toBase58String(i.transactionId)))] | |
181 | 181 | func appendResult (r0,ownerAddr,id,proposedAmountLeft,desiredAmountLeft,proposedAssetId) = if (if ((0 > proposedAmountLeft)) | |
182 | 182 | then true | |
183 | 183 | else (0 > desiredAmountLeft)) | |
184 | 184 | then throw("Internal error with calculation") | |
185 | 185 | else if ((proposedAmountLeft == 0)) | |
186 | 186 | then (r0 :+ StringEntry((id + kStatus), statusDone)) | |
187 | 187 | else if ((desiredAmountLeft == 0)) | |
188 | 188 | then (r0 ++ [ScriptTransfer(ownerAddr, proposedAmountLeft, proposedAssetId), StringEntry((id + kStatus), statusDone)]) | |
189 | 189 | else r0 | |
190 | 190 | ||
191 | 191 | let proposedAmountLeft1 = (proposedAssetAmount1 - amount1) | |
192 | 192 | let desiredAmountLeft1 = (desiredAssetAmount1 - amount2) | |
193 | 193 | let proposedAmountLeft2 = (proposedAssetAmount1 - amount2) | |
194 | 194 | let desiredAmountLeft2 = (desiredAssetAmount1 - amount1) | |
195 | 195 | let result1 = appendResult(result0, ownerAddr1, id1, proposedAmountLeft1, desiredAmountLeft1, proposedAssetId1) | |
196 | 196 | let result2 = appendResult(result1, ownerAddr2, id2, proposedAmountLeft2, desiredAmountLeft2, proposedAssetId2) | |
197 | 197 | result2 | |
198 | 198 | } | |
199 | 199 | } | |
200 | 200 | } | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | ||
204 | 204 | @Callable(i) | |
205 | 205 | func executeOnSwopfi (id,pool) = { | |
206 | 206 | let $t083968545 = readProposalData(id) | |
207 | 207 | let status = $t083968545._1 | |
208 | 208 | let ownerAddr = $t083968545._2 | |
209 | 209 | let proposedAssetId = $t083968545._3 | |
210 | 210 | let proposedAssetAmount = $t083968545._4 | |
211 | 211 | let desiredAssetId = $t083968545._5 | |
212 | 212 | let desiredAssetAmount = $t083968545._6 | |
213 | 213 | let partialAllowed = $t083968545._7 | |
214 | 214 | let filled = $t083968545._8 | |
215 | 215 | let txs = $t083968545._9 | |
216 | 216 | if ((status != statusActive)) | |
217 | 217 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
218 | 218 | else { | |
219 | 219 | let poolAddr = valueOrErrorMessage(addressFromString(pool), "Wrong pool address") | |
220 | 220 | let poolAssetA = getStringValue(poolAddr, "A_asset_id") | |
221 | 221 | let poolAssetB = getStringValue(poolAddr, "B_asset_id") | |
222 | 222 | let proposedAssetId1 = "" | |
223 | 223 | let desiredAssetId1 = "" | |
224 | 224 | let t = if (if ((poolAssetA == proposedAssetId1)) | |
225 | 225 | then (poolAssetB == desiredAssetId1) | |
226 | 226 | else false) | |
227 | 227 | then 1 | |
228 | 228 | else if (if ((poolAssetB == proposedAssetId1)) | |
229 | 229 | then (poolAssetA == desiredAssetId1) | |
230 | 230 | else false) | |
231 | 231 | then 2 | |
232 | 232 | else throw("Pool doesn't match proposal") | |
233 | 233 | let poolBalA = getIntegerValue(poolAddr, "A_asset_balance") | |
234 | 234 | let poolBalB = getIntegerValue(poolAddr, "B_asset_balance") | |
235 | 235 | let bal1 = if ((t == 1)) | |
236 | 236 | then poolBalA | |
237 | 237 | else poolBalB | |
238 | 238 | let bal2 = if ((t == 1)) | |
239 | 239 | then poolBalB | |
240 | 240 | else poolBalA | |
241 | 241 | let ratio = fraction(desiredAssetAmount, scale8, proposedAssetAmount) | |
242 | 242 | let maxPay = (fraction(bal2, (((feeDelimiter - poolFee) - orderFee) * scale8), (feeDelimiter * ratio)) - bal1) | |
243 | 243 | let toPay = min([maxPay, proposedAssetAmount]) | |
244 | 244 | let toGet = fraction(bal2, toPay, (bal1 + toPay)) | |
245 | 245 | nil | |
246 | 246 | } | |
247 | 247 | } | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | @Verifier(tx) | |
251 | 251 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
252 | 252 |
github/deemru/w8io/169f3d6 67.85 ms ◑