Cross chain protocol IP management protocol, ft Story Protocol and Layer Zero. This is a demo for minting and registering an IP NFT with Story protocol on remote chain using Layer Zero.
The main contract that is deployed on both chains. User can mint and register IP NFTs on Sepolia
chain by running this function from BSC Testnet
chain:
function send(
uint32 _dstEid,
MintData calldata _mintData,
bytes calldata _options
) external payable {}
_dstEid
is the endpoint ID ofSepolia
chain (query from deployed contracts of LayerZero)._mintData
is the data of NFT that includescollection address
,recipient address
, and theURI
of the NFT._options
is the message execution options (e.g., gas to use on destination). Themost newly Registered IP
will be query fromIPAssetRegistrarOApp
contract onSepolia
chain by function newlyRegisteredIp()
A simple NFT contract that is deployed on Sepolia
chain. This contract must be deployed before minting and registering IP NFTs. The owner of this contract must be the IPAssetRegistrarOApp
contract on Sepolia
chain.
Before deploying the contracts, you need to create a .secret
file in the root directory of the project and add the private key
of the account that will deploy the contracts. We also use Node.js version v18.16.0
, npm version 9.5.1
and hardhat version 2.22.3
for developing and deploying the contracts.
To deploy the contracts on BSC Testnet
and Sepolia
chain, you can use the following commands:
- Install dependencies
npm install
- Deploy contracts on
BSC Testnet
chain
npx hardhat deploy --network bsctestnet
- Deploy contracts on
Sepolia
chain
npx hardhat deploy --network sepolia
- Set Peer for deployed
IPAssetRegistrarOApp
contracts on both chains. You can use the content of./scripts/setup.js
to do this or use UI onbscscan
andetherscan
after verifying contracts.
┌──────────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┐
│ Contract │ BSC Testnet │ Sepolia │
├──────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┤
│ IPAssetRegistrarOApp │ 0xAE5E080fB3b880a047c4347F6f51bCa84F4f6a3b │ 0x7316e5511784EA3A2735c0Fe8a99324231E49030 │
├──────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┤
│ SimpleIpNft │ 0xa5eE5654b582857F26BeaaD82f1E69eC5591Bd86 │ 0x8381dE6C4DCa920381fe7626B6c823810B7e1B99 │
└──────────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┘
To do the test, you need change the address of all contracts in ./test_scripts/send_mess.js
and run the following command:
node ./test_scripts/send_mess.js