Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
MasterChef
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 800 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {SafeERC20, IERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {Math} from "./libraries/Math.sol"; import {Rewarder} from "./libraries/Rewarder.sol"; import {Constants} from "./libraries/Constants.sol"; import {Amounts} from "./libraries/Amounts.sol"; import {IMetro} from "./interfaces/IMetro.sol"; import {IVoter} from "./interfaces/IVoter.sol"; import {IMasterChef} from "./interfaces/IMasterChef.sol"; import {IMasterChefRewarder} from "./interfaces/IMasterChefRewarder.sol"; import {IRewarderFactory, IBaseRewarder} from "./interfaces/IRewarderFactory.sol"; /** * @title Master Chef Contract * @author BlueLabs * @dev The MasterChef allows users to deposit tokens to earn METRO tokens distributed as liquidity mining rewards. * The METRO token is minted by the MasterChef contract and distributed to the users. * A share of the rewards is sent to the treasury. * The weight of each pool is determined by the amount of votes in the Voter contract and by the top pool ids. * On top of the Voter rewards, the MasterChef can also distribute extra rewards in other tokens using extra rewarders. * */ contract MasterChef is Ownable2StepUpgradeable, IMasterChef { using SafeERC20 for IERC20; using SafeERC20 for IMetro; using Math for uint256; using Rewarder for Rewarder.Parameter; using Amounts for Amounts.Parameter; IMetro private immutable _metro; IRewarderFactory private immutable _rewarderFactory; address private immutable _lbHooksManager; uint256 private immutable _treasuryShare; IVoter private _voter; address private _treasury; uint96 private _metroPerSecond; Farm[] private _farms; address private _trustee; bool private _mintMETRO; address private _operator; /// trackes the unclaimed rewards for each address, eg. we dont want pay out metro on deposit /// pid => account => unclaimedRewards; mapping(uint256 => mapping(address => uint256)) private unclaimedRewards; uint256[10] __gap; modifier onlyTrusted() { if (_trustee == address(0)) revert MasterChef__TrusteeNotSet(); if (msg.sender != _trustee) revert MasterChef__NotTrustedCaller(); _; } /** * @dev Constructor for the MasterChef contract. * @param metro The address of the METRO token. * @param rewarderFactory The address of the rewarder factory. * @param lbHooksManager The address of the LB hooks manager. * @param treasuryShare The share of the rewards that will be sent to the treasury. */ constructor(IMetro metro, IRewarderFactory rewarderFactory, address lbHooksManager, uint256 treasuryShare) { _disableInitializers(); if (treasuryShare > Constants.PRECISION) revert MasterChef__InvalidShares(); _metro = metro; _rewarderFactory = rewarderFactory; _lbHooksManager = lbHooksManager; _treasuryShare = treasuryShare; } /** * @dev Initializes the MasterChef contract. * @param initialOwner The initial owner of the contract. * @param treasury The initial treasury. */ function initialize(address initialOwner, address treasury, IVoter voter) external reinitializer(4) { __Ownable_init(initialOwner); _setTreasury(treasury); _voter = voter; _mintMETRO = false; } /** * @dev Returns the address of the METRO token. * @return The address of the METRO token. */ function getMetro() external view override returns (IMetro) { return _metro; } /** * @dev Returns the address of the Voter contract. * @return The address of the Voter contract. */ function getVoter() external view override returns (IVoter) { return _voter; } /** * @dev Returns the address of the rewarder factory. * @return The address of the rewarder factory. */ function getRewarderFactory() external view override returns (IRewarderFactory) { return _rewarderFactory; } /** * @dev Returns the address of the LB hooks manager. * @return The address of the LB hooks manager. */ function getLBHooksManager() external view override returns (address) { return _lbHooksManager; } /** * @dev Returns the address of the treasury. * @return The address of the treasury. */ function getTreasury() external view override returns (address) { return _treasury; } /** * @dev Returns the share of the rewards that will be sent to the treasury. * @return The share of the rewards that will be sent to the treasury. */ function getTreasuryShare() external view override returns (uint256) { return _treasuryShare; } /** * @dev Returns the number of farms. * @return The number of farms. */ function getNumberOfFarms() external view override returns (uint256) { return _farms.length; } /** * @dev Returns the deposit amount of an account on a farm. * @param pid The pool ID of the farm. * @param account The account to check for the deposit amount. * @return The deposit amount of the account on the farm. */ function getDeposit(uint256 pid, address account) external view override returns (uint256) { return _farms[pid].amounts.getAmountOf(account); } /** * @dev Returns the total deposit amount of a farm. * @param pid The pool ID of the farm. * @return The total deposit amount of the farm. */ function getTotalDeposit(uint256 pid) external view override returns (uint256) { return _farms[pid].amounts.getTotalAmount(); } /** * @dev Returns the pending rewards for a given account on a list of farms. * @param account The account to check for pending rewards. * @param pids The pool IDs of the farms. * @return metroRewards The METRO rewards for the account on the farms. * @return extraTokens The extra tokens from the extra rewarders. * @return extraRewards The extra rewards amounts from the extra rewarders. */ function getPendingRewards(address account, uint256[] calldata pids) external view override returns (uint256[] memory metroRewards, IERC20[] memory extraTokens, uint256[] memory extraRewards) { metroRewards = new uint256[](pids.length); extraTokens = new IERC20[](pids.length); extraRewards = new uint256[](pids.length); for (uint256 i; i < pids.length; ++i) { uint256 pid = pids[i]; Farm storage farm = _farms[pid]; Rewarder.Parameter storage rewarder = farm.rewarder; Amounts.Parameter storage amounts = farm.amounts; uint256 balance = amounts.getAmountOf(account); uint256 totalSupply = amounts.getTotalAmount(); { (, uint256 metroRewardForPid) = _calculateAmounts(_getRewardForPid(rewarder, pid, totalSupply)); metroRewards[i] = rewarder.getPendingReward(account, balance, totalSupply, metroRewardForPid) + unclaimedRewards[pid][account]; } IMasterChefRewarder extraRewarder = farm.extraRewarder; if (address(extraRewarder) != address(0)) { (extraTokens[i], extraRewards[i]) = extraRewarder.getPendingReward(account, balance, totalSupply); } } } /** * @dev Returns the token of a farm. * @param pid The pool ID of the farm. * @return The token of the farm. */ function getToken(uint256 pid) external view override returns (IERC20) { return _farms[pid].token; } /** * @dev Returns the last update timestamp of a farm. * @param pid The pool ID of the farm. * @return The last update timestamp of the farm. */ function getLastUpdateTimestamp(uint256 pid) external view override returns (uint256) { return _farms[pid].rewarder.lastUpdateTimestamp; } /** * @dev Returns the extra rewarder of a farm. * @param pid The pool ID of the farm. * @return The extra rewarder of the farm. */ function getExtraRewarder(uint256 pid) external view override returns (IMasterChefRewarder) { return _farms[pid].extraRewarder; } /** * @dev Returns the METRO per second. * @return The METRO per second. */ function getMetroPerSecond() external view override returns (uint256) { return _metroPerSecond; } /** * @dev Returns the mintMETRO flag. */ function getMintMetroFlag() external view returns (bool) { return _mintMETRO; } /** * @dev Returns the METRO per second for a given pool ID. * If the pool ID is not in the top pool IDs, it will return 0. * Else, it will return the METRO per second multiplied by the weight of the pool ID over the total weight. * @param pid The pool ID. * @return The METRO per second for the pool ID. */ function getMetroPerSecondForPid(uint256 pid) external view override returns (uint256) { return _getRewardForPid(pid, _metroPerSecond, _voter.getTotalWeight()); } /** * @dev Deposits tokens to a farm on behalf for user * @param pid The pool ID of the farm. * @param amount The amount of tokens to deposit. * @param to User account */ function depositOnBehalf(uint256 pid, uint256 amount, address to) external override onlyTrusted { _modify(pid, to, amount.toInt256(), false); if (amount > 0) _farms[pid].token.safeTransferFrom(msg.sender, address(this), amount); } /** * @dev Deposits tokens to a farm. * @param pid The pool ID of the farm. * @param amount The amount of tokens to deposit. */ function deposit(uint256 pid, uint256 amount) external override { _modify(pid, msg.sender, amount.toInt256(), false); if (amount > 0) _farms[pid].token.safeTransferFrom(msg.sender, address(this), amount); } /** * @dev Withdraws tokens from a farm. * @param pid The pool ID of the farm. * @param amount The amount of tokens to withdraw. */ function withdraw(uint256 pid, uint256 amount) external override { _modify(pid, msg.sender, -amount.toInt256(), true); if (amount > 0) _farms[pid].token.safeTransfer(msg.sender, amount); } /** * @dev Claims the rewards from a list of farms. * @param pids The pool IDs of the farms. */ function claim(uint256[] calldata pids) external override { for (uint256 i; i < pids.length; ++i) { _modify(pids[i], msg.sender, 0, true); } } /** * @dev Emergency withdraws tokens from a farm, without claiming any rewards. * @param pid The pool ID of the farm. */ function emergencyWithdraw(uint256 pid) external override { Farm storage farm = _farms[pid]; uint256 balance = farm.amounts.getAmountOf(msg.sender); int256 deltaAmount = -balance.toInt256(); // redistribute rewards (uint256 oldBalance, uint256 newBalance, uint256 oldTotalSupply, uint256 newTotalSupply) = farm.amounts.update(msg.sender, deltaAmount); uint256 totalMetroRewardForPid = _getRewardForPid(farm.rewarder, pid, oldTotalSupply); uint256 metroRewardForPid = _mintMetro(totalMetroRewardForPid); uint256 metroReward = farm.rewarder.update(msg.sender, oldBalance, newBalance, oldTotalSupply, metroRewardForPid); metroReward = metroReward + unclaimedRewards[pid][msg.sender]; unclaimedRewards[pid][msg.sender] = 0; // update share farm.rewarder.updateAccDebtPerShare(newTotalSupply, metroReward); farm.token.safeTransfer(msg.sender, balance); IMasterChefRewarder extraRewarder = farm.extraRewarder; if (address(extraRewarder) != address(0)) { farm.extraRewarder.onEmergency(msg.sender, pid, oldBalance, newBalance, oldTotalSupply); } emit PositionModified(pid, msg.sender, deltaAmount, 0); } /** * @dev Updates all the farms in the pids list. * @param pids The pool IDs to update. */ function updateAll(uint256[] calldata pids) external override { _updateAll(pids); } /** * @dev Sets the METRO per second. * You have to update all farms before setting the emission rate with updateAll function * @param lumPerSecond The new METRO per second. */ function setMetroPerSecond(uint96 lumPerSecond) external override onlyOwner { if (lumPerSecond > Constants.MAX_METRO_PER_SECOND) revert MasterChef__InvalidMetroPerSecond(); _metroPerSecond = lumPerSecond; emit MetroPerSecondSet(lumPerSecond); } /** * @dev Adds a farm. * @param token The token of the farm. * @param extraRewarder The extra rewarder of the farm. */ function add(IERC20 token, IMasterChefRewarder extraRewarder) external override { if (msg.sender != address(_lbHooksManager)) _checkOwnerOrOperator(); uint256 pid = _farms.length; Farm storage farm = _farms.push(); farm.token = token; farm.rewarder.lastUpdateTimestamp = block.timestamp; if (address(extraRewarder) != address(0)) _setExtraRewarder(pid, extraRewarder); token.balanceOf(address(this)); // sanity check emit FarmAdded(pid, token); } /** * @dev Sets the extra rewarder of a farm. * @param pid The pool ID of the farm. * @param extraRewarder The new extra rewarder of the farm. */ function setExtraRewarder(uint256 pid, IMasterChefRewarder extraRewarder) external override onlyOwner { _setExtraRewarder(pid, extraRewarder); } /** * @dev Sets the treasury. * @param treasury The new treasury. */ function setTreasury(address treasury) external override onlyOwner { _setTreasury(treasury); } /** * @dev Sets voter * @param voter The new voter. */ function setVoter(IVoter voter) external override onlyOwner { if (address(voter) == address(0)) revert MasterChef__ZeroAddress(); _voter = voter; emit VoterSet(voter); } /** * @dev Sets trustee * @param trustee The new trustee. */ function setTrustee(address trustee) external onlyOwner { _trustee = trustee; emit TrusteeSet(trustee); } /** * @dev Sets mintMetro. If true this will mint new metro, on false this will just emit * @param mintMetro The new mintMetro. */ function setMintMetro(bool mintMetro) external onlyOwner { _mintMETRO = mintMetro; emit MintMetroSet(mintMetro); } /** * @dev Updates the operator. * @param operator The new operator. */ function updateOperator(address operator) external onlyOwner { _operator = operator; emit OperatorUpdated(operator); } /** * @dev Blocks the renouncing of ownership. */ function renounceOwnership() public pure override { revert MasterChef__CannotRenounceOwnership(); } /** * @dev Returns the reward for a given pool ID. * If the pool ID is not in the top pool IDs, it will return 0. * Else, it will return the reward multiplied by the weight of the pool ID over the total weight. * @param rewarder The storage pointer to the rewarder. * @param pid The pool ID. * @param totalSupply The total supply. * @return The reward for the pool ID. */ function _getRewardForPid(Rewarder.Parameter storage rewarder, uint256 pid, uint256 totalSupply) private view returns (uint256) { return _getRewardForPid(pid, rewarder.getTotalRewards(_metroPerSecond, totalSupply), _voter.getTotalWeight()); } /** * @dev Returns the reward for a given pool ID. * If the pool ID is not in the top pool IDs, it will return 0. * Else, it will return the reward multiplied by the weight of the pool ID over the total weight. * @param pid The pool ID. * @param totalRewards The total rewards. * @param totalWeight The total weight. * @return The reward for the pool ID. */ function _getRewardForPid(uint256 pid, uint256 totalRewards, uint256 totalWeight) private view returns (uint256) { return totalWeight == 0 ? 0 : totalRewards * _voter.getWeight(pid) / totalWeight; } /** * @dev Sets the extra rewarder of a farm. * Will call link/unlink to make sure the rewarders are properly set/unset. * It is very important that a rewarder that was previously linked can't be linked again. * @param pid The pool ID of the farm. * @param extraRewarder The new extra rewarder of the farm. */ function _setExtraRewarder(uint256 pid, IMasterChefRewarder extraRewarder) private { if ( address(extraRewarder) != address(0) && _rewarderFactory.getRewarderType(extraRewarder) != IRewarderFactory.RewarderType.MasterChefRewarder ) { revert MasterChef__NotMasterchefRewarder(); } IMasterChefRewarder oldExtraRewarder = _farms[pid].extraRewarder; if (address(oldExtraRewarder) != address(0)) oldExtraRewarder.unlink(pid); if (address(extraRewarder) != address(0)) extraRewarder.link(pid); _farms[pid].extraRewarder = extraRewarder; emit ExtraRewarderSet(pid, extraRewarder); } /** * @dev Updates all the farms in the pids list. * @param pids The pool IDs to update. */ function _updateAll(uint256[] memory pids) private { uint256 length = pids.length; uint256 totalWeight = _voter.getTotalWeight(); uint256 lumPerSecond = _metroPerSecond; for (uint256 i; i < length; ++i) { uint256 pid = pids[i]; Farm storage farm = _farms[pid]; Rewarder.Parameter storage rewarder = farm.rewarder; uint256 totalSupply = farm.amounts.getTotalAmount(); uint256 totalRewards = rewarder.getTotalRewards(lumPerSecond, totalSupply); uint256 totalMetroRewardForPid = _getRewardForPid(pid, totalRewards, totalWeight); uint256 metroRewardForPid = _mintMetro(totalMetroRewardForPid); rewarder.updateAccDebtPerShare(totalSupply, metroRewardForPid); } } /** * @dev Modifies the position of an account on a farm. * @param pid The pool ID of the farm. * @param account The account to modify the position of. * @param deltaAmount The delta amount to modify the position with. * @param isPayOutReward If true, the rewards will be paid out, otherwise accrued */ function _modify(uint256 pid, address account, int256 deltaAmount, bool isPayOutReward) private { Farm storage farm = _farms[pid]; Rewarder.Parameter storage rewarder = farm.rewarder; IMasterChefRewarder extraRewarder = farm.extraRewarder; (uint256 oldBalance, uint256 newBalance, uint256 oldTotalSupply,) = farm.amounts.update(account, deltaAmount); uint256 totalMetroRewardForPid = _getRewardForPid(rewarder, pid, oldTotalSupply); uint256 metroRewardForPid = _mintMetro(totalMetroRewardForPid); uint256 metroReward = rewarder.update(account, oldBalance, newBalance, oldTotalSupply, metroRewardForPid); if (isPayOutReward) { metroReward = metroReward + unclaimedRewards[pid][account]; unclaimedRewards[pid][account] = 0; if (metroReward > 0) _metro.safeTransfer(account, metroReward); } else { unclaimedRewards[pid][account] += metroReward; } if (address(extraRewarder) != address(0)) { extraRewarder.onModify(account, pid, oldBalance, newBalance, oldTotalSupply); } emit PositionModified(pid, account, deltaAmount, metroReward); } /** * @dev Sets the treasury. * @param treasury The new treasury. */ function _setTreasury(address treasury) private { if (treasury == address(0)) revert MasterChef__ZeroAddress(); _treasury = treasury; emit TreasurySet(treasury); } /** * @dev Mints METRO tokens to the treasury and to this contract if _mintMetro is true. * If _mintMetro is false the contract needs to be funded with METRO tokens. * @param amount The amount of METRO tokens to mint. * @return The amount of METRO tokens minted for liquidity mining. */ function _mintMetro(uint256 amount) private returns (uint256) { if (amount == 0) return 0; (uint256 treasuryAmount, uint256 liquidityMiningAmount) = _calculateAmounts(amount); if (!_mintMETRO) { _metro.safeTransfer(_treasury, treasuryAmount); return liquidityMiningAmount; } _metro.mint(_treasury, treasuryAmount); return _metro.mint(address(this), liquidityMiningAmount); } /** * @dev Calculates the amounts of MOE tokens to mint for each recipient. * @param amount The amount of MOE tokens to mint. * @return treasuryAmount The amount of MOE tokens to mint for the treasury. * @return liquidityMiningAmount The amount of MOE tokens to mint for liquidity mining. */ function _calculateAmounts(uint256 amount) private view returns (uint256 treasuryAmount, uint256 liquidityMiningAmount) { treasuryAmount = amount * _treasuryShare / Constants.PRECISION; liquidityMiningAmount = amount - treasuryAmount; } function _checkOwnerOrOperator() private view { if (msg.sender != address(_operator)) _checkOwner(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {OwnableUpgradeable} from "./OwnableUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step struct Ownable2StepStorage { address _pendingOwner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00; function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) { assembly { $.slot := Ownable2StepStorageLocation } } event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); function __Ownable2Step_init() internal onlyInitializing { } function __Ownable2Step_init_unchained() internal onlyInitializing { } /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); return $._pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); $._pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); delete $._pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @title Math * @dev Library for mathematical operations with overflow and underflow checks. */ library Math { error Math__UnderOverflow(); uint256 internal constant MAX_INT256 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /** * @dev Adds a signed integer to an unsigned integer with overflow check. * The result must be greater than or equal to 0 and less than or equal to MAX_INT256. * @param x Unsigned integer to add to. * @param delta Signed integer to add. * @return y The result of the addition. */ function addDelta(uint256 x, int256 delta) internal pure returns (uint256 y) { uint256 success; assembly { y := add(x, delta) success := iszero(or(gt(x, MAX_INT256), gt(y, MAX_INT256))) } if (success == 0) revert Math__UnderOverflow(); } /** * @dev Safely converts an unsigned integer to a signed integer. * @param x Unsigned integer to convert. * @return y Signed integer result. */ function toInt256(uint256 x) internal pure returns (int256 y) { if (x > MAX_INT256) revert Math__UnderOverflow(); return int256(x); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {Amounts} from "./Amounts.sol"; import {Constants} from "./Constants.sol"; /** * @title Rewarder Library * @dev A library that defines various functions for calculating rewards. * It takes care about the reward debt and the accumulated debt per share. */ library Rewarder { using Amounts for Amounts.Parameter; struct Parameter { uint256 lastUpdateTimestamp; uint256 accDebtPerShare; mapping(address => uint256) debt; } /** * @dev Returns the debt associated with an amount. * @param accDebtPerShare The accumulated debt per share. * @param deposit The amount. * @return The debt associated with the amount. */ function getDebt(uint256 accDebtPerShare, uint256 deposit) internal pure returns (uint256) { return (deposit * accDebtPerShare) >> Constants.ACC_PRECISION_BITS; } /** * @dev Returns the debt per share associated with a total deposit and total rewards. * @param totalDeposit The total deposit. * @param totalRewards The total rewards. * @return The debt per share associated with the total deposit and total rewards. */ function getDebtPerShare(uint256 totalDeposit, uint256 totalRewards) internal pure returns (uint256) { return totalDeposit == 0 ? 0 : (totalRewards << Constants.ACC_PRECISION_BITS) / totalDeposit; } /** * @dev Returns the total rewards to emit. * If the end timestamp is in the past, the rewards are calculated up to the end timestamp. * If the last update timestamp is in the future, it will return 0. * @param rewarder The storage pointer to the rewarder. * @param rewardPerSecond The reward per second. * @param endTimestamp The end timestamp. * @param totalSupply The total supply. * @return The total rewards. */ function getTotalRewards( Parameter storage rewarder, uint256 rewardPerSecond, uint256 endTimestamp, uint256 totalSupply ) internal view returns (uint256) { if (totalSupply == 0) return 0; uint256 lastUpdateTimestamp = rewarder.lastUpdateTimestamp; uint256 timestamp = block.timestamp > endTimestamp ? endTimestamp : block.timestamp; return timestamp > lastUpdateTimestamp ? (timestamp - lastUpdateTimestamp) * rewardPerSecond : 0; } /** * @dev Returns the total rewards to emit. * @param rewarder The storage pointer to the rewarder. * @param rewardPerSecond The reward per second. * @param totalSupply The total supply. * @return The total rewards. */ function getTotalRewards(Parameter storage rewarder, uint256 rewardPerSecond, uint256 totalSupply) internal view returns (uint256) { return getTotalRewards(rewarder, rewardPerSecond, block.timestamp, totalSupply); } /** * @dev Returns the pending reward of an account. * @param rewarder The storage pointer to the rewarder. * @param amounts The storage pointer to the amounts. * @param account The address of the account. * @param totalRewards The total rewards. * @return The pending reward of the account. */ function getPendingReward( Parameter storage rewarder, Amounts.Parameter storage amounts, address account, uint256 totalRewards ) internal view returns (uint256) { return getPendingReward(rewarder, account, amounts.getAmountOf(account), amounts.getTotalAmount(), totalRewards); } /** * @dev Returns the pending reward of an account. * If the balance of the account is 0, it will always return 0. * @param rewarder The storage pointer to the rewarder. * @param account The address of the account. * @param balance The balance of the account. * @param totalSupply The total supply. * @param totalRewards The total rewards. * @return The pending reward of the account. */ function getPendingReward( Parameter storage rewarder, address account, uint256 balance, uint256 totalSupply, uint256 totalRewards ) internal view returns (uint256) { uint256 accDebtPerShare = rewarder.accDebtPerShare + getDebtPerShare(totalSupply, totalRewards); return balance == 0 ? 0 : getDebt(accDebtPerShare, balance) - rewarder.debt[account]; } /** * @dev Updates the rewarder. * If the balance of the account is 0, it will always return 0. * @param rewarder The storage pointer to the rewarder. * @param account The address of the account. * @param oldBalance The old balance of the account. * @param newBalance The new balance of the account. * @param totalSupply The total supply. * @param totalRewards The total rewards. * @return rewards The rewards of the account. */ function update( Parameter storage rewarder, address account, uint256 oldBalance, uint256 newBalance, uint256 totalSupply, uint256 totalRewards ) internal returns (uint256 rewards) { uint256 accDebtPerShare = updateAccDebtPerShare(rewarder, totalSupply, totalRewards); rewards = oldBalance == 0 ? 0 : getDebt(accDebtPerShare, oldBalance) - rewarder.debt[account]; rewarder.debt[account] = getDebt(accDebtPerShare, newBalance); } /** * @dev Updates the accumulated debt per share. * If the last update timestamp is in the future, it will not update the last update timestamp. * @param rewarder The storage pointer to the rewarder. * @param totalSupply The total supply. * @param totalRewards The total rewards. * @return The accumulated debt per share. */ function updateAccDebtPerShare(Parameter storage rewarder, uint256 totalSupply, uint256 totalRewards) internal returns (uint256) { uint256 debtPerShare = getDebtPerShare(totalSupply, totalRewards); if (block.timestamp > rewarder.lastUpdateTimestamp) rewarder.lastUpdateTimestamp = block.timestamp; return debtPerShare == 0 ? rewarder.accDebtPerShare : rewarder.accDebtPerShare += debtPerShare; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @title Constants Library * @dev A library that defines various constants used throughout the codebase. */ library Constants { uint256 internal constant ACC_PRECISION_BITS = 64; uint256 internal constant PRECISION = 1e18; uint256 internal constant MAX_NUMBER_OF_FARMS = 32; uint256 internal constant MAX_NUMBER_OF_REWARDS = 32; uint256 internal constant MAX_METRO_PER_SECOND = 10e18; uint256 internal constant MAX_BRIBES_PER_POOL = 5; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {Math} from "./Math.sol"; /** * @title Amounts Library * @dev A library that defines various functions for manipulating amounts of a key and a total. * The key can be bytes32, address, or uint256. */ library Amounts { using Math for uint256; struct Parameter { uint256 totalAmount; mapping(bytes32 => uint256) amounts; } /** * @dev Returns the amount of a key. * @param amounts The storage pointer to the amounts. * @param key The key of the amount. * @return The amount of the key. */ function getAmountOf(Parameter storage amounts, bytes32 key) internal view returns (uint256) { return amounts.amounts[key]; } /** * @dev Returns the amount of an address. * @param amounts The storage pointer to the amounts. * @param account The address of the amount. * @return The amount of the address. */ function getAmountOf(Parameter storage amounts, address account) internal view returns (uint256) { return getAmountOf(amounts, bytes32(uint256(uint160(account)))); } /** * @dev Returns the amount of an id. * @param amounts The storage pointer to the amounts. * @param id The id of the amount. * @return The amount of the id. */ function getAmountOf(Parameter storage amounts, uint256 id) internal view returns (uint256) { return getAmountOf(amounts, bytes32(id)); } /** * @dev Returns the total amount. * @param amounts The storage pointer to the amounts. * @return The total amount. */ function getTotalAmount(Parameter storage amounts) internal view returns (uint256) { return amounts.totalAmount; } /** * @dev Updates the amount of a key. The delta is added to the key amount and the total amount. * @param amounts The storage pointer to the amounts. * @param key The key of the amount. * @param deltaAmount The delta amount to update. * @return oldAmount The old amount of the key. * @return newAmount The new amount of the key. * @return oldTotalAmount The old total amount. * @return newTotalAmount The new total amount. */ function update(Parameter storage amounts, bytes32 key, int256 deltaAmount) internal returns (uint256 oldAmount, uint256 newAmount, uint256 oldTotalAmount, uint256 newTotalAmount) { oldAmount = amounts.amounts[key]; oldTotalAmount = amounts.totalAmount; if (deltaAmount == 0) { newAmount = oldAmount; newTotalAmount = oldTotalAmount; } else { newAmount = oldAmount.addDelta(deltaAmount); newTotalAmount = oldTotalAmount.addDelta(deltaAmount); amounts.amounts[key] = newAmount; amounts.totalAmount = newTotalAmount; } } /** * @dev Updates the amount of an address. The delta is added to the address amount and the total amount. * @param amounts The storage pointer to the amounts. * @param account The address of the amount. * @param deltaAmount The delta amount to update. * @return oldAmount The old amount of the key. * @return newAmount The new amount of the key. * @return oldTotalAmount The old total amount. * @return newTotalAmount The new total amount. */ function update(Parameter storage amounts, address account, int256 deltaAmount) internal returns (uint256 oldAmount, uint256 newAmount, uint256 oldTotalAmount, uint256 newTotalAmount) { return update(amounts, bytes32(uint256(uint160(account))), deltaAmount); } /** * @dev Updates the amount of an id. The delta is added to the id amount and the total amount. * @param amounts The storage pointer to the amounts. * @param id The id of the amount. * @param deltaAmount The delta amount to update. * @return oldAmount The old amount of the key. * @return newAmount The new amount of the key. * @return oldTotalAmount The old total amount. * @return newTotalAmount The new total amount. */ function update(Parameter storage amounts, uint256 id, int256 deltaAmount) internal returns (uint256 oldAmount, uint256 newAmount, uint256 oldTotalAmount, uint256 newTotalAmount) { return update(amounts, bytes32(id), deltaAmount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; interface IMetro is IERC20 { function mint(address account, uint256 amount) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {IBribeRewarder} from "./IBribeRewarder.sol"; import {IMasterChef} from "./IMasterChef.sol"; interface IVoter { error IVoter__InvalidLength(); error IVoter_VotingPeriodNotStarted(); error IVoter_VotingPeriodEnded(); error IVoter__AlreadyVoted(); error IVoter__NotOwner(); error IVoter__InsufficientVotingPower(); error IVoter__TooManyPoolIds(); error IVoter__DuplicatePoolId(uint256 pid); error IVoter__InsufficientLockTime(); error Voter__InvalidRegisterCaller(); error Voter__PoolNotVotable(); error IVoter__NoFinishedPeriod(); error IVoter_ZeroValue(); error IVoter__EmergencyUnlock(); event VotingPeriodStarted(); event Voted(uint256 indexed tokenId, uint256 votingPeriod, address[] votedPools, uint256[] votesDeltaAmounts); event TopPoolIdsWithWeightsSet(uint256[] poolIds, uint256[] pidWeights); event VoterPoolValidatorUpdated(address indexed validator); event VotingDurationUpdated(uint256 duration); event MinimumLockTimeUpdated(uint256 lockTime); event MinimumVotesPerPoolUpdated(uint256 minimum); event OperatorUpdated(address indexed operator); event ElevatedRewarderAdded(address indexed rewarder); event ElevatedRewarderRemoved(address indexed rewarder); struct VotingPeriod { uint256 startTime; uint256 endTime; } function getMasterChef() external view returns (IMasterChef); function getTotalWeight() external view returns (uint256); function getTopPoolIds() external view returns (uint256[] memory); function getWeight(uint256 pid) external view returns (uint256); function hasVoted(uint256 period, uint256 tokenId) external view returns (bool); function getCurrentVotingPeriod() external view returns (uint256); function getLatestFinishedPeriod() external view returns (uint256); function getPeriodStartTime() external view returns (uint256); function getPeriodStartEndtime(uint256 periodId) external view returns (uint256, uint256); function getVotesPerPeriod(uint256 periodId, address pool) external view returns (uint256); function getVotedPools() external view returns (address[] memory); function getVotedPoolsLength() external view returns (uint256); function getVotedPoolsAtIndex(uint256 index) external view returns (address, uint256); function getTotalVotes() external view returns (uint256); function getUserVotes(uint256 tokenId, address pool) external view returns (uint256); function getPoolVotesPerPeriod(uint256 periodId, address pool) external view returns (uint256); function getUserBribeRewaderAt(uint256 period, address account, uint256 index) external view returns (IBribeRewarder); function getUserBribeRewarderLength(uint256 period, address account) external view returns (uint256); function getBribeRewarderAt(uint256 period, address pool, uint256 index) external view returns (IBribeRewarder); function getBribeRewarderLength(uint256 period, address pool) external view returns (uint256); function ownerOf(uint256 tokenId, address account) external view returns (bool); function onRegister() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; import {IMasterChefRewarder} from "./IMasterChefRewarder.sol"; import {IMetro} from "./IMetro.sol"; import {IVoter} from "./IVoter.sol"; import {Rewarder} from "../libraries/Rewarder.sol"; import {Amounts} from "../libraries/Amounts.sol"; import {IRewarderFactory} from "./IRewarderFactory.sol"; interface IMasterChef { error MasterChef__InvalidShares(); error MasterChef__InvalidMetroPerSecond(); error MasterChef__ZeroAddress(); error MasterChef__NotMasterchefRewarder(); error MasterChef__CannotRenounceOwnership(); error MasterChef__MintFailed(); error MasterChef__TrusteeNotSet(); error MasterChef__NotTrustedCaller(); struct Farm { Amounts.Parameter amounts; Rewarder.Parameter rewarder; IERC20 token; IMasterChefRewarder extraRewarder; } // bool depositOnBehalf; // true if v2 pool zap in should be possible // uint256 startTime; event PositionModified(uint256 indexed pid, address indexed account, int256 deltaAmount, uint256 metroReward); event MetroPerSecondSet(uint256 metroPerSecond); event FarmAdded(uint256 indexed pid, IERC20 indexed token); event ExtraRewarderSet(uint256 indexed pid, IMasterChefRewarder extraRewarder); event TreasurySet(address indexed treasury); event VoterSet(IVoter indexed newVoter); event TrusteeSet(address indexed trustee); event MintMetroSet(bool mintMetro); event OperatorUpdated(address indexed operator); function add(IERC20 token, IMasterChefRewarder extraRewarder) external; function claim(uint256[] memory pids) external; function deposit(uint256 pid, uint256 amount) external; function depositOnBehalf(uint256 pid, uint256 amount, address account) external; function emergencyWithdraw(uint256 pid) external; function getDeposit(uint256 pid, address account) external view returns (uint256); function getLastUpdateTimestamp(uint256 pid) external view returns (uint256); function getPendingRewards(address account, uint256[] memory pids) external view returns (uint256[] memory metroRewards, IERC20[] memory extraTokens, uint256[] memory extraRewards); function getExtraRewarder(uint256 pid) external view returns (IMasterChefRewarder); function getMetro() external view returns (IMetro); function getMetroPerSecond() external view returns (uint256); function getMetroPerSecondForPid(uint256 pid) external view returns (uint256); function getNumberOfFarms() external view returns (uint256); function getToken(uint256 pid) external view returns (IERC20); function getTotalDeposit(uint256 pid) external view returns (uint256); function getTreasury() external view returns (address); function getTreasuryShare() external view returns (uint256); function getRewarderFactory() external view returns (IRewarderFactory); function getLBHooksManager() external view returns (address); function getVoter() external view returns (IVoter); function setExtraRewarder(uint256 pid, IMasterChefRewarder extraRewarder) external; function setMetroPerSecond(uint96 metroPerSecond) external; function setTreasury(address treasury) external; function setVoter(IVoter voter) external; function setTrustee(address trustee) external; function updateAll(uint256[] calldata pids) external; function withdraw(uint256 pid, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IBaseRewarder} from "./IBaseRewarder.sol"; interface IMasterChefRewarder is IBaseRewarder { error MasterChefRewarder__AlreadyLinked(); error MasterChefRewarder__NotLinked(); error MasterChefRewarder__UseUnlink(); enum Status { Unlinked, Linked, Stopped } function link(uint256 pid) external; function unlink(uint256 pid) external; function onEmergency(address account, uint256 pid, uint256 oldBalance, uint256 newBalance, uint256 oldTotalSupply) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; import {IRewarder} from "../interfaces/IRewarder.sol"; import {IBribeRewarder} from "../interfaces/IBribeRewarder.sol"; import {IBaseRewarder} from "../interfaces/IBaseRewarder.sol"; interface IRewarderFactory { error RewarderFactory__ZeroAddress(); error RewarderFactory__InvalidRewarderType(); error RewarderFactory__InvalidPid(); error RewarderFactory__TokenNotWhitelisted(); error RewarderFactory__InvalidLength(); enum RewarderType { InvalidRewarder, MasterChefRewarder, BribeRewarder } event RewarderCreated( RewarderType indexed rewarderType, IERC20 indexed token, uint256 indexed pid, IBaseRewarder rewarder ); event BribeRewarderCreated( RewarderType indexed rewarderType, IERC20 indexed token, address indexed pool, IBribeRewarder rewarder ); event RewarderImplementationSet(RewarderType indexed rewarderType, IRewarder indexed implementation); function getBribeCreatorFee() external view returns (uint256); function getWhitelistedTokenInfo (address token) external view returns (bool, uint256); function getRewarderImplementation(RewarderType rewarderType) external view returns (IRewarder); function getRewarderCount(RewarderType rewarderType) external view returns (uint256); function getRewarderAt(RewarderType rewarderType, uint256 index) external view returns (IRewarder); function getRewarderType(IRewarder rewarder) external view returns (RewarderType); function setRewarderImplementation(RewarderType rewarderType, IRewarder implementation) external; function createRewarder(RewarderType rewarderType, IERC20 token, uint256 pid) external returns (IBaseRewarder); function createBribeRewarder(IERC20 token, address pool) external returns (IBribeRewarder); function setWhitelist(address[] calldata tokens, uint256[] calldata minBribeAmounts) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; import {IRewarder} from "./IRewarder.sol"; interface IBribeRewarder is IRewarder { error BribeRewarder__OnlyVoter(); error BribeRewarder__InsufficientFunds(); error BribeRewarder__WrongStartId(); error BribeRewarder__WrongEndId(); error BribeRewarder__ZeroReward(); error BribeRewarder__NativeTransferFailed(); error BribeRewarder__NotOwner(); error BribeRewarder__CannotRenounceOwnership(); error BribeRewarder__NotNativeRewarder(); error BribeRewarder__AlreadyInitialized(); error BribeRewarder__PeriodNotFound(); error BribeRewarder__AmountTooLow(); error BribeRewarder__OnlyVoterAdmin(); event Claimed(address indexed account, address indexed pool, uint256 amount); event Deposited(uint256 indexed periodId, address indexed account, address indexed pool, uint256 amount); event BribeInit(uint256 indexed startId, uint256 indexed lastId, uint256 amountPerPeriod); event Swept(IERC20 indexed token, address indexed account, uint256 amount); function bribe(uint256 startId, uint256 lastId, uint256 amountPerPeriod) external; function claim(address account) external; function deposit(uint256 periodId, address account, uint256 deltaAmount) external; function getPool() external view returns (address); function getPendingReward(address account) external view returns (uint256); function getBribePeriods() external view returns (address pool, uint256[] memory); function getStartVotingPeriodId() external view returns (uint256); function getLastVotingPeriodId() external view returns (uint256); function getAmountPerPeriod() external view returns (uint256); function sweep(IERC20 token, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; import {IRewarder} from "./IRewarder.sol"; interface IBaseRewarder is IRewarder { error BaseRewarder__NativeTransferFailed(); error BaseRewarder__InvalidCaller(); error BaseRewarder__Stopped(); error BaseRewarder__AlreadyStopped(); error BaseRewarder__NotNativeRewarder(); error BaseRewarder__ZeroAmount(); error BaseRewarder__ZeroReward(); error BaseRewarder__InvalidDuration(); error BaseRewarder__InvalidPid(uint256 pid); error BaseRewarder__InvalidStartTimestamp(uint256 startTimestamp); error BaseRewarder__CannotRenounceOwnership(); event Claim(address indexed account, IERC20 indexed token, uint256 reward); event RewardParameterUpdated(uint256 rewardPerSecond, uint256 startTimestamp, uint256 endTimestamp); event Stopped(); event Swept(IERC20 indexed token, address indexed account, uint256 amount); function getToken() external view returns (IERC20); function getCaller() external view returns (address); function getPid() external view returns (uint256); function getRewarderParameter() external view returns (IERC20 token, uint256 rewardPerSecond, uint256 lastUpdateTimestamp, uint256 endTimestamp); function getRemainingReward() external view returns (uint256); function getPendingReward(address account, uint256 balance, uint256 totalSupply) external view returns (IERC20 token, uint256 pendingReward); function isStopped() external view returns (bool); function initialize(address initialOwner) external; function setRewardPerSecond(uint256 maxRewardPerSecond, uint256 expectedDuration) external returns (uint256 rewardPerSecond); function setRewarderParameters(uint256 maxRewardPerSecond, uint256 startTimestamp, uint256 expectedDuration) external returns (uint256 rewardPerSecond); function stop() external; function sweep(IERC20 token, address account) external; function onModify(address account, uint256 pid, uint256 oldBalance, uint256 newBalance, uint256 totalSupply) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; interface IRewarder { function getToken() external view returns (IERC20); function getCaller() external view returns (address); function initialize(address initialOwner) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "solmate/=lib/solmate/", "joe-v2/=lib/joe-v2/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IMetro","name":"metro","type":"address"},{"internalType":"contract IRewarderFactory","name":"rewarderFactory","type":"address"},{"internalType":"address","name":"lbHooksManager","type":"address"},{"internalType":"uint256","name":"treasuryShare","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"MasterChef__CannotRenounceOwnership","type":"error"},{"inputs":[],"name":"MasterChef__InvalidMetroPerSecond","type":"error"},{"inputs":[],"name":"MasterChef__InvalidShares","type":"error"},{"inputs":[],"name":"MasterChef__MintFailed","type":"error"},{"inputs":[],"name":"MasterChef__NotMasterchefRewarder","type":"error"},{"inputs":[],"name":"MasterChef__NotTrustedCaller","type":"error"},{"inputs":[],"name":"MasterChef__TrusteeNotSet","type":"error"},{"inputs":[],"name":"MasterChef__ZeroAddress","type":"error"},{"inputs":[],"name":"Math__UnderOverflow","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"contract IMasterChefRewarder","name":"extraRewarder","type":"address"}],"name":"ExtraRewarderSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"}],"name":"FarmAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"metroPerSecond","type":"uint256"}],"name":"MetroPerSecondSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"mintMetro","type":"bool"}],"name":"MintMetroSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"int256","name":"deltaAmount","type":"int256"},{"indexed":false,"internalType":"uint256","name":"metroReward","type":"uint256"}],"name":"PositionModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trustee","type":"address"}],"name":"TrusteeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IVoter","name":"newVoter","type":"address"}],"name":"VoterSet","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"contract IMasterChefRewarder","name":"extraRewarder","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"depositOnBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"getDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getExtraRewarder","outputs":[{"internalType":"contract IMasterChefRewarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLBHooksManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getLastUpdateTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMetro","outputs":[{"internalType":"contract IMetro","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMetroPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getMetroPerSecondForPid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintMetroFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumberOfFarms","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256[]","name":"metroRewards","type":"uint256[]"},{"internalType":"contract IERC20[]","name":"extraTokens","type":"address[]"},{"internalType":"uint256[]","name":"extraRewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewarderFactory","outputs":[{"internalType":"contract IRewarderFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getTotalDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasuryShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVoter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"contract IVoter","name":"voter","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"contract IMasterChefRewarder","name":"extraRewarder","type":"address"}],"name":"setExtraRewarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"lumPerSecond","type":"uint96"}],"name":"setMetroPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"mintMetro","type":"bool"}],"name":"setMintMetro","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustee","type":"address"}],"name":"setTrustee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVoter","name":"voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"updateAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"updateOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
61010060405234801562000011575f80fd5b50604051620029fc380380620029fc833981016040819052620000349162000154565b6200003e6200008b565b670de0b6b3a7640000811115620000685760405163169cfea160e11b815260040160405180910390fd5b6001600160a01b0393841660805291831660a05290911660c05260e052620001ab565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000dc5760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146200013c5780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6001600160a01b03811681146200013c575f80fd5b5f805f806080858703121562000168575f80fd5b845162000175816200013f565b602086015190945062000188816200013f565b60408601519093506200019b816200013f565b6060959095015193969295505050565b60805160a05160c05160e0516127ec620002105f395f81816103ff0152611df301525f8181610435015261079301525f8181610398015261159301525f8181610304015281816118d701528181611bc701528181611c190152611ca201526127ec5ff3fe608060405234801561000f575f80fd5b506004361061024f575f3560e01c8063796441bb1161013d578063c7a61783116100b8578063e30c397811610088578063e665b4141161006e578063e665b4141461051e578063f0f4426014610531578063f2fde38b14610544575f80fd5b8063e30c397814610503578063e4b50cb81461050b575f80fd5b8063c7a61783146104c2578063d0d1ea70146104ca578063d23ab97a146104dd578063e2bbb158146104f0575f80fd5b80639f489e4e1161010d578063ac788bc1116100f3578063ac788bc11461047f578063b507a7001461049c578063c0c53b8b146104af575f80fd5b80639f489e4e14610459578063ac7475ed1461046c575f80fd5b8063796441bb146103fd57806379ba5097146104235780638da5cb5b1461042b5780639b4c8ea514610433575f80fd5b80634bc2a657116101cd5780635c4323ab1161019d57806363bee3691161018357806363bee369146103cf5780636ba4c138146103e2578063715018a6146103f5575f80fd5b80635c4323ab146103965780635ffb915f146103bc575f80fd5b80634bc2a6571461033b57806352c28fab1461034e5780635312ea8e14610361578063566aff6a14610374575f80fd5b80632b37f53c116102225780633b19e84a116102085780633b19e84a146102f15780633d42a0a714610302578063441a3e7014610328575f80fd5b80632b37f53c146102ba5780633404b811146102de575f80fd5b806304093c5b146102535780630b909d6914610268578063143073551461029457806321bd31de146102a7575b5f80fd5b610266610261366004612370565b610557565b005b600154600160a01b90046bffffffffffffffffffffffff165b6040519081526020015b60405180910390f35b6102816102a23660046123af565b610596565b6102666102b53660046123da565b610641565b5f546001600160a01b03165b6040516001600160a01b03909116815260200161028b565b6102666102ec366004612415565b610653565b6001546001600160a01b03166102c6565b7f00000000000000000000000000000000000000000000000000000000000000006102c6565b610266610336366004612430565b6106b3565b610266610349366004612450565b610712565b61026661035c36600461246b565b610788565b61026661036f3660046123af565b610911565b610387610382366004612497565b610ada565b60405161028b93929190612521565b7f00000000000000000000000000000000000000000000000000000000000000006102c6565b6102666103ca366004612592565b610d9a565b6102666103dd3660046125bd565b610e34565b6102666103f0366004612370565b610ee4565b610266610f23565b7f0000000000000000000000000000000000000000000000000000000000000000610281565b610266610f3c565b6102c6610f89565b7f00000000000000000000000000000000000000000000000000000000000000006102c6565b6102816104673660046123da565b610fbd565b61026661047a366004612450565b610ff1565b600354600160a01b900460ff16604051901515815260200161028b565b6102816104aa3660046123af565b611042565b6102666104bd3660046125f3565b61106f565b600254610281565b6102666104d8366004612450565b611190565b6102816104eb3660046123af565b6111e1565b6102666104fe366004612430565b61120a565b6102c6611237565b6102c66105193660046123af565b61125f565b6102c661052c3660046123af565b611295565b61026661053f366004612450565b6112cb565b610266610552366004612450565b6112dc565b6105928282808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525061136192505050565b5050565b5f61063b82600160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff165f8054906101000a90046001600160a01b03166001600160a01b03166306aba0e16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106369190612630565b611497565b92915050565b61064961152b565b610592828261155f565b61065b61152b565b60038054821515600160a01b0260ff60a01b199091161790556040517f8d0c12e457acc102367c41c574b896726159f39951f3a79ebfeb210973755de0906106a890831515815260200190565b60405180910390a150565b6106d182336106c18461179d565b6106ca9061265b565b60016117ca565b8015610592576105923382600285815481106106ef576106ef612675565b5f9182526020909120600560079092020101546001600160a01b03169190611a35565b61071a61152b565b6001600160a01b038116610741576040516398e7ce9b60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038316908117825560405190917f5bb4a0f5a67f7c49cfc7820adfab4690a3752cf969544ddd8445b970d3643e8991a250565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107c0576107c0611aa9565b600280546001810182555f91909152600781027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad3810180546001600160a01b0319166001600160a01b0386811691909117909155427f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad08301557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9091019083161561086f5761086f828461155f565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa1580156108b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d59190612630565b506040516001600160a01b0385169083907f9d7bf7d496ad44415bf088986e68bcfc590380ab2bf411124744b485329f2fc6905f90a350505050565b5f6002828154811061092557610925612675565b5f91825260208220600790910201915061093f8233611ac3565b90505f61094b8261179d565b6109549061265b565b90505f808080610965873387611ae2565b93509350935093505f61097c886002018a85611b0c565b90505f61098882611b86565b90505f61099c60028b013389898987611d14565b5f8c81526005602090815260408083203384529091529020549091506109c29082612689565b5f8c815260056020908152604080832033845290915281205590506109eb60028b018583611d94565b5060058a0154610a05906001600160a01b0316338b611a35565b60068a01546001600160a01b03168015610a905760068b0154604051636e36211360e11b8152336004820152602481018e9052604481018a905260648101899052608481018890526001600160a01b039091169063dc6c42269060a4015f604051808303815f87803b158015610a79575f80fd5b505af1158015610a8b573d5f803e3d5ffd5b505050505b604080518a81525f602082015233918e917f0e006e790dc8db480892a6d5c0bf539c411db278e5185b07d46bdcc110ba6af5910160405180910390a3505050505050505050505050565b606080808367ffffffffffffffff811115610af757610af761269c565b604051908082528060200260200182016040528015610b20578160200160208202803683370190505b5092508367ffffffffffffffff811115610b3c57610b3c61269c565b604051908082528060200260200182016040528015610b65578160200160208202803683370190505b5091508367ffffffffffffffff811115610b8157610b8161269c565b604051908082528060200260200182016040528015610baa578160200160208202803683370190505b5090505f5b84811015610d90575f868683818110610bca57610bca612675565b9050602002013590505f60028281548110610be757610be7612675565b5f91825260208220600790910201915060028201908290610c08828d611ac3565b90505f610c13835490565b90505f610c29610c24868985611b0c565b611de3565b91505060055f8881526020019081526020015f205f8f6001600160a01b03166001600160a01b031681526020019081526020015f2054610c788f8585858a611e3590949392919063ffffffff16565b610c829190612689565b8b8981518110610c9457610c94612675565b60209081029190910101525060068501546001600160a01b03168015610d785760405163c718325160e01b81526001600160a01b038f81166004830152602482018590526044820184905282169063c7183251906064016040805180830381865afa158015610d05573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d2991906126b0565b8b8a81518110610d3b57610d3b612675565b602002602001018b8b81518110610d5457610d54612675565b6020026020010182815250826001600160a01b03166001600160a01b031681525050505b5050505050505080610d89906126dc565b9050610baf565b5093509350939050565b610da261152b565b678ac7230489e80000816bffffffffffffffffffffffff161115610dd957604051635aef384360e11b815260040160405180910390fd5b600180546001600160a01b0316600160a01b6bffffffffffffffffffffffff8416908102919091179091556040519081527ff174eb93c65a88199f7e24a73be8f5b23f34aa8dd31576f583869e4b325ef2e5906020016106a8565b6003546001600160a01b0316610e5d57604051632b95b73560e21b815260040160405180910390fd5b6003546001600160a01b03163314610e885760405163b185012560e01b815260040160405180910390fd5b610e9c8382610e968561179d565b5f6117ca565b8115610edf57610edf33308460028781548110610ebb57610ebb612675565b5f9182526020909120600560079092020101546001600160a01b0316929190611e98565b505050565b5f5b81811015610edf57610f13838383818110610f0357610f03612675565b90506020020135335f60016117ca565b610f1c816126dc565b9050610ee6565b60405163a3dd49c760e01b815260040160405180910390fd5b3380610f46611237565b6001600160a01b031614610f7d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610f8681611ed7565b50565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b5f610fea8260028581548110610fd557610fd5612675565b5f918252602090912060079091020190611ac3565b9392505050565b610ff961152b565b600480546001600160a01b0319166001600160a01b0383169081179091556040517fb3b3f5f64ab192e4b5fefde1f51ce9733bbdcf831951543b325aebd49cc27ec4905f90a250565b5f6002828154811061105657611056612675565b905f5260205f2090600702016002015f01549050919050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546004919068010000000000000000900460ff16806110be5750805467ffffffffffffffff808416911610155b156110dc5760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff8316176801000000000000000017815561110c85611f0f565b61111584611f20565b5f80546001600160a01b0319166001600160a01b0385161790556003805460ff60a01b19169055805468ff00000000000000001916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b61119861152b565b600380546001600160a01b0319166001600160a01b0383169081179091556040517fc93afddbe60c8bb62dd8f92851afc10e08cef038fc5c261dda1d8ae8b890e0c4905f90a250565b5f61063b600283815481106111f8576111f8612675565b905f5260205f2090600702015f015490565b6112188233610e968461179d565b80156105925761059233308360028681548110610ebb57610ebb612675565b5f807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610fad565b5f6002828154811061127357611273612675565b5f9182526020909120600560079092020101546001600160a01b031692915050565b5f600282815481106112a9576112a9612675565b5f9182526020909120600660079092020101546001600160a01b031692915050565b6112d361152b565b610f8681611f20565b6112e461152b565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b0383169081178255611328610f89565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b80515f8054604080516306aba0e160e01b815290516001600160a01b03909216916306aba0e1916004808201926020929091908290030181865afa1580156113ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113cf9190612630565b600154909150600160a01b90046bffffffffffffffffffffffff165f5b83811015611490575f85828151811061140757611407612675565b602002602001015190505f6002828154811061142557611425612675565b5f9182526020822060079091020191506002820190611442835490565b90505f611450838884611f90565b90505f61145e86838b611497565b90505f61146a82611b86565b9050611477858583611d94565b505050505050505080611489906126dc565b90506113ec565b5050505050565b5f8115611521575f5460405163d851fdfd60e01b81526004810186905283916001600160a01b03169063d851fdfd90602401602060405180830381865afa1580156114e4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115089190612630565b61151290856126f4565b61151c919061270b565b611523565b5f5b949350505050565b33611534610f89565b6001600160a01b03161461155d5760405163118cdaa760e01b8152336004820152602401610f74565b565b6001600160a01b0381161580159061161057506001604051634f4ee65b60e11b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690639e9dccb690602401602060405180830381865afa1580156115d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115fc919061273e565b600281111561160d5761160d61272a565b14155b1561162e576040516376644cf960e11b815260040160405180910390fd5b5f6002838154811061164257611642612675565b5f9182526020909120600660079092020101546001600160a01b0316905080156116bc5760405163f1e023fd60e01b8152600481018490526001600160a01b0382169063f1e023fd906024015f604051808303815f87803b1580156116a5575f80fd5b505af11580156116b7573d5f803e3d5ffd5b505050505b6001600160a01b038216156117215760405163b1a867d560e01b8152600481018490526001600160a01b0383169063b1a867d5906024015f604051808303815f87803b15801561170a575f80fd5b505af115801561171c573d5f803e3d5ffd5b505050505b816002848154811061173557611735612675565b5f9182526020918290206007919091020160060180546001600160a01b0319166001600160a01b03938416179055604051918416825284917fa0671cc6d1b10c28ed0b4e4a9eaa3a903f4fa57c3a02426bbcc453004fed8745910160405180910390a2505050565b5f6001600160ff1b038211156117c6576040516308a942bb60e11b815260040160405180910390fd5b5090565b5f600285815481106117de576117de612675565b5f9182526020822060066007909202019081015490925060028301916001600160a01b03909116908080611813868a8a611ae2565b509250925092505f611826868c84611b0c565b90505f61183282611b86565b90505f611843888d88888887611d14565b905089156119035760055f8e81526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f2054816118899190612689565b90505f60055f8f81526020019081526020015f205f8e6001600160a01b03166001600160a01b031681526020019081526020015f20819055505f8111156118fe576118fe6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168d83611a35565b61194a565b8060055f8f81526020019081526020015f205f8e6001600160a01b03166001600160a01b031681526020019081526020015f205f8282546119449190612689565b90915550505b6001600160a01b038716156119e05760405163870b50fd60e01b81526001600160a01b038d81166004830152602482018f905260448201889052606482018790526084820186905288169063870b50fd9060a4016020604051808303815f875af11580156119ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119de9190612630565b505b604080518c8152602081018390526001600160a01b038e16918f917f0e006e790dc8db480892a6d5c0bf539c411db278e5185b07d46bdcc110ba6af5910160405180910390a350505050505050505050505050565b6040516001600160a01b03838116602483015260448201839052610edf91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f9d565b6004546001600160a01b0316331461155d5761155d61152b565b6001600160a01b0381165f908152600183016020526040812054610fea565b5f808080611afa876001600160a01b03881687611ffe565b93509350935093505b93509350935093565b6001545f90611523908490611b38908790600160a01b90046bffffffffffffffffffffffff1686611f90565b5f8054906101000a90046001600160a01b03166001600160a01b03166306aba0e16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d5f803e3d5ffd5b5f815f03611b9557505f919050565b5f80611ba084611de3565b6003549193509150600160a01b900460ff16611bf057600154610fea906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911684611a35565b6001546040516340c10f1960e01b81526001600160a01b039182166004820152602481018490527f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f19906044016020604051808303815f875af1158015611c61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c859190612630565b506040516340c10f1960e01b8152306004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906340c10f19906044016020604051808303815f875af1158015611cf0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115239190612630565b5f80611d21888585611d94565b90508515611d5c576001600160a01b0387165f908152600289016020526040902054611d4d828861205b565b611d57919061275c565b611d5e565b5f5b9150611d6a818661205b565b6001600160a01b039097165f90815260029098016020525060409096209490945550929392505050565b5f80611da08484612071565b8554909150421115611db0574285555b8015611dd45780856001015f828254611dc99190612689565b925050819055611dda565b84600101545b95945050505050565b5f80670de0b6b3a7640000611e187f0000000000000000000000000000000000000000000000000000000000000000856126f4565b611e22919061270b565b9150611e2e828461275c565b9050915091565b5f80611e418484612071565b8760010154611e509190612689565b90508415611e8b576001600160a01b0386165f908152600288016020526040902054611e7c828761205b565b611e86919061275c565b611e8d565b5f5b979650505050505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611ed19186918216906323b872dd90608401611a62565b50505050565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561059282612093565b611f17612103565b610f8681612151565b6001600160a01b038116611f47576040516398e7ce9b60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f905f90a250565b5f61152384844285612182565b5f611fb16001600160a01b038416836121c7565b905080515f14158015611fd5575080806020019051810190611fd3919061276f565b155b15610edf57604051635274afe760e01b81526001600160a01b0384166004820152602401610f74565b5f828152600184016020526040812054845490919081848103612025575082915080611b03565b61202f84866121d4565b925061203b82866121d4565b5f8781526001890160205260409020849055808855905093509350935093565b5f604061206884846126f4565b901c9392505050565b5f821561208b5761208683604084901b61270b565b610fea565b505f92915050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661155d57604051631afcd79f60e31b815260040160405180910390fd5b612159612103565b6001600160a01b038116610f7d57604051631e4fbdf760e01b81525f6004820152602401610f74565b5f815f0361219157505f611523565b84545f4285106121a157426121a3565b845b90508181116121b2575f611e8d565b856121bd838361275c565b611e8d91906126f4565b6060610fea83835f61220f565b8181016001600160ff1b0380841190821117155f819003612208576040516308a942bb60e11b815260040160405180910390fd5b5092915050565b6060814710156122345760405163cd78605960e01b8152306004820152602401610f74565b5f80856001600160a01b0316848660405161224f919061278a565b5f6040518083038185875af1925050503d805f8114612289576040519150601f19603f3d011682016040523d82523d5f602084013e61228e565b606091505b509150915061229e8683836122a8565b9695505050505050565b6060826122b857612086826122ff565b81511580156122cf57506001600160a01b0384163b155b156122f857604051639996b31560e01b81526001600160a01b0385166004820152602401610f74565b5080610fea565b80511561230f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8083601f840112612338575f80fd5b50813567ffffffffffffffff81111561234f575f80fd5b6020830191508360208260051b8501011115612369575f80fd5b9250929050565b5f8060208385031215612381575f80fd5b823567ffffffffffffffff811115612397575f80fd5b6123a385828601612328565b90969095509350505050565b5f602082840312156123bf575f80fd5b5035919050565b6001600160a01b0381168114610f86575f80fd5b5f80604083850312156123eb575f80fd5b8235915060208301356123fd816123c6565b809150509250929050565b8015158114610f86575f80fd5b5f60208284031215612425575f80fd5b8135610fea81612408565b5f8060408385031215612441575f80fd5b50508035926020909101359150565b5f60208284031215612460575f80fd5b8135610fea816123c6565b5f806040838503121561247c575f80fd5b8235612487816123c6565b915060208301356123fd816123c6565b5f805f604084860312156124a9575f80fd5b83356124b4816123c6565b9250602084013567ffffffffffffffff8111156124cf575f80fd5b6124db86828701612328565b9497909650939450505050565b5f8151808452602080850194508084015f5b83811015612516578151875295820195908201906001016124fa565b509495945050505050565b606081525f61253360608301866124e8565b8281036020848101919091528551808352868201928201905f5b818110156125725784516001600160a01b03168352938301939183019160010161254d565b5050848103604086015261258681876124e8565b98975050505050505050565b5f602082840312156125a2575f80fd5b81356bffffffffffffffffffffffff81168114610fea575f80fd5b5f805f606084860312156125cf575f80fd5b833592506020840135915060408401356125e8816123c6565b809150509250925092565b5f805f60608486031215612605575f80fd5b8335612610816123c6565b92506020840135612620816123c6565b915060408401356125e8816123c6565b5f60208284031215612640575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f600160ff1b820161266f5761266f612647565b505f0390565b634e487b7160e01b5f52603260045260245ffd5b8082018082111561063b5761063b612647565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156126c1575f80fd5b82516126cc816123c6565b6020939093015192949293505050565b5f600182016126ed576126ed612647565b5060010190565b808202811582820484141761063b5761063b612647565b5f8261272557634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52602160045260245ffd5b5f6020828403121561274e575f80fd5b815160038110610fea575f80fd5b8181038181111561063b5761063b612647565b5f6020828403121561277f575f80fd5b8151610fea81612408565b5f82515f5b818110156127a9576020818601810151858301520161278f565b505f92019182525091905056fea264697066735822122034b6f63f16aba0cc5b44233afa1c7331e0bd305f912db1deb76232486039ef7d64736f6c6343000814003300000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f7321000000000000000000000000d9db92613867fe0d290ce64fe737e2f8b80cadc3000000000000000000000000f6f7ae5d4804b9dbbee41168e26b8d636b8d535a0000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061024f575f3560e01c8063796441bb1161013d578063c7a61783116100b8578063e30c397811610088578063e665b4141161006e578063e665b4141461051e578063f0f4426014610531578063f2fde38b14610544575f80fd5b8063e30c397814610503578063e4b50cb81461050b575f80fd5b8063c7a61783146104c2578063d0d1ea70146104ca578063d23ab97a146104dd578063e2bbb158146104f0575f80fd5b80639f489e4e1161010d578063ac788bc1116100f3578063ac788bc11461047f578063b507a7001461049c578063c0c53b8b146104af575f80fd5b80639f489e4e14610459578063ac7475ed1461046c575f80fd5b8063796441bb146103fd57806379ba5097146104235780638da5cb5b1461042b5780639b4c8ea514610433575f80fd5b80634bc2a657116101cd5780635c4323ab1161019d57806363bee3691161018357806363bee369146103cf5780636ba4c138146103e2578063715018a6146103f5575f80fd5b80635c4323ab146103965780635ffb915f146103bc575f80fd5b80634bc2a6571461033b57806352c28fab1461034e5780635312ea8e14610361578063566aff6a14610374575f80fd5b80632b37f53c116102225780633b19e84a116102085780633b19e84a146102f15780633d42a0a714610302578063441a3e7014610328575f80fd5b80632b37f53c146102ba5780633404b811146102de575f80fd5b806304093c5b146102535780630b909d6914610268578063143073551461029457806321bd31de146102a7575b5f80fd5b610266610261366004612370565b610557565b005b600154600160a01b90046bffffffffffffffffffffffff165b6040519081526020015b60405180910390f35b6102816102a23660046123af565b610596565b6102666102b53660046123da565b610641565b5f546001600160a01b03165b6040516001600160a01b03909116815260200161028b565b6102666102ec366004612415565b610653565b6001546001600160a01b03166102c6565b7f00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f73216102c6565b610266610336366004612430565b6106b3565b610266610349366004612450565b610712565b61026661035c36600461246b565b610788565b61026661036f3660046123af565b610911565b610387610382366004612497565b610ada565b60405161028b93929190612521565b7f000000000000000000000000d9db92613867fe0d290ce64fe737e2f8b80cadc36102c6565b6102666103ca366004612592565b610d9a565b6102666103dd3660046125bd565b610e34565b6102666103f0366004612370565b610ee4565b610266610f23565b7f0000000000000000000000000000000000000000000000000000000000000000610281565b610266610f3c565b6102c6610f89565b7f000000000000000000000000f6f7ae5d4804b9dbbee41168e26b8d636b8d535a6102c6565b6102816104673660046123da565b610fbd565b61026661047a366004612450565b610ff1565b600354600160a01b900460ff16604051901515815260200161028b565b6102816104aa3660046123af565b611042565b6102666104bd3660046125f3565b61106f565b600254610281565b6102666104d8366004612450565b611190565b6102816104eb3660046123af565b6111e1565b6102666104fe366004612430565b61120a565b6102c6611237565b6102c66105193660046123af565b61125f565b6102c661052c3660046123af565b611295565b61026661053f366004612450565b6112cb565b610266610552366004612450565b6112dc565b6105928282808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525061136192505050565b5050565b5f61063b82600160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff165f8054906101000a90046001600160a01b03166001600160a01b03166306aba0e16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106369190612630565b611497565b92915050565b61064961152b565b610592828261155f565b61065b61152b565b60038054821515600160a01b0260ff60a01b199091161790556040517f8d0c12e457acc102367c41c574b896726159f39951f3a79ebfeb210973755de0906106a890831515815260200190565b60405180910390a150565b6106d182336106c18461179d565b6106ca9061265b565b60016117ca565b8015610592576105923382600285815481106106ef576106ef612675565b5f9182526020909120600560079092020101546001600160a01b03169190611a35565b61071a61152b565b6001600160a01b038116610741576040516398e7ce9b60e01b815260040160405180910390fd5b5f80546001600160a01b0319166001600160a01b038316908117825560405190917f5bb4a0f5a67f7c49cfc7820adfab4690a3752cf969544ddd8445b970d3643e8991a250565b336001600160a01b037f000000000000000000000000f6f7ae5d4804b9dbbee41168e26b8d636b8d535a16146107c0576107c0611aa9565b600280546001810182555f91909152600781027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad3810180546001600160a01b0319166001600160a01b0386811691909117909155427f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad08301557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9091019083161561086f5761086f828461155f565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa1580156108b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d59190612630565b506040516001600160a01b0385169083907f9d7bf7d496ad44415bf088986e68bcfc590380ab2bf411124744b485329f2fc6905f90a350505050565b5f6002828154811061092557610925612675565b5f91825260208220600790910201915061093f8233611ac3565b90505f61094b8261179d565b6109549061265b565b90505f808080610965873387611ae2565b93509350935093505f61097c886002018a85611b0c565b90505f61098882611b86565b90505f61099c60028b013389898987611d14565b5f8c81526005602090815260408083203384529091529020549091506109c29082612689565b5f8c815260056020908152604080832033845290915281205590506109eb60028b018583611d94565b5060058a0154610a05906001600160a01b0316338b611a35565b60068a01546001600160a01b03168015610a905760068b0154604051636e36211360e11b8152336004820152602481018e9052604481018a905260648101899052608481018890526001600160a01b039091169063dc6c42269060a4015f604051808303815f87803b158015610a79575f80fd5b505af1158015610a8b573d5f803e3d5ffd5b505050505b604080518a81525f602082015233918e917f0e006e790dc8db480892a6d5c0bf539c411db278e5185b07d46bdcc110ba6af5910160405180910390a3505050505050505050505050565b606080808367ffffffffffffffff811115610af757610af761269c565b604051908082528060200260200182016040528015610b20578160200160208202803683370190505b5092508367ffffffffffffffff811115610b3c57610b3c61269c565b604051908082528060200260200182016040528015610b65578160200160208202803683370190505b5091508367ffffffffffffffff811115610b8157610b8161269c565b604051908082528060200260200182016040528015610baa578160200160208202803683370190505b5090505f5b84811015610d90575f868683818110610bca57610bca612675565b9050602002013590505f60028281548110610be757610be7612675565b5f91825260208220600790910201915060028201908290610c08828d611ac3565b90505f610c13835490565b90505f610c29610c24868985611b0c565b611de3565b91505060055f8881526020019081526020015f205f8f6001600160a01b03166001600160a01b031681526020019081526020015f2054610c788f8585858a611e3590949392919063ffffffff16565b610c829190612689565b8b8981518110610c9457610c94612675565b60209081029190910101525060068501546001600160a01b03168015610d785760405163c718325160e01b81526001600160a01b038f81166004830152602482018590526044820184905282169063c7183251906064016040805180830381865afa158015610d05573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d2991906126b0565b8b8a81518110610d3b57610d3b612675565b602002602001018b8b81518110610d5457610d54612675565b6020026020010182815250826001600160a01b03166001600160a01b031681525050505b5050505050505080610d89906126dc565b9050610baf565b5093509350939050565b610da261152b565b678ac7230489e80000816bffffffffffffffffffffffff161115610dd957604051635aef384360e11b815260040160405180910390fd5b600180546001600160a01b0316600160a01b6bffffffffffffffffffffffff8416908102919091179091556040519081527ff174eb93c65a88199f7e24a73be8f5b23f34aa8dd31576f583869e4b325ef2e5906020016106a8565b6003546001600160a01b0316610e5d57604051632b95b73560e21b815260040160405180910390fd5b6003546001600160a01b03163314610e885760405163b185012560e01b815260040160405180910390fd5b610e9c8382610e968561179d565b5f6117ca565b8115610edf57610edf33308460028781548110610ebb57610ebb612675565b5f9182526020909120600560079092020101546001600160a01b0316929190611e98565b505050565b5f5b81811015610edf57610f13838383818110610f0357610f03612675565b90506020020135335f60016117ca565b610f1c816126dc565b9050610ee6565b60405163a3dd49c760e01b815260040160405180910390fd5b3380610f46611237565b6001600160a01b031614610f7d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610f8681611ed7565b50565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b5f610fea8260028581548110610fd557610fd5612675565b5f918252602090912060079091020190611ac3565b9392505050565b610ff961152b565b600480546001600160a01b0319166001600160a01b0383169081179091556040517fb3b3f5f64ab192e4b5fefde1f51ce9733bbdcf831951543b325aebd49cc27ec4905f90a250565b5f6002828154811061105657611056612675565b905f5260205f2090600702016002015f01549050919050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546004919068010000000000000000900460ff16806110be5750805467ffffffffffffffff808416911610155b156110dc5760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff191667ffffffffffffffff8316176801000000000000000017815561110c85611f0f565b61111584611f20565b5f80546001600160a01b0319166001600160a01b0385161790556003805460ff60a01b19169055805468ff00000000000000001916815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b61119861152b565b600380546001600160a01b0319166001600160a01b0383169081179091556040517fc93afddbe60c8bb62dd8f92851afc10e08cef038fc5c261dda1d8ae8b890e0c4905f90a250565b5f61063b600283815481106111f8576111f8612675565b905f5260205f2090600702015f015490565b6112188233610e968461179d565b80156105925761059233308360028681548110610ebb57610ebb612675565b5f807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00610fad565b5f6002828154811061127357611273612675565b5f9182526020909120600560079092020101546001600160a01b031692915050565b5f600282815481106112a9576112a9612675565b5f9182526020909120600660079092020101546001600160a01b031692915050565b6112d361152b565b610f8681611f20565b6112e461152b565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b0383169081178255611328610f89565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b80515f8054604080516306aba0e160e01b815290516001600160a01b03909216916306aba0e1916004808201926020929091908290030181865afa1580156113ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113cf9190612630565b600154909150600160a01b90046bffffffffffffffffffffffff165f5b83811015611490575f85828151811061140757611407612675565b602002602001015190505f6002828154811061142557611425612675565b5f9182526020822060079091020191506002820190611442835490565b90505f611450838884611f90565b90505f61145e86838b611497565b90505f61146a82611b86565b9050611477858583611d94565b505050505050505080611489906126dc565b90506113ec565b5050505050565b5f8115611521575f5460405163d851fdfd60e01b81526004810186905283916001600160a01b03169063d851fdfd90602401602060405180830381865afa1580156114e4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115089190612630565b61151290856126f4565b61151c919061270b565b611523565b5f5b949350505050565b33611534610f89565b6001600160a01b03161461155d5760405163118cdaa760e01b8152336004820152602401610f74565b565b6001600160a01b0381161580159061161057506001604051634f4ee65b60e11b81526001600160a01b0383811660048301527f000000000000000000000000d9db92613867fe0d290ce64fe737e2f8b80cadc31690639e9dccb690602401602060405180830381865afa1580156115d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115fc919061273e565b600281111561160d5761160d61272a565b14155b1561162e576040516376644cf960e11b815260040160405180910390fd5b5f6002838154811061164257611642612675565b5f9182526020909120600660079092020101546001600160a01b0316905080156116bc5760405163f1e023fd60e01b8152600481018490526001600160a01b0382169063f1e023fd906024015f604051808303815f87803b1580156116a5575f80fd5b505af11580156116b7573d5f803e3d5ffd5b505050505b6001600160a01b038216156117215760405163b1a867d560e01b8152600481018490526001600160a01b0383169063b1a867d5906024015f604051808303815f87803b15801561170a575f80fd5b505af115801561171c573d5f803e3d5ffd5b505050505b816002848154811061173557611735612675565b5f9182526020918290206007919091020160060180546001600160a01b0319166001600160a01b03938416179055604051918416825284917fa0671cc6d1b10c28ed0b4e4a9eaa3a903f4fa57c3a02426bbcc453004fed8745910160405180910390a2505050565b5f6001600160ff1b038211156117c6576040516308a942bb60e11b815260040160405180910390fd5b5090565b5f600285815481106117de576117de612675565b5f9182526020822060066007909202019081015490925060028301916001600160a01b03909116908080611813868a8a611ae2565b509250925092505f611826868c84611b0c565b90505f61183282611b86565b90505f611843888d88888887611d14565b905089156119035760055f8e81526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f2054816118899190612689565b90505f60055f8f81526020019081526020015f205f8e6001600160a01b03166001600160a01b031681526020019081526020015f20819055505f8111156118fe576118fe6001600160a01b037f00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f7321168d83611a35565b61194a565b8060055f8f81526020019081526020015f205f8e6001600160a01b03166001600160a01b031681526020019081526020015f205f8282546119449190612689565b90915550505b6001600160a01b038716156119e05760405163870b50fd60e01b81526001600160a01b038d81166004830152602482018f905260448201889052606482018790526084820186905288169063870b50fd9060a4016020604051808303815f875af11580156119ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119de9190612630565b505b604080518c8152602081018390526001600160a01b038e16918f917f0e006e790dc8db480892a6d5c0bf539c411db278e5185b07d46bdcc110ba6af5910160405180910390a350505050505050505050505050565b6040516001600160a01b03838116602483015260448201839052610edf91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611f9d565b6004546001600160a01b0316331461155d5761155d61152b565b6001600160a01b0381165f908152600183016020526040812054610fea565b5f808080611afa876001600160a01b03881687611ffe565b93509350935093505b93509350935093565b6001545f90611523908490611b38908790600160a01b90046bffffffffffffffffffffffff1686611f90565b5f8054906101000a90046001600160a01b03166001600160a01b03166306aba0e16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610612573d5f803e3d5ffd5b5f815f03611b9557505f919050565b5f80611ba084611de3565b6003549193509150600160a01b900460ff16611bf057600154610fea906001600160a01b037f00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f73218116911684611a35565b6001546040516340c10f1960e01b81526001600160a01b039182166004820152602481018490527f00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f7321909116906340c10f19906044016020604051808303815f875af1158015611c61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c859190612630565b506040516340c10f1960e01b8152306004820152602481018290527f00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f73216001600160a01b0316906340c10f19906044016020604051808303815f875af1158015611cf0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115239190612630565b5f80611d21888585611d94565b90508515611d5c576001600160a01b0387165f908152600289016020526040902054611d4d828861205b565b611d57919061275c565b611d5e565b5f5b9150611d6a818661205b565b6001600160a01b039097165f90815260029098016020525060409096209490945550929392505050565b5f80611da08484612071565b8554909150421115611db0574285555b8015611dd45780856001015f828254611dc99190612689565b925050819055611dda565b84600101545b95945050505050565b5f80670de0b6b3a7640000611e187f0000000000000000000000000000000000000000000000000000000000000000856126f4565b611e22919061270b565b9150611e2e828461275c565b9050915091565b5f80611e418484612071565b8760010154611e509190612689565b90508415611e8b576001600160a01b0386165f908152600288016020526040902054611e7c828761205b565b611e86919061275c565b611e8d565b5f5b979650505050505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611ed19186918216906323b872dd90608401611a62565b50505050565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561059282612093565b611f17612103565b610f8681612151565b6001600160a01b038116611f47576040516398e7ce9b60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f905f90a250565b5f61152384844285612182565b5f611fb16001600160a01b038416836121c7565b905080515f14158015611fd5575080806020019051810190611fd3919061276f565b155b15610edf57604051635274afe760e01b81526001600160a01b0384166004820152602401610f74565b5f828152600184016020526040812054845490919081848103612025575082915080611b03565b61202f84866121d4565b925061203b82866121d4565b5f8781526001890160205260409020849055808855905093509350935093565b5f604061206884846126f4565b901c9392505050565b5f821561208b5761208683604084901b61270b565b610fea565b505f92915050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661155d57604051631afcd79f60e31b815260040160405180910390fd5b612159612103565b6001600160a01b038116610f7d57604051631e4fbdf760e01b81525f6004820152602401610f74565b5f815f0361219157505f611523565b84545f4285106121a157426121a3565b845b90508181116121b2575f611e8d565b856121bd838361275c565b611e8d91906126f4565b6060610fea83835f61220f565b8181016001600160ff1b0380841190821117155f819003612208576040516308a942bb60e11b815260040160405180910390fd5b5092915050565b6060814710156122345760405163cd78605960e01b8152306004820152602401610f74565b5f80856001600160a01b0316848660405161224f919061278a565b5f6040518083038185875af1925050503d805f8114612289576040519150601f19603f3d011682016040523d82523d5f602084013e61228e565b606091505b509150915061229e8683836122a8565b9695505050505050565b6060826122b857612086826122ff565b81511580156122cf57506001600160a01b0384163b155b156122f857604051639996b31560e01b81526001600160a01b0385166004820152602401610f74565b5080610fea565b80511561230f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f8083601f840112612338575f80fd5b50813567ffffffffffffffff81111561234f575f80fd5b6020830191508360208260051b8501011115612369575f80fd5b9250929050565b5f8060208385031215612381575f80fd5b823567ffffffffffffffff811115612397575f80fd5b6123a385828601612328565b90969095509350505050565b5f602082840312156123bf575f80fd5b5035919050565b6001600160a01b0381168114610f86575f80fd5b5f80604083850312156123eb575f80fd5b8235915060208301356123fd816123c6565b809150509250929050565b8015158114610f86575f80fd5b5f60208284031215612425575f80fd5b8135610fea81612408565b5f8060408385031215612441575f80fd5b50508035926020909101359150565b5f60208284031215612460575f80fd5b8135610fea816123c6565b5f806040838503121561247c575f80fd5b8235612487816123c6565b915060208301356123fd816123c6565b5f805f604084860312156124a9575f80fd5b83356124b4816123c6565b9250602084013567ffffffffffffffff8111156124cf575f80fd5b6124db86828701612328565b9497909650939450505050565b5f8151808452602080850194508084015f5b83811015612516578151875295820195908201906001016124fa565b509495945050505050565b606081525f61253360608301866124e8565b8281036020848101919091528551808352868201928201905f5b818110156125725784516001600160a01b03168352938301939183019160010161254d565b5050848103604086015261258681876124e8565b98975050505050505050565b5f602082840312156125a2575f80fd5b81356bffffffffffffffffffffffff81168114610fea575f80fd5b5f805f606084860312156125cf575f80fd5b833592506020840135915060408401356125e8816123c6565b809150509250925092565b5f805f60608486031215612605575f80fd5b8335612610816123c6565b92506020840135612620816123c6565b915060408401356125e8816123c6565b5f60208284031215612640575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b5f600160ff1b820161266f5761266f612647565b505f0390565b634e487b7160e01b5f52603260045260245ffd5b8082018082111561063b5761063b612647565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156126c1575f80fd5b82516126cc816123c6565b6020939093015192949293505050565b5f600182016126ed576126ed612647565b5060010190565b808202811582820484141761063b5761063b612647565b5f8261272557634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52602160045260245ffd5b5f6020828403121561274e575f80fd5b815160038110610fea575f80fd5b8181038181111561063b5761063b612647565b5f6020828403121561277f575f80fd5b8151610fea81612408565b5f82515f5b818110156127a9576020818601810151858301520161278f565b505f92019182525091905056fea264697066735822122034b6f63f16aba0cc5b44233afa1c7331e0bd305f912db1deb76232486039ef7d64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f7321000000000000000000000000d9db92613867fe0d290ce64fe737e2f8b80cadc3000000000000000000000000f6f7ae5d4804b9dbbee41168e26b8d636b8d535a0000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : metro (address): 0x71E99522EaD5E21CF57F1f542Dc4ad2E841F7321
Arg [1] : rewarderFactory (address): 0xd9db92613867FE0d290CE64Fe737E2F8B80CADc3
Arg [2] : lbHooksManager (address): 0xF6f7Ae5d4804B9DbbeE41168E26B8d636B8D535a
Arg [3] : treasuryShare (uint256): 0
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000071e99522ead5e21cf57f1f542dc4ad2e841f7321
Arg [1] : 000000000000000000000000d9db92613867fe0d290ce64fe737e2f8b80cadc3
Arg [2] : 000000000000000000000000f6f7ae5d4804b9dbbee41168e26b8d636b8d535a
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.