ETH Price: $3,150.98 (+0.22%)
Gas: 0.06 GWei

Contract

0x55231F67b289815483a037D459877D85819e9144

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Finalize2170292023-08-17 13:04:17331 days ago1692277457IN
Mendi Finance: Liquidity Generation
0 ETH0.000125041.7
Deposit2169962023-08-17 12:57:41331 days ago1692277061IN
Mendi Finance: Liquidity Generation
0 ETH0.00015821.51654591
Deposit2169932023-08-17 12:57:05331 days ago1692277025IN
Mendi Finance: Liquidity Generation
0 ETH0.000184911.52276815
Deposit2169892023-08-17 12:56:17331 days ago1692276977IN
Mendi Finance: Liquidity Generation
0 ETH0.000178451.53003537
Deposit2169882023-08-17 12:56:05331 days ago1692276965IN
Mendi Finance: Liquidity Generation
0 ETH0.000193121.53003537
Deposit2169872023-08-17 12:55:53331 days ago1692276953IN
Mendi Finance: Liquidity Generation
0 ETH0.000167461.53473099
Deposit2169822023-08-17 12:54:53331 days ago1692276893IN
Mendi Finance: Liquidity Generation
0 ETH0.000192251.58340435
Deposit2169812023-08-17 12:54:41331 days ago1692276881IN
Mendi Finance: Liquidity Generation
0 ETH0.000194251.538984
Deposit2169792023-08-17 12:54:17331 days ago1692276857IN
Mendi Finance: Liquidity Generation
0 ETH0.00016111.54437286
Deposit2169752023-08-17 12:53:29331 days ago1692276809IN
Mendi Finance: Liquidity Generation
0 ETH0.000169941.55721142
Deposit2169642023-08-17 12:51:17331 days ago1692276677IN
Mendi Finance: Liquidity Generation
0 ETH0.000166861.59958122
Deposit2169552023-08-17 12:49:29331 days ago1692276569IN
Mendi Finance: Liquidity Generation
0 ETH0.000222291.83075831
Deposit2169312023-08-17 12:44:41331 days ago1692276281IN
Mendi Finance: Liquidity Generation
0 ETH0.000267122.2
Deposit2169182023-08-17 12:42:05331 days ago1692276125IN
Mendi Finance: Liquidity Generation
0 ETH0.00026852.12711493
Deposit2169182023-08-17 12:42:05331 days ago1692276125IN
Mendi Finance: Liquidity Generation
0 ETH0.000258272.12711493
Deposit2168952023-08-17 12:37:29331 days ago1692275849IN
Mendi Finance: Liquidity Generation
0 ETH0.000271562.15176473
Deposit2168812023-08-17 12:34:41331 days ago1692275681IN
Mendi Finance: Liquidity Generation
0 ETH0.000258722.13062815
Deposit2168772023-08-17 12:33:53331 days ago1692275633IN
Mendi Finance: Liquidity Generation
0 ETH0.00026672.11285355
Deposit2168742023-08-17 12:33:17331 days ago1692275597IN
Mendi Finance: Liquidity Generation
0 ETH0.000095972.08336098
Deposit2168742023-08-17 12:33:17331 days ago1692275597IN
Mendi Finance: Liquidity Generation
0 ETH0.000252312.07800675
Deposit2168502023-08-17 12:28:29331 days ago1692275309IN
Mendi Finance: Liquidity Generation
0 ETH0.000249642.05602879
Deposit2168192023-08-17 12:22:17331 days ago1692274937IN
Mendi Finance: Liquidity Generation
0 ETH0.000261012.06770835
Deposit2167972023-08-17 12:17:53331 days ago1692274673IN
Mendi Finance: Liquidity Generation
0 ETH0.000249932.14294727
Deposit2167832023-08-17 12:15:05331 days ago1692274505IN
Mendi Finance: Liquidity Generation
0 ETH0.00027922.21203856
Deposit2167812023-08-17 12:14:41331 days ago1692274481IN
Mendi Finance: Liquidity Generation
0 ETH0.00027922.21203856
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To Value
2170292023-08-17 13:04:17331 days ago1692277457
Mendi Finance: Liquidity Generation
0 ETH
2170292023-08-17 13:04:17331 days ago1692277457
Mendi Finance: Liquidity Generation
0 ETH
2170292023-08-17 13:04:17331 days ago1692277457
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169962023-08-17 12:57:41331 days ago1692277061
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169932023-08-17 12:57:05331 days ago1692277025
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169892023-08-17 12:56:17331 days ago1692276977
Mendi Finance: Liquidity Generation
0 ETH
2169882023-08-17 12:56:05331 days ago1692276965
Mendi Finance: Liquidity Generation
0 ETH
2169882023-08-17 12:56:05331 days ago1692276965
Mendi Finance: Liquidity Generation
0 ETH
2169882023-08-17 12:56:05331 days ago1692276965
Mendi Finance: Liquidity Generation
0 ETH
2169882023-08-17 12:56:05331 days ago1692276965
Mendi Finance: Liquidity Generation
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LiquidityGenerator

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 14 : LiquidityGenerator.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

import "./interfaces/IERC20.sol";
import "./interfaces/IOwnedDistributor.sol";
import "./libraries/SafeMath.sol";
import "./libraries/SafeToken.sol";
import "./LGEDepositor.sol";

