MultiGiveaway

Deploy on Alchemy
Verified
Ethereum
Verified, NFT
Solidity
Verified
Ethereum

Contract Information

The following smart contract is a MultiGiveaway contract that allows multiple giveaways to be conducted using Merkle trees. Users can claim tokens from multiple Merkle trees by providing the correct proof. The contract supports ERC721, ERC1155, and ERC20 tokens. The contract also has an admin role that can add new giveaways and check the claimed status of users. The contract ensures that tokens can only be claimed once and within the specified expiry time.
More Info

MultiGiveaway Source Code

//SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol"; import "./ClaimERC1155ERC721ERC20.sol"; import "../../common/BaseWithStorage/WithAdmin.sol"; /// @title MultiGiveaway contract. /// @notice This contract manages claims for multiple token types. contract MultiGiveaway is WithAdmin, ClaimERC1155ERC721ERC20 { /////////////////////////////// Data ////////////////////////////// bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61; bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81; bytes4 internal constant ERC721_RECEIVED = 0x150b7a02; bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46; mapping(address => mapping(bytes32 => bool)) public claimed; mapping(bytes32 => uint256) internal _expiryTime; /////////////////////////////// Events ////////////////////////////// event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime); /////////////////////////////// Constructor ///////////////////////// constructor(address admin) { _admin = admin; } /////////////////////////////// Functions /////////////////////////// /// @notice Function to add a new giveaway. /// @param merkleRoot The merkle root hash of the claim data. /// @param expiryTime The expiry time for the giveaway. function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime) external onlyAdmin { _expiryTime[merkleRoot] = expiryTime; emit NewGiveaway(merkleRoot, expiryTime); } /// @notice Function to check which giveaways have been claimed by a particular user. /// @param user The user (intended token destination) address. /// @param rootHashes The array of giveaway root hashes to check. /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed. function getClaimedStatus(address user, bytes32[] calldata rootHashes) external view returns (bool[] memory) { bool[] memory claimedGiveaways = new bool[](rootHashes.length); for (uint256 i = 0; i < rootHashes.length; i++) { claimedGiveaways[i] = claimed[user][rootHashes[i]]; } return claimedGiveaways; } /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address. /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param. /// @param proofs The proofs submitted for verification. function claimMultipleTokensFromMultipleMerkleTree( bytes32[] calldata rootHashes, Claim[] memory claims, bytes32[][] calldata proofs ) external { require(claims.length == rootHashes.length, "INVALID_INPUT"); require(claims.length == proofs.length, "INVALID_INPUT"); for (uint256 i = 0; i < rootHashes.length; i++) { claimMultipleTokens(rootHashes[i], claims[i], proofs[i]); } } /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim. /// @param merkleRoot The merkle root hash for the specific set of items being claimed. /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param. /// @param proof The proof provided by the user performing the claim function. function claimMultipleTokens( bytes32 merkleRoot, Claim memory claim, bytes32[] calldata proof ) public { uint256 giveawayExpiryTime = _expiryTime[merkleRoot]; require(claim.to != address(0), "INVALID_TO_ZERO_ADDRESS"); require(claim.to != address(this), "DESTINATION_MULTIGIVEAWAY_CONTRACT"); require(giveawayExpiryTime != 0, "GIVEAWAY_DOES_NOT_EXIST"); require(block.timestamp < giveawayExpiryTime, "CLAIM_PERIOD_IS_OVER"); require(claimed[claim.to][merkleRoot] == false, "DESTINATION_ALREADY_CLAIMED"); claimed[claim.to][merkleRoot] = true; _claimERC1155ERC721ERC20(merkleRoot, claim, proof); } function onERC721Received( address, /*operator*/ address, /*from*/ uint256, /*id*/ bytes calldata /*data*/ ) external pure returns (bytes4) { return ERC721_RECEIVED; } function onERC721BatchReceived( address, /*operator*/ address, /*from*/ uint256[] calldata, /*ids*/ bytes calldata /*data*/ ) external pure returns (bytes4) { return ERC721_BATCH_RECEIVED; } function onERC1155Received( address, /*operator*/ address, /*from*/ uint256, /*id*/ uint256, /*value*/ bytes calldata /*data*/ ) external pure returns (bytes4) { return ERC1155_RECEIVED; } function onERC1155BatchReceived( address, /*operator*/ address, /*from*/ uint256[] calldata, /*ids*/ uint256[] calldata, /*values*/ bytes calldata /*data*/ ) external pure returns (bytes4) { return ERC1155_BATCH_RECEIVED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); } //SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol"; import "../../common/interfaces/IERC721Extended.sol"; import "../../common/Libraries/Verify.sol"; contract ClaimERC1155ERC721ERC20 { /////////////////////////////// Libs ////////////////////////////// using SafeERC20 for IERC20; /////////////////////////////// Data ////////////////////////////// struct Claim { address to; ERC1155Claim[] erc1155; ERC721Claim[] erc721; ERC20Claim erc20; bytes32 salt; } struct ERC1155Claim { uint256[] ids; uint256[] values; address contractAddress; } struct ERC721Claim { uint256[] ids; address contractAddress; } struct ERC20Claim { uint256[] amounts; address[] contractAddresses; } /////////////////////////////// Events ////////////////////////////// /// @dev Emits when a successful claim occurs. /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens. /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address. /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address. /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses. event ClaimedMultipleTokens(address to, ERC1155Claim[] erc1155, ERC721Claim[] erc721, ERC20Claim erc20); /////////////////////////////// Functions /////////////////////////// /// @dev Internal function used to claim multiple token types in one claim. /// @param merkleRoot The merkle root hash for the specific set of items being claimed. /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param. /// @param proof The proof provided by the user performing the claim function. function _claimERC1155ERC721ERC20( bytes32 merkleRoot, Claim memory claim, bytes32[] calldata proof ) internal { _checkValidity(merkleRoot, claim, proof); for (uint256 i = 0; i < claim.erc1155.length; i++) { require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, "INVALID_INPUT"); _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress); } for (uint256 i = 0; i < claim.erc721.length; i++) { _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress); } if (claim.erc20.amounts.length != 0) { require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, "INVALID_INPUT"); _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses); } emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20); } /// @dev Private function used to check the validity of a specific claim. /// @param merkleRoot The merkle root hash for the specific set of items being claimed. /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param. /// @param proof The proof provided by the user performing the claim function. function _checkValidity( bytes32 merkleRoot, Claim memory claim, bytes32[] memory proof ) private pure { bytes32 leaf = _generateClaimHash(claim); require(Verify.doesComputedHashMatchMerkleRootHash(merkleRoot, proof, leaf), "INVALID_CLAIM"); } /// @dev Private function used to generate a hash from an encoded claim. /// @param claim The claim struct. function _generateClaimHash(Claim memory claim) private pure returns (bytes32) { return keccak256(abi.encode(claim)); } /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim. /// @param to The destination address for the claimed tokens. /// @param ids The array of ERC1155 ids. /// @param values The amount of ERC1155 tokens of each id to be transferred. /// @param contractAddress The ERC1155 token contract address. function _transferERC1155( address to, uint256[] memory ids, uint256[] memory values, address contractAddress ) private { require(contractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS"); IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, ""); } /// @dev Private function used to transfer the ERC721tokens specified in a specific claim. /// @param to The destination address for the claimed tokens. /// @param ids The array of ERC721 ids. /// @param contractAddress The ERC721 token contract address. function _transferERC721( address to, uint256[] memory ids, address contractAddress ) private { require(contractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS"); IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, ""); } /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim. /// @param to The destination address for the claimed tokens. /// @param amounts The array of amounts of ERC20 tokens to be transferred. /// @param contractAddresses The array of ERC20 token contract addresses. function _transferERC20( address to, uint256[] memory amounts, address[] memory contractAddresses ) private { for (uint256 i = 0; i < amounts.length; i++) { address erc20ContractAddress = contractAddresses[i]; uint256 erc20Amount = amounts[i]; require(erc20ContractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS"); IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount); } } } //SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity 0.8.2; contract WithAdmin { address internal _admin; /// @dev Emits when the contract administrator is changed. /// @param oldAdmin The address of the previous administrator. /// @param newAdmin The address of the new administrator. event AdminChanged(address oldAdmin, address newAdmin); modifier onlyAdmin() { require(msg.sender == _admin, "ADMIN_ONLY"); _; } /// @dev Get the current administrator of this contract. /// @return The current administrator of this contract. function getAdmin() external view returns (address) { return _admin; } /// @dev Change the administrator to be `newAdmin`. /// @param newAdmin The address of the new administrator. function changeAdmin(address newAdmin) external { require(msg.sender == _admin, "ADMIN_ACCESS_DENIED"); emit AdminChanged(_admin, newAdmin); _admin = newAdmin; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } //SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol"; interface IERC721Extended is IERC721 { function approveFor( address sender, address operator, uint256 id ) external; function batchTransferFrom( address from, address to, uint256[] calldata ids, bytes calldata data ) external; function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, bytes calldata data ) external; function setApprovalForAllFor( address sender, address operator, bool approved ) external; function burn(uint256 id) external; function burnFrom(address from, uint256 id) external; } //SPDX-License-Identifier: MIT pragma solidity 0.8.2; /** * @title Verify * @dev Merkle root comparison function. */ library Verify { /// @dev Check if the computedHash == comparisonHash. /// @param comparisonHash The merkle root hash passed to the function. /// @param proof The proof provided by the user. /// @param leaf The generated hash. /// @return Whether the computedHash == comparisonHash. function doesComputedHashMatchMerkleRootHash( bytes32 comparisonHash, bytes32[] memory proof, bytes32 leaf ) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash < proofElement) { computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash == comparisonHash; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
< //SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

