Skip to content

Commit

Permalink
Merge pull request #135 from balancer/audit-updates
Browse files Browse the repository at this point in the history
Cumulative changes from recent PRs
  • Loading branch information
EndymionJkb authored Aug 15, 2024
2 parents 90d4758 + de56aab commit ba9f595
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
5 changes: 1 addition & 4 deletions docs/concepts/vault/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ Liquidity can be added to a buffer for a specific token pair. This is done by in
* @param wrappedToken Address of the wrapped token that implements IERC4626
* @param amountUnderlyingRaw Amount of underlying tokens that will be deposited into the buffer
* @param amountWrappedRaw Amount of wrapped tokens that will be deposited into the buffer
* @param sharesOwner Address of the contract that will own the liquidity. Only this contract will be able to
* remove liquidity from the buffer
* @return issuedShares the amount of tokens sharesOwner has in the buffer, denominated in underlying tokens.
* (This is the BPT of an internal ERC4626 token buffer.)
*/
function addLiquidityToBuffer(
IERC4626 wrappedToken,
uint256 amountUnderlyingRaw,
uint256 amountWrappedRaw,
address sharesOwner
uint256 amountWrappedRaw
) external returns (uint256 issuedShares);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,25 @@ Only pools whose protocol fees have NOT been overridden can be permissionlessly
|---|---|---|
| pool | address | The pool for which to get the protocol yield fee info |

### `collectAggregateFees`

```solidity
function collectAggregateFees(address pool) external;
```
This function collects accumulated aggregate swap and yield fees for the specified pool. It makes a permissioned call on `collectAggregateFees` in the Vault to calculate the fee amounts, then calls `sendTo` to transfer the tokens, after which they are distributed to the protocol and pool creator balances. As this affects Vault accounting, it is invoked through `unlock` and a local "hook", with the ProtocolFeeController acting as the "Router". The Vault function supplies credit for the tokens to be taken as fees, and the fee controller takes debt (through `sendTo`), ensuring valid settlement.

**Parameters:**

| Name | Type | Description |
|---|---|---|
| pool | address | The pool on which all aggregate fees should be collected |

### `getProtocolFeeAmounts`

```solidity
function getProtocolFeeAmounts(address pool) external view returns (uint256[] memory feeAmounts);
```
This function returns the amount of each pool token allocated to the protocol and available for withdrawal. It includes both swap and yield fees. Calling `collectAggregateFees` on the Vault will transfer any pending fees from the Vault to the Protocol Fee Controller, and allocate them to the protocol and pool creator.
This function returns the amount of each pool token allocated to the protocol and available for withdrawal. It includes both swap and yield fees. Calling `collectAggregateFees` will transfer any pending fees from the Vault to the Protocol Fee Controller, and allocate them to the protocol and pool creator.

**Parameters:**

Expand Down
3 changes: 1 addition & 2 deletions docs/developer-reference/contracts/router-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ Executes a swap operation specifying an exact output token amount.
function addLiquidityToBuffer(
IERC4626 wrappedToken,
uint256 amountUnderlyingRaw,
uint256 amountWrappedRaw,
address sharesOwner
uint256 amountWrappedRaw
) external returns (uint256 issuedShares);
```
Adds liquidity to a yield-bearing buffer (one of the Vault's internal ERC4626 token buffers).
Expand Down
24 changes: 5 additions & 19 deletions docs/developer-reference/contracts/vault-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ This `VaultAdmin` function unpauses native vault buffers globally. When buffers
function addLiquidityToBuffer(
IERC4626 wrappedToken,
uint256 amountUnderlyingRaw,
uint256 amountWrappedRaw,
address sharesOwner
uint256 amountWrappedRaw
) external returns (uint256 issuedShares);
```
This `VaultAdmin` function adds liquidity to a yield-bearing token buffer (linear pool embedded in the vault).
Expand Down Expand Up @@ -949,19 +948,6 @@ This `VaultAdmin` function assigns a new static swap fee percentage to the speci
| pool | address | The address of the pool for which the static swap fee will be changed |
| swapFeePercentage | uint256 | The new swap fee percentage to apply to the pool |

### `collectAggregateFees`

```solidity
function collectAggregateFees(address pool) external;
```
This `VaultAdmin` function collects accumulated aggregate swap and yield fees for the specified pool. Fees are sent to the ProtocolFeeController address.

**Parameters:**

| Name | Type | Description |
|---|---|---|
| pool | address | The pool on which all aggregate fees should be collected |

### `updateAggregateSwapFeePercentage`

```solidity
Expand Down Expand Up @@ -1078,9 +1064,9 @@ This `VaultAdmin` function disables recovery mode for a pool. This is a permissi
### `quote`

```solidity
function quote(bytes calldata data) external payable returns (bytes memory result);
function quote(bytes calldata data) external returns (bytes memory result);
```
This `VaultExtension` function performs a callback on `msg.sender` with arguments provided in `data`. It is used to query a set of operations on the Vault. Only off-chain `eth_call` are allowed, anything else will revert.
This `VaultExtension` function performs a callback on `msg.sender` with arguments provided in `data`. It is used to query a set of operations on the Vault. Only off-chain `eth_call` are allowed, anything else will revert. Also note that it is non-payable, as the Vault does not allow ETH.

**Parameters:**

Expand All @@ -1097,9 +1083,9 @@ This `VaultExtension` function performs a callback on `msg.sender` with argument
### `quoteAndRevert`

```solidity
function quoteAndRevert(bytes calldata data) external payable;
function quoteAndRevert(bytes calldata data) external;
```
This `VaultExtension` function performs a callback on `msg.sender` with arguments provided in `data`. It is used to query a set of operations on the Vault. Only off-chain `eth_call` are allowed, anything else will revert. This call always reverts, returning the result in the revert reason.
This `VaultExtension` function performs a callback on `msg.sender` with arguments provided in `data`. It is used to query a set of operations on the Vault. Only off-chain `eth_call` are allowed, anything else will revert. This call always reverts, returning the result in the revert reason. Also note that it is non-payable, as the Vault does not allow ETH.

**Parameters:**

Expand Down

0 comments on commit ba9f595

Please sign in to comment.