Blockchain / Global / Address

Contract

0x0907162dd0635E8F2dF89af67Fa04af74341C032

Balance
0 SOMI
Transactions sent
1
Type
Contract · 3,835 bytes of code

MultiPassPurchaser Verified

Compiler
solc 0.8.29+commit.ab55807c
Language
Solidity
Optimization
No
EVM version
paris
License
—
Verified
2026-10-12

somnex-genesis-pass-nft/tool/MultiPassPurchaser.sol

and 10 more files

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../SomnexGenesisPassManager.sol";

/**
 * @title MultiPassPurchaser
 * @dev This contract allows purchasing multiple NFT types in a single transaction
 */
contract MultiPassPurchaser {
    // Structure to hold purchase parameters
    struct PurchaseParams {
        address nftContract;  // Address of the NFT contract
        uint256 amount;       // Number of NFTs to purchase
    }

    /**
     * @dev Multi-buy function to purchase multiple NFT types in one transaction
     * @param purchases Array of purchase parameters
     * @param paymentToken Address of the payment token
     * @param passManager Address of the pass manager contract
     */
    function multiBuy(
        PurchaseParams[] calldata purchases,
        IERC20 paymentToken,
        SomnexGenesisPassManager passManager,
        address to
    ) public {
        require(purchases.length > 0, "No purchases specified");
        
        // Calculate total cost first
        uint256 totalCost = 0;
        uint256[] memory mintPrices = new uint256[](purchases.length);
        
        for (uint256 i = 0; i < purchases.length; i++) {
            PurchaseParams calldata purchase = purchases[i];
            require(purchase.amount > 0, "Purchase amount must be greater than zero");
            
            // Get pass type from the NFT contract
            (bool success, bytes memory data) = purchase.nftContract.staticcall(
                abi.encodePacked(bytes4(keccak256(bytes("PASS_TYPE()")))));
                
            require(success, "Failed to get pass type from contract");
            
            uint256 price = passManager.getMintPrice(abi.decode(data, (uint8)));
            mintPrices[i] = price;
            totalCost += price * purchase.amount;
        }

        require(paymentToken.transferFrom(msg.sender, address(this), totalCost), "Failed to transfer payment token");
        
        // Execute all purchases
        for (uint256 i = 0; i < purchases.length; i++) {
            PurchaseParams calldata purchase = purchases[i];
            
            paymentToken.approve(purchase.nftContract, purchase.amount * mintPrices[i]);
            // Call the buy function on the specific NFT contract
            (bool success, ) = purchase.nftContract.call(
                abi.encodeWithSignature("buy(uint256,address)", purchase.amount, to)
            );
            
            require(success, "Failed to execute buy");
        }
    }
    
    /**
     * @dev Get team wallet address from an NFT contract
     * @param nftContract Address of the NFT contract
     */
    function getTeamWallet(address nftContract) private view returns (address) {
        (bool success, bytes memory data) = nftContract.staticcall(
            abi.encodePacked(bytes4(keccak256(bytes("team()")))));
            
        if (success) {
            return abi.decode(data, (address));
        }
        
        return address(0);
    }
}

