tx · 7UzCmEuo1vb2Y9oB5t1qBigPreAN8YpNZzPGPWf8jjBt 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph: -0.01400000 Waves 2021.11.08 21:21 [1782386] smart account 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph > SELF 0.00000000 Waves
{ "type": 13, "id": "7UzCmEuo1vb2Y9oB5t1qBigPreAN8YpNZzPGPWf8jjBt", "fee": 1400000, "feeAssetId": null, "timestamp": 1636395761292, "version": 2, "chainId": 84, "sender": "3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph", "senderPublicKey": "G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD", "proofs": [ "3xPdSh2CNNWZmUKmqaqqw1xaxgx3QQjckQkiKQCqm1T84jVd3SiQJQXF4ic9TQzuK58pPEq9RUfV2bMdxw1WLP8G" ], "script": "base64:AAIFAAAAAAAAACEIAhIAEgYKBBgYGBESBgoECAgBARIAEgMKAQgSBAoCCAEAAAAGAAAAAApkZXBvc2l0RmVlAAAAAAAAAAPoAAAAAA1jb250cm9sbGVyRmVlAAAAAAAAACcQAAAAAAtwbGF0Zm9ybUZlZQAAAAAAAAAnEAAAAAAMYWRtaW5QdWJLZXkxAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAAMYWRtaW5QdWJLZXkyAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAAMYWRtaW5QdWJLZXkzAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAYAAAACYTgBAAAABGluaXQAAAAACQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAADEzUFBIN3g3aXFvYlc1eml5aVJDaWMxOXJRcUtyNm5QWWFLMV9hc3NldF9iYWxhbmNlAAAAAAAAbdStBQAAAANuaWwAAAABaQEAAAAIYWRkUG9vbHMAAAAEAAAABXBvb2xzAA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AAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAQYW1vdW50V2l0aG91dEZlZQkAAlkAAAABBQAAABVsaXF1aWR1dHlBc3NldEFkZHJlc3MJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADXBvb2xBbW91bnRLZXkFAAAADW5ld1Bvb2xBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAEXVzZXJQb29sQW1vdW50S2V5BQAAABFuZXdVc2VyUG9vbEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAARdXNlclBvb2xFYXJuZWRLZXkFAAAAD3VzZXJFYXJuZWRUb3RhbAUAAAADbmlsCQAAAgAAAAECAAAAJllvdSBoYXZlIG5vdCBzdWNoIGJhbGFuY2UgZm9yIHdpdGhkcmF3AAAAAQAAAAJiNgEAAAACYjcAAAAACQAB9AAAAAMIBQAAAAJiNgAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmI2AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAmI2AAAAD3NlbmRlclB1YmxpY0tleZtb+6g=", "height": 1782386, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7G1AZqKYvvbGPzCaSmSpawCCNuhmfkYoiD3qPr8VU4T6 Next: 4ndh7wEkBieQqVzM6ZvdkwRR2qHfgbjecY1CFgSvzYwT Diff:
Old | New | Differences | |
---|---|---|---|
128 | 128 | ||
129 | 129 | @Callable(a8) | |
130 | 130 | func call () = { | |
131 | - | let pmtAmountA = | |
132 | - | let pmtAmountB = | |
131 | + | let pmtAmountA = 10 | |
132 | + | let pmtAmountB = 1 | |
133 | 133 | let pmtDecimalsA = 8 | |
134 | 134 | let pmtDecimalsB = 6 | |
135 | 135 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let depositFee = 1000 | |
5 | 5 | ||
6 | 6 | let controllerFee = 10000 | |
7 | 7 | ||
8 | 8 | let platformFee = 10000 | |
9 | 9 | ||
10 | 10 | let adminPubKey1 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
11 | 11 | ||
12 | 12 | let adminPubKey2 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
13 | 13 | ||
14 | 14 | let adminPubKey3 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
15 | 15 | ||
16 | 16 | @Callable(a8) | |
17 | 17 | func init () = [IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_asset_balance", 7197869)] | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | 22 | func addPools (pools,liquidityTokens,serviceTokens,liquidityTokenDecimals) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
23 | 23 | then { | |
24 | 24 | func generatePoolKeys (accumulated,pool) = IntegerEntry((pool + "_asset_balance"), 0) :: accumulated | |
25 | 25 | ||
26 | 26 | func generatePoolLiquidityTokenKeys (accumulated,pool) = { | |
27 | 27 | let poolIndex = value(indexOf(pools, pool)) | |
28 | 28 | let liquidityToken = liquidityTokens[poolIndex] | |
29 | 29 | StringEntry((pool + "_liquidity_token"), liquidityToken) :: accumulated | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | func generatePoolServiceTokenKeys (accumulated,pool) = { | |
33 | 33 | let poolIndex = value(indexOf(pools, pool)) | |
34 | 34 | let liquidityToken = serviceTokens[poolIndex] | |
35 | 35 | StringEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | func generatePoolLiquidityTokenDecimalKeys (accumulated,pool) = { | |
39 | 39 | let poolIndex = value(indexOf(pools, pool)) | |
40 | 40 | let liquidityToken = liquidityTokenDecimals[poolIndex] | |
41 | 41 | IntegerEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | func generatePoolActiveKeys (accumulated,pool) = BooleanEntry((pool + "_active"), true) :: accumulated | |
45 | 45 | ||
46 | 46 | let poolBalanceKeys = { | |
47 | 47 | let $l = pools | |
48 | 48 | let $s = size($l) | |
49 | 49 | let $acc0 = nil | |
50 | 50 | func 1 ($a,$i) = if (($i >= $s)) | |
51 | 51 | then $a | |
52 | 52 | else generatePoolKeys($a, $l[$i]) | |
53 | 53 | ||
54 | 54 | func 2 ($a,$i) = if (($i >= $s)) | |
55 | 55 | then $a | |
56 | 56 | else throw("List size exceeds 20") | |
57 | 57 | ||
58 | 58 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
59 | 59 | } | |
60 | 60 | let poolLiquidityTokenKeys = { | |
61 | 61 | let $l = pools | |
62 | 62 | let $s = size($l) | |
63 | 63 | let $acc0 = nil | |
64 | 64 | func 1 ($a,$i) = if (($i >= $s)) | |
65 | 65 | then $a | |
66 | 66 | else generatePoolLiquidityTokenKeys($a, $l[$i]) | |
67 | 67 | ||
68 | 68 | func 2 ($a,$i) = if (($i >= $s)) | |
69 | 69 | then $a | |
70 | 70 | else throw("List size exceeds 20") | |
71 | 71 | ||
72 | 72 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
73 | 73 | } | |
74 | 74 | let poolServiceTokenKeys = { | |
75 | 75 | let $l = pools | |
76 | 76 | let $s = size($l) | |
77 | 77 | let $acc0 = nil | |
78 | 78 | func 1 ($a,$i) = if (($i >= $s)) | |
79 | 79 | then $a | |
80 | 80 | else generatePoolServiceTokenKeys($a, $l[$i]) | |
81 | 81 | ||
82 | 82 | func 2 ($a,$i) = if (($i >= $s)) | |
83 | 83 | then $a | |
84 | 84 | else throw("List size exceeds 20") | |
85 | 85 | ||
86 | 86 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
87 | 87 | } | |
88 | 88 | let poolLiquidityTokenDecimalKeys = { | |
89 | 89 | let $l = pools | |
90 | 90 | let $s = size($l) | |
91 | 91 | let $acc0 = nil | |
92 | 92 | func 1 ($a,$i) = if (($i >= $s)) | |
93 | 93 | then $a | |
94 | 94 | else generatePoolLiquidityTokenDecimalKeys($a, $l[$i]) | |
95 | 95 | ||
96 | 96 | func 2 ($a,$i) = if (($i >= $s)) | |
97 | 97 | then $a | |
98 | 98 | else throw("List size exceeds 20") | |
99 | 99 | ||
100 | 100 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
101 | 101 | } | |
102 | 102 | let poolActiveKeys = { | |
103 | 103 | let $l = pools | |
104 | 104 | let $s = size($l) | |
105 | 105 | let $acc0 = nil | |
106 | 106 | func 1 ($a,$i) = if (($i >= $s)) | |
107 | 107 | then $a | |
108 | 108 | else generatePoolActiveKeys($a, $l[$i]) | |
109 | 109 | ||
110 | 110 | func 2 ($a,$i) = if (($i >= $s)) | |
111 | 111 | then $a | |
112 | 112 | else throw("List size exceeds 20") | |
113 | 113 | ||
114 | 114 | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
115 | 115 | } | |
116 | 116 | ((((poolBalanceKeys ++ poolLiquidityTokenKeys) ++ poolServiceTokenKeys) ++ poolLiquidityTokenDecimalKeys) ++ poolActiveKeys) | |
117 | 117 | } | |
118 | 118 | else throw("Only admin can call this function") | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | 123 | func issueToken (name,description,quantity,decimals) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
124 | 124 | then [Issue(name, description, quantity, decimals, true, unit, 0)] | |
125 | 125 | else throw("Only admin can call this function") | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | ||
129 | 129 | @Callable(a8) | |
130 | 130 | func call () = { | |
131 | - | let pmtAmountA = | |
132 | - | let pmtAmountB = | |
131 | + | let pmtAmountA = 10 | |
132 | + | let pmtAmountB = 1 | |
133 | 133 | let pmtDecimalsA = 8 | |
134 | 134 | let pmtDecimalsB = 6 | |
135 | 135 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
136 | 136 | let a9 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
137 | 137 | let a10 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
138 | 138 | let third = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
139 | 139 | let fouth = fraction(a9, a10, third) | |
140 | 140 | [IntegerEntry("fisrt", a9), IntegerEntry("second", a10), IntegerEntry("third", third), IntegerEntry("fouth", fouth)] | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | 145 | @Callable(i) | |
146 | 146 | func deposit (pool) = { | |
147 | 147 | let amount = i.payments[0].amount | |
148 | 148 | let assetId = i.payments[0].assetId | |
149 | 149 | let assetIdString = match assetId { | |
150 | 150 | case id: ByteVector => | |
151 | 151 | toBase58String(id) | |
152 | 152 | case _ => | |
153 | 153 | throw("Match error") | |
154 | 154 | } | |
155 | 155 | if ((size(i.payments) != 1)) | |
156 | 156 | then throw("One attached payment expected") | |
157 | 157 | else if ((0 >= amount)) | |
158 | 158 | then throw(("Deposit amount must be positive. Actual: " + toString(amount))) | |
159 | 159 | else { | |
160 | 160 | let poolAmountKey = (pool + "_asset_balance") | |
161 | 161 | let userAddress = toString(i.caller) | |
162 | 162 | let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance") | |
163 | 163 | let dAppAssetAddress = match getString((pool + "_service_token")) { | |
164 | 164 | case string: String => | |
165 | 165 | string | |
166 | 166 | case nothing => | |
167 | 167 | throw("You try to deposit on unsupported pool") | |
168 | 168 | } | |
169 | 169 | let liquidutyAssetAddress = getStringValue(this, (pool + "_liquidity_token")) | |
170 | 170 | let liquidityTokenDecimal = match assetInfo(fromBase58String(liquidutyAssetAddress)) { | |
171 | 171 | case asset: Asset => | |
172 | 172 | asset.decimals | |
173 | 173 | case _ => | |
174 | 174 | throw("Can't find asset") | |
175 | 175 | } | |
176 | 176 | if ((liquidutyAssetAddress != assetIdString)) | |
177 | 177 | then throw("You attached wrong liquidity token from Swop.fi") | |
178 | 178 | else { | |
179 | 179 | let poolAmount = getIntegerValue(this, poolAmountKey) | |
180 | 180 | let userAmount = match getInteger(userPoolAmountKey) { | |
181 | 181 | case int: Int => | |
182 | 182 | int | |
183 | 183 | case nothing => | |
184 | 184 | 0 | |
185 | 185 | } | |
186 | 186 | let newPoolAmount = (poolAmount + amount) | |
187 | 187 | let userAmountWithoutFee = ((amount - fraction(amount, 1, depositFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP)) | |
188 | 188 | let newUserPoolAmount = (userAmount + userAmountWithoutFee) | |
189 | 189 | [Reissue(fromBase58String(dAppAssetAddress), userAmountWithoutFee, true), ScriptTransfer(i.caller, userAmountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount)] | |
190 | 190 | } | |
191 | 191 | } | |
192 | 192 | } | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func withdraw (pool,userEarned) = { | |
198 | 198 | let amount = i.payments[0].amount | |
199 | 199 | let assetId = i.payments[0].assetId | |
200 | 200 | let assetIdString = match assetId { | |
201 | 201 | case id: ByteVector => | |
202 | 202 | toBase58String(id) | |
203 | 203 | case _ => | |
204 | 204 | throw("Match error") | |
205 | 205 | } | |
206 | 206 | if ((size(i.payments) != 1)) | |
207 | 207 | then throw("One attached payment expected") | |
208 | 208 | else if ((0 >= amount)) | |
209 | 209 | then throw(("Withdraw amount must be positive. Actual: " + toString(amount))) | |
210 | 210 | else { | |
211 | 211 | let poolAmountKey = (pool + "_asset_balance") | |
212 | 212 | let userAddress = toString(i.caller) | |
213 | 213 | let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance") | |
214 | 214 | let userPoolEarnedKey = (((pool + "_") + userAddress) + "_earned") | |
215 | 215 | let dAppAssetAddress = match getString((pool + "_service_token")) { | |
216 | 216 | case string: String => | |
217 | 217 | string | |
218 | 218 | case nothing => | |
219 | 219 | throw("You try to withdraw from unsupported pool") | |
220 | 220 | } | |
221 | 221 | if ((dAppAssetAddress != assetIdString)) | |
222 | 222 | then throw("You attached an wrong token") | |
223 | 223 | else { | |
224 | 224 | let poolAmount = getIntegerValue(this, poolAmountKey) | |
225 | 225 | let userAmount = match getInteger(userPoolAmountKey) { | |
226 | 226 | case int: Int => | |
227 | 227 | int | |
228 | 228 | case nothing => | |
229 | 229 | 0 | |
230 | 230 | } | |
231 | 231 | let userEarnedBefore = match getInteger(userPoolEarnedKey) { | |
232 | 232 | case int: Int => | |
233 | 233 | int | |
234 | 234 | case nothing => | |
235 | 235 | 0 | |
236 | 236 | } | |
237 | 237 | let liquidutyAssetAddress = getStringValue(this, (pool + "_liquidity_token")) | |
238 | 238 | let liquidityTokenDecimal = match assetInfo(fromBase58String(liquidutyAssetAddress)) { | |
239 | 239 | case asset: Asset => | |
240 | 240 | asset.decimals | |
241 | 241 | case _ => | |
242 | 242 | throw("Can't find asset") | |
243 | 243 | } | |
244 | 244 | let userEarnedTotal = (userEarned + userEarnedBefore) | |
245 | 245 | let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP)) | |
246 | 246 | let newPoolAmount = (poolAmount - amountWithoutFee) | |
247 | 247 | if ((userAmount >= amount)) | |
248 | 248 | then { | |
249 | 249 | let newUserPoolAmount = (userAmount - amountWithoutFee) | |
250 | 250 | [Burn(fromBase58String(dAppAssetAddress), amountWithoutFee), ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(liquidutyAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)] | |
251 | 251 | } | |
252 | 252 | else throw("You have not such balance for withdraw") | |
253 | 253 | } | |
254 | 254 | } | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | ||
258 | 258 | @Verifier(b6) | |
259 | 259 | func b7 () = sigVerify(b6.bodyBytes, b6.proofs[0], b6.senderPublicKey) | |
260 | 260 |
github/deemru/w8io/169f3d6 62.65 ms ◑