tx · 3fGDbei1YTGTTrXxxdeHyozEZ1xu7mZ88VQCPpCypH4R 3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr: -0.01400000 Waves 2022.04.07 17:38 [1998277] smart account 3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr > SELF 0.00000000 Waves
{ "type": 13, "id": "3fGDbei1YTGTTrXxxdeHyozEZ1xu7mZ88VQCPpCypH4R", "fee": 1400000, "feeAssetId": null, "timestamp": 1649342334409, "version": 2, "chainId": 84, "sender": "3N9Tq8RmGw456c1eYphzoMyvtwJGrY98jfr", "senderPublicKey": "He9ZSnjQZGhUkdUsMVVz4t6eAU1c2owedXGCfY1WZvnU", "proofs": [ "55bpnseJWdJGyZdnR5FEfjFXHU9teCBmddsXfFX4uC8M9sNuYGkgRRFvzJzpfUFk5BP7XmfD5f6fQQNaRbBL6Ugo" ], "script": "base64:AAIFAAAAAAAAAB8IAhIFCgMIAQQSAwoBCBIDCgEIEgQKAggIEgQKAggIAAAAEwAAAAAQa1Byb3Bvc2VkQXNzZXRJZAIAAAATX3Byb3Bvc2VkX2Fzc2V0MV9pZAAAAAAUa1Byb3Bvc2VkQXNzZXRBbW91bnQCAAAAF19wcm9wb3NlZF9hc3NldDFfYW1vdW50AAAAAA9rRGVzaXJlZEFzc2V0SWQCAAAAEV9kZXNpcmVkX2Fzc2V0X2lkAAAAAA5rRGVzaXJlZEFtb3VudAIAAAAVX2Rlc2lyZWRfYXNzZXRfYW1vdW50AAAAAAdrU3RhdHVzAgAAAAdfc3RhdHVzAAAAAAZrT3duZXICAAAABl9vd25lcgAAAAAKa0Nsb3NlVHhJZAIAAAAMX2Nsb3NlX3R4X2lkAAAAAAhrUGFydGlhbAIAAAAIX3BhcnRpYWwAAAAAB2tGaWxsZWQCAAAAB19maWxsZWQAAAAACWtQcm9wb3NhbAIAAAAFcHJvcF8AAAAADmtQcm9wb3NhbFRvdGFsAgAAAApwcm9wX3RvdGFsAAAAAAxzdGF0dXNBY3RpdmUCAA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IJAABoAAAAAgkAAGUAAAACCQAAZQAAAAIFAAAADGZlZURlbGltaXRlcgUAAAAHcG9vbEZlZQUAAAAIb3JkZXJGZWUFAAAABnNjYWxlOAkAAGgAAAACBQAAAAxmZWVEZWxpbWl0ZXIFAAAABXJhdGlvBQAAAARiYWwxBAAAAAV0b1BheQkAAZcAAAABCQAETAAAAAIFAAAABm1heFBheQkABEwAAAACBQAAABNwcm9wb3NlZEFzc2V0QW1vdW50BQAAAANuaWwEAAAABXRvR2V0CQAAawAAAAMFAAAABGJhbDIFAAAABXRvUGF5CQAAZAAAAAIFAAAABGJhbDEFAAAABXRvUGF5BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleUBbUTE=", "height": 1998277, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BfW7VndERmTFtJA3x9BKcKxTsk7AkGJTvbJuPEvE6aLH Next: HVz6uxXi1XFWTUGXfFFqwf35VArQUYo9q1M5h244VMBK Diff:
Old | New | Differences | |
---|---|---|---|
116 | 116 | } | |
117 | 117 | let amount1 = $t038874216._1 | |
118 | 118 | let amount2 = $t038874216._2 | |
119 | - | let filledNew = (filled + amount1) | |
120 | - | let statusNew = if ((filledNew == desiredAssetAmount)) | |
121 | - | then statusDone | |
122 | - | else statusActive | |
119 | + | if ((amount2 == 0)) | |
120 | + | then throw("Payment amount is not enough to get something in change") | |
121 | + | else { | |
122 | + | let filledNew = (filled + amount1) | |
123 | + | let statusNew = if ((filledNew == desiredAssetAmount)) | |
124 | + | then statusDone | |
125 | + | else statusActive | |
123 | 126 | [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)))] | |
127 | + | } | |
124 | 128 | } | |
125 | 129 | } | |
126 | 130 | ||
128 | 132 | ||
129 | 133 | @Callable(i) | |
130 | 134 | func matchProposals (id1,id2) = { | |
131 | - | let $ | |
132 | - | let status1 = $ | |
133 | - | let ownerAddr1 = $ | |
134 | - | let proposedAssetId1 = $ | |
135 | - | let proposedAssetAmount1 = $ | |
136 | - | let desiredAssetId1 = $ | |
137 | - | let desiredAssetAmount1 = $ | |
138 | - | let partialAllowed1 = $ | |
139 | - | let filled1 = $ | |
140 | - | let txs1 = $ | |
141 | - | let $ | |
142 | - | let status2 = $ | |
143 | - | let ownerAddr2 = $ | |
144 | - | let proposedAssetId2 = $ | |
145 | - | let proposedAssetAmount2 = $ | |
146 | - | let desiredAssetId2 = $ | |
147 | - | let desiredAssetAmount2 = $ | |
148 | - | let partialAllowed2 = $ | |
149 | - | let filled2 = $ | |
150 | - | let txs2 = $ | |
135 | + | let $t048585017 = readProposalData(id1) | |
136 | + | let status1 = $t048585017._1 | |
137 | + | let ownerAddr1 = $t048585017._2 | |
138 | + | let proposedAssetId1 = $t048585017._3 | |
139 | + | let proposedAssetAmount1 = $t048585017._4 | |
140 | + | let desiredAssetId1 = $t048585017._5 | |
141 | + | let desiredAssetAmount1 = $t048585017._6 | |
142 | + | let partialAllowed1 = $t048585017._7 | |
143 | + | let filled1 = $t048585017._8 | |
144 | + | let txs1 = $t048585017._9 | |
145 | + | let $t050205179 = readProposalData(id2) | |
146 | + | let status2 = $t050205179._1 | |
147 | + | let ownerAddr2 = $t050205179._2 | |
148 | + | let proposedAssetId2 = $t050205179._3 | |
149 | + | let proposedAssetAmount2 = $t050205179._4 | |
150 | + | let desiredAssetId2 = $t050205179._5 | |
151 | + | let desiredAssetAmount2 = $t050205179._6 | |
152 | + | let partialAllowed2 = $t050205179._7 | |
153 | + | let filled2 = $t050205179._8 | |
154 | + | let txs2 = $t050205179._9 | |
151 | 155 | if ((status1 != statusActive)) | |
152 | 156 | then throw(((("Proposal with id '" + id1) + "' is not active. Status: ") + status1)) | |
153 | 157 | else if ((status2 != statusActive)) | |
194 | 198 | ||
195 | 199 | @Callable(i) | |
196 | 200 | func executeOnSwopfi (id,pool) = { | |
197 | - | let $ | |
198 | - | let status = $ | |
199 | - | let ownerAddr = $ | |
200 | - | let proposedAssetId = $ | |
201 | - | let proposedAssetAmount = $ | |
202 | - | let desiredAssetId = $ | |
203 | - | let desiredAssetAmount = $ | |
204 | - | let partialAllowed = $ | |
205 | - | let filled = $ | |
206 | - | let txs = $ | |
201 | + | let $t082188367 = readProposalData(id) | |
202 | + | let status = $t082188367._1 | |
203 | + | let ownerAddr = $t082188367._2 | |
204 | + | let proposedAssetId = $t082188367._3 | |
205 | + | let proposedAssetAmount = $t082188367._4 | |
206 | + | let desiredAssetId = $t082188367._5 | |
207 | + | let desiredAssetAmount = $t082188367._6 | |
208 | + | let partialAllowed = $t082188367._7 | |
209 | + | let filled = $t082188367._8 | |
210 | + | let txs = $t082188367._9 | |
207 | 211 | if ((status != statusActive)) | |
208 | 212 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
209 | 213 | else { |
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 | 82 | if ((status != statusActive)) | |
83 | 83 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
84 | 84 | else [ScriptTransfer(ownerAddr, (proposedAssetAmount - filled), proposedAssetId), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), ((txs + ":") + toBase58String(i.transactionId)))] | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func acceptProposal (id) = { | |
91 | 91 | let $t034393522 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
92 | 92 | let pmtAmount = $t034393522._1 | |
93 | 93 | let pmtAssetId = $t034393522._2 | |
94 | 94 | let $t035263675 = readProposalData(id) | |
95 | 95 | let status = $t035263675._1 | |
96 | 96 | let ownerAddr = $t035263675._2 | |
97 | 97 | let proposedAssetId = $t035263675._3 | |
98 | 98 | let proposedAssetAmount = $t035263675._4 | |
99 | 99 | let desiredAssetId = $t035263675._5 | |
100 | 100 | let desiredAssetAmount = $t035263675._6 | |
101 | 101 | let partialAllowed = $t035263675._7 | |
102 | 102 | let filled = $t035263675._8 | |
103 | 103 | let txs = $t035263675._9 | |
104 | 104 | if ((status != statusActive)) | |
105 | 105 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
106 | 106 | else if ((desiredAssetId != pmtAssetId)) | |
107 | 107 | then throw("Atatched asset doesn't match desired") | |
108 | 108 | else { | |
109 | 109 | let $t038874216 = if (!(partialAllowed)) | |
110 | 110 | then if ((desiredAssetAmount != pmtAmount)) | |
111 | 111 | then throw("Attached asset amount doesn't match") | |
112 | 112 | else $Tuple2(pmtAmount, desiredAssetAmount) | |
113 | 113 | else { | |
114 | 114 | let a1 = min([pmtAmount, (desiredAssetAmount - filled)]) | |
115 | 115 | $Tuple2(a1, fraction(proposedAssetAmount, a1, desiredAssetAmount)) | |
116 | 116 | } | |
117 | 117 | let amount1 = $t038874216._1 | |
118 | 118 | let amount2 = $t038874216._2 | |
119 | - | let filledNew = (filled + amount1) | |
120 | - | let statusNew = if ((filledNew == desiredAssetAmount)) | |
121 | - | then statusDone | |
122 | - | else statusActive | |
119 | + | if ((amount2 == 0)) | |
120 | + | then throw("Payment amount is not enough to get something in change") | |
121 | + | else { | |
122 | + | let filledNew = (filled + amount1) | |
123 | + | let statusNew = if ((filledNew == desiredAssetAmount)) | |
124 | + | then statusDone | |
125 | + | else statusActive | |
123 | 126 | [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)))] | |
127 | + | } | |
124 | 128 | } | |
125 | 129 | } | |
126 | 130 | ||
127 | 131 | ||
128 | 132 | ||
129 | 133 | @Callable(i) | |
130 | 134 | func matchProposals (id1,id2) = { | |
131 | - | let $ | |
132 | - | let status1 = $ | |
133 | - | let ownerAddr1 = $ | |
134 | - | let proposedAssetId1 = $ | |
135 | - | let proposedAssetAmount1 = $ | |
136 | - | let desiredAssetId1 = $ | |
137 | - | let desiredAssetAmount1 = $ | |
138 | - | let partialAllowed1 = $ | |
139 | - | let filled1 = $ | |
140 | - | let txs1 = $ | |
141 | - | let $ | |
142 | - | let status2 = $ | |
143 | - | let ownerAddr2 = $ | |
144 | - | let proposedAssetId2 = $ | |
145 | - | let proposedAssetAmount2 = $ | |
146 | - | let desiredAssetId2 = $ | |
147 | - | let desiredAssetAmount2 = $ | |
148 | - | let partialAllowed2 = $ | |
149 | - | let filled2 = $ | |
150 | - | let txs2 = $ | |
135 | + | let $t048585017 = readProposalData(id1) | |
136 | + | let status1 = $t048585017._1 | |
137 | + | let ownerAddr1 = $t048585017._2 | |
138 | + | let proposedAssetId1 = $t048585017._3 | |
139 | + | let proposedAssetAmount1 = $t048585017._4 | |
140 | + | let desiredAssetId1 = $t048585017._5 | |
141 | + | let desiredAssetAmount1 = $t048585017._6 | |
142 | + | let partialAllowed1 = $t048585017._7 | |
143 | + | let filled1 = $t048585017._8 | |
144 | + | let txs1 = $t048585017._9 | |
145 | + | let $t050205179 = readProposalData(id2) | |
146 | + | let status2 = $t050205179._1 | |
147 | + | let ownerAddr2 = $t050205179._2 | |
148 | + | let proposedAssetId2 = $t050205179._3 | |
149 | + | let proposedAssetAmount2 = $t050205179._4 | |
150 | + | let desiredAssetId2 = $t050205179._5 | |
151 | + | let desiredAssetAmount2 = $t050205179._6 | |
152 | + | let partialAllowed2 = $t050205179._7 | |
153 | + | let filled2 = $t050205179._8 | |
154 | + | let txs2 = $t050205179._9 | |
151 | 155 | if ((status1 != statusActive)) | |
152 | 156 | then throw(((("Proposal with id '" + id1) + "' is not active. Status: ") + status1)) | |
153 | 157 | else if ((status2 != statusActive)) | |
154 | 158 | then throw(((("Proposal with id '" + id2) + "' is not active. Status: ") + status2)) | |
155 | 159 | else if (if ((desiredAssetId1 != proposedAssetId2)) | |
156 | 160 | then true | |
157 | 161 | else (desiredAssetId2 != proposedAssetId1)) | |
158 | 162 | then throw("Assets in proposals doesn't match") | |
159 | 163 | else { | |
160 | 164 | let price1 = fraction(proposedAssetAmount1, scale8, desiredAssetAmount1) | |
161 | 165 | let price2 = fraction(desiredAssetAmount2, scale8, proposedAssetAmount2) | |
162 | 166 | if ((price2 > price1)) | |
163 | 167 | then throw(((("Price doesn't match. price1 = " + toString(price1)) + ", price2 = ") + toString(price2))) | |
164 | 168 | else { | |
165 | 169 | let usedPrice = ((price1 + price2) / 2) | |
166 | 170 | let amount0 = min([proposedAssetAmount1, (desiredAssetAmount2 - filled2)]) | |
167 | 171 | let amount2 = min([fraction(amount0, scale8, usedPrice), (desiredAssetAmount1 - filled1)]) | |
168 | 172 | let amount1 = fraction(amount2, usedPrice, scale8) | |
169 | 173 | let newFilled1 = (filled1 + amount2) | |
170 | 174 | let newFilled2 = (filled2 + amount1) | |
171 | 175 | 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)))] | |
172 | 176 | func appendResult (r0,ownerAddr,id,proposedAmountLeft,desiredAmountLeft,proposedAssetId) = if (if ((0 > proposedAmountLeft)) | |
173 | 177 | then true | |
174 | 178 | else (0 > desiredAmountLeft)) | |
175 | 179 | then throw("Internal error with calculation") | |
176 | 180 | else if ((proposedAmountLeft == 0)) | |
177 | 181 | then (r0 :+ StringEntry((id + kStatus), statusDone)) | |
178 | 182 | else if ((desiredAmountLeft == 0)) | |
179 | 183 | then (r0 ++ [ScriptTransfer(ownerAddr, proposedAmountLeft, proposedAssetId), StringEntry((id + kStatus), statusDone)]) | |
180 | 184 | else r0 | |
181 | 185 | ||
182 | 186 | let proposedAmountLeft1 = (proposedAssetAmount1 - amount1) | |
183 | 187 | let desiredAmountLeft1 = (desiredAssetAmount1 - amount2) | |
184 | 188 | let proposedAmountLeft2 = (proposedAssetAmount1 - amount2) | |
185 | 189 | let desiredAmountLeft2 = (desiredAssetAmount1 - amount1) | |
186 | 190 | let result1 = appendResult(result0, ownerAddr1, id1, proposedAmountLeft1, desiredAmountLeft1, proposedAssetId1) | |
187 | 191 | let result2 = appendResult(result1, ownerAddr2, id2, proposedAmountLeft2, desiredAmountLeft2, proposedAssetId2) | |
188 | 192 | result2 | |
189 | 193 | } | |
190 | 194 | } | |
191 | 195 | } | |
192 | 196 | ||
193 | 197 | ||
194 | 198 | ||
195 | 199 | @Callable(i) | |
196 | 200 | func executeOnSwopfi (id,pool) = { | |
197 | - | let $ | |
198 | - | let status = $ | |
199 | - | let ownerAddr = $ | |
200 | - | let proposedAssetId = $ | |
201 | - | let proposedAssetAmount = $ | |
202 | - | let desiredAssetId = $ | |
203 | - | let desiredAssetAmount = $ | |
204 | - | let partialAllowed = $ | |
205 | - | let filled = $ | |
206 | - | let txs = $ | |
201 | + | let $t082188367 = readProposalData(id) | |
202 | + | let status = $t082188367._1 | |
203 | + | let ownerAddr = $t082188367._2 | |
204 | + | let proposedAssetId = $t082188367._3 | |
205 | + | let proposedAssetAmount = $t082188367._4 | |
206 | + | let desiredAssetId = $t082188367._5 | |
207 | + | let desiredAssetAmount = $t082188367._6 | |
208 | + | let partialAllowed = $t082188367._7 | |
209 | + | let filled = $t082188367._8 | |
210 | + | let txs = $t082188367._9 | |
207 | 211 | if ((status != statusActive)) | |
208 | 212 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
209 | 213 | else { | |
210 | 214 | let poolAddr = valueOrErrorMessage(addressFromString(pool), "Wrong pool address") | |
211 | 215 | let poolAssetA = getStringValue(poolAddr, "A_asset_id") | |
212 | 216 | let poolAssetB = getStringValue(poolAddr, "B_asset_id") | |
213 | 217 | let proposedAssetId1 = "" | |
214 | 218 | let desiredAssetId1 = "" | |
215 | 219 | let t = if (if ((poolAssetA == proposedAssetId1)) | |
216 | 220 | then (poolAssetB == desiredAssetId1) | |
217 | 221 | else false) | |
218 | 222 | then 1 | |
219 | 223 | else if (if ((poolAssetB == proposedAssetId1)) | |
220 | 224 | then (poolAssetA == desiredAssetId1) | |
221 | 225 | else false) | |
222 | 226 | then 2 | |
223 | 227 | else throw("Pool doesn't match proposal") | |
224 | 228 | let poolBalA = getIntegerValue(poolAddr, "A_asset_balance") | |
225 | 229 | let poolBalB = getIntegerValue(poolAddr, "B_asset_balance") | |
226 | 230 | let bal1 = if ((t == 1)) | |
227 | 231 | then poolBalA | |
228 | 232 | else poolBalB | |
229 | 233 | let bal2 = if ((t == 1)) | |
230 | 234 | then poolBalB | |
231 | 235 | else poolBalA | |
232 | 236 | let ratio = fraction(desiredAssetAmount, scale8, proposedAssetAmount) | |
233 | 237 | let maxPay = (fraction(bal2, (((feeDelimiter - poolFee) - orderFee) * scale8), (feeDelimiter * ratio)) - bal1) | |
234 | 238 | let toPay = min([maxPay, proposedAssetAmount]) | |
235 | 239 | let toGet = fraction(bal2, toPay, (bal1 + toPay)) | |
236 | 240 | nil | |
237 | 241 | } | |
238 | 242 | } | |
239 | 243 | ||
240 | 244 | ||
241 | 245 | @Verifier(tx) | |
242 | 246 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
243 | 247 |
github/deemru/w8io/169f3d6 81.97 ms ◑