diff --git a/.env.example b/.env.example index 6559992..d9f00a6 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ -JSON_RPC_PROVIDER= -USDC_OWNER_ADDRESS= +FORK_RPC_PROVIDER=https://eth-mainnet.g.alchemy.com/v2/demo +USDC_OWNER_ADDRESS=0x7713974908Be4BEd47172370115e8b1219F4A5f0 diff --git a/.gitignore b/.gitignore index dbef00a..e48a943 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ node_modules ignition/deployments/chain-31337 .openzeppelin + +.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 55712c1..72446f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file +} diff --git a/contracts/SwapAdapter.sol b/contracts/SwapAdapter.sol index 75a8703..5468a90 100644 --- a/contracts/SwapAdapter.sol +++ b/contracts/SwapAdapter.sol @@ -226,7 +226,7 @@ contract SwapAdapter is AccessControl { IWETH(_weth).withdraw(IERC20(_weth).balanceOf(address(this))); vars.ERC20HandlerAddress = _bridge._resourceIDToHandlerAddress(vars.resourceID); - IERC20(token).approve(address(vars.ERC20HandlerAddress), amountOut); + IERC20(token).forceApprove(address(vars.ERC20HandlerAddress), amountOut); _bridge.deposit{value: vars.fee}(destinationDomainID, vars.resourceID, vars.depositData, ""); // Return unspent native currency to msg.sender @@ -398,7 +398,7 @@ contract SwapAdapter is AccessControl { IWETH(_weth).withdraw(IERC20(_weth).balanceOf(address(this))); vars.ERC20HandlerAddress = _bridge._resourceIDToHandlerAddress(vars.resourceID); - IERC20(token).approve(address(vars.ERC20HandlerAddress), amountOut); + IERC20(token).forceApprove(address(vars.ERC20HandlerAddress), amountOut); _bridge.deposit{value: vars.fee}(destinationDomainID, vars.resourceID, vars.depositData, ""); // Return unspent native currency to msg.sender diff --git a/contracts/interfaces/IPermit2.sol b/contracts/interfaces/IPermit2.sol index e2ae3eb..050abc7 100644 --- a/contracts/interfaces/IPermit2.sol +++ b/contracts/interfaces/IPermit2.sol @@ -12,4 +12,4 @@ interface IPermit2 { /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve /// @dev Setting amount to type(uint160).max sets an unlimited approval function approve(address token, address spender, uint160 amount, uint48 expiration) external; -} \ No newline at end of file +} diff --git a/contracts/interfaces/IUniversalRouter.sol b/contracts/interfaces/IUniversalRouter.sol index 9281199..a188c27 100644 --- a/contracts/interfaces/IUniversalRouter.sol +++ b/contracts/interfaces/IUniversalRouter.sol @@ -8,4 +8,4 @@ interface IUniversalRouter { /// @param inputs An array of byte strings containing abi encoded inputs for each command /// @param deadline The deadline by which the transaction must be executed function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable; -} \ No newline at end of file +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 3f012e6..4b82dee 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -41,4 +41,4 @@ export default [...compat.extends("eslint:recommended"), { quotes: ["error", "double"], semi: "off", }, -}]; \ No newline at end of file +}]; diff --git a/hardhat.config.ts b/hardhat.config.ts index 8836b3b..d925727 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -6,7 +6,7 @@ import dotenv from "dotenv"; dotenv.config(); const mainnetFork = { - url: `${process.env.JSON_RPC_PROVIDER}`, + url: `${process.env.FORK_RPC_PROVIDER}`, }; const config: HardhatUserConfig = {