Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mv transfer function from VaultExtension to Vault #1079

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions pkg/interfaces/contracts/vault/IVaultExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,31 +277,6 @@ interface IVaultExtension {
*/
function approve(address owner, address spender, uint256 amount) external returns (bool);

/**
* @notice Transfers pool token from owner to a recipient.
* @dev Notice that the pool token address is not included in the params. This function is exclusively called by
* the pool contract, so msg.sender is used as the token address.
*
* @param owner Address of the owner
* @param to Address of the recipient
* @param amount Amount of tokens to transfer
* @return success True if successful, false otherwise
*/
function transfer(address owner, address to, uint256 amount) external returns (bool);

/**
* @notice Transfers pool token from a sender to a recipient using an allowance.
* @dev Notice that the pool token address is not included in the params. This function is exclusively called by
* the pool contract, so msg.sender is used as the token address.
*
* @param spender Address allowed to perform the transfer
* @param from Address of the sender
* @param to Address of the recipient
* @param amount Amount of tokens to transfer
* @return success True if successful, false otherwise
*/
function transferFrom(address spender, address from, address to, uint256 amount) external returns (bool);

/*******************************************************************************
Pool Pausing
*******************************************************************************/
Expand Down
29 changes: 29 additions & 0 deletions pkg/interfaces/contracts/vault/IVaultMain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,35 @@ interface IVaultMain {
*/
function getPoolTokenCountAndIndexOfToken(address pool, IERC20 token) external view returns (uint256, uint256);

/*******************************************************************************
Balancer Pool Tokens
*******************************************************************************/

/**
* @notice Transfers pool token from owner to a recipient.
* @dev Notice that the pool token address is not included in the params. This function is exclusively called by
* the pool contract, so msg.sender is used as the token address.
*
* @param owner Address of the owner
* @param to Address of the recipient
* @param amount Amount of tokens to transfer
* @return success True if successful, false otherwise
*/
function transfer(address owner, address to, uint256 amount) external returns (bool);
jubeira marked this conversation as resolved.
Show resolved Hide resolved

/**
* @notice Transfers pool token from a sender to a recipient using an allowance.
* @dev Notice that the pool token address is not included in the params. This function is exclusively called by
* the pool contract, so msg.sender is used as the token address.
*
* @param spender Address allowed to perform the transfer
* @param from Address of the sender
* @param to Address of the recipient
* @param amount Amount of tokens to transfer
* @return success True if successful, false otherwise
*/
function transferFrom(address spender, address from, address to, uint256 amount) external returns (bool);

/*******************************************************************************
ERC4626 Buffers
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
308.8k
308.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
244.3k
244.4k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
331.2k
331.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
257.7k
257.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
196.4k
196.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
180.5k
180.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
193.5k
190.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
213.6k
209.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
194.5k
194.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
180.6k
180.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
179.0k
179.1k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
171.7k
171.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
170.7k
170.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
178.8k
178.9k

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
538.1k
537.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
558.3k
558.4k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
217.8k
217.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
214.8k
211.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
234.8k
230.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
227.6k
227.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
196.6k
196.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
193.1k
193.2k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
221.8k
221.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
187.5k
187.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
197.9k
198.0k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
211.9k
212.0k

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
230.5k
230.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
317.4k
317.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
244.0k
244.1k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
189.4k
189.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
166.9k
167.0k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
179.8k
176.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
212.8k
208.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
158.2k
158.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
170.7k
170.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
348.6k
348.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
336.1k
336.2k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
152.6k
152.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
175.9k
176.0k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
188.3k
188.4k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
201.1k
198.1k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
234.0k
230.0k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
221.8k
221.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
173.9k
174.0k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
197.2k
197.3k

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 22 additions & 0 deletions pkg/vault/contracts/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,28 @@ contract Vault is IVaultMain, VaultCommon, Proxy {
return (poolTokens.length, index);
}

/*******************************************************************************
Balancer Pool Tokens
*******************************************************************************/

/// @inheritdoc IVaultMain
function transfer(address owner, address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, owner, to, amount);
return true;
}

/// @inheritdoc IVaultMain
function transferFrom(
address spender,
address from,
address to,
uint256 amount
) external returns (bool) {
_spendAllowance(msg.sender, from, spender, amount);
_transfer(msg.sender, from, to, amount);
return true;
}

/*******************************************************************************
ERC4626 Buffers
*******************************************************************************/
Expand Down
18 changes: 0 additions & 18 deletions pkg/vault/contracts/VaultExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -626,24 +626,6 @@ contract VaultExtension is IVaultExtension, VaultCommon, Proxy {
return true;
}

/// @inheritdoc IVaultExtension
function transfer(address owner, address to, uint256 amount) external onlyVaultDelegateCall returns (bool) {
_transfer(msg.sender, owner, to, amount);
return true;
}

/// @inheritdoc IVaultExtension
function transferFrom(
address spender,
address from,
address to,
uint256 amount
) external onlyVaultDelegateCall returns (bool) {
_spendAllowance(msg.sender, from, spender, amount);
_transfer(msg.sender, from, to, amount);
return true;
}

/*******************************************************************************
ERC4626 Buffers
*******************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions pkg/vault/test/.contract-sizes/Vault
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Bytecode 23.378
InitCode 24.786
Bytecode 23.850
InitCode 25.258
4 changes: 2 additions & 2 deletions pkg/vault/test/.contract-sizes/VaultExtension
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Bytecode 19.576
InitCode 20.729
Bytecode 19.141
InitCode 20.293
Loading
Loading