Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- MasterChefVoltV3
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2022-03-09T12:43:28.830149Z
Constructor Arguments
000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e00000000000000000000000034ef2cc892a88415e9f02b91bfa9c91fc0be6bd40000000000000000000000000000000000000000000000000000000000000000
Arg [0] (address) : 0xc71e27c7e128d9caeb2b8ca756647f7f199cf39e
Arg [1] (address) : 0x34ef2cc892a88415e9f02b91bfa9c91fc0be6bd4
Arg [2] (uint256) : 0
Contract source code
// SPDX-License-Identifier: MIXED // File @openzeppelin/contracts/utils/Context.sol@v3.4.2 // License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File @openzeppelin/contracts/access/Ownable.sol@v3.4.2 // License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File @openzeppelin/contracts/math/SafeMath.sol@v3.4.2 // License-Identifier: MIT 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/utils/EnumerableSet.sol@v3.4.2 // License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File @openzeppelin/contracts/utils/ReentrancyGuard.sol@v3.4.2 // License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File contracts/interfaces/IERC20.sol // License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); // EIP 2612 function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; } // File contracts/MasterChefVoltV3.sol // License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface IMasterChef { struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. } struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. VOLT to distribute per block. uint256 lastRewardTimestamp; // Last block number that VOLT distribution occurs. uint256 accVoltPerShare; // Accumulated VOLT per share, times 1e12. See below. } function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory); function totalAllocPoint() external view returns (uint256); function voltPerSec() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount) external; function devPercent() external view returns (uint256); function treasuryPercent() external view returns (uint256); function investorPercent() external view returns (uint256); } interface IRewarder { function onVoltReward(address user, uint256 newLpAmount) external; function pendingTokens(address user) external view returns (uint256 pending); function rewardToken() external view returns (IERC20); } library BoringERC20 { bytes4 private constant SIG_SYMBOL = 0x95d89b41; // symbol() bytes4 private constant SIG_NAME = 0x06fdde03; // name() bytes4 private constant SIG_DECIMALS = 0x313ce567; // decimals() bytes4 private constant SIG_TRANSFER = 0xa9059cbb; // transfer(address,uint256) bytes4 private constant SIG_TRANSFER_FROM = 0x23b872dd; // transferFrom(address,address,uint256) function returnDataToString(bytes memory data) internal pure returns (string memory) { if (data.length >= 64) { return abi.decode(data, (string)); } else if (data.length == 32) { uint8 i = 0; while (i < 32 && data[i] != 0) { i++; } bytes memory bytesArray = new bytes(i); for (i = 0; i < 32 && data[i] != 0; i++) { bytesArray[i] = data[i]; } return string(bytesArray); } else { return "???"; } } /// @notice Provides a safe ERC20.symbol version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token symbol. function safeSymbol(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.name version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token name. function safeName(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.decimals version which returns '18' as fallback value. /// @param token The address of the ERC-20 token contract. /// @return (uint8) Token decimals. function safeDecimals(IERC20 token) internal view returns (uint8) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_DECIMALS)); return success && data.length == 32 ? abi.decode(data, (uint8)) : 18; } /// @notice Provides a safe ERC20.transfer version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransfer( IERC20 token, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed"); } /// @notice Provides a safe ERC20.transferFrom version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param from Transfer tokens from. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(SIG_TRANSFER_FROM, from, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed"); } } /// @notice The (older) MasterChefVoltV2 contract gives out a constant number of VOLT tokens per block. /// It is the only address with minting rights for VOLT. /// The idea for this MasterChefVoltV3 (MCJV3) contract is therefore to be the owner of a dummy token /// that is deposited into the MasterChefVoltV2 (MCJV2) contract. /// The allocation point for this pool on MCJV3 is the total allocation point for all pools that receive double incentives. contract MasterChefVoltV3 is Ownable, ReentrancyGuard { using SafeMath for uint256; using BoringERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; /// @notice Info of each MCJV3 user. /// `amount` LP token amount the user has provided. /// `rewardDebt` The amount of VOLT entitled to the user. struct UserInfo { uint256 amount; uint256 rewardDebt; } /// @notice Info of each MCJV3 pool. /// `allocPoint` The amount of allocation points assigned to the pool. /// Also known as the amount of VOLT to distribute per block. struct PoolInfo { IERC20 lpToken; uint256 accVoltPerShare; uint256 lastRewardTimestamp; uint256 allocPoint; IRewarder rewarder; } /// @notice Address of MCJV2 contract. IMasterChef public immutable MASTER_CHEF_V2; /// @notice Address of VOLT contract. IERC20 public immutable VOLT; /// @notice The index of MCJV3 master pool in MCJV2 uint256 public immutable MASTER_PID; /// @notice Info of each MCJV3 pool. PoolInfo[] public poolInfo; // Set of all LP tokens that have been added as pools EnumerableSet.AddressSet private lpTokens; /// @notice Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) public userInfo; /// @dev Total allocation points. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint; uint256 private constant ACC_TOKEN_PRECISION = 1e18; event Add(uint256 indexed pid, uint256 allocPoint, IERC20 indexed lpToken, IRewarder indexed rewarder); event Set(uint256 indexed pid, uint256 allocPoint, IRewarder indexed rewarder, bool overwrite); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event UpdatePool(uint256 indexed pid, uint256 lastRewardTimestamp, uint256 lpSupply, uint256 accVoltPerShare); event Harvest(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Init(); /// @param _MASTER_CHEF_V2 The VoltSwap MCJV2 contract address. /// @param _volt The VOLT token contract address. /// @param _MASTER_PID The pool ID of the dummy token on the base MCJV2 contract. constructor( IMasterChef _MASTER_CHEF_V2, IERC20 _volt, uint256 _MASTER_PID ) public { MASTER_CHEF_V2 = _MASTER_CHEF_V2; VOLT = _volt; MASTER_PID = _MASTER_PID; } /// @notice Deposits a dummy token to `MASTER_CHEF_V2` MCJV2. This is required because MCJV2 holds the minting rights for VOLT. /// Any balance of transaction sender in `dummyToken` is transferred. /// The allocation point for the pool on MCJV2 is the total allocation point for all pools that receive double incentives. /// @param dummyToken The address of the ERC-20 token to deposit into MCJV2. function init(IERC20 dummyToken) external onlyOwner { uint256 balance = dummyToken.balanceOf(msg.sender); require(balance != 0, "MasterChefV2: Balance must exceed 0"); dummyToken.safeTransferFrom(msg.sender, address(this), balance); dummyToken.approve(address(MASTER_CHEF_V2), balance); MASTER_CHEF_V2.deposit(MASTER_PID, balance); emit Init(); } /// @notice Returns the number of MCJV3 pools. function poolLength() external view returns (uint256 pools) { pools = poolInfo.length; } /// @notice Add a new LP to the pool. Can only be called by the owner. /// DO NOT add the same LP token more than once. Rewards will be messed up if you do. /// @param allocPoint AP of the new pool. /// @param _lpToken Address of the LP ERC-20 token. /// @param _rewarder Address of the rewarder delegate. function add( uint256 allocPoint, IERC20 _lpToken, IRewarder _rewarder ) external onlyOwner { require(!lpTokens.contains(address(_lpToken)), "add: LP already added"); // Sanity check to ensure _lpToken is an ERC20 token _lpToken.balanceOf(address(this)); // Sanity check if we add a rewarder if (address(_rewarder) != address(0)) { _rewarder.onVoltReward(address(0), 0); } uint256 lastRewardTimestamp = block.timestamp; totalAllocPoint = totalAllocPoint.add(allocPoint); poolInfo.push( PoolInfo({ lpToken: _lpToken, allocPoint: allocPoint, lastRewardTimestamp: lastRewardTimestamp, accVoltPerShare: 0, rewarder: _rewarder }) ); lpTokens.add(address(_lpToken)); emit Add(poolInfo.length.sub(1), allocPoint, _lpToken, _rewarder); } /// @notice Update the given pool's VOLT allocation point and `IRewarder` contract. Can only be called by the owner. /// @param _pid The index of the pool. See `poolInfo`. /// @param _allocPoint New AP of the pool. /// @param _rewarder Address of the rewarder delegate. /// @param overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored. function set( uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool overwrite ) external onlyOwner { PoolInfo memory pool = poolInfo[_pid]; totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); pool.allocPoint = _allocPoint; if (overwrite) { _rewarder.onVoltReward(address(0), 0); // sanity check pool.rewarder = _rewarder; } poolInfo[_pid] = pool; emit Set(_pid, _allocPoint, overwrite ? _rewarder : pool.rewarder, overwrite); } /// @notice View function to see pending VOLT on frontend. /// @param _pid The index of the pool. See `poolInfo`. /// @param _user Address of user. /// @return pendingVolt VOLT reward for a given user. // bonusTokenAddress The address of the bonus reward. // bonusTokenSymbol The symbol of the bonus token. // pendingBonusToken The amount of bonus rewards pending. function pendingTokens(uint256 _pid, address _user) external view returns ( uint256 pendingVolt, address bonusTokenAddress, string memory bonusTokenSymbol, uint256 pendingBonusToken ) { PoolInfo memory pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accVoltPerShare = pool.accVoltPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.timestamp > pool.lastRewardTimestamp && lpSupply != 0) { uint256 secondsElapsed = block.timestamp.sub(pool.lastRewardTimestamp); uint256 voltReward = secondsElapsed.mul(voltPerSec()).mul(pool.allocPoint).div(totalAllocPoint); accVoltPerShare = accVoltPerShare.add(voltReward.mul(ACC_TOKEN_PRECISION).div(lpSupply)); } pendingVolt = user.amount.mul(accVoltPerShare).div(ACC_TOKEN_PRECISION).sub(user.rewardDebt); // If it's a double reward farm, we return info about the bonus token if (address(pool.rewarder) != address(0)) { bonusTokenAddress = address(pool.rewarder.rewardToken()); bonusTokenSymbol = IERC20(pool.rewarder.rewardToken()).safeSymbol(); pendingBonusToken = pool.rewarder.pendingTokens(_user); } } /// @notice Update reward variables for all pools. Be careful of gas spending! /// @param pids Pool IDs of all to be updated. Make sure to update all active pools. function massUpdatePools(uint256[] calldata pids) external { uint256 len = pids.length; for (uint256 i = 0; i < len; ++i) { updatePool(pids[i]); } } /// @notice Calculates and returns the `amount` of VOLT per block. function voltPerSec() public view returns (uint256 amount) { uint256 total = 1000; uint256 lpPercent = total.sub(MASTER_CHEF_V2.devPercent()).sub(MASTER_CHEF_V2.treasuryPercent()).sub( MASTER_CHEF_V2.investorPercent() ); uint256 lpShare = MASTER_CHEF_V2.voltPerSec().mul(lpPercent).div(total); amount = lpShare.mul(MASTER_CHEF_V2.poolInfo(MASTER_PID).allocPoint).div(MASTER_CHEF_V2.totalAllocPoint()); } /// @notice Update reward variables of the given pool. /// @param pid The index of the pool. See `poolInfo`. function updatePool(uint256 pid) public { PoolInfo memory pool = poolInfo[pid]; if (block.timestamp > pool.lastRewardTimestamp) { uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply > 0) { uint256 secondsElapsed = block.timestamp.sub(pool.lastRewardTimestamp); uint256 voltReward = secondsElapsed.mul(voltPerSec()).mul(pool.allocPoint).div(totalAllocPoint); pool.accVoltPerShare = pool.accVoltPerShare.add((voltReward.mul(ACC_TOKEN_PRECISION).div(lpSupply))); } pool.lastRewardTimestamp = block.timestamp; poolInfo[pid] = pool; emit UpdatePool(pid, pool.lastRewardTimestamp, lpSupply, pool.accVoltPerShare); } } /// @notice Deposit LP tokens to MCJV3 for VOLT allocation. /// @param pid The index of the pool. See `poolInfo`. /// @param amount LP token amount to deposit. function deposit(uint256 pid, uint256 amount) external nonReentrant { harvestFromMasterChef(); updatePool(pid); PoolInfo memory pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; if (user.amount > 0) { // Harvest VOLT uint256 pending = user.amount.mul(pool.accVoltPerShare).div(ACC_TOKEN_PRECISION).sub(user.rewardDebt); VOLT.safeTransfer(msg.sender, pending); emit Harvest(msg.sender, pid, pending); } uint256 balanceBefore = pool.lpToken.balanceOf(address(this)); pool.lpToken.safeTransferFrom(msg.sender, address(this), amount); uint256 receivedAmount = pool.lpToken.balanceOf(address(this)).sub(balanceBefore); // Effects user.amount = user.amount.add(receivedAmount); user.rewardDebt = user.amount.mul(pool.accVoltPerShare).div(ACC_TOKEN_PRECISION); // Interactions IRewarder _rewarder = pool.rewarder; if (address(_rewarder) != address(0)) { _rewarder.onVoltReward(msg.sender, user.amount); } emit Deposit(msg.sender, pid, receivedAmount); } /// @notice Withdraw LP tokens from MCJV3. /// @param pid The index of the pool. See `poolInfo`. /// @param amount LP token amount to withdraw. function withdraw(uint256 pid, uint256 amount) external nonReentrant { harvestFromMasterChef(); updatePool(pid); PoolInfo memory pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; if (user.amount > 0) { // Harvest VOLT uint256 pending = user.amount.mul(pool.accVoltPerShare).div(ACC_TOKEN_PRECISION).sub(user.rewardDebt); VOLT.safeTransfer(msg.sender, pending); emit Harvest(msg.sender, pid, pending); } // Effects user.amount = user.amount.sub(amount); user.rewardDebt = user.amount.mul(pool.accVoltPerShare).div(ACC_TOKEN_PRECISION); // Interactions IRewarder _rewarder = pool.rewarder; if (address(_rewarder) != address(0)) { _rewarder.onVoltReward(msg.sender, user.amount); } pool.lpToken.safeTransfer(msg.sender, amount); emit Withdraw(msg.sender, pid, amount); } /// @notice Harvests VOLT from `MASTER_CHEF_V2` MCJV2 and pool `MASTER_PID` to this MCJV3 contract. function harvestFromMasterChef() public { MASTER_CHEF_V2.deposit(MASTER_PID, 0); } /// @notice Withdraw without caring about rewards. EMERGENCY ONLY. /// @param pid The index of the pool. See `poolInfo`. function emergencyWithdraw(uint256 pid) external nonReentrant { PoolInfo memory pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; IRewarder _rewarder = pool.rewarder; if (address(_rewarder) != address(0)) { _rewarder.onVoltReward(msg.sender, 0); } // Note: transfer can fail or succeed if `amount` is zero. pool.lpToken.safeTransfer(msg.sender, amount); emit EmergencyWithdraw(msg.sender, pid, amount); } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_MASTER_CHEF_V2","internalType":"contract IMasterChef"},{"type":"address","name":"_volt","internalType":"contract IERC20"},{"type":"uint256","name":"_MASTER_PID","internalType":"uint256"}]},{"type":"event","name":"Add","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"allocPoint","internalType":"uint256","indexed":false},{"type":"address","name":"lpToken","internalType":"contract IERC20","indexed":true},{"type":"address","name":"rewarder","internalType":"contract IRewarder","indexed":true}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EmergencyWithdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Harvest","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Init","inputs":[],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Set","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"allocPoint","internalType":"uint256","indexed":false},{"type":"address","name":"rewarder","internalType":"contract IRewarder","indexed":true},{"type":"bool","name":"overwrite","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"UpdatePool","inputs":[{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"lastRewardTimestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"lpSupply","internalType":"uint256","indexed":false},{"type":"uint256","name":"accVoltPerShare","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMasterChef"}],"name":"MASTER_CHEF_V2","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MASTER_PID","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"VOLT","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"add","inputs":[{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"address","name":"_lpToken","internalType":"contract IERC20"},{"type":"address","name":"_rewarder","internalType":"contract IRewarder"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvestFromMasterChef","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[{"type":"address","name":"dummyToken","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"massUpdatePools","inputs":[{"type":"uint256[]","name":"pids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pendingVolt","internalType":"uint256"},{"type":"address","name":"bonusTokenAddress","internalType":"address"},{"type":"string","name":"bonusTokenSymbol","internalType":"string"},{"type":"uint256","name":"pendingBonusToken","internalType":"uint256"}],"name":"pendingTokens","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"lpToken","internalType":"contract IERC20"},{"type":"uint256","name":"accVoltPerShare","internalType":"uint256"},{"type":"uint256","name":"lastRewardTimestamp","internalType":"uint256"},{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"address","name":"rewarder","internalType":"contract IRewarder"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pools","internalType":"uint256"}],"name":"poolLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"set","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"address","name":"_rewarder","internalType":"contract IRewarder"},{"type":"bool","name":"overwrite","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalAllocPoint","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePool","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"rewardDebt","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"voltPerSec","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"pid","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806357a5b58c116100b857806393f1a40b1161007c57806393f1a40b14610237578063ab7de09814610258578063e2bbb1581461026b578063ed5fe9211461027e578063f2fde38b14610286578063ffcd42631461029957610137565b806357a5b58c146101f957806361621aaa1461020c578063715018a61461021457806388bba42f1461021c5780638da5cb5b1461022f57610137565b80632981cc6f116100ff5780632981cc6f146101b0578063441a3e70146101b85780634f70b15a146101cb57806351eb05a6146101d35780635312ea8e146101e657610137565b8063081e3eda1461013c5780631526fe271461015a57806317caf6f11461017e57806319ab453c1461018657806327bf88ad1461019b575b600080fd5b6101446102bc565b6040516101519190612997565b60405180910390f35b61016d61016836600461257a565b6102c2565b6040516101519594939291906126f1565b61014461030d565b6101996101943660046123d9565b610313565b005b6101a361057c565b60405161015191906126a0565b6101446105a0565b6101996101c636600461261a565b610985565b610199610bf6565b6101996101e136600461257a565b610c99565b6101996101f436600461257a565b610ec6565b6101996102073660046123f5565b611037565b610144611066565b61019961108a565b61019961022a36600461263b565b611113565b6101a3611354565b61024a6102453660046125aa565b611363565b604051610151929190612a01565b6101996102663660046125d9565b611387565b61019961027936600461261a565b61167b565b6101a36119fb565b6101996102943660046123d9565b611a1f565b6102ac6102a73660046125aa565b611adf565b60405161015194939291906129a0565b60025490565b600281815481106102cf57fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b0393841695509193909290911685565b60065481565b61031b611e29565b6001600160a01b031661032c611354565b6001600160a01b03161461035b5760405162461bcd60e51b8152600401610352906128f6565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a082319061038a9033906004016126a0565b60206040518083038186803b1580156103a257600080fd5b505afa1580156103b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103da9190612592565b9050806103f95760405162461bcd60e51b815260040161035290612721565b61040e6001600160a01b038316333084611e2d565b60405163095ea7b360e01b81526001600160a01b0383169063095ea7b39061045c907f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e9085906004016126b4565b602060405180830381600087803b15801561047657600080fd5b505af115801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae9190612464565b50604051631c57762b60e31b81526001600160a01b037f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e169063e2bbb1589061051d907f0000000000000000000000000000000000000000000000000000000000000000908590600401612a01565b600060405180830381600087803b15801561053757600080fd5b505af115801561054b573d6000803e3d6000fd5b50506040517f57a86f7d14ccde89e22870afe839e3011216827daa9b24e18629f0a1e9d6cc14925060009150a15050565b7f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e81565b6000806103e8905060006107737f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e6001600160a01b0316630735b2086040518163ffffffff1660e01b815260040160206040518083038186803b15801561060657600080fd5b505afa15801561061a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063e9190612592565b61076d7f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e6001600160a01b03166304ef9d586040518163ffffffff1660e01b815260040160206040518083038186803b15801561069a57600080fd5b505afa1580156106ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d29190612592565b61076d7f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e6001600160a01b031663fc3c28af6040518163ffffffff1660e01b815260040160206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190612592565b8790611f26565b90611f26565b9050600061081c83610816847f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e6001600160a01b0316632981cc6f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d857600080fd5b505afa1580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108109190612592565b90611f53565b90611f94565b905061097d7f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e6001600160a01b03166317caf6f16040518163ffffffff1660e01b815260040160206040518083038186803b15801561087a57600080fd5b505afa15801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b29190612592565b604051631526fe2760e01b8152610816906001600160a01b037f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e1690631526fe2790610922907f000000000000000000000000000000000000000000000000000000000000000090600401612997565b60806040518083038186803b15801561093a57600080fd5b505afa15801561094e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109729190612528565b602001518490611f53565b935050505090565b600260015414156109a85760405162461bcd60e51b815260040161035290612960565b60026001556109b5610bf6565b6109be82610c99565b6109c6612398565b600283815481106109d357fe5b600091825260208083206040805160a081018252600594850290920180546001600160a01b03908116845260018201548486015260028201548484015260038201546060850152600490910154166080830152878552928252828420338552909152912080549192509015610aed576000610a73826001015461076d670de0b6b3a764000061081687602001518760000154611f5390919063ffffffff16565b9050610aa96001600160a01b037f00000000000000000000000034ef2cc892a88415e9f02b91bfa9c91fc0be6bd4163383611fc6565b84336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495483604051610ae39190612997565b60405180910390a3505b8054610af99084611f26565b8082556020830151610b1991670de0b6b3a7640000916108169190611f53565b600182015560808201516001600160a01b03811615610b93578154604051631e4310bb60e31b81526001600160a01b0383169163f21885d891610b609133916004016126b4565b600060405180830381600087803b158015610b7a57600080fd5b505af1158015610b8e573d6000803e3d6000fd5b505050505b8251610ba9906001600160a01b03163386611fc6565b84336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56886604051610be39190612997565b60405180910390a3505060018055505050565b604051631c57762b60e31b81526001600160a01b037f000000000000000000000000c71e27c7e128d9caeb2b8ca756647f7f199cf39e169063e2bbb15890610c65907f000000000000000000000000000000000000000000000000000000000000000090600090600401612a01565b600060405180830381600087803b158015610c7f57600080fd5b505af1158015610c93573d6000803e3d6000fd5b50505050565b610ca1612398565b60028281548110610cae57fe5b60009182526020918290206040805160a081018252600590930290910180546001600160a01b0390811684526001820154948401949094526002810154918301829052600381015460608401526004015490921660808201529150421115610ec25780516040516370a0823160e01b81526000916001600160a01b0316906370a0823190610d409030906004016126a0565b60206040518083038186803b158015610d5857600080fd5b505afa158015610d6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d909190612592565b90508015610e03576000610db1836040015142611f2690919063ffffffff16565b90506000610dd56006546108168660600151610810610dce6105a0565b8790611f53565b9050610dfb610df08461081684670de0b6b3a7640000611f53565b6020860151906120bc565b602085015250505b4260408301526002805483919085908110610e1a57fe5b6000918252602091829020835160059092020180546001600160a01b039283166001600160a01b0319918216178255848401516001830155604080860151600284015560608601516003840155608090950151600490920180549290931691161790558382015190840151915185927f3be3541fc42237d611b30329040bfa4569541d156560acdbbae57640d20b8f4692610eb89290918691612a0f565b60405180910390a2505b5050565b60026001541415610ee95760405162461bcd60e51b815260040161035290612960565b6002600155610ef6612398565b60028281548110610f0357fe5b600091825260208083206040805160a081018252600594850290920180546001600160a01b0390811684526001808301548587015260028301548585015260038301546060860152600490920154811660808501908152898852958552828720338852909452908520805486825591810195909555925190945090811615610fe757604051631e4310bb60e31b81526001600160a01b0382169063f21885d890610fb49033906000906004016126b4565b600060405180830381600087803b158015610fce57600080fd5b505af1158015610fe2573d6000803e3d6000fd5b505050505b8351610ffd906001600160a01b03163384611fc6565b84336001600160a01b03167fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae059584604051610be39190612997565b8060005b81811015610c935761105e84848381811061105257fe5b90506020020135610c99565b60010161103b565b7f000000000000000000000000000000000000000000000000000000000000000081565b611092611e29565b6001600160a01b03166110a3611354565b6001600160a01b0316146110c95760405162461bcd60e51b8152600401610352906128f6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b61111b611e29565b6001600160a01b031661112c611354565b6001600160a01b0316146111525760405162461bcd60e51b8152600401610352906128f6565b61115a612398565b6002858154811061116757fe5b60009182526020918290206040805160a081018252600590930290910180546001600160a01b039081168452600182015494840194909452600280820154928401929092526003810154606084015260040154909216608082015281549092506112059186916111ff9190899081106111dc57fe5b906000526020600020906005020160030154600654611f2690919063ffffffff16565b906120bc565b60065560608101849052811561128657604051631e4310bb60e31b81526001600160a01b0384169063f21885d8906112449060009081906004016126b4565b600060405180830381600087803b15801561125e57600080fd5b505af1158015611272573d6000803e3d6000fd5b5050506001600160a01b0384166080830152505b806002868154811061129457fe5b600091825260209182902083516005929092020180546001600160a01b03199081166001600160a01b0393841617825592840151600182015560408401516002820155606084015160038201556080909301516004909301805490921692169190911790558161130857806080015161130a565b825b6001600160a01b0316857fa54644aae5c48c5971516f334e4fe8ecbc7930e23f34877d4203c6551e67ffaa86856040516113459291906129f1565b60405180910390a35050505050565b6000546001600160a01b031690565b60056020908152600092835260408084209091529082529020805460019091015482565b61138f611e29565b6001600160a01b03166113a0611354565b6001600160a01b0316146113c65760405162461bcd60e51b8152600401610352906128f6565b6113d16003836120e1565b156113ee5760405162461bcd60e51b8152600401610352906128c7565b6040516370a0823160e01b81526001600160a01b038316906370a082319061141a9030906004016126a0565b60206040518083038186803b15801561143257600080fd5b505afa158015611446573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146a9190612592565b506001600160a01b038116156114dc57604051631e4310bb60e31b81526001600160a01b0382169063f21885d8906114a99060009081906004016126b4565b600060405180830381600087803b1580156114c357600080fd5b505af11580156114d7573d6000803e3d6000fd5b505050505b60065442906114eb90856120bc565b6006556040805160a0810182526001600160a01b038581168252600060208301818152938301858152606084018981528784166080860190815260028054600181018255945294517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace600590940293840180546001600160a01b031990811692871692909217905595517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf84015590517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad0830155517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad182015591517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad29092018054909316911617905561161f6003846120f6565b506002546001600160a01b03808416919085169061163e906001611f26565b7f4b16bd2431ad24dc020ab0e1de7fcb6563dead6a24fb10089d6c23e97a70381f8760405161166d9190612997565b60405180910390a450505050565b6002600154141561169e5760405162461bcd60e51b815260040161035290612960565b60026001556116ab610bf6565b6116b482610c99565b6116bc612398565b600283815481106116c957fe5b600091825260208083206040805160a081018252600594850290920180546001600160a01b039081168452600182015484860152600282015484840152600382015460608501526004909101541660808301528785529282528284203385529091529120805491925090156117e3576000611769826001015461076d670de0b6b3a764000061081687602001518760000154611f5390919063ffffffff16565b905061179f6001600160a01b037f00000000000000000000000034ef2cc892a88415e9f02b91bfa9c91fc0be6bd4163383611fc6565b84336001600160a01b03167f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae0660924954836040516117d99190612997565b60405180910390a3505b81516040516370a0823160e01b81526000916001600160a01b0316906370a08231906118139030906004016126a0565b60206040518083038186803b15801561182b57600080fd5b505afa15801561183f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118639190612592565b835190915061187d906001600160a01b0316333087611e2d565b82516040516370a0823160e01b81526000916119039184916001600160a01b0316906370a08231906118b39030906004016126a0565b60206040518083038186803b1580156118cb57600080fd5b505afa1580156118df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076d9190612592565b835490915061191290826120bc565b808455602085015161193291670de0b6b3a7640000916108169190611f53565b600184015560808401516001600160a01b038116156119ac578354604051631e4310bb60e31b81526001600160a01b0383169163f21885d8916119799133916004016126b4565b600060405180830381600087803b15801561199357600080fd5b505af11580156119a7573d6000803e3d6000fd5b505050505b86336001600160a01b03167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15846040516119e69190612997565b60405180910390a35050600180555050505050565b7f00000000000000000000000034ef2cc892a88415e9f02b91bfa9c91fc0be6bd481565b611a27611e29565b6001600160a01b0316611a38611354565b6001600160a01b031614611a5e5760405162461bcd60e51b8152600401610352906128f6565b6001600160a01b038116611a845760405162461bcd60e51b81526004016103529061279b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008060606000611aee612398565b60028781548110611afb57fe5b600091825260208083206040805160a081018252600594850290920180546001600160a01b039081168452600182015484860190815260028301548585015260038301546060860152600492830154821660808601528e88529585528287208d821688529094528186209451835192516370a0823160e01b815293975094959391909116916370a0823191611b92913091016126a0565b60206040518083038186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be29190612592565b9050836040015142118015611bf657508015155b15611c58576000611c14856040015142611f2690919063ffffffff16565b90506000611c316006546108168860600151610810610dce6105a0565b9050611c53611c4c8461081684670de0b6b3a7640000611f53565b85906120bc565b935050505b611c83836001015461076d670de0b6b3a7640000610816868860000154611f5390919063ffffffff16565b60808501519098506001600160a01b031615611e1c5783608001516001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015611cd657600080fd5b505afa158015611cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0e9190612480565b9650611d9684608001516001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015611d5057600080fd5b505afa158015611d64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d889190612480565b6001600160a01b031661210b565b608085015160405163c031a66f60e01b81529197506001600160a01b03169063c031a66f90611dc9908c906004016126a0565b60206040518083038186803b158015611de157600080fd5b505afa158015611df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e199190612592565b94505b5050505092959194509250565b3390565b60006060856001600160a01b03166323b872dd60e01b868686604051602401611e58939291906126cd565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611e969190612684565b6000604051808303816000865af19150503d8060008114611ed3576040519150601f19603f3d011682016040523d82523d6000602084013e611ed8565b606091505b5091509150818015611f02575080511580611f02575080806020019051810190611f029190612464565b611f1e5760405162461bcd60e51b81526004016103529061292b565b505050505050565b600082821115611f485760405162461bcd60e51b815260040161035290612818565b508082035b92915050565b600082611f6257506000611f4d565b82820282848281611f6f57fe5b0414611f8d5760405162461bcd60e51b815260040161035290612886565b9392505050565b6000808211611fb55760405162461bcd60e51b81526004016103529061284f565b818381611fbe57fe5b049392505050565b60006060846001600160a01b031663a9059cbb60e01b8585604051602401611fef9291906126b4565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161202d9190612684565b6000604051808303816000865af19150503d806000811461206a576040519150601f19603f3d011682016040523d82523d6000602084013e61206f565b606091505b50915091508180156120995750805115806120995750808060200190518101906120999190612464565b6120b55760405162461bcd60e51b815260040161035290612764565b5050505050565b600082820183811015611f8d5760405162461bcd60e51b8152600401610352906127e1565b6000611f8d836001600160a01b0384166121d0565b6000611f8d836001600160a01b0384166121e8565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b179052905160609160009183916001600160a01b038616916121529190612684565b600060405180830381855afa9150503d806000811461218d576040519150601f19603f3d011682016040523d82523d6000602084013e612192565b606091505b5091509150816121bd57604051806040016040528060038152602001623f3f3f60e81b8152506121c6565b6121c681612232565b925050505b919050565b60009081526001919091016020526040902054151590565b60006121f483836121d0565b61222a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611f4d565b506000611f4d565b606060408251106122585781806020019051810190612251919061249c565b90506121cb565b8151602014156123785760005b60208160ff161080156122945750828160ff168151811061228257fe5b01602001516001600160f81b03191615155b156122a157600101612265565b60608160ff1667ffffffffffffffff811180156122bd57600080fd5b506040519080825280601f01601f1916602001820160405280156122e8576020820181803683370190505b509050600091505b60208260ff1610801561231f5750838260ff168151811061230d57fe5b01602001516001600160f81b03191615155b1561236f57838260ff168151811061233357fe5b602001015160f81c60f81b818360ff168151811061234d57fe5b60200101906001600160f81b031916908160001a9053506001909101906122f0565b91506121cb9050565b506040805180820190915260038152623f3f3f60e81b60208201526121cb565b6040518060a0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6000602082840312156123ea578081fd5b8135611f8d81612a78565b60008060208385031215612407578081fd5b823567ffffffffffffffff8082111561241e578283fd5b818501915085601f830112612431578283fd5b81358181111561243f578384fd5b8660208083028501011115612452578384fd5b60209290920196919550909350505050565b600060208284031215612475578081fd5b8151611f8d81612a90565b600060208284031215612491578081fd5b8151611f8d81612a78565b6000602082840312156124ad578081fd5b815167ffffffffffffffff808211156124c4578283fd5b818401915084601f8301126124d7578283fd5b8151818111156124e5578384fd5b6124f8601f8201601f1916602001612a25565b915080825285602082850101111561250e578384fd5b61251f816020840160208601612a4c565b50949350505050565b600060808284031215612539578081fd5b6125436080612a25565b825161254e81612a78565b808252506020830151602082015260408301516040820152606083015160608201528091505092915050565b60006020828403121561258b578081fd5b5035919050565b6000602082840312156125a3578081fd5b5051919050565b600080604083850312156125bc578182fd5b8235915060208301356125ce81612a78565b809150509250929050565b6000806000606084860312156125ed578081fd5b8335925060208401356125ff81612a78565b9150604084013561260f81612a78565b809150509250925092565b6000806040838503121561262c578182fd5b50508035926020909101359150565b60008060008060808587031215612650578081fd5b8435935060208501359250604085013561266981612a78565b9150606085013561267981612a90565b939692955090935050565b60008251612696818460208701612a4c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039586168152602081019490945260408401929092526060830152909116608082015260a00190565b60208082526023908201527f4d61737465724368656656323a2042616c616e6365206d75737420657863656560408201526206420360ec1b606082015260800190565b6020808252601c908201527f426f72696e6745524332303a205472616e73666572206661696c656400000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601590820152741859190e88131408185b1c9958591e481859191959605a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f426f72696e6745524332303a205472616e7366657246726f6d206661696c6564604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b600085825260018060a01b03851660208301526080604083015283518060808401526129d38160a0850160208801612a4c565b606083019390935250601f91909101601f19160160a0019392505050565b9182521515602082015260400190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff81118282101715612a4457600080fd5b604052919050565b60005b83811015612a67578181015183820152602001612a4f565b83811115610c935750506000910152565b6001600160a01b0381168114612a8d57600080fd5b50565b8015158114612a8d57600080fdfea264697066735822122068c92ad80f89ba592f660532502a3831969ad2b554831a1ecfe8e15520044dbb64736f6c634300060c0033