| 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 | ||||||||||||||||||||||||||
2 | Price function | ETH reserve | Balloon reserve | |||||||||||||||||||||||
3 | input reserve | 2 | ETH | How much ETH is currently in the DEX | 2 | 90000000 | ||||||||||||||||||||
4 | output reserve | 90000000 | balloons | How many balloons are currently in the DEX | ||||||||||||||||||||||
5 | input amount | 0.6 | ETH | How much ETH I want to pay | ||||||||||||||||||||||
6 | input with fee | 0.5982 | ETH | How much ETH is left after 0.03% DEX fee is subtracted | ||||||||||||||||||||||
7 | numerator | 53838000 | ||||||||||||||||||||||||
8 | denominator | 2.5982 | ||||||||||||||||||||||||
9 | price | 20,721,268.570549 | balloons | How many balloons I will get for the amount of ETH I'm paying | ||||||||||||||||||||||
10 | 34535447.617581 | balloons / ETH | Price per balloon | |||||||||||||||||||||||
11 | ||||||||||||||||||||||||||
12 | ETH to Token | How many ballons I can get for the given amount of ETH | ||||||||||||||||||||||||
13 | ETH | 2 | ETH | How much ETH I pay | ||||||||||||||||||||||
14 | ETH reserve | 2 | ETH | How much ETH is currently in the DEX | ||||||||||||||||||||||
15 | token reserve | 90000000 | balloons | How many balloons are currently in the dex | ||||||||||||||||||||||
16 | tokens bought | 44,932,398.597897 | balloons | How many balloons I will get for my ETH | ||||||||||||||||||||||
17 | ||||||||||||||||||||||||||
18 | Token to ETH | How much ETH I can get for the given amount of balloons you want to sell to a contract | ||||||||||||||||||||||||
19 | Balloons | 1 | balloons | How many balloons I want to sell | ||||||||||||||||||||||
20 | ETH reserve | 2 | ETH | How much ETH is currently in the DEX | ||||||||||||||||||||||
21 | Token reserve | 90000000 | balloons | How many balloons are currently in the dex | ||||||||||||||||||||||
22 | ETH "bought" | 0.000000 | ETH | How much ETH I will get for my balloons | ||||||||||||||||||||||
23 | ||||||||||||||||||||||||||
24 | Adding liquidity to the liquidity pool (deposit function) | |||||||||||||||||||||||||
25 | ETH deposited | 100 | ETH | How much ETH I want to add to the liquidity pool | ||||||||||||||||||||||
26 | ETH reserve | 2 | ETH | How much ETH is currently in the DEX | ||||||||||||||||||||||
27 | Token reserve | 90000000 | balloons | How many balloons are currently in the DEX | ||||||||||||||||||||||
28 | Total liquidity | 2 | LP tokens | Assuming there were no swaps in the initial DEX contract, total liquidity is equal to ETH reserve | ||||||||||||||||||||||
29 | Tokens to deposit | 4500000000 | balloons | How many tokens need to be sent to DEX when depositing the given amount of ETH. Calculated based on current liquidity pool ratio. | ||||||||||||||||||||||
30 | Minted liquidity | 100 | LP tokens | How many LP tokens were added to the liquidity pool | ||||||||||||||||||||||
31 | New total liquidity | 102 | LP tokens | Newly minted liquidity added to the previous total | ||||||||||||||||||||||
32 | ||||||||||||||||||||||||||
33 | Removing liquidity from the liquidity pool (withdraw function) | |||||||||||||||||||||||||
34 | Liquidity withdrawn | 4 | LP tokens | How many LP tokens are removed from the liquidity pool | ||||||||||||||||||||||
35 | Total liquidity | 2 | LP tokens | Current total liquidity, before removing LP tokens. Assuming there were no swaps in the initial DEX contract, total liquidity is equal to ETH reserve | ||||||||||||||||||||||
36 | ETH reserve | 2 | ETH | How much ETH is currently in the DEX | ||||||||||||||||||||||
37 | Token reserve | 90000000 | balloons | How many balloons are currently in the DEX | ||||||||||||||||||||||
38 | ETH withdrawn | 4 | ETH | How much ETH is removed from the liquidity pool | ||||||||||||||||||||||
39 | Token withdrawn | 180000000 | balloons | How many balloons are withdrawn from the liquidity pool | ||||||||||||||||||||||
40 | New total liquidity | -2 | LP tokens | New total of the liquidity pool | ||||||||||||||||||||||
41 | ||||||||||||||||||||||||||
42 | ||||||||||||||||||||||||||
43 | By: Radek | velvetshark.com | |||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||