Skip to content

Commit

Permalink
Add vault getter to aggregator router (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
jubeira authored Feb 19, 2025
1 parent a3d5032 commit 2ab2db7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/interfaces/contracts/vault/IAggregatorRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.24;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { IVault } from "./IVault.sol";
import { SwapKind } from "./VaultTypes.sol";

interface IAggregatorRouter {
Expand All @@ -13,6 +14,9 @@ interface IAggregatorRouter {
/// @notice Thrown when the sender does not transfer the correct amount of tokens to the Vault.
error SwapInsufficientPayment();

/// @notice Get the address of the Balancer Vault.
function getVault() external view returns (IVault);

/**
* @notice Executes a swap operation specifying an exact input token amount.
* @param pool Address of the liquidity pool
Expand Down
5 changes: 5 additions & 0 deletions pkg/vault/contracts/AggregatorRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ contract AggregatorRouter is IAggregatorRouter, SenderGuard, VaultGuard, Reentra
// solhint-disable-previous-line no-empty-blocks
}

/// @inheritdoc IAggregatorRouter
function getVault() public view returns (IVault) {
return _vault;
}

/***************************************************************************
Swaps
***************************************************************************/
Expand Down
5 changes: 5 additions & 0 deletions pkg/vault/test/foundry/AggregatorsRouter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ contract AggregatorsRouterTest is BaseVaultTest {
poolArgs = abi.encode(vault, name, symbol);
}

function testGetVault() public view {
assertNotEq(address(vault), address(0), "Vault not set");
assertEq(address(aggregatorsRouter.getVault()), address(vault), "Wrong vault");
}

/************************************
EXACT IN
************************************/
Expand Down

0 comments on commit 2ab2db7

Please sign in to comment.