Other files

  • @openzeppelin/contracts/utils/introspection/IERC165.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
    
    pragma solidity >=0.4.16;
    
    /**
     * @dev Interface of the ERC-165 standard, as defined in the
     * https://eips.ethereum.org/EIPS/eip-165[ERC].
     *
     * 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[ERC 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);
    }
    
  • @openzeppelin/contracts/utils/Errors.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
    
    pragma solidity ^0.8.20;
    
    /**
     * @dev Collection of common custom errors used in multiple contracts
     *
     * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
     * It is recommended to avoid relying on the error API for critical functionality.
     *
     * _Available since v5.1._
     */
    library Errors {
        /**
         * @dev The ETH balance of the account is not enough to perform the operation.
         */
        error InsufficientBalance(uint256 balance, uint256 needed);
    
        /**
         * @dev A call to an address target failed. The target may have reverted.
         */
        error FailedCall();
    
        /**
         * @dev The deployment failed.
         */
        error FailedDeployment();
    
        /**
         * @dev A necessary precompile is missing.
         */
        error MissingPrecompile(address);
    }
    
  • @openzeppelin/contracts/access/Ownable.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
    
    pragma solidity ^0.8.20;
    
    import {Context} from "../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.
     *
     * The initial owner is set to the address provided by the deployer. 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;
    
        /**
         * @dev The caller account is not authorized to perform an operation.
         */
        error OwnableUnauthorizedAccount(address account);
    
        /**
         * @dev The owner is not a valid owner account. (eg. `address(0)`)
         */
        error OwnableInvalidOwner(address owner);
    
        event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    
        /**
         * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
         */
        constructor(address initialOwner) {
            if (initialOwner == address(0)) {
                revert OwnableInvalidOwner(address(0));
            }
            _transferOwnership(initialOwner);
        }
    
        /**
         * @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 {
            if (owner() != _msgSender()) {
                revert OwnableUnauthorizedAccount(_msgSender());
            }
        }
    
        /**
         * @dev Leaves the contract without owner. It will not be possible to call
         * `onlyOwner` functions. Can only be called by the current owner.
         *
         * NOTE: Renouncing ownership will leave the contract without an owner,
         * thereby disabling 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 {
            if (newOwner == address(0)) {
                revert OwnableInvalidOwner(address(0));
            }
            _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);
        }
    }
    
  • @openzeppelin/contracts/access/Ownable2Step.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)
    
    pragma solidity ^0.8.20;
    
    import {Ownable} from "./Ownable.sol";
    
    /**
     * @dev Contract module which provides access control mechanism, where
     * there is an account (an owner) that can be granted exclusive access to
     * specific functions.
     *
     * This extension of the {Ownable} contract includes a two-step mechanism to transfer
     * ownership, where the new owner must call {acceptOwnership} in order to replace the
     * old one. This can help prevent common mistakes, such as transfers of ownership to
     * incorrect accounts, or to contracts that are unable to interact with the
     * permission system.
     *
     * The initial owner is specified at deployment time in the constructor for `Ownable`. This
     * can later be changed with {transferOwnership} and {acceptOwnership}.
     *
     * This module is used through inheritance. It will make available all functions
     * from parent (Ownable).
     */
    abstract contract Ownable2Step is Ownable {
        address private _pendingOwner;
    
        event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
    
        /**
         * @dev Returns the address of the pending owner.
         */
        function pendingOwner() public view virtual returns (address) {
            return _pendingOwner;
        }
    
        /**
         * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
         * Can only be called by the current owner.
         *
         * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
         */
        function transferOwnership(address newOwner) public virtual override onlyOwner {
            _pendingOwner = newOwner;
            emit OwnershipTransferStarted(owner(), newOwner);
        }
    
        /**
         * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
         * Internal function without access restriction.
         */
        function _transferOwnership(address newOwner) internal virtual override {
            delete _pendingOwner;
            super._transferOwnership(newOwner);
        }
    
        /**
         * @dev The new owner accepts the ownership transfer.
         */
        function acceptOwnership() public virtual {
            address sender = _msgSender();
            if (pendingOwner() != sender) {
                revert OwnableUnauthorizedAccount(sender);
            }
            _transferOwnership(sender);
        }
    }
    
  • @openzeppelin/contracts/token/ERC20/IERC20.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
    
    pragma solidity >=0.4.16;
    
    /**
     * @dev Interface of the ERC-20 standard as defined in the ERC.
     */
    interface IERC20 {
        /**
         * @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);
    
        /**
         * @dev Returns the value of tokens in existence.
         */
        function totalSupply() external view returns (uint256);
    
        /**
         * @dev Returns the value of tokens owned by `account`.
         */
        function balanceOf(address account) external view returns (uint256);
    
        /**
         * @dev Moves a `value` amount of tokens from the caller's account to `to`.
         *
         * Returns a boolean value indicating whether the operation succeeded.
         *
         * Emits a {Transfer} event.
         */
        function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool);
    
        /**
         * @dev Moves a `value` amount of tokens from `from` to `to` using the
         * allowance mechanism. `value` is then deducted from the caller's
         * allowance.
         *
         * Returns a boolean value indicating whether the operation succeeded.
         *
         * Emits a {Transfer} event.
         */
        function transferFrom(address from, address to, uint256 value) external returns (bool);
    }
    
  • @openzeppelin/contracts/token/ERC721/IERC721.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)
    
    pragma solidity >=0.6.2;
    
    import {IERC165} from "../../utils/introspection/IERC165.sol";
    
    /**
     * @dev Required interface of an ERC-721 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`.
         *
         * 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;
    
        /**
         * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
         * are aware of the ERC-721 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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
         * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
         * understand this adds an external call which potentially creates a reentrancy vulnerability.
         *
         * 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 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 address zero.
         *
         * Emits an {ApprovalForAll} event.
         */
        function setApprovalForAll(address operator, bool approved) external;
    
        /**
         * @dev Returns the account approved for `tokenId` token.
         *
         * Requirements:
         *
         * - `tokenId` must exist.
         */
        function getApproved(uint256 tokenId) external view returns (address operator);
    
        /**
         * @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);
    }
    
  • @openzeppelin/contracts/utils/Address.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)
    
    pragma solidity ^0.8.20;
    
    import {Errors} from "./Errors.sol";
    
    /**
     * @dev Collection of functions related to the address type
     */
    library Address {
        /**
         * @dev There's no code at `target` (it is not a contract).
         */
        error AddressEmptyCode(address target);
    
        /**
         * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
         */
        function sendValue(address payable recipient, uint256 amount) internal {
            if (address(this).balance < amount) {
                revert Errors.InsufficientBalance(address(this).balance, amount);
            }
    
            (bool success, bytes memory returndata) = recipient.call{value: amount}("");
            if (!success) {
                _revert(returndata);
            }
        }
    
        /**
         * @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 or custom error, it is bubbled
         * up by this function (like regular Solidity function calls). However, if
         * the call reverted with no returned reason, this function reverts with a
         * {Errors.FailedCall} error.
         *
         * 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.
         */
        function functionCall(address target, bytes memory data) internal returns (bytes memory) {
            return functionCallWithValue(target, data, 0);
        }
    
        /**
         * @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`.
         */
        function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
            if (address(this).balance < value) {
                revert Errors.InsufficientBalance(address(this).balance, value);
            }
            (bool success, bytes memory returndata) = target.call{value: value}(data);
            return verifyCallResultFromTarget(target, success, returndata);
        }
    
        /**
         * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
         * but performing a static call.
         */
        function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
            (bool success, bytes memory returndata) = target.staticcall(data);
            return verifyCallResultFromTarget(target, success, returndata);
        }
    
        /**
         * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
         * but performing a delegate call.
         */
        function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
            (bool success, bytes memory returndata) = target.delegatecall(data);
            return verifyCallResultFromTarget(target, success, returndata);
        }
    
        /**
         * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
         * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
         * of an unsuccessful call.
         */
        function verifyCallResultFromTarget(
            address target,
            bool success,
            bytes memory returndata
        ) internal view returns (bytes memory) {
            if (!success) {
                _revert(returndata);
            } else {
                // only check if target is a contract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                if (returndata.length == 0 && target.code.length == 0) {
                    revert AddressEmptyCode(target);
                }
                return returndata;
            }
        }
    
        /**
         * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
         * revert reason or with a default {Errors.FailedCall} error.
         */
        function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
            if (!success) {
                _revert(returndata);
            } else {
                return returndata;
            }
        }
    
        /**
         * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
         */
        function _revert(bytes memory returndata) private pure {
            // 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
                assembly ("memory-safe") {
                    revert(add(returndata, 0x20), mload(returndata))
                }
            } else {
                revert Errors.FailedCall();
            }
        }
    }
    
  • @openzeppelin/contracts/utils/Context.sol
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
    
    pragma solidity ^0.8.20;
    
    /**
     * @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;
        }
    
        function _contextSuffixLength() internal view virtual returns (uint256) {
            return 0;
        }
    }
    
  • somnex-genesis-pass-nft/SomnexGenesisPassManager.sol
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.0;
    
    import "@openzeppelin/contracts/access/Ownable2Step.sol";
    import "@openzeppelin/contracts/utils/Context.sol";
    import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
    import "./interfaces/IGenesisERC721.sol";
    
    /**
     * @title SomnexGenesisPassManager
     * @dev This contract manages the minting parameters for different pass types
     */
    contract SomnexGenesisPassManager is Ownable2Step {
        // Structure to hold minting parameters
        struct MintParams {
            uint256 price;
            uint256 maxSupply;
        }
    
        // Mapping from pass type to its minting parameters
        mapping(uint8 => MintParams) private _mintParams;
        uint256 public typeCount;
        address private _team; // Team wallet address
    
        /**
         * @dev Emitted when mint price is updated for a pass type
         */
        event MintPriceUpdated(uint8 indexed passType, uint256 newPrice);
    
        /**
         * @dev Emitted when max supply is updated for a pass type
         */
        event MaxSupplyUpdated(uint8 indexed passType, uint256 newSupply);
    
        /**
         * @dev Initializes the contract with provided mint parameters
         * @param initTeam Team wallet address
         * @param passTypes Array of pass types (0 = Silver, 1 = Gold, 2 = Platinum, etc.)
         * @param params Array of MintParams structs corresponding to pass types
         */
        constructor(
            address initTeam,
            uint8[] memory passTypes,
            MintParams[] memory params
        ) Ownable(msg.sender) {
            require(passTypes.length == params.length, 
                "Arrays length mismatch");
            require(passTypes.length > 0, "At least one pass type required");
            
            for (uint256 i = 0; i < passTypes.length; i++) {
                uint8 passType = passTypes[i];
                _mintParams[passType] = MintParams({
                    price: params[i].price,
                    maxSupply: params[i].maxSupply
                });
            }
            typeCount = passTypes.length;
            _team = initTeam;
        }
    
        function team() public view returns (address) {
            return _team;
        }
    
        function setTeam(address newTeam) public onlyOwner {
            require(newTeam != address(0), "Team address cannot be zero");
            _team = newTeam;
        }
    
        /**
         * @dev Returns the mint price for a given pass type
         * @param passType The type of pass (0 = Silver, 1 = Gold, 2 = Platinum)
         */
        function getMintPrice(uint8 passType) public view returns (uint256) {
            return _mintParams[passType].price;
        }
    
        /**
         * @dev Returns the max supply for a given pass type
         * @param passType The type of pass (0 = Silver, 1 = Gold, 2 = Platinum)
         */
        function getMaxSupply(uint8 passType) public view returns (uint256) {
            return _mintParams[passType].maxSupply;
        }
    
        function getParam(uint8 passType) public view returns (uint256 price, uint256 maxSupply) {
            MintParams memory params = _mintParams[passType];
            return (params.price, params.maxSupply);
        }
    
        function getAllTypesMintParams() public view returns (MintParams[] memory) {
            MintParams[] memory mintParams_ = new MintParams[](typeCount);
            for (uint256 i = 0; i < typeCount; i++) {
                mintParams_[i] = _mintParams[uint8(i)];
            }
            return mintParams_;
        }
        
        /**
         * @dev Updates the mint price for a specific pass type
         * @param passType The type of pass (0 = Silver, 1 = Gold, 2 = Platinum)
         * @param newPrice The new mint price in wei
         */
        function setMintPrice(uint8 passType, uint256 newPrice) external onlyOwner {
            require(passType < typeCount, "Invalid pass type");
            _mintParams[passType].price = newPrice;
            emit MintPriceUpdated(passType, newPrice);
        }
    
        /**
         * @dev Updates the max supply for a specific pass type
         * @param passType The type of pass (0 = Silver, 1 = Gold, 2 = Platinum)
         * @param newSupply The new max supply
         */
        function setMaxSupply(uint8 passType, uint256 newSupply) external onlyOwner {
            require(passType < typeCount, "Invalid pass type");
            _mintParams[passType].maxSupply = newSupply;
            emit MaxSupplyUpdated(passType, newSupply);
        }
    
        /**
         * @dev Sets the mint parameters for a specific pass type or adds a new type if it doesn't exist yet
         * @param passType The type of pass (0 = Silver, 1 = Gold, 2 = Platinum)
         * @param price The mint price in wei
         * @param maxSupply  The max supply
         */
        function setParam(
            uint8 passType,
            uint256 price,
            uint256 maxSupply
        ) external onlyOwner {
            require(passType <= typeCount, "Invalid pass type");
            if (passType == typeCount) {
                typeCount++;
            }
            _mintParams[passType] = MintParams({
                price: price,
                maxSupply: maxSupply
            });
            emit MintPriceUpdated(passType, price);
            emit MaxSupplyUpdated(passType, maxSupply);
        }
    
        function setBaseURI(address nftContract, string memory baseURI) external onlyOwner {
            IGenesisERC721(nftContract).setBaseURI(baseURI);
        }
    }
    
  • somnex-genesis-pass-nft/interfaces/IGenesisERC721.sol
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.0;
    
    interface IGenesisERC721 {
        function PASS_TYPE() external view returns (uint8);
        function buy(uint256 amount, address to) external;
        function maxSupply() external view returns (uint256);
        function setBaseURI(string memory baseURI_) external;
        function tokenURI(uint256 tokenId) external view returns (string memory);
    }
ABI · 1 entries
json
[
  {
    "name": "multiBuy",
    "type": "function",
    "inputs": [
      {
        "name": "purchases",
        "type": "tuple[]",
        "components": [
          {
            "name": "nftContract",
            "type": "address",
            "internalType": "address"
          },
          {
            "name": "amount",
            "type": "uint256",
            "internalType": "uint256"
          }
        ],
        "internalType": "struct MultiPassPurchaser.PurchaseParams[]"
      },
      {
        "name": "paymentToken",
        "type": "address",
        "internalType": "contract IERC20"
      },
      {
        "name": "passManager",
        "type": "address",
        "internalType": "contract SomnexGenesisPassManager"
      },
      {
        "name": "to",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  }
]