-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ETH-based Swap and Cross-Chain Functionality #39
Add ETH-based Swap and Cross-Chain Functionality #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to pass the WETH address as constructor parameters. Better option will be to use the Deployer
pattern where you deploy the contract using FerrumDeployer
and pass the parameters through the initData
(IFerrumDeployer(msg.sender).initData()
).
To see how to use the Ferrum Deployer follow this pattern:
Check this contract for example
Line 10, import the deployer
Line 27, get the init params
Line 28, decode the init params. For example, you can pass pool
, oneInchRouter
and WETH
as init params. Obviously these params must be abi encoded and passed to the deployer.
-
Create a dummy file this and re-instatiate the FerrumDeployer. This is so that hardhat pulls the code for the contract.
-
Update the deploy script:
Follow this example in the deploy script.
Line 11 encodes the init parameters and line 12 deploys the contract.
To import the deployUsingDeployer
function you can reference the foundry-contracts
package:
import { deployUsingDeployer, Salt, ZeroAddress } from "foundry-contracts/dist/test/common/Utils";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description of Changes
This pull request introduces the
swapAndCrossOneInchETH
function to our smart contract suite. This addition enables users to perform ETH-based swaps and initiate cross-chain transactions seamlessly. The function is designed to accept Ethereum as input and interact with the 1inch protocol for efficient swapping and cross-chain operations.Key Features
Technical Details
external
andpayable
to handle incoming ETH transactions.IWETH
interface for WETH interactions.require
statements for clear and informative error handling.This function enriches our contract's capabilities, making it more versatile in handling various types of token swaps and cross-chain interactions. The addition follows our commitment to enhancing user experience and expanding the functionality of our DeFi solutions.