contract LiquidityGenerator {
    using SafeMath for uint256;
    using SafeToken for address;

    struct ConstuctorParams {
        address admin_;
        address mendi_;
        address usdc_;
        address reservesManager_;
        address distributor_;
        address bonusDistributor_;
        uint256 periodBegin_;
        uint256 periodDuration_;
        uint256 bonusDuration_;
    }

    address public immutable mendi;
    address public immutable usdc;
    address public immutable distributor;
    address public immutable bonusDistributor;
    uint256 public immutable periodBegin;
    uint256 public immutable periodEnd;
    uint256 public immutable bonusEnd;
    bool public finalized = false;
    address public admin;
    address public pendingAdmin;
    address public reservesManager;

    event AdminChanged(address prevAdmin, address newAdmin);
    event PendingAdminChanged(
        address prevPendingAdmin,
        address newPendingAdmin
    );
    event ReservesManagerChanged(
        address prevReservesManager,
        address newReservesManager
    );
    event Finalized(uint256 amountMendi, uint256 amountUSDC);
    event Deposit(
        address indexed sender,
        uint256 amount,
        uint256 distributorTotalShares,
        uint256 bonusDistributorTotalShares,
        uint256 newShares,
        uint256 newBonusShares
    );

    constructor(ConstuctorParams memory params_) {
        require(
            params_.periodDuration_ > 0,
            "LiquidityGenerator: INVALID_PERIOD_DURATION"
        );
        require(
            params_.bonusDuration_ > 0 &&
                params_.bonusDuration_ <= params_.periodDuration_,
            "LiquidityGenerator: INVALID_BONUS_DURATION"
        );
        admin = params_.admin_;
        mendi = params_.mendi_;
        usdc = params_.usdc_;
        reservesManager = params_.reservesManager_;
        distributor = params_.distributor_;
        bonusDistributor = params_.bonusDistributor_;
        periodBegin = params_.periodBegin_;
        periodEnd = params_.periodBegin_.add(params_.periodDuration_);
        bonusEnd = params_.periodBegin_.add(params_.bonusDuration_);
    }

    function distributorTotalShares()
        public
        view
        returns (uint256 totalShares)
    {
        return IOwnedDistributor(distributor).totalShares();
    }

    function bonusDistributorTotalShares()
        public
        view
        returns (uint256 totalShares)
    {
        return IOwnedDistributor(bonusDistributor).totalShares();
    }

    function distributorRecipients(
        address account
    )
        public
        view
        returns (uint256 shares, uint256 lastShareIndex, uint256 credit)
    {
        return IOwnedDistributor(distributor).recipients(account);
    }

    function bonusDistributorRecipients(
        address account
    )
        public
        view
        returns (uint256 shares, uint256 lastShareIndex, uint256 credit)
    {
        return IOwnedDistributor(bonusDistributor).recipients(account);
    }

    function _setAdmin(address admin_) external {
        require(msg.sender == admin, "LiquidityGenerator: FORBIDDEN");
        require(admin_ != address(0), "LiquidityGenerator: INVALID_ADDRESS");
        address prevPendingAdmin = pendingAdmin;
        pendingAdmin = admin_;
        emit PendingAdminChanged(prevPendingAdmin, pendingAdmin);
    }

    function _acceptAdmin() external {
        require(msg.sender == pendingAdmin, "LiquidityGenerator: FORBIDDEN");
        address prevAdmin = admin;
        address prevPendingAdmin = pendingAdmin;
        admin = pendingAdmin;
        pendingAdmin = address(0);
        emit AdminChanged(prevAdmin, admin);
        emit PendingAdminChanged(prevPendingAdmin, pendingAdmin);
    }

    function _setReservesManager(address reservesManager_) external {
        require(
            getBlockTimestamp() < periodBegin,
            "LiquidityGenerator: Event Started"
        );
        require(msg.sender == admin, "LiquidityGenerator: FORBIDDEN");
        require(
            reservesManager_ != address(0),
            "LiquidityGenerator: INVALID_ADDRESS"
        );
        address prevReservesManager = reservesManager;
        reservesManager = reservesManager_;
        emit ReservesManagerChanged(prevReservesManager, reservesManager);
    }

    function finalize() public {
        require(!finalized, "LiquidityGenerator: FINALIZED");
        uint256 blockTimestamp = getBlockTimestamp();
        require(blockTimestamp >= periodEnd, "LiquidityGenerator: TOO_SOON");

        uint256 _amountMendi = mendi.balanceOf(reservesManager);
        uint256 _amountUSDC = usdc.balanceOf(reservesManager);

        LGEDepositor(reservesManager).finalize();

        finalized = true;
        emit Finalized(_amountMendi, _amountUSDC);
    }

    function deposit(uint256 amountUSDC) external payable {
        uint256 blockTimestamp = getBlockTimestamp();
        require(blockTimestamp >= periodBegin, "LiquidityGenerator: TOO_SOON");
        require(blockTimestamp < periodEnd, "LiquidityGenerator: TOO_LATE");
        require(amountUSDC >= 1e7, "LiquidityGenerator: INVALID_VALUE"); // minimum 10 USDC

        // Pull usdc to reserves manager
        require(
            reservesManager != address(0),
            "LiquidityGenerator: ZERO_ADDRESS_RESERVES"
        );
        usdc.safeTransferFrom(msg.sender, reservesManager, amountUSDC);

        (uint256 _prevSharesBonus, , ) = IOwnedDistributor(bonusDistributor)
            .recipients(msg.sender);
        uint256 _newSharesBonus = _prevSharesBonus;
        if (blockTimestamp < bonusEnd) {
            _newSharesBonus = _prevSharesBonus.add(amountUSDC);
            IOwnedDistributor(bonusDistributor).editRecipient(
                msg.sender,
                _newSharesBonus
            );
        }
        (uint256 _prevShares, , ) = IOwnedDistributor(distributor).recipients(
            msg.sender
        );
        uint256 _newShares = _prevShares.add(amountUSDC);
        IOwnedDistributor(distributor).editRecipient(msg.sender, _newShares);
        emit Deposit(
            msg.sender,
            amountUSDC,
            distributorTotalShares(),
            bonusDistributorTotalShares(),
            _newShares,
            _newSharesBonus
        );
    }

    receive() external payable {
        revert("LiquidityGenerator: BAD_CALL");
    }

    function getBlockTimestamp() public view virtual returns (uint256) {
        return block.timestamp;
    }
}

File 2 of 14 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 14 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 14 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 5 of 14 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 6 of 14 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 7 of 14 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 8 of 14 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 9 of 14 : LGEDepositor.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

import "@openzeppelin/contracts/access/AccessControl.sol";

import "./interfaces/IERC20.sol";
import "./interfaces/IOwnedDistributor.sol";
import "./interfaces/VelocoreInterfaces.sol";
import "./libraries/SafeMath.sol";
import "./libraries/SafeToken.sol";

