tx · 2JTtQX6QWVH7gidsJBw3xX9idARLEFScRbFp1HoQ5hrs

3N99iJ7nhpJnb7RyucdZREx2ESs3XhKfBNh:  -0.01000000 Waves

2022.04.07 18:50 [1998345] smart account 3N99iJ7nhpJnb7RyucdZREx2ESs3XhKfBNh > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
42.35 ms