pragma solidity >=0.6.0 <0.8.0; import "../interfaces/ILinkdropERC721.sol"; import "../interfaces/ILinkdropFactoryERC721.sol"; import "./LinkdropFactoryCommon.sol"; import "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol"; contract LinkdropFactoryERC721 is ILinkdropFactoryERC721, LinkdropFactoryCommon { /** * @dev Function to verify claim params, make sure the link is not claimed or canceled and proxy is allowed to spend token * @param _weiAmount Amount of wei to be claimed * @param _nftAddress NFT address * @param _tokenId Token id to be claimed * @param _expiration Unix timestamp of link expiration time * @param _linkId Address corresponding to link key * @param _linkdropMaster Address corresponding to linkdrop master key * @param _campaignId Campaign id * @param _linkdropSignerSignature ECDSA signature of linkdrop signer * @param _receiver Address of linkdrop receiver * @param _receiverSignature ECDSA signature of linkdrop receiver * @return True if success */ function checkClaimParamsERC721 ( uint _weiAmount, address _nftAddress, uint _tokenId, uint _expiration, address _linkId, address payable _linkdropMaster, uint _campaignId, bytes memory _linkdropSignerSignature, address _receiver, bytes memory _receiverSignature ) public override view returns (bool) { // Make sure proxy contract is deployed require(isDeployed(_linkdropMaster, _campaignId), "LINKDROP_PROXY_CONTRACT_NOT_DEPLOYED"); return ILinkdropERC721(deployed[salt(_linkdropMaster, _campaignId)]).checkClaimParamsERC721 ( _weiAmount, _nftAddress, _tokenId, _expiration, _linkId, _linkdropSignerSignature, _receiver, _receiverSignature ); } /** * @dev Function to claim ETH and/or ERC721 token * @param _weiAmount Amount of wei to be claimed * @param _nftAddress NFT address * @param _tokenId Token id to be claimed * @param _expiration Unix timestamp of link expiration time * @param _linkId Address corresponding to link key * @param _linkdropMaster Address corresponding to linkdrop master key * @param _campaignId Campaign id * @param _linkdropSignerSignature ECDSA signature of linkdrop signer * @param _receiver Address of linkdrop receiver * @param _receiverSignature ECDSA signature of linkdrop receiver * @return True if success */ function claimERC721 ( uint _weiAmount, address _nftAddress, uint _tokenId, uint _expiration, address _linkId, address payable _linkdropMaster, uint _campaignId, bytes calldata _linkdropSignerSignature, address payable _receiver, bytes calldata _receiverSignature ) external override returns (bool) { // Make sure proxy contract is deployed require(isDeployed(_linkdropMaster, _campaignId), "LINKDROP_PROXY_CONTRACT_NOT_DEPLOYED"); // Call claim function in the context of proxy contract ILinkdropERC721(deployed[salt(_linkdropMaster, _campaignId)]).claimERC721 ( _weiAmount, _nftAddress, _tokenId, _expiration, _linkId, _linkdropSignerSignature, _receiver, _receiverSignature ); return true; } }