contract LGEDepositor is AccessControl {
    using TokenLib for Token;
    using SafeToken for address;

    address public immutable liquidityGenerator;
    IVault public immutable vault;
    IFactory public immutable factory;
    address public immutable mendi;
    address public immutable usdc;
    address public immutable vc;

    Token public immutable mendiToken;
    Token public immutable usdcToken;
    Token public immutable vcToken;
    IPool public immutable mendiUSDCPool;
    Token public immutable mendiUSDCPoolToken;

    uint256 finalizeAt;
    bool deposited;

    uint8 constant SWAP = 0;
    uint8 constant GAUGE = 1;

    uint8 constant EXACTLY = 0;
    uint8 constant AT_MOST = 1;
    uint8 constant ALL = 2;

    bytes32 public HARVESTER_ROLE = keccak256("HARVESTER_ROLE");

    modifier onlyLG() {
        require(msg.sender == liquidityGenerator, "LGEDepositor: ONLY_LG");
        _;
    }

    constructor(
        address liquidityGenerator_,
        IVault vault_,
        IFactory factory_,
        address mendi_,
        address usdc_,
        address vc_
    ) {
        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());

        liquidityGenerator = liquidityGenerator_;
        vault = vault_;
        factory = factory_;
        mendi = mendi_;
        usdc = usdc_;
        vc = vc_;

        mendiToken = toToken(IERC20(mendi));
        usdcToken = toToken(IERC20(usdc));
        vcToken = toToken(IERC20(vc));

        mendiUSDCPool = factory.pools(mendiToken, usdcToken);
        mendiUSDCPoolToken = toToken(IERC20(address(mendiUSDCPool)));
    }

    function finalize() external onlyLG {
        finalizeAt = getBlockTimestamp();
    }

    function deposit() external {
        require(finalizeAt > 0, "LGEDepositor: NOT_FINALIZED");
        require(
            mendi.balanceOf(address(this)) >= 2_500_000e18,
            "LGEDepositor: NOT_ENOUGH_MENDI"
        );

        addLPInternal();
        stakeLPInternal();

        deposited = true;
    }

    function harvest(address to) external onlyRole(HARVESTER_ROLE) {
        require(deposited, "LGEDepositor: NOT_DEPOSITED");

        harvestVCInternal();

        sendAllInternal(vcToken, to);
    }

    function withdraw(address to) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            getBlockTimestamp() > finalizeAt + 180 days,
            "LGEDepositor: LP_LOCKED"
        );

        unstakeLPInternal();

        sendAllInternal(mendiUSDCPoolToken, to);
    }

    /* Internal Liquidity Functions */

    function addLPInternal() internal {
        approveAllInternal(mendiToken, address(vault));
        approveAllInternal(usdcToken, address(vault));

        run3Internal(
            0,
            mendiUSDCPool,
            SWAP,
            mendiToken,
            EXACTLY,
            int128(int256(mendiToken.addr().balanceOf(address(this)))),
            usdcToken,
            EXACTLY,
            int128(int256(usdcToken.addr().balanceOf(address(this)))),
            mendiUSDCPoolToken,
            AT_MOST,
            0
        );

        removeApproveInternal(mendiToken, address(vault));
        removeApproveInternal(usdcToken, address(vault));
    }

    function stakeLPInternal() internal {
        approveAllInternal(mendiUSDCPoolToken, address(vault));

        run2Internal(
            0,
            mendiUSDCPool,
            GAUGE,
            mendiUSDCPoolToken,
            EXACTLY,
            int128(int256(mendiUSDCPoolToken.addr().balanceOf(address(this)))),
            vcToken,
            AT_MOST,
            0
        );

        removeApproveInternal(mendiUSDCPoolToken, address(vault));
    }

    function harvestVCInternal() internal {
        run1Internal(0, mendiUSDCPool, GAUGE, vcToken, AT_MOST, 0);
    }

    function unstakeLPInternal() internal {
        uint256 stakedAmount = IGauge(address(mendiUSDCPool)).stakedTokens(
            address(this)
        )[0];

        run2Internal(
            0,
            mendiUSDCPool,
            GAUGE,
            mendiUSDCPoolToken,
            EXACTLY,
            -(int128(uint128(stakedAmount))),
            vcToken,
            AT_MOST,
            0
        );
    }

    function removeLPInternal() internal {
        approveAllInternal(mendiUSDCPoolToken, address(vault));

        run3Internal(
            0,
            mendiUSDCPool,
            SWAP,
            mendiToken,
            AT_MOST,
            0,
            usdcToken,
            AT_MOST,
            0,
            mendiUSDCPoolToken,
            EXACTLY,
            int128(int256(mendiUSDCPoolToken.addr().balanceOf(address(this))))
        );

        removeApproveInternal(mendiUSDCPoolToken, address(vault));
    }

    function run1Internal(
        uint256 value,
        IPool pool,
        uint8 method,
        Token t1,
        uint8 m1,
        int128 a1
    ) internal {
        Token[] memory tokens = new Token[](1);

        VelocoreOperation[] memory ops = new VelocoreOperation[](1);

        tokens[0] = (t1);

        ops[0].poolId =
            bytes32(bytes1(method)) |
            bytes32(uint256(uint160(address(pool))));
        ops[0].tokenInformations = new bytes32[](1);
        ops[0].data = "";

        ops[0].tokenInformations[0] =
            bytes32(bytes1(0x00)) |
            bytes32(bytes2(uint16(m1))) |
            bytes32(uint256(uint128(uint256(int256(a1)))));
        vault.execute{value: value}(tokens, new int128[](1), ops);
    }

    function run2Internal(
        uint256 value,
        IPool pool,
        uint8 method,
        Token t1,
        uint8 m1,
        int128 a1,
        Token t2,
        uint8 m2,
        int128 a2
    ) internal {
        Token[] memory tokens = new Token[](2);

        VelocoreOperation[] memory ops = new VelocoreOperation[](1);

        tokens[0] = (t1);
        tokens[1] = (t2);

        ops[0].poolId =
            bytes32(bytes1(method)) |
            bytes32(uint256(uint160(address(pool))));
        ops[0].tokenInformations = new bytes32[](2);
        ops[0].data = "";

        ops[0].tokenInformations[0] =
            bytes32(bytes1(0x00)) |
            bytes32(bytes2(uint16(m1))) |
            bytes32(uint256(uint128(uint256(int256(a1)))));
        ops[0].tokenInformations[1] =
            bytes32(bytes1(0x01)) |
            bytes32(bytes2(uint16(m2))) |
            bytes32(uint256(uint128(uint256(int256(a2)))));
        vault.execute{value: value}(tokens, new int128[](2), ops);
    }

    function run3Internal(
        uint256 value,
        IPool pool,
        uint8 method,
        Token t1,
        uint8 m1,
        int128 a1,
        Token t2,
        uint8 m2,
        int128 a2,
        Token t3,
        uint8 m3,
        int128 a3
    ) internal {
        Token[] memory tokens = new Token[](3);

        VelocoreOperation[] memory ops = new VelocoreOperation[](1);

        tokens[0] = (t1);
        tokens[1] = (t2);
        tokens[2] = (t3);

        ops[0].poolId =
            bytes32(bytes1(method)) |
            bytes32(uint256(uint160(address(pool))));
        ops[0].tokenInformations = new bytes32[](3);
        ops[0].data = "";

        ops[0].tokenInformations[0] =
            bytes32(bytes1(0x00)) |
            bytes32(bytes2(uint16(m1))) |
            bytes32(uint256(uint128(uint256(int256(a1)))));
        ops[0].tokenInformations[1] =
            bytes32(bytes1(0x01)) |
            bytes32(bytes2(uint16(m2))) |
            bytes32(uint256(uint128(uint256(int256(a2)))));
        ops[0].tokenInformations[2] =
            bytes32(bytes1(0x02)) |
            bytes32(bytes2(uint16(m3))) |
            bytes32(uint256(uint128(uint256(int256(a3)))));
        vault.execute{value: value}(tokens, new int128[](3), ops);
    }

    /* Internal Helper Functions */

    function sendAllInternal(Token token, address to) internal {
        token.addr().safeTransfer(to, token.addr().balanceOf(address(this)));
    }

    function approveAllInternal(Token token, address spender) internal {
        token.addr().safeApprove(
            spender,
            token.addr().balanceOf(address(this))
        );
    }

    function removeApproveInternal(Token token, address spender) internal {
        token.addr().safeApprove(spender, 0);
    }

    /* Admin Functions */

    function _recover(address token) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            finalizeAt == 0 || getBlockTimestamp() > finalizeAt + 7 days,
            "LGEDepositor: NOT_RECOVER_TIME"
        );
        uint256 amount = token.balanceOf(address(this));
        token.safeTransfer(msg.sender, amount);
    }

    /* Misc Functions */

    function getBlockTimestamp() public view virtual returns (uint256) {
        return block.timestamp;
    }
}

