ModeNetwork Swapper is a simple Node.js script for swapping ETH, WETH, USDT, or other ERC20 tokens on Mode Network. It uses the KimRouter Contract for easy exchanges. Using ModeNetwork Swapper helps you earn points for Mode Network's airdrop, giving you a chance to get extra rewards while you trade.
- Swap ETH for WETH and reverse.
- Swap ETH for USDT and reverse.
- Swap ETH for a custom ERC20 token specified by the user.
- Specify the swap pair, amount, custom ERC20 token address, and number of repetitions for the swaps.
- Node.js
- npm
- An Ethereum wallet with some ETH on the Mode network.
- A private key to that Ethereum wallet (strongly recommended to use a wallet with a small amount for testing purposes and never commit or disclose your private key).
Clone the repository and install the dependencies:
git clone git@github.com:bbbwizard/modenet-swapper.git
cd modenet-swapper
npm install
Create a .env file in the root of the project directory containing your personal Ethereum node RPC URL and Private Key:
RPC_URL='https://mainnet.mode.network' // rpc for the mode network
PRIVATE_KEY='<your_private_key>'
Run the script with the options to specify the swap pair, amount, and optionally a custom ERC20 token address and the number of repetitions for the swap.
node index.js --pair eth-weth --amount 0.01 --repeat 1
node index.js --pair eth-usdt --amount 0.01 --repeat 1
node index.js --pair eth-erc20 --token 'erc20_token_address' --amount 'amount' --repeat 1
Options:
-p, --pair <pair>
: Choose the swap pair, either eth-weth or eth-usdt or specify the custom ERC20 tokens with-token
.-a, --amount <amount>
: Specify the amount of ETH that you want to swap.-t, --token <token>
: (Optional) Specify the ERC20 token address you want to swap with ETH.-n, --repeat <repeat>
: (Optional) Specify the number of times to repeat the swap operation (default is 1).
Ensure never to expose your private key, especially in a public repository or front-end application.
Only perform transactions with amounts you are willing to risk, and always double-check smart contract addresses and ABI details before interacting with the contracts.
Explore the cutting-edge of crypto and Web3 at CrypJect – your hub for the newest projects and resources.