A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Simulating single-asset entry (joinSwapExternAmountIn) - "Join with" column has amount you're depositing. Output is poolAmountOut, and newTokenBalance | |||||||||||||||||||||||||
2 | Can repeat by copying F into C (updating token balance), and H into the total supply B12. | |||||||||||||||||||||||||
3 | ||||||||||||||||||||||||||
4 | Join with | |||||||||||||||||||||||||
5 | Token | Weight | Balance | token amt | Ratio in | newTokenBalanceIn | PoolAmountOut | new totalSupply | 1) In column D, type in the document you are depositing for single asset entry (e.g., 0.6 WETH) | |||||||||||||||||
6 | SXAU | 2 | 0.132 | 0 | 0 | 0.132 | 0 | 302.5757164 | You are limited to 1/2 the current balance - if you try to add 1 WETH, it won't let you (ratio in turns red) | |||||||||||||||||
7 | WETH | 4 | 1.35 | 0 | 0 | 1.35 | 0 | 302.5757164 | 2) If you enter a valid amount, ratio in is deposit/balance = 0.444; < 0.5, so ok | |||||||||||||||||
8 | WBTC | 8 | 1.194 | 0 | 0 | 1.194 | 0 | 302.5757164 | 3) It computes the new WETH balance (balance + deposit - fees = 1.926) | |||||||||||||||||
9 | rBPT | 6 | 100 | 0 | 0 | 100 | 0 | 302.5757164 | 4) It computes the poolAmountOut - the number of tokens it will mint when you deposit the WETH | |||||||||||||||||
10 | 20 | This is calculated using the weights, balances, WETH's proportion in the pool, and total liquidity (exponential formula) | ||||||||||||||||||||||||
11 | 5) Since we're minting pool tokens, the total supply goes up (just existing supply + poolAmountOut) | |||||||||||||||||||||||||
12 | Swap fee | 0.05 | 6) To do this iteratively, you would copy the new token balance (overwrite 1.35 with 1.926) | |||||||||||||||||||||||
13 | Total supply | 302.5757164 | and the new total supply (overwrite 302.57 in B13 with 324.86 in H7). | |||||||||||||||||||||||
14 | ||||||||||||||||||||||||||
15 | spot price is: (balanceIn/weightIn) / (balanceOut/weightOut) * 1/(1- swap fee) | |||||||||||||||||||||||||
16 | ||||||||||||||||||||||||||
17 | Simulating multi-asset exit (exitPool) - Pool amount in is the amount of pool tokens you're burning | |||||||||||||||||||||||||
18 | Pool | To simulate exitPool | ||||||||||||||||||||||||
19 | Token | Weight | Balance | Multi-asset-out | Amount In | tokenOut | new totalSupply | new balances | 1) Type the number of pool tokens you're burning in B30 | |||||||||||||||||
20 | SXAU | 2 | 0.132 | 0.04363 | 10 | 0.02833557752 | 292.5757164 | 0.10366 | 2) It will show you the balances you would be withdrawing for that number of tokens | |||||||||||||||||
21 | WETH | 4 | 1.35 | 0.44617 | 0 | 0 | 302.5757164 | 0.90383 | 3) The total supply would then decrease by poolAmountOut | |||||||||||||||||
22 | WBTC | 8 | 1.194 | 0.39474 | 0 | 0 | 302.5757164 | 0.79965 | 4) To iterate, you would copy the new balances from H to C, and adjust the total supply and "This LP balance" | |||||||||||||||||
23 | rBPT | 6 | 100 | 33.04958 | 0 | 0 | 302.5757164 | 66.95042 | ||||||||||||||||||
24 | 20 | To simulate single asset withdrawal (exitswapPoolAmountIn) | ||||||||||||||||||||||||
25 | 1) Type in the pool tokens you are burning in column E; for instance, 100 tokens worth of WBTC | |||||||||||||||||||||||||
26 | Swap fee | 0.05 | 2) It will show you the amount you'd be withdrawing (0.33 WBTC), and the new balance and new total supply | |||||||||||||||||||||||
27 | Total supply | 302.5757164 | ||||||||||||||||||||||||
28 | This LP bal | 202.5757164 | ||||||||||||||||||||||||
29 | ||||||||||||||||||||||||||
30 | PoolAmountIn | 100 | ||||||||||||||||||||||||
31 | ||||||||||||||||||||||||||
32 | ||||||||||||||||||||||||||
33 | ||||||||||||||||||||||||||
34 | ||||||||||||||||||||||||||
35 | ||||||||||||||||||||||||||
36 | ||||||||||||||||||||||||||
37 | ||||||||||||||||||||||||||
38 | ||||||||||||||||||||||||||
39 | ||||||||||||||||||||||||||
40 | ||||||||||||||||||||||||||
41 | ||||||||||||||||||||||||||
42 | ||||||||||||||||||||||||||
43 | ||||||||||||||||||||||||||
44 | ||||||||||||||||||||||||||
45 | ||||||||||||||||||||||||||
46 | ||||||||||||||||||||||||||
47 | ||||||||||||||||||||||||||
48 | ||||||||||||||||||||||||||
49 | ||||||||||||||||||||||||||
50 | ||||||||||||||||||||||||||
51 | ||||||||||||||||||||||||||
52 | ||||||||||||||||||||||||||
53 | ||||||||||||||||||||||||||
54 | ||||||||||||||||||||||||||
55 | ||||||||||||||||||||||||||
56 | ||||||||||||||||||||||||||
57 | ||||||||||||||||||||||||||
58 | ||||||||||||||||||||||||||
59 | ||||||||||||||||||||||||||
60 | ||||||||||||||||||||||||||
61 | ||||||||||||||||||||||||||
62 | ||||||||||||||||||||||||||
63 | ||||||||||||||||||||||||||
64 | ||||||||||||||||||||||||||
65 | ||||||||||||||||||||||||||
66 | ||||||||||||||||||||||||||
67 | ||||||||||||||||||||||||||
68 | ||||||||||||||||||||||||||
69 | ||||||||||||||||||||||||||
70 | ||||||||||||||||||||||||||
71 | ||||||||||||||||||||||||||
72 | ||||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||
74 | ||||||||||||||||||||||||||
75 | ||||||||||||||||||||||||||
76 | ||||||||||||||||||||||||||
77 | ||||||||||||||||||||||||||
78 | ||||||||||||||||||||||||||
79 | ||||||||||||||||||||||||||
80 | ||||||||||||||||||||||||||
81 | ||||||||||||||||||||||||||
82 | ||||||||||||||||||||||||||
83 | ||||||||||||||||||||||||||
84 | ||||||||||||||||||||||||||
85 | ||||||||||||||||||||||||||
86 | ||||||||||||||||||||||||||
87 | ||||||||||||||||||||||||||
88 | ||||||||||||||||||||||||||
89 | ||||||||||||||||||||||||||
90 | ||||||||||||||||||||||||||
91 | ||||||||||||||||||||||||||
92 | ||||||||||||||||||||||||||
93 | ||||||||||||||||||||||||||
94 | ||||||||||||||||||||||||||
95 | ||||||||||||||||||||||||||
96 | ||||||||||||||||||||||||||
97 | ||||||||||||||||||||||||||
98 | ||||||||||||||||||||||||||
99 | ||||||||||||||||||||||||||
100 |