Skip to content
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
5 changes: 2 additions & 3 deletions test/integration/Across.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {LibBytes} from "../utils/LibBytes.sol";
import {ISpokePool} from "src/core/Across.sol";
Expand Down Expand Up @@ -82,7 +81,7 @@ contract AcrossTest is BridgeSettlerIntegrationTest {
deal(address(this), amount);
(bool success,) = address(WETH).call{value: amount}(abi.encodeWithSignature("deposit()"));
assertTrue(success, "Deposit failed");
WETH.approve(address(ALLOWANCE_HOLDER), amount);
WETH.approve(address(allowanceHolder), amount);

bytes[] memory bridgeActions = ActionDataBuilder.build(
_getDefaultTransferFrom(address(WETH), amount),
Expand All @@ -93,7 +92,7 @@ contract AcrossTest is BridgeSettlerIntegrationTest {

uint256 balanceBefore = WETH.balanceOf(spokePool);
vm.expectCall(spokePool, acrossCall(2000, 2000));
ALLOWANCE_HOLDER.exec(
allowanceHolder.exec(
address(bridgeSettler),
address(WETH),
amount,
Expand Down
3 changes: 1 addition & 2 deletions test/integration/BebopPairTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {ActionDataBuilder} from "../utils/ActionDataBuilder.sol";
import {Settler} from "src/Settler.sol";
import {ISettlerActions} from "src/ISettlerActions.sol";
import {IBebopSettlement} from "src/core/Bebop.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";

import {SettlerBasePairTest} from "./SettlerBasePairTest.t.sol";

Expand Down Expand Up @@ -368,7 +367,7 @@ abstract contract BebopPairTest is SettlerBasePairTest {
Settler _settler = settler;
IERC20 _fromToken = fromToken();

bytes[] memory actions = _buildRestrictedTargetActions(address(ALLOWANCE_HOLDER));
bytes[] memory actions = _buildRestrictedTargetActions(address(allowanceHolder));

ISettlerBase.AllowedSlippage memory allowedSlippage = ISettlerBase.AllowedSlippage({
recipient: payable(address(0)), buyToken: IERC20(address(0)), minAmountOut: 0
Expand Down
13 changes: 6 additions & 7 deletions test/integration/CCIP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {Vm} from "@forge-std/Vm.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {InvalidFeeToken, InvalidTokenAmountsLength} from "src/core/SettlerErrors.sol";
import {LibBytes} from "../utils/LibBytes.sol";
Expand Down Expand Up @@ -40,7 +39,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {

deal(address(USDC), address(this), 2000e6);
deal(address(this), 10 ether);
USDC.approve(address(ALLOWANCE_HOLDER), 2000e6);
USDC.approve(address(allowanceHolder), 2000e6);
}

function getOnRamp(uint64 destinationChainSelector) internal view returns (address onRamp) {
Expand Down Expand Up @@ -97,7 +96,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {

// Execute and verify
vm.expectCall(CCIP_ROUTER, fee, abi.encodeCall(IRouterClient.ccipSend, (ARBITRUM_SELECTOR, message)));
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(USDC),
amount,
Expand Down Expand Up @@ -143,7 +142,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {

// Execute
vm.expectCall(CCIP_ROUTER, fee, abi.encodeCall(IRouterClient.ccipSend, (BASE_SELECTOR, message)));
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(USDC),
amount,
Expand Down Expand Up @@ -199,7 +198,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {
// Execute
vm.expectCall(CCIP_ROUTER, fee, abi.encodeCall(IRouterClient.ccipSend, (ARBITRUM_SELECTOR, message)));
vm.recordLogs();
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(USDC),
amount,
Expand Down Expand Up @@ -256,7 +255,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {

// Should revert because feeToken is not address(0)
vm.expectRevert(InvalidFeeToken.selector);
ALLOWANCE_HOLDER.exec(
allowanceHolder.exec(
address(bridgeSettler),
address(USDC),
amount,
Expand Down Expand Up @@ -296,7 +295,7 @@ contract CCIPTest is BridgeSettlerIntegrationTest {

// Should revert because tokenAmounts length is not 1
vm.expectRevert(InvalidTokenAmountsLength.selector);
ALLOWANCE_HOLDER.exec(
allowanceHolder.exec(
address(bridgeSettler),
address(USDC),
amount,
Expand Down
5 changes: 2 additions & 3 deletions test/integration/DeBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {DeBridge, DLN_SOURCE, IDlnSource} from "src/core/DeBridge.sol";
import {ActionDataBuilder} from "../utils/ActionDataBuilder.sol";
Expand Down Expand Up @@ -72,7 +71,7 @@ contract DeBridgeTest is BridgeSettlerIntegrationTest {

deal(address(this), globalFee);
deal(address(USDC), address(this), amount);
USDC.approve(address(ALLOWANCE_HOLDER), amount);
USDC.approve(address(allowanceHolder), amount);

bytes[] memory bridgeActions = ActionDataBuilder.build(
_getDefaultTransferFrom(address(USDC), amount),
Expand All @@ -84,7 +83,7 @@ contract DeBridgeTest is BridgeSettlerIntegrationTest {
uint256 usdcBalanceBefore = USDC.balanceOf(address(DLN_SOURCE));
uint256 ethBalanceBefore = address(DLN_SOURCE).balance;
vm.expectCall(address(DLN_SOURCE), globalFee, deBridgecall(address(USDC), amount));
ALLOWANCE_HOLDER.exec{value: globalFee}(
allowanceHolder.exec{value: globalFee}(
address(bridgeSettler),
address(USDC),
amount,
Expand Down
17 changes: 3 additions & 14 deletions test/integration/DodoV2PairTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {ISettlerBase} from "src/interfaces/ISettlerBase.sol";
import {BasePairTest} from "./BasePairTest.t.sol";
import {SettlerBasePairTest} from "./SettlerBasePairTest.t.sol";
import {ISettlerActions} from "src/ISettlerActions.sol";
import {ActionDataBuilder} from "../utils/ActionDataBuilder.sol";
import {MainnetSettler as Settler} from "src/chains/Mainnet/TakerSubmitted.sol";
import {Shim} from "./SettlerBasePairTest.t.sol";
import {Settler} from "src/Settler.sol";

import {IAllowanceHolder} from "src/allowanceholder/IAllowanceHolder.sol";

contract DodoV2PairTest is BasePairTest {
contract DodoV2PairTest is SettlerBasePairTest {
function _testName() internal pure override returns (string memory) {
return "USDT-DAI";
}

Settler internal settler;
IAllowanceHolder internal allowanceHolder;
uint256 private _amount;

function setUp() public override {
Expand All @@ -38,14 +35,6 @@ contract DodoV2PairTest is BasePairTest {
safeApproveIfBelow(fromToken(), FROM, address(PERMIT2), amount());
warmPermit2Nonce(FROM);

allowanceHolder = IAllowanceHolder(0x0000000000001fF3684f28c67538d4D072C22734);

uint256 forkChainId = (new Shim()).chainId();
vm.chainId(31337);
settler = new Settler(bytes20(0));
vm.etch(address(allowanceHolder), vm.getDeployedCode("AllowanceHolder.sol:AllowanceHolder"));
vm.chainId(forkChainId);

// USDT is obnoxious about throwing errors, so let's check here before
// we run into something inscrutable. Do this here to avoid incorrectly
// warming storage.
Expand Down
5 changes: 2 additions & 3 deletions test/integration/LayerZeroOFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {PlasmaBridgeSettler} from "src/chains/Plasma/BridgeSettler.sol";
import {SafeTransferLib} from "src/vendor/SafeTransferLib.sol";
Expand All @@ -25,7 +24,7 @@ contract LayerZeroOFTEthereumTest is BridgeSettlerIntegrationTest {
function testBridgeERC20() public {
uint256 amount = 10000000;
deal(address(USDT), address(this), amount, true);
USDT.safeApprove(address(ALLOWANCE_HOLDER), amount);
USDT.safeApprove(address(allowanceHolder), amount);

IOFT.SendParam memory sendParam = IOFT.SendParam({
dstEid: uint32(30110), // ARBITRUM
Expand Down Expand Up @@ -56,7 +55,7 @@ contract LayerZeroOFTEthereumTest is BridgeSettlerIntegrationTest {
deal(address(this), fee);
uint256 balanceBefore = USDT.balanceOf(oft);
vm.expectCall(oft, fee, abi.encodeCall(IOFT.send, (sendParam, messagingFee, address(this))));
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(USDT),
amount,
Expand Down
5 changes: 2 additions & 3 deletions test/integration/Mayan.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {ArbitrumBridgeSettler} from "src/chains/Arbitrum/BridgeSettler.sol";
import {IMayanForwarder} from "src/core/Mayan.sol";
Expand Down Expand Up @@ -64,7 +63,7 @@ contract MayanTest is BridgeSettlerIntegrationTest {
bytes32 someExtraBytes = keccak256("someExtraBytesForERC20Transfer");

deal(address(token), address(this), amount);
token.approve(address(ALLOWANCE_HOLDER), amount);
token.approve(address(allowanceHolder), amount);

bytes[] memory bridgeActions = ActionDataBuilder.build(
_getDefaultTransferFrom(address(token), amount),
Expand All @@ -86,7 +85,7 @@ contract MayanTest is BridgeSettlerIntegrationTest {
address(mayanProtocol),
abi.encodeCall(MayanProtocolDummy.mayanERC20Receiver, (address(token), amount, someExtraBytes))
);
ALLOWANCE_HOLDER.exec(
allowanceHolder.exec(
address(bridgeSettler),
address(token),
amount,
Expand Down
13 changes: 6 additions & 7 deletions test/integration/NucleusTeller.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {Vm} from "@forge-std/Vm.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {INucleusTeller} from "src/core/NucleusTeller.sol";
import {SafeTransferLib} from "src/vendor/SafeTransferLib.sol";
Expand Down Expand Up @@ -76,7 +75,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {
uint256 shareAmount = 1e18;

deal(address(WPAXG), address(this), shareAmount, true);
WPAXG.safeApprove(address(ALLOWANCE_HOLDER), shareAmount);
WPAXG.safeApprove(address(allowanceHolder), shareAmount);

INucleusTeller.BridgeData memory data = _bridgeData();
uint256 fee = INucleusTeller(TELLER).previewFee(shareAmount, data);
Expand All @@ -94,7 +93,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {

vm.expectCall(TELLER, fee, abi.encodeCall(INucleusTeller.bridge, (shareAmount, data)));
vm.recordLogs();
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(WPAXG),
shareAmount,
Expand All @@ -112,7 +111,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {
uint256 shareAmount = 1e18;

deal(address(WPAXG), address(this), shareAmount, true);
WPAXG.safeApprove(address(ALLOWANCE_HOLDER), shareAmount);
WPAXG.safeApprove(address(allowanceHolder), shareAmount);

INucleusTeller.BridgeData memory data = _bridgeData();
uint256 fee = INucleusTeller(TELLER).previewFee(shareAmount, data);
Expand All @@ -128,7 +127,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {
uint256 supplyBefore = WPAXG.totalSupply();

vm.recordLogs();
ALLOWANCE_HOLDER.exec{value: fee + excess}(
allowanceHolder.exec{value: fee + excess}(
address(bridgeSettler),
address(WPAXG),
shareAmount,
Expand All @@ -146,7 +145,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {
uint256 depositAmount = 1e18;

deal(address(PAXG), address(this), depositAmount, true);
PAXG.safeApprove(address(ALLOWANCE_HOLDER), depositAmount);
PAXG.safeApprove(address(allowanceHolder), depositAmount);

INucleusTeller.BridgeData memory data = _bridgeData();
// PAXG → WPAXG is a 1:1 wrap, so the resulting share count equals the deposit amount.
Expand All @@ -169,7 +168,7 @@ contract NucleusTellerMainnetTest is BridgeSettlerIntegrationTest {
TELLER, fee, abi.encodeCall(INucleusTeller.depositAndBridge, (PAXG, depositAmount, expectedShares, data))
);
vm.recordLogs();
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(PAXG),
depositAmount,
Expand Down
9 changes: 5 additions & 4 deletions test/integration/SettlerBasePairTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {LibBytes} from "../utils/LibBytes.sol";
import {SafeTransferLib} from "src/vendor/SafeTransferLib.sol";

import {IAllowanceHolder} from "src/allowanceholder/IAllowanceHolder.sol";
import {MainnetSettler as Settler} from "src/chains/Mainnet/TakerSubmitted.sol";
import {IAllowanceHolder, ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {MainnetSettler} from "src/chains/Mainnet/TakerSubmitted.sol";
import {Settler} from "src/Settler.sol";

contract Shim {
Comment thread
e1Ru1o marked this conversation as resolved.
Outdated
// forgefmt: disable-next-line
Expand All @@ -37,7 +38,7 @@ abstract contract SettlerBasePairTest is BasePairTest {
IZeroEx internal ZERO_EX = IZeroEx(0xDef1C0ded9bec7F1a1670819833240f027b25EfF);

function settlerInitCode() internal virtual returns (bytes memory) {
return bytes.concat(type(Settler).creationCode, abi.encode(bytes20(0)));
return bytes.concat(type(MainnetSettler).creationCode, abi.encode(bytes20(0)));
}

function _deploySettler() private returns (Settler r) {
Expand All @@ -50,7 +51,7 @@ abstract contract SettlerBasePairTest is BasePairTest {

function setUp() public virtual override {
super.setUp();
allowanceHolder = IAllowanceHolder(0x0000000000001fF3684f28c67538d4D072C22734);
allowanceHolder = ALLOWANCE_HOLDER;

uint256 forkChainId = (new Shim()).chainId();
vm.chainId(31337);
Expand Down
5 changes: 2 additions & 3 deletions test/integration/StargateV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.25;
import {IERC20} from "@forge-std/interfaces/IERC20.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {BridgeSettlerIntegrationTest} from "./BridgeSettler.t.sol";
import {ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {IBridgeSettlerActions} from "src/bridge/IBridgeSettlerActions.sol";
import {ArbitrumBridgeSettler} from "src/chains/Arbitrum/BridgeSettler.sol";
import {IStargateV2, IOFT, ETH} from "src/core/StargateV2.sol";
Expand Down Expand Up @@ -81,7 +80,7 @@ contract StargateV2Test is BridgeSettlerIntegrationTest {
uint256 amount = 10000;

deal(address(token), address(this), amount);
token.approve(address(ALLOWANCE_HOLDER), amount);
token.approve(address(allowanceHolder), amount);

(IOFT.SendParam memory sendParam, IOFT.MessagingFee memory messagingFee, uint256 fee) =
_prepareSendToken(amount);
Expand All @@ -99,7 +98,7 @@ contract StargateV2Test is BridgeSettlerIntegrationTest {
deal(address(this), fee);
uint256 balanceBefore = token.balanceOf(pool);
vm.expectCall(pool, fee, abi.encodeCall(IStargateV2.sendToken, (sendParam, messagingFee, address(this))));
ALLOWANCE_HOLDER.exec{value: fee}(
allowanceHolder.exec{value: fee}(
address(bridgeSettler),
address(token),
amount,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/UniV3CallbackPoC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.25;

import {AllowanceHolder} from "src/allowanceholder/AllowanceHolderOld.sol";
import {IAllowanceHolder} from "src/allowanceholder/IAllowanceHolder.sol";
import {IAllowanceHolder, ALLOWANCE_HOLDER} from "src/allowanceholder/IAllowanceHolder.sol";
import {MainnetSettler as Settler} from "src/chains/Mainnet/TakerSubmitted.sol";
import {ISettlerActions} from "src/ISettlerActions.sol";
import {IUniswapV3Pool} from "src/core/UniswapV3Fork.sol";
Expand Down Expand Up @@ -92,7 +92,7 @@ contract UniV3CallbackPoC is Utils, Permit2Signature, MainnetDefaultFork {
permit2Domain = permit2.DOMAIN_SEPARATOR();

// Deploy AllowanceHolder
ah = IAllowanceHolder(0x0000000000001fF3684f28c67538d4D072C22734);
ah = ALLOWANCE_HOLDER;
{
uint256 forkChainId = (new Shim()).chainId();
vm.chainId(31337);
Expand Down
Loading
Loading