- install dependencies
pnpm install
- rename
.env.example
→.env
- put the mnemonic of the test wallet of ethereum
- use
scripts/getBase58Pk.js
to generateSOLANA_PRIVATE_KEY
- rename
layerzero.config.dev.ts
tolayerzero.config.ts
- rename
hardhat.config.dev.ts
tohardhat.config.ts
- compile the contract
pnpm compile:hardhat
- Prepare Program ID
solana-keygen new -o target/deploy/endpoint-keypair.json --force
solana-keygen new -o target/deploy/oft-keypair.json --force
anchor keys sync
- change
program/src/oft/lib.rs
with new program id
endpoint: A9xGfr4F2J3NVsk9X7syKLNtKgpwaKW9xtPEmoxYb3i9
oft: EaWXNTXSauuEWUyzBATCCbLfscNAgxS4bfQHnTGKeFXY
- build Solana OFT program
anchor build
- don’t add -v for verified build as its too slow
- deploy Solana OFT program
solana program deploy --program-id target/deploy/oft-keypair.json target/deploy/oft.so -u devnet
- Create Solana OFT
pnpm hardhat lz:oft:solana:create --eid 40168 --program-id EaWXNTXSauuEWUyzBATCCbLfscNAgxS4bfQHnTGKeFXY --only-oft-store true --name WOO --symbol WOO
- open
./deployments/solana-testnet/OFT.json
, find OFTStore =DKrx8GxUMBwJ1dDDpiJkdBvx31T7fxM3sqzCf2FPsNg9
- change
layerzero.config.ts
withDKrx8GxUMBwJ1dDDpiJkdBvx31T7fxM3sqzCf2FPsNg9
- deploy the contract to Ethereum Sepolia
- first create a test WOO ERC20 token on Sepolia using https://coinfactory.app/, here is the contract: https://sepolia.etherscan.io/token/0xDd481A5FBa15E777fd73493E505C057fe16b0955#readContract
- set the contract address as
wooTokenOnSepolia
indeploy/WooTokenOFTAdapter.ts
npx hardhat lz:deploy
- tag use
WooTokenOFTAdapter
- https://sepolia.etherscan.io/token/0xd73E4a225f973EA0615EfeB2a23aAb33Ac5759F9#code
- initialize the OFT
npx hardhat lz:oapp:init:solana --oapp-config layerzero.config.ts --solana-secret-key <SOLANA_PRIVATE_KEY> --solana-program-id EaWXNTXSauuEWUyzBATCCbLfscNAgxS4bfQHnTGKeFXY
- wire the config
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts --solana-secret-key <SOLANA_PRIVATE_KEY> --solana-program-id EaWXNTXSauuEWUyzBATCCbLfscNAgxS4bfQHnTGKeFXY
-
Send from Sepolia to Solana devnet
npx hardhat --network sepolia send --dst-eid 40168 --amount 1000000000000000000 --to 3R1QAWUwPNRunitwENqieRv3SS1BTpPTvhemJEuCeSZA
- Sepolia: https://sepolia.etherscan.io/tx/0x30bf12fe3db14ba74f7e421fe3f1ec16145b665db26637f0e24fa4d1d3e5e627
- LayerZero: https://testnet.layerzeroscan.com/tx/0x30bf12fe3db14ba74f7e421fe3f1ec16145b665db26637f0e24fa4d1d3e5e627
- Solana: https://explorer.solana.com/tx/59XVQvoSYoQ7T6NrXLrSAErzYQ8e9nQj8DWeGyKrHLPvmi1di1iqBoQwZZ2TggVYt6LHms4U7EiyhgrGa63Gy5tu?cluster=devnet
-
Send from Solana devnet to Sepolia
- open
./deployments/solana-testnet/OFT.json
to find out the mint and escrow address npx hardhat lz:oft:solana:send --amount 1000000000 --from-eid 40168 --to 0xc031C368b51c28266396273b0C6ce2489b00969d --to-eid 40161 --mint HzY4dNBHd2mjwsDV7mT22uJ9Eag2tX26rCW3YvEdEPrg --program-id EaWXNTXSauuEWUyzBATCCbLfscNAgxS4bfQHnTGKeFXY --escrow B6yC6NLN2WpSU5fJnCXC6p32Uzz2u9h7RKnnochaVd9w
- Solana: https://explorer.solana.com/tx/5pF9FnzjiXzVQfNXBAwENBMgZVZkyWUQTmkfn4XuXvGDZhBWYm3SRMGQJCetoHWFE7DgvYhXfS1xfyrUVVZfWAfy?cluster=devnet
- LayerZero: https://testnet.layerzeroscan.com/tx/5pF9FnzjiXzVQfNXBAwENBMgZVZkyWUQTmkfn4XuXvGDZhBWYm3SRMGQJCetoHWFE7DgvYhXfS1xfyrUVVZfWAfy
- Sepolia: https://sepolia.etherscan.io/tx/0x1ffc9a118ef8fb9f769b8a066ea6f5e9081e5bc1743208df83bff63a5c72a109
- open
- you can find the error tx on Solana: https://solscan.io/tx/wqPf3tmMVd1SsqqEVN3sMChr7HZif96DgJTJxKLG4UvLBXhtrXHYB6j3XujQvALNk1xn1KKmfwoRnte9PtDXjne?cluster=devnet
- Lz endpoint receive tx: https://solscan.io/tx/4gnu9WCmZ2eN4F8ckrVMLGonM2hd1Hgnk5aWsiTd4Ntr8QJDnkcpsYfacrHmVFyGU2yLbj5wQoHutXrHftwwrd7E?cluster=devnet