File 10 of 14 : IERC20.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(
        address owner,
        address spender
    ) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

File 11 of 14 : IOwnedDistributor.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IOwnedDistributor {
    function totalShares() external view returns (uint256);

    function recipients(
        address
    )
        external
        view
        returns (uint256 shares, uint256 lastShareIndex, uint256 credit);

    function editRecipient(address account, uint256 shares) external;
}

File 12 of 14 : VelocoreInterfaces.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "./IERC20.sol";

bytes32 constant TOKEN_MASK = 0x000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
bytes32 constant ID_MASK = 0x00FFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;

uint256 constant ID_SHIFT = 160;
bytes32 constant TOKENSPEC_MASK = 0xFF00000000000000000000000000000000000000000000000000000000000000;

type Token is bytes32;
type TokenSpecType is bytes32;

library TokenSpec {
    TokenSpecType constant ERC20 =
        TokenSpecType.wrap(
            0x0000000000000000000000000000000000000000000000000000000000000000
        );

    TokenSpecType constant ERC721 =
        TokenSpecType.wrap(
            0x0100000000000000000000000000000000000000000000000000000000000000
        );

    TokenSpecType constant ERC1155 =
        TokenSpecType.wrap(
            0x0200000000000000000000000000000000000000000000000000000000000000
        );

    TokenSpecType constant NATIVE =
        TokenSpecType.wrap(
            0xEE00000000000000000000000000000000000000000000000000000000000000
        );
}

library TokenLib {
    using TokenLib for Token;
    using TokenLib for bytes32;

    function wrap(bytes32 data) internal pure returns (Token) {
        return Token.wrap(data);
    }

    function unwrap(Token tok) internal pure returns (bytes32) {
        return Token.unwrap(tok);
    }

    function addr(Token tok) internal pure returns (address) {
        return address(uint160(uint256(tok.unwrap() & TOKEN_MASK)));
    }

    function id(Token tok) internal pure returns (uint256) {
        return uint256((tok.unwrap() & ID_MASK) >> ID_SHIFT);
    }

    function spec(Token tok) internal pure returns (TokenSpecType) {
        return TokenSpecType.wrap(tok.unwrap() & TOKENSPEC_MASK);
    }
}

function toToken(IERC20 tok) pure returns (Token) {
    return Token.wrap(bytes32(uint256(uint160(address(tok)))));
}

function toToken(
    TokenSpecType spec_,
    uint88 id_,
    address addr_
) pure returns (Token) {
    return
        Token.wrap(
            TokenSpecType.unwrap(spec_) |
                bytes32((bytes32(uint256(id_)) << ID_SHIFT) & ID_MASK) |
                bytes32(uint256(uint160(addr_)))
        );
}

interface IAuthorizer {
    /**
     * @dev Returns true if `account` can perform the action described by `actionId` in the contract `where`.
     */
    function canPerform(
        bytes32 actionId,
        address account,
        address where
    ) external view returns (bool);
}

interface IPool {
    function poolParams() external view returns (bytes memory);
}

interface ISwap is IPool {
    function velocore__execute(
        address user,
        Token[] calldata tokens,
        int128[] memory amounts,
        bytes calldata data
    ) external returns (int128[] memory, int128[] memory);

    function swapType() external view returns (string memory);

    function listedTokens() external view returns (Token[] memory);

    function lpTokens() external view returns (Token[] memory);

    function underlyingTokens(Token lp) external view returns (Token[] memory);
    //function spotPrice(Token token, Token base) external view returns (uint256);
}

interface IGauge is IPool {
    /**
     * @dev This method is called by Vault.execute().
     * the parameters and return values are the same as velocore__execute.
     * The only difference is that the vault will call velocore__emission before calling velocore__gauge.
     */
    function velocore__gauge(
        address user,
        Token[] calldata tokens,
        int128[] memory amounts,
        bytes calldata data
    ) external returns (int128[] memory deltaGauge, int128[] memory deltaPool);

    /**
     * @dev This method is called by Vault.execute() before calling velocore__emission or changing votes.
     *
     * The vault will credit emitted VC into the gauge balance.
     * IGauge is expected to update its internal ledger.
     * @param newEmissions newly emitted VCs since last emission
     */
    function velocore__emission(uint256 newEmissions) external;

