tx · 6k2vTG5CAvAXfoXBN4Ytbjtz6pAEGhzrmxR7wCGW5H2U

3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9:  -0.01000000 Waves

2023.10.06 10:10 [2786449] smart account 3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9 > SELF 0.00000000 Waves

{ "type": 13, "id": "6k2vTG5CAvAXfoXBN4Ytbjtz6pAEGhzrmxR7wCGW5H2U", "fee": 1000000, "feeAssetId": null, "timestamp": 1696576348374, "version": 2, "chainId": 84, "sender": "3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9", "senderPublicKey": "4AVkL2DQJ8sngCNyArYueNuPS7cvygnakPJhU65LfPfu", "proofs": [ "s9r7wV3SvWuAnmXC36oEr2md6xesrS5k3FuzZi6Af4HuhRvUTaUgi898M92dMxeMFcTy4ph3PksFXHf2RstJJGi", "Vb192w3VBPHXJcqbEKKTtfszQnNMB6czk1MZKEg6gazNyz3W2szK4A6FsXzkjy9Aikr7qgvQZv3693QEi9APqvA" ], "script": "base64:BgIMCAISAwoBGBIDCgEYEQAOQVhMWV9NQUlOX0FERFIJAQdBZGRyZXNzAQEaAVRHYdFKTc5/+9vupfS91sItmkjqQtK5YZsAB1NGX1BPT0wCAlNGAAdXWF9QT09MAgJXWAAKa1NoYXJlUG9vbAIMX3Bvb2xTaGFyZUlkAAVrUG9vbAIFcG9vbF8ACWtBZG1pbjFQSwIVZ3JvdXAxX2FkbWluMV9wdWJfa2V5AAlrQWRtaW4yUEsCFWdyb3VwMV9hZG1pbjJfcHViX2tleQAJa0FkbWluM1BLAhVncm91cDFfYWRtaW4zX3B1Yl9rZXkAD2tPcGVyYXRvckNhbGxQSwISYWRtaW5fY2FsbF9wdWJfa2V5AAhhZG1pbjFQSwkA2QQBCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUOQVhMWV9NQUlOX0FERFIFCWtBZG1pbjFQSwISQ2FuJ3QgZ2V0IGFkbWluMVBLAAhhZG1pbj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CRAwIIBQJ0eAZwcm9vZnMAAgUIYWRtaW4zUEsAAQAACQBnAgkAZAIJAGQCBRJhZG1pblB1YktleTFTaWduZWQFEmFkbWluUHViS2V5MlNpZ25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAAKqSuQp", "height": 2786449, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DVHYTiNpa3SRApNXgm1Dv3EKgUWRYEpAuuNfM9VRwuvG Next: 4K7aLKSLrQb8TF4gsC9xk2YQ1Qz3pmnA4W6bPaPejAej Diff:
OldNewDifferences
2828 let operatorPK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kOperatorCallPK), "Can't get operatorPK"))
2929
3030 func unknownPoolType () = throw("Wrong pool type")
31+
32+
33+func listToInt (a,item) = (a :+ parseIntValue(item))
34+
35+
36+func directSwopfiCPMM (rArgs) = {
37+ let dApp = addressFromStringValue(rArgs[1])
38+ let pmt = {
39+ let pmtP = split(rArgs[2], "|")
40+[AttachedPayment(fromBase58String(pmtP[0]), parseIntValue(pmtP[1]))]
41+ }
42+ let minToRecive = rArgs[3]
43+ invoke(dApp, "callFunction", ["exchange", [minToRecive]], pmt)
44+ }
45+
46+
47+func directRoutingSwopfi (rArgs) = {
48+ let dApp = addressFromStringValue(rArgs[1])
49+ let pmt = {
50+ let pmtP = split(rArgs[2], "|")
51+[AttachedPayment(fromBase58String(pmtP[0]), parseIntValue(pmtP[1]))]
52+ }
53+ let args = {
54+ let eArgs = split(rArgs[3], "|")
55+ let exchangers = split(eArgs[0], ",")
56+ let exchangersType = split(eArgs[1], ",")
57+ let args1 = {
58+ let $l = split(eArgs[2], ",")
59+ let $s = size($l)
60+ let $acc0 = nil
61+ func $f0_1 ($a,$i) = if (($i >= $s))
62+ then $a
63+ else listToInt($a, $l[$i])
64+
65+ func $f0_2 ($a,$i) = if (($i >= $s))
66+ then $a
67+ else throw("List size exceeds 3")
68+
69+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
70+ }
71+ let args2 = {
72+ let $l = split(eArgs[3], ",")
73+ let $s = size($l)
74+ let $acc0 = nil
75+ func $f1_1 ($a,$i) = if (($i >= $s))
76+ then $a
77+ else listToInt($a, $l[$i])
78+
79+ func $f1_2 ($a,$i) = if (($i >= $s))
80+ then $a
81+ else throw("List size exceeds 3")
82+
83+ $f1_2($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3)
84+ }
85+ let routingAssetsKeys = split(eArgs[4], ",")
86+ let minToRecive = parseIntValue(eArgs[4])
87+[exchangers, exchangersType, args1, args2, routingAssetsKeys, minToRecive]
88+ }
89+ invoke(dApp, "routingTrade", args, pmt)
90+ }
3191
3292
3393 @Callable(i)
72132
73133
74134 @Callable(i)
75-func exchangeTokens (route) = nil
135+func exchangeTokens (routes) = {
136+ func exchangeToken (r,route) = {
137+ let rArgs = split(route, "__")
138+ if ((rArgs[0] == "directSwopfiCPMM"))
139+ then {
140+ let inv = directSwopfiCPMM(rArgs)
141+ if ((inv == inv))
142+ then (r :+ inv)
143+ else throw("Strict value is not equal to itself.")
144+ }
145+ else if ((rArgs[0] == "routingSwopfi"))
146+ then {
147+ let inv = directRoutingSwopfi(rArgs)
148+ if ((inv == inv))
149+ then (r :+ inv)
150+ else throw("Strict value is not equal to itself.")
151+ }
152+ else throw("Unknown route type")
153+ }
154+
155+ let res = {
156+ let $l = routes
157+ let $s = size($l)
158+ let $acc0 = nil
159+ func $f0_1 ($a,$i) = if (($i >= $s))
160+ then $a
161+ else exchangeToken($a, $l[$i])
162+
163+ func $f0_2 ($a,$i) = if (($i >= $s))
164+ then $a
165+ else throw("List size exceeds 30")
166+
167+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30)
168+ }
169+ nil
170+ }
76171
77172
78173 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let AXLY_MAIN_ADDR = Address(base58'3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS')
55
66 let SF_POOL = "SF"
77
88 let WX_POOL = "WX"
99
1010 let kSharePool = "_poolShareId"
1111
1212 let kPool = "pool_"
1313
1414 let kAdmin1PK = "group1_admin1_pub_key"
1515
1616 let kAdmin2PK = "group1_admin2_pub_key"
1717
1818 let kAdmin3PK = "group1_admin3_pub_key"
1919
2020 let kOperatorCallPK = "admin_call_pub_key"
2121
2222 let admin1PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin1PK), "Can't get admin1PK"))
2323
2424 let admin2PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin2PK), "Can't get admin2PK"))
2525
2626 let admin3PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin3PK), "Can't get admin3PK"))
2727
2828 let operatorPK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kOperatorCallPK), "Can't get operatorPK"))
2929
3030 func unknownPoolType () = throw("Wrong pool type")
31+
32+
33+func listToInt (a,item) = (a :+ parseIntValue(item))
34+
35+
36+func directSwopfiCPMM (rArgs) = {
37+ let dApp = addressFromStringValue(rArgs[1])
38+ let pmt = {
39+ let pmtP = split(rArgs[2], "|")
40+[AttachedPayment(fromBase58String(pmtP[0]), parseIntValue(pmtP[1]))]
41+ }
42+ let minToRecive = rArgs[3]
43+ invoke(dApp, "callFunction", ["exchange", [minToRecive]], pmt)
44+ }
45+
46+
47+func directRoutingSwopfi (rArgs) = {
48+ let dApp = addressFromStringValue(rArgs[1])
49+ let pmt = {
50+ let pmtP = split(rArgs[2], "|")
51+[AttachedPayment(fromBase58String(pmtP[0]), parseIntValue(pmtP[1]))]
52+ }
53+ let args = {
54+ let eArgs = split(rArgs[3], "|")
55+ let exchangers = split(eArgs[0], ",")
56+ let exchangersType = split(eArgs[1], ",")
57+ let args1 = {
58+ let $l = split(eArgs[2], ",")
59+ let $s = size($l)
60+ let $acc0 = nil
61+ func $f0_1 ($a,$i) = if (($i >= $s))
62+ then $a
63+ else listToInt($a, $l[$i])
64+
65+ func $f0_2 ($a,$i) = if (($i >= $s))
66+ then $a
67+ else throw("List size exceeds 3")
68+
69+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
70+ }
71+ let args2 = {
72+ let $l = split(eArgs[3], ",")
73+ let $s = size($l)
74+ let $acc0 = nil
75+ func $f1_1 ($a,$i) = if (($i >= $s))
76+ then $a
77+ else listToInt($a, $l[$i])
78+
79+ func $f1_2 ($a,$i) = if (($i >= $s))
80+ then $a
81+ else throw("List size exceeds 3")
82+
83+ $f1_2($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3)
84+ }
85+ let routingAssetsKeys = split(eArgs[4], ",")
86+ let minToRecive = parseIntValue(eArgs[4])
87+[exchangers, exchangersType, args1, args2, routingAssetsKeys, minToRecive]
88+ }
89+ invoke(dApp, "routingTrade", args, pmt)
90+ }
3191
3292
3393 @Callable(i)
3494 func exchangeLps (lps) = {
3595 func exLP (a,lp) = {
3696 let lpB = fromBase58String(lp)
3797 let balance = assetBalance(this, lpB)
3898 let pool = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (lp + kSharePool)), ("Can't get pool of lp:" + lp))
3999 let pType = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (kPool + pool)), "Pool is not inited")
40100 let poolAddr = valueOrErrorMessage(addressFromString(pool), "unknown addr")
41101 if ((balance > 0))
42102 then {
43103 let inv = if ((pType == SF_POOL))
44104 then invoke(poolAddr, "callFunction", ["withdraw", ["0"]], [AttachedPayment(lpB, balance)])
45105 else if ((pType == WX_POOL))
46106 then invoke(poolAddr, "get", nil, [AttachedPayment(lpB, balance)])
47107 else unknownPoolType()
48108 if ((inv == inv))
49109 then (a :+ true)
50110 else throw("Strict value is not equal to itself.")
51111 }
52112 else (a :+ false)
53113 }
54114
55115 let res = {
56116 let $l = lps
57117 let $s = size($l)
58118 let $acc0 = nil
59119 func $f0_1 ($a,$i) = if (($i >= $s))
60120 then $a
61121 else exLP($a, $l[$i])
62122
63123 func $f0_2 ($a,$i) = if (($i >= $s))
64124 then $a
65125 else throw("List size exceeds 50")
66126
67127 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50)
68128 }
69129 $Tuple2(nil, res)
70130 }
71131
72132
73133
74134 @Callable(i)
75-func exchangeTokens (route) = nil
135+func exchangeTokens (routes) = {
136+ func exchangeToken (r,route) = {
137+ let rArgs = split(route, "__")
138+ if ((rArgs[0] == "directSwopfiCPMM"))
139+ then {
140+ let inv = directSwopfiCPMM(rArgs)
141+ if ((inv == inv))
142+ then (r :+ inv)
143+ else throw("Strict value is not equal to itself.")
144+ }
145+ else if ((rArgs[0] == "routingSwopfi"))
146+ then {
147+ let inv = directRoutingSwopfi(rArgs)
148+ if ((inv == inv))
149+ then (r :+ inv)
150+ else throw("Strict value is not equal to itself.")
151+ }
152+ else throw("Unknown route type")
153+ }
154+
155+ let res = {
156+ let $l = routes
157+ let $s = size($l)
158+ let $acc0 = nil
159+ func $f0_1 ($a,$i) = if (($i >= $s))
160+ then $a
161+ else exchangeToken($a, $l[$i])
162+
163+ func $f0_2 ($a,$i) = if (($i >= $s))
164+ then $a
165+ else throw("List size exceeds 30")
166+
167+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30)
168+ }
169+ nil
170+ }
76171
77172
78173 @Verifier(tx)
79174 func verify () = match tx {
80175 case inv: InvokeScriptTransaction =>
81176 let isRightFee = if ((inv.fee == 900000))
82177 then (inv.feeAssetId == unit)
83178 else false
84179 let isExLpCall = (inv.function == "exchangeLps")
85180 let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK))
86181 then 1
87182 else 0
88183 let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin2PK))
89184 then 1
90185 else 0
91186 let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin3PK))
92187 then 1
93188 else 0
94189 let adminPubKeyCallSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], operatorPK))
95190 then 1
96191 else 0
97192 let signedByOneAdmin = ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminPubKeyCallSigned) >= 1)
98193 if (if (isRightFee)
99194 then isExLpCall
100195 else false)
101196 then signedByOneAdmin
102197 else false
103198 case _ =>
104199 let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK))
105200 then 1
106201 else 0
107202 let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK))
108203 then 1
109204 else 0
110205 let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK))
111206 then 1
112207 else 0
113208 (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2)
114209 }
115210

github/deemru/w8io/026f985 
29.74 ms