Contract Address Details

0x91aD62286cb69d2C6abdB952564e0EFEA082869c

Creator
0x9ab7a2–138be3 at 0x6423fa–b544c6
Balance
0 MOVR
Tokens
Fetching tokens...
Transactions
22,110 Transactions
Transfers
92,772 Transfers
Gas Used
2,583,488,589
Last Balance Update
1851657
Contract name:
MasterChefAdvanced




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
default




Verified at
2021-09-16 19:11:25.955666Z

Constructor Arguments

00000000000000000000000052f04c806eb82930f40d410259b7af8e18d3bdc90000000000000000000000009ab7a2e735231af9d7555af5af24d664bb138be3000000000000000000000000453a9acf28e09f67f443ecf5295a6f7e071c05c8000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000081e02

Arg [0] (address) : 0x52f04c806eb82930f40d410259b7af8e18d3bdc9
Arg [1] (address) : 0x9ab7a2e735231af9d7555af5af24d664bb138be3
Arg [2] (address) : 0x453a9acf28e09f67f443ecf5295a6f7e071c05c8
Arg [3] (uint256) : 10000000000000000
Arg [4] (uint256) : 531970

              

Contract source code

// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File @openzeppelin/contracts/math/SafeMath.sol@v3.1.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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, 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) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* 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);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.1.0
pragma solidity ^0.6.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@v3.1.0
pragma solidity ^0.6.2;
/**
* @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) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
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@v3.1.0
pragma solidity ^0.6.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 @openzeppelin/contracts/GSN/Context.sol@v3.1.0
pragma solidity ^0.6.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.1.0
pragma solidity ^0.6.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.
*/
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 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/utils/ReentrancyGuard.sol@v3.1.0
pragma solidity ^0.6.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].
*/
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/MasterChefAdvanced.sol
pragma solidity 0.6.12;
interface IKafeToken is IERC20{
function mint(address to, uint256 amt) external;
}
contract MasterChefAdvanced is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. EGGs to distribute per block.
uint256 lastRewardBlock; // Last block number that EGGs distribution occurs.
uint256 accKafePerShare; // Accumulated EGGs per share, times 1e12. See below.
uint16 depositFeeBP; // Deposit fee in basis points
}
// The EGG TOKEN!
IKafeToken public kafe;
// Dev address.
address public devaddr;
uint256 public constant DEV_FEE_DIVIDER = 10;
// EGG tokens created per block.
uint256 public kafePerBlock;
// Bonus muliplier for early kafe makers.
uint256 public constant BONUS_MULTIPLIER = 1;
// Deposit Fee address
address public feeAddress;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
// Total allocation points. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when EGG mining starts.
uint256 public startBlock;
uint256 public depositedKafe;
uint256[] public rewardMultipliers = [100, 75, 56, 42, 40];
uint256 public rewardTimePerMultiplierTier = 24 hours/12; // 12secs per block. - represents number of blocks in each index of multiplier
bool public masterChefCircuitBreak = false;
mapping(address => mapping(uint256 => uint256)) public feeFactor;
// address -> pool -> rate
// if 0, means normal deposit fee.
// if non 0, multiply the fee by this factor.
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event SetFeeAddress(address indexed user, address indexed newAddress);
event SetDevAddress(address indexed user, address indexed newAddress);
event UpdateEmissionRate(address indexed user, uint256 goosePerBlock);
constructor(
IKafeToken _kafe,
address _devaddr,
address _feeAddress,
uint256 _kafePerBlock,
uint256 _startBlock
) public {
kafe = _kafe;
devaddr = _devaddr;
feeAddress = _feeAddress;
kafePerBlock = _kafePerBlock;
startBlock = _startBlock;
}
function poolLength() external view returns (uint256) {
return poolInfo.length;
}
mapping(IERC20 => bool) public poolExistence;
modifier nonDuplicated(IERC20 _lpToken) {
require(poolExistence[_lpToken] == false, "nonDuplicated: duplicated");
_;
}
function setFactor(address _a, uint256 _poolId, uint256 _bps) external onlyOwner(){
require(_bps <= 10000, "max 100% factor");
feeFactor[_a][_poolId] = _bps;
}
function setRewardTimePerMultiplierTier(uint256 _numBlocks, bool update) external onlyOwner(){
if (update){
massUpdatePools();
}
rewardTimePerMultiplierTier = _numBlocks;
}
function setRewardMultipliers(uint256[] memory _multipliers, bool update) external onlyOwner(){
if (update){
massUpdatePools();
}
rewardMultipliers = _multipliers;
}
function toggleCircuitBreaker(bool _b) external onlyOwner(){
masterChefCircuitBreak = _b;
}
// Add a new lp to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IERC20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner nonDuplicated(_lpToken) {
// require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
require(_depositFeeBP <= 2000, "max 20% fee");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolExistence[_lpToken] = true;
poolInfo.push(PoolInfo({
lpToken : _lpToken,
allocPoint : _allocPoint,
lastRewardBlock : lastRewardBlock,
accKafePerShare : 0,
depositFeeBP : _depositFeeBP
}));
// 100 = 1%
}
// Update the given pool's EGG allocation point and deposit fee. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 5000, "max 50% fee");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
poolInfo[_pid].depositFeeBP = _depositFeeBP;
}
// refer to new getMultiplier function at the bottom
// function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) {
// return _to.sub(_from).mul(BONUS_MULTIPLIER);
// }
// View function to see pending EGGs on frontend.
function pendingKafe(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accKafePerShare = pool.accKafePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (_pid == 0){
lpSupply = depositedKafe;
}
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 kafeReward = multiplier.mul(kafePerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accKafePerShare = accKafePerShare.add(kafeReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accKafePerShare).div(1e12).sub(user.rewardDebt);
}
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (_pid == 0){
lpSupply = depositedKafe;
}
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 kafeReward = multiplier.mul(kafePerBlock).mul(pool.allocPoint).div(totalAllocPoint);
kafe.mint(devaddr, kafeReward.div(DEV_FEE_DIVIDER));
kafe.mint(address(this), kafeReward);
pool.accKafePerShare = pool.accKafePerShare.add(kafeReward.mul(1e12).div(lpSupply));
pool.lastRewardBlock = block.number;
}
// // Deposit LP tokens to MasterChef for EGG allocation.
// function deposit(uint256 _pid, uint256 _amount) public nonReentrant {
// PoolInfo storage pool = poolInfo[_pid];
// UserInfo storage user = userInfo[_pid][msg.sender];
// updatePool(_pid);
// if (user.amount > 0) {
// uint256 pending = user.amount.mul(pool.accKafePerShare).div(1e12).sub(user.rewardDebt);
// if (pending > 0) {
// safeKafeTransfer(msg.sender, pending);
// }
// }
// if (_amount > 0) {
// pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
// if (pool.depositFeeBP > 0) {
// uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000); // 100 = 1%
// pool.lpToken.safeTransfer(feeAddress, depositFee);
// user.amount = user.amount.add(_amount).sub(depositFee);
// } else {
// user.amount = user.amount.add(_amount);
// }
// }
// user.rewardDebt = user.amount.mul(pool.accKafePerShare).div(1e12);
// emit Deposit(msg.sender, _pid, _amount);
// }
function deposit(uint256 _pid, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accKafePerShare).div(1e12).sub(user.rewardDebt);
if (pending > 0) {
safeKafeTransfer(msg.sender, pending);
}
}
// prevent double hop for deposit fee
uint256 intendedDepAmt = _amount;
uint256 actualDepAmt = _amount;
if (intendedDepAmt > 0) {
if (pool.depositFeeBP > 0) {
uint256 feeAmount = intendedDepAmt.mul(pool.depositFeeBP).div(10000); // 100 = 1%
if (feeFactor[msg.sender][_pid]>0){
feeAmount = feeAmount.mul(feeFactor[msg.sender][_pid]).div(10000);
}
pool.lpToken.safeTransferFrom(address(msg.sender), feeAddress, feeAmount);
intendedDepAmt = intendedDepAmt.sub(feeAmount);
}
uint256 balBefore = pool.lpToken.balanceOf(address(this));
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), intendedDepAmt);
actualDepAmt = pool.lpToken.balanceOf(address(this)).sub(balBefore);
user.amount = user.amount.add(actualDepAmt);
if (_pid == 0){
depositedKafe = depositedKafe.add(actualDepAmt);
}
}
user.rewardDebt = user.amount.mul(pool.accKafePerShare).div(1e12);
emit Deposit(msg.sender, _pid, actualDepAmt);
}
// Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accKafePerShare).div(1e12).sub(user.rewardDebt);
if (pending > 0) {
safeKafeTransfer(msg.sender, pending);
}
if (_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
if (_pid == 0){
depositedKafe = depositedKafe.sub(_amount);
}
}
user.rewardDebt = user.amount.mul(pool.accKafePerShare).div(1e12);
emit Withdraw(msg.sender, _pid, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
pool.lpToken.safeTransfer(address(msg.sender), amount);
emit EmergencyWithdraw(msg.sender, _pid, amount);
}
// Safe kafe transfer function, just in case if rounding error causes pool to not have enough EGGs.
function safeKafeTransfer(address _to, uint256 _amount) internal {
uint256 kafeBal = kafe.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > kafeBal) {
transferSuccess = kafe.transfer(_to, kafeBal);
} else {
transferSuccess = kafe.transfer(_to, _amount);
}
require(transferSuccess, "safeKafeTransfer: transfer failed");
}
// Update dev address by the previous dev.
function dev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
emit SetDevAddress(msg.sender, _devaddr);
}
function setFeeAddress(address _feeAddress) public {
require(msg.sender == feeAddress, "setFeeAddress: FORBIDDEN");
feeAddress = _feeAddress;
emit SetFeeAddress(msg.sender, _feeAddress);
}
//Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _kafePerBlock) public onlyOwner {
massUpdatePools();
kafePerBlock = _kafePerBlock;
emit UpdateEmissionRate(msg.sender, _kafePerBlock);
}
// helpers
function _getTierOfBlock(uint256 blockNum) internal view returns (uint256){
return (blockNum <= startBlock) ? 0 : blockNum.sub(startBlock).div(rewardTimePerMultiplierTier);
}
// for reward boosts
function _getMultiplierByBlockNum(uint256 blockNum) internal view returns (uint256) {
return _getMultiplierByTier(_getTierOfBlock(blockNum));
}
function _getMultiplierByTier(uint256 tier) internal view returns (uint256) {
return (tier < rewardMultipliers.length) ? rewardMultipliers[tier] : rewardMultipliers[rewardMultipliers.length - 1];
}
function _getCurrentBlockEmission() internal view returns (uint256) {
return _getMultiplierByBlockNum(block.number);
}
function _getMultiplierByFullTiers(uint256 startTier, uint256 endTier) internal view returns (uint256){
if (startTier >= endTier){
return 0;
}
// tiers that happen after the last defined tier in the rewardMultipliers array
uint256 staticTiers = (endTier >= rewardMultipliers.length) ? (endTier.sub(rewardMultipliers.length)) : 0;
uint256 staticMultipliers = staticTiers.mul(rewardMultipliers[rewardMultipliers.length - 1]);
uint256 sum = 0;
uint256 max = (endTier >= rewardMultipliers.length) ? rewardMultipliers.length : endTier;
for (uint256 i = startTier; i < max; i++){
sum = sum.add(rewardMultipliers[i]);
}
return (sum.add(staticMultipliers)).mul(rewardTimePerMultiplierTier);
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to)
public
view
returns (uint256)
{
// circuitbreak!
if (masterChefCircuitBreak){
return _to.sub(_from);
}
if (_from >= _to){
return 0;
}
if (_to <= startBlock){
return 0;
}
if (_from < startBlock){
_from = startBlock;
}
uint256 startTier = _getTierOfBlock(_from);
uint256 endTier = _getTierOfBlock(_to);
if (startTier >= rewardMultipliers.length){
return _to.sub(_from).mul(rewardMultipliers[rewardMultipliers.length-1]);
}
else if (startTier == endTier) {
return _to.sub(_from).mul(_getMultiplierByTier(startTier));
}
// overcalculate first
uint256 sum = _getMultiplierByFullTiers(startTier,endTier.add(1));
// remove front
// _from - startOfFirstTier
uint256 startOfFirstTier = startBlock.add(startTier.mul(rewardTimePerMultiplierTier));
sum = sum.sub((_from.sub(startOfFirstTier)).mul(_getMultiplierByTier(startTier)));
// remove end
// endOfLastTier - _to
uint256 endOfLastTier = startBlock.add((endTier.add(1)).mul(rewardTimePerMultiplierTier));
sum = sum.sub((endOfLastTier.sub(_to)).mul(_getMultiplierByTier(endTier)));
return sum;
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_kafe","internalType":"contract IKafeToken"},{"type":"address","name":"_devaddr","internalType":"address"},{"type":"address","name":"_feeAddress","internalType":"address"},{"type":"uint256","name":"_kafePerBlock","internalType":"uint256"},{"type":"uint256","name":"_startBlock","internalType":"uint256"}]},{"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":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetDevAddress","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"newAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetFeeAddress","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"newAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"UpdateEmissionRate","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"goosePerBlock","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":"uint256","name":"","internalType":"uint256"}],"name":"BONUS_MULTIPLIER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DEV_FEE_DIVIDER","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"add","inputs":[{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"address","name":"_lpToken","internalType":"contract IERC20"},{"type":"uint16","name":"_depositFeeBP","internalType":"uint16"},{"type":"bool","name":"_withUpdate","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositedKafe","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"dev","inputs":[{"type":"address","name":"_devaddr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"devaddr","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeFactor","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMultiplier","inputs":[{"type":"uint256","name":"_from","internalType":"uint256"},{"type":"uint256","name":"_to","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IKafeToken"}],"name":"kafe","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"kafePerBlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"massUpdatePools","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"masterChefCircuitBreak","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingKafe","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"poolExistence","inputs":[{"type":"address","name":"","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"lpToken","internalType":"contract IERC20"},{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"uint256","name":"lastRewardBlock","internalType":"uint256"},{"type":"uint256","name":"accKafePerShare","internalType":"uint256"},{"type":"uint16","name":"depositFeeBP","internalType":"uint16"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"poolLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardMultipliers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardTimePerMultiplierTier","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"set","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"uint16","name":"_depositFeeBP","internalType":"uint16"},{"type":"bool","name":"_withUpdate","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFactor","inputs":[{"type":"address","name":"_a","internalType":"address"},{"type":"uint256","name":"_poolId","internalType":"uint256"},{"type":"uint256","name":"_bps","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeAddress","inputs":[{"type":"address","name":"_feeAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardMultipliers","inputs":[{"type":"uint256[]","name":"_multipliers","internalType":"uint256[]"},{"type":"bool","name":"update","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardTimePerMultiplierTier","inputs":[{"type":"uint256","name":"_numBlocks","internalType":"uint256"},{"type":"bool","name":"update","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startBlock","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleCircuitBreaker","inputs":[{"type":"bool","name":"_b","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":"updateEmissionRate","inputs":[{"type":"uint256","name":"_kafePerBlock","internalType":"uint256"}]},{"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":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061021c5760003560e01c806384e82a33116101255780639824522e116100ad578063d96384221161007c578063d963842214610645578063e1fed7621461067a578063e2bbb15814610682578063f2fde38b146106a5578063f5332e3c146106cb5761021c565b80639824522e146105ac578063aa8965b5146105d1578063cbd258b514610603578063d49e77cd1461063d5761021c565b80638d88a90e116100f45780638d88a90e146104f95780638da5cb5b1461051f5780638dbb1e3a1461052757806393f1a40b1461054a578063981962a71461058f5761021c565b806384e82a33146103e85780638705fcd4146104265780638aa285501461044c5780638b21947c146104545761021c565b806346f729f2116101a85780635cd6b289116101775780635cd6b28914610385578063630b5ba1146103b15780636b581e04146103b9578063715018a6146103d85780638144f7bd146103e05761021c565b806346f729f21461033b57806348cd4cb11461034357806351eb05a61461034b5780635312ea8e146103685761021c565b806317caf6f1116101ef57806317caf6f1146102b85780633072ef35146102c057806341275358146102c8578063429f6590146102ec578063441a3e70146103185761021c565b8063081e3eda146102215780630ba84cd21461023b5780631526fe271461025a578063177c865a146102b0575b600080fd5b6102296106d3565b60408051918252519081900360200190f35b6102586004803603602081101561025157600080fd5b50356106d9565b005b6102776004803603602081101561027057600080fd5b5035610777565b604080516001600160a01b039096168652602086019490945284840192909252606084015261ffff166080830152519081900360a00190f35b6102296107c3565b6102296107c9565b6102296107cf565b6102d06107d5565b604080516001600160a01b039092168252519081900360200190f35b6102296004803603604081101561030257600080fd5b506001600160a01b0381351690602001356107e4565b6102586004803603604081101561032e57600080fd5b5080359060200135610801565b6102296109da565b6102296109e0565b6102586004803603602081101561036157600080fd5b50356109e6565b6102586004803603602081101561037e57600080fd5b5035610c26565b6102296004803603604081101561039b57600080fd5b50803590602001356001600160a01b0316610d26565b610258610e8f565b610258600480360360208110156103cf57600080fd5b50351515610eb2565b610258610f1d565b610229610fbf565b610258600480360360808110156103fe57600080fd5b508035906001600160a01b036020820135169061ffff60408201351690606001351515610fc4565b6102586004803603602081101561043c57600080fd5b50356001600160a01b0316611254565b6102296112ff565b6102586004803603604081101561046a57600080fd5b81019060208101813564010000000081111561048557600080fd5b82018360208201111561049757600080fd5b803590602001918460208302840111640100000000831117156104b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050503515159050611304565b6102586004803603602081101561050f57600080fd5b50356001600160a01b0316611382565b6102d0611419565b6102296004803603604081101561053d57600080fd5b5080359060200135611428565b6105766004803603604081101561056057600080fd5b50803590602001356001600160a01b031661159b565b6040805192835260208301919091528051918290030190f35b610229600480360360208110156105a557600080fd5b50356115bf565b610258600480360360408110156105c257600080fd5b508035906020013515156115dd565b610258600480360360608110156105e757600080fd5b506001600160a01b038135169060208101359060400135611649565b6106296004803603602081101561061957600080fd5b50356001600160a01b0316611710565b604080519115158252519081900360200190f35b6102d0611725565b6102586004803603608081101561065b57600080fd5b5080359060208101359061ffff60408201351690606001351515611734565b6102d0611888565b6102586004803603604081101561069857600080fd5b5080359060200135611897565b610258600480360360208110156106bb57600080fd5b50356001600160a01b0316611bd3565b610629611ccb565b60065490565b6106e1611cd4565b6000546001600160a01b03908116911614610731576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b610739610e8f565b600481905560408051828152905133917fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c4053919081900360200190a250565b6006818154811061078457fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b0390931694509092909161ffff1685565b600c5481565b60085481565b60045481565b6005546001600160a01b031681565b600e60209081526000928352604080842090915290825290205481565b60026001541415610859576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006006838154811061087057fe5b6000918252602080832086845260078252604080852033865290925292208054600590920290920192508311156108e3576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b6108ec846109e6565b6000610926826001015461092064e8d4a5100061091a87600301548760000154611cd890919063ffffffff16565b90611d38565b90611d7a565b90508015610938576109383382611dbc565b831561097857815461094a9085611d7a565b82558254610962906001600160a01b03163386611f8f565b8461097857600a546109749085611d7a565b600a555b600383015482546109939164e8d4a510009161091a91611cd8565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a3505060018055505050565b600a5481565b60095481565b6000600682815481106109f557fe5b9060005260206000209060050201905080600201544311610a165750610c23565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a6057600080fd5b505afa158015610a74573d6000803e3d6000fd5b505050506040513d6020811015610a8a57600080fd5b5051905082610a985750600a545b801580610aa757506001820154155b15610ab9575043600290910155610c23565b6000610ac9836002015443611428565b90506000610af660085461091a8660010154610af060045487611cd890919063ffffffff16565b90611cd8565b6002546003549192506001600160a01b03908116916340c10f199116610b1d84600a611d38565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610b6357600080fd5b505af1158015610b77573d6000803e3d6000fd5b5050600254604080516340c10f1960e01b81523060048201526024810186905290516001600160a01b0390921693506340c10f19925060448082019260009290919082900301818387803b158015610bce57600080fd5b505af1158015610be2573d6000803e3d6000fd5b50505050610c10610c058461091a64e8d4a5100085611cd890919063ffffffff16565b600386015490611fe1565b6003850155505043600290920191909155505b50565b60026001541415610c7e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600181905550600060068281548110610c9557fe5b600091825260208083208584526007825260408085203380875293528420805485825560018201959095556005909302018054909450919291610ce5916001600160a01b03919091169083611f8f565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a35050600180555050565b60008060068481548110610d3657fe5b600091825260208083208784526007825260408085206001600160a01b0389811687529084528186206005959095029092016003810154815483516370a0823160e01b815230600482015293519298509596909590949316926370a082319260248082019391829003018186803b158015610db057600080fd5b505afa158015610dc4573d6000803e3d6000fd5b505050506040513d6020811015610dda57600080fd5b5051905086610de85750600a545b836002015443118015610dfa57508015155b15610e5a576000610e0f856002015443611428565b90506000610e3660085461091a8860010154610af060045487611cd890919063ffffffff16565b9050610e55610e4e8461091a8464e8d4a51000611cd8565b8590611fe1565b935050505b610e82836001015461092064e8d4a5100061091a868860000154611cd890919063ffffffff16565b9450505050505b92915050565b60065460005b81811015610eae57610ea6816109e6565b600101610e95565b5050565b610eba611cd4565b6000546001600160a01b03908116911614610f0a576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b600d805460ff1916911515919091179055565b610f25611cd4565b6000546001600160a01b03908116911614610f75576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600a81565b610fcc611cd4565b6000546001600160a01b0390811691161461101c576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b6001600160a01b0383166000908152600f6020526040902054839060ff161561108c576040805162461bcd60e51b815260206004820152601960248201527f6e6f6e4475706c6963617465643a206475706c69636174656400000000000000604482015290519081900360640190fd5b6107d08361ffff1611156110d5576040805162461bcd60e51b815260206004820152600b60248201526a6d6178203230252066656560a81b604482015290519081900360640190fd5b81156110e3576110e3610e8f565b600060095443116110f6576009546110f8565b435b6008549091506111089087611fe1565b6008556001600160a01b039485166000818152600f602090815260408083208054600160ff199091168117909155815160a081018352948552918401998a5283019384526060830182815261ffff9788166080850190815260068054938401815590935292517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600590920291820180546001600160a01b031916919099161790975596517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4087015590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d41860155517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d42850155505091517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d43909101805461ffff191691909216179055565b6005546001600160a01b031633146112b3576040805162461bcd60e51b815260206004820152601860248201527f736574466565416464726573733a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03831690811790915560405133907fd44190acf9d04bdb5d3a1aafff7e6dee8b40b93dfb8c5d3f0eea4b9f4539c3f790600090a350565b600181565b61130c611cd4565b6000546001600160a01b0390811691161461135c576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b801561136a5761136a610e8f565b815161137d90600b906020850190612557565b505050565b6003546001600160a01b031633146113cd576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b03831690811790915560405133907f618c54559e94f1499a808aad71ee8729f8e74e8c48e979616328ce493a1a52e790600090a350565b6000546001600160a01b031690565b600d5460009060ff1615611447576114408284611d7a565b9050610e89565b81831061145657506000610e89565b600954821161146757506000610e89565b6009548310156114775760095492505b60006114828461203b565b9050600061148f8461203b565b600b5490915082106114d157600b80546114c8919060001981019081106114b257fe5b600091825260209091200154610af08688611d7a565b92505050610e89565b808214156114ef576114c86114e58361206f565b610af08688611d7a565b600061150583611500846001611fe1565b6120bc565b9050600061152a611521600c5486611cd890919063ffffffff16565b60095490611fe1565b905061154c61154561153b8661206f565b610af08a85611d7a565b8390611d7a565b9150600061156d611521600c54610af0600188611fe190919063ffffffff16565b905061158f61158861157e8661206f565b610af0848b611d7a565b8490611d7a565b98975050505050505050565b60076020908152600092835260408084209091529082529020805460019091015482565b600b81815481106115cc57fe5b600091825260209091200154905081565b6115e5611cd4565b6000546001600160a01b03908116911614611635576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b801561164357611643610e8f565b50600c55565b611651611cd4565b6000546001600160a01b039081169116146116a1576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b6127108111156116ea576040805162461bcd60e51b815260206004820152600f60248201526e36b0bc1018981812903330b1ba37b960891b604482015290519081900360640190fd5b6001600160a01b039092166000908152600e602090815260408083209383529290522055565b600f6020526000908152604090205460ff1681565b6003546001600160a01b031681565b61173c611cd4565b6000546001600160a01b0390811691161461178c576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b6113888261ffff1611156117d5576040805162461bcd60e51b815260206004820152600b60248201526a6d6178203530252066656560a81b604482015290519081900360640190fd5b80156117e3576117e3610e8f565b6118208361181a600687815481106117f757fe5b906000526020600020906005020160010154600854611d7a90919063ffffffff16565b90611fe1565b600881905550826006858154811061183457fe5b906000526020600020906005020160010181905550816006858154811061185757fe5b906000526020600020906005020160040160006101000a81548161ffff021916908361ffff16021790555050505050565b6002546001600160a01b031681565b600260015414156118ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260018190555060006006838154811061190657fe5b60009182526020808320868452600782526040808520338652909252922060059091029091019150611937846109e6565b80541561198057600061196c826001015461092064e8d4a5100061091a87600301548760000154611cd890919063ffffffff16565b9050801561197e5761197e3382611dbc565b505b82808015611b7057600484015461ffff1615611a355760048401546000906119b5906127109061091a90869061ffff16611cd8565b336000908152600e602090815260408083208b845290915290205490915015611a0957336000908152600e602090815260408083208a8452909152902054611a06906127109061091a908490611cd8565b90505b6005548554611a27916001600160a01b039182169133911684612193565b611a318382611d7a565b9250505b8354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611a7f57600080fd5b505afa158015611a93573d6000803e3d6000fd5b505050506040513d6020811015611aa957600080fd5b50518554909150611ac5906001600160a01b0316333086612193565b8454604080516370a0823160e01b81523060048201529051611b479284926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015611b1557600080fd5b505afa158015611b29573d6000803e3d6000fd5b505050506040513d6020811015611b3f57600080fd5b505190611d7a565b8454909250611b569083611fe1565b845586611b6e57600a54611b6a9083611fe1565b600a555b505b60038401548354611b8b9164e8d4a510009161091a91611cd8565b6001840155604080518281529051879133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350506001805550505050565b611bdb611cd4565b6000546001600160a01b03908116911614611c2b576040805162461bcd60e51b81526020600482018190526024820152600080516020612620833981519152604482015290519081900360640190fd5b6001600160a01b038116611c705760405162461bcd60e51b81526004018080602001828103825260268152602001806125b86026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600d5460ff1681565b3390565b600082611ce757506000610e89565b82820282848281611cf457fe5b0414611d315760405162461bcd60e51b81526004018080602001828103825260218152602001806125de6021913960400191505060405180910390fd5b9392505050565b6000611d3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121ed565b6000611d3183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061228f565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611e0757600080fd5b505afa158015611e1b573d6000803e3d6000fd5b505050506040513d6020811015611e3157600080fd5b50519050600081831115611ec8576002546040805163a9059cbb60e01b81526001600160a01b038781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611e9557600080fd5b505af1158015611ea9573d6000803e3d6000fd5b505050506040513d6020811015611ebf57600080fd5b50519050611f4d565b6002546040805163a9059cbb60e01b81526001600160a01b038781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611f1e57600080fd5b505af1158015611f32573d6000803e3d6000fd5b505050506040513d6020811015611f4857600080fd5b505190505b80611f895760405162461bcd60e51b81526004018080602001828103825260218152602001806125ff6021913960400191505060405180910390fd5b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261137d9084906122e9565b600082820183811015611d31576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600060095482111561206757612062600c5461091a60095485611d7a90919063ffffffff16565b610e89565b600092915050565b600b54600090821061209d57600b8054600019810190811061208d57fe5b9060005260206000200154610e89565b600b82815481106120aa57fe5b90600052602060002001549050919050565b60008183106120cd57506000610e89565b600b546000908310156120e15760006120ef565b600b546120ef908490611d7a565b90506000612125600b6001600b80549050038154811061210b57fe5b906000526020600020015483611cd890919063ffffffff16565b9050600080600b8054905086101561213d5785612141565b600b545b9050865b8181101561218157612177600b828154811061215d57fe5b906000526020600020015484611fe190919063ffffffff16565b9250600101612145565b50600c54610e8290610af08486611fe1565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611f899085906122e9565b600081836122795760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561223e578181015183820152602001612226565b50505050905090810190601f16801561226b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161228557fe5b0495945050505050565b600081848411156122e15760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561223e578181015183820152602001612226565b505050900390565b606061233e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661239a9092919063ffffffff16565b80519091501561137d5780806020019051602081101561235d57600080fd5b505161137d5760405162461bcd60e51b815260040180806020018281038252602a815260200180612640602a913960400191505060405180910390fd5b60606123a984846000856123b1565b949350505050565b60606123bc8561251e565b61240d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061244c5780518252601f19909201916020918201910161242d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146124ae576040519150601f19603f3d011682016040523d82523d6000602084013e6124b3565b606091505b509150915081156124c75791506123a99050565b8051156124d75780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561223e578181015183820152602001612226565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906123a9575050151592915050565b828054828255906000526020600020908101928215612592579160200282015b82811115612592578251825591602001919060010190612577565b5061259e9291506125a2565b5090565b5b8082111561259e57600081556001016125a356fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77736166654b6166655472616e736665723a207472616e73666572206661696c65644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220c98a5b724e3e404d52d226d244ae7ae5a8fafc53b9e2ef0a8aeb6f140644a0f864736f6c634300060c0033