    function stakeableTokens() external view returns (Token[] memory);

    function stakedTokens(
        address user
    ) external view returns (uint256[] memory);

    function stakedTokens() external view returns (uint256[] memory);

    function emissionShare(address user) external view returns (uint256);

    function naturalBribes() external view returns (Token[] memory);
}

interface IConverter {
    /**
     * @dev This method is called by Vault.execute().
     * Vault will transfer any positively specified amounts directly to the IConverter before calling velocore__convert.
     *
     * Instead of returning balance delta numbers, IConverter is expected to directly transfer outputs back to vault.
     * Vault will measure the difference, and credit the user.
     */
    function velocore__convert(
        address user,
        Token[] calldata tokens,
        int128[] memory amounts,
        bytes calldata data
    ) external;
}

interface IBribe is IPool {
    /**
     * @dev This method is called when someone vote/harvest from/to a @param gauge,
     * and when this IBribe happens to be attached to the gauge.
     *
     * Attachment can happen without IBribe's permission. Implementations must verify that @param gauge is correct.
     *
     * Returns balance deltas; their net differences are credited as bribe.
     * deltaExternal must be zero or negative; Vault will take specified amounts from the contract's balance
     *
     * @param  gauge  the gauge to bribe for.
     * @param  elapsed  elapsed time after last call; can be used to save gas.
     */
    function velocore__bribe(
        IGauge gauge,
        uint256 elapsed
    )
        external
        returns (
            Token[] memory bribeTokens,
            int128[] memory deltaGauge,
            int128[] memory deltaPool,
            int128[] memory deltaExternal
        );

    function bribeTokens(IGauge gauge) external view returns (Token[] memory);

    function bribeRates(IGauge gauge) external view returns (uint256[] memory);
}

interface IFacet {
    function initializeFacet() external;
}

interface IFactory {
    function pools(Token quote, Token base) external view returns (IPool pool);
}

struct VelocoreOperation {
    bytes32 poolId;
    bytes32[] tokenInformations;
    bytes data;
}

interface IVault {
    event Swap(
        ISwap indexed pool,
        address indexed user,
        Token[] tokenRef,
        int128[] delta
    );
    event Gauge(
        IGauge indexed pool,
        address indexed user,
        Token[] tokenRef,
        int128[] delta
    );
    event Convert(
        IConverter indexed pool,
        address indexed user,
        Token[] tokenRef,
        int128[] delta
    );
    event Vote(IGauge indexed pool, address indexed user, int256 voteDelta);
    event UserBalance(
        address indexed to,
        address indexed from,
        Token[] tokenRef,
        int128[] delta
    );
    event BribeAttached(IGauge indexed gauge, IBribe indexed bribe);
    event BribeKilled(IGauge indexed gauge, IBribe indexed bribe);
    event GaugeKilled(IGauge indexed gauge, bool killed);

    function notifyInitialSupply(Token, uint128, uint128) external;

    function attachBribe(IGauge gauge, IBribe bribe) external;

    function killBribe(IGauge gauge, IBribe bribe) external;

    function killGauge(IGauge gauge, bool t) external;

    function ballotToken() external returns (Token);

    function emissionToken() external returns (Token);

    function execute(
        Token[] calldata tokenRef,
        int128[] memory deposit,
        VelocoreOperation[] calldata ops
    ) external payable;

    function query(
        address user,
        Token[] calldata tokenRef,
        int128[] memory deposit,
        VelocoreOperation[] calldata ops
    ) external returns (int128[] memory);

    function admin_setFunctions(
        address implementation,
        bytes4[] calldata sigs
    ) external;

    function admin_addFacet(IFacet implementation) external;

    function admin_setAuthorizer(IAuthorizer auth_) external;

    function inspect(address lens, bytes memory data) external;
}

File 13 of 14 : SafeMath.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, errorMessage);

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction underflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, errorMessage);

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts with custom message on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 14 of 14 : SafeToken.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

interface ERC20Interface {
    function balanceOf(address user) external view returns (uint256);
}

