Skip to content
Verified contractPartialMIT

FundBNRV2

Address0xddc86fd7279dc219201839f8a3dd6b411e31e879
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.22

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.22+commit.4fc1097e
Language
solidity
Optimization
Yes, 200 runs
EVM version
berlin
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,320,808
Creation transaction
0x3fee340b65…283afa7029

FundBNRV2.sol



// Sources flattened with hardhat v2.14.1 https://hardhat.org

// File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected]

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// 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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    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;
    }
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;


/**
 * @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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @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.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        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) {
        OwnableStorage storage $ = _getOwnableStorage();
        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 {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;


/**
 * @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 Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step
    struct Ownable2StepStorage {
        address _pendingOwner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;

    function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {
        assembly {
            $.slot := Ownable2StepStorageLocation
        }
    }

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    function __Ownable2Step_init() internal onlyInitializing {
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        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 {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        $._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 {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        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);
    }
}


// File @openzeppelin/contracts/interfaces/[email protected]

// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}


// File @openzeppelin/contracts/token/ERC20/[email protected]

// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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


// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]

// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}


// File @openzeppelin/contracts-upgradeable/token/ERC20/[email protected]

// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;





/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {
    /// @custom:storage-location erc7201:openzeppelin.storage.ERC20
    struct ERC20Storage {
        mapping(address account => uint256) _balances;

        mapping(address account => mapping(address spender => uint256)) _allowances;

        uint256 _totalSupply;

        string _name;
        string _symbol;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;

    function _getERC20Storage() private pure returns (ERC20Storage storage $) {
        assembly {
            $.slot := ERC20StorageLocation
        }
    }

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC20Storage storage $ = _getERC20Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            $._totalSupply += value;
        } else {
            uint256 fromBalance = $._balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                $._balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                $._totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                $._balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        $._allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;


/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        PausableStorage storage $ = _getPausableStorage();
        return $._paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
        emit Unpaused(_msgSender());
    }
}


// File contracts/access/FreezableAmountUpgradeable.sol

// BNY Smart Contract Repo (last updated version: 1.1.0)

pragma solidity 0.8.22;

abstract contract FreezableAmountUpgradeable is Initializable {
    mapping(address => uint256) private _frozenAmount;

    event FrozenAmount(address indexed account, uint256 amount);
    event UnfrozenAmount(address indexed account, uint256 amount);

    /**
     * @dev Initializes the contract
     */
    function __FreezableAmount_init() internal onlyInitializing {
        __FreezableAmount_init_unchained();
    }

    function __FreezableAmount_init_unchained() internal onlyInitializing {} // solhint-disable-line no-empty-blocks

    /**
     * @dev Returns the frozen amount of tokens of the `account`
     * @param account The address to check
     */
    function frozenBalanceOf(address account) public view virtual returns (uint256) {
        return _frozenAmount[account];
    }

    /**
     * @dev Freeze the `amount` of tokens of the `account`
     * @param account The address to freeze tokens in
     * @param amount The amount of tokens to freeze
     */
    function _freezeAmount(address account, uint256 amount) internal virtual {
        _frozenAmount[account] += amount;

        emit FrozenAmount(account, amount);
    }

    /**
     * @dev Unfreeze the `amount` of tokens of the `account`
     * @param account The address to unfreeze tokens in
     * @param amount The amount of tokens to unfreeze
     */
    function _unfreezeAmount(address account, uint256 amount) internal virtual {
        require(
            amount <= frozenBalanceOf(account),
            "FreezableAmount: Unfreeze amount exceeds the frozen balance of the account"
        );
        _frozenAmount[account] -= amount;

        emit UnfrozenAmount(account, amount);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File contracts/access/FreezableUpgradeable.sol

// BNY Smart Contract Repo (last updated version: 1.0.0)

pragma solidity 0.8.22;

abstract contract FreezableUpgradeable is Initializable {
    mapping(address => bool) internal _frozen;

    event Frozen(address indexed account);
    event Unfrozen(address indexed account);

    /**
     * @dev Throws if account is frozen
     * @param _account The address to check
     */
    modifier notFrozen(address _account) {
        require(!isFrozen(_account), "Freezable: account is frozen");
        _;
    }

    /**
     * @dev Throws if account is not frozen
     * @param _account The address to check
     */
    modifier frozen(address _account) {
        require(isFrozen(_account), "Freezable: account is not frozen");
        _;
    }

    /**
     * @dev Initializes the contract
     */
    function __Freezable_init() internal onlyInitializing {
        __Freezable_init_unchained();
    }

    function __Freezable_init_unchained() internal onlyInitializing {} // solhint-disable-line no-empty-blocks

    /**
     * @dev Checks if account is frozen
     * @param _account The address to check
     */
    function isFrozen(address _account) public view virtual returns (bool) {
        return _frozen[_account];
    }

    /**
     * @dev Freeze an account
     * @param _account The address to freeze
     */
    function _freeze(address _account) internal virtual notFrozen(_account) {
        _frozen[_account] = true;
        emit Frozen(_account);
    }

    /**
     * @dev Unfreeze an account
     * @param _account The address to unfreeze
     */
    function _unfreeze(address _account) internal virtual frozen(_account) {
        _frozen[_account] = false;
        emit Unfrozen(_account);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File contracts/access/TransferUpgradeable.sol

// BNY Smart Contract Repo

pragma solidity 0.8.22;

abstract contract TransferUpgradeable is Initializable {
    /**
     * @dev Emitted when holder-initiated transfers are enabled or disabled
     */
    event ToggleHolderInitiatedTransfers(bool);

    /**
     * @dev Emitted when redemptions are enabled or disabled
     */
    event ToggleRedemptions(bool);

    bool private _isHolderInitiatedTransferEnabled;
    bool private _isRedemptionEnabled;

    /**
     * @dev Initializes the contract with provided state for holder-initiated transfers flag and
     * sets redemptions flag to true if redemption address is provided upon deployment.
     */
    function __Transferrable_init(
        bool enableHolderInitiatedTransfers,
        address redemptionAddress
    ) internal onlyInitializing {
        _isHolderInitiatedTransferEnabled = enableHolderInitiatedTransfers;
        if (redemptionAddress != address(0)) {
            _isRedemptionEnabled = true;
        } else {
            _isRedemptionEnabled = false;
        }
    }

    /**
     * @dev Throws if holder-initiated transfers is not in the required state
     ( i.e. trying to enable transfers when it is already enabled or vice versa)
     */
    modifier holderInitiatedTransfersInRequiredState(bool requiredState) {
        require(
            isHolderInitiatedTransferEnabled() != requiredState,
            "Transferrable: holder initiated transfers already in the required state"
        );
        _;
    }

    /**
     * @dev Returns true if the Holder-Initiated transfers are enabled for contract, and false otherwise.
     */
    function isHolderInitiatedTransferEnabled() public view virtual returns (bool) {
        return _isHolderInitiatedTransferEnabled;
    }

    /**
     * @dev Enables or disables holder-initiated transfers
     * @param enable True to enable holder-initiated transfers, false to disable
     */
    function _toggleHolderInitiatedTransfers(
        bool enable
    ) internal virtual holderInitiatedTransfersInRequiredState(enable) {
        _isHolderInitiatedTransferEnabled = enable;
        emit ToggleHolderInitiatedTransfers(enable);
    }

    /**
     * @dev Returns true if redemptions are enabled for contract, and false otherwise.
     */
    function isRedemptionEnabled() public view virtual returns (bool) {
        return _isRedemptionEnabled;
    }

    /**
     * @dev Enables or disables redemptions
     * @param enable True to enable redemptions, false to disable
     */
    function _toggleRedemptions(bool enable) internal virtual {
        _isRedemptionEnabled = enable;
        emit ToggleRedemptions(enable);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File contracts/access/WhitelistableUpgradeable.sol

// BNY Smart Contract Repo (last updated version: 1.2.0-RC1)

pragma solidity 0.8.22;

abstract contract WhitelistableUpgradeable is Initializable {
    // dictionary of whitelisted addresses
    mapping(address => bool) private _whitelist;

    //Events emitted whenever the whitelist is updated
    event WhitelistedEvent(address indexed account);
    event UnWhitelistedEvent(address indexed account);

    error AddressAlreadyInWhitelist(address);
    error AddressNotFoundInWhitelist(address);

    /**
     * @dev Initializes the contract
     */
    function __Whitelistable_init(address[] memory initialAddress) internal onlyInitializing {
        for (uint256 i = 0; i < initialAddress.length; i++) {
            _whitelist[initialAddress[i]] = true;
        }
        __Whitelistable_init_unchained();
    }

    function __Whitelistable_init_unchained() internal onlyInitializing {} // solhint-disable-line no-empty-blocks

    /**
     * @dev Receives account and removes it adds to the whitelist
     * @param _account The address to add to whitelist
     */
    function _addToWhitelist(address _account) internal virtual {
        if (_isWhitelisted(_account)) {
            revert AddressAlreadyInWhitelist(_account);
        }
        _whitelist[_account] = true;
        emit WhitelistedEvent(_account);
    }

    /**
     * @dev Receives account and removes it from tracked whitelist
     * @param _account The address to remove from whitelist
     */
    function _removeFromWhitelist(address _account) internal virtual {
        if (!_isWhitelisted(_account)) {
            revert AddressNotFoundInWhitelist(_account);
        }
        delete _whitelist[_account];
        emit UnWhitelistedEvent(_account);
    }

    /**
     * @dev Returns true if the passed address is in the whitelst
     * @param _account The address in question
     */
    function _isWhitelisted(address _account) public view virtual returns (bool) {
        return _whitelist[_account];
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File contracts/fund/bnr/v2/FundBNRV2.sol

// BNY Smart Contract Repo (last updated version: 1.2.0-RC1)

pragma solidity 0.8.22;








contract FundBNRV2 is
    Initializable,
    Ownable2StepUpgradeable,
    PausableUpgradeable,
    FreezableUpgradeable,
    WhitelistableUpgradeable,
    TransferUpgradeable,
    FreezableAmountUpgradeable,
    ERC20Upgradeable
{
    event Redemption(address indexed from, address indexed to, uint256 value);
    event RedemptionLockConsumed(
        address indexed from,
        address indexed to,
        uint256 unlockedAmount,
        uint256 lockedAmount
    );
    event ToggleUsdcRedemptions(bool enabled);
    event RedemptionAddressUpdated(address indexed oldAddress, address indexed newAddress);
    event RedemptionUsdcAddressUpdated(address indexed oldAddress, address indexed newAddress);
    error AddressNotAllowlisted(address user);
    error AddressIsFrozen(address user);
    error InsufficientBalance();
    error InsufficientLockedBalance();
    error InsufficientAvailableBalance();
    error InsufficientRedemptionBalance();
    error InvalidLockedBalance();
    error RedemptionTransferDisabled();
    error UsdcRedemptionTransferDisabled();
    error HolderInitiatedTransfersDisabled();
    error RedemptionAddressCollision(address addr);
    error SelfRedemptionNotAllowed();

    // Field Params
    string private _fundNumber;
    string private _mgmtCo;
    uint256 private _issueDate;
    string private _currencyCode;
    address private _adminAddress;
    address private _redemptionAddress;
    uint8 private _decimals;
    address private _redemptionUsdcAddress;
    bool private _isUsdcRedemptionEnabled;

    struct FundParams {
        string name;
        string symbol;
        string fundNumber;
        string mgmtCo;
        uint256 issueDate;
        string currencyCode;
        address adminAddress;
        address redemptionAddress;
        address redemptionUsdcAddress;
        bool enableHolderInitiatedTransfers;
        uint8 decimals;
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    // Initialization function that calls inherited supers, grants admin role, sets fields
    function initialize(FundParams calldata params) public initializer {
        __Ownable2Step_init();
        __Ownable_init(_msgSender());
        if (
            params.redemptionAddress != address(0) &&
            params.redemptionUsdcAddress != address(0) &&
            params.redemptionAddress == params.redemptionUsdcAddress
        ) revert RedemptionAddressCollision(params.redemptionAddress);

        _fundNumber = params.fundNumber;
        _mgmtCo = params.mgmtCo;
        _issueDate = params.issueDate;
        _currencyCode = params.currencyCode;
        _adminAddress = params.adminAddress;
        _redemptionAddress = params.redemptionAddress;
        _redemptionUsdcAddress = params.redemptionUsdcAddress;
        address[] memory initialAddresses = new address[](3);
        initialAddresses[0] = params.redemptionAddress;
        initialAddresses[1] = params.redemptionUsdcAddress;
        initialAddresses[2] = address(0);
        _decimals = params.decimals;

        __ERC20_init(params.name, params.symbol);
        __Pausable_init();
        __Freezable_init();
        __FreezableAmount_init();
        __Whitelistable_init(initialAddresses);
        __Transferrable_init(params.enableHolderInitiatedTransfers, params.redemptionAddress);
        _isUsdcRedemptionEnabled = params.redemptionUsdcAddress != address(0);
    }

    // Getters
    function fundNumber() public view returns (string memory) {
        return _fundNumber;
    }

    function mgmtCo() external view returns (string memory) {
        return _mgmtCo;
    }

    function issueDate() external view returns (uint256) {
        return _issueDate;
    }

    function currencyCode() external view returns (string memory) {
        return _currencyCode;
    }

    function adminAddress() public view returns (address) {
        return _adminAddress;
    }

    function redemptionAddress() public view returns (address) {
        return _redemptionAddress;
    }

    function redemptionUsdcAddress() public view returns (address) {
        return _redemptionUsdcAddress;
    }

    function decimals() public view override returns (uint8) {
        return _decimals;
    }

    //Whitelist functions
    function addToWhitelist(address account) external onlyOwner {
        _addToWhitelist(account);
    }

    function removeFromWhitelist(address account) external onlyOwner {
        _removeFromWhitelist(account);
    }

    // Pause functions
    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    // Freeze functions
    function freeze(address account) external onlyOwner {
        if (_isWhitelisted(account)) {
            _removeFromWhitelist(account);
        }
        _freeze(account);
    }

    //unfreeze the account
    function unfreeze(address account) external onlyOwner {
        _unfreeze(account);
    }

    // ERC20
    function mint(address to, uint256 amount) public onlyOwner whenNotPaused {
        commonValidation(address(0), to);
        _mint(to, amount);
    }

    /**
     * Burns a specified amount of tokens from a given account.
     * This function can only be called by an account with the DEFAULT_ADMIN_ROLE.
     * The contract must not be paused.
     *
     * @param from The address of the account to burn tokens from.
     * @param amount The amount of tokens to burn.
     *
     * Requirements:
     * - The 'from' account must not be the zero address.
     * - The 'from' account must be whitelisted.
     * - The 'from' account must not be frozen.
     * - The 'from' account must have a balance of at least 'amount'.
     * - If the available balance of the 'from' account is less than 'amount', the function will attempt to unfreeze and unlock the required amount of tokens.
     * - If the available balance of the 'from' account is still insufficient after unfreezing and unlocking, the function will revert with an "Insufficient unlocked balance after unfreezing and unlocking" error.
     *
     * Emits a Transfer event indicating the burning of tokens.
     */
    function burn(address from, uint256 amount) external onlyOwner whenNotPaused {
        commonValidation(from, address(0));
        uint256 frozenAmt = frozenBalanceOf(from);
        uint256 available = balanceOf(from) - frozenAmt;
        if (balanceOf(from) < amount) revert InsufficientBalance();
        if (available >= amount) {
            _burn(from, amount);
        } else {
            uint256 remainingAmount = amount - available;
            if (frozenAmt < remainingAmount) revert InsufficientLockedBalance();
            _unfreezeAmount(from, remainingAmount);
            _burn(from, amount);
        }
    }

    //burn functions for different balance types
    function burnAvailableBalance(address from, uint256 amount) external onlyOwner whenNotPaused {
        checkAvailableBalance(from, amount);
        _burn(from, amount);
    }

    function burnMintLockBalance(address from, uint256 amount) external onlyOwner whenNotPaused {
        _unfreezeAmount(from, amount);
        _burn(from, amount);
    }

    // Lock and Unlock functions
    function unlockTokens(address account, uint256 amount) external onlyOwner {
        _unfreezeAmount(account, amount);
    }

    function lockTokens(address account, uint256 amount) public onlyOwner {
        checkAvailableBalance(account, amount);
        _freezeAmount(account, amount);
    }

    // Toggle holder-initiated transfers
    function toggleHolderInitiatedtransfer(bool enable) external onlyOwner {
        _toggleHolderInitiatedTransfers(enable);
    }

    // Admin signed transfers
    function adminInitiatedTransfer(address from, address to, uint256 amount) external onlyOwner whenNotPaused {
        commonValidation(from, to);
        address redemptionAddr = _redemptionAddress;
        address redemptionUsdcAddr = _redemptionUsdcAddress;
        if (to == redemptionAddr) {
            if (!isRedemptionEnabled()) revert RedemptionTransferDisabled();
            checkAvailableBalance(from, amount);
            emit Redemption(from, to, amount);
            _transfer(from, to, amount);
        } else if (to == redemptionUsdcAddr) {
            if (!_isUsdcRedemptionEnabled) revert UsdcRedemptionTransferDisabled();
            checkAvailableBalance(from, amount);
            emit Redemption(from, to, amount);
            _transfer(from, to, amount);
        } else {
            checkAvailableBalance(from, amount);
            _transfer(from, to, amount);
        }
    }

    // Mint and lock tokens
    function mintLockToken(address to, uint256 amount) external onlyOwner {
        mint(to, amount);
        lockTokens(to, amount);
    }

    function updateRedemptionAddress(address newRedemptionAddress) external onlyOwner whenNotPaused {
        if (newRedemptionAddress != address(0) && newRedemptionAddress == _redemptionUsdcAddress)
            revert RedemptionAddressCollision(newRedemptionAddress);

        address oldAddr = _redemptionAddress;
        if (newRedemptionAddress != oldAddr) {
            if (newRedemptionAddress != address(0) && !_isWhitelisted(newRedemptionAddress)) {
                _addToWhitelist(newRedemptionAddress);
            }
            if (oldAddr != address(0) && oldAddr != _redemptionUsdcAddress && _isWhitelisted(oldAddr)) {
                _removeFromWhitelist(oldAddr);
            }
        }

        _redemptionAddress = newRedemptionAddress;
        if (newRedemptionAddress == address(0)) {
            if (isRedemptionEnabled()) {
                _toggleRedemptions(false);
            }
        } else if (!isRedemptionEnabled()) {
            _toggleRedemptions(true);
        }
        emit RedemptionAddressUpdated(oldAddr, newRedemptionAddress);
    }

    function updateRedemptionUsdcAddress(address newRedemptionUsdcAddress) external onlyOwner whenNotPaused {
        if (newRedemptionUsdcAddress != address(0) && newRedemptionUsdcAddress == _redemptionAddress)
            revert RedemptionAddressCollision(newRedemptionUsdcAddress);

        address oldUsdcAddr = _redemptionUsdcAddress;
        if (newRedemptionUsdcAddress != oldUsdcAddr) {
            if (newRedemptionUsdcAddress != address(0) && !_isWhitelisted(newRedemptionUsdcAddress)) {
                _addToWhitelist(newRedemptionUsdcAddress);
            }
            if (oldUsdcAddr != address(0) && oldUsdcAddr != _redemptionAddress && _isWhitelisted(oldUsdcAddr)) {
                _removeFromWhitelist(oldUsdcAddr);
            }
        }

        _redemptionUsdcAddress = newRedemptionUsdcAddress;
        if (newRedemptionUsdcAddress == address(0)) {
            if (_isUsdcRedemptionEnabled) {
                _isUsdcRedemptionEnabled = false;
                emit ToggleUsdcRedemptions(false);
            }
        } else if (!_isUsdcRedemptionEnabled) {
            _isUsdcRedemptionEnabled = true;
            emit ToggleUsdcRedemptions(true);
        }
        emit RedemptionUsdcAddressUpdated(oldUsdcAddr, newRedemptionUsdcAddress);
    }

    function isUsdcRedemptionEnabled() public view returns (bool) {
        return _isUsdcRedemptionEnabled;
    }

    // Accept new admin address
    function acceptOwnership() public override {
        address previousAdmin = adminAddress();
        super.acceptOwnership();
        // slither-disable-next-line missing-zero-check
        address newAdmin = _msgSender();
        if (!_isWhitelisted(newAdmin)) {
            _addToWhitelist(newAdmin);
        }
        if (
            previousAdmin != newAdmin &&
            previousAdmin != _redemptionAddress &&
            previousAdmin != _redemptionUsdcAddress &&
            _isWhitelisted(previousAdmin)
        ) {
            _removeFromWhitelist(previousAdmin);
        }
        _adminAddress = newAdmin;
    }

    function transfer(address to, uint256 amount) public override whenNotPaused returns (bool) {
        address sender = _msgSender();
        commonValidation(sender, to);

        if (_isRegularRedemptionDestination(to)) {
            if (!isRedemptionEnabled()) revert RedemptionTransferDisabled();
            _transferRedemption(sender, to, amount);
        } else if (_isUsdcRedemptionDestination(to)) {
            if (!_isUsdcRedemptionEnabled) revert UsdcRedemptionTransferDisabled();
            _transferRedemption(sender, to, amount);
        } else {
            if (!isHolderInitiatedTransferEnabled()) revert HolderInitiatedTransfersDisabled();
            checkAvailableBalance(sender, amount);
            _transfer(sender, to, amount);
        }
        return true;
    }

    function commonValidation(address from, address to) internal view {
        commonValidationSingleAddress(from);
        commonValidationSingleAddress(to);
    }

    function commonValidationSingleAddress(address user) internal view {
        if (!_isWhitelisted(user)) {
            revert AddressNotAllowlisted(user);
        }
        if (isFrozen(user)) {
            revert AddressIsFrozen(user);
        }
    }

    function checkAvailableBalance(address account, uint256 amount) internal view {
        if (availableBalance(account) < amount) revert InsufficientAvailableBalance();
    }

    function availableBalance(address account) public view returns (uint256) {
        return balanceOf(account) - frozenBalanceOf(account);
    }

    function lockedBalanceOf(address account) public view returns (uint256) {
        return frozenBalanceOf(account);
    }

    function redeemableBalance(address account) external view returns (uint256) {
        return balanceOf(account);
    }

    function _isRegularRedemptionDestination(address to) internal view returns (bool) {
        return _redemptionAddress != address(0) && to == _redemptionAddress;
    }

    function _isUsdcRedemptionDestination(address to) internal view returns (bool) {
        return _redemptionUsdcAddress != address(0) && to == _redemptionUsdcAddress;
    }

    function _transferRedemption(address from, address to, uint256 amount) internal {
        if (from == to) revert SelfRedemptionNotAllowed();

        (uint256 unlockedUsed, uint256 lockedUsed) = _consumeRedemptionBalance(from, amount);
        emit Redemption(from, to, amount);
        emit RedemptionLockConsumed(from, to, unlockedUsed, lockedUsed);
        _transfer(from, to, amount);
    }

    function _consumeRedemptionBalance(
        address from,
        uint256 amount
    ) internal returns (uint256 unlockedUsed, uint256 lockedUsed) {
        uint256 total = balanceOf(from);
        uint256 locked = frozenBalanceOf(from);

        if (amount > total) revert InsufficientBalance();
        if (locked > total) revert InvalidLockedBalance();

        uint256 unlocked = total - locked;
        unlockedUsed = amount < unlocked ? amount : unlocked;
        lockedUsed = amount - unlockedUsed;

        if (lockedUsed > locked) revert InsufficientRedemptionBalance();
        if (lockedUsed > 0) {
            _unfreezeAmount(from, lockedUsed);
        }
    }

    /// @notice This contract intentionally disables approve(), transferFrom(),
    /// increaseAllowance(), and decreaseAllowance(). All token movements are
    /// owner-controlled via mint(), burn(), and adminInitiatedTransfer().
    /// This contract does NOT fully comply with EIP-20.

    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
        revert("public increaseAllowance function disabled");
    }

    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
        revert("public decreaseAllowance function disabled");
    }

    function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
        revert("public transferFrom function disabled");
    }

    function approve(address spender, uint256 amount) public override returns (bool) {
        revert("public approve function disabled");
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "berlin"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.