You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A bound token has a valid balance and weight. A token cannot be bound without valid parameters which will enable e.g. `getSpotPrice` in terms of other tokens. However, disabling `isSwapPublic` will disable any interaction with this token in practice \(assuming there are no existing tokens in the pool, which can always `exitPool`\).
49
51
50
-
#### `getNumTokens`
52
+
**getNumTokens**
51
53
52
54
`getNumTokens() -> (uint)`
53
55
54
56
How many tokens are bound to this pool.
55
57
56
-
#### `getNormalizedWeight`
58
+
**getNormalizedWeight**
57
59
58
60
`getNormalizedWeight(address token) -> (uint)`
59
61
60
62
The normalized weight of a token. The combined normalized weights of all tokens will sum up to 1. \(Note: the actual sum may be 1 plus or minus a few wei due to division precision loss\)
61
63
62
-
#### `getController`
64
+
**getController**
63
65
64
66
`getController() -> (address)`
65
67
66
68
Get the "controller" address, which can call `CONTROL` functions like `rebind`, `setSwapFee`, or `finalize`.
67
69
68
-
#### `bind`
70
+
**bind**
69
71
70
72
`bind(address token, uint balance, uint denorm)`
71
73
@@ -80,53 +82,53 @@ Possible errors:
80
82
*`ERR_MAX_TOKENS` -- Only 8 tokens are allowed per pool
Changes the parameters of an already-bound token. Performs the same validation on the parameters.
88
90
89
-
#### `unbind`
91
+
**unbind**
90
92
91
93
`unbind(address token)`
92
94
93
95
Unbinds a token, clearing all of its parameters. Exit fee is charged and the remaining balance is sent to caller.
94
96
95
-
#### `setPublicSwap`
97
+
**setPublicSwap**
96
98
97
99
`setPublicSwap(bool isPublic)`
98
100
99
101
Makes `isPublicSwap` return `_publicSwap` Requires caller to be controller and pool not to be finalized. Finalized pools always have public swap.
100
102
101
-
#### `finalize`
103
+
**finalize**
102
104
103
105
`finalize()`
104
106
105
107
This makes the pool **finalized**. This is a one-way transition. `bind`, `rebind`, `unbind`, `setSwapFee` and `setPublicSwap` will all throw `ERR_IS_FINALIZED` after pool is finalized. This also switches `isSwapPublic` to true.
106
108
107
-
#### `gulp`
109
+
**gulp**
108
110
109
111
`gulp(address token)`
110
112
111
113
This syncs the internal `balance` of `token` within a pool with the actual `balance` registered on the ERC20 contract. This is useful to account for airdropped tokens or any tokens sent to the pool without using the `join` or `joinSwap` methods.
112
114
113
115
As an example, pools that contain `COMP` tokens can have the `COMP` balance [updated with the rewards sent by Compound protocol](https://etherscan.io/tx/0xeccd42bf2b8a180a561c026717707d9024a083059af2f22c197ee511d1010e23). In order for any airdrop balance to be gulped, the token must be bound to the pool. So if a shared pool \(which is immutable\) does not have a given token, any airdrops in that token will be locked in the pool forever.
114
116
115
-
#### `setSwapFee`
117
+
**setSwapFee**
116
118
117
119
`setSwapFee(uint swapFee)`
118
120
119
121
Caller must be controller. Pool must NOT be finalized.
120
122
121
-
#### `isFinalized`
123
+
**isFinalized**
122
124
123
125
`isFinalized() -> (bool)`
124
126
125
127
The `finalized` state lets users know that the weights, balances, and fees of this pool are immutable. In the `finalized` state, `SWAP`, `JOIN`, and `EXIT` are public. [`CONTROL` capabilities](api.md#access-control) are disabled.
126
128
127
-
### Trading and Liquidity Functions
129
+
####Trading and Liquidity Functions
128
130
129
-
#### `swapExactAmountIn`
131
+
**swapExactAmountIn**
130
132
131
133
```text
132
134
swapExactAmountIn(
@@ -143,7 +145,7 @@ Trades an exact `tokenAmountIn` of `tokenIn` taken from the caller by the pool,
143
145
144
146
Returns `(tokenAmountOut, spotPriceAfter)`, where `tokenAmountOut` is the amount of token that came out of the pool, and `spotPriceAfter` is the new marginal spot price, ie, the result of `getSpotPrice` after the call. \(These values are what are limited by the arguments; you are guaranteed `tokenAmountOut >= minAmountOut` and `spotPriceAfter <= maxPrice`\).
Join the pool, getting `poolAmountOut` pool tokens. This will pull some of each of the currently trading tokens in the pool, meaning you must have called `approve` for each token for this pool. These values are limited by the array of `maxAmountsIn` in the order of the pool tokens.
164
166
165
167
If the balances you are adding are 10% of the current pool balances, then you should set `poolAmountOut` as 10% of the current `poolSupply`. Bear in mind that the proportions of the different underlying token balances might change until your transaction gets mined: therefore you should have a buffer to avoid the transaction being reverted. We usually suggest 1% if you use high gas prices for fast confirmation. So calculate `poolAmountOut` as described above with 99% of the `maxAmountsIn`.
Exit the pool, paying `poolAmountIn` pool tokens and getting some of each of the currently trading tokens in return. These values are limited by the array of `minAmountsOut` in the order of the pool tokens.
172
174
173
-
To define `minAmountsOut`, consider the percentage of the pool liquidity you are withdrawing, which is `poolAmountIn/poolSupply` and multiply that percentage by each of the underlying pool token balances. If you expect to receive say 10 units of each of the underlying tokens in the pool, consider setting `minAmountsOut` as 9.9 to allow for variations in the balances proportions that may happen before your transaction gets mined.
175
+
To define `minAmountsOut`, consider the percentage of the pool liquidity you are withdrawing, which is `poolAmountIn/poolSupply` and multiply that percentage by each of the underlying pool token balances. If you expect to receive say 10 units of each of the underlying tokens in the pool, consider setting `minAmountsOut` as 9.9 to allow for variations in the balances proportions that may happen before your transaction gets mined.
Specify `poolAmountOut` pool shares that you want to get, and a token `tokenIn` to pay with. This costs `tokenAmountIn` tokens \(these went into the pool\).
Copy file name to clipboardExpand all lines: api/core-contracts.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/api/core-contracts)
2
-
3
1
# Events
4
2
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/api/core-contracts)
4
+
5
+
## Events
6
+
5
7
### Events
6
8
7
9
`LOG_CALL` is an anonymous event which uses the function signature as the event signature. It is fired by all stateful functions. The following applies to Balancer Core pools. Smart Pools have similar events and modifiers.
@@ -14,7 +16,7 @@ event LOG_CALL(
14
16
) anonymous;
15
17
```
16
18
17
-
`LOG_SWAP` is fired \(along with `LOG_CALL`\) for all [swap variants]().
19
+
`LOG_SWAP` is fired \(along with `LOG_CALL`\) for all [swap variants](core-contracts.md).
Copy file name to clipboardExpand all lines: api/migration-to-version-0.4.md
+12-10
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,31 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/api/migration-to-version-0.4)
2
-
3
1
# Migration to Version 1.0
4
2
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/api/migration-to-version-0.4)
4
+
5
+
## Migration to Version 1.0
6
+
5
7
The SOR Version 1.0.0-0 introduces breaking changes but should be fairly easy to update. Benefits of updating include - support for multihop swaps and an easier to use wrapper interface as well as more efficient/faster processing.
6
8
7
-
## Overview Of Changes
9
+
###Overview Of Changes
8
10
9
-
### SOR Library
11
+
####SOR Library
10
12
11
13
The SOR is now instantiated as an object:
12
14
13
-
#### `const SOR = new sor.SOR(Provider, GasPrice, MaxPools, ChainId, PoolsUrl)`
15
+
**const SOR = new sor.SOR\(Provider, GasPrice, MaxPools, ChainId, PoolsUrl\)**
14
16
15
17
* Find further details on parameters [here](../smart-contracts/sor/development.md#sor-object).
16
18
17
19
SOR now has three main functions:
18
20
19
-
#### `await SOR.setCostOutputToken(tokenOut)`
21
+
**await SOR.setCostOutputToken\(tokenOut\)**
20
22
21
23
* Calculates gas cost for swapping token on Balancer.
22
24
* The result is used to make more gas efficient swap recommendations.
23
25
* Result is cached for future use but can be updated by re-calling.
24
26
* Notice that outputToken is tokenOut if swapType == 'swapExactIn' and tokenIn if swapType == 'swapExactOut'
25
27
26
-
#### `const isSuccess = await SOR.fetchPools()`
28
+
**const isSuccess = await SOR.fetchPools\(\)**
27
29
28
30
* This fetches all Balancer pool information and on-chain balances.
29
31
* Retrieves pool information from static IPFS file rather than Subgraph.
@@ -32,19 +34,19 @@ SOR now has three main functions:
32
34
* Information is cached and used for all future processing, this results in fast processing of swaps, i.e. useful when changing swap amounts or types in a UI.
33
35
* Accurate/valid swaps rely on upM to date balance information so it is recommended this function is re-called to refresh as needed.
* Will return amount expected and a list of swaps that can be executed on-chain.
39
41
40
-
### ExchangeProxy Contract
42
+
####ExchangeProxy Contract
41
43
42
44
A new ExchangeProxy contract that supports multihop swaps has been deployed to the addresses below. For contract details please see [Exchange Proxy](../smart-contracts/exchange-proxy.md).
* For more information on SOR functions and to see code examples \(including using with ExchangeProxy\) please see [Development & Examples](../smart-contracts/sor/development.md).
50
52
* For a full example demonstrating use of SOR wrapper please see [here](https://github.com/balancer-labs/balancer-sor/blob/master/test/testScripts/example-simpleSwap.ts).
Copy file name to clipboardExpand all lines: core-concepts/bal-balancer-governance-token/README.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-balancer-governance-token/)
2
-
3
1
# BAL Governance Token
4
2
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-balancer-governance-token/)
4
+
5
+
## BAL Governance Token
6
+
5
7
Since inception, our goal at Balancer Labs has been to decentralize and diversify governance of the [Balancer Protocol](http://balancer.finance/). We have looked into several approaches and designs, and have landed on an approach we are proud to share: the Balancer Protocol Governance Token \(BAL\).
6
8
7
9
We believe alignment between token holders and protocol stakeholders is crucial for successful decentralized governance. More explicitly, we believe BAL tokens are the vehicle to drive alignment and participation in the protocol. BAL tokens are not an investment; BAL token holders should be people who interact with the protocol in some way, are committed to its future development, and want a seat at the governance table.
@@ -24,17 +26,17 @@ We expect token holders to help guide the protocol to its fullest potential thro
24
26
25
27
### Token Supply and Distribution <aid="14a8"></a>
26
28
27
-
The total supply of BAL tokens will be capped at 100M. This does NOT mean that this cap will ever be reached. It will be up to governance \(controlled by BAL token holders\) to decide if the distribution should end before this cap is reached.
29
+
The total supply of BAL tokens will be capped at 100M. This does NOT mean that this cap will ever be reached. It will be up to governance \(controlled by BAL token holders\) to decide if the distribution should end before this cap is reached.
28
30
29
31
**25M** BAL tokens were initially allocated to founders, stock options, advisors and investors, all subject to vesting periods.
30
32
31
33
**5M** were allocated for the [Balancer Ecosystem Fund](https://etherscan.io/token/0xba100000625a3754423978a60c9317c58a424e3d?a=0xb618f903ad1d00d6f7b92f5b0954dcdc056fc533). This fund will be deployed to attract and incentivize strategic partners who will help the Balancer ecosystem grow and thrive. BAL holders will ultimately decide how this fund is used over the coming years.
32
34
33
35
**5M** were allocated for the [Fundraising Fund](https://etherscan.io/token/0xba100000625a3754423978a60c9317c58a424e3d?a=0xb129f73f1afd3a49c701241f374db17ae63b20eb). Balancer Labs raised a pre-seed and seed round. This fund will be used for future fundraising rounds to support Balancer Labs' operations and growth. BAL tokens will never be sold to retail investors.
34
36
35
-
The remaining 65M tokens are intended to be mostly distributed to liquidity providers in the coming years.
37
+
The remaining 65M tokens are intended to be mostly distributed to liquidity providers in the coming years.
36
38
37
-
Every week 145,000 BALs, or approximately 7.5M per year, are distributed to liquidity providers. This means that in the first year of BAL’s existence there would be 30% supply inflation from the initial supply of 25M tokens \(here we are not considering the two funds, since they are not yet allocated\).
39
+
Every week 145,000 BALs, or approximately 7.5M per year, are distributed to liquidity providers. This means that in the first year of BAL’s existence there would be 30% supply inflation from the initial supply of 25M tokens \(here we are not considering the two funds, since they are not yet allocated\).
38
40
39
41
This high rate of supply inflation is meant to kickstart the distribution of governance rights of the protocol to those who earn it. At the the current rate of 145,000 BAL per week, it would take 8.666 years to distribute the whole 65M BAL remaining, before reaching the 100M cap.
Copy file name to clipboardExpand all lines: core-concepts/bal-balancer-governance-token/bal-for-gas.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-balancer-governance-token/bal-for-gas)
2
-
3
1
# BAL for Gas
4
2
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-balancer-governance-token/bal-for-gas)
4
+
5
+
## BAL for Gas
6
+
5
7
Following a 6 week pilot, on March 7th 2021 the Balancer community approved a campaign to increase BAL distribution. To ensure lasting robustness of the governance process, both liquidity providers and traders should have a say in how the protocol evolves.
6
8
7
9
While liquidity providers receive BAL as a function of the amount of liquidity provided in the system, traders earn BAL for swapping tokens on the Balancer Exchange dApp.
@@ -28,11 +30,11 @@ Because this program only partially covers gas costs \(with very specific caps t
28
30
29
31
80,000 BAL from the Ecosystem Fund have been allocated to the “BAL for Gas’’ campaign, starting on March 8th 2021. There is no fixed time period; the budget is consumed on a first-come, first-served basis. When the budget is exhausted, the campaign is suspended until it is replenished by BAL governance.
30
32
31
-
## Notes
33
+
###Notes
32
34
33
35
\[1\] Transactions sent by the miner of the block or having a gas price of 10 Gwei or less are not considered for the purposes of determining the median gas price of the block
34
36
35
-
## References
37
+
###References
36
38
37
39
*[BAL for Gas proposal](https://forum.balancer.finance/t/proposal-bal-for-gas/1437)
38
40
*[Original pilot](https://forum.balancer.finance/t/proposal-balancer-exchange-gas-reimbursement/705) and [Expansion of the list of eligible tokens](https://forum.balancer.finance/t/proposal-expand-the-exchange-gas-reimbursement-to-all-whitelisted-tokens/799)
Copy file name to clipboardExpand all lines: core-concepts/bal-liquidity-mining/README.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-liquidity-mining/)
2
-
3
1
# Liquidity Mining
4
2
5
-
## BAL Distribution Proportional to Liquidity on Balancer <aid="353e"></a>
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-liquidity-mining/)
4
+
5
+
## Liquidity Mining
6
+
7
+
### BAL Distribution Proportional to Liquidity on Balancer <aid="353e"></a>
6
8
7
9
To make the token distribution as fair as possible, we distribute BAL tokens proportional to the amount of liquidity each address contributed, relative to the total liquidity on Balancer. Since there is liquidity in several different tokens, we use the USD value as the common measure.
8
10
@@ -51,7 +53,7 @@ The constant, `k`, was initially set to 0.5, but beginning in week 8 \(July 20th
51
53
52
54
All the calculations described above depend exclusively on on-chain data and historical token prices openly accessible on CoinGecko. This whole calculation process is fully auditable via an [open source script](https://github.com/balancer-labs/bal-mining-scripts/).
53
55
54
-
## Token Whitelist and Eligible Pools for Liquidity Mining <aid="84fc"></a>
56
+
###Token Whitelist and Eligible Pools for Liquidity Mining <aid="84fc"></a>
55
57
56
58
**UPDATED for week 9**\(starting June 29th 00:00 UTC\): All tokens present in the whitelist created by the community \(see whitelist proposal\) are eligible for BAL liquidity mining. The [most up to date list](https://github.com/balancer-labs/assets/blob/master/lists/eligible.json) is maintained on Balancer's Github. All tokens listed under the `"homestead"` list in the json file linked are eligible. This list will evolve over time with input from the community.
Copy file name to clipboardExpand all lines: core-concepts/bal-liquidity-mining/exchange-and-reward-listing.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
-
# This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-liquidity-mining/exchange-and-reward-listing)
2
-
3
1
# Exchange and BAL Mining Listing
4
2
3
+
## This page has been deprecated. V1 documentation is partially maintained [here](https://docs.balancer.fi/v/v1/core-concepts/bal-liquidity-mining/exchange-and-reward-listing)
4
+
5
+
## Exchange and BAL Mining Listing
6
+
5
7
Token listings are managed in [this repository](https://github.com/balancer-labs/assets), with the following categories:
6
8
7
9
*`eligible.json`: assets eligible for BAL mining as per weekly proposals
0 commit comments