This project provides a simple example demonstrating how to send OFT (Omnichain Fungible Tokens) across different blockchain networks using scripts. You can use it to send tokens across chains or send back the OFT tokens to the origin chain. It supports transferring tokens between the mainnet and the Base network.
Before getting started, ensure you have the following tools installed:
- Node.js (recommended v16 or higher)
- Yarn (a JavaScript package manager)
You can check if these are installed by running the following commands:
node -v
yarn -v
If they're not installed, you can install them from Node.js official website and Yarn official website.
Follow these steps to set up the project on your local machine:
-
Clone the Repository
Run the following command to clone this repository to your local machine:
git clone [email protected]:ora-io/oft-bridge-script.git cd oft-bridge-script
-
Install Dependencies
Install the required dependencies using
Yarn
:yarn install
-
Copy the Environment Variables File
In the root directory of the project, you'll find a
.env.example
file. Copy it and rename it to.env
:cp .env.example .env
-
Fill in the Environment Variables
Open the
.env
file and fill in the following required fields:- {XXX}_RPC_URL: The RPC URL of the network you want to use.
- SENDER_ACCOUNT_PRIV_KEY: The private key of the sender account (used to sign the transaction).
- RECEIVER_ACCOUNT_ADDRESS: The address of the receiving account.
- SEND_AMOUNT: The amount of tokens to send. (if you want to send 1 ora coin, put 1 in here).
Example:
# Test bridge token SENDER_ACCOUNT_PRIV_KEY=your_wallet_private_key RECEIVER_ACCOUNT_ADDRESS=receiver_wallet_address # Token amount to send SEND_AMOUNT=1
Once you've configured the environment variables, you can run the following commands to send OFT tokens across chains:
-
To Arbitrum:
yarn run ora-eth-to-arbitrum
-
To Base:
yarn run ora-eth-to-base
-
To Binance:
yarn run ora-eth-to-binance
-
To Ethereum:
yarn run ora-base-to-eth
-
To Binance:
yarn run ora-base-to-binance
-
To Arbitrum:
yarn run ora-base-to-arbitrum
-
To Base:
yarn run ora-arbitrum-to-base
-
To Binance:
yarn run ora-arbitrum-to-binance
-
To Ethereum:
yarn run ora-arbitrum-to-eth
-
To Base:
yarn run ora-binance-to-base
-
To Arbitrum:
yarn run ora-binance-to-arbitrum
-
To Ethereum:
yarn run ora-binance-to-eth
This command will send the tokens back from the Base network to the mainnet.
- Make sure that the private keys and addresses you are using are correct and secure.
- Double-check the token amounts before sending to avoid sending incorrect values.
- This script is intended for development and testing purposes. Please ensure proper validation and auditing before using it in a production environment.
Your wallet private key can typically be exported from the wallet you are using (e.g., MetaMask or other wallets). Make sure to keep the private key secure and do not expose it to anyone.
You can view your wallet address in your crypto wallet. Wallet addresses usually begin with 0x
followed by a string of characters.
Currently, this project supports the mainnet and the Base network. Additional blockchain networks may be supported in the future.
We welcome contributions! If you have any ideas, improvements, or bug fixes, feel free to submit a pull request. Before submitting, please ensure that all tests are run and the code is thoroughly validated.
This project is licensed under the MIT License, which allows you to freely use, modify, and distribute the code.
If you encounter any issues or have questions, please feel free to open an issue or reach out. We hope this tool helps you in your cross-chain token transfer needs!