import "@openzeppelin/contracts-0.8/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155Receiver.sol";
import "./ClaimERC1155ERC721ERC20.sol";
import "../../common/BaseWithStorage/WithAdmin.sol";

/// @title MultiGiveaway contract.
/// @notice This contract manages claims for multiple token types.
contract MultiGiveaway is WithAdmin, ClaimERC1155ERC721ERC20 {
    ///////////////////////////////  Data //////////////////////////////

    bytes4 private constant ERC1155_RECEIVED = 0xf23a6e61;
    bytes4 private constant ERC1155_BATCH_RECEIVED = 0xbc197c81;
    bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
    bytes4 internal constant ERC721_BATCH_RECEIVED = 0x4b808c46;

    mapping(address => mapping(bytes32 => bool)) public claimed;
    mapping(bytes32 => uint256) internal _expiryTime;

    ///////////////////////////////  Events //////////////////////////////

    event NewGiveaway(bytes32 merkleRoot, uint256 expiryTime);

    ///////////////////////////////  Constructor /////////////////////////

    constructor(address admin) {
        _admin = admin;
    }

    ///////////////////////////////  Functions ///////////////////////////

    /// @notice Function to add a new giveaway.
    /// @param merkleRoot The merkle root hash of the claim data.
    /// @param expiryTime The expiry time for the giveaway.
    function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime) external onlyAdmin {
        _expiryTime[merkleRoot] = expiryTime;
        emit NewGiveaway(merkleRoot, expiryTime);
    }

    /// @notice Function to check which giveaways have been claimed by a particular user.
    /// @param user The user (intended token destination) address.
    /// @param rootHashes The array of giveaway root hashes to check.
    /// @return claimedGiveaways The array of bools confirming whether or not the giveaways relating to the root hashes provided have been claimed.
    function getClaimedStatus(address user, bytes32[] calldata rootHashes) external view returns (bool[] memory) {
        bool[] memory claimedGiveaways = new bool[](rootHashes.length);
        for (uint256 i = 0; i < rootHashes.length; i++) {
            claimedGiveaways[i] = claimed[user][rootHashes[i]];
        }
        return claimedGiveaways;
    }

    /// @notice Function to permit the claiming of multiple tokens from multiple giveaways to a reserved address.
    /// @param claims The array of claim structs, each containing a destination address, the giveaway items to be claimed and an optional salt param.
    /// @param proofs The proofs submitted for verification.
    function claimMultipleTokensFromMultipleMerkleTree(
        bytes32[] calldata rootHashes,
        Claim[] memory claims,
        bytes32[][] calldata proofs
    ) external {
        require(claims.length == rootHashes.length, "INVALID_INPUT");
        require(claims.length == proofs.length, "INVALID_INPUT");
        for (uint256 i = 0; i < rootHashes.length; i++) {
            claimMultipleTokens(rootHashes[i], claims[i], proofs[i]);
        }
    }

    /// @dev Public function used to perform validity checks and progress to claim multiple token types in one claim.
    /// @param merkleRoot The merkle root hash for the specific set of items being claimed.
    /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.
    /// @param proof The proof provided by the user performing the claim function.
    function claimMultipleTokens(
        bytes32 merkleRoot,
        Claim memory claim,
        bytes32[] calldata proof
    ) public {
        uint256 giveawayExpiryTime = _expiryTime[merkleRoot];
        require(claim.to != address(0), "INVALID_TO_ZERO_ADDRESS");
        require(claim.to != address(this), "DESTINATION_MULTIGIVEAWAY_CONTRACT");
        require(giveawayExpiryTime != 0, "GIVEAWAY_DOES_NOT_EXIST");
        require(block.timestamp < giveawayExpiryTime, "CLAIM_PERIOD_IS_OVER");
        require(claimed[claim.to][merkleRoot] == false, "DESTINATION_ALREADY_CLAIMED");
        claimed[claim.to][merkleRoot] = true;
        _claimERC1155ERC721ERC20(merkleRoot, claim, proof);
    }

    function onERC721Received(
        address, /*operator*/
        address, /*from*/
        uint256, /*id*/
        bytes calldata /*data*/
    ) external pure returns (bytes4) {
        return ERC721_RECEIVED;
    }

    function onERC721BatchReceived(
        address, /*operator*/
        address, /*from*/
        uint256[] calldata, /*ids*/
        bytes calldata /*data*/
    ) external pure returns (bytes4) {
        return ERC721_BATCH_RECEIVED;
    }

    function onERC1155Received(
        address, /*operator*/
        address, /*from*/
        uint256, /*id*/
        uint256, /*value*/
        bytes calldata /*data*/
    ) external pure returns (bytes4) {
        return ERC1155_RECEIVED;
    }

    function onERC1155BatchReceived(
        address, /*operator*/
        address, /*from*/
        uint256[] calldata, /*ids*/
        uint256[] calldata, /*values*/
        bytes calldata /*data*/
    ) external pure returns (bytes4) {
        return ERC1155_BATCH_RECEIVED;
    }
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {

    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    )
        external
        returns(bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    )
        external
        returns(bytes4);
}
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

