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 1 commit
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
12 changes: 0 additions & 12 deletions pkg/interfaces/contracts/vault/IVaultExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +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
Expand Down
16 changes: 16 additions & 0 deletions pkg/interfaces/contracts/vault/IVaultMain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ 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

/*******************************************************************************
ERC4626 Buffers
*******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
213.6k
212.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
171.8k
171.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
166.5k
166.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
215.0k
214.9k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
234.9k
233.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
193.2k
193.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
167.2k
167.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
213.2k
212.1k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
201.6k
201.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
234.5k
233.4k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
336.5k
336.6k
10 changes: 10 additions & 0 deletions pkg/vault/contracts/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,16 @@ 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;
}

/*******************************************************************************
ERC4626 Buffers
*******************************************************************************/
Expand Down
6 changes: 0 additions & 6 deletions pkg/vault/contracts/VaultExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,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,
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.569
InitCode 24.978
Bytecode 23.972
InitCode 25.380
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.350
InitCode 20.495
Bytecode 19.289
InitCode 20.435
5 changes: 0 additions & 5 deletions pkg/vault/test/foundry/mutation/vault/VaultExtension.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ contract VaultExtensionMutationTest is BaseVaultTest {
vaultExtension.allowance(address(dai), address(1), address(2));
}

function testTransferWhenNotVault() public {
vm.expectRevert(IVaultErrors.NotVaultDelegateCall.selector);
vaultExtension.transfer(address(0), address(1), 1);
}

function testApproveWhenNotVault() public {
vm.expectRevert(IVaultErrors.NotVaultDelegateCall.selector);
vaultExtension.approve(address(0), address(1), 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
196.6k
195.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
159.7k
159.8k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
188.6k
188.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
201.7k
201.6k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
217.8k
216.7k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
174.4k
174.5k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
198.4k
198.3k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
214.5k
213.4k
Original file line number Diff line number Diff line change
@@ -1 +1 @@
237.7k
236.6k
Loading