πŸ”—Retrieve Calls

This page demonstrates how the NFTDelegation.com smart contract can be integrated to make external calls.

Steps:

  1. Import Interfaces within your smart contract

import "./INFTDelegationRead.sol";
  1. Declare the Read Interface variable as below:

INFTDelegationRead public dmcRead;
  1. Modify your constructor as below. When deploying the smart contract input the NFTDelegation smart contract address 0x2202CB9c00487e7e8EF21e6d8E914B32e709f43d within your constructor.

constructor(address _NFTdelegationManagementContract) {
    dmcRead = INFTDelegationRead(_NFTdelegationManagementContract);
}
  1. Add function calls

The retrieveDelegators() function returns an array of Delegators for the function caller address (msg.sender) based on 'Any Collection' and 'All Use Cases'.

function retrieveDelegators() public view returns(address[] memory) {
    return dmcRead.retrieveDelegators(msg.sender, 0x8888888888888888888888888888888888888888, 1);
}

The checkMintingStatus(_vault) function checks the minting eligibility status for the function caller (msg.sender) by providing a Delegator's address as an input. This function is based on 'Any Collection' and 'Minting Use Case #2' and returns a bool status (true/false).

function checkMintingStatus(address _vault) public view returns(bool) {
    return dmcRead.retrieveGlobalStatusOfDelegation(_vault, 0x8888888888888888888888888888888888888888, msg.sender, 2);
}

The retrieveTokenStatus(_vault, _tokenid) function checks if a delegation was registered from the a Delegator to the function caller (msg.sender) for an individual token id on a specific usecase on a specific collection and returns a bool status (true/false).

Please note that you can customize the demo functions for the collection or usecase that you are interested in.

Full Source Code

Last updated