ETH Price: $2,863.82 (-2.95%)

Contract

0xA657a123610D27EDC71B83c390F1CE2B651E2626
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xF2d69cf6...B34928D48
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ModuleGlobals

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT

pragma solidity 0.8.18;

import {Errors} from "../../../libraries/Errors.sol";
import {Events} from "../../../libraries/Events.sol";
import {IModuleGlobals} from "../../../interfaces/IModuleGlobals.sol";

/**
 * @title ModuleGlobals
 * @author Lens Protocol
 *
 * @notice This contract contains data relevant to Lens modules, such as the module governance address, treasury
 * address and treasury fee BPS.
 *
 * NOTE: The reason we have an additional governance address instead of just fetching it from the hub is to
 * allow the flexibility of using different governance executors.
 */
contract ModuleGlobals is IModuleGlobals {
    uint16 internal constant BPS_MAX = 10000;

    mapping(address => bool) internal _currencyWhitelisted;
    address internal _governance;
    address internal _treasury;
    uint16 internal _treasuryFee;

    modifier onlyGov() {
        if (msg.sender != _governance) revert Errors.NotGovernance();
        _;
    }

    /**
     * @notice Initializes the governance, treasury and treasury fee amounts.
     *
     * @param governance The governance address which has additional control over setting certain parameters.
     * @param treasury The treasury address to direct fees to.
     * @param treasuryFee The treasury fee in BPS to levy on collects.
     */
    constructor(address governance, address treasury, uint16 treasuryFee) {
        _setGovernance(governance);
        _setTreasury(treasury);
        _setTreasuryFee(treasuryFee);
        _currencyWhitelisted[address(0x1)] = true;
        // _currencyWhitelisted[
        //     address(0x4300000000000000000000000000000000000003)
        // ] = true;
        // _currencyWhitelisted[
        //     address(0x4300000000000000000000000000000000000004)
        // ] = true;
    }

    /// @inheritdoc IModuleGlobals
    function setGovernance(address newGovernance) external override onlyGov {
        _setGovernance(newGovernance);
    }

    /// @inheritdoc IModuleGlobals
    function setTreasury(address newTreasury) external override onlyGov {
        _setTreasury(newTreasury);
    }

    /// @inheritdoc IModuleGlobals
    function setTreasuryFee(uint16 newTreasuryFee) external override onlyGov {
        _setTreasuryFee(newTreasuryFee);
    }

    /// @inheritdoc IModuleGlobals
    function whitelistCurrency(
        address currency,
        bool toWhitelist
    ) external override onlyGov {
        _whitelistCurrency(currency, toWhitelist);
    }

    /// @inheritdoc IModuleGlobals
    function isCurrencyWhitelisted(
        address currency
    ) external view override returns (bool) {
        return _currencyWhitelisted[currency];
    }

    /// @inheritdoc IModuleGlobals
    function getGovernance() external view override returns (address) {
        return _governance;
    }

    /// @inheritdoc IModuleGlobals
    function getTreasury() external view override returns (address) {
        return _treasury;
    }

    /// @inheritdoc IModuleGlobals
    function getTreasuryFee() external view override returns (uint16) {
        return _treasuryFee;
    }

    //@inheritdoc IModuleGlobals
    function getTreasuryData()
        external
        view
        override
        returns (address, uint16)
    {
        return (_treasury, _treasuryFee);
    }

    function _setGovernance(address newGovernance) internal {
        if (newGovernance == address(0)) revert Errors.InitParamsInvalid();
        address prevGovernance = _governance;
        _governance = newGovernance;
        emit Events.ModuleGlobalsGovernanceSet(prevGovernance, newGovernance);
    }

    function _setTreasury(address newTreasury) internal {
        if (newTreasury == address(0)) revert Errors.InitParamsInvalid();
        address prevTreasury = _treasury;
        _treasury = newTreasury;
        emit Events.ModuleGlobalsTreasurySet(prevTreasury, newTreasury);
    }

    function _setTreasuryFee(uint16 newTreasuryFee) internal {
        if (newTreasuryFee > BPS_MAX / 10) revert Errors.InitParamsInvalid();
        uint16 prevTreasuryFee = _treasuryFee;
        _treasuryFee = newTreasuryFee;
        emit Events.ModuleGlobalsTreasuryFeeSet(
            prevTreasuryFee,
            newTreasuryFee
        );
    }

    function _whitelistCurrency(address currency, bool toWhitelist) internal {
        if (currency == address(0)) revert Errors.InitParamsInvalid();
        bool prevWhitelisted = _currencyWhitelisted[currency];
        _currencyWhitelisted[currency] = toWhitelist;
        emit Events.ModuleGlobalsCurrencyWhitelisted(
            currency,
            prevWhitelisted,
            toWhitelist
        );
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.18;

/**
 * @title IModuleGlobals
 * @author Lens Protocol
 *
 * @notice This is the interface for the ModuleGlobals contract, a data providing contract to be queried by modules
 * for the most up-to-date parameters.
 */
interface IModuleGlobals {
    /**
     * @notice Sets the governance address. This function can only be called by governance.
     *
     * @param newGovernance The new governance address to set.
     */
    function setGovernance(address newGovernance) external;

    /**
     * @notice Sets the treasury address. This function can only be called by governance.
     *
     * @param newTreasury The new treasury address to set.
     */
    function setTreasury(address newTreasury) external;

    /**
     * @notice Sets the treasury fee. This function can only be called by governance.
     *
     * @param newTreasuryFee The new treasury fee to set.
     */
    function setTreasuryFee(uint16 newTreasuryFee) external;

    /**
     * @notice Adds or removes a currency from the whitelist. This function can only be called by governance.
     *
     * @param currency The currency to add or remove from the whitelist.
     * @param toWhitelist Whether to add or remove the currency from the whitelist.
     */
    function whitelistCurrency(address currency, bool toWhitelist) external;

    /// ************************
    /// *****VIEW FUNCTIONS*****
    /// ************************

    /**
     * @notice Returns whether a currency is whitelisted.
     *
     * @param currency The currency to query the whitelist for.
     *
     * @return bool True if the queried currency is whitelisted, false otherwise.
     */
    function isCurrencyWhitelisted(
        address currency
    ) external view returns (bool);

    /**
     * @notice Returns the governance address.
     *
     * @return address The governance address.
     */
    function getGovernance() external view returns (address);

    /**
     * @notice Returns the treasury address.
     *
     * @return address The treasury address.
     */
    function getTreasury() external view returns (address);

    /**
     * @notice Returns the treasury fee.
     *
     * @return uint16 The treasury fee.
     */
    function getTreasuryFee() external view returns (uint16);

    /**
     * @notice Returns the treasury address and treasury fee in a single call.
     *
     * @return tuplee First, the treasury address, second, the treasury fee.
     */
    function getTreasuryData() external view returns (address, uint16);
}

File 3 of 5 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

library DataTypes {
    enum State {
        OpenForAll,
        CreateCollectionPaused,
        Paused
    }

    struct CreateNewCollectionData {
        uint256 royalty;
        string collInfoURI;
        string collName;
        string collSymbol;
        address derivedRuleModule;
        bytes derivedRuleModuleInitData;
    }

    struct CreateNewNFTData {
        uint256 collectionId;
        string nftInfoURI;
        uint256 derivedFrom;
        bytes derivedModuleData;
        bytes32[] proof;
    }

    struct LimitBurnToken {
        uint256 collectionId;
        uint256 tokenId;
    }

    struct EIP712Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
        uint256 deadline;
    }
}

File 4 of 5 : Errors.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.18;

library Errors {
    error NotGovernance();
    error NotCollectionOwner();

    error InitParamsInvalid();
    error CannotInitImplementation();
    error Initialized();
    error Paused();
    error NotOwnerOrApproved();
    error NotHub();
    error AlreadyTrade();
    error RoyaltyTooHigh();
    error DerivedRuleModuleNotWhitelisted();

    error CollectionIdNotExist();
    error JustOwnerCanPublishRootNode();
    error ModuleDataMismatch();
    error MintLimitExceeded();
    error MintExpired();

    error BurnExpiredOneWeek();
    error DerivedFromNFTNotExist();
    error NotInWhiteList();

    error CanNotDeleteZeroNFT();

    error EmptyMerkleRoot();
    error AlreadyFinish();
    error NotEnoughEth();
    error AlreadyClaimed();
    error MerkleProofVerifyFailed();
    error SendETHFailed();

    error NotArriveClaimTime();
}

File 5 of 5 : Events.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.18;

import {DataTypes} from "./DataTypes.sol";

library Events {
    event GovernanceSet(
        address indexed caller,
        address indexed prevGovernance,
        address indexed newGovernance
    );

    event StateSet(
        address indexed caller,
        DataTypes.State indexed prevState,
        DataTypes.State indexed newState
    );

    event MaxRoyaltySet(
        address indexed caller,
        uint32 indexed prevMaxBaseRoyalty,
        uint32 indexed newMaxBaseRoyalty
    );

    event StakeAndYieldContractAddressSet(
        address indexed caller,
        address indexed prevStakeAndYieldContractAddress,
        address indexed newStakeAndYieldContractAddress
    );

    event CreateCollectionStakeEthAmountSet(
        address indexed caller,
        uint256 indexed prevStakeEthAmount,
        uint256 indexed newStakeEthAmount
    );

    event RoyaltyDataSet(
        address indexed caller,
        address indexed royaltyAddr,
        uint32 indexed percentage
    );

    event NewCollectionCreated(
        address indexed collectionOwner,
        address derivedCollectionAddr,
        address derivedRuleModule,
        address currency,
        uint256 collectionId,
        uint256 baseRoyalty,
        uint256 mintLimit,
        uint256 mintExpired,
        uint256 mintPrice,
        bytes32 whiteListRootHash,
        string collInfoURI,
        string name
    );

    event BurnNFTFromCollection(
        uint256 collectionId,
        uint256 nftId,
        address burner,
        address owner
    );

    event NewNFTCreated(
        uint256 indexed tokenId,
        uint256 indexed collectionId,
        uint256 derivedFrom,
        address collectionAddr,
        address creator,
        string nftInfoURI
    );

    event BaseInitialized(string name, string symbol);

    event DerivedRuleModuleWhitelisted(
        address derivedRuleModule,
        bool whitelist
    );

    /**
     * @notice Emitted when the ModuleGlobals governance address is set.
     *
     * @param prevGovernance The previous governance address.
     * @param newGovernance The new governance address set.
     */
    event ModuleGlobalsGovernanceSet(
        address indexed prevGovernance,
        address indexed newGovernance
    );

    /**
     * @notice Emitted when the ModuleGlobals treasury address is set.
     *
     * @param prevTreasury The previous treasury address.
     * @param newTreasury The new treasury address set.
     */
    event ModuleGlobalsTreasurySet(
        address indexed prevTreasury,
        address indexed newTreasury
    );

    /**
     * @notice Emitted when the ModuleGlobals treasury fee is set.
     *
     * @param prevTreasuryFee The previous treasury fee in BPS.
     * @param newTreasuryFee The new treasury fee in BPS.
     */
    event ModuleGlobalsTreasuryFeeSet(
        uint16 indexed prevTreasuryFee,
        uint16 indexed newTreasuryFee
    );

    /**
     * @notice Emitted when a currency is added to or removed from the ModuleGlobals whitelist.
     *
     * @param currency The currency address.
     * @param prevWhitelisted Whether or not the currency was previously whitelisted.
     * @param whitelisted Whether or not the currency is whitelisted.
     */
    event ModuleGlobalsCurrencyWhitelisted(
        address indexed currency,
        bool indexed prevWhitelisted,
        bool indexed whitelisted
    );

    event SetNewRoundReward(
        uint256 rewardId,
        uint256 rewardAmount,
        bytes32 merkleRoot
    );

    event ClaimYieldAndGas(
        address contractAddr,
        uint256 claimableYield,
        uint256 gasEtherBalance
    );

    event ClaimStakeEth(address staker, uint256 claimAmount);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 20,
    "details": {
      "yul": true
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"governance","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint16","name":"treasuryFee","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InitParamsInvalid","type":"error"},{"inputs":[],"name":"NotGovernance","type":"error"},{"inputs":[],"name":"getGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasuryData","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasuryFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"}],"name":"isCurrencyWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newGovernance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"newTreasuryFee","type":"uint16"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"},{"internalType":"bool","name":"toWhitelist","type":"bool"}],"name":"whitelistCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"}]

