Coder Social home page Coder Social logo

0xstory's Introduction

0xstory

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.

Flow chart

Contracts description

IPAssetRegistrarOApp.sol

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 of Sepolia chain (query from deployed contracts of LayerZero).
  • _mintData is the data of NFT that includes collection address, recipient address, and the URI of the NFT.
  • _options is the message execution options (e.g., gas to use on destination). The most newly Registered IP will be query from IPAssetRegistrarOApp contract on Sepolia chain by function newlyRegisteredIp()

SimpleIpNft.sol

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.

Development

Deployment

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:

  1. Install dependencies
npm install
  1. Deploy contracts on BSC Testnet chain
npx hardhat deploy --network bsctestnet
  1. Deploy contracts on Sepolia chain
npx hardhat deploy --network sepolia
  1. Set Peer for deployed IPAssetRegistrarOApp contracts on both chains. You can use the content of ./scripts/setup.js to do this or use UI on bscscan and etherscan after verifying contracts.

Contracts addresses

┌──────────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┐
│       Contract       │                 BSC Testnet                │                   Sepolia                  │
├──────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┤
│ IPAssetRegistrarOApp │ 0xAE5E080fB3b880a047c4347F6f51bCa84F4f6a3b │ 0x7316e5511784EA3A2735c0Fe8a99324231E49030 │
├──────────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┤
│ SimpleIpNft          │ 0xa5eE5654b582857F26BeaaD82f1E69eC5591Bd86 │ 0x8381dE6C4DCa920381fe7626B6c823810B7e1B99 │
└──────────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┘

Test

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

0xstory's People

Contributors

hoanm avatar eledra89 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.