Create Smart Contract

The library provides the necessary interface needed to interact with the protocol.

The example code below shows how to create a royalty manager that creates automated compactable Nft royalty sale smart contracts.

pragma solidity ^0.8.7;

import INftRoyaltyFactoryV2 "@picardy-protocol/interface/INftRoyaltyFactoryV2.sol";

///Do not use this code snippet for production as it is just an example 
///and may use hardcoded values.

contract RoyaltyManager {
    
    INftRoyaltyFactoryV2 i_nftRoyaltyFactory;
    
   struct Details {
        uint maxSupply; 
        uint maxMintAmount; 
        uint cost; 
        uint percentage;
        string name;
        string symbol; 
        string initBaseURI;
        string creatorName;
        address creator;
    }  
    
    constructor (address _nftRoyaltyFactory){
        i_nftRoyaltyFactory = INftRoyaltyFactoryV2(_nftROyaltyFactory);
        // You can now use all the functions available in the nftRoyaltyFactory
        // like createNftRoyalty()
    }
    
    function createNftRoyalty(Details calldata _details)external {
        // this function creates the royalty sale contract.
    }
}

Go to Builders Den page to learn more about the interface and all its available methods.

Last updated