Verified
Ethereum
Verified, Router
Solidity
Verified
Ethereum

Contract Information

The following smart contract is called Booster and it is used to manage multiple liquidity pools. It allows users to deposit and withdraw funds from the pools, and also provides incentives for locking funds. The contract also has a shutdown function and allows for the setting of fees and treasury addresses.
More Info

Booster Source Code

// SPDX-License-Identifier: MIT // File: contracts\Interfaces.sol pragma solidity 0.6.12; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUtil { /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } contract ReentrancyGuard { uint256 private _guardCounter; constructor () internal { _guardCounter = 1; } modifier nonReentrant() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); } } interface ICurveGauge { function deposit(uint256) external; function balanceOf(address) external view returns (uint256); function withdraw(uint256) external; function claim_rewards() external; function reward_tokens(uint256) external view returns(address);//v2 function rewarded_token() external view returns(address);//v1 } interface ICurveVoteEscrow { function create_lock(uint256, uint256) external; function increase_amount(uint256) external; function increase_unlock_time(uint256) external; function withdraw() external; function smart_wallet_checker() external view returns (address); } interface IWalletChecker { function check(address) external view returns (bool); } interface IVoting{ function vote(uint256, bool, bool) external; //voteId, support, executeIfDecided function getVote(uint256) external view returns(bool,bool,uint64,uint64,uint64,uint64,uint256,uint256,uint256,bytes memory); function vote_for_gauge_weights(address,uint256) external; } interface IMinter{ function mint(address) external; } interface IRegistry{ function get_registry() external view returns(address); function get_address(uint256 _id) external view returns(address); function gauge_controller() external view returns(address); function get_lp_token(address) external view returns(address); function get_gauges(address) external view returns(address[10] memory,uint128[10] memory); } interface IStaker{ function deposit(address, address) external; function withdraw(address) external; function withdraw(address, address, uint256) external; function withdrawAll(address, address) external; function createLock(uint256, uint256) external; function increaseAmount(uint256) external; function increaseTime(uint256) external; function release() external; function claimCrv(address) external returns (uint256); function claimRewards(address) external; function claimFees(address,address) external; function setStashAccess(address, bool) external; function vote(uint256,address,bool) external; function voteGaugeWeight(address,uint256) external; function balanceOfPool(address) external view returns (uint256); function operator() external view returns (address); function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory); } interface IRewards{ function stake(address, uint256) external; function stakeFor(address, uint256) external; function withdraw(address, uint256) external; function exit(address) external; function getReward(address) external; function queueNewRewards(uint256) external; function notifyRewardAmount(uint256) external; function addExtraReward(address) external; function stakingToken() external returns (address); } interface IStash{ function stashRewards() external returns (bool); function processStash() external returns (bool); function claimRewards() external returns (bool); } interface IFeeDistro{ function claim() external; function token() external view returns(address); } interface ITokenMinter{ function mint(address,uint256) external; function burn(address,uint256) external; } interface IDeposit{ function isShutdown() external view returns(bool); function balanceOf(address _account) external view returns(uint256); function totalSupply() external view returns(uint256); function poolInfo(uint256) external view returns(address,address,address,address,address, bool); function rewardClaimed(uint256,address,uint256) external; function withdrawTo(uint256,uint256,address) external; function claimRewards(uint256,address) external returns(bool); function rewardArbitrator() external returns(address); } interface ICrvDeposit{ function deposit(uint256, bool) external; function lockIncentive() external view returns(uint256); } interface IRewardFactory{ function setAccess(address,bool) external; function CreateCrvRewards(uint256,address) external returns(address); function CreateTokenRewards(address,address,address) external returns(address); function activeRewardCount(address) external view returns(uint256); function addActiveReward(address,uint256) external returns(bool); function removeActiveReward(address,uint256) external returns(bool); } interface IStashFactory{ function CreateStash(uint256,address,address,uint256) external returns(address); } interface ITokenFactory{ function CreateDepositToken(address) external returns(address); } interface IPools{ function addPool(address _lptoken, address _gauge, uint256 _stashVersion) external returns(bool); function shutdownPool(uint256 _pid) external returns(bool); function poolInfo(uint256) external view returns(address,address,address,address,address,bool); function poolLength() external view returns (uint256); function gaugeMap(address) external view returns(bool); function setPoolManager(address _poolM) external; } interface IVestedEscrow{ function fund(address[] calldata _recipient, uint256[] calldata _amount) external returns(bool); } // File: @openzeppelin\contracts\math\SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File: @openzeppelin\contracts\token\ERC20\IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @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); } // File: @openzeppelin\contracts\utils\Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @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, it is bubbled up by this * function (like regular Solidity function calls). * * 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. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @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`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @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 SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @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, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts\Booster.sol pragma solidity 0.6.12; contract Booster{ using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant registry = address(0x0000000022D53366457F9d5E68Ec105046FC4383); uint256 public constant distributionAddressId = 4; address public constant voteOwnership = address(0xE478de485ad2fe566d49342Cbd03E49ed7DB3356); address public constant voteParameter = address(0xBCfF8B0b9419b9A88c44546519b1e909cF330399); uint256 public lockIncentive = 1000; //incentive to crv stakers uint256 public stakerIncentive = 450; //incentive to native token stakers uint256 public earmarkIncentive = 50; //incentive to users who spend gas to make calls uint256 public platformFee = 0; //possible fee to build treasury uint256 public constant MaxFees = 2000; uint256 public constant FEE_DENOMINATOR = 10000; address public owner; address public feeManager; address public poolManager; address public immutable staker; address public immutable minter; address public rewardFactory; address public stashFactory; address public tokenFactory; address public rewardArbitrator; address public voteDelegate; address public treasury; address public stakerRewards; //cvx rewards address public lockRewards; //cvxCrv rewards(crv) address public lockFees; //cvxCrv vecrv fees address public feeDistro; address public feeToken; bool public isShutdown; struct PoolInfo { address lptoken; address token; address gauge; address crvRewards; address stash; bool shutdown; } //index(pid) -> pool PoolInfo[] public poolInfo; mapping(address => bool) public gaugeMap; event Deposited(address indexed user, uint256 indexed poolid, uint256 amount); event Withdrawn(address indexed user, uint256 indexed poolid, uint256 amount); constructor(address _staker, address _minter) public { isShutdown = false; staker = _staker; owner = msg.sender; voteDelegate = msg.sender; feeManager = msg.sender; poolManager = msg.sender; feeDistro = address(0); //address(0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc); feeToken = address(0); //address(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490); treasury = address(0); minter = _minter; } /// SETTER SECTION /// function setOwner(address _owner) external { require(msg.sender == owner, "!auth"); owner = _owner; } function setFeeManager(address _feeM) external { require(msg.sender == feeManager, "!auth"); feeManager = _feeM; } function setPoolManager(address _poolM) external { require(msg.sender == poolManager, "!auth"); poolManager = _poolM; } function setFactories(address _rfactory, address _sfactory, address _tfactory) external { require(msg.sender == owner, "!auth"); //reward factory only allow this to be called once even if owner //removes ability to inject malicious staking contracts //token factory can also be immutable if(rewardFactory == address(0)){ rewardFactory = _rfactory; tokenFactory = _tfactory; } //stash factory should be considered more safe to change //updating may be required to handle new types of gauges stashFactory = _sfactory; } function setArbitrator(address _arb) external { require(msg.sender==owner, "!auth"); rewardArbitrator = _arb; } function setVoteDelegate(address _voteDelegate) external { require(msg.sender==voteDelegate, "!auth"); voteDelegate = _voteDelegate; } function setRewardContracts(address _rewards, address _stakerRewards) external { require(msg.sender == owner, "!auth"); //reward contracts are immutable or else the owner //has a means to redeploy and mint cvx via rewardClaimed() if(lockRewards == address(0)){ lockRewards = _rewards; stakerRewards = _stakerRewards; } } // Set reward token and claim contract, get from Curve's registry function setFeeInfo() external { require(msg.sender==feeManager, "!auth"); feeDistro = IRegistry(registry).get_address(distributionAddressId); address _feeToken = IFeeDistro(feeDistro).token(); if(feeToken != _feeToken){ //create a new reward contract for the new token lockFees = IRewardFactory(rewardFactory).CreateTokenRewards(_feeToken,lockRewards,address(this)); feeToken = _feeToken; } } function setFees(uint256 _lockFees, uint256 _stakerFees, uint256 _callerFees, uint256 _platform) external{ require(msg.sender==feeManager, "!auth"); uint256 total = _lockFees.add(_stakerFees).add(_callerFees).add(_platform); require(total <= MaxFees, ">MaxFees"); //values must be within certain ranges if(_lockFees >= 1000 && _lockFees <= 1500 && _stakerFees >= 300 && _stakerFees <= 600 && _callerFees >= 10 && _callerFees <= 100 && _platform <= 200){ lockIncentive = _lockFees; stakerIncentive = _stakerFees; earmarkIncentive = _callerFees; platformFee = _platform; } } function setTreasury(address _treasury) external { require(msg.sender==feeManager, "!auth"); treasury = _treasury; } /// END SETTER SECTION /// function poolLength() external view returns (uint256) { return poolInfo.length; } //create a new pool function addPool(address _lptoken, address _gauge, uint256 _stashVersion) external returns(bool){ require(msg.sender==poolManager && !isShutdown, "!add"); require(_gauge != address(0) && _lptoken != address(0),"!param"); //the next pool's pid uint256 pid = poolInfo.length; //create a tokenized deposit address token = ITokenFactory(tokenFactory).CreateDepositToken(_lptoken); //create a reward contract for crv rewards address newRewardPool = IRewardFactory(rewardFactory).CreateCrvRewards(pid,token); //create a stash to handle extra incentives address stash = IStashFactory(stashFactory).CreateStash(pid,_gauge,staker,_stashVersion); //add the new pool poolInfo.push( PoolInfo({ lptoken: _lptoken, token: token, gauge: _gauge, crvRewards: newRewardPool, stash: stash, shutdown: false }) ); gaugeMap[_gauge] = true; //give stashes access to rewardfactory and voteproxy // voteproxy so it can grab the incentive tokens off the contract after claiming rewards // reward factory so that stashes can make new extra reward contracts if a new incentive is added to the gauge if(stash != address(0)){ poolInfo[pid].stash = stash; IStaker(staker).setStashAccess(stash,true); IRewardFactory(rewardFactory).setAccess(stash,true); } return true; } //shutdown pool function shutdownPool(uint256 _pid) external returns(bool){ require(msg.sender==poolManager, "!auth"); PoolInfo storage pool = poolInfo[_pid]; //withdraw from gauge try IStaker(staker).withdrawAll(pool.lptoken,pool.gauge){ }catch{} pool.shutdown = true; gaugeMap[pool.gauge] = false; return true; } //shutdown this contract. // unstake and pull all lp tokens to this address // only allow withdrawals function shutdownSystem() external{ require(msg.sender == owner, "!auth"); isShutdown = true; for(uint i=0; i < poolInfo.length; i++){ PoolInfo storage pool = poolInfo[i]; if (pool.shutdown) continue; address token = pool.lptoken; address gauge = pool.gauge; //withdraw from gauge try IStaker(staker).withdrawAll(token,gauge){ pool.shutdown = true; }catch{} } } //deposit lp tokens and stake function deposit(uint256 _pid, uint256 _amount, bool _stake) public returns(bool){ require(!isShutdown,"shutdown"); PoolInfo storage pool = poolInfo[_pid]; require(pool.shutdown == false, "pool is closed"); //send to proxy to stake address lptoken = pool.lptoken; IERC20(lptoken).safeTransferFrom(msg.sender, staker, _amount); //stake address gauge = pool.gauge; require(gauge != address(0),"!gauge setting"); IStaker(staker).deposit(lptoken,gauge); //some gauges claim rewards when depositing, stash them in a seperate contract until next claim address stash = pool.stash; if(stash != address(0)){ IStash(stash).stashRewards(); } address token = pool.token; if(_stake){ //mint here and send to rewards on user behalf ITokenMinter(token).mint(address(this),_amount); address rewardContract = pool.crvRewards; IERC20(token).safeApprove(rewardContract,0); IERC20(token).safeApprove(rewardContract,_amount); IRewards(rewardContract).stakeFor(msg.sender,_amount); }else{ //add user balance directly ITokenMinter(token).mint(msg.sender,_amount); } emit Deposited(msg.sender, _pid, _amount); return true; } //deposit all lp tokens and stake function depositAll(uint256 _pid, bool _stake) external returns(bool){ address lptoken = poolInfo[_pid].lptoken; uint256 balance = IERC20(lptoken).balanceOf(msg.sender); deposit(_pid,balance,_stake); return true; } //withdraw lp tokens function _withdraw(uint256 _pid, uint256 _amount, address _from, address _to) internal { PoolInfo storage pool = poolInfo[_pid]; address lptoken = pool.lptoken; address gauge = pool.gauge; //remove lp balance address token = pool.token; ITokenMinter(token).burn(_from,_amount); //pull from gauge if not shutdown // if shutdown tokens will be in this contract if (!pool.shutdown) { IStaker(staker).withdraw(lptoken,gauge, _amount); } //some gauges claim rewards when withdrawing, stash them in a seperate contract until next claim //do not call if shutdown since stashes wont have access address stash = pool.stash; if(stash != address(0) && !isShutdown && !pool.shutdown){ IStash(stash).stashRewards(); } //return lp tokens IERC20(lptoken).safeTransfer(_to, _amount); emit Withdrawn(_to, _pid, _amount); } //withdraw lp tokens function withdraw(uint256 _pid, uint256 _amount) public returns(bool){ _withdraw(_pid,_amount,msg.sender,msg.sender); return true; } //withdraw all lp tokens function withdrawAll(uint256 _pid) public returns(bool){ address token = poolInfo[_pid].token; uint256 userBal = IERC20(token).balanceOf(msg.sender); withdraw(_pid, userBal); return true; } //allow reward contracts to send here and withdraw to user function withdrawTo(uint256 _pid, uint256 _amount, address _to) external returns(bool){ address rewardContract = poolInfo[_pid].crvRewards; require(msg.sender == rewardContract,"!auth"); _withdraw(_pid,_amount,msg.sender,_to); return true; } //delegate address votes on dao function vote(uint256 _voteId, address _votingAddress, bool _support) external returns(bool){ require(msg.sender == voteDelegate, "!auth"); require(_votingAddress == voteOwnership || _votingAddress == voteParameter, "!voteAddr"); IStaker(staker).vote(_voteId,_votingAddress,_support); return true; } function voteGaugeWeight(address[] calldata _gauge, uint256[] calldata _weight ) external returns(bool){ require(msg.sender == voteDelegate, "!auth"); for(uint256 i = 0; i < _gauge.length; i++){ IStaker(staker).voteGaugeWeight(_gauge[i],_weight[i]); } return true; } function claimRewards(uint256 _pid, address _gauge) external returns(bool){ address stash = poolInfo[_pid].stash; require(msg.sender == stash,"!auth"); IStaker(staker).claimRewards(_gauge); return true; } function setGaugeRedirect(uint256 _pid) external returns(bool){ address stash = poolInfo[_pid].stash; require(msg.sender == stash,"!auth"); address gauge = poolInfo[_pid].gauge; bytes memory data = abi.encodeWithSelector(bytes4(keccak256("set_rewards_receiver(address)")), stash); IStaker(staker).execute(gauge,uint256(0),data); return true; } //claim crv and extra rewards and disperse to reward contracts function _earmarkRewards(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; require(pool.shutdown == false, "pool is closed"); address gauge = pool.gauge; //claim crv IStaker(staker).claimCrv(gauge); //check if there are extra rewards address stash = pool.stash; if(stash != address(0)){ //claim extra rewards IStash(stash).claimRewards(); //process extra rewards IStash(stash).processStash(); } //crv balance uint256 crvBal = IERC20(crv).balanceOf(address(this)); if (crvBal > 0) { uint256 _lockIncentive = crvBal.mul(lockIncentive).div(FEE_DENOMINATOR); uint256 _stakerIncentive = crvBal.mul(stakerIncentive).div(FEE_DENOMINATOR); uint256 _callIncentive = crvBal.mul(earmarkIncentive).div(FEE_DENOMINATOR); //send treasury if(treasury != address(0) && treasury != address(this) && platformFee > 0){ //only subtract after address condition check uint256 _platform = crvBal.mul(platformFee).div(FEE_DENOMINATOR); crvBal = crvBal.sub(_platform); IERC20(crv).safeTransfer(treasury, _platform); } //remove incentives from balance crvBal = crvBal.sub(_lockIncentive).sub(_callIncentive).sub(_stakerIncentive); //send incentives for calling IERC20(crv).safeTransfer(msg.sender, _callIncentive); //send crv to lp provider reward contract address rewardContract = pool.crvRewards; IERC20(crv).safeTransfer(rewardContract, crvBal); IRewards(rewardContract).queueNewRewards(crvBal); //send lockers' share of crv to reward contract IERC20(crv).safeTransfer(lockRewards, _lockIncentive); IRewards(lockRewards).queueNewRewards(_lockIncentive); //send stakers's share of crv to reward contract IERC20(crv).safeTransfer(stakerRewards, _stakerIncentive); IRewards(stakerRewards).queueNewRewards(_stakerIncentive); } } function earmarkRewards(uint256 _pid) external returns(bool){ require(!isShutdown,"shutdown"); _earmarkRewards(_pid); return true; } //claim fees from curve distro contract, put in lockers' reward contract function earmarkFees() external returns(bool){ //claim fee rewards IStaker(staker).claimFees(feeDistro, feeToken); //send fee rewards to reward contract uint256 _balance = IERC20(feeToken).balanceOf(address(this)); IERC20(feeToken).safeTransfer(lockFees, _balance); IRewards(lockFees).queueNewRewards(_balance); return true; } //callback from reward contract when crv is received. function rewardClaimed(uint256 _pid, address _address, uint256 _amount) external returns(bool){ address rewardContract = poolInfo[_pid].crvRewards; require(msg.sender == rewardContract || msg.sender == lockRewards, "!auth"); //mint reward tokens ITokenMinter(minter).mint(_address,_amount); return true; } }
< // SPDX-License-Identifier: MIT
// File: contracts\Interfaces.sol

