Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lufaque committed Nov 11, 2024
1 parent 8f4a204 commit 221555c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/foundry/test/ParentPool/Deposit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract Deposit is BaseTest {
uint256 internal constant DEPOSIT_FEE_USDC = 3 * 10 ** 6;
uint256 internal constant MAX_INDIVIDUAL_DEPOSIT = 100_000 * 1e6; // 100k usdc

FunctionsRouter functionsRouter = FunctionsRouter(vm.envAddress("CLF_ROUTER_BASE"));
FunctionsRouter internal functionsRouter = FunctionsRouter(vm.envAddress("CLF_ROUTER_BASE"));

/*//////////////////////////////////////////////////////////////
SETUP
Expand Down
17 changes: 12 additions & 5 deletions packages/foundry/test/utils/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ contract BaseTest is Test {
VARIABLES
//////////////////////////////////////////////////////////////*/
uint256 internal constant LINK_INIT_BALANCE = 100 * 1e18;
uint256 internal constant PARENT_POOL_CAP = 100_000_000 * 1e6;

ParentPoolCLFCLA public parentPoolCLFCLA;
ParentPool public parentPoolImplementation;
Expand Down Expand Up @@ -124,6 +125,7 @@ contract BaseTest is Test {
proxyDeployer,
bytes("")
);
vm.stopPrank();
}

function _deployParentPool() private {
Expand Down Expand Up @@ -158,6 +160,7 @@ contract BaseTest is Test {
function deployLpToken() public {
vm.prank(deployer);
lpToken = new LPToken(deployer, address(parentPoolProxy));
vm.stopPrank();
}

function _deployCCIPLocalSimulatorFork() internal {
Expand Down Expand Up @@ -194,20 +197,24 @@ contract BaseTest is Test {
function _setProxyImplementation(address _proxy, address _implementation) internal {
vm.prank(proxyDeployer);
ITransparentUpgradeableProxy(address(_proxy)).upgradeToAndCall(_implementation, bytes(""));
vm.stopPrank();
}

/// @notice might need to update this to pass _parentPoolImplementation like above
function setParentPoolVars() public {
vm.prank(deployer);
// IParentPool(address(parentPoolProxy)).setPools(_chainSelector, _childProxy, false);

vm.prank(deployer);
// should probably update this from user1
IParentPool(address(parentPoolProxy)).setConceroContractSender(
uint64(vm.envUint("CL_CCIP_CHAIN_SELECTOR_ARBITRUM")),
address(user1),
true
);

vm.prank(deployer);
IParentPool(address(parentPoolProxy)).setPoolCap(PARENT_POOL_CAP);

vm.stopPrank();
}

function _setDstSelectorAndPool(uint64 _chainSelector, address _poolProxy) internal {
Expand Down Expand Up @@ -235,10 +242,9 @@ contract BaseTest is Test {
//////////////////////////////////////////////////////////////*/
function addFunctionsConsumer(address _consumer) public {
vm.prank(vm.envAddress("DEPLOYER_ADDRESS"));
functionsSubscriptions = FunctionsSubscriptions(
address(0xf9B8fc078197181C841c296C876945aaa425B278)
);
functionsSubscriptions = FunctionsSubscriptions(address(vm.envAddress("CLF_ROUTER_BASE")));
functionsSubscriptions.addConsumer(uint64(vm.envUint("CLF_SUBID_BASE")), _consumer);
vm.stopPrank();
}

function _fundLinkParentProxy(uint256 amount) internal {
Expand Down Expand Up @@ -476,6 +482,7 @@ contract BaseTest is Test {
proxyDeployer,
bytes("")
);
vm.stopPrank();
}

function _deployOrchestratorImplementation() internal {
Expand Down
2 changes: 2 additions & 0 deletions packages/hardhat/contracts/Interfaces/IParentPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,6 @@ interface IParentPool is IPool {
uint256 childPoolsBalance,
uint256 clpAmount
) external view returns (uint256);

function setPoolCap(uint256 _newCap) external payable;
}
23 changes: 12 additions & 11 deletions packages/hardhat/contracts/ParentPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
*/
pragma solidity 0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../foundry/lib/chainlink/contracts/foundry-lib/forge-std/src/console.sol";
import {AutomationCompatibleInterface} from "@chainlink/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol";
import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";
import {LinkTokenInterface} from "@chainlink/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol";
import {LPToken} from "./LPToken.sol";
import {IParentPool} from "./Interfaces/IParentPool.sol";
import {IInfraStorage} from "./Interfaces/IInfraStorage.sol";
import {ParentPoolStorage} from "contracts/Libraries/ParentPoolStorage.sol";
import {ICCIP} from "./Interfaces/ICCIP.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IInfraOrchestrator} from "./Interfaces/IInfraOrchestrator.sol";
import {ParentPoolCommon} from "./ParentPoolCommon.sol";
import {IInfraStorage} from "./Interfaces/IInfraStorage.sol";
import {IParentPoolCLFCLA, IParentPoolCLFCLAViewDelegate} from "./Interfaces/IParentPoolCLFCLA.sol";
import {AutomationCompatibleInterface} from "@chainlink/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol";
import {IParentPool} from "./Interfaces/IParentPool.sol";
import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";
import {LPToken} from "./LPToken.sol";
import {LibConcero} from "./Libraries/LibConcero.sol";
import {ICCIP} from "./Interfaces/ICCIP.sol";
import {LinkTokenInterface} from "@chainlink/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol";
import {ParentPoolCommon} from "./ParentPoolCommon.sol";
import {ParentPoolStorage} from "contracts/Libraries/ParentPoolStorage.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

////////////////////////////////////////////////////////
//////////////////////// ERRORS ////////////////////////
Expand Down

0 comments on commit 221555c

Please sign in to comment.