0x608060405234801561001057600080fd5b5060405161081f38038061081f83398101604081905261002f9161021f565b61003883610088565b61004182610101565b61004a8161017a565b5050600160008181526020527fada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7d805460ff191690911790555061029c565b6001600160a01b0381166100af576040516348be0eb360e01b815260040160405180910390fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff2c86dc6b0b35e1a39ca30cef142d7d6b22e19a6a80fc6e1aa65d8800cbfaf1f90600090a35050565b6001600160a01b038116610128576040516348be0eb360e01b815260040160405180910390fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5cb4acf97ee6ea8f25a68142111278feba4c06ea62d0133a3eaa607afa0a84b590600090a35050565b610187600a61271061026d565b61ffff168161ffff1611156101af576040516348be0eb360e01b815260040160405180910390fd5b6002805461ffff838116600160a01b81810261ffff60a01b1985161790945560405193909204169182907f2fb9c375d97e4a071d9c39e213c83b0ac8e05a2a38336d9b2f4063e7a337ea8d90600090a35050565b80516001600160a01b038116811461021a57600080fd5b919050565b60008060006060848603121561023457600080fd5b61023d84610203565b925061024b60208501610203565b9150604084015161ffff8116811461026257600080fd5b809150509250925092565b600061ffff8084168061029057634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b610574806102ab6000396000f3fe608060405234801561001057600080fd5b50600436106100835760003560e01c8063289b3c0d1461008857806329070c6d146100b25780633b19e84a146100d357806343b938c5146100e45780638c3bfb1c1461012057806398f965d114610135578063a652db491461015f578063ab033ea914610172578063f0f4426014610185575b600080fd5b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b600254600160a01b900461ffff1660405161ffff90911681526020016100a9565b6002546001600160a01b0316610095565b6101106100f236600461048d565b6001600160a01b031660009081526020819052604090205460ff1690565b60405190151581526020016100a9565b61013361012e3660046104af565b610198565b005b600254604080516001600160a01b0383168152600160a01b90920461ffff166020830152016100a9565b61013361016d3660046104eb565b6101d1565b61013361018036600461048d565b610208565b61013361019336600461048d565b61023c565b6001546001600160a01b031633146101c357604051632d5be4cb60e21b815260040160405180910390fd5b6101cd8282610270565b5050565b6001546001600160a01b031633146101fc57604051632d5be4cb60e21b815260040160405180910390fd5b610205816102f6565b50565b6001546001600160a01b0316331461023357604051632d5be4cb60e21b815260040160405180910390fd5b6102058161037f565b6001546001600160a01b0316331461026757604051632d5be4cb60e21b815260040160405180910390fd5b610205816103f8565b6001600160a01b038216610297576040516348be0eb360e01b815260040160405180910390fd5b6001600160a01b038216600081815260208190526040808220805485151560ff1982168117909255915160ff909216939092841515927f1630cbc8e97f59c3e910b379bee737cfea8536f1759396aac157436108e4ddd19190a4505050565b610303600a61271061050f565b61ffff168161ffff16111561032b576040516348be0eb360e01b815260040160405180910390fd5b6002805461ffff838116600160a01b81810261ffff60a01b1985161790945560405193909204169182907f2fb9c375d97e4a071d9c39e213c83b0ac8e05a2a38336d9b2f4063e7a337ea8d90600090a35050565b6001600160a01b0381166103a6576040516348be0eb360e01b815260040160405180910390fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff2c86dc6b0b35e1a39ca30cef142d7d6b22e19a6a80fc6e1aa65d8800cbfaf1f90600090a35050565b6001600160a01b03811661041f576040516348be0eb360e01b815260040160405180910390fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5cb4acf97ee6ea8f25a68142111278feba4c06ea62d0133a3eaa607afa0a84b590600090a35050565b80356001600160a01b038116811461048857600080fd5b919050565b60006020828403121561049f57600080fd5b6104a882610471565b9392505050565b600080604083850312156104c257600080fd5b6104cb83610471565b9150602083013580151581146104e057600080fd5b809150509250929050565b6000602082840312156104fd57600080fd5b813561ffff811681146104a857600080fd5b600061ffff8084168061053257634e487b7160e01b600052601260045260246000fd5b9216919091049291505056fea264697066735822122005a10aa940cf6c7ba32a0a7a59b1186eafb8bd89d72c4c44bbf304e01973169764736f6c634300081200330000000000000000000000004e52df5f38f417db6a2a2325fc4cf69ee2c87fe20000000000000000000000004e52df5f38f417db6a2a2325fc4cf69ee2c87fe200000000000000000000000000000000000000000000000000000000000003e8

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100835760003560e01c8063289b3c0d1461008857806329070c6d146100b25780633b19e84a146100d357806343b938c5146100e45780638c3bfb1c1461012057806398f965d114610135578063a652db491461015f578063ab033ea914610172578063f0f4426014610185575b600080fd5b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b600254600160a01b900461ffff1660405161ffff90911681526020016100a9565b6002546001600160a01b0316610095565b6101106100f236600461048d565b6001600160a01b031660009081526020819052604090205460ff1690565b60405190151581526020016100a9565b61013361012e3660046104af565b610198565b005b600254604080516001600160a01b0383168152600160a01b90920461ffff166020830152016100a9565b61013361016d3660046104eb565b6101d1565b61013361018036600461048d565b610208565b61013361019336600461048d565b61023c565b6001546001600160a01b031633146101c357604051632d5be4cb60e21b815260040160405180910390fd5b6101cd8282610270565b5050565b6001546001600160a01b031633146101fc57604051632d5be4cb60e21b815260040160405180910390fd5b610205816102f6565b50565b6001546001600160a01b0316331461023357604051632d5be4cb60e21b815260040160405180910390fd5b6102058161037f565b6001546001600160a01b0316331461026757604051632d5be4cb60e21b815260040160405180910390fd5b610205816103f8565b6001600160a01b038216610297576040516348be0eb360e01b815260040160405180910390fd5b6001600160a01b038216600081815260208190526040808220805485151560ff1982168117909255915160ff909216939092841515927f1630cbc8e97f59c3e910b379bee737cfea8536f1759396aac157436108e4ddd19190a4505050565b610303600a61271061050f565b61ffff168161ffff16111561032b576040516348be0eb360e01b815260040160405180910390fd5b6002805461ffff838116600160a01b81810261ffff60a01b1985161790945560405193909204169182907f2fb9c375d97e4a071d9c39e213c83b0ac8e05a2a38336d9b2f4063e7a337ea8d90600090a35050565b6001600160a01b0381166103a6576040516348be0eb360e01b815260040160405180910390fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff2c86dc6b0b35e1a39ca30cef142d7d6b22e19a6a80fc6e1aa65d8800cbfaf1f90600090a35050565b6001600160a01b03811661041f576040516348be0eb360e01b815260040160405180910390fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5cb4acf97ee6ea8f25a68142111278feba4c06ea62d0133a3eaa607afa0a84b590600090a35050565b80356001600160a01b038116811461048857600080fd5b919050565b60006020828403121561049f57600080fd5b6104a882610471565b9392505050565b600080604083850312156104c257600080fd5b6104cb83610471565b9150602083013580151581146104e057600080fd5b809150509250929050565b6000602082840312156104fd57600080fd5b813561ffff811681146104a857600080fd5b600061ffff8084168061053257634e487b7160e01b600052601260045260246000fd5b9216919091049291505056fea264697066735822122005a10aa940cf6c7ba32a0a7a59b1186eafb8bd89d72c4c44bbf304e01973169764736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.