import "@openzeppelin/contracts-0.8/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-0.8/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-0.8/token/ERC20/utils/SafeERC20.sol";
import "../../common/interfaces/IERC721Extended.sol";
import "../../common/Libraries/Verify.sol";

contract ClaimERC1155ERC721ERC20 {
    ///////////////////////////////  Libs //////////////////////////////

    using SafeERC20 for IERC20;

    ///////////////////////////////  Data //////////////////////////////

    struct Claim {
        address to;
        ERC1155Claim[] erc1155;
        ERC721Claim[] erc721;
        ERC20Claim erc20;
        bytes32 salt;
    }

    struct ERC1155Claim {
        uint256[] ids;
        uint256[] values;
        address contractAddress;
    }

    struct ERC721Claim {
        uint256[] ids;
        address contractAddress;
    }

    struct ERC20Claim {
        uint256[] amounts;
        address[] contractAddresses;
    }

    ///////////////////////////////  Events //////////////////////////////

    /// @dev Emits when a successful claim occurs.
    /// @param to The destination address for the claimed ERC1155, ERC721 and ERC20 tokens.
    /// @param erc1155 The array of ERC1155Claim structs containing the ids, values and ERC1155 contract address.
    /// @param erc721 The array of ERC721Claim structs containing the ids and ERC721 contract address.
    /// @param erc20 The ERC20Claim struct containing the amounts and ERC20 contract addresses.
    event ClaimedMultipleTokens(address to, ERC1155Claim[] erc1155, ERC721Claim[] erc721, ERC20Claim erc20);

    ///////////////////////////////  Functions ///////////////////////////

    /// @dev Internal function used to claim multiple token types in one claim.
    /// @param merkleRoot The merkle root hash for the specific set of items being claimed.
    /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.
    /// @param proof The proof provided by the user performing the claim function.
    function _claimERC1155ERC721ERC20(
        bytes32 merkleRoot,
        Claim memory claim,
        bytes32[] calldata proof
    ) internal {
        _checkValidity(merkleRoot, claim, proof);
        for (uint256 i = 0; i < claim.erc1155.length; i++) {
            require(claim.erc1155[i].ids.length == claim.erc1155[i].values.length, "INVALID_INPUT");
            _transferERC1155(claim.to, claim.erc1155[i].ids, claim.erc1155[i].values, claim.erc1155[i].contractAddress);
        }
        for (uint256 i = 0; i < claim.erc721.length; i++) {
            _transferERC721(claim.to, claim.erc721[i].ids, claim.erc721[i].contractAddress);
        }
        if (claim.erc20.amounts.length != 0) {
            require(claim.erc20.amounts.length == claim.erc20.contractAddresses.length, "INVALID_INPUT");
            _transferERC20(claim.to, claim.erc20.amounts, claim.erc20.contractAddresses);
        }
        emit ClaimedMultipleTokens(claim.to, claim.erc1155, claim.erc721, claim.erc20);
    }

    /// @dev Private function used to check the validity of a specific claim.
    /// @param merkleRoot The merkle root hash for the specific set of items being claimed.
    /// @param claim The claim struct containing the destination address, all items to be claimed and optional salt param.
    /// @param proof The proof provided by the user performing the claim function.
    function _checkValidity(
        bytes32 merkleRoot,
        Claim memory claim,
        bytes32[] memory proof
    ) private pure {
        bytes32 leaf = _generateClaimHash(claim);
        require(Verify.doesComputedHashMatchMerkleRootHash(merkleRoot, proof, leaf), "INVALID_CLAIM");
    }

    /// @dev Private function used to generate a hash from an encoded claim.
    /// @param claim The claim struct.
    function _generateClaimHash(Claim memory claim) private pure returns (bytes32) {
        return keccak256(abi.encode(claim));
    }

    /// @dev Private function used to transfer the ERC1155 tokens specified in a specific claim.
    /// @param to The destination address for the claimed tokens.
    /// @param ids The array of ERC1155 ids.
    /// @param values The amount of ERC1155 tokens of each id to be transferred.
    /// @param contractAddress The ERC1155 token contract address.
    function _transferERC1155(
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        address contractAddress
    ) private {
        require(contractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS");
        IERC1155(contractAddress).safeBatchTransferFrom(address(this), to, ids, values, "");
    }

    /// @dev Private function used to transfer the ERC721tokens specified in a specific claim.
    /// @param to The destination address for the claimed tokens.
    /// @param ids The array of ERC721 ids.
    /// @param contractAddress The ERC721 token contract address.
    function _transferERC721(
        address to,
        uint256[] memory ids,
        address contractAddress
    ) private {
        require(contractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS");
        IERC721Extended(contractAddress).safeBatchTransferFrom(address(this), to, ids, "");
    }

    /// @dev Private function used to transfer the ERC20 tokens specified in a specific claim.
    /// @param to The destination address for the claimed tokens.
    /// @param amounts The array of amounts of ERC20 tokens to be transferred.
    /// @param contractAddresses The array of ERC20 token contract addresses.
    function _transferERC20(
        address to,
        uint256[] memory amounts,
        address[] memory contractAddresses
    ) private {
        for (uint256 i = 0; i < amounts.length; i++) {
            address erc20ContractAddress = contractAddresses[i];
            uint256 erc20Amount = amounts[i];
            require(erc20ContractAddress != address(0), "INVALID_CONTRACT_ZERO_ADDRESS");
            IERC20(erc20ContractAddress).safeTransferFrom(address(this), to, erc20Amount);
        }
    }
}
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

contract WithAdmin {
    address internal _admin;

    /// @dev Emits when the contract administrator is changed.
    /// @param oldAdmin The address of the previous administrator.
    /// @param newAdmin The address of the new administrator.
    event AdminChanged(address oldAdmin, address newAdmin);

    modifier onlyAdmin() {
        require(msg.sender == _admin, "ADMIN_ONLY");
        _;
    }

    /// @dev Get the current administrator of this contract.
    /// @return The current administrator of this contract.
    function getAdmin() external view returns (address) {
        return _admin;
    }

    /// @dev Change the administrator to be `newAdmin`.
    /// @param newAdmin The address of the new administrator.
    function changeAdmin(address newAdmin) external {
        require(msg.sender == _admin, "ADMIN_ACCESS_DENIED");
        emit AdminChanged(_admin, newAdmin);
        _admin = newAdmin;
    }
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

import "@openzeppelin/contracts-0.8/token/ERC721/IERC721.sol";

interface IERC721Extended is IERC721 {
    function approveFor(
        address sender,
        address operator,
        uint256 id
    ) external;

    function batchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) external;

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) external;

    function setApprovalForAllFor(
        address sender,
        address operator,
        bool approved
    ) external;

    function burn(uint256 id) external;

    function burnFrom(address from, uint256 id) external;
}
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

/**
 * @title Verify
 * @dev Merkle root comparison function.
 */
library Verify {
    /// @dev Check if the computedHash == comparisonHash.
    /// @param comparisonHash The merkle root hash passed to the function.
    /// @param proof The proof provided by the user.
    /// @param leaf The generated hash.
    /// @return Whether the computedHash == comparisonHash.
    function doesComputedHashMatchMerkleRootHash(
        bytes32 comparisonHash,
        bytes32[] memory proof,
        bytes32 leaf
    ) internal pure returns (bool) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash < proofElement) {
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }
        return computedHash == comparisonHash;
    }
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
 < 

