Blockchain / Global / Address

Contract

0x42f1F37Ed34117041CCbDf60F12ee64bb4380BD1

Balance
0 SOMI
Transactions sent
1
Type
Contract · 4,834 bytes of code

SomnexGenesisPassManager Verified

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

somnex-genesis-pass-nft/SomnexGenesisPassManager.sol

and 6 more files

Solidity
// 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);
    }
}

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);
    }
    
  • 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);
    }
  • @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/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/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;
        }
    }
    
ABI · 23 entries
json
[
  {
    "type": "constructor",
    "inputs": [
      {
        "name": "initTeam",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "passTypes",
        "type": "uint8[]",
        "internalType": "uint8[]"
      },
      {
        "name": "params",
        "type": "tuple[]",
        "components": [
          {
            "name": "price",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "maxSupply",
            "type": "uint256",
            "internalType": "uint256"
          }
        ],
        "internalType": "struct SomnexGenesisPassManager.MintParams[]"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "name": "OwnableInvalidOwner",
    "type": "error",
    "inputs": [
      {
        "name": "owner",
        "type": "address",
        "internalType": "address"
      }
    ]
  },
  {
    "name": "OwnableUnauthorizedAccount",
    "type": "error",
    "inputs": [
      {
        "name": "account",
        "type": "address",
        "internalType": "address"
      }
    ]
  },
  {
    "name": "MaxSupplyUpdated",
    "type": "event",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "indexed": true,
        "internalType": "uint8"
      },
      {
        "name": "newSupply",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "name": "MintPriceUpdated",
    "type": "event",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "indexed": true,
        "internalType": "uint8"
      },
      {
        "name": "newPrice",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "name": "OwnershipTransferStarted",
    "type": "event",
    "inputs": [
      {
        "name": "previousOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "newOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      }
    ],
    "anonymous": false
  },
  {
    "name": "OwnershipTransferred",
    "type": "event",
    "inputs": [
      {
        "name": "previousOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "newOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      }
    ],
    "anonymous": false
  },
  {
    "name": "acceptOwnership",
    "type": "function",
    "inputs": [],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "getAllTypesMintParams",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "tuple[]",
        "components": [
          {
            "name": "price",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "maxSupply",
            "type": "uint256",
            "internalType": "uint256"
          }
        ],
        "internalType": "struct SomnexGenesisPassManager.MintParams[]"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "getMaxSupply",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "getMintPrice",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "getParam",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      }
    ],
    "outputs": [
      {
        "name": "price",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "maxSupply",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "owner",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "pendingOwner",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "renounceOwnership",
    "type": "function",
    "inputs": [],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "setBaseURI",
    "type": "function",
    "inputs": [
      {
        "name": "nftContract",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "baseURI",
        "type": "string",
        "internalType": "string"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "setMaxSupply",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      },
      {
        "name": "newSupply",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "setMintPrice",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      },
      {
        "name": "newPrice",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "setParam",
    "type": "function",
    "inputs": [
      {
        "name": "passType",
        "type": "uint8",
        "internalType": "uint8"
      },
      {
        "name": "price",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "maxSupply",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "setTeam",
    "type": "function",
    "inputs": [
      {
        "name": "newTeam",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "team",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "transferOwnership",
    "type": "function",
    "inputs": [
      {
        "name": "newOwner",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "name": "typeCount",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  }
]