creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/migration/OPNMintManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\nimport {Owned} from \"@solmate/src/auth/Owned.sol\";\nimport {IOPNToken, IERC20} from \"./interfaces/IOPNToken.sol\";\nimport {IOPNMintManager} from \"./interfaces/IOPNMintManager.sol\";\n\n/**\n * The OPNMintManager contract is used to be the contract managing minting of OPN tokens. It is used by the migration contract to mint tokens for users who have migrated their tokens from the old contract to the new contract.\n *\n * The reason it exists is because the minting of tokens is a sensitive operation and should be managed by a separate contract to the main token contract. This is to ensure that the main token contract is not compromised and that the minting process is transparent and auditable.\n */\ncontract OPNMintManager is IOPNMintManager, Owned {\n    IOPNToken public immutable opnToken;\n\n    uint256 public immutable chainId;\n\n    address public migrationContract;\n\n    address public daoContractAddress;\n\n    constructor(\n        address _initialAdmin,\n        address _daoContractAddress,\n        address _opnTokenAddress,\n        uint256 _chainID\n    ) Owned(_initialAdmin) {\n        opnToken = IOPNToken(_opnTokenAddress);\n        daoContractAddress = _daoContractAddress; // note consider making immutable\n        chainId = _chainID;\n    }\n\n    // Modifiers\n\n    modifier onlyMigrationContract() {\n        require(\n            msg.sender == migrationContract,\n            \"OPNMintManager: UNAUTHORIZED MIGRATION MANAGER\"\n        );\n        _;\n    }\n\n    modifier onlyDAOController() virtual {\n        require(\n            msg.sender == owner,\n            \"OPNMintManager: UNAUTHORIZED ONLY DAO OWNER\"\n        );\n        _;\n    }\n\n    modifier onlyOnEthereum() {\n        if (chainId != 1) return;\n        _;\n    }\n\n    // Operational functions\n\n    /// @inheritdoc IOPNMintManager\n    function issueTokensMigration(\n        address _to,\n        uint256 _amount\n    ) external override onlyMigrationContract {\n        if (chainId == 1) {\n            // mint tokens directly from the contract\n            opnToken.issueTokensMigration(_to, _amount);\n        } else {\n            // transfer mapped tokens to the recipient\n            opnToken.transfer(_to, _amount);\n        }\n    }\n\n    /// @inheritdoc IOPNMintManager\n    function mintTokenPolygonInventory(\n        address _to,\n        uint256 _amount\n    ) external override onlyDAOController onlyOnEthereum {\n        opnToken.mintTokenPolygonInventory(_to, _amount);\n    }\n\n    // Configuration functions\n\n    /// @inheritdoc IOPNMintManager\n    function setMigrationContract(\n        address _migrationContract\n    ) external override onlyDAOController {\n        // set the migration contract address\n        migrationContract = _migrationContract;\n        emit MigrationContractSet(_migrationContract);\n    }\n\n    /// @inheritdoc IOPNMintManager\n    function setDaoContractAddress(\n        address _daoContractAddress\n    ) external override onlyDAOController {\n        daoContractAddress = _daoContractAddress;\n        emit DAOContractAddressSet(_daoContractAddress);\n    }\n\n    /// @inheritdoc IOPNMintManager\n    function setMintManangerInToken(\n        address _newMigrationManager\n    ) external override onlyDAOController onlyOnEthereum {\n        opnToken.setMintManager(_newMigrationManager);\n        emit MintManagerSetInToken(_newMigrationManager);\n    }\n\n    /// @inheritdoc IOPNMintManager\n    function withdrawTokens(\n        address _tokenAddress,\n        uint256 _amount\n    ) external override onlyDAOController {\n        IERC20(_tokenAddress).transfer(msg.sender, _amount);\n    }\n\n    /// @inheritdoc IOPNMintManager\n    function withdrawOPN() external override onlyDAOController {\n        opnToken.transfer(msg.sender, opnToken.balanceOf(address(this)));\n    }\n\n    // View functions\n\n    /// @inheritdoc IOPNMintManager\n    function opnTokenAddress() external view override returns (address) {\n        return address(opnToken);\n    }\n}\n"
      },
      "lib/solmate/src/auth/Owned.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)\nabstract contract Owned {\n    /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event OwnershipTransferred(address indexed user, address indexed newOwner);\n\n    /*//////////////////////////////////////////////////////////////\n                            OWNERSHIP STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    address public owner;\n\n    modifier onlyOwner() virtual {\n        require(msg.sender == owner, \"UNAUTHORIZED\");\n\n        _;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    constructor(address _owner) {\n        owner = _owner;\n\n        emit OwnershipTransferred(address(0), _owner);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                             OWNERSHIP LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        owner = newOwner;\n\n        emit OwnershipTransferred(msg.sender, newOwner);\n    }\n}\n"
      },
      "src/migration/interfaces/IOPNToken.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport {IERC20} from \"erc20/interfaces/IERC20.sol\";\n\ninterface IOPNToken is IERC20 {\n    /// @notice Mint function only callable by the DAO\n    /// @dev this function will be only callable by a DAO governance contract that can only execute functions like these after a majority vote (with quorum) has been reached\n    /// @param _to Address to which tokens will be minted.\n    /// @param _amount Amount of tokens to mint\n    function mintTokensByDAO(address _to, uint256 _amount) external;\n\n    /// @notice Issues tokens during the migration process.\n    /// @dev This function will be only callable by a migration manager contract(burning GET and minting OPN) that will be responsible for minting tokens during the migration process. After the migration the DAO can revoke the minting rights of the migration manager.\n    /// @param _to Address to which tokens will be minted.\n    /// @param _amount Amount of tokens to mint.\n    function issueTokensMigration(address _to, uint256 _amount) external;\n\n    /// @notice Mints tokens for Polygon inventory.\n    /// @dev As to allow GET to be migrated on Polygon this function will be used to mint a certain amount of tokens to the Polygon inventory. This is not inflationary as the tokens are already minted on Ethereum and are just being moved to Polygon.\n    /// @param _to Address to which tokens will be minted.\n    /// @param _amount Amount of tokens to mint.\n    function mintTokenPolygonInventory(address _to, uint256 _amount) external;\n\n    /// @notice Allows token holders to burn their tokens.\n    /// @param _amount Amount of tokens to burn.\n    function burn(uint256 _amount) external;\n\n    /// @notice Finalizes the migration process\n    /// @dev this function disables the migration minting and revokes the minting rights of the migration manager. This function can only be called by the DAO.\n    function finalizeMigration() external;\n\n    /// @notice Sets a new DAO controller address\n    /// @param _newDaoController The address of the new DAO controller.\n    function setDAOControllerAddress(address _newDaoController) external;\n\n    /// @notice Sets a new mint manager address\n    /// @param _newMigrationManager The address of the new mint manager.\n    function setMintManager(address _newMigrationManager) external;\n\n    // View functions\n\n    /// @notice Returns the address of the mint manager.\n    /// @return address of the mint manager.\n    function mintManagerAddress() external view returns (address);\n\n    /// @notice Returns the address of the DAO controller.\n    /// @return address of the DAO controller.\n    function daoControllerAddress() external view returns (address);\n\n    /// @notice Returns whether the migration issuance is disabled permanently\n    function migrationIssuanceDisabledPermanently()\n        external\n        view\n        returns (bool);\n\n    // Events\n\n    event TokensBurned(address indexed from, uint256 amount);\n\n    event MigrationInventoryMint(address indexed to, uint256 amount);\n\n    event MigrationManagerSet(address indexed newMigrationManager);\n\n    event MigrationMint(address indexed to, uint256 amount);\n\n    event DaoMint(address indexed to, uint256 amount);\n\n    event DaoControllerSet(address _newDaoController);\n\n    event MigrationConfigFinalized();\n}\n"
      },
      "src/migration/interfaces/IOPNMintManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\ninterface IOPNMintManager {\n    // Events\n\n    event MigrationMint(address indexed to, uint256 amount);\n\n    event DaoMint(address indexed to, uint256 amount);\n\n    event MigrationContractSet(address migrationContract);\n\n    event DAOContractAddressSet(address daoContractAddress);\n\n    event MintManagerSetInToken(address _newMigrationManager);\n\n    // Functions\n\n    function opnTokenAddress() external view returns (address);\n\n    function issueTokensMigration(address _to, uint256 _amount) external;\n\n    function mintTokenPolygonInventory(address _to, uint256 _amount) external;\n\n    function setDaoContractAddress(address _daoContractAddress) external;\n\n    function setMintManangerInToken(address _newMigrationManager) external;\n\n    function withdrawOPN() external;\n\n    function setMigrationContract(address _migrationContract) external;\n\n    function withdrawTokens(address _tokenAddress, uint256 _amount) external;\n}\n"
      },
      "lib/erc20/contracts/interfaces/IERC20.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.7;\n\n/// @title Interface of the ERC20 standard as defined in the EIP, including EIP-2612 permit functionality.\ninterface IERC20 {\n\n    /**************/\n    /*** Events ***/\n    /**************/\n\n    /**\n     *  @dev   Emitted when one account has set the allowance of another account over their tokens.\n     *  @param owner_   Account that tokens are approved from.\n     *  @param spender_ Account that tokens are approved for.\n     *  @param amount_  Amount of tokens that have been approved.\n     */\n    event Approval(address indexed owner_, address indexed spender_, uint256 amount_);\n\n    /**\n     *  @dev   Emitted when tokens have moved from one account to another.\n     *  @param owner_     Account that tokens have moved from.\n     *  @param recipient_ Account that tokens have moved to.\n     *  @param amount_    Amount of tokens that have been transferred.\n     */\n    event Transfer(address indexed owner_, address indexed recipient_, uint256 amount_);\n\n    /**************************/\n    /*** External Functions ***/\n    /**************************/\n\n    /**\n     *  @dev    Function that allows one account to set the allowance of another account over their tokens.\n     *          Emits an {Approval} event.\n     *  @param  spender_ Account that tokens are approved for.\n     *  @param  amount_  Amount of tokens that have been approved.\n     *  @return success_ Boolean indicating whether the operation succeeded.\n     */\n    function approve(address spender_, uint256 amount_) external returns (bool success_);\n\n    /**\n     *  @dev    Function that allows one account to decrease the allowance of another account over their tokens.\n     *          Emits an {Approval} event.\n     *  @param  spender_          Account that tokens are approved for.\n     *  @param  subtractedAmount_ Amount to decrease approval by.\n     *  @return success_          Boolean indicating whether the operation succeeded.\n     */\n    function decreaseAllowance(address spender_, uint256 subtractedAmount_) external returns (bool success_);\n\n    /**\n     *  @dev    Function that allows one account to increase the allowance of another account over their tokens.\n     *          Emits an {Approval} event.\n     *  @param  spender_     Account that tokens are approved for.\n     *  @param  addedAmount_ Amount to increase approval by.\n     *  @return success_     Boolean indicating whether the operation succeeded.\n     */\n    function increaseAllowance(address spender_, uint256 addedAmount_) external returns (bool success_);\n\n    /**\n     *  @dev   Approve by signature.\n     *  @param owner_    Owner address that signed the permit.\n     *  @param spender_  Spender of the permit.\n     *  @param amount_   Permit approval spend limit.\n     *  @param deadline_ Deadline after which the permit is invalid.\n     *  @param v_        ECDSA signature v component.\n     *  @param r_        ECDSA signature r component.\n     *  @param s_        ECDSA signature s component.\n     */\n    function permit(address owner_, address spender_, uint amount_, uint deadline_, uint8 v_, bytes32 r_, bytes32 s_) external;\n\n    /**\n     *  @dev    Moves an amount of tokens from `msg.sender` to a specified account.\n     *          Emits a {Transfer} event.\n     *  @param  recipient_ Account that receives tokens.\n     *  @param  amount_    Amount of tokens that are transferred.\n     *  @return success_   Boolean indicating whether the operation succeeded.\n     */\n    function transfer(address recipient_, uint256 amount_) external returns (bool success_);\n\n    /**\n     *  @dev    Moves a pre-approved amount of tokens from a sender to a specified account.\n     *          Emits a {Transfer} event.\n     *          Emits an {Approval} event.\n     *  @param  owner_     Account that tokens are moving from.\n     *  @param  recipient_ Account that receives tokens.\n     *  @param  amount_    Amount of tokens that are transferred.\n     *  @return success_   Boolean indicating whether the operation succeeded.\n     */\n    function transferFrom(address owner_, address recipient_, uint256 amount_) external returns (bool success_);\n\n    /**********************/\n    /*** View Functions ***/\n    /**********************/\n\n    /**\n     *  @dev    Returns the allowance that one account has given another over their tokens.\n     *  @param  owner_     Account that tokens are approved from.\n     *  @param  spender_   Account that tokens are approved for.\n     *  @return allowance_ Allowance that one account has given another over their tokens.\n     */\n    function allowance(address owner_, address spender_) external view returns (uint256 allowance_);\n\n    /**\n     *  @dev    Returns the amount of tokens owned by a given account.\n     *  @param  account_ Account that owns the tokens.\n     *  @return balance_ Amount of tokens owned by a given account.\n     */\n    function balanceOf(address account_) external view returns (uint256 balance_);\n\n    /**\n     *  @dev    Returns the decimal precision used by the token.\n     *  @return decimals_ The decimal precision used by the token.\n     */\n    function decimals() external view returns (uint8 decimals_);\n\n    /**\n     *  @dev    Returns the signature domain separator.\n     *  @return domainSeparator_ The signature domain separator.\n     */\n    function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);\n\n    /**\n     *  @dev    Returns the name of the token.\n     *  @return name_ The name of the token.\n     */\n    function name() external view returns (string memory name_);\n\n    /**\n      *  @dev    Returns the nonce for the given owner.\n      *  @param  owner_  The address of the owner account.\n      *  @return nonce_ The nonce for the given owner.\n     */\n    function nonces(address owner_) external view returns (uint256 nonce_);\n\n    /**\n     *  @dev    Returns the symbol of the token.\n     *  @return symbol_ The symbol of the token.\n     */\n    function symbol() external view returns (string memory symbol_);\n\n    /**\n     *  @dev    Returns the total amount of tokens in existence.\n     *  @return totalSupply_ The total amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256 totalSupply_);\n\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@solmate/src/=lib/solmate/src/",
        "forge-std/=lib/forge-std/src/",
        "contract-test-utils/=lib/erc20-helper/lib/contract-test-utils/contracts/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc20-helper/=lib/erc20-helper/src/",
        "erc20/=lib/erc20/contracts/",
        "revenue-distribution-token/=lib/revenue-distribution-token/contracts/",
        "solmate/=lib/solmate/src/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs"
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "london",
      "viaIR": false,
      "libraries": {}
    }
  }}