pragma solidity 0.6.12;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUtil {
    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }
}

contract ReentrancyGuard {
    uint256 private _guardCounter;

    constructor () internal {
        _guardCounter = 1;
    }

    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
    }
}

interface ICurveGauge {
    function deposit(uint256) external;
    function balanceOf(address) external view returns (uint256);
    function withdraw(uint256) external;
    function claim_rewards() external;
    function reward_tokens(uint256) external view returns(address);//v2
    function rewarded_token() external view returns(address);//v1
}

interface ICurveVoteEscrow {
    function create_lock(uint256, uint256) external;
    function increase_amount(uint256) external;
    function increase_unlock_time(uint256) external;
    function withdraw() external;
    function smart_wallet_checker() external view returns (address);
}

interface IWalletChecker {
    function check(address) external view returns (bool);
}

interface IVoting{
    function vote(uint256, bool, bool) external; //voteId, support, executeIfDecided
    function getVote(uint256) external view returns(bool,bool,uint64,uint64,uint64,uint64,uint256,uint256,uint256,bytes memory); 
    function vote_for_gauge_weights(address,uint256) external;
}

interface IMinter{
    function mint(address) external;
}

interface IRegistry{
    function get_registry() external view returns(address);
    function get_address(uint256 _id) external view returns(address);
    function gauge_controller() external view returns(address);
    function get_lp_token(address) external view returns(address);
    function get_gauges(address) external view returns(address[10] memory,uint128[10] memory);
}

interface IStaker{
    function deposit(address, address) external;
    function withdraw(address) external;
    function withdraw(address, address, uint256) external;
    function withdrawAll(address, address) external;
    function createLock(uint256, uint256) external;
    function increaseAmount(uint256) external;
    function increaseTime(uint256) external;
    function release() external;
    function claimCrv(address) external returns (uint256);
    function claimRewards(address) external;
    function claimFees(address,address) external;
    function setStashAccess(address, bool) external;
    function vote(uint256,address,bool) external;
    function voteGaugeWeight(address,uint256) external;
    function balanceOfPool(address) external view returns (uint256);
    function operator() external view returns (address);
    function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory);
}

interface IRewards{
    function stake(address, uint256) external;
    function stakeFor(address, uint256) external;
    function withdraw(address, uint256) external;
    function exit(address) external;
    function getReward(address) external;
    function queueNewRewards(uint256) external;
    function notifyRewardAmount(uint256) external;
    function addExtraReward(address) external;
    function stakingToken() external returns (address);
}

interface IStash{
    function stashRewards() external returns (bool);
    function processStash() external returns (bool);
    function claimRewards() external returns (bool);
}

interface IFeeDistro{
    function claim() external;
    function token() external view returns(address);
}

interface ITokenMinter{
    function mint(address,uint256) external;
    function burn(address,uint256) external;
}

interface IDeposit{
    function isShutdown() external view returns(bool);
    function balanceOf(address _account) external view returns(uint256);
    function totalSupply() external view returns(uint256);
    function poolInfo(uint256) external view returns(address,address,address,address,address, bool);
    function rewardClaimed(uint256,address,uint256) external;
    function withdrawTo(uint256,uint256,address) external;
    function claimRewards(uint256,address) external returns(bool);
    function rewardArbitrator() external returns(address);
}

interface ICrvDeposit{
    function deposit(uint256, bool) external;
    function lockIncentive() external view returns(uint256);
}

interface IRewardFactory{
    function setAccess(address,bool) external;
    function CreateCrvRewards(uint256,address) external returns(address);
    function CreateTokenRewards(address,address,address) external returns(address);
    function activeRewardCount(address) external view returns(uint256);
    function addActiveReward(address,uint256) external returns(bool);
    function removeActiveReward(address,uint256) external returns(bool);
}

interface IStashFactory{
    function CreateStash(uint256,address,address,uint256) external returns(address);
}

interface ITokenFactory{
    function CreateDepositToken(address) external returns(address);
}

interface IPools{
    function addPool(address _lptoken, address _gauge, uint256 _stashVersion) external returns(bool);
    function shutdownPool(uint256 _pid) external returns(bool);
    function poolInfo(uint256) external view returns(address,address,address,address,address,bool);
    function poolLength() external view returns (uint256);
    function gaugeMap(address) external view returns(bool);
    function setPoolManager(address _poolM) external;
}

