NFTDelegation.com
  • 👋Welcome to NFTDelegation
  • Overview
    • ✨Features
    • 💡Use Cases
  • Guides
    • â„šī¸How to Register
      • 📃How to Register a Delegation?
      • 👩‍đŸ’ŧHow to Register a Delegation Manager?
      • 🤝How to Register a Consolidation?
      • 📄How to Register a Delegation/ Consolidation/Delegation Manager (Advanced)?
      • 🔐How to Delegate using SAFE (formerly GNOSIS) using the Transaction Builder?
    • â„šī¸How to View
      • 📃How to View Your Delegations?
      • 👩‍đŸ’ŧHow to View Your Delegation Managers (Sub-Delegations)?
      • 🤝How to View Your Consolidations?
    • â„šī¸How to Manage
      • 📃How to Update a Delegation/Delegation Manager/Consolidation?
      • 👩‍đŸ’ŧHow to Revoke a Delegation/Delegation Manager/Consolidation?
    • â„šī¸How to Manage using Delegation Management (Sub-Delegation) Rights
      • 📃How to Register a Delegation Using Delegation Management (Sub-Delegation) Rights?
      • 👩‍đŸ’ŧHow to Revoke a Delegation Using Delegation Management (Sub-Delegation) Rights?
    • â„šī¸How to Lock
      • 🔒How to Globally Lock Your Wallet ?
      • 🔒How to Lock Your Wallet for a Specific Collection?
      • 🔒How to Lock Your Wallet for a Specific Use Case on a Collection?
    • â„šī¸How to Unlock
      • 🔓How to Globally Unlock Your Wallet ?
      • 🔓How to Unlock Your Wallet for a Specific Collection?
      • 🔓How to Unlock Your Wallet for a Specific Use Case?
  • Three Address Protocol (TAP)
    • 💡What is TAP?
    • 💡How to Register Delegations (TAP)?
    • 💡How to Register Consolidations (TAP)?
  • Developer Center
    • 💡General Info
    • 📔Contract Addresses
    • 📖Getter Functions
    • âœī¸Setter Functions
    • 📄INFTDelegationRead.sol
    • 📄INFTDelegationWrite.sol
    • đŸ–Ĩī¸NFTDelegation Integrations
      • 🔗Retrieve Calls
      • 🔗ERC721 Integration
  • Resources
    • NFTDelegation.com
    • Github
    • Dune Dashboard
Powered by GitBook
On this page
  1. Developer Center
  2. NFTDelegation Integrations

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).

function retrieveTokenStatus(address _vault, uint256 _tokenid) public view returns(bool) {
    return dmcRead.retrieveTokenStatus(_vault,         0x33fd426905f149f8376e227d0c9d3340aad17af1, msg.sender, 1, _tokenid);
}

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

Full Source Code

// SPDX-License-Identifier: MIT

import "./INFTDelegationRead.sol";

pragma solidity ^0.8.18;

contract NFTDelegationDEMO {
    
    INFTDelegationRead public dmcRead;

    constructor(address _NFTdelegationManagementContract) {
        dmcRead = INFTDelegationRead(_NFTdelegationManagementContract);
    }

    // Sample function for retrieving the delegators of msg.sender on Any collection for Any Use case

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

    // Sample function for retrieving the delegation status of msg.sender given a Delegator address

    function checkMintingStatus(address _vault) public view returns(bool) {
        return dmcRead.retrieveGlobalStatusOfDelegation(_vault, 0x8888888888888888888888888888888888888888, msg.sender, 2);
    }
    
    // Sample function for retrieving the token status given a delegator address

    function retrieveTokenStatus(address _vault, uint256 _tokenid) public view returns(bool) {
        return dmcRead.retrieveTokenStatus(_vault, 0x8888888888888888888888888888888888888888, msg.sender, 1, _tokenid);
    }

}
PreviousNFTDelegation IntegrationsNextERC721 Integration

Last updated 1 year ago

đŸ–Ĩī¸
🔗