From e8bd2ead6d2f50fc48816fec320559b9186c45bb Mon Sep 17 00:00:00 2001 From: Jeffrey Bennett Date: Thu, 26 Oct 2023 23:52:47 -0400 Subject: [PATCH] refactor: add getter for the query library --- .../contracts/standalone-utils/IBalancerRelayer.sol | 2 ++ pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol | 4 ++++ pkg/standalone-utils/test/BaseRelayerLibrary.test.ts | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/interfaces/contracts/standalone-utils/IBalancerRelayer.sol b/pkg/interfaces/contracts/standalone-utils/IBalancerRelayer.sol index b3ab5d7e98..6a175a6cd3 100644 --- a/pkg/interfaces/contracts/standalone-utils/IBalancerRelayer.sol +++ b/pkg/interfaces/contracts/standalone-utils/IBalancerRelayer.sol @@ -24,6 +24,8 @@ import "../vault/IVault.sol"; interface IBalancerRelayer { function getLibrary() external view returns (address); + function getQueryLibrary() external view returns (address); + function getVault() external view returns (IVault); function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); diff --git a/pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol b/pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol index c8dba9c648..1ea1bb8158 100644 --- a/pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol +++ b/pkg/standalone-utils/contracts/relayer/BalancerRelayer.sol @@ -82,6 +82,10 @@ contract BalancerRelayer is IBalancerRelayer, Version, ReentrancyGuard { return _library; } + function getQueryLibrary() external view override returns (address) { + return _queryLibrary; + } + function multicall(bytes[] calldata data) external payable override nonReentrant returns (bytes[] memory results) { uint256 numData = data.length; diff --git a/pkg/standalone-utils/test/BaseRelayerLibrary.test.ts b/pkg/standalone-utils/test/BaseRelayerLibrary.test.ts index 2959455214..e179c4c35d 100644 --- a/pkg/standalone-utils/test/BaseRelayerLibrary.test.ts +++ b/pkg/standalone-utils/test/BaseRelayerLibrary.test.ts @@ -9,7 +9,7 @@ import { deploy, deployedAt } from '@balancer-labs/v2-helpers/src/contract'; import * as expectEvent from '@balancer-labs/v2-helpers/src/test/expectEvent'; import { actionId } from '@balancer-labs/v2-helpers/src/models/misc/actions'; -import { ANY_ADDRESS, MAX_UINT256 } from '@balancer-labs/v2-helpers/src/constants'; +import { ANY_ADDRESS, MAX_UINT256, ZERO_ADDRESS } from '@balancer-labs/v2-helpers/src/constants'; import Vault from '@balancer-labs/v2-helpers/src/models/vault/Vault'; import { BigNumberish, bn, fp } from '@balancer-labs/v2-helpers/src/numbers'; import { toChainedReference } from './helpers/chainedReferences'; @@ -48,6 +48,10 @@ describe('BaseRelayerLibrary', function () { expect(await relayer.getLibrary()).to.equal(relayerLibrary.address); }); + it('returns the query library address', async () => { + expect(await relayer.getQueryLibrary()).not.to.equal(ZERO_ADDRESS); + }); + it('returns the vault address', async () => { expect(await relayer.getVault()).to.equal(vault.address); });