tx · DVHYTiNpa3SRApNXgm1Dv3EKgUWRYEpAuuNfM9VRwuvG 3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9: -0.01000000 Waves 2023.09.26 00:36 [2771490] smart account 3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9 > SELF 0.00000000 Waves
{ "type": 13, "id": "DVHYTiNpa3SRApNXgm1Dv3EKgUWRYEpAuuNfM9VRwuvG", "fee": 1000000, "feeAssetId": null, "timestamp": 1695677789388, "version": 2, "chainId": 84, "sender": "3MxiR4vDPzVeaEPgznfS4zi4uLd2nnQuGy9", "senderPublicKey": "4AVkL2DQJ8sngCNyArYueNuPS7cvygnakPJhU65LfPfu", "proofs": [ "EWqemK4kPpgwhgexcBsXPWPNsDV4R336xFiZb6yB8tmW6kH7kG3Pymwy1NNj1b94F7N6ZKo87MqHK51JwHfMEKV", "2E2qpwtJDwxwtu1LtWkGHYe39FJ4KMbsWjDwNvtVSG8NszD2fesvqTr8f7Xqjkf5J9GM4Ti3ZN57mFhtfEfq4Z7w" ], "script": "base64:BgIMCAISAwoBGBIDCgEYDgAOQVhMWV9NQUlOX0FERFIJAQdBZGRyZXNzAQEaAVRHYdFKTc5/+9vupfS91sItmkjqQtK5YZsAB1NGX1BPT0wCAlNGAAdXWF9QT09MAgJXWAAKa1NoYXJlUG9vbAIMX3Bvb2xTaGFyZUlkAAVrUG9vbAIFcG9vbF8ACWtBZG1pbjFQSwIVZ3JvdXAxX2FkbWluMV9wdWJfa2V5AAlrQWRtaW4yUEsCFWdyb3VwMV9hZG1pbjJfcHViX2tleQAJa0FkbWluM1BLAhVncm91cDFfYWRtaW4zX3B1Yl9rZXkAD2tPcGVyYXRvckNhbGxQSwISYWRtaW5fY2FsbF9wdWJfa2V5AAhhZG1pbjFQSwkA2QQBCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUOQVhMWV9NQUlOX0FERFIFCWtBZG1pbjFQSwISQ2FuJ3QgZ2V0IGFkbWluMVBLAA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5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUIYWRtaW4xUEsAAQAABBJhZG1pblB1YktleTJTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwABBQhhZG1pbjJQSwABAAAEEmFkbWluUHViS2V5M1NpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAIFCGFkbWluM1BLAAEAAAkAZwIJAGQCCQBkAgUSYWRtaW5QdWJLZXkxU2lnbmVkBRJhZG1pblB1YktleTJTaWduZWQFEmFkbWluUHViS2V5M1NpZ25lZAAC+8JHkQ==", "height": 2771490, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6E7SeS9KNuHLoQvLSfiCPqtUD2EAVToZBcUiQVMGL2eJ Next: 6k2vTG5CAvAXfoXBN4Ytbjtz6pAEGhzrmxR7wCGW5H2U Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | let lpB = fromBase58String(lp) | |
37 | 37 | let balance = assetBalance(this, lpB) | |
38 | 38 | let pool = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (lp + kSharePool)), ("Can't get pool of lp:" + lp)) | |
39 | - | let pType = valueOrErrorMessage(getString( | |
39 | + | let pType = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (kPool + pool)), "Pool is not inited") | |
40 | 40 | let poolAddr = valueOrErrorMessage(addressFromString(pool), "unknown addr") | |
41 | 41 | if ((balance > 0)) | |
42 | 42 | then { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let AXLY_MAIN_ADDR = Address(base58'3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS') | |
5 | 5 | ||
6 | 6 | let SF_POOL = "SF" | |
7 | 7 | ||
8 | 8 | let WX_POOL = "WX" | |
9 | 9 | ||
10 | 10 | let kSharePool = "_poolShareId" | |
11 | 11 | ||
12 | 12 | let kPool = "pool_" | |
13 | 13 | ||
14 | 14 | let kAdmin1PK = "group1_admin1_pub_key" | |
15 | 15 | ||
16 | 16 | let kAdmin2PK = "group1_admin2_pub_key" | |
17 | 17 | ||
18 | 18 | let kAdmin3PK = "group1_admin3_pub_key" | |
19 | 19 | ||
20 | 20 | let kOperatorCallPK = "admin_call_pub_key" | |
21 | 21 | ||
22 | 22 | let admin1PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin1PK), "Can't get admin1PK")) | |
23 | 23 | ||
24 | 24 | let admin2PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin2PK), "Can't get admin2PK")) | |
25 | 25 | ||
26 | 26 | let admin3PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin3PK), "Can't get admin3PK")) | |
27 | 27 | ||
28 | 28 | let operatorPK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kOperatorCallPK), "Can't get operatorPK")) | |
29 | 29 | ||
30 | 30 | func unknownPoolType () = throw("Wrong pool type") | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func exchangeLps (lps) = { | |
35 | 35 | func exLP (a,lp) = { | |
36 | 36 | let lpB = fromBase58String(lp) | |
37 | 37 | let balance = assetBalance(this, lpB) | |
38 | 38 | let pool = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (lp + kSharePool)), ("Can't get pool of lp:" + lp)) | |
39 | - | let pType = valueOrErrorMessage(getString( | |
39 | + | let pType = valueOrErrorMessage(getString(AXLY_MAIN_ADDR, (kPool + pool)), "Pool is not inited") | |
40 | 40 | let poolAddr = valueOrErrorMessage(addressFromString(pool), "unknown addr") | |
41 | 41 | if ((balance > 0)) | |
42 | 42 | then { | |
43 | 43 | let inv = if ((pType == SF_POOL)) | |
44 | 44 | then invoke(poolAddr, "callFunction", ["withdraw", ["0"]], [AttachedPayment(lpB, balance)]) | |
45 | 45 | else if ((pType == WX_POOL)) | |
46 | 46 | then invoke(poolAddr, "get", nil, [AttachedPayment(lpB, balance)]) | |
47 | 47 | else unknownPoolType() | |
48 | 48 | if ((inv == inv)) | |
49 | 49 | then (a :+ true) | |
50 | 50 | else throw("Strict value is not equal to itself.") | |
51 | 51 | } | |
52 | 52 | else (a :+ false) | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | let res = { | |
56 | 56 | let $l = lps | |
57 | 57 | let $s = size($l) | |
58 | 58 | let $acc0 = nil | |
59 | 59 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
60 | 60 | then $a | |
61 | 61 | else exLP($a, $l[$i]) | |
62 | 62 | ||
63 | 63 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
64 | 64 | then $a | |
65 | 65 | else throw("List size exceeds 50") | |
66 | 66 | ||
67 | 67 | $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) | |
68 | 68 | } | |
69 | 69 | $Tuple2(nil, res) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(i) | |
75 | 75 | func exchangeTokens (route) = nil | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | @Verifier(tx) | |
79 | 79 | func verify () = match tx { | |
80 | 80 | case inv: InvokeScriptTransaction => | |
81 | 81 | let isRightFee = if ((inv.fee == 900000)) | |
82 | 82 | then (inv.feeAssetId == unit) | |
83 | 83 | else false | |
84 | 84 | let isExLpCall = (inv.function == "exchangeLps") | |
85 | 85 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
86 | 86 | then 1 | |
87 | 87 | else 0 | |
88 | 88 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin2PK)) | |
89 | 89 | then 1 | |
90 | 90 | else 0 | |
91 | 91 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin3PK)) | |
92 | 92 | then 1 | |
93 | 93 | else 0 | |
94 | 94 | let adminPubKeyCallSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], operatorPK)) | |
95 | 95 | then 1 | |
96 | 96 | else 0 | |
97 | 97 | let signedByOneAdmin = ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminPubKeyCallSigned) >= 1) | |
98 | 98 | if (if (isRightFee) | |
99 | 99 | then isExLpCall | |
100 | 100 | else false) | |
101 | 101 | then signedByOneAdmin | |
102 | 102 | else false | |
103 | 103 | case _ => | |
104 | 104 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
105 | 105 | then 1 | |
106 | 106 | else 0 | |
107 | 107 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK)) | |
108 | 108 | then 1 | |
109 | 109 | else 0 | |
110 | 110 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK)) | |
111 | 111 | then 1 | |
112 | 112 | else 0 | |
113 | 113 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
114 | 114 | } | |
115 | 115 |
github/deemru/w8io/169f3d6 42.63 ms ◑