Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/GiftMintMulticall.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import { ReentrancyGuard } from "solmate/utils/ReentrancyGuard.sol";
import { Ownable } from "openzeppelin-contracts/access/Ownable.sol";
interface INonFungibleSeaDropToken {
function mintSeaDrop(address minter, uint256 quantity) external;
function owner() external view returns (address);
}
/**
* @title GiftMintMulticall
* @notice Multicall contract that enables gift minting functionality for SeaDrop NFTs.
* Users can pay to mint tokens directly to recipients' addresses.
* @dev This contract must be added as an allowed payer on target NFT contracts.
*/
contract GiftMintMulticall is Ownable, ReentrancyGuard {
/// @notice Track allowed NFT contracts for gift minting
mapping(address => bool) public allowedContracts;
/// @notice Track gift mint prices per contract
mapping(address => uint256) public giftMintPrices;
/// @notice SeaDrop contract address
address public immutable seaDropContract;
/// @notice Platform fee basis points (e.g., 250 = 2.5%)
uint256 public platformFeeBps = 250;
/// @notice Platform fee recipient
address public platformFeeRecipient;
// Events
event GiftMintExecuted(
address indexed nftContract,
address indexed payer,
address indexed recipient,
uint256 quantity,
uint256 totalPrice
);
event ContractAllowed(address indexed nftContract, bool allowed);
event GiftPriceUpdated(address indexed nftContract, uint256 newPrice);
event PlatformFeeUpdated(uint256 newFeeBps);
event PlatformFeeRecipientUpdated(address newRecipient);
constructor(
address _seaDropContract,
address _platformFeeRecipient
) {
if (_seaDropContract == address(0)) revert("Invalid SeaDrop address");
if (_platformFeeRecipient == address(0)) revert("Invalid fee recipient");
seaDropContract = _seaDropContract;
platformFeeRecipient = _platformFeeRecipient;
}
/**
* @notice Execute a gift mint - user pays, tokens go to recipient
* @param nftContract The NFT contract to mint from
* @param recipient Address to receive the minted tokens
* @param quantity Number of tokens to mint
*/
function giftMint(
address nftContract,
address recipient,
uint256 quantity
) external payable nonReentrant {
if (!allowedContracts[nftContract]) revert("Contract not allowed");
if (recipient == address(0)) revert("Invalid recipient");
if (quantity == 0) revert("Invalid quantity");
uint256 giftPrice = giftMintPrices[nftContract];
uint256 totalCost = giftPrice * quantity;
if (msg.value < totalCost) revert("Insufficient payment");
// Calculate platform fee
uint256 platformFee = (totalCost * platformFeeBps) / 10000;
uint256 creatorPayment = totalCost - platformFee;
// Execute the mint
// This multicall contract must be added as an allowed payer
// in the NFT contract's _allowedSeaDrop mapping
INonFungibleSeaDropToken(nftContract).mintSeaDrop(recipient, quantity);
// Distribute payments
if (platformFee > 0) {
(bool platformSuccess, ) = payable(platformFeeRecipient).call{value: platformFee}("");
if (!platformSuccess) revert("Platform fee transfer failed");
}
if (creatorPayment > 0) {
// Get creator payout address from the NFT contract
address creator = INonFungibleSeaDropToken(nftContract).owner();
(bool creatorSuccess, ) = payable(creator).call{value: creatorPayment}("");
if (!creatorSuccess) revert("Creator payment transfer failed");
}
// Refund excess payment
if (msg.value > totalCost) {
(bool refundSuccess, ) = payable(msg.sender).call{value: msg.value - totalCost}("");
if (!refundSuccess) revert("Refund transfer failed");
}
emit GiftMintExecuted(nftContract, msg.sender, recipient, quantity, totalCost);
}
/**
* @notice Batch gift mint to multiple recipients
* @param nftContract The NFT contract to mint from
* @param recipients Array of addresses to receive tokens
* @param quantities Array of quantities for each recipient
*/
function giftMintBatch(
address nftContract,
address[] calldata recipients,
uint256[] calldata quantities
) external payable nonReentrant {
if (!allowedContracts[nftContract]) revert("Contract not allowed");
uint256 length = recipients.length;
if (length != quantities.length) revert("Array length mismatch");
if (length == 0) revert("Empty arrays");
uint256 totalQuantity = 0;
for (uint256 i = 0; i < length;) {
if (recipients[i] == address(0)) revert("Invalid recipient");
if (quantities[i] == 0) revert("Invalid quantity");
totalQuantity += quantities[i];
unchecked { ++i; }
}
uint256 giftPrice = giftMintPrices[nftContract];
uint256 totalCost = giftPrice * totalQuantity;
if (msg.value < totalCost) revert("Insufficient payment");
// Execute mints
for (uint256 i = 0; i < length;) {
INonFungibleSeaDropToken(nftContract).mintSeaDrop(
recipients[i],
quantities[i]
);
emit GiftMintExecuted(nftContract, msg.sender, recipients[i], quantities[i], giftPrice * quantities[i]);
unchecked { ++i; }
}
// Handle payments (similar to single mint)
uint256 platformFee = (totalCost * platformFeeBps) / 10000;
uint256 creatorPayment = totalCost - platformFee;
if (platformFee > 0) {
(bool platformSuccess, ) = payable(platformFeeRecipient).call{value: platformFee}("");
if (!platformSuccess) revert("Platform fee transfer failed");
}
if (creatorPayment > 0) {
address creator = INonFungibleSeaDropToken(nftContract).owner();
(bool creatorSuccess, ) = payable(creator).call{value: creatorPayment}("");
if (!creatorSuccess) revert("Creator payment transfer failed");
}
// Refund excess payment
if (msg.value > totalCost) {
(bool refundSuccess, ) = payable(msg.sender).call{value: msg.value - totalCost}("");
if (!refundSuccess) revert("Refund transfer failed");
}
}
// ========== ADMIN FUNCTIONS ==========
/**
* @notice Set whether a contract is allowed for gift minting
* @param nftContract The NFT contract address
* @param allowed Whether the contract is allowed
*/
function setAllowedContract(address nftContract, bool allowed) external onlyOwner {
allowedContracts[nftContract] = allowed;
emit ContractAllowed(nftContract, allowed);
}
/**
* @notice Set the gift mint price for a specific NFT contract
* @param nftContract The NFT contract address
* @param price The price in wei per token
*/
function setGiftMintPrice(address nftContract, uint256 price) external onlyOwner {
giftMintPrices[nftContract] = price;
emit GiftPriceUpdated(nftContract, price);
}
/**
* @notice Update the platform fee percentage
* @param feeBps Fee in basis points (max 1000 = 10%)
*/
function setPlatformFee(uint256 feeBps) external onlyOwner {
if (feeBps > 1000) revert("Fee too high"); // Max 10%
platformFeeBps = feeBps;
emit PlatformFeeUpdated(feeBps);
}
/**
* @notice Update the platform fee recipient address
* @param recipient New fee recipient address
*/
function setPlatformFeeRecipient(address recipient) external onlyOwner {
if (recipient == address(0)) revert("Invalid recipient");
platformFeeRecipient = recipient;
emit PlatformFeeRecipientUpdated(recipient);
}
/**
* @notice Emergency withdrawal of stuck funds
* @dev Only callable by owner as a safety mechanism
*/
function emergencyWithdraw() external onlyOwner {
uint256 balance = address(this).balance;
if (balance > 0) {
(bool success, ) = payable(owner()).call{value: balance}("");
if (!success) revert("Withdrawal failed");
}
}
/**
* @notice Get the total cost for a gift mint
* @param nftContract The NFT contract address
* @param quantity Number of tokens to mint
* @return Total cost in wei
*/
function getGiftMintCost(address nftContract, uint256 quantity) external view returns (uint256) {
return giftMintPrices[nftContract] * quantity;
}
}
"
},
"../lib/seadrop/lib/solmate/src/utils/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Gas optimized reentrancy protection for smart contracts.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol)
abstract contract ReentrancyGuard {
uint256 private locked = 1;
modifier nonReentrant() virtual {
require(locked == 1, "REENTRANCY");
locked = 2;
_;
locked = 1;
}
}
"
},
"../lib/seadrop/lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
"
},
"../lib/seadrop/lib/openzeppelin-contracts/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
"
}
},
"settings": {
"remappings": [
"seadrop/=../lib/seadrop/src/",
"@seadrop-interfaces/=../lib/seadrop/src/interfaces/",
"@seadrop-lib/=../lib/seadrop/src/lib/",
"ERC721A/=../lib/seadrop/lib/ERC721A/contracts/",
"openzeppelin-contracts/=../lib/seadrop/lib/openzeppelin-contracts/contracts/",
"solmate/=../lib/seadrop/lib/solmate/src/",
"utility-contracts/=../lib/seadrop/lib/utility-contracts/src/",
"forge-std/=../lib/seadrop/lib/forge-std/src/",
"ERC721A-Upgradeable/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/ERC721A-Upgradeable/contracts/",
"create2-helpers/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/create2-helpers/",
"create2-scripts/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/create2-helpers/script/",
"ds-test/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/ds-test/src/",
"murky/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/murky/src/",
"openzeppelin-contracts-upgradeable/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/openzeppelin-contracts-upgradeable/contracts/",
"operator-filter-registry/=/Users/davidhurley/Desktop/lazer/pranksy-minting-app/lib/seadrop/lib/operator-filter-registry/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "london",
"viaIR": true
}
}}
Submitted on: 2025-11-06 10:20:42
Comments
Log in to comment.
No comments yet.