MultiGiveaway ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"}],"name":"ClaimedMultipleTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expiryTime","type":"uint256"}],"name":"NewGiveaway","type":"event"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"expiryTime","type":"uint256"}],"name":"addNewGiveaway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"components":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"internalType":"struct ClaimERC1155ERC721ERC20.Claim","name":"claim","type":"tuple"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"claimMultipleTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"rootHashes","type":"bytes32[]"},{"components":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"internalType":"struct ClaimERC1155ERC721ERC20.Claim[]","name":"claims","type":"tuple[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"}],"name":"claimMultipleTokensFromMultipleMerkleTree","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32[]","name":"rootHashes","type":"bytes32[]"}],"name":"getClaimedStatus","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"}]
[{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"indexed":false,"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"}],"name":"ClaimedMultipleTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expiryTime","type":"uint256"}],"name":"NewGiveaway","type":"event"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"expiryTime","type":"uint256"}],"name":"addNewGiveaway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"components":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"internalType":"struct ClaimERC1155ERC721ERC20.Claim","name":"claim","type":"tuple"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"claimMultipleTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"rootHashes","type":"bytes32[]"},{"components":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC1155Claim[]","name":"erc1155","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"contractAddress","type":"address"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC721Claim[]","name":"erc721","type":"tuple[]"},{"components":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"contractAddresses","type":"address[]"}],"internalType":"struct ClaimERC1155ERC721ERC20.ERC20Claim","name":"erc20","type":"tuple"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"internalType":"struct ClaimERC1155ERC721ERC20.Claim[]","name":"claims","type":"tuple[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"}],"name":"claimMultipleTokensFromMultipleMerkleTree","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32[]","name":"rootHashes","type":"bytes32[]"}],"name":"getClaimedStatus","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"}]

MultiGiveaway Bytecode

608060405234801561001057600080fd5b5060405161204e38038061204e83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b611fbd806100916000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80636e9960c311610081578063bc197c811161005b578063bc197c8114610229578063c850933214610264578063f23a6e6114610277576100c9565b80636e9960c3146101db5780638f283970146101f6578063a7d235be14610209576100c9565b806325839ca7116100b257806325839ca71461017a5780634b808c461461018f5780636aea75f1146101c8576100c9565b80630f2d940b146100ce578063150b7a0214610111575b600080fd5b6100fc6100dc366004611911565b600160209081526000928352604080842090915290825290205460ff1681565b60405190151581526020015b60405180910390f35b61014961011f3660046117ef565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610108565b61018d610188366004611a28565b6102b0565b005b61014961019d366004611761565b7f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b61018d6101d6366004611a95565b61050d565b6000546040516001600160a01b039091168152602001610108565b61018d610204366004611690565b6105b6565b61021c6102173660046118c0565b610691565b6040516101089190611d4b565b6101496102373660046116aa565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b61018d61027236600461193a565b61079c565b61014961028536600461185c565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b60008481526002602052604090205483516001600160a01b031661031b5760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f544f5f5a45524f5f4144445245535300000000000000000060448201526064015b60405180910390fd5b83516001600160a01b031630141561039b5760405162461bcd60e51b815260206004820152602260248201527f44455354494e4154494f4e5f4d554c544947495645415741595f434f4e54524160448201527f43540000000000000000000000000000000000000000000000000000000000006064820152608401610312565b806103e85760405162461bcd60e51b815260206004820152601760248201527f47495645415741595f444f45535f4e4f545f45584953540000000000000000006044820152606401610312565b8042106104375760405162461bcd60e51b815260206004820152601460248201527f434c41494d5f504552494f445f49535f4f5645520000000000000000000000006044820152606401610312565b83516001600160a01b0316600090815260016020908152604080832088845290915290205460ff16156104ac5760405162461bcd60e51b815260206004820152601b60248201527f44455354494e4154494f4e5f414c52454144595f434c41494d454400000000006044820152606401610312565b83516001600160a01b0316600090815260016020818152604080842089855290915290912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610506858585856108c5565b5050505050565b6000546001600160a01b031633146105675760405162461bcd60e51b815260206004820152600a60248201527f41444d494e5f4f4e4c59000000000000000000000000000000000000000000006044820152606401610312565b60008281526002602090815260409182902083905581518481529081018390527fcf995c8d29c258a6c2056e0d5ddfa67f3634d25f5eed5dcf65ead06195b1a271910160405180910390a15050565b6000546001600160a01b031633146106105760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e494544000000000000000000000000006044820152606401610312565b600054604080516001600160a01b03928316815291831660208301527f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b606060008267ffffffffffffffff8111156106bc57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156106e5578160200160208202803683370190505b50905060005b83811015610791576001600160a01b03861660009081526001602052604081209086868481811061072c57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060009054906101000a900460ff1682828151811061076f57634e487b7160e01b600052603260045260246000fd5b911515602092830291909101909101528061078981611f2c565b9150506106eb565b5090505b9392505050565b825184146107dc5760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b8251811461081c5760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b60005b848110156108bd576108ab86868381811061084a57634e487b7160e01b600052603260045260246000fd5b9050602002013585838151811061087157634e487b7160e01b600052603260045260246000fd5b602002602001015185858581811061089957634e487b7160e01b600052603260045260246000fd5b90506020028101906101889190611e46565b806108b581611f2c565b91505061081f565b505050505050565b6109038484848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610bb692505050565b60005b836020015151811015610a61578360200151818151811061093757634e487b7160e01b600052603260045260246000fd5b602002602001015160200151518460200151828151811061096857634e487b7160e01b600052603260045260246000fd5b60200260200101516000015151146109b25760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b610a4f8460000151856020015183815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015186602001518481518110610a0e57634e487b7160e01b600052603260045260246000fd5b60200260200101516020015187602001518581518110610a3e57634e487b7160e01b600052603260045260246000fd5b602002602001015160400151610c20565b80610a5981611f2c565b915050610906565b5060005b836040015151811015610af157610adf846000015185604001518381518110610a9e57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015186604001518481518110610ace57634e487b7160e01b600052603260045260246000fd5b602002602001015160200151610cf9565b80610ae981611f2c565b915050610a65565b506060830151515115610b6357606083015160208101515190515114610b495760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b825160608401518051602090910151610b63929190610dcf565b7fdbf330cc6723e4f92690af8e3d5103c1b06d58e85b16421cc981f407535d2f278360000151846020015185604001518660600151604051610ba89493929190611d03565b60405180910390a150505050565b6000610bc183610ec0565b9050610bce848383610ef1565b610c1a5760405162461bcd60e51b815260206004820152600d60248201527f494e56414c49445f434c41494d000000000000000000000000000000000000006044820152606401610312565b50505050565b6001600160a01b038116610c765760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b6040517f2eb2c2d60000000000000000000000000000000000000000000000000000000081526001600160a01b03821690632eb2c2d690610cc1903090889088908890600401611c67565b600060405180830381600087803b158015610cdb57600080fd5b505af1158015610cef573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038116610d4f5760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b6040517f28cfbd460000000000000000000000000000000000000000000000000000000081526001600160a01b038216906328cfbd4690610d9890309087908790600401611cbf565b600060405180830381600087803b158015610db257600080fd5b505af1158015610dc6573d6000803e3d6000fd5b50505050505050565b60005b8251811015610c1a576000828281518110610dfd57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848381518110610e2957634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006001600160a01b0316826001600160a01b03161415610e965760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b610eab6001600160a01b038316308884610faf565b50508080610eb890611f2c565b915050610dd2565b600081604051602001610ed39190611dc4565b6040516020818303038152906040528051906020012090505b919050565b600081815b8451811015610fa4576000858281518110610f2157634e487b7160e01b600052603260045260246000fd5b6020026020010151905080831015610f64576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250610f91565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080610f9c81611f2c565b915050610ef6565b509093149392505050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610c1a9287929160009161107591851690849061110a565b80519091501561110557808060200190518101906110939190611a08565b6111055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610312565b505050565b60606111198484600085611121565b949350505050565b6060824710156111995760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610312565b843b6111e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516112039190611c4b565b60006040518083038185875af1925050503d8060008114611240576040519150601f19603f3d011682016040523d82523d6000602084013e611245565b606091505b5091509150611255828286611260565b979650505050505050565b6060831561126f575081610795565b82511561127f5782518084602001fd5b8160405162461bcd60e51b81526004016103129190611d91565b80356001600160a01b0381168114610eec57600080fd5b60008083601f8401126112c1578182fd5b50813567ffffffffffffffff8111156112d8578182fd5b60208301915083602080830285010111156112f257600080fd5b9250929050565b600082601f830112611309578081fd5b8135602061131e61131983611edc565b611eab565b82815281810190858301855b858110156113c75781358801606080601f19838d0301121561134a578889fd5b61135381611eab565b8783013567ffffffffffffffff8082111561136c578b8cfd5b61137a8e8b84880101611475565b8352604091508185013581811115611390578c8dfd5b61139e8f8c83890101611475565b8b85015250506113af838501611299565b9082015286525050928401929084019060010161132a565b5090979650505050505050565b600082601f8301126113e4578081fd5b813560206113f461131983611edc565b82815281810190858301855b858110156113c75781358801604080601f19838d03011215611420578889fd5b61142981611eab565b8783013567ffffffffffffffff811115611441578a8bfd5b61144f8d8a83870101611475565b82525061145d828401611299565b81890152865250509284019290840190600101611400565b600082601f830112611485578081fd5b8135602061149561131983611edc565b82815281810190858301838502870184018810156114b1578586fd5b855b858110156113c7578135845292840192908401906001016114b3565b60008083601f8401126114e0578182fd5b50813567ffffffffffffffff8111156114f7578182fd5b6020830191508360208285010111156112f257600080fd5b600060a08284031215611520578081fd5b61152a60a0611eab565b905061153582611299565b8152602082013567ffffffffffffffff8082111561155257600080fd5b61155e858386016112f9565b6020840152604084013591508082111561157757600080fd5b611583858386016113d4565b6040840152606084013591508082111561159c57600080fd5b506115a9848285016115bf565b6060830152506080820135608082015292915050565b6000604082840312156115d0578081fd5b6115da6040611eab565b9050813567ffffffffffffffff808211156115f457600080fd5b61160085838601611475565b835260209150818401358181111561161757600080fd5b84019050601f8101851361162a57600080fd5b803561163861131982611edc565b818152838101908385018584028501860189101561165557600080fd5b600094505b8385101561167f5761166b81611299565b83526001949094019391850191850161165a565b508085870152505050505092915050565b6000602082840312156116a1578081fd5b61079582611299565b60008060008060008060008060a0898b0312156116c5578384fd5b6116ce89611299565b97506116dc60208a01611299565b9650604089013567ffffffffffffffff808211156116f8578586fd5b6117048c838d016112b0565b909850965060608b013591508082111561171c578586fd5b6117288c838d016112b0565b909650945060808b0135915080821115611740578384fd5b5061174d8b828c016114cf565b999c989b5096995094979396929594505050565b60008060008060008060808789031215611779578384fd5b61178287611299565b955061179060208801611299565b9450604087013567ffffffffffffffff808211156117ac578586fd5b6117b88a838b016112b0565b909650945060608901359150808211156117d0578384fd5b506117dd89828a016114cf565b979a9699509497509295939492505050565b600080600080600060808688031215611806578283fd5b61180f86611299565b945061181d60208701611299565b935060408601359250606086013567ffffffffffffffff81111561183f578182fd5b61184b888289016114cf565b969995985093965092949392505050565b60008060008060008060a08789031215611874578384fd5b61187d87611299565b955061188b60208801611299565b94506040870135935060608701359250608087013567ffffffffffffffff8111156118b4578283fd5b6117dd89828a016114cf565b6000806000604084860312156118d4578081fd5b6118dd84611299565b9250602084013567ffffffffffffffff8111156118f8578182fd5b611904868287016112b0565b9497909650939450505050565b60008060408385031215611923578182fd5b61192c83611299565b946020939093013593505050565b600080600080600060608688031215611951578283fd5b853567ffffffffffffffff80821115611968578485fd5b61197489838a016112b0565b909750955060209150878201358181111561198d578586fd5b8801601f81018a1361199d578586fd5b80356119ab61131982611edc565b81815284810190838601895b848110156119e0576119ce8f89843589010161150f565b845292870192908701906001016119b7565b509098505050506040890135925050808211156119fb578283fd5b5061184b888289016112b0565b600060208284031215611a19578081fd5b81518015158114610795578182fd5b60008060008060608587031215611a3d578182fd5b84359350602085013567ffffffffffffffff80821115611a5b578384fd5b611a678883890161150f565b94506040870135915080821115611a7c578384fd5b50611a89878288016112b0565b95989497509550505050565b60008060408385031215611aa7578182fd5b50508035926020909101359150565b6000815180845260208085018081965082840281019150828601855b85811015611b36578284038952815160608151818752611af482880182611ba8565b9150508682015186820388880152611b0c8282611ba8565b6040938401516001600160a01b031697909301969096525098850198935090840190600101611ad2565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015611b36578284038952815160408151818752611b8182880182611ba8565b928801516001600160a01b0316968801969096525098850198935090840190600101611b5f565b6000815180845260208085019450808401835b83811015611bd757815187529582019590820190600101611bbb565b509495945050505050565b6000815160408452611bf76040850182611ba8565b602084810151868303878301528051808452908201935090918491908301905b80831015611c405784516001600160a01b03168252938301936001929092019190830190611c17565b509695505050505050565b60008251611c5d818460208701611f00565b9190910192915050565b60006001600160a01b03808716835280861660208401525060a06040830152611c9360a0830185611ba8565b8281036060840152611ca58185611ba8565b838103608090940193909352508152602001949350505050565b60006001600160a01b03808616835280851660208401525060806040830152611ceb6080830184611ba8565b82810360609093019290925281526020019392505050565b60006001600160a01b038616825260806020830152611d256080830186611ab6565b8281036040840152611d378186611b43565b905082810360608401526112558185611be2565b6020808252825182820181905260009190848201906040850190845b81811015611d85578351151583529284019291840191600101611d67565b50909695505050505050565b6000602082528251806020840152611db0816040850160208701611f00565b601f01601f19169190910160400192915050565b6000602082526001600160a01b038351166020830152602083015160a06040840152611df360c0840182611ab6565b90506040840151601f1980858403016060860152611e118383611b43565b9250606086015191508085840301608086015250611e2f8282611be2565b915050608084015160a08401528091505092915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611e7a578283fd5b83018035915067ffffffffffffffff821115611e94578283fd5b60209081019250810236038213156112f257600080fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611ed457611ed4611f71565b604052919050565b600067ffffffffffffffff821115611ef657611ef6611f71565b5060209081020190565b60005b83811015611f1b578181015183820152602001611f03565b83811115610c1a5750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f6a57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220b4867497a2dc74b8644537bbd4f044bcb72587ab9eeac79048f4f5816640b95164736f6c63430008020033000000000000000000000000eaa0993e1d21c2103e4f172a20d29371fbaf6d06
608060405234801561001057600080fd5b5060405161204e38038061204e83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b611fbd806100916000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80636e9960c311610081578063bc197c811161005b578063bc197c8114610229578063c850933214610264578063f23a6e6114610277576100c9565b80636e9960c3146101db5780638f283970146101f6578063a7d235be14610209576100c9565b806325839ca7116100b257806325839ca71461017a5780634b808c461461018f5780636aea75f1146101c8576100c9565b80630f2d940b146100ce578063150b7a0214610111575b600080fd5b6100fc6100dc366004611911565b600160209081526000928352604080842090915290825290205460ff1681565b60405190151581526020015b60405180910390f35b61014961011f3660046117ef565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610108565b61018d610188366004611a28565b6102b0565b005b61014961019d366004611761565b7f4b808c46000000000000000000000000000000000000000000000000000000009695505050505050565b61018d6101d6366004611a95565b61050d565b6000546040516001600160a01b039091168152602001610108565b61018d610204366004611690565b6105b6565b61021c6102173660046118c0565b610691565b6040516101089190611d4b565b6101496102373660046116aa565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b61018d61027236600461193a565b61079c565b61014961028536600461185c565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b60008481526002602052604090205483516001600160a01b031661031b5760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f544f5f5a45524f5f4144445245535300000000000000000060448201526064015b60405180910390fd5b83516001600160a01b031630141561039b5760405162461bcd60e51b815260206004820152602260248201527f44455354494e4154494f4e5f4d554c544947495645415741595f434f4e54524160448201527f43540000000000000000000000000000000000000000000000000000000000006064820152608401610312565b806103e85760405162461bcd60e51b815260206004820152601760248201527f47495645415741595f444f45535f4e4f545f45584953540000000000000000006044820152606401610312565b8042106104375760405162461bcd60e51b815260206004820152601460248201527f434c41494d5f504552494f445f49535f4f5645520000000000000000000000006044820152606401610312565b83516001600160a01b0316600090815260016020908152604080832088845290915290205460ff16156104ac5760405162461bcd60e51b815260206004820152601b60248201527f44455354494e4154494f4e5f414c52454144595f434c41494d454400000000006044820152606401610312565b83516001600160a01b0316600090815260016020818152604080842089855290915290912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610506858585856108c5565b5050505050565b6000546001600160a01b031633146105675760405162461bcd60e51b815260206004820152600a60248201527f41444d494e5f4f4e4c59000000000000000000000000000000000000000000006044820152606401610312565b60008281526002602090815260409182902083905581518481529081018390527fcf995c8d29c258a6c2056e0d5ddfa67f3634d25f5eed5dcf65ead06195b1a271910160405180910390a15050565b6000546001600160a01b031633146106105760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e494544000000000000000000000000006044820152606401610312565b600054604080516001600160a01b03928316815291831660208301527f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b606060008267ffffffffffffffff8111156106bc57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156106e5578160200160208202803683370190505b50905060005b83811015610791576001600160a01b03861660009081526001602052604081209086868481811061072c57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060009054906101000a900460ff1682828151811061076f57634e487b7160e01b600052603260045260246000fd5b911515602092830291909101909101528061078981611f2c565b9150506106eb565b5090505b9392505050565b825184146107dc5760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b8251811461081c5760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b60005b848110156108bd576108ab86868381811061084a57634e487b7160e01b600052603260045260246000fd5b9050602002013585838151811061087157634e487b7160e01b600052603260045260246000fd5b602002602001015185858581811061089957634e487b7160e01b600052603260045260246000fd5b90506020028101906101889190611e46565b806108b581611f2c565b91505061081f565b505050505050565b6109038484848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610bb692505050565b60005b836020015151811015610a61578360200151818151811061093757634e487b7160e01b600052603260045260246000fd5b602002602001015160200151518460200151828151811061096857634e487b7160e01b600052603260045260246000fd5b60200260200101516000015151146109b25760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b610a4f8460000151856020015183815181106109de57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015186602001518481518110610a0e57634e487b7160e01b600052603260045260246000fd5b60200260200101516020015187602001518581518110610a3e57634e487b7160e01b600052603260045260246000fd5b602002602001015160400151610c20565b80610a5981611f2c565b915050610906565b5060005b836040015151811015610af157610adf846000015185604001518381518110610a9e57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015186604001518481518110610ace57634e487b7160e01b600052603260045260246000fd5b602002602001015160200151610cf9565b80610ae981611f2c565b915050610a65565b506060830151515115610b6357606083015160208101515190515114610b495760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b6044820152606401610312565b825160608401518051602090910151610b63929190610dcf565b7fdbf330cc6723e4f92690af8e3d5103c1b06d58e85b16421cc981f407535d2f278360000151846020015185604001518660600151604051610ba89493929190611d03565b60405180910390a150505050565b6000610bc183610ec0565b9050610bce848383610ef1565b610c1a5760405162461bcd60e51b815260206004820152600d60248201527f494e56414c49445f434c41494d000000000000000000000000000000000000006044820152606401610312565b50505050565b6001600160a01b038116610c765760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b6040517f2eb2c2d60000000000000000000000000000000000000000000000000000000081526001600160a01b03821690632eb2c2d690610cc1903090889088908890600401611c67565b600060405180830381600087803b158015610cdb57600080fd5b505af1158015610cef573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038116610d4f5760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b6040517f28cfbd460000000000000000000000000000000000000000000000000000000081526001600160a01b038216906328cfbd4690610d9890309087908790600401611cbf565b600060405180830381600087803b158015610db257600080fd5b505af1158015610dc6573d6000803e3d6000fd5b50505050505050565b60005b8251811015610c1a576000828281518110610dfd57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848381518110610e2957634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006001600160a01b0316826001600160a01b03161415610e965760405162461bcd60e51b815260206004820152601d60248201527f494e56414c49445f434f4e54524143545f5a45524f5f414444524553530000006044820152606401610312565b610eab6001600160a01b038316308884610faf565b50508080610eb890611f2c565b915050610dd2565b600081604051602001610ed39190611dc4565b6040516020818303038152906040528051906020012090505b919050565b600081815b8451811015610fa4576000858281518110610f2157634e487b7160e01b600052603260045260246000fd5b6020026020010151905080831015610f64576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250610f91565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080610f9c81611f2c565b915050610ef6565b509093149392505050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610c1a9287929160009161107591851690849061110a565b80519091501561110557808060200190518101906110939190611a08565b6111055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610312565b505050565b60606111198484600085611121565b949350505050565b6060824710156111995760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610312565b843b6111e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610312565b600080866001600160a01b031685876040516112039190611c4b565b60006040518083038185875af1925050503d8060008114611240576040519150601f19603f3d011682016040523d82523d6000602084013e611245565b606091505b5091509150611255828286611260565b979650505050505050565b6060831561126f575081610795565b82511561127f5782518084602001fd5b8160405162461bcd60e51b81526004016103129190611d91565b80356001600160a01b0381168114610eec57600080fd5b60008083601f8401126112c1578182fd5b50813567ffffffffffffffff8111156112d8578182fd5b60208301915083602080830285010111156112f257600080fd5b9250929050565b600082601f830112611309578081fd5b8135602061131e61131983611edc565b611eab565b82815281810190858301855b858110156113c75781358801606080601f19838d0301121561134a578889fd5b61135381611eab565b8783013567ffffffffffffffff8082111561136c578b8cfd5b61137a8e8b84880101611475565b8352604091508185013581811115611390578c8dfd5b61139e8f8c83890101611475565b8b85015250506113af838501611299565b9082015286525050928401929084019060010161132a565b5090979650505050505050565b600082601f8301126113e4578081fd5b813560206113f461131983611edc565b82815281810190858301855b858110156113c75781358801604080601f19838d03011215611420578889fd5b61142981611eab565b8783013567ffffffffffffffff811115611441578a8bfd5b61144f8d8a83870101611475565b82525061145d828401611299565b81890152865250509284019290840190600101611400565b600082601f830112611485578081fd5b8135602061149561131983611edc565b82815281810190858301838502870184018810156114b1578586fd5b855b858110156113c7578135845292840192908401906001016114b3565b60008083601f8401126114e0578182fd5b50813567ffffffffffffffff8111156114f7578182fd5b6020830191508360208285010111156112f257600080fd5b600060a08284031215611520578081fd5b61152a60a0611eab565b905061153582611299565b8152602082013567ffffffffffffffff8082111561155257600080fd5b61155e858386016112f9565b6020840152604084013591508082111561157757600080fd5b611583858386016113d4565b6040840152606084013591508082111561159c57600080fd5b506115a9848285016115bf565b6060830152506080820135608082015292915050565b6000604082840312156115d0578081fd5b6115da6040611eab565b9050813567ffffffffffffffff808211156115f457600080fd5b61160085838601611475565b835260209150818401358181111561161757600080fd5b84019050601f8101851361162a57600080fd5b803561163861131982611edc565b818152838101908385018584028501860189101561165557600080fd5b600094505b8385101561167f5761166b81611299565b83526001949094019391850191850161165a565b508085870152505050505092915050565b6000602082840312156116a1578081fd5b61079582611299565b60008060008060008060008060a0898b0312156116c5578384fd5b6116ce89611299565b97506116dc60208a01611299565b9650604089013567ffffffffffffffff808211156116f8578586fd5b6117048c838d016112b0565b909850965060608b013591508082111561171c578586fd5b6117288c838d016112b0565b909650945060808b0135915080821115611740578384fd5b5061174d8b828c016114cf565b999c989b5096995094979396929594505050565b60008060008060008060808789031215611779578384fd5b61178287611299565b955061179060208801611299565b9450604087013567ffffffffffffffff808211156117ac578586fd5b6117b88a838b016112b0565b909650945060608901359150808211156117d0578384fd5b506117dd89828a016114cf565b979a9699509497509295939492505050565b600080600080600060808688031215611806578283fd5b61180f86611299565b945061181d60208701611299565b935060408601359250606086013567ffffffffffffffff81111561183f578182fd5b61184b888289016114cf565b969995985093965092949392505050565b60008060008060008060a08789031215611874578384fd5b61187d87611299565b955061188b60208801611299565b94506040870135935060608701359250608087013567ffffffffffffffff8111156118b4578283fd5b6117dd89828a016114cf565b6000806000604084860312156118d4578081fd5b6118dd84611299565b9250602084013567ffffffffffffffff8111156118f8578182fd5b611904868287016112b0565b9497909650939450505050565b60008060408385031215611923578182fd5b61192c83611299565b946020939093013593505050565b600080600080600060608688031215611951578283fd5b853567ffffffffffffffff80821115611968578485fd5b61197489838a016112b0565b909750955060209150878201358181111561198d578586fd5b8801601f81018a1361199d578586fd5b80356119ab61131982611edc565b81815284810190838601895b848110156119e0576119ce8f89843589010161150f565b845292870192908701906001016119b7565b509098505050506040890135925050808211156119fb578283fd5b5061184b888289016112b0565b600060208284031215611a19578081fd5b81518015158114610795578182fd5b60008060008060608587031215611a3d578182fd5b84359350602085013567ffffffffffffffff80821115611a5b578384fd5b611a678883890161150f565b94506040870135915080821115611a7c578384fd5b50611a89878288016112b0565b95989497509550505050565b60008060408385031215611aa7578182fd5b50508035926020909101359150565b6000815180845260208085018081965082840281019150828601855b85811015611b36578284038952815160608151818752611af482880182611ba8565b9150508682015186820388880152611b0c8282611ba8565b6040938401516001600160a01b031697909301969096525098850198935090840190600101611ad2565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015611b36578284038952815160408151818752611b8182880182611ba8565b928801516001600160a01b0316968801969096525098850198935090840190600101611b5f565b6000815180845260208085019450808401835b83811015611bd757815187529582019590820190600101611bbb565b509495945050505050565b6000815160408452611bf76040850182611ba8565b602084810151868303878301528051808452908201935090918491908301905b80831015611c405784516001600160a01b03168252938301936001929092019190830190611c17565b509695505050505050565b60008251611c5d818460208701611f00565b9190910192915050565b60006001600160a01b03808716835280861660208401525060a06040830152611c9360a0830185611ba8565b8281036060840152611ca58185611ba8565b838103608090940193909352508152602001949350505050565b60006001600160a01b03808616835280851660208401525060806040830152611ceb6080830184611ba8565b82810360609093019290925281526020019392505050565b60006001600160a01b038616825260806020830152611d256080830186611ab6565b8281036040840152611d378186611b43565b905082810360608401526112558185611be2565b6020808252825182820181905260009190848201906040850190845b81811015611d85578351151583529284019291840191600101611d67565b50909695505050505050565b6000602082528251806020840152611db0816040850160208701611f00565b601f01601f19169190910160400192915050565b6000602082526001600160a01b038351166020830152602083015160a06040840152611df360c0840182611ab6565b90506040840151601f1980858403016060860152611e118383611b43565b9250606086015191508085840301608086015250611e2f8282611be2565b915050608084015160a08401528091505092915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611e7a578283fd5b83018035915067ffffffffffffffff821115611e94578283fd5b60209081019250810236038213156112f257600080fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611ed457611ed4611f71565b604052919050565b600067ffffffffffffffff821115611ef657611ef6611f71565b5060209081020190565b60005b83811015611f1b578181015183820152602001611f03565b83811115610c1a5750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f6a57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220b4867497a2dc74b8644537bbd4f044bcb72587ab9eeac79048f4f5816640b95164736f6c63430008020033000000000000000000000000eaa0993e1d21c2103e4f172a20d29371fbaf6d06

Check out more smart contracts

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.