Steps to develop an omni chain fungible or non-fungible token (OFT or ONFT)
Write a token contract (ERC20 or ERC721).
Write a token gateway contract that implements the interface FT_Gateway or NFT_Gateway. This can be embedded into the token contract.
Select a crosschain messaging service.
Write an adaptor contract that implements the interface MessageProxy.
Deploy the adaptor, token and gateway on each chain.
Set the adaptor as trusted in the gateway contract on each chain.
Set messageSender and messageReceiver to the gateway contract in the adaptor on each chain.
Set each other adaptor as trusted foriegn message sender.
Complete deployment!
Deploy example OFT and adaptor for AnyCall V7.
npx hardhat run ./scripts/deployOFT.js --network fantomtest
npx hardhat run ./scripts/deployOFT.js --network goerli
Modify the addresses in configOFT.js and run
const anyCallConfig = {
"fantomtest" : "0x470BFEE42A801Abb9a1492482d609fB84713d60F" ,
"goerli" : "0x7EA2be2df7BA6E54B1A9C70676f668455E329d29"
}
// anycall adaptor addresses
const peers = {
"fantomtest" : "0x02594328E83682acDBbE06e0bf01C71c43E3f663" ,
"goerli" : "0x62866B0dc76B683Dd5675c5b1d1344d3f399ebbA"
}
npx hardhat run ./scripts/configOFT.js --network fantomtest
npx hardhat run ./scripts/configOFT.js --network goerli
Try making a crosschain transfer
npx hardhat run ./scripts/sendOFT.js --network fantomtest