interface IVestedEscrow{
    function fund(address[] calldata _recipient, uint256[] calldata _amount) external returns(bool);
}

// File: @openzeppelin\contracts\math\SafeMath.sol

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

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

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

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

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

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// File: @openzeppelin\contracts\token\ERC20\IERC20.sol

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

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

// File: @openzeppelin\contracts\utils\Address.sol
pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol


pragma solidity >=0.6.0 <0.8.0;


/**
 * @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 SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @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, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// File: contracts\Booster.sol

pragma solidity 0.6.12;



contract Booster{
    using SafeERC20 for IERC20;
    using Address for address;
    using SafeMath for uint256;

    address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52);
    address public constant registry = address(0x0000000022D53366457F9d5E68Ec105046FC4383);
    uint256 public constant distributionAddressId = 4;
    address public constant voteOwnership = address(0xE478de485ad2fe566d49342Cbd03E49ed7DB3356);
    address public constant voteParameter = address(0xBCfF8B0b9419b9A88c44546519b1e909cF330399);

    uint256 public lockIncentive = 1000; //incentive to crv stakers
    uint256 public stakerIncentive = 450; //incentive to native token stakers
    uint256 public earmarkIncentive = 50; //incentive to users who spend gas to make calls
    uint256 public platformFee = 0; //possible fee to build treasury
    uint256 public constant MaxFees = 2000;
    uint256 public constant FEE_DENOMINATOR = 10000;

    address public owner;
    address public feeManager;
    address public poolManager;
    address public immutable staker;
    address public immutable minter;
    address public rewardFactory;
    address public stashFactory;
    address public tokenFactory;
    address public rewardArbitrator;
    address public voteDelegate;
    address public treasury;
    address public stakerRewards; //cvx rewards
    address public lockRewards; //cvxCrv rewards(crv)
    address public lockFees; //cvxCrv vecrv fees
    address public feeDistro;
    address public feeToken;

    bool public isShutdown;

    struct PoolInfo {
        address lptoken;
        address token;
        address gauge;
        address crvRewards;
        address stash;
        bool shutdown;
    }

    //index(pid) -> pool
    PoolInfo[] public poolInfo;
    mapping(address => bool) public gaugeMap;

    event Deposited(address indexed user, uint256 indexed poolid, uint256 amount);
    event Withdrawn(address indexed user, uint256 indexed poolid, uint256 amount);

    constructor(address _staker, address _minter) public {
        isShutdown = false;
        staker = _staker;
        owner = msg.sender;
        voteDelegate = msg.sender;
        feeManager = msg.sender;
        poolManager = msg.sender;
        feeDistro = address(0); //address(0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc);
        feeToken = address(0); //address(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);
        treasury = address(0);
        minter = _minter;
    }


    /// SETTER SECTION ///

    function setOwner(address _owner) external {
        require(msg.sender == owner, "!auth");
        owner = _owner;
    }

    function setFeeManager(address _feeM) external {
        require(msg.sender == feeManager, "!auth");
        feeManager = _feeM;
    }

    function setPoolManager(address _poolM) external {
        require(msg.sender == poolManager, "!auth");
        poolManager = _poolM;
    }

    function setFactories(address _rfactory, address _sfactory, address _tfactory) external {
        require(msg.sender == owner, "!auth");
        
        //reward factory only allow this to be called once even if owner
        //removes ability to inject malicious staking contracts
        //token factory can also be immutable
        if(rewardFactory == address(0)){
            rewardFactory = _rfactory;
            tokenFactory = _tfactory;
        }

        //stash factory should be considered more safe to change
        //updating may be required to handle new types of gauges
        stashFactory = _sfactory;
    }

    function setArbitrator(address _arb) external {
        require(msg.sender==owner, "!auth");
        rewardArbitrator = _arb;
    }

    function setVoteDelegate(address _voteDelegate) external {
        require(msg.sender==voteDelegate, "!auth");
        voteDelegate = _voteDelegate;
    }

    function setRewardContracts(address _rewards, address _stakerRewards) external {
        require(msg.sender == owner, "!auth");
        
        //reward contracts are immutable or else the owner
        //has a means to redeploy and mint cvx via rewardClaimed()
        if(lockRewards == address(0)){
            lockRewards = _rewards;
            stakerRewards = _stakerRewards;
        }
    }

    // Set reward token and claim contract, get from Curve's registry
    function setFeeInfo() external {
        require(msg.sender==feeManager, "!auth");
        
        feeDistro = IRegistry(registry).get_address(distributionAddressId);
        address _feeToken = IFeeDistro(feeDistro).token();
        if(feeToken != _feeToken){
            //create a new reward contract for the new token
            lockFees = IRewardFactory(rewardFactory).CreateTokenRewards(_feeToken,lockRewards,address(this));
            feeToken = _feeToken;
        }
    }

    function setFees(uint256 _lockFees, uint256 _stakerFees, uint256 _callerFees, uint256 _platform) external{
        require(msg.sender==feeManager, "!auth");

        uint256 total = _lockFees.add(_stakerFees).add(_callerFees).add(_platform);
        require(total <= MaxFees, ">MaxFees");

        //values must be within certain ranges     
        if(_lockFees >= 1000 && _lockFees <= 1500
            && _stakerFees >= 300 && _stakerFees <= 600
            && _callerFees >= 10 && _callerFees <= 100
            && _platform <= 200){
            lockIncentive = _lockFees;
            stakerIncentive = _stakerFees;
            earmarkIncentive = _callerFees;
            platformFee = _platform;
        }
    }

    function setTreasury(address _treasury) external {
        require(msg.sender==feeManager, "!auth");
        treasury = _treasury;
    }

    /// END SETTER SECTION ///


    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    //create a new pool
    function addPool(address _lptoken, address _gauge, uint256 _stashVersion) external returns(bool){
        require(msg.sender==poolManager && !isShutdown, "!add");
        require(_gauge != address(0) && _lptoken != address(0),"!param");

        //the next pool's pid
        uint256 pid = poolInfo.length;

        //create a tokenized deposit
        address token = ITokenFactory(tokenFactory).CreateDepositToken(_lptoken);
        //create a reward contract for crv rewards
        address newRewardPool = IRewardFactory(rewardFactory).CreateCrvRewards(pid,token);
        //create a stash to handle extra incentives
        address stash = IStashFactory(stashFactory).CreateStash(pid,_gauge,staker,_stashVersion);

        //add the new pool
        poolInfo.push(
            PoolInfo({
                lptoken: _lptoken,
                token: token,
                gauge: _gauge,
                crvRewards: newRewardPool,
                stash: stash,
                shutdown: false
            })
        );
        gaugeMap[_gauge] = true;
        //give stashes access to rewardfactory and voteproxy
        //   voteproxy so it can grab the incentive tokens off the contract after claiming rewards
        //   reward factory so that stashes can make new extra reward contracts if a new incentive is added to the gauge
        if(stash != address(0)){
            poolInfo[pid].stash = stash;
            IStaker(staker).setStashAccess(stash,true);
            IRewardFactory(rewardFactory).setAccess(stash,true);
        }
        return true;
    }

    //shutdown pool
    function shutdownPool(uint256 _pid) external returns(bool){
        require(msg.sender==poolManager, "!auth");
        PoolInfo storage pool = poolInfo[_pid];

        //withdraw from gauge
        try IStaker(staker).withdrawAll(pool.lptoken,pool.gauge){
        }catch{}

        pool.shutdown = true;
        gaugeMap[pool.gauge] = false;
        return true;
    }

    //shutdown this contract.
    //  unstake and pull all lp tokens to this address
    //  only allow withdrawals
    function shutdownSystem() external{
        require(msg.sender == owner, "!auth");
        isShutdown = true;

        for(uint i=0; i < poolInfo.length; i++){
            PoolInfo storage pool = poolInfo[i];
            if (pool.shutdown) continue;

            address token = pool.lptoken;
            address gauge = pool.gauge;

            //withdraw from gauge
            try IStaker(staker).withdrawAll(token,gauge){
                pool.shutdown = true;
            }catch{}
        }
    }


    //deposit lp tokens and stake
    function deposit(uint256 _pid, uint256 _amount, bool _stake) public returns(bool){
        require(!isShutdown,"shutdown");
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.shutdown == false, "pool is closed");

        //send to proxy to stake
        address lptoken = pool.lptoken;
        IERC20(lptoken).safeTransferFrom(msg.sender, staker, _amount);

        //stake
        address gauge = pool.gauge;
        require(gauge != address(0),"!gauge setting");
        IStaker(staker).deposit(lptoken,gauge);

        //some gauges claim rewards when depositing, stash them in a seperate contract until next claim
        address stash = pool.stash;
        if(stash != address(0)){
            IStash(stash).stashRewards();
        }

        address token = pool.token;
        if(_stake){
            //mint here and send to rewards on user behalf
            ITokenMinter(token).mint(address(this),_amount);
            address rewardContract = pool.crvRewards;
            IERC20(token).safeApprove(rewardContract,0);
            IERC20(token).safeApprove(rewardContract,_amount);
            IRewards(rewardContract).stakeFor(msg.sender,_amount);
        }else{
            //add user balance directly
            ITokenMinter(token).mint(msg.sender,_amount);
        }

        
        emit Deposited(msg.sender, _pid, _amount);
        return true;
    }

    //deposit all lp tokens and stake
    function depositAll(uint256 _pid, bool _stake) external returns(bool){
        address lptoken = poolInfo[_pid].lptoken;
        uint256 balance = IERC20(lptoken).balanceOf(msg.sender);
        deposit(_pid,balance,_stake);
        return true;
    }

    //withdraw lp tokens
    function _withdraw(uint256 _pid, uint256 _amount, address _from, address _to) internal {
        PoolInfo storage pool = poolInfo[_pid];
        address lptoken = pool.lptoken;
        address gauge = pool.gauge;

        //remove lp balance
        address token = pool.token;
        ITokenMinter(token).burn(_from,_amount);

        //pull from gauge if not shutdown
        // if shutdown tokens will be in this contract
        if (!pool.shutdown) {
            IStaker(staker).withdraw(lptoken,gauge, _amount);
        }

        //some gauges claim rewards when withdrawing, stash them in a seperate contract until next claim
        //do not call if shutdown since stashes wont have access
        address stash = pool.stash;
        if(stash != address(0) && !isShutdown && !pool.shutdown){
            IStash(stash).stashRewards();
        }
        
        //return lp tokens
        IERC20(lptoken).safeTransfer(_to, _amount);

        emit Withdrawn(_to, _pid, _amount);
    }

    //withdraw lp tokens
    function withdraw(uint256 _pid, uint256 _amount) public returns(bool){
        _withdraw(_pid,_amount,msg.sender,msg.sender);
        return true;
    }

    //withdraw all lp tokens
    function withdrawAll(uint256 _pid) public returns(bool){
        address token = poolInfo[_pid].token;
        uint256 userBal = IERC20(token).balanceOf(msg.sender);
        withdraw(_pid, userBal);
        return true;
    }

    //allow reward contracts to send here and withdraw to user
    function withdrawTo(uint256 _pid, uint256 _amount, address _to) external returns(bool){
        address rewardContract = poolInfo[_pid].crvRewards;
        require(msg.sender == rewardContract,"!auth");

        _withdraw(_pid,_amount,msg.sender,_to);
        return true;
    }


    //delegate address votes on dao
    function vote(uint256 _voteId, address _votingAddress, bool _support) external returns(bool){
        require(msg.sender == voteDelegate, "!auth");
        require(_votingAddress == voteOwnership || _votingAddress == voteParameter, "!voteAddr");
        
        IStaker(staker).vote(_voteId,_votingAddress,_support);
        return true;
    }

    function voteGaugeWeight(address[] calldata _gauge, uint256[] calldata _weight ) external returns(bool){
        require(msg.sender == voteDelegate, "!auth");

        for(uint256 i = 0; i < _gauge.length; i++){
            IStaker(staker).voteGaugeWeight(_gauge[i],_weight[i]);
        }
        return true;
    }

    function claimRewards(uint256 _pid, address _gauge) external returns(bool){
        address stash = poolInfo[_pid].stash;
        require(msg.sender == stash,"!auth");

        IStaker(staker).claimRewards(_gauge);
        return true;
    }

    function setGaugeRedirect(uint256 _pid) external returns(bool){
        address stash = poolInfo[_pid].stash;
        require(msg.sender == stash,"!auth");
        address gauge = poolInfo[_pid].gauge;
        bytes memory data = abi.encodeWithSelector(bytes4(keccak256("set_rewards_receiver(address)")), stash);
        IStaker(staker).execute(gauge,uint256(0),data);
        return true;
    }

    //claim crv and extra rewards and disperse to reward contracts
    function _earmarkRewards(uint256 _pid) internal {
        PoolInfo storage pool = poolInfo[_pid];
        require(pool.shutdown == false, "pool is closed");

        address gauge = pool.gauge;

        //claim crv
        IStaker(staker).claimCrv(gauge);

        //check if there are extra rewards
        address stash = pool.stash;
        if(stash != address(0)){
            //claim extra rewards
            IStash(stash).claimRewards();
            //process extra rewards
            IStash(stash).processStash();
        }

        //crv balance
        uint256 crvBal = IERC20(crv).balanceOf(address(this));

        if (crvBal > 0) {
            uint256 _lockIncentive = crvBal.mul(lockIncentive).div(FEE_DENOMINATOR);
            uint256 _stakerIncentive = crvBal.mul(stakerIncentive).div(FEE_DENOMINATOR);
            uint256 _callIncentive = crvBal.mul(earmarkIncentive).div(FEE_DENOMINATOR);
            
            //send treasury
            if(treasury != address(0) && treasury != address(this) && platformFee > 0){
                //only subtract after address condition check
                uint256 _platform = crvBal.mul(platformFee).div(FEE_DENOMINATOR);
                crvBal = crvBal.sub(_platform);
                IERC20(crv).safeTransfer(treasury, _platform);
            }

            //remove incentives from balance
            crvBal = crvBal.sub(_lockIncentive).sub(_callIncentive).sub(_stakerIncentive);

            //send incentives for calling
            IERC20(crv).safeTransfer(msg.sender, _callIncentive);          

            //send crv to lp provider reward contract
            address rewardContract = pool.crvRewards;
            IERC20(crv).safeTransfer(rewardContract, crvBal);
            IRewards(rewardContract).queueNewRewards(crvBal);

            //send lockers' share of crv to reward contract
            IERC20(crv).safeTransfer(lockRewards, _lockIncentive);
            IRewards(lockRewards).queueNewRewards(_lockIncentive);

            //send stakers's share of crv to reward contract
            IERC20(crv).safeTransfer(stakerRewards, _stakerIncentive);
            IRewards(stakerRewards).queueNewRewards(_stakerIncentive);
        }
    }

    function earmarkRewards(uint256 _pid) external returns(bool){
        require(!isShutdown,"shutdown");
        _earmarkRewards(_pid);
        return true;
    }

    //claim fees from curve distro contract, put in lockers' reward contract
    function earmarkFees() external returns(bool){
        //claim fee rewards
        IStaker(staker).claimFees(feeDistro, feeToken);
        //send fee rewards to reward contract
        uint256 _balance = IERC20(feeToken).balanceOf(address(this));
        IERC20(feeToken).safeTransfer(lockFees, _balance);
        IRewards(lockFees).queueNewRewards(_balance);
        return true;
    }

    //callback from reward contract when crv is received.
    function rewardClaimed(uint256 _pid, address _address, uint256 _amount) external returns(bool){
        address rewardContract = poolInfo[_pid].crvRewards;
        require(msg.sender == rewardContract || msg.sender == lockRewards, "!auth");

        //mint reward tokens
        ITokenMinter(minter).mint(_address,_amount);
        
        return true;
    }

} < 

Booster ABI

[{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"address","name":"_minter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lptoken","type":"address"},{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"uint256","name":"_stashVersion","type":"uint256"}],"name":"addPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_gauge","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"crv","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_stake","type":"bool"}],"name":"deposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"bool","name":"_stake","type":"bool"}],"name":"depositAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionAddressId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earmarkFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earmarkIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"earmarkRewards","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistro","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugeMap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockFees","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"address","name":"lptoken","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"crvRewards","type":"address"},{"internalType":"address","name":"stash","type":"address"},{"internalType":"bool","name":"shutdown","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardArbitrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rewardClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_arb","type":"address"}],"name":"setArbitrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rfactory","type":"address"},{"internalType":"address","name":"_sfactory","type":"address"},{"internalType":"address","name":"_tfactory","type":"address"}],"name":"setFactories","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setFeeInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeM","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockFees","type":"uint256"},{"internalType":"uint256","name":"_stakerFees","type":"uint256"},{"internalType":"uint256","name":"_callerFees","type":"uint256"},{"internalType":"uint256","name":"_platform","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"setGaugeRedirect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolM","type":"address"}],"name":"setPoolManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewards","type":"address"},{"internalType":"address","name":"_stakerRewards","type":"address"}],"name":"setRewardContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voteDelegate","type":"address"}],"name":"setVoteDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"shutdownPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shutdownSystem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"staker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakerIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakerRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stashFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voteId","type":"uint256"},{"internalType":"address","name":"_votingAddress","type":"address"},{"internalType":"bool","name":"_support","type":"bool"}],"name":"vote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteDelegate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauge","type":"address[]"},{"internalType":"uint256[]","name":"_weight","type":"uint256[]"}],"name":"voteGaugeWeight","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteOwnership","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voteParameter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"withdrawAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
[{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"address","name":"_minter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_lptoken","type":"address"},{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"uint256","name":"_stashVersion","type":"uint256"}],"name":"addPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_gauge","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"crv","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_stake","type":"bool"}],"name":"deposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"bool","name":"_stake","type":"bool"}],"name":"depositAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionAddressId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earmarkFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earmarkIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"earmarkRewards","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistro","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugeMap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockFees","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"address","name":"lptoken","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"crvRewards","type":"address"},{"internalType":"address","name":"stash","type":"address"},{"internalType":"bool","name":"shutdown","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardArbitrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rewardClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_arb","type":"address"}],"name":"setArbitrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rfactory","type":"address"},{"internalType":"address","name":"_sfactory","type":"address"},{"internalType":"address","name":"_tfactory","type":"address"}],"name":"setFactories","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setFeeInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeM","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockFees","type":"uint256"},{"internalType":"uint256","name":"_stakerFees","type":"uint256"},{"internalType":"uint256","name":"_callerFees","type":"uint256"},{"internalType":"uint256","name":"_platform","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"setGaugeRedirect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolM","type":"address"}],"name":"setPoolManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewards","type":"address"},{"internalType":"address","name":"_stakerRewards","type":"address"}],"name":"setRewardContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voteDelegate","type":"address"}],"name":"setVoteDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"shutdownPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shutdownSystem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"staker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakerIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakerRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stashFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voteId","type":"uint256"},{"internalType":"address","name":"_votingAddress","type":"address"},{"internalType":"bool","name":"_support","type":"bool"}],"name":"vote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteDelegate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauge","type":"address[]"},{"internalType":"uint256[]","name":"_weight","type":"uint256[]"}],"name":"voteGaugeWeight","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteOwnership","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voteParameter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"withdrawAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

Booster Bytecode

60c06040526103e86000556101c26001556032600255600060035534801561002657600080fd5b506040516139733803806139738339818101604052604081101561004957600080fd5b508051602090910151601180546001600160601b0319606094851b8116608052600480546001600160a01b031990811633908117909255600b80548216831790556005805482168317905560068054821690921790915560108054821690556001600160a81b0319909216909255600c80549091169055911b1660a05260805160601c60a05160601c61383e6101356000398061098452806119bb525080610b295280610d7e5280610eef5280610f6752806114e5528061164f528061178f5280611dd8528061205b528061224a528061264b52806128965280612a3c5280612ea9525061383e6000f3fe608060405234801561001057600080fd5b50600436106103785760003560e01c80637303df9a116101d3578063b0eefabe11610104578063d0fb0203116100a2578063dc4c90d31161007c578063dc4c90d3146108fa578063e2cdd42a14610902578063e77772fe14610936578063f0f442601461093e57610378565b8063d0fb0203146108e2578063d6a0f530146108ea578063d73792a9146108f257610378565b8063bfad96ba116100de578063bfad96ba146107d5578063cb0d5b5214610897578063cc956f3f146108bd578063cfb9cfba146108da57610378565b8063b0eefabe1461079f578063b42eda71146107c5578063bf86d690146107cd57610378565b80639123d40411610171578063958e2d311161014b578063958e2d311461076a5780639f00332b14610787578063a386a0801461078f578063ab3662921461079757610378565b80639123d4041461071757806393e846a01461073457806395539a1d1461073c57610378565b80637b103999116101ad5780637b103999146106995780637bd3b995146106a15780637e29d6c2146106d95780638da5cb5b1461070f57610378565b80637303df9a14610645578063748743231461064d5780637aef67151461067357610378565b8063441a3e70116102ad57806361d027b31161024b5780636a4874a1116102255780636a4874a1146105b05780636c7b69cb146105b85780636fcba377146105e457806371192b171461061357610378565b806361d027b31461059857806362d28ac7146105a0578063647846a5146105a857610378565b80635a4ae5ca116102875780635a4ae5ca146105465780635ebaf1db1461054e57806360759fce1461055657806360cafe841461057b57610378565b8063441a3e70146104f5578063472d35b914610518578063509406181461053e57610378565b806322230b961161031a578063354af919116102f4578063354af919146104b2578063376d771a146104ba5780633a088cd2146104c257806343a0d066146104ca57610378565b806322230b961461049a578063245e4bf0146104a257806326232a2e146104aa57610378565b8063081e3eda11610356578063081e3eda146103b157806313af4035146103cb57806314cd70e4146103f35780631526fe271461043957610378565b8063043b684a1461037d578063068eb19e146103a157806307546172146103a9575b600080fd5b610385610964565b604080516001600160a01b039092168252519081900360200190f35b610385610973565b610385610982565b6103b96109a6565b60408051918252519081900360200190f35b6103f1600480360360208110156103e157600080fd5b50356001600160a01b03166109ac565b005b6104256004803603606081101561040957600080fd5b50803590602081013590604001356001600160a01b0316610a15565b604080519115158252519081900360200190f35b6104566004803603602081101561044f57600080fd5b5035610a99565b604080516001600160a01b0397881681529587166020870152938616858501529185166060850152909316608083015291151560a082015290519081900360c00190f35b610425610af7565b610385610c8d565b6103b9610c9c565b6103f1610ca2565b610385610e07565b6103b9610e16565b610425600480360360608110156104e057600080fd5b50803590602081013590604001351515610e1c565b6104256004803603604081101561050b57600080fd5b508035906020013561123f565b6103f16004803603602081101561052e57600080fd5b50356001600160a01b0316611257565b6103b96112c0565b6103f16112c6565b6103856114e3565b6104256004803603604081101561056c57600080fd5b50803590602001351515611507565b6104256004803603602081101561059157600080fd5b50356115b4565b6103856116e6565b6103b96116f5565b6103856116fb565b61038561170a565b610425600480360360408110156105ce57600080fd5b50803590602001356001600160a01b0316611722565b6103f1600480360360808110156105fa57600080fd5b508035906020810135906040810135906060013561181e565b6104256004803603606081101561062957600080fd5b508035906001600160a01b036020820135169060400135611939565b6103b9611a53565b6103f16004803603602081101561066357600080fd5b50356001600160a01b0316611a59565b6103f16004803603602081101561068957600080fd5b50356001600160a01b0316611ac2565b610385611b2b565b6103f1600480360360608110156106b757600080fd5b506001600160a01b038135811691602081013582169160409091013516611b3f565b610425600480360360608110156106ef57600080fd5b506001600160a01b03813581169160208101359091169060400135611beb565b610385612135565b6104256004803603602081101561072d57600080fd5b5035612144565b6103b96123ed565b6103f16004803603604081101561075257600080fd5b506001600160a01b03813581169160200135166123f2565b6104256004803603602081101561078057600080fd5b503561247e565b61038561252d565b61038561253c565b610385612554565b6103f1600480360360208110156107b557600080fd5b50356001600160a01b0316612563565b6103856125cc565b6104256125e4565b610425600480360360408110156107eb57600080fd5b81019060208101813564010000000081111561080657600080fd5b82018360208201111561081857600080fd5b8035906020019184602083028401116401000000008311171561083a57600080fd5b91939092909160208101903564010000000081111561085857600080fd5b82018360208201111561086a57600080fd5b8035906020019184602083028401116401000000008311171561088c57600080fd5b5090925090506125f4565b610425600480360360208110156108ad57600080fd5b50356001600160a01b0316612711565b610425600480360360208110156108d357600080fd5b5035612726565b610385612784565b610385612793565b6103856127a2565b6103b96127b1565b6103856127b7565b6104256004803603606081101561091857600080fd5b508035906001600160a01b03602082013516906040013515156127c6565b610385612915565b6103f16004803603602081101561095457600080fd5b50356001600160a01b0316612924565b600a546001600160a01b031681565b6008546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60125490565b6004546001600160a01b031633146109f3576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60008060128581548110610a2557fe5b60009182526020909120600360059092020101546001600160a01b03169050338114610a80576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b610a8c8585338661298d565b60019150505b9392505050565b60128181548110610aa657fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091831693908316929081169190811690600160a01b900460ff1686565b60105460115460408051632dbfa73560e01b81526001600160a01b0393841660048201529183166024830152516000927f00000000000000000000000000000000000000000000000000000000000000001691632dbfa735916044808301928692919082900301818387803b158015610b6f57600080fd5b505af1158015610b83573d6000803e3d6000fd5b5050601154604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015610bd457600080fd5b505afa158015610be8573d6000803e3d6000fd5b505050506040513d6020811015610bfe57600080fd5b5051600f54601154919250610c20916001600160a01b03908116911683612be6565b600f546040805163590a41f560e01b81526004810184905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b50505050600191505090565b6007546001600160a01b031681565b60035481565b6004546001600160a01b03163314610ce9576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6011805460ff60a01b1916600160a01b17905560005b601254811015610e0457600060128281548110610d1857fe5b906000526020600020906005020190508060040160149054906101000a900460ff1615610d455750610dfc565b80546002820154604080516301395c5960e31b81526001600160a01b0393841660048201819052928416602482018190529151929391927f0000000000000000000000000000000000000000000000000000000000000000909216916309cae2c89160448082019260009290919082900301818387803b158015610dc857600080fd5b505af1925050508015610dd9575060015b610de257610df8565b60048301805460ff60a01b1916600160a01b1790555b5050505b600101610cff565b50565b600e546001600160a01b031681565b60025481565b601154600090600160a01b900460ff1615610e69576040805162461bcd60e51b815260206004820152600860248201526739b43aba3237bbb760c11b604482015290519081900360640190fd5b600060128581548110610e7857fe5b600091825260209091206005909102016004810154909150600160a01b900460ff1615610edd576040805162461bcd60e51b815260206004820152600e60248201526d1c1bdbdb081a5cc818db1bdcd95960921b604482015290519081900360640190fd5b80546001600160a01b0316610f1481337f000000000000000000000000000000000000000000000000000000000000000088612c3d565b60028201546001600160a01b031680610f65576040805162461bcd60e51b815260206004820152600e60248201526d2167617567652073657474696e6760901b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f9609f0883836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b158015610fe557600080fd5b505af1158015610ff9573d6000803e3d6000fd5b5050505060048301546001600160a01b0316801561107957806001600160a01b031663b87bd4816040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561104c57600080fd5b505af1158015611060573d6000803e3d6000fd5b505050506040513d602081101561107657600080fd5b50505b60018401546001600160a01b0316861561119257604080516340c10f1960e01b8152306004820152602481018a905290516001600160a01b038316916340c10f1991604480830192600092919082900301818387803b1580156110db57600080fd5b505af11580156110ef573d6000803e3d6000fd5b50505060038601546001600160a01b039081169150611112908316826000612c9d565b6111266001600160a01b038316828b612c9d565b604080516305dc812160e31b8152336004820152602481018b905290516001600160a01b03831691632ee4090891604480830192600092919082900301818387803b15801561117457600080fd5b505af1158015611188573d6000803e3d6000fd5b50505050506111f9565b604080516340c10f1960e01b8152336004820152602481018a905290516001600160a01b038316916340c10f1991604480830192600092919082900301818387803b1580156111e057600080fd5b505af11580156111f4573d6000803e3d6000fd5b505050505b6040805189815290518a9133917f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9181900360200190a350600198975050505050505050565b600061124d8383333361298d565b5060015b92915050565b6005546001600160a01b0316331461129e576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60005481565b6005546001600160a01b0316331461130d576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6040805163124fd3dd60e21b815260048181015290516f22d53366457f9d5e68ec105046fc43839163493f4f74916024808301926020929190829003018186803b15801561135a57600080fd5b505afa15801561136e573d6000803e3d6000fd5b505050506040513d602081101561138457600080fd5b5051601080546001600160a01b0319166001600160a01b03928316179081905560408051637e062a3560e11b81529051600093929092169163fc0c546a91600480820192602092909190829003018186803b1580156113e257600080fd5b505afa1580156113f6573d6000803e3d6000fd5b505050506040513d602081101561140c57600080fd5b50516011549091506001600160a01b03808316911614610e0457600754600e5460408051637c6b091760e11b81526001600160a01b03858116600483015292831660248201523060448201529051919092169163f8d6122e9160648083019260209291908290030181600087803b15801561148657600080fd5b505af115801561149a573d6000803e3d6000fd5b505050506040513d60208110156114b057600080fd5b5051600f80546001600160a01b039283166001600160a01b03199182161790915560118054939092169216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806012848154811061151757fe5b60009182526020808320600590920290910154604080516370a0823160e01b815233600482015290516001600160a01b03909216945084926370a0823192602480840193829003018186803b15801561156f57600080fd5b505afa158015611583573d6000803e3d6000fd5b505050506040513d602081101561159957600080fd5b505190506115a8858286610e1c565b50600195945050505050565b6006546000906001600160a01b031633146115fe576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b60006012838154811061160d57fe5b60009182526020822060059091020180546002820154604080516301395c5960e31b81526001600160a01b0393841660048201529183166024830152519294507f000000000000000000000000000000000000000000000000000000000000000091909116926309cae2c89260448084019382900301818387803b15801561169457600080fd5b505af19250505080156116a5575060015b5060048101805460ff60a01b1916600160a01b179055600201546001600160a01b03166000908152601360205260409020805460ff19169055506001919050565b600c546001600160a01b031681565b60015481565b6011546001600160a01b031681565b73d533a949740bb3306d119cc777fa900ba034cd5281565b6000806012848154811061173257fe5b60009182526020909120600460059092020101546001600160a01b0316905033811461178d576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ef5cfb8c846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156117fc57600080fd5b505af1158015611810573d6000803e3d6000fd5b506001979650505050505050565b6005546001600160a01b03163314611865576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600061187d8261187785818989612db0565b90612db0565b90506107d08111156118c1576040805162461bcd60e51b81526020600482015260086024820152673e4d61784665657360c01b604482015290519081900360640190fd5b6103e885101580156118d557506105dc8511155b80156118e3575061012c8410155b80156118f157506102588411155b80156118fe5750600a8310155b801561190b575060648311155b8015611918575060c88211155b156119325760008590556001849055600283905560038290555b5050505050565b6000806012858154811061194957fe5b60009182526020909120600360059092020101546001600160a01b03169050338114806119805750600e546001600160a01b031633145b6119b9576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340c10f1985856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611a3057600080fd5b505af1158015611a44573d6000803e3d6000fd5b50600198975050505050505050565b6107d081565b600b546001600160a01b03163314611aa0576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314611b09576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6f22d53366457f9d5e68ec105046fc438381565b6004546001600160a01b03163314611b86576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6007546001600160a01b0316611bc757600780546001600160a01b038086166001600160a01b03199283161790925560098054928416929091169190911790555b50600880546001600160a01b0319166001600160a01b039290921691909117905550565b6006546000906001600160a01b031633148015611c125750601154600160a01b900460ff16155b611c4c576040805162461bcd60e51b815260206004808301919091526024820152630858591960e21b604482015290519081900360640190fd5b6001600160a01b03831615801590611c6c57506001600160a01b03841615155b611ca6576040805162461bcd60e51b815260206004820152600660248201526521706172616d60d01b604482015290519081900360640190fd5b60125460095460408051630452a26760e21b81526001600160a01b0388811660048301529151600093929092169163114a899c9160248082019260209290919082900301818787803b158015611cfb57600080fd5b505af1158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b5051600754604080516358cbfd4560e01b8152600481018690526001600160a01b038085166024830152915193945060009391909216916358cbfd4591604480830192602092919082900301818787803b158015611d8257600080fd5b505af1158015611d96573d6000803e3d6000fd5b505050506040513d6020811015611dac57600080fd5b505160085460408051634ce5896f60e11b8152600481018790526001600160a01b038a811660248301527f000000000000000000000000000000000000000000000000000000000000000081166044830152606482018a9052915193945060009391909216916399cb12de91608480830192602092919082900301818787803b158015611e3857600080fd5b505af1158015611e4c573d6000803e3d6000fd5b505050506040513d6020811015611e6257600080fd5b50516040805160c0810182526001600160a01b03808c16825286811660208381019182528c83168486018181528985166060870190815285891660808801818152600060a08a0181815260128054600181810183559184529b516005909c027fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444810180549d8d166001600160a01b03199e8f1617905599517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34458b018054918d16918e1691909117905595517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34468a018054918c16918d1691909117905593517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec344789018054918b16918c1691909117905590517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3448909701805493511515600160a01b0260ff60a01b199890991693909916929092179590951695909517909555835260139052929020805460ff191690911790559091501561181057806012858154811061200a57fe5b6000918252602082206004600590920201810180546001600160a01b039485166001600160a01b031990911617905560408051637d1cb25960e11b81528585169281019290925260016024830152517f00000000000000000000000000000000000000000000000000000000000000009093169263fa3964b29260448084019391929182900301818387803b1580156120a257600080fd5b505af11580156120b6573d6000803e3d6000fd5b50506007546040805163b84614a560e01b81526001600160a01b03868116600483015260016024830152915191909216935063b84614a59250604480830192600092919082900301818387803b15801561210f57600080fd5b505af1158015612123573d6000803e3d6000fd5b50505050506001979650505050505050565b6004546001600160a01b031681565b6000806012838154811061215457fe5b60009182526020909120600460059092020101546001600160a01b031690503381146121af576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6000601284815481106121be57fe5b6000918252602080832060026005909302019190910154604080516001600160a01b038781166024808401919091528351808403820181526044938401855295860180516001600160e01b0316635efcc08b60e11b1781529351635b0e93fb60e11b815294821660048601818152918601889052606093860193845286516064870152865190985095967f00000000000000000000000000000000000000000000000000000000000000009092169563b61d27f6958995939489949092608490920191808383895b8381101561229e578181015183820152602001612286565b50505050905090810190601f1680156122cb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156122ec57600080fd5b505af1158015612300573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604090815281101561232957600080fd5b81516020830180516040519294929383019291908464010000000082111561235057600080fd5b90830190602082018581111561236557600080fd5b825164010000000081118282018810171561237f57600080fd5b82525081516020918201929091019080838360005b838110156123ac578181015183820152602001612394565b50505050905090810190601f1680156123d95780820380516001836020036101000a031916815260200191505b506040525060019998505050505050505050565b600481565b6004546001600160a01b03163314612439576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600e546001600160a01b031661247a57600e80546001600160a01b038085166001600160a01b031992831617909255600d8054928416929091169190911790555b5050565b6000806012838154811061248e57fe5b6000918252602080832060016005909302019190910154604080516370a0823160e01b815233600482015290516001600160a01b03909216945084926370a0823192602480840193829003018186803b1580156124ea57600080fd5b505afa1580156124fe573d6000803e3d6000fd5b505050506040513d602081101561251457600080fd5b50519050612522848261123f565b506001949350505050565b600b546001600160a01b031681565b73e478de485ad2fe566d49342cbd03e49ed7db335681565b600f546001600160a01b031681565b6004546001600160a01b031633146125aa576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b73bcff8b0b9419b9a88c44546519b1e909cf33039981565b601154600160a01b900460ff1681565b600b546000906001600160a01b0316331461263e576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b60005b848110156115a8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635d7e9bcb87878481811061268457fe5b905060200201356001600160a01b03168686858181106126a057fe5b905060200201356040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156126ed57600080fd5b505af1158015612701573d6000803e3d6000fd5b5050600190920191506126419050565b60136020526000908152604090205460ff1681565b601154600090600160a01b900460ff1615612773576040805162461bcd60e51b815260206004820152600860248201526739b43aba3237bbb760c11b604482015290519081900360640190fd5b61277c82612e0a565b506001919050565b600d546001600160a01b031681565b6005546001600160a01b031681565b6010546001600160a01b031681565b61271081565b6006546001600160a01b031681565b600b546000906001600160a01b03163314612810576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6001600160a01b03831673e478de485ad2fe566d49342cbd03e49ed7db3356148061285757506001600160a01b03831673bcff8b0b9419b9a88c44546519b1e909cf330399145b612894576040805162461bcd60e51b815260206004820152600960248201526810bb37ba32a0b2323960b91b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e2cdd42a8585856040518463ffffffff1660e01b815260040180848152602001836001600160a01b0316815260200182151581526020019350505050600060405180830381600087803b1580156117fc57600080fd5b6009546001600160a01b031681565b6005546001600160a01b0316331461296b576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60006012858154811061299c57fe5b60009182526020822060059091020180546002820154600183015460408051632770a7eb60e21b81526001600160a01b038a81166004830152602482018c9052915195975093811695928116949116928392639dc29fac9260448084019382900301818387803b158015612a0f57600080fd5b505af1158015612a23573d6000803e3d6000fd5b505050506004840154600160a01b900460ff16612adb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed1284848a6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612ac257600080fd5b505af1158015612ad6573d6000803e3d6000fd5b505050505b60048401546001600160a01b03168015801590612b025750601154600160a01b900460ff16155b8015612b1a57506004850154600160a01b900460ff16155b15612b8757806001600160a01b031663b87bd4816040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612b5a57600080fd5b505af1158015612b6e573d6000803e3d6000fd5b505050506040513d6020811015612b8457600080fd5b50505b612b9b6001600160a01b038516878a612be6565b6040805189815290518a916001600160a01b038916917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc69181900360200190a3505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612c38908490613376565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612c97908590613376565b50505050565b801580612d23575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612cf557600080fd5b505afa158015612d09573d6000803e3d6000fd5b505050506040513d6020811015612d1f57600080fd5b5051155b612d5e5760405162461bcd60e51b81526004018080602001828103825260368152602001806137d36036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612c38908490613376565b600082820183811015610a92576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600060128281548110612e1957fe5b600091825260209091206005909102016004810154909150600160a01b900460ff1615612e7e576040805162461bcd60e51b815260206004820152600e60248201526d1c1bdbdb081a5cc818db1bdcd95960921b604482015290519081900360640190fd5b600281015460408051631ff4de0360e11b81526001600160a01b0392831660048201819052915191927f00000000000000000000000000000000000000000000000000000000000000001691633fe9bc06916024808201926020929091908290030181600087803b158015612ef257600080fd5b505af1158015612f06573d6000803e3d6000fd5b505050506040513d6020811015612f1c57600080fd5b505060048201546001600160a01b0316801561300857806001600160a01b031663372500ab6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612f6d57600080fd5b505af1158015612f81573d6000803e3d6000fd5b505050506040513d6020811015612f9757600080fd5b50506040805163654580bb60e11b815290516001600160a01b0383169163ca8b01769160048083019260209291908290030181600087803b158015612fdb57600080fd5b505af1158015612fef573d6000803e3d6000fd5b505050506040513d602081101561300557600080fd5b50505b604080516370a0823160e01b8152306004820152905160009173d533a949740bb3306d119cc777fa900ba034cd52916370a0823191602480820192602092909190829003018186803b15801561305d57600080fd5b505afa158015613071573d6000803e3d6000fd5b505050506040513d602081101561308757600080fd5b5051905080156119325760006130b46127106130ae6000548561342790919063ffffffff16565b90613480565b905060006130d36127106130ae6001548661342790919063ffffffff16565b905060006130f26127106130ae6002548761342790919063ffffffff16565b600c549091506001600160a01b03161580159061311a5750600c546001600160a01b03163014155b801561312857506000600354115b1561318757600061314a6127106130ae6003548861342790919063ffffffff16565b905061315685826134e7565b600c549095506131859073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b031683612be6565b505b61319d82613197838188886134e7565b906134e7565b93506131be73d533a949740bb3306d119cc777fa900ba034cd523383612be6565b60038701546001600160a01b03166131eb73d533a949740bb3306d119cc777fa900ba034cd528287612be6565b806001600160a01b031663590a41f5866040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561323157600080fd5b505af1158015613245573d6000803e3d6000fd5b5050600e54613275925073d533a949740bb3306d119cc777fa900ba034cd5291506001600160a01b031686612be6565b600e546040805163590a41f560e01b81526004810187905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b1580156132c257600080fd5b505af11580156132d6573d6000803e3d6000fd5b5050600d54613306925073d533a949740bb3306d119cc777fa900ba034cd5291506001600160a01b031685612be6565b600d546040805163590a41f560e01b81526004810186905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b15801561335357600080fd5b505af1158015613367573d6000803e3d6000fd5b50505050505050505050505050565b60606133cb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166135449092919063ffffffff16565b805190915015612c38578080602001905160208110156133ea57600080fd5b5051612c385760405162461bcd60e51b815260040180806020018281038252602a8152602001806137a9602a913960400191505060405180910390fd5b60008261343657506000611251565b8282028284828161344357fe5b0414610a925760405162461bcd60e51b81526004018080602001828103825260218152602001806137886021913960400191505060405180910390fd5b60008082116134d6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816134df57fe5b049392505050565b60008282111561353e576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6060613553848460008561355b565b949350505050565b60608247101561359c5760405162461bcd60e51b81526004018080602001828103825260268152602001806137626026913960400191505060405180910390fd5b6135a5856136b7565b6135f6576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106136355780518252601f199092019160209182019101613616565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613697576040519150601f19603f3d011682016040523d82523d6000602084013e61369c565b606091505b50915091506136ac8282866136bd565b979650505050505050565b3b151590565b606083156136cc575081610a92565b8251156136dc5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561372657818101518382015260200161370e565b50505050905090810190601f1680156137535780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220c5d514fc01a91563fe8c3fc100910ae4fc8331968b27a2bd69dd0153a7e8620c64736f6c634300060c0033000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad800000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b
60c06040526103e86000556101c26001556032600255600060035534801561002657600080fd5b506040516139733803806139738339818101604052604081101561004957600080fd5b508051602090910151601180546001600160601b0319606094851b8116608052600480546001600160a01b031990811633908117909255600b80548216831790556005805482168317905560068054821690921790915560108054821690556001600160a81b0319909216909255600c80549091169055911b1660a05260805160601c60a05160601c61383e6101356000398061098452806119bb525080610b295280610d7e5280610eef5280610f6752806114e5528061164f528061178f5280611dd8528061205b528061224a528061264b52806128965280612a3c5280612ea9525061383e6000f3fe608060405234801561001057600080fd5b50600436106103785760003560e01c80637303df9a116101d3578063b0eefabe11610104578063d0fb0203116100a2578063dc4c90d31161007c578063dc4c90d3146108fa578063e2cdd42a14610902578063e77772fe14610936578063f0f442601461093e57610378565b8063d0fb0203146108e2578063d6a0f530146108ea578063d73792a9146108f257610378565b8063bfad96ba116100de578063bfad96ba146107d5578063cb0d5b5214610897578063cc956f3f146108bd578063cfb9cfba146108da57610378565b8063b0eefabe1461079f578063b42eda71146107c5578063bf86d690146107cd57610378565b80639123d40411610171578063958e2d311161014b578063958e2d311461076a5780639f00332b14610787578063a386a0801461078f578063ab3662921461079757610378565b80639123d4041461071757806393e846a01461073457806395539a1d1461073c57610378565b80637b103999116101ad5780637b103999146106995780637bd3b995146106a15780637e29d6c2146106d95780638da5cb5b1461070f57610378565b80637303df9a14610645578063748743231461064d5780637aef67151461067357610378565b8063441a3e70116102ad57806361d027b31161024b5780636a4874a1116102255780636a4874a1146105b05780636c7b69cb146105b85780636fcba377146105e457806371192b171461061357610378565b806361d027b31461059857806362d28ac7146105a0578063647846a5146105a857610378565b80635a4ae5ca116102875780635a4ae5ca146105465780635ebaf1db1461054e57806360759fce1461055657806360cafe841461057b57610378565b8063441a3e70146104f5578063472d35b914610518578063509406181461053e57610378565b806322230b961161031a578063354af919116102f4578063354af919146104b2578063376d771a146104ba5780633a088cd2146104c257806343a0d066146104ca57610378565b806322230b961461049a578063245e4bf0146104a257806326232a2e146104aa57610378565b8063081e3eda11610356578063081e3eda146103b157806313af4035146103cb57806314cd70e4146103f35780631526fe271461043957610378565b8063043b684a1461037d578063068eb19e146103a157806307546172146103a9575b600080fd5b610385610964565b604080516001600160a01b039092168252519081900360200190f35b610385610973565b610385610982565b6103b96109a6565b60408051918252519081900360200190f35b6103f1600480360360208110156103e157600080fd5b50356001600160a01b03166109ac565b005b6104256004803603606081101561040957600080fd5b50803590602081013590604001356001600160a01b0316610a15565b604080519115158252519081900360200190f35b6104566004803603602081101561044f57600080fd5b5035610a99565b604080516001600160a01b0397881681529587166020870152938616858501529185166060850152909316608083015291151560a082015290519081900360c00190f35b610425610af7565b610385610c8d565b6103b9610c9c565b6103f1610ca2565b610385610e07565b6103b9610e16565b610425600480360360608110156104e057600080fd5b50803590602081013590604001351515610e1c565b6104256004803603604081101561050b57600080fd5b508035906020013561123f565b6103f16004803603602081101561052e57600080fd5b50356001600160a01b0316611257565b6103b96112c0565b6103f16112c6565b6103856114e3565b6104256004803603604081101561056c57600080fd5b50803590602001351515611507565b6104256004803603602081101561059157600080fd5b50356115b4565b6103856116e6565b6103b96116f5565b6103856116fb565b61038561170a565b610425600480360360408110156105ce57600080fd5b50803590602001356001600160a01b0316611722565b6103f1600480360360808110156105fa57600080fd5b508035906020810135906040810135906060013561181e565b6104256004803603606081101561062957600080fd5b508035906001600160a01b036020820135169060400135611939565b6103b9611a53565b6103f16004803603602081101561066357600080fd5b50356001600160a01b0316611a59565b6103f16004803603602081101561068957600080fd5b50356001600160a01b0316611ac2565b610385611b2b565b6103f1600480360360608110156106b757600080fd5b506001600160a01b038135811691602081013582169160409091013516611b3f565b610425600480360360608110156106ef57600080fd5b506001600160a01b03813581169160208101359091169060400135611beb565b610385612135565b6104256004803603602081101561072d57600080fd5b5035612144565b6103b96123ed565b6103f16004803603604081101561075257600080fd5b506001600160a01b03813581169160200135166123f2565b6104256004803603602081101561078057600080fd5b503561247e565b61038561252d565b61038561253c565b610385612554565b6103f1600480360360208110156107b557600080fd5b50356001600160a01b0316612563565b6103856125cc565b6104256125e4565b610425600480360360408110156107eb57600080fd5b81019060208101813564010000000081111561080657600080fd5b82018360208201111561081857600080fd5b8035906020019184602083028401116401000000008311171561083a57600080fd5b91939092909160208101903564010000000081111561085857600080fd5b82018360208201111561086a57600080fd5b8035906020019184602083028401116401000000008311171561088c57600080fd5b5090925090506125f4565b610425600480360360208110156108ad57600080fd5b50356001600160a01b0316612711565b610425600480360360208110156108d357600080fd5b5035612726565b610385612784565b610385612793565b6103856127a2565b6103b96127b1565b6103856127b7565b6104256004803603606081101561091857600080fd5b508035906001600160a01b03602082013516906040013515156127c6565b610385612915565b6103f16004803603602081101561095457600080fd5b50356001600160a01b0316612924565b600a546001600160a01b031681565b6008546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60125490565b6004546001600160a01b031633146109f3576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60008060128581548110610a2557fe5b60009182526020909120600360059092020101546001600160a01b03169050338114610a80576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b610a8c8585338661298d565b60019150505b9392505050565b60128181548110610aa657fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091831693908316929081169190811690600160a01b900460ff1686565b60105460115460408051632dbfa73560e01b81526001600160a01b0393841660048201529183166024830152516000927f00000000000000000000000000000000000000000000000000000000000000001691632dbfa735916044808301928692919082900301818387803b158015610b6f57600080fd5b505af1158015610b83573d6000803e3d6000fd5b5050601154604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015610bd457600080fd5b505afa158015610be8573d6000803e3d6000fd5b505050506040513d6020811015610bfe57600080fd5b5051600f54601154919250610c20916001600160a01b03908116911683612be6565b600f546040805163590a41f560e01b81526004810184905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b50505050600191505090565b6007546001600160a01b031681565b60035481565b6004546001600160a01b03163314610ce9576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6011805460ff60a01b1916600160a01b17905560005b601254811015610e0457600060128281548110610d1857fe5b906000526020600020906005020190508060040160149054906101000a900460ff1615610d455750610dfc565b80546002820154604080516301395c5960e31b81526001600160a01b0393841660048201819052928416602482018190529151929391927f0000000000000000000000000000000000000000000000000000000000000000909216916309cae2c89160448082019260009290919082900301818387803b158015610dc857600080fd5b505af1925050508015610dd9575060015b610de257610df8565b60048301805460ff60a01b1916600160a01b1790555b5050505b600101610cff565b50565b600e546001600160a01b031681565b60025481565b601154600090600160a01b900460ff1615610e69576040805162461bcd60e51b815260206004820152600860248201526739b43aba3237bbb760c11b604482015290519081900360640190fd5b600060128581548110610e7857fe5b600091825260209091206005909102016004810154909150600160a01b900460ff1615610edd576040805162461bcd60e51b815260206004820152600e60248201526d1c1bdbdb081a5cc818db1bdcd95960921b604482015290519081900360640190fd5b80546001600160a01b0316610f1481337f000000000000000000000000000000000000000000000000000000000000000088612c3d565b60028201546001600160a01b031680610f65576040805162461bcd60e51b815260206004820152600e60248201526d2167617567652073657474696e6760901b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f9609f0883836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b158015610fe557600080fd5b505af1158015610ff9573d6000803e3d6000fd5b5050505060048301546001600160a01b0316801561107957806001600160a01b031663b87bd4816040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561104c57600080fd5b505af1158015611060573d6000803e3d6000fd5b505050506040513d602081101561107657600080fd5b50505b60018401546001600160a01b0316861561119257604080516340c10f1960e01b8152306004820152602481018a905290516001600160a01b038316916340c10f1991604480830192600092919082900301818387803b1580156110db57600080fd5b505af11580156110ef573d6000803e3d6000fd5b50505060038601546001600160a01b039081169150611112908316826000612c9d565b6111266001600160a01b038316828b612c9d565b604080516305dc812160e31b8152336004820152602481018b905290516001600160a01b03831691632ee4090891604480830192600092919082900301818387803b15801561117457600080fd5b505af1158015611188573d6000803e3d6000fd5b50505050506111f9565b604080516340c10f1960e01b8152336004820152602481018a905290516001600160a01b038316916340c10f1991604480830192600092919082900301818387803b1580156111e057600080fd5b505af11580156111f4573d6000803e3d6000fd5b505050505b6040805189815290518a9133917f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9181900360200190a350600198975050505050505050565b600061124d8383333361298d565b5060015b92915050565b6005546001600160a01b0316331461129e576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60005481565b6005546001600160a01b0316331461130d576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6040805163124fd3dd60e21b815260048181015290516f22d53366457f9d5e68ec105046fc43839163493f4f74916024808301926020929190829003018186803b15801561135a57600080fd5b505afa15801561136e573d6000803e3d6000fd5b505050506040513d602081101561138457600080fd5b5051601080546001600160a01b0319166001600160a01b03928316179081905560408051637e062a3560e11b81529051600093929092169163fc0c546a91600480820192602092909190829003018186803b1580156113e257600080fd5b505afa1580156113f6573d6000803e3d6000fd5b505050506040513d602081101561140c57600080fd5b50516011549091506001600160a01b03808316911614610e0457600754600e5460408051637c6b091760e11b81526001600160a01b03858116600483015292831660248201523060448201529051919092169163f8d6122e9160648083019260209291908290030181600087803b15801561148657600080fd5b505af115801561149a573d6000803e3d6000fd5b505050506040513d60208110156114b057600080fd5b5051600f80546001600160a01b039283166001600160a01b03199182161790915560118054939092169216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806012848154811061151757fe5b60009182526020808320600590920290910154604080516370a0823160e01b815233600482015290516001600160a01b03909216945084926370a0823192602480840193829003018186803b15801561156f57600080fd5b505afa158015611583573d6000803e3d6000fd5b505050506040513d602081101561159957600080fd5b505190506115a8858286610e1c565b50600195945050505050565b6006546000906001600160a01b031633146115fe576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b60006012838154811061160d57fe5b60009182526020822060059091020180546002820154604080516301395c5960e31b81526001600160a01b0393841660048201529183166024830152519294507f000000000000000000000000000000000000000000000000000000000000000091909116926309cae2c89260448084019382900301818387803b15801561169457600080fd5b505af19250505080156116a5575060015b5060048101805460ff60a01b1916600160a01b179055600201546001600160a01b03166000908152601360205260409020805460ff19169055506001919050565b600c546001600160a01b031681565b60015481565b6011546001600160a01b031681565b73d533a949740bb3306d119cc777fa900ba034cd5281565b6000806012848154811061173257fe5b60009182526020909120600460059092020101546001600160a01b0316905033811461178d576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ef5cfb8c846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156117fc57600080fd5b505af1158015611810573d6000803e3d6000fd5b506001979650505050505050565b6005546001600160a01b03163314611865576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600061187d8261187785818989612db0565b90612db0565b90506107d08111156118c1576040805162461bcd60e51b81526020600482015260086024820152673e4d61784665657360c01b604482015290519081900360640190fd5b6103e885101580156118d557506105dc8511155b80156118e3575061012c8410155b80156118f157506102588411155b80156118fe5750600a8310155b801561190b575060648311155b8015611918575060c88211155b156119325760008590556001849055600283905560038290555b5050505050565b6000806012858154811061194957fe5b60009182526020909120600360059092020101546001600160a01b03169050338114806119805750600e546001600160a01b031633145b6119b9576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340c10f1985856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611a3057600080fd5b505af1158015611a44573d6000803e3d6000fd5b50600198975050505050505050565b6107d081565b600b546001600160a01b03163314611aa0576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314611b09576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6f22d53366457f9d5e68ec105046fc438381565b6004546001600160a01b03163314611b86576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6007546001600160a01b0316611bc757600780546001600160a01b038086166001600160a01b03199283161790925560098054928416929091169190911790555b50600880546001600160a01b0319166001600160a01b039290921691909117905550565b6006546000906001600160a01b031633148015611c125750601154600160a01b900460ff16155b611c4c576040805162461bcd60e51b815260206004808301919091526024820152630858591960e21b604482015290519081900360640190fd5b6001600160a01b03831615801590611c6c57506001600160a01b03841615155b611ca6576040805162461bcd60e51b815260206004820152600660248201526521706172616d60d01b604482015290519081900360640190fd5b60125460095460408051630452a26760e21b81526001600160a01b0388811660048301529151600093929092169163114a899c9160248082019260209290919082900301818787803b158015611cfb57600080fd5b505af1158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b5051600754604080516358cbfd4560e01b8152600481018690526001600160a01b038085166024830152915193945060009391909216916358cbfd4591604480830192602092919082900301818787803b158015611d8257600080fd5b505af1158015611d96573d6000803e3d6000fd5b505050506040513d6020811015611dac57600080fd5b505160085460408051634ce5896f60e11b8152600481018790526001600160a01b038a811660248301527f000000000000000000000000000000000000000000000000000000000000000081166044830152606482018a9052915193945060009391909216916399cb12de91608480830192602092919082900301818787803b158015611e3857600080fd5b505af1158015611e4c573d6000803e3d6000fd5b505050506040513d6020811015611e6257600080fd5b50516040805160c0810182526001600160a01b03808c16825286811660208381019182528c83168486018181528985166060870190815285891660808801818152600060a08a0181815260128054600181810183559184529b516005909c027fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444810180549d8d166001600160a01b03199e8f1617905599517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34458b018054918d16918e1691909117905595517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34468a018054918c16918d1691909117905593517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec344789018054918b16918c1691909117905590517fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3448909701805493511515600160a01b0260ff60a01b199890991693909916929092179590951695909517909555835260139052929020805460ff191690911790559091501561181057806012858154811061200a57fe5b6000918252602082206004600590920201810180546001600160a01b039485166001600160a01b031990911617905560408051637d1cb25960e11b81528585169281019290925260016024830152517f00000000000000000000000000000000000000000000000000000000000000009093169263fa3964b29260448084019391929182900301818387803b1580156120a257600080fd5b505af11580156120b6573d6000803e3d6000fd5b50506007546040805163b84614a560e01b81526001600160a01b03868116600483015260016024830152915191909216935063b84614a59250604480830192600092919082900301818387803b15801561210f57600080fd5b505af1158015612123573d6000803e3d6000fd5b50505050506001979650505050505050565b6004546001600160a01b031681565b6000806012838154811061215457fe5b60009182526020909120600460059092020101546001600160a01b031690503381146121af576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6000601284815481106121be57fe5b6000918252602080832060026005909302019190910154604080516001600160a01b038781166024808401919091528351808403820181526044938401855295860180516001600160e01b0316635efcc08b60e11b1781529351635b0e93fb60e11b815294821660048601818152918601889052606093860193845286516064870152865190985095967f00000000000000000000000000000000000000000000000000000000000000009092169563b61d27f6958995939489949092608490920191808383895b8381101561229e578181015183820152602001612286565b50505050905090810190601f1680156122cb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156122ec57600080fd5b505af1158015612300573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604090815281101561232957600080fd5b81516020830180516040519294929383019291908464010000000082111561235057600080fd5b90830190602082018581111561236557600080fd5b825164010000000081118282018810171561237f57600080fd5b82525081516020918201929091019080838360005b838110156123ac578181015183820152602001612394565b50505050905090810190601f1680156123d95780820380516001836020036101000a031916815260200191505b506040525060019998505050505050505050565b600481565b6004546001600160a01b03163314612439576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600e546001600160a01b031661247a57600e80546001600160a01b038085166001600160a01b031992831617909255600d8054928416929091169190911790555b5050565b6000806012838154811061248e57fe5b6000918252602080832060016005909302019190910154604080516370a0823160e01b815233600482015290516001600160a01b03909216945084926370a0823192602480840193829003018186803b1580156124ea57600080fd5b505afa1580156124fe573d6000803e3d6000fd5b505050506040513d602081101561251457600080fd5b50519050612522848261123f565b506001949350505050565b600b546001600160a01b031681565b73e478de485ad2fe566d49342cbd03e49ed7db335681565b600f546001600160a01b031681565b6004546001600160a01b031633146125aa576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b73bcff8b0b9419b9a88c44546519b1e909cf33039981565b601154600160a01b900460ff1681565b600b546000906001600160a01b0316331461263e576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b60005b848110156115a8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635d7e9bcb87878481811061268457fe5b905060200201356001600160a01b03168686858181106126a057fe5b905060200201356040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156126ed57600080fd5b505af1158015612701573d6000803e3d6000fd5b5050600190920191506126419050565b60136020526000908152604090205460ff1681565b601154600090600160a01b900460ff1615612773576040805162461bcd60e51b815260206004820152600860248201526739b43aba3237bbb760c11b604482015290519081900360640190fd5b61277c82612e0a565b506001919050565b600d546001600160a01b031681565b6005546001600160a01b031681565b6010546001600160a01b031681565b61271081565b6006546001600160a01b031681565b600b546000906001600160a01b03163314612810576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b6001600160a01b03831673e478de485ad2fe566d49342cbd03e49ed7db3356148061285757506001600160a01b03831673bcff8b0b9419b9a88c44546519b1e909cf330399145b612894576040805162461bcd60e51b815260206004820152600960248201526810bb37ba32a0b2323960b91b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e2cdd42a8585856040518463ffffffff1660e01b815260040180848152602001836001600160a01b0316815260200182151581526020019350505050600060405180830381600087803b1580156117fc57600080fd5b6009546001600160a01b031681565b6005546001600160a01b0316331461296b576040805162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60006012858154811061299c57fe5b60009182526020822060059091020180546002820154600183015460408051632770a7eb60e21b81526001600160a01b038a81166004830152602482018c9052915195975093811695928116949116928392639dc29fac9260448084019382900301818387803b158015612a0f57600080fd5b505af1158015612a23573d6000803e3d6000fd5b505050506004840154600160a01b900460ff16612adb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed1284848a6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612ac257600080fd5b505af1158015612ad6573d6000803e3d6000fd5b505050505b60048401546001600160a01b03168015801590612b025750601154600160a01b900460ff16155b8015612b1a57506004850154600160a01b900460ff16155b15612b8757806001600160a01b031663b87bd4816040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612b5a57600080fd5b505af1158015612b6e573d6000803e3d6000fd5b505050506040513d6020811015612b8457600080fd5b50505b612b9b6001600160a01b038516878a612be6565b6040805189815290518a916001600160a01b038916917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc69181900360200190a3505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612c38908490613376565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612c97908590613376565b50505050565b801580612d23575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612cf557600080fd5b505afa158015612d09573d6000803e3d6000fd5b505050506040513d6020811015612d1f57600080fd5b5051155b612d5e5760405162461bcd60e51b81526004018080602001828103825260368152602001806137d36036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612c38908490613376565b600082820183811015610a92576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600060128281548110612e1957fe5b600091825260209091206005909102016004810154909150600160a01b900460ff1615612e7e576040805162461bcd60e51b815260206004820152600e60248201526d1c1bdbdb081a5cc818db1bdcd95960921b604482015290519081900360640190fd5b600281015460408051631ff4de0360e11b81526001600160a01b0392831660048201819052915191927f00000000000000000000000000000000000000000000000000000000000000001691633fe9bc06916024808201926020929091908290030181600087803b158015612ef257600080fd5b505af1158015612f06573d6000803e3d6000fd5b505050506040513d6020811015612f1c57600080fd5b505060048201546001600160a01b0316801561300857806001600160a01b031663372500ab6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612f6d57600080fd5b505af1158015612f81573d6000803e3d6000fd5b505050506040513d6020811015612f9757600080fd5b50506040805163654580bb60e11b815290516001600160a01b0383169163ca8b01769160048083019260209291908290030181600087803b158015612fdb57600080fd5b505af1158015612fef573d6000803e3d6000fd5b505050506040513d602081101561300557600080fd5b50505b604080516370a0823160e01b8152306004820152905160009173d533a949740bb3306d119cc777fa900ba034cd52916370a0823191602480820192602092909190829003018186803b15801561305d57600080fd5b505afa158015613071573d6000803e3d6000fd5b505050506040513d602081101561308757600080fd5b5051905080156119325760006130b46127106130ae6000548561342790919063ffffffff16565b90613480565b905060006130d36127106130ae6001548661342790919063ffffffff16565b905060006130f26127106130ae6002548761342790919063ffffffff16565b600c549091506001600160a01b03161580159061311a5750600c546001600160a01b03163014155b801561312857506000600354115b1561318757600061314a6127106130ae6003548861342790919063ffffffff16565b905061315685826134e7565b600c549095506131859073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b031683612be6565b505b61319d82613197838188886134e7565b906134e7565b93506131be73d533a949740bb3306d119cc777fa900ba034cd523383612be6565b60038701546001600160a01b03166131eb73d533a949740bb3306d119cc777fa900ba034cd528287612be6565b806001600160a01b031663590a41f5866040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561323157600080fd5b505af1158015613245573d6000803e3d6000fd5b5050600e54613275925073d533a949740bb3306d119cc777fa900ba034cd5291506001600160a01b031686612be6565b600e546040805163590a41f560e01b81526004810187905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b1580156132c257600080fd5b505af11580156132d6573d6000803e3d6000fd5b5050600d54613306925073d533a949740bb3306d119cc777fa900ba034cd5291506001600160a01b031685612be6565b600d546040805163590a41f560e01b81526004810186905290516001600160a01b039092169163590a41f59160248082019260009290919082900301818387803b15801561335357600080fd5b505af1158015613367573d6000803e3d6000fd5b50505050505050505050505050565b60606133cb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166135449092919063ffffffff16565b805190915015612c38578080602001905160208110156133ea57600080fd5b5051612c385760405162461bcd60e51b815260040180806020018281038252602a8152602001806137a9602a913960400191505060405180910390fd5b60008261343657506000611251565b8282028284828161344357fe5b0414610a925760405162461bcd60e51b81526004018080602001828103825260218152602001806137886021913960400191505060405180910390fd5b60008082116134d6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816134df57fe5b049392505050565b60008282111561353e576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6060613553848460008561355b565b949350505050565b60608247101561359c5760405162461bcd60e51b81526004018080602001828103825260268152602001806137626026913960400191505060405180910390fd5b6135a5856136b7565b6135f6576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106136355780518252601f199092019160209182019101613616565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613697576040519150601f19603f3d011682016040523d82523d6000602084013e61369c565b606091505b50915091506136ac8282866136bd565b979650505050505050565b3b151590565b606083156136cc575081610a92565b8251156136dc5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561372657818101518382015260200161370e565b50505050905090810190601f1680156137535780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220c5d514fc01a91563fe8c3fc100910ae4fc8331968b27a2bd69dd0153a7e8620c64736f6c634300060c0033000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad800000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b

Check out more smart contracts

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.