library SafeToken {
    function myBalance(address token) internal view returns (uint256) {
        return ERC20Interface(token).balanceOf(address(this));
    }

    function balanceOf(
        address token,
        address user
    ) internal view returns (uint256) {
        return ERC20Interface(token).balanceOf(user);
    }

    function safeApprove(address token, address to, uint256 value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x095ea7b3, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "!safeApprove"
        );
    }

    function safeTransfer(address token, address to, uint256 value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0xa9059cbb, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "!safeTransfer"
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x23b872dd, from, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "!safeTransferFrom"
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "!safeTransferETH");
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"admin_","type":"address"},{"internalType":"address","name":"mendi_","type":"address"},{"internalType":"address","name":"usdc_","type":"address"},{"internalType":"address","name":"reservesManager_","type":"address"},{"internalType":"address","name":"distributor_","type":"address"},{"internalType":"address","name":"bonusDistributor_","type":"address"},{"internalType":"uint256","name":"periodBegin_","type":"uint256"},{"internalType":"uint256","name":"periodDuration_","type":"uint256"},{"internalType":"uint256","name":"bonusDuration_","type":"uint256"}],"internalType":"struct LiquidityGenerator.ConstuctorParams","name":"params_","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"prevAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"distributorTotalShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bonusDistributorTotalShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBonusShares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountMendi","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountUSDC","type":"uint256"}],"name":"Finalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"prevPendingAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"PendingAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"prevReservesManager","type":"address"},{"indexed":false,"internalType":"address","name":"newReservesManager","type":"address"}],"name":"ReservesManagerChanged","type":"event"},{"inputs":[],"name":"_acceptAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin_","type":"address"}],"name":"_setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reservesManager_","type":"address"}],"name":"_setReservesManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"bonusDistributorRecipients","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"lastShareIndex","type":"uint256"},{"internalType":"uint256","name":"credit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusDistributorTotalShares","outputs":[{"internalType":"uint256","name":"totalShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountUSDC","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"distributorRecipients","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"lastShareIndex","type":"uint256"},{"internalType":"uint256","name":"credit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributorTotalShares","outputs":[{"internalType":"uint256","name":"totalShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mendi","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodBegin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reservesManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101606040526000805460ff191690553480156200001c57600080fd5b5060405162001779380380620017798339810160408190526200003f9162000261565b60008160e0015111620000ad5760405162461bcd60e51b815260206004820152602b60248201527f4c697175696469747947656e657261746f723a20494e56414c49445f5045524960448201526a27a22fa22aa920aa24a7a760a91b60648201526084015b60405180910390fd5b6000816101000151118015620000cc57508060e0015181610100015111155b6200012d5760405162461bcd60e51b815260206004820152602a60248201527f4c697175696469747947656e657261746f723a20494e56414c49445f424f4e5560448201526929afa22aa920aa24a7a760b11b6064820152608401620000a4565b805160008054610100600160a81b0319166101006001600160a01b03938416810291909117909155602080840151831660809081526040850151841660a09081526060860151600280546001600160a01b03191691871691909117905590850151841660c09081529085015190931660e09081529284018051909252918301519051620001c692909190620001f7811b6200101d17901c565b6101205261010081015160c0820151620001ec91620001f7602090811b6200101d17901c565b61014052506200033c565b600062000205828462000315565b9392505050565b60405161012081016001600160401b03811182821017156200023e57634e487b7160e01b600052604160045260246000fd5b60405290565b80516001600160a01b03811681146200025c57600080fd5b919050565b600061012082840312156200027557600080fd5b6200027f6200020c565b6200028a8362000244565b81526200029a6020840162000244565b6020820152620002ad6040840162000244565b6040820152620002c06060840162000244565b6060820152620002d36080840162000244565b6080820152620002e660a0840162000244565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152508091505092915050565b600082198211156200033757634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c05160e051610100516101205161014051611372620004076000396000818161036c0152610b6e0152600081816102a1015281816105cf015261096a0152600081816101d4015281816108fa0152610ef70152600081816103b5015281816107930152818161089b01528181610af20152610bbd0152600081816104260152818161081201528181610c3a01528181610cde0152610ec4015260008181610258015281816106900152610aaf0152600081816102d5015261065101526113726000f3fe60806040526004361061012e5760003560e01c806384d572b4116100ab578063b6b55f251161006f578063b6b55f2514610401578063bfe1092814610414578063e9c714f214610448578063ea988b591461045d578063eb5ab75f1461047d578063f851a4401461049d57600080fd5b806384d572b4146103455780638bc85b031461035a578063a4fa00e01461038e578063b04c1e02146103a3578063b3f05b97146103d757600080fd5b80634bb278f3116100f25780634bb278f31461027a578063506ec0951461028f5780635f33f281146102c357806366082ffc146102f7578063796b89b91461033257600080fd5b806326782247146101855780632c995cae146101c2578063345ef941146102045780633a74a767146102245780633e413bee1461024657600080fd5b366101805760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a204241445f43414c4c0000000060448201526064015b60405180910390fd5b600080fd5b34801561019157600080fd5b506001546101a5906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101ce57600080fd5b506101f67f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101b9565b34801561021057600080fd5b506002546101a5906001600160a01b031681565b34801561023057600080fd5b5061024461023f3660046111b6565b6104c2565b005b34801561025257600080fd5b506101a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561028657600080fd5b50610244610579565b34801561029b57600080fd5b506101f67f000000000000000000000000000000000000000000000000000000000000000081565b3480156102cf57600080fd5b506101a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561030357600080fd5b506103176103123660046111b6565b61076d565b604080519384526020840192909252908201526060016101b9565b34801561033e57600080fd5b50426101f6565b34801561035157600080fd5b506101f661080e565b34801561036657600080fd5b506101f67f000000000000000000000000000000000000000000000000000000000000000081565b34801561039a57600080fd5b506101f6610897565b3480156103af57600080fd5b506101a57f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e357600080fd5b506000546103f19060ff1681565b60405190151581526020016101b9565b61024461040f3660046111df565b6108f7565b34801561042057600080fd5b506101a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561045457600080fd5b50610244610db2565b34801561046957600080fd5b506103176104783660046111b6565b610e9e565b34801561048957600080fd5b506102446104983660046111b6565b610ef5565b3480156104a957600080fd5b506000546101a59061010090046001600160a01b031681565b60005461010090046001600160a01b031633146104f15760405162461bcd60e51b8152600401610177906111f8565b6001600160a01b0381166105175760405162461bcd60e51b81526004016101779061122f565b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fce9caef2978509c160ecb4635d80502a939fccaf6f7f6967edbe940500cffd7791015b60405180910390a15050565b60005460ff16156105cc5760405162461bcd60e51b815260206004820152601d60248201527f4c697175696469747947656e657261746f723a2046494e414c495a45440000006044820152606401610177565b427f000000000000000000000000000000000000000000000000000000000000000081101561063d5760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f534f4f4e000000006044820152606401610177565b600254600090610679906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169116611030565b6002549091506000906106b8906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169116611030565b9050600260009054906101000a90046001600160a01b03166001600160a01b0316634bb278f36040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561070a57600080fd5b505af115801561071e573d6000803e3d6000fd5b50506000805460ff19166001179055505060408051838152602081018390527fb968440accd1ce5fa60b00de8bb8d8487eb2fda3c3701fb30fea3f69aa910a48910160405180910390a1505050565b6040516375c1018960e11b81526001600160a01b038281166004830152600091829182917f00000000000000000000000000000000000000000000000000000000000000009091169063eb820312906024015b606060405180830381865afa1580156107dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108019190611272565b9250925092509193909250565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089291906112a0565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086e573d6000803e3d6000fd5b427f00000000000000000000000000000000000000000000000000000000000000008110156109685760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f534f4f4e000000006044820152606401610177565b7f000000000000000000000000000000000000000000000000000000000000000081106109d75760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f4c415445000000006044820152606401610177565b62989680821015610a345760405162461bcd60e51b815260206004820152602160248201527f4c697175696469747947656e657261746f723a20494e56414c49445f56414c556044820152604560f81b6064820152608401610177565b6002546001600160a01b0316610a9e5760405162461bcd60e51b815260206004820152602960248201527f4c697175696469747947656e657261746f723a205a45524f5f414444524553536044820152685f524553455256455360b81b6064820152608401610177565b600254610ada906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116913391168561109e565b6040516375c1018960e11b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063eb82031290602401606060405180830381865afa158015610b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b659190611272565b509091508190507f0000000000000000000000000000000000000000000000000000000000000000831015610c2257610b9e828561101d565b6040516304674a9360e41b8152336004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634674a93090604401600060405180830381600087803b158015610c0957600080fd5b505af1158015610c1d573d6000803e3d6000fd5b505050505b6040516375c1018960e11b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063eb82031290602401606060405180830381865afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad9190611272565b5090915060009050610cbf828761101d565b6040516304674a9360e41b8152336004820152602481018290529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634674a93090604401600060405180830381600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b50505050336001600160a01b03167ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e4587610d7661080e565b610d7e610897565b60408051938452602084019290925290820152606081018490526080810186905260a00160405180910390a2505050505050565b6001546001600160a01b03163314610ddc5760405162461bcd60e51b8152600401610177906111f8565b60008054600180546001600160a01b03808216610100818102610100600160a81b0319871617968790556001600160a01b031990931690935560408051948390048216808652929095041660208401529290917f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fce9caef2978509c160ecb4635d80502a939fccaf6f7f6967edbe940500cffd77910161056d565b6040516375c1018960e11b81526001600160a01b038281166004830152600091829182917f00000000000000000000000000000000000000000000000000000000000000009091169063eb820312906024016107c0565b7f00000000000000000000000000000000000000000000000000000000000000004210610f6e5760405162461bcd60e51b815260206004820152602160248201527f4c697175696469747947656e657261746f723a204576656e74205374617274656044820152601960fa1b6064820152608401610177565b60005461010090046001600160a01b03163314610f9d5760405162461bcd60e51b8152600401610177906111f8565b6001600160a01b038116610fc35760405162461bcd60e51b81526004016101779061122f565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f3a4c1ee31657ea6603d60e66b12beae947df172538a56cb59b9f0c5534664578910161056d565b600061102982846112b9565b9392505050565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa15801561107a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102991906112a0565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161110291906112df565b6000604051808303816000865af19150503d806000811461113f576040519150601f19603f3d011682016040523d82523d6000602084013e611144565b606091505b509150915081801561116e57508051158061116e57508080602001905181019061116e919061131a565b6111ae5760405162461bcd60e51b815260206004820152601160248201527021736166655472616e7366657246726f6d60781b6044820152606401610177565b505050505050565b6000602082840312156111c857600080fd5b81356001600160a01b038116811461102957600080fd5b6000602082840312156111f157600080fd5b5035919050565b6020808252601d908201527f4c697175696469747947656e657261746f723a20464f5242494444454e000000604082015260600190565b60208082526023908201527f4c697175696469747947656e657261746f723a20494e56414c49445f4144445260408201526245535360e81b606082015260800190565b60008060006060848603121561128757600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156112b257600080fd5b5051919050565b600082198211156112da57634e487b7160e01b600052601160045260246000fd5b500190565b6000825160005b8181101561130057602081860181015185830152016112e6565b8181111561130f576000828501525b509190910192915050565b60006020828403121561132c57600080fd5b8151801515811461102957600080fdfea264697066735822122050c8bdfac12daff3bac48761968ea65a19bc8fac4197da4891b6c5452137fd0564736f6c634300080a003300000000000000000000000057cd331c7b2c7582625810465ea3cf9bdca2123600000000000000000000000043e8809ea748eff3204ee01f08872f063e44065f000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff000000000000000000000000e3cda0a0896b70f0ebc6a1848096529aa7aee9ee0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc434000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f50000000000000000000000000000000000000000000000000000000064d4df500000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000015180

