tx · ZbukTgBHH3KsgfZPGV2kZBR3SKvD2zW5wgMHEbddpog 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq: -0.01300000 Waves 2023.01.17 13:50 [2408829] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves
{ "type": 13, "id": "ZbukTgBHH3KsgfZPGV2kZBR3SKvD2zW5wgMHEbddpog", "fee": 1300000, "feeAssetId": null, "timestamp": 1673952641518, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "3wQfWXXsufVsu4K14dyvAdFvJkybrrd8x7kRunJitrLnozdRntiykF2ka7ZvoYN1Z42cDKamkVmiTjwbb15Z5zq9" ], "script": "base64:BgIYCAISBgoEAQEICBIFCgMBCAgSAwoBCBIAEwADU0VQAgJfXwAIZmVlU2NhbGUJALYCAQCgjQYBD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwUDa2V5CQCsAgICFU5vIGRhdGEgZm9yIHRoaXMua2V5PQUDa2V5AAxwb29sRGlzYWJsZWQJAAIBAg1Qb29sIGRpc2FibGVkAAxwb29sTm90RXhpc3QJAAIBAhFQb29sIGlzIG5vdCBleGlzdAAOc2xpcHBhZ2VUb29CaWcJAAIBAhNTbGlwcGFnZSBpcyB0b28gYmlnARNrZXlNYW5hZ2VyUHVibGljS2V5AAIUJXNfX21hbmFnZXJQdWJsaWNLZXkBGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAIbJXNfX3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5AQJmYwACEyVzX19mYWN0b3J5Q29udHJhY3QAD2ZhY3RvcnlDb250cmFjdAkBEUBleHRyTmF0aXZlKDEwNjIpAQkBD2dldFN0cmluZ09yRmFpbAEJAQJmYwABG2ZlZ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yaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQPdGFyZ2V0UHVibGljS2V5BAckbWF0Y2gwCQEWbWFuYWdlclB1YmxpY0tleU9yVW5pdAADCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCcGsFByRtYXRjaDAFAnBrAwkAAQIFByRtYXRjaDACBFVuaXQIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V5qO9FCw==", "chainId": 84, "height": 2408829, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B9fgfpEGSrfgGcHD1vzBkj6YqzZRxRvfzm1GY2VurVLa Next: 3XNuPqrLxCykM5YCU9L5mZmYiGrmPeEwC9g3UQwpDNG9 Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let feeScale = toBigInt(100000) | |
7 | + | ||
8 | + | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
4 | 9 | ||
5 | 10 | ||
11 | + | let poolDisabled = throw("Pool disabled") | |
12 | + | ||
13 | + | let poolNotExist = throw("Pool is not exist") | |
14 | + | ||
15 | + | let slippageTooBig = throw("Slippage is too big") | |
16 | + | ||
17 | + | func keyManagerPublicKey () = "%s__managerPublicKey" | |
18 | + | ||
19 | + | ||
20 | + | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
21 | + | ||
22 | + | ||
23 | + | func fc () = "%s__factoryContract" | |
24 | + | ||
25 | + | ||
26 | + | let factoryContract = addressFromStringValue(getStringOrFail(fc())) | |
27 | + | ||
28 | + | func feeLiquidityContractAddress () = makeString(["%s", "feeLiquidityContractAddress"], SEP) | |
29 | + | ||
30 | + | ||
31 | + | func feeLiquidity () = makeString(["%d", "feeLiquidity"], SEP) | |
32 | + | ||
33 | + | ||
34 | + | func protocolFee () = makeString(["%d", "protocolFee"], SEP) | |
35 | + | ||
36 | + | ||
37 | + | func asInt (val) = match val { | |
38 | + | case valInt: Int => | |
39 | + | valInt | |
40 | + | case _ => | |
41 | + | throw("fail to cast into Int") | |
42 | + | } | |
43 | + | ||
44 | + | ||
45 | + | func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP) | |
46 | + | ||
47 | + | ||
48 | + | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
49 | + | case s: String => | |
50 | + | fromBase58String(s) | |
51 | + | case _: Unit => | |
52 | + | unit | |
53 | + | case _ => | |
54 | + | throw("Match error") | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
59 | + | case s: String => | |
60 | + | fromBase58String(s) | |
61 | + | case _: Unit => | |
62 | + | unit | |
63 | + | case _ => | |
64 | + | throw("Match error") | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | func isManager (i) = match managerPublicKeyOrUnit() { | |
69 | + | case pk: ByteVector => | |
70 | + | (i.callerPublicKey == pk) | |
71 | + | case _: Unit => | |
72 | + | (i.caller == this) | |
73 | + | case _ => | |
74 | + | throw("Match error") | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | func mustManager (i) = if (isManager(i)) | |
79 | + | then true | |
80 | + | else throw("permission denied") | |
81 | + | ||
82 | + | ||
83 | + | @Callable(i) | |
84 | + | func constructor (protocolFeeAmount,feeLiquidityAmount,feeLiquidityAddress,fc) = { | |
85 | + | let check = mustManager(i) | |
86 | + | if ((check == check)) | |
87 | + | then [StringEntry(feeLiquidityContractAddress(), feeLiquidityAddress), IntegerEntry(feeLiquidity(), feeLiquidityAmount), IntegerEntry(protocolFee(), protocolFeeAmount), StringEntry(fc(), fc)] | |
88 | + | else throw("Strict value is not equal to itself.") | |
89 | + | } | |
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | @Callable(i) | |
94 | + | func swap (amountOutMin,assetOut,addressTo) = { | |
95 | + | let pmt = value(i.payments[0]) | |
96 | + | let assetIn = value(pmt.assetId) | |
97 | + | let amountIn = value(pmt.amount) | |
98 | + | let prFee = value(getInteger(protocolFee())) | |
99 | + | let feeProtocolAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
100 | + | let feeLiquidityAmount = fraction(toBigInt(amountIn), toBigInt(prFee), feeScale) | |
101 | + | let amountInToPool = (toBigInt(amountIn) - feeProtocolAmount) | |
102 | + | let cleanAmountIn = (amountInToPool - feeLiquidityAmount) | |
103 | + | let checks = [if ((size(i.payments) == 1)) | |
104 | + | then true | |
105 | + | else throw("exactly 1 payment are expected")] | |
106 | + | if ((checks == checks)) | |
107 | + | then { | |
108 | + | let lpNonReverese = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetIn, assetOut], nil) | |
109 | + | let lpReverse = invoke(factoryContract, "getLpAssetFromPoolAssetsREADONLY", [assetOut, assetIn], nil) | |
110 | + | let $t030893610 = if ((lpNonReverese != unit)) | |
111 | + | then { | |
112 | + | let isReverse = false | |
113 | + | let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpNonReverese], nil) | |
114 | + | $Tuple2(isReverse, pool) | |
115 | + | } | |
116 | + | else if ((lpReverse != unit)) | |
117 | + | then { | |
118 | + | let isReverse = true | |
119 | + | let pool = invoke(factoryContract, "getPoolAddressFromLpAssetREADONLY", [lpReverse], nil) | |
120 | + | $Tuple2(isReverse, pool) | |
121 | + | } | |
122 | + | else { | |
123 | + | let isReverse = true | |
124 | + | let pool = "" | |
125 | + | $Tuple2(isReverse, pool) | |
126 | + | } | |
127 | + | let isReverse = $t030893610._1 | |
128 | + | let pool = $t030893610._2 | |
129 | + | let checkExist = [if ((pool != "")) | |
130 | + | then true | |
131 | + | else poolNotExist] | |
132 | + | if ((checkExist == checkExist)) | |
133 | + | then { | |
134 | + | let isPoolOneTokenOperationsDisabled = { | |
135 | + | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [pool], nil) | |
136 | + | if ($isInstanceOf(@, "Boolean")) | |
137 | + | then @ | |
138 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
139 | + | } | |
140 | + | let check = [if (isPoolOneTokenOperationsDisabled) | |
141 | + | then true | |
142 | + | else poolDisabled] | |
143 | + | if ((check == check)) | |
144 | + | then { | |
145 | + | let poolAdr = addressFromStringValue(valueOrElse(pool, "")) | |
146 | + | let res = invoke(poolAdr, "calculateAmountOutForSwapAndSendTokens", [cleanAmountIn, isReverse, amountOutMin, addressTo], [AttachedPayment(assetIn, toInt(amountInToPool))]) | |
147 | + | $Tuple2(nil, true) | |
148 | + | } | |
149 | + | else throw("Strict value is not equal to itself.") | |
150 | + | } | |
151 | + | else throw("Strict value is not equal to itself.") | |
152 | + | } | |
153 | + | else throw("Strict value is not equal to itself.") | |
154 | + | } | |
155 | + | ||
156 | + | ||
157 | + | ||
158 | + | @Callable(i) | |
159 | + | func setManager (pendingManagerPublicKey) = { | |
160 | + | let checkCaller = mustManager(i) | |
161 | + | if ((checkCaller == checkCaller)) | |
162 | + | then { | |
163 | + | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
164 | + | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
165 | + | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
166 | + | else throw("Strict value is not equal to itself.") | |
167 | + | } | |
168 | + | else throw("Strict value is not equal to itself.") | |
169 | + | } | |
170 | + | ||
171 | + | ||
172 | + | ||
173 | + | @Callable(i) | |
174 | + | func confirmManager () = { | |
175 | + | let pm = pendingManagerPublicKeyOrUnit() | |
176 | + | let hasPM = if (isDefined(pm)) | |
177 | + | then true | |
178 | + | else throw("no pending manager") | |
179 | + | if ((hasPM == hasPM)) | |
180 | + | then { | |
181 | + | let checkPM = if ((i.callerPublicKey == value(pm))) | |
182 | + | then true | |
183 | + | else throw("you are not pending manager") | |
184 | + | if ((checkPM == checkPM)) | |
185 | + | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
186 | + | else throw("Strict value is not equal to itself.") | |
187 | + | } | |
188 | + | else throw("Strict value is not equal to itself.") | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | @Verifier(tx) | |
193 | + | func verify () = { | |
194 | + | let targetPublicKey = match managerPublicKeyOrUnit() { | |
195 | + | case pk: ByteVector => | |
196 | + | pk | |
197 | + | case _: Unit => | |
198 | + | tx.senderPublicKey | |
199 | + | case _ => | |
200 | + | throw("Match error") | |
201 | + | } | |
202 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
203 | + | } | |
6 | 204 |
github/deemru/w8io/169f3d6 35.66 ms ◑