tx · Ary5AQ2rFWpkDw3FAZPVhYBtFtkhA2wfkovPMfvzi8Yz 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS: -0.01100000 Waves 2023.03.24 16:40 [2504166] smart account 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS > SELF 0.00000000 Waves
{ "type": 13, "id": "Ary5AQ2rFWpkDw3FAZPVhYBtFtkhA2wfkovPMfvzi8Yz", "fee": 1100000, "feeAssetId": null, "timestamp": 1679665270887, "version": 2, "chainId": 84, "sender": "3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS", "senderPublicKey": "HP8sssVq1866F7CaPQJwgFrt6fsqhQjKwM84cL1wjD2a", "proofs": [ "22ZpUHicyXPMpnZ58jMMFfQ4nEFqL3AMhw1wdL56gMknSUn4kWCcwfSCZ6Yc8UL6NhEJQ3fZfZmPBNNyfNf29djX" ], "script": "base64:BgIeCAISBwoFCAEIAQESAwoBCBIDCgEIEgcKBQgIAQEBJgALU0ZfUE9TX1RZUEUCAlNGAAtXWF9QT1NfVFlQRQICV1gABlNDQUxFOACAwtcvAApGRUVfU0NBTEU2AMCEPQAUa1NGUG9vbEFBc3NldEJhbGFuY2UCD0FfYXNzZXRfYmFsYW5jZQAUa1NGUG9vbEJBc3NldEJhbGFuY2UCD0JfYXNzZXRfYmFsYW5jZQAPa1NGUG9vbEFBc3NldElkAgpBX2Fzc2V0X2lkAA9rU0ZQb29sQkFzc2V0SWQCCkJfYXNzZXRfaWQADmtTRlBvb2xTaGFyZUlkAg5zaGFyZV9hc3NldF9pZAAOa1NGUG9vbFZlcnNpb24CB3ZlcnNpb24AEGtTRkZhcm1pbmdTdGFrZWQCFF9zaGFyZV90b2tlbnNfbG9ja2VkAA1rVXNlclBvc2l0aW9uAg5fdXNlcl9wb3NpdGlvbgARa1VzZXJQb3NpdGlvblR5cGUCE191c2VyX3Bvc2l0aW9uX3R5cGUAEGtVc2VyUG9zaXRpb25OdW0CFV91c2VyX3Bv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1ZXN0SWQFCmtSZXF1ZXN0SWQFBnBhcmFtcwUDbmlsBQxuZXdSZXF1ZXN0SWQBaQELaW5pdE5ld1Bvb2wFBHR5cGUIcG9vbEFkZHILaW5GZWVOb0xvYW4JaW5GZWVMb2FuBmNhcEZlZQMDCQECIT0CBQR0eXBlBQtTRl9QT1NfVFlQRQkBAiE9AgUEdHlwZQULV1hfUE9TX1RZUEUHCQACAQIKV3JvbmcgdHlwZQkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQhwb29sQWRkcgUVa0F4bHlJbkZlZVdpdGhvdXRMb2FuBQtpbkZlZU5vTG9hbgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQhwb29sQWRkcgUSa0F4bHlJbkZlZVdpdGhMb2FuBQtpbkZlZU5vTG9hbgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQhwb29sQWRkcgULa0F4bHlDYXBGZWUFBmNhcEZlZQkAzAgCCQELU3RyaW5nRW50cnkCBQVrUG9vbAUEdHlwZQUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlefz9KaY=", "height": 2504166, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 8TxLWrWRvX18P347dc4dKx3hi3pCtj1KP9ciiwtqSppK Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SF_POS_TYPE = "SF" | |
5 | + | ||
6 | + | let WX_POS_TYPE = "WX" | |
7 | + | ||
8 | + | let SCALE8 = 100000000 | |
9 | + | ||
10 | + | let FEE_SCALE6 = 1000000 | |
11 | + | ||
12 | + | let kSFPoolAAssetBalance = "A_asset_balance" | |
13 | + | ||
14 | + | let kSFPoolBAssetBalance = "B_asset_balance" | |
15 | + | ||
16 | + | let kSFPoolAAssetId = "A_asset_id" | |
17 | + | ||
18 | + | let kSFPoolBAssetId = "B_asset_id" | |
19 | + | ||
20 | + | let kSFPoolShareId = "share_asset_id" | |
21 | + | ||
22 | + | let kSFPoolVersion = "version" | |
23 | + | ||
24 | + | let kSFFarmingStaked = "_share_tokens_locked" | |
25 | + | ||
26 | + | let kUserPosition = "_user_position" | |
27 | + | ||
28 | + | let kUserPositionType = "_user_position_type" | |
29 | + | ||
30 | + | let kUserPositionNum = "_user_position_number" | |
31 | + | ||
32 | + | let kTotalPosition = "_total_position" | |
33 | + | ||
34 | + | let kAxlyInFeeWithoutLoan = "_axly_fee_without_loan" | |
35 | + | ||
36 | + | let kAxlyInFeeWithLoan = "_axly_fee_with_loan" | |
37 | + | ||
38 | + | let kAxlyCapFee = "_axly_fee_cap" | |
39 | + | ||
40 | + | let kRequestId = "_request_id" | |
41 | + | ||
42 | + | let kRequestIter = "requests_iter" | |
43 | + | ||
44 | + | let kPool = "pool_" | |
45 | + | ||
46 | + | let kMoneyBox = "axly_money_box" | |
47 | + | ||
48 | + | let kSFFarmingAddr = "swopfi_farming_addr" | |
49 | + | ||
50 | + | let kLendService = "lendServiceAddr" | |
51 | + | ||
52 | + | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
53 | + | ||
54 | + | func isSelfCall (i) = if ((i.caller == this)) | |
55 | + | then unit | |
56 | + | else throw("Only contract itself can call this function") | |
57 | + | ||
58 | + | ||
59 | + | func accountBalance (assetId) = match assetId { | |
60 | + | case id: ByteVector => | |
61 | + | assetBalance(this, id) | |
62 | + | case waves: Unit => | |
63 | + | wavesBalance(this).available | |
64 | + | case _ => | |
65 | + | throw("Match error") | |
66 | + | } | |
67 | + | ||
68 | + | ||
69 | + | func getSFPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
70 | + | ||
71 | + | ||
72 | + | func getWXPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
73 | + | ||
74 | + | ||
75 | + | func getAxlyTotalPosition (pool) = valueOrElse(getInteger(this, (pool + kTotalPosition)), 0) | |
76 | + | ||
77 | + | ||
78 | + | func getNewUserPositionNumber (pool,user) = (valueOrElse(getInteger(this, (((pool + "_") + user) + kUserPositionNum)), 0) + 1) | |
79 | + | ||
80 | + | ||
81 | + | func getAxlyInFee (pool,withLoan) = if (withLoan) | |
82 | + | then getIntegerValue(this, (pool + kAxlyInFeeWithLoan)) | |
83 | + | else getIntegerValue(this, (pool + kAxlyInFeeWithoutLoan)) | |
84 | + | ||
85 | + | ||
86 | + | func getSFFarmingAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kSFFarmingAddr), "Can't get swopfi farming addr"))) | |
87 | + | ||
88 | + | ||
89 | + | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
90 | + | ||
91 | + | ||
92 | + | func assetIdToStr (assetId) = match assetId { | |
93 | + | case id: ByteVector => | |
94 | + | toBase58String(id) | |
95 | + | case waves: Unit => | |
96 | + | "WAVES" | |
97 | + | case _ => | |
98 | + | throw("Match error") | |
99 | + | } | |
100 | + | ||
101 | + | ||
102 | + | func assetIdFromStr (assetId) = if ((assetId == "WAVES")) | |
103 | + | then unit | |
104 | + | else fromBase58String(assetId) | |
105 | + | ||
106 | + | ||
107 | + | func replanishSwopFi (user,pool,withLoan,pmtA,pmtAssetA,pmtB,pmtAssetB,balA,balB,shareId,virtualSwapTokenPay,virtualSwapTokenGet) = { | |
108 | + | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
109 | + | let poolAddr = Address(fromBase58String(pool)) | |
110 | + | let ratioA = fraction(SCALE8, pmtA, balA) | |
111 | + | let ratioB = fraction(SCALE8, pmtB, balB) | |
112 | + | let $t045424835 = if ((ratioB > ratioA)) | |
113 | + | then { | |
114 | + | let pmt = fraction(balB, ratioA, SCALE8, CEILING) | |
115 | + | $Tuple4(pmtA, pmt, (pmtB - pmt), pmtAssetB) | |
116 | + | } | |
117 | + | else { | |
118 | + | let pmt = fraction(balA, ratioB, SCALE8, CEILING) | |
119 | + | $Tuple4(pmt, pmtB, (pmtA - pmt), pmtAssetA) | |
120 | + | } | |
121 | + | let pmtAmountA = $t045424835._1 | |
122 | + | let pmtAmountB = $t045424835._2 | |
123 | + | let change = $t045424835._3 | |
124 | + | let changeAssetId = $t045424835._4 | |
125 | + | let inv1 = if (if ((pmtAmountA > 0)) | |
126 | + | then (pmtAmountB > 0) | |
127 | + | else false) | |
128 | + | then { | |
129 | + | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
130 | + | invoke(poolAddr, "replenishWithTwoTokensV2", [false, 0], payments) | |
131 | + | } | |
132 | + | else 0 | |
133 | + | if ((inv1 == inv1)) | |
134 | + | then { | |
135 | + | let inv2 = if ((change > 0)) | |
136 | + | then { | |
137 | + | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
138 | + | let vars = [virtualSwapTokenPay, virtualSwapTokenGet, false, 0] | |
139 | + | invoke(poolAddr, "replenishWithOneTokenV2", vars, payments) | |
140 | + | } | |
141 | + | else 0 | |
142 | + | if ((inv2 == inv2)) | |
143 | + | then { | |
144 | + | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
145 | + | let totalShare = (shareBalanceAfter - shareBalanceBefore) | |
146 | + | let axlyInFee = fraction(totalShare, (FEE_SCALE6 - getAxlyInFee(pool, withLoan)), FEE_SCALE6) | |
147 | + | let userShareForStake = (totalShare - axlyInFee) | |
148 | + | if ((0 >= userShareForStake)) | |
149 | + | then throw("amount of staked sharetokens must be > 0") | |
150 | + | else { | |
151 | + | let inv3 = invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
152 | + | if ((inv3 == inv3)) | |
153 | + | then { | |
154 | + | let totalAmount = getAxlyTotalPosition(pool) | |
155 | + | let newPosNum = getNewUserPositionNumber(pool, user) | |
156 | + | [IntegerEntry((pool + kTotalPosition), (totalAmount + userShareForStake)), IntegerEntry((((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition), userShareForStake), StringEntry((((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPositionType), SF_POS_TYPE), IntegerEntry((((pool + "_") + user) + kUserPositionNum), newPosNum), ScriptTransfer(moneyBox, axlyInFee, fromBase58String(shareId))] | |
157 | + | } | |
158 | + | else throw("Strict value is not equal to itself.") | |
159 | + | } | |
160 | + | } | |
161 | + | else throw("Strict value is not equal to itself.") | |
162 | + | } | |
163 | + | else throw("Strict value is not equal to itself.") | |
164 | + | } | |
165 | + | ||
166 | + | ||
167 | + | func replanishWX (user,pool,withLoan,pmtA,pmtAssetA,pmtB,pmtAssetB,balA,balB,shareId,virtualSwapTokenPay,virtualSwapTokenGet) = { | |
168 | + | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
169 | + | let poolAddr = Address(fromBase58String(pool)) | |
170 | + | let ratioA = fraction(SCALE8, pmtA, balA) | |
171 | + | let ratioB = fraction(SCALE8, pmtB, balB) | |
172 | + | let $t070217314 = if ((ratioB > ratioA)) | |
173 | + | then { | |
174 | + | let pmt = fraction(balB, ratioA, SCALE8, CEILING) | |
175 | + | $Tuple4(pmtA, pmt, (pmtB - pmt), pmtAssetB) | |
176 | + | } | |
177 | + | else { | |
178 | + | let pmt = fraction(balA, ratioB, SCALE8, CEILING) | |
179 | + | $Tuple4(pmt, pmtB, (pmtA - pmt), pmtAssetA) | |
180 | + | } | |
181 | + | let pmtAmountA = $t070217314._1 | |
182 | + | let pmtAmountB = $t070217314._2 | |
183 | + | let change = $t070217314._3 | |
184 | + | let changeAssetId = $t070217314._4 | |
185 | + | let inv1 = if (if ((pmtAmountA > 0)) | |
186 | + | then (pmtAmountB > 0) | |
187 | + | else false) | |
188 | + | then { | |
189 | + | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
190 | + | invoke(poolAddr, "replenishWithTwoTokensV2", [false, 0], payments) | |
191 | + | } | |
192 | + | else 0 | |
193 | + | if ((inv1 == inv1)) | |
194 | + | then { | |
195 | + | let inv2 = if ((change > 0)) | |
196 | + | then { | |
197 | + | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
198 | + | let vars = [virtualSwapTokenPay, virtualSwapTokenGet, false, 0] | |
199 | + | invoke(poolAddr, "replenishWithOneTokenV2", vars, payments) | |
200 | + | } | |
201 | + | else 0 | |
202 | + | if ((inv2 == inv2)) | |
203 | + | then { | |
204 | + | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
205 | + | let totalShare = (shareBalanceAfter - shareBalanceBefore) | |
206 | + | let axlyInFee = fraction(totalShare, (FEE_SCALE6 - getAxlyInFee(pool, withLoan)), FEE_SCALE6) | |
207 | + | let userShareForStake = (totalShare - axlyInFee) | |
208 | + | if ((0 >= userShareForStake)) | |
209 | + | then throw("amount of staked sharetokens must be > 0") | |
210 | + | else { | |
211 | + | let inv3 = invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
212 | + | if ((inv3 == inv3)) | |
213 | + | then { | |
214 | + | let totalAmount = getAxlyTotalPosition(pool) | |
215 | + | let newPosNum = getNewUserPositionNumber(pool, user) | |
216 | + | [IntegerEntry((pool + kTotalPosition), (totalAmount + userShareForStake)), IntegerEntry((((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition), userShareForStake), StringEntry((((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPositionType), SF_POS_TYPE), IntegerEntry((((pool + "_") + user) + kUserPositionNum), newPosNum), ScriptTransfer(moneyBox, axlyInFee, fromBase58String(shareId))] | |
217 | + | } | |
218 | + | else throw("Strict value is not equal to itself.") | |
219 | + | } | |
220 | + | } | |
221 | + | else throw("Strict value is not equal to itself.") | |
222 | + | } | |
223 | + | else throw("Strict value is not equal to itself.") | |
224 | + | } | |
225 | + | ||
226 | + | ||
227 | + | @Callable(i) | |
228 | + | func replanish (pool,borrowAmount,borrowAssetId,virtualSwapTokenPay,virtualSwapTokenGet) = { | |
229 | + | let type = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
230 | + | let $t092009451 = if ((type == SF_POS_TYPE)) | |
231 | + | then getSFPoolData(Address(fromBase58String(pool))) | |
232 | + | else if ((type == WX_POS_TYPE)) | |
233 | + | then getWXPoolData(Address(fromBase58String(pool))) | |
234 | + | else throw("Wrong pool type") | |
235 | + | let AId = $t092009451._1 | |
236 | + | let BId = $t092009451._2 | |
237 | + | let balA = $t092009451._3 | |
238 | + | let balB = $t092009451._4 | |
239 | + | let shareId = $t092009451._5 | |
240 | + | let $t0945510092 = if ((size(i.payments) == 2)) | |
241 | + | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
242 | + | then throw("Wrong payment asset A") | |
243 | + | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
244 | + | then throw("Wrong payment asset B") | |
245 | + | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
246 | + | else if ((size(i.payments) == 1)) | |
247 | + | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
248 | + | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
249 | + | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
250 | + | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
251 | + | else throw("Wrong payment") | |
252 | + | else throw("One or two payments expected") | |
253 | + | let pmtA = $t0945510092._1 | |
254 | + | let pmtAssetA = $t0945510092._2 | |
255 | + | let pmtB = $t0945510092._3 | |
256 | + | let pmtAssetB = $t0945510092._4 | |
257 | + | if ((borrowAmount > 0)) | |
258 | + | then { | |
259 | + | let request = makeString([type, toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, toString(virtualSwapTokenPay), toString(virtualSwapTokenGet)], ",") | |
260 | + | let newRequestId = { | |
261 | + | let @ = invoke(this, "createNewRequest", [request], nil) | |
262 | + | if ($isInstanceOf(@, "Int")) | |
263 | + | then @ | |
264 | + | else unit | |
265 | + | } | |
266 | + | if ((newRequestId == newRequestId)) | |
267 | + | then { | |
268 | + | let args = [toString(i.caller), shareId, borrowAssetId, borrowAmount, toString(this), "replanishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
269 | + | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
270 | + | nil | |
271 | + | } | |
272 | + | else throw("Strict value is not equal to itself.") | |
273 | + | } | |
274 | + | else if ((type == SF_POS_TYPE)) | |
275 | + | then replanishSwopFi(toString(i.caller), pool, false, pmtA, pmtAssetA, pmtB, pmtAssetB, balA, balB, shareId, virtualSwapTokenPay, virtualSwapTokenGet) | |
276 | + | else throw("Cant wx") | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | ||
281 | + | @Callable(i) | |
282 | + | func replanishFromLand (requestId) = { | |
283 | + | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
284 | + | if ((request[0] == SF_POS_TYPE)) | |
285 | + | then replanishSwopFi(request[1], request[2], true, parseIntValue(request[3]), request[4], parseIntValue(request[5]), request[6], parseIntValue(request[7]), parseIntValue(request[8]), request[9], parseIntValue(request[10]), parseIntValue(request[11])) | |
286 | + | else throw("Cant wx") | |
287 | + | } | |
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | @Callable(i) | |
292 | + | func createNewRequest (params) = valueOrElse(isSelfCall(i), { | |
293 | + | let newRequestId = (valueOrElse(getInteger(this, kRequestIter), 0) + 1) | |
294 | + | $Tuple2([StringEntry((toString(newRequestId) + kRequestId), params)], newRequestId) | |
295 | + | }) | |
296 | + | ||
297 | + | ||
298 | + | ||
299 | + | @Callable(i) | |
300 | + | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFee) = if (if ((type != SF_POS_TYPE)) | |
301 | + | then (type != WX_POS_TYPE) | |
302 | + | else false) | |
303 | + | then throw("Wrong type") | |
304 | + | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyCapFee), capFee), StringEntry(kPool, type)] | |
305 | + | ||
306 | + | ||
307 | + | @Verifier(tx) | |
308 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
309 | + |
github/deemru/w8io/169f3d6 38.58 ms ◑