Deployed Bytecode

0x60806040526004361061012e5760003560e01c806384d572b4116100ab578063b6b55f251161006f578063b6b55f2514610401578063bfe1092814610414578063e9c714f214610448578063ea988b591461045d578063eb5ab75f1461047d578063f851a4401461049d57600080fd5b806384d572b4146103455780638bc85b031461035a578063a4fa00e01461038e578063b04c1e02146103a3578063b3f05b97146103d757600080fd5b80634bb278f3116100f25780634bb278f31461027a578063506ec0951461028f5780635f33f281146102c357806366082ffc146102f7578063796b89b91461033257600080fd5b806326782247146101855780632c995cae146101c2578063345ef941146102045780633a74a767146102245780633e413bee1461024657600080fd5b366101805760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a204241445f43414c4c0000000060448201526064015b60405180910390fd5b600080fd5b34801561019157600080fd5b506001546101a5906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101ce57600080fd5b506101f67f0000000000000000000000000000000000000000000000000000000064d4df5081565b6040519081526020016101b9565b34801561021057600080fd5b506002546101a5906001600160a01b031681565b34801561023057600080fd5b5061024461023f3660046111b6565b6104c2565b005b34801561025257600080fd5b506101a57f000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff81565b34801561028657600080fd5b50610244610579565b34801561029b57600080fd5b506101f67f0000000000000000000000000000000000000000000000000000000064de19d081565b3480156102cf57600080fd5b506101a57f00000000000000000000000043e8809ea748eff3204ee01f08872f063e44065f81565b34801561030357600080fd5b506103176103123660046111b6565b61076d565b604080519384526020840192909252908201526060016101b9565b34801561033e57600080fd5b50426101f6565b34801561035157600080fd5b506101f661080e565b34801561036657600080fd5b506101f67f0000000000000000000000000000000000000000000000000000000064d630d081565b34801561039a57600080fd5b506101f6610897565b3480156103af57600080fd5b506101a57f000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f581565b3480156103e357600080fd5b506000546103f19060ff1681565b60405190151581526020016101b9565b61024461040f3660046111df565b6108f7565b34801561042057600080fd5b506101a57f0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc43481565b34801561045457600080fd5b50610244610db2565b34801561046957600080fd5b506103176104783660046111b6565b610e9e565b34801561048957600080fd5b506102446104983660046111b6565b610ef5565b3480156104a957600080fd5b506000546101a59061010090046001600160a01b031681565b60005461010090046001600160a01b031633146104f15760405162461bcd60e51b8152600401610177906111f8565b6001600160a01b0381166105175760405162461bcd60e51b81526004016101779061122f565b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fce9caef2978509c160ecb4635d80502a939fccaf6f7f6967edbe940500cffd7791015b60405180910390a15050565b60005460ff16156105cc5760405162461bcd60e51b815260206004820152601d60248201527f4c697175696469747947656e657261746f723a2046494e414c495a45440000006044820152606401610177565b427f0000000000000000000000000000000000000000000000000000000064de19d081101561063d5760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f534f4f4e000000006044820152606401610177565b600254600090610679906001600160a01b037f00000000000000000000000043e8809ea748eff3204ee01f08872f063e44065f81169116611030565b6002549091506000906106b8906001600160a01b037f000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff81169116611030565b9050600260009054906101000a90046001600160a01b03166001600160a01b0316634bb278f36040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561070a57600080fd5b505af115801561071e573d6000803e3d6000fd5b50506000805460ff19166001179055505060408051838152602081018390527fb968440accd1ce5fa60b00de8bb8d8487eb2fda3c3701fb30fea3f69aa910a48910160405180910390a1505050565b6040516375c1018960e11b81526001600160a01b038281166004830152600091829182917f000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f59091169063eb820312906024015b606060405180830381865afa1580156107dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108019190611272565b9250925092509193909250565b60007f0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc4346001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089291906112a0565b905090565b60007f000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f56001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086e573d6000803e3d6000fd5b427f0000000000000000000000000000000000000000000000000000000064d4df508110156109685760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f534f4f4e000000006044820152606401610177565b7f0000000000000000000000000000000000000000000000000000000064de19d081106109d75760405162461bcd60e51b815260206004820152601c60248201527f4c697175696469747947656e657261746f723a20544f4f5f4c415445000000006044820152606401610177565b62989680821015610a345760405162461bcd60e51b815260206004820152602160248201527f4c697175696469747947656e657261746f723a20494e56414c49445f56414c556044820152604560f81b6064820152608401610177565b6002546001600160a01b0316610a9e5760405162461bcd60e51b815260206004820152602960248201527f4c697175696469747947656e657261746f723a205a45524f5f414444524553536044820152685f524553455256455360b81b6064820152608401610177565b600254610ada906001600160a01b037f000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff8116913391168561109e565b6040516375c1018960e11b81523360048201526000907f000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f56001600160a01b03169063eb82031290602401606060405180830381865afa158015610b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b659190611272565b509091508190507f0000000000000000000000000000000000000000000000000000000064d630d0831015610c2257610b9e828561101d565b6040516304674a9360e41b8152336004820152602481018290529091507f000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f56001600160a01b031690634674a93090604401600060405180830381600087803b158015610c0957600080fd5b505af1158015610c1d573d6000803e3d6000fd5b505050505b6040516375c1018960e11b81523360048201526000907f0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc4346001600160a01b03169063eb82031290602401606060405180830381865afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad9190611272565b5090915060009050610cbf828761101d565b6040516304674a9360e41b8152336004820152602481018290529091507f0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc4346001600160a01b031690634674a93090604401600060405180830381600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b50505050336001600160a01b03167ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e4587610d7661080e565b610d7e610897565b60408051938452602084019290925290820152606081018490526080810186905260a00160405180910390a2505050505050565b6001546001600160a01b03163314610ddc5760405162461bcd60e51b8152600401610177906111f8565b60008054600180546001600160a01b03808216610100818102610100600160a81b0319871617968790556001600160a01b031990931690935560408051948390048216808652929095041660208401529290917f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fce9caef2978509c160ecb4635d80502a939fccaf6f7f6967edbe940500cffd77910161056d565b6040516375c1018960e11b81526001600160a01b038281166004830152600091829182917f0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc4349091169063eb820312906024016107c0565b7f0000000000000000000000000000000000000000000000000000000064d4df504210610f6e5760405162461bcd60e51b815260206004820152602160248201527f4c697175696469747947656e657261746f723a204576656e74205374617274656044820152601960fa1b6064820152608401610177565b60005461010090046001600160a01b03163314610f9d5760405162461bcd60e51b8152600401610177906111f8565b6001600160a01b038116610fc35760405162461bcd60e51b81526004016101779061122f565b600280546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f3a4c1ee31657ea6603d60e66b12beae947df172538a56cb59b9f0c5534664578910161056d565b600061102982846112b9565b9392505050565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa15801561107a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102991906112a0565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161110291906112df565b6000604051808303816000865af19150503d806000811461113f576040519150601f19603f3d011682016040523d82523d6000602084013e611144565b606091505b509150915081801561116e57508051158061116e57508080602001905181019061116e919061131a565b6111ae5760405162461bcd60e51b815260206004820152601160248201527021736166655472616e7366657246726f6d60781b6044820152606401610177565b505050505050565b6000602082840312156111c857600080fd5b81356001600160a01b038116811461102957600080fd5b6000602082840312156111f157600080fd5b5035919050565b6020808252601d908201527f4c697175696469747947656e657261746f723a20464f5242494444454e000000604082015260600190565b60208082526023908201527f4c697175696469747947656e657261746f723a20494e56414c49445f4144445260408201526245535360e81b606082015260800190565b60008060006060848603121561128757600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156112b257600080fd5b5051919050565b600082198211156112da57634e487b7160e01b600052601160045260246000fd5b500190565b6000825160005b8181101561130057602081860181015185830152016112e6565b8181111561130f576000828501525b509190910192915050565b60006020828403121561132c57600080fd5b8151801515811461102957600080fdfea264697066735822122050c8bdfac12daff3bac48761968ea65a19bc8fac4197da4891b6c5452137fd0564736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000057cd331c7b2c7582625810465ea3cf9bdca2123600000000000000000000000043e8809ea748eff3204ee01f08872f063e44065f000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff000000000000000000000000e3cda0a0896b70f0ebc6a1848096529aa7aee9ee0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc434000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f50000000000000000000000000000000000000000000000000000000064d4df500000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000015180

-----Decoded View---------------
Arg [0] : params_ (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000057cd331c7b2c7582625810465ea3cf9bdca21236
Arg [1] : 00000000000000000000000043e8809ea748eff3204ee01f08872f063e44065f
Arg [2] : 000000000000000000000000176211869ca2b568f2a7d4ee941e073a821ee1ff
Arg [3] : 000000000000000000000000e3cda0a0896b70f0ebc6a1848096529aa7aee9ee
Arg [4] : 0000000000000000000000005df2107a5b5e7b0b19dd7ded7470e8d9792bc434
Arg [5] : 000000000000000000000000716f2de8a4de036ffe2b806a2948060a6f1053f5
Arg [6] : 0000000000000000000000000000000000000000000000000000000064d4df50
Arg [7] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [8] : 0000000000000000000000000000000000000000000000000000000000015180


Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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.