S Price: $0.537926 (+0.77%)

Contract Diff Checker

Contract Name:
DelegatorCaller

Contract Source Code:

File 1 of 1 : DelegatorCaller

// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;

interface IERC721 {
    function balanceOf(address owner) external view returns (uint256);
}

interface SacraRelay {
    struct CallWithERC2771 {
        uint chainId;
        address target;
        bytes data;
        address user;
        uint userNonce;
        uint userDeadline;
    }

    function callFromDelegator(CallWithERC2771 calldata callInfo) external;
}

contract DelegatorCaller {
    SacraRelay public sacraRelay;

    constructor(address _sacraRelay) {
        sacraRelay = SacraRelay(_sacraRelay);
    }

    // Function to get the NFT balance of a given address for a specific contract
    function getNFTBalance(address nftContract, address owner) public view returns (uint256) {
        return IERC721(nftContract).balanceOf(owner);
    }

    function kek(
        SacraRelay.CallWithERC2771 calldata callInfo,
        address nftContract,
        uint256 minimum
    ) public {
        // Call the relay function
        sacraRelay.callFromDelegator(callInfo);

        // Check NFT balance
        uint256 balance = IERC721(nftContract).balanceOf(callInfo.user);
        require(balance >= minimum, "Insufficient NFT balance");
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):