diff --git a/.gitmodules b/.gitmodules index 9337666..0f07815 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "lib/solady"] path = lib/solady url = https://github.com/vectorized/solady -[submodule "lib/openzeppelin-contracts"] - path = lib/openzeppelin-contracts - url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts deleted file mode 160000 index e4f7021..0000000 --- a/lib/openzeppelin-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e4f70216d759d8e6a64144a9e1f7bbeed78e7079 diff --git a/src/across/AcrossV3Helper.sol b/src/across/AcrossV3Helper.sol index 41c6f0b..7891b18 100644 --- a/src/across/AcrossV3Helper.sol +++ b/src/across/AcrossV3Helper.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0; /// library imports import "forge-std/Test.sol"; import {IAcrossSpokePoolV3} from "./interfaces/IAcrossSpokePoolV3.sol"; -import {IERC20} from "./interfaces/IERC20.sol"; +import {IERC20} from "../interfaces/IERC20.sol"; /// @title AcrossV3 Helper /// @notice helps simulate AcrossV3 message relaying diff --git a/src/across/interfaces/IERC20.sol b/src/across/interfaces/IERC20.sol deleted file mode 100644 index 7d10195..0000000 --- a/src/across/interfaces/IERC20.sol +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) - -pragma solidity ^0.8.20; - -/** - * @dev Interface of the ERC-20 standard as defined in the ERC. - */ -interface IERC20 { - /** - * @dev Emitted when `value` tokens are moved from one account (`from`) to - * another (`to`). - * - * Note that `value` may be zero. - */ - event Transfer(address indexed from, address indexed to, uint256 value); - - /** - * @dev Emitted when the allowance of a `spender` for an `owner` is set by - * a call to {approve}. `value` is the new allowance. - */ - event Approval(address indexed owner, address indexed spender, uint256 value); - - /** - * @dev Returns the value of tokens in existence. - */ - function totalSupply() external view returns (uint256); - - /** - * @dev Returns the value of tokens owned by `account`. - */ - function balanceOf(address account) external view returns (uint256); - - /** - * @dev Moves a `value` amount of tokens from the caller's account to `to`. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transfer(address to, uint256 value) external returns (bool); - - /** - * @dev Returns the remaining number of tokens that `spender` will be - * allowed to spend on behalf of `owner` through {transferFrom}. This is - * zero by default. - * - * This value changes when {approve} or {transferFrom} are called. - */ - function allowance(address owner, address spender) external view returns (uint256); - - /** - * @dev Sets a `value` amount of tokens as the allowance of `spender` over the - * caller's tokens. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * IMPORTANT: Beware that changing an allowance with this method brings the risk - * that someone may use both the old and the new allowance by unfortunate - * transaction ordering. One possible solution to mitigate this race - * condition is to first reduce the spender's allowance to 0 and set the - * desired value afterwards: - * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - * - * Emits an {Approval} event. - */ - function approve(address spender, uint256 value) external returns (bool); - - /** - * @dev Moves a `value` amount of tokens from `from` to `to` using the - * allowance mechanism. `value` is then deducted from the caller's - * allowance. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transferFrom(address from, address to, uint256 value) external returns (bool); -} diff --git a/src/debridge/DebridgeDlnHelper.sol b/src/debridge/DebridgeDlnHelper.sol index dc6259b..1a0583e 100644 --- a/src/debridge/DebridgeDlnHelper.sol +++ b/src/debridge/DebridgeDlnHelper.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0; /// library imports import "forge-std/Test.sol"; import {IExternalCallExecutor} from "./interfaces/IExternalCallExecutor.sol"; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {IERC20} from "../interfaces/IERC20.sol"; import {IDlnDestination, Order} from "./interfaces/IDlnDestination.sol"; /// @title Debridge DLN Helper diff --git a/src/interfaces/IERC20.sol b/src/interfaces/IERC20.sol new file mode 100644 index 0000000..408c918 --- /dev/null +++ b/src/interfaces/IERC20.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) + +pragma solidity >=0.8.0; + +/// @dev Interface of the ERC-20 standard. Vendored from OpenZeppelin contracts to keep pigeon self-contained. +interface IERC20 { + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); + + function totalSupply() external view returns (uint256); + + function balanceOf(address account) external view returns (uint256); + + function transfer(address to, uint256 value) external returns (bool); + + function allowance(address owner, address spender) external view returns (uint256); + + function approve(address spender, uint256 value) external returns (bool); + + function transferFrom(address from, address to, uint256 value) external returns (bool); +} diff --git a/test/Across.t.sol b/test/Across.t.sol index 10a9001..d520172 100644 --- a/test/Across.t.sol +++ b/test/Across.t.sol @@ -8,7 +8,7 @@ import {console2} from "forge-std/console2.sol"; import {AcrossV3Helper} from "src/across/AcrossV3Helper.sol"; import {IAcrossSpokePoolV3} from "src/across/interfaces/IAcrossSpokePoolV3.sol"; import {IAcrossV3Interpreter} from "src/across/interfaces/IAcrossV3Interpreter.sol"; -import {IERC20} from "src/across/interfaces/IERC20.sol"; +import {IERC20} from "src/interfaces/IERC20.sol"; import {console} from "forge-std/console.sol"; contract Target { diff --git a/test/Debridge.t.sol b/test/Debridge.t.sol index 6b3d3b1..5059a85 100644 --- a/test/Debridge.t.sol +++ b/test/Debridge.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import {IERC20} from "src/across/interfaces/IERC20.sol"; +import {IERC20} from "src/interfaces/IERC20.sol"; import "forge-std/Test.sol"; import {DebridgeHelper} from "src/debridge/DebridgeHelper.sol"; diff --git a/test/DebridgeDln.t.sol b/test/DebridgeDln.t.sol index 25dd721..f78c8e6 100644 --- a/test/DebridgeDln.t.sol +++ b/test/DebridgeDln.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; +import {IERC20} from "src/interfaces/IERC20.sol"; import "forge-std/Test.sol"; import {DebridgeDlnHelper} from "../src/debridge/DebridgeDlnHelper.sol"; diff --git a/test/Stargate.t.sol b/test/Stargate.t.sol index c48ab97..7f46d48 100644 --- a/test/Stargate.t.sol +++ b/test/Stargate.t.sol @@ -4,6 +4,7 @@ pragma solidity >=0.8.0; import "forge-std/Test.sol"; import {LayerZeroHelper} from "src/layerzero/LayerZeroHelper.sol"; +import {IERC20} from "src/interfaces/IERC20.sol"; interface IStargateRouter { struct lzTxObj { @@ -25,14 +26,6 @@ interface IStargateRouter { ) external payable; } -interface IERC20 { - function approve(address spender, uint256 amount) external returns (bool); - - function balanceOf(address account) external view returns (uint256); - - function transfer(address to, uint256 amount) external returns (bool); -} - contract Target { uint256 public value;