Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- WagyuVault
- Optimization enabled
- true
- Compiler version
- v0.8.0+commit.c7dfd78e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-10-16T14:29:03.492871Z
Constructor Arguments
000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf078351000000000000000000000000f84fb4a80dd211408699afa9c7a9d236feff1dd8000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8520000000000000000000000004cd2c9f7db37515c0173dc61b7c068290b8338280000000000000000000000004cd2c9f7db37515c0173dc61b7c068290b833828
Arg [0] (address) : 0xabf26902fd7b624e0db40d31171ea9dddf078351
Arg [1] (address) : 0xf84fb4a80dd211408699afa9c7a9d236feff1dd8
Arg [2] (address) : 0xa7e8280b8ce4f87dfefc3d1f2254b5ccd971e852
Arg [3] (address) : 0x4cd2c9f7db37515c0173dc61b7c068290b833828
Arg [4] (address) : 0x4cd2c9f7db37515c0173dc61b7c068290b833828
Contract source code
// File: contracts/token/BEP20/IBEP20.sol pragma solidity >=0.4.0; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the bep token owner. */ function getOwner() external view returns (address); /** * @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: contracts/math/SafeMath.sol pragma solidity >=0.4.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; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // 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: contracts/token/BEP20/SafeBEP20.sol pragma solidity ^0.8.0; /** * @title SafeBEP20 * @dev Wrappers around BEP20 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 SafeBEP20 for IBEP20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeBEP20 { using SafeMath for uint256; using Address for address; function safeTransfer( IBEP20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IBEP20 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 * {IBEP20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IBEP20 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), 'SafeBEP20: approve from non-zero to non-zero allowance' ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IBEP20 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( IBEP20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value, 'SafeBEP20: 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(IBEP20 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, 'SafeBEP20: low-level call failed'); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), 'SafeBEP20: BEP20 operation did not succeed'); } } } // File: contracts/GSN/Context.sol pragma solidity >=0.4.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 { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor() {} function _msgSender() internal view returns (address payable) { return payable(msg.sender); } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: contracts/access/Ownable.sol pragma solidity >=0.4.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() { 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 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 onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), 'Ownable: new owner is the zero address'); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: contracts/interfaces/IMasterChef.sol pragma solidity ^0.8.0; interface IMasterChef { function deposit(uint256 _pid, uint256 _amount) external; function withdraw(uint256 _pid, uint256 _amount) external; function enterStaking(uint256 _amount) external; function leaveStaking(uint256 _amount) external; function pendingCake(uint256 _pid, address _user) external view returns (uint256); function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256); function emergencyWithdraw(uint256 _pid) external; } // File: contracts/utils/Pausable.sol pragma solidity ^0.8.0; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // File: contracts/WagyuVault.sol pragma solidity ^0.8.0; // File: contracts/CakeVault.sol contract WagyuVault is Ownable, Pausable { using SafeBEP20 for IBEP20; using SafeMath for uint256; struct UserInfo { uint256 shares; // number of shares for a user uint256 lastDepositedTime; // keeps track of deposited time for potential penalty uint256 cakeAtLastUserAction; // keeps track of cake deposited at the last user action uint256 lastUserActionTime; // keeps track of the last user action time } IBEP20 public immutable token; // Cake token IBEP20 public immutable receiptToken; // Syrup token IMasterChef public immutable masterchef; mapping(address => UserInfo) public userInfo; uint256 public totalShares; uint256 public lastHarvestedTime; address public admin; address public treasury; uint256 public constant MAX_PERFORMANCE_FEE = 500; // 5% uint256 public constant MAX_CALL_FEE = 100; // 1% uint256 public constant MAX_WITHDRAW_FEE = 100; // 1% uint256 public constant MAX_WITHDRAW_FEE_PERIOD = 72 hours; // 3 days uint256 public performanceFee = 200; // 2% uint256 public callFee = 25; // 0.25% uint256 public withdrawFee = 10; // 0.1% uint256 public withdrawFeePeriod = 72 hours; // 3 days event Deposit(address indexed sender, uint256 amount, uint256 shares, uint256 lastDepositedTime); event Withdraw(address indexed sender, uint256 amount, uint256 shares); event Harvest(address indexed sender, uint256 performanceFee, uint256 callFee); event Pause(); event Unpause(); /** * @notice Constructor * @param _token: Cake token contract * @param _receiptToken: Syrup token contract * @param _masterchef: MasterChef contract * @param _admin: address of the admin * @param _treasury: address of the treasury (collects fees) */ constructor( IBEP20 _token, IBEP20 _receiptToken, IMasterChef _masterchef, address _admin, address _treasury ) public { token = _token; receiptToken = _receiptToken; masterchef = _masterchef; admin = _admin; treasury = _treasury; // Infinite approve IBEP20(_token).safeApprove(address(_masterchef), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); } /** * @notice Checks if the msg.sender is the admin address */ modifier onlyAdmin() { require(msg.sender == admin, "admin: wut?"); _; } /** * @notice Checks if the msg.sender is a contract or a proxy */ modifier notContract() { require(!_isContract(msg.sender), "contract not allowed"); require(msg.sender == tx.origin, "proxy contract not allowed"); _; } /** * @notice Deposits funds into the Cake Vault * @dev Only possible when contract not paused. * @param _amount: number of tokens to deposit (in CAKE) */ function deposit(uint256 _amount) external whenNotPaused notContract { require(_amount > 0, "Nothing to deposit"); uint256 pool = balanceOf(); token.safeTransferFrom(msg.sender, address(this), _amount); uint256 currentShares = 0; if (totalShares != 0) { currentShares = (_amount.mul(totalShares)).div(pool); } else { currentShares = _amount; } UserInfo storage user = userInfo[msg.sender]; user.shares = user.shares.add(currentShares); user.lastDepositedTime = block.timestamp; totalShares = totalShares.add(currentShares); user.cakeAtLastUserAction = user.shares.mul(balanceOf()).div(totalShares); user.lastUserActionTime = block.timestamp; _earn(); emit Deposit(msg.sender, _amount, currentShares, block.timestamp); } /** * @notice Withdraws all funds for a user */ function withdrawAll() external notContract { withdraw(userInfo[msg.sender].shares); } /** * @notice Reinvests CAKE tokens into MasterChef * @dev Only possible when contract not paused. */ function harvest() external notContract whenNotPaused { IMasterChef(masterchef).leaveStaking(0); uint256 bal = available(); uint256 currentPerformanceFee = bal.mul(performanceFee).div(10000); token.safeTransfer(treasury, currentPerformanceFee); uint256 currentCallFee = bal.mul(callFee).div(10000); token.safeTransfer(msg.sender, currentCallFee); _earn(); lastHarvestedTime = block.timestamp; emit Harvest(msg.sender, currentPerformanceFee, currentCallFee); } /** * @notice Sets admin address * @dev Only callable by the contract owner. */ function setAdmin(address _admin) external onlyOwner { require(_admin != address(0), "Cannot be zero address"); admin = _admin; } /** * @notice Sets treasury address * @dev Only callable by the contract owner. */ function setTreasury(address _treasury) external onlyOwner { require(_treasury != address(0), "Cannot be zero address"); treasury = _treasury; } /** * @notice Sets performance fee * @dev Only callable by the contract admin. */ function setPerformanceFee(uint256 _performanceFee) external onlyAdmin { require(_performanceFee <= MAX_PERFORMANCE_FEE, "performanceFee cannot be more than MAX_PERFORMANCE_FEE"); performanceFee = _performanceFee; } /** * @notice Sets call fee * @dev Only callable by the contract admin. */ function setCallFee(uint256 _callFee) external onlyAdmin { require(_callFee <= MAX_CALL_FEE, "callFee cannot be more than MAX_CALL_FEE"); callFee = _callFee; } /** * @notice Sets withdraw fee * @dev Only callable by the contract admin. */ function setWithdrawFee(uint256 _withdrawFee) external onlyAdmin { require(_withdrawFee <= MAX_WITHDRAW_FEE, "withdrawFee cannot be more than MAX_WITHDRAW_FEE"); withdrawFee = _withdrawFee; } /** * @notice Sets withdraw fee period * @dev Only callable by the contract admin. */ function setWithdrawFeePeriod(uint256 _withdrawFeePeriod) external onlyAdmin { require( _withdrawFeePeriod <= MAX_WITHDRAW_FEE_PERIOD, "withdrawFeePeriod cannot be more than MAX_WITHDRAW_FEE_PERIOD" ); withdrawFeePeriod = _withdrawFeePeriod; } /** * @notice Withdraws from MasterChef to Vault without caring about rewards. * @dev EMERGENCY ONLY. Only callable by the contract admin. */ function emergencyWithdraw() external onlyAdmin { IMasterChef(masterchef).emergencyWithdraw(0); } /** * @notice Withdraw unexpected tokens sent to the Cake Vault */ function inCaseTokensGetStuck(address _token) external onlyAdmin { require(_token != address(token), "Token cannot be same as deposit token"); require(_token != address(receiptToken), "Token cannot be same as receipt token"); uint256 amount = IBEP20(_token).balanceOf(address(this)); IBEP20(_token).safeTransfer(msg.sender, amount); } /** * @notice Triggers stopped state * @dev Only possible when contract not paused. */ function pause() external onlyAdmin whenNotPaused { _pause(); emit Pause(); } /** * @notice Returns to normal state * @dev Only possible when contract is paused. */ function unpause() external onlyAdmin whenPaused { _unpause(); emit Unpause(); } /** * @notice Calculates the expected harvest reward from third party * @return Expected reward to collect in CAKE */ function calculateHarvestCakeRewards() external view returns (uint256) { uint256 amount = IMasterChef(masterchef).pendingCake(0, address(this)); amount = amount.add(available()); uint256 currentCallFee = amount.mul(callFee).div(10000); return currentCallFee; } /** * @notice Calculates the total pending rewards that can be restaked * @return Returns total pending cake rewards */ function calculateTotalPendingCakeRewards() external view returns (uint256) { uint256 amount = IMasterChef(masterchef).pendingCake(0, address(this)); amount = amount.add(available()); return amount; } /** * @notice Calculates the price per share */ function getPricePerFullShare() external view returns (uint256) { return totalShares == 0 ? 1e18 : balanceOf().mul(1e18).div(totalShares); } /** * @notice Withdraws from funds from the Cake Vault * @param _shares: Number of shares to withdraw */ function withdraw(uint256 _shares) public notContract { UserInfo storage user = userInfo[msg.sender]; require(_shares > 0, "Nothing to withdraw"); require(_shares <= user.shares, "Withdraw amount exceeds balance"); uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares); user.shares = user.shares.sub(_shares); totalShares = totalShares.sub(_shares); uint256 bal = available(); if (bal < currentAmount) { uint256 balWithdraw = currentAmount.sub(bal); IMasterChef(masterchef).leaveStaking(balWithdraw); uint256 balAfter = available(); uint256 diff = balAfter.sub(bal); if (diff < balWithdraw) { currentAmount = bal.add(diff); } } if (block.timestamp < user.lastDepositedTime.add(withdrawFeePeriod)) { uint256 currentWithdrawFee = currentAmount.mul(withdrawFee).div(10000); token.safeTransfer(treasury, currentWithdrawFee); currentAmount = currentAmount.sub(currentWithdrawFee); } if (user.shares > 0) { user.cakeAtLastUserAction = user.shares.mul(balanceOf()).div(totalShares); } else { user.cakeAtLastUserAction = 0; } user.lastUserActionTime = block.timestamp; token.safeTransfer(msg.sender, currentAmount); emit Withdraw(msg.sender, currentAmount, _shares); } /** * @notice Custom logic for how much the vault allows to be borrowed * @dev The contract puts 100% of the tokens to work. */ function available() public view returns (uint256) { return token.balanceOf(address(this)); } /** * @notice Calculates the total underlying tokens * @dev It includes tokens held by the contract and held in MasterChef */ function balanceOf() public view returns (uint256) { (uint256 amount, ) = IMasterChef(masterchef).userInfo(0, address(this)); return token.balanceOf(address(this)).add(amount); } /** * @notice Deposits tokens into MasterChef to earn staking rewards */ function _earn() internal { uint256 bal = available(); if (bal > 0) { IMasterChef(masterchef).enterStaking(bal); } } /** * @notice Checks if address is a contract * @dev It prevents contract from being targetted */ function _isContract(address addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return size > 0; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_token","internalType":"contract IBEP20"},{"type":"address","name":"_receiptToken","internalType":"contract IBEP20"},{"type":"address","name":"_masterchef","internalType":"contract IMasterChef"},{"type":"address","name":"_admin","internalType":"address"},{"type":"address","name":"_treasury","internalType":"address"}]},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false},{"type":"uint256","name":"lastDepositedTime","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Harvest","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"uint256","name":"performanceFee","internalType":"uint256","indexed":false},{"type":"uint256","name":"callFee","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":"Pause","inputs":[],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpause","inputs":[],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_CALL_FEE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_PERFORMANCE_FEE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_WITHDRAW_FEE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_WITHDRAW_FEE_PERIOD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"admin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"available","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateHarvestCakeRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateTotalPendingCakeRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"callFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPricePerFullShare","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvest","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"inCaseTokensGetStuck","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastHarvestedTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMasterChef"}],"name":"masterchef","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IBEP20"}],"name":"receiptToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdmin","inputs":[{"type":"address","name":"_admin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCallFee","inputs":[{"type":"uint256","name":"_callFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPerformanceFee","inputs":[{"type":"uint256","name":"_performanceFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTreasury","inputs":[{"type":"address","name":"_treasury","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawFee","inputs":[{"type":"uint256","name":"_withdrawFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawFeePeriod","inputs":[{"type":"uint256","name":"_withdrawFeePeriod","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IBEP20"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalShares","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"shares","internalType":"uint256"},{"type":"uint256","name":"lastDepositedTime","internalType":"uint256"},{"type":"uint256","name":"cakeAtLastUserAction","internalType":"uint256"},{"type":"uint256","name":"lastUserActionTime","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_shares","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawAll","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFeePeriod","inputs":[]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061023d5760003560e01c8063853828b61161013b578063db2e21bc116100b8578063f0f442601161007c578063f0f44260146103ef578063f2fde38b14610402578063f851a44014610415578063fb1db2781461041d578063fc0c546a146104255761023d565b8063db2e21bc146103bc578063def68a9c146103c4578063df10b4e6146103d7578063e941fa78146103df578063ec78e832146103e75761023d565b8063b60f0531116100ff578063b60f053114610386578063b6ac642a1461038e578063b6b55f25146103a1578063bdca9165146103b4578063d4b0de2f146102965761023d565b8063853828b61461035e57806387788782146103665780638da5cb5b1461036e57806390321e1a146103765780639d72596b1461037e5761023d565b806348a0d754116101c957806370897b231161018d57806370897b231461032b578063715018a61461033e578063722713f71461034657806377c7b8fc1461034e5780638456cb59146103565761023d565b806348a0d754146102de57806358ebceb6146102e65780635c975abb146102ee57806361d027b314610303578063704b6c02146103185761023d565b80632cfc5f01116102105780632cfc5f01146102ab5780632e1a7d4d146102b35780633a98ef39146102c65780633f4ba83a146102ce5780634641257d146102d65761023d565b80631959a002146102425780631efac1b81461026e57806326465826146102835780632ad5a53f14610296575b600080fd5b610255610250366004611c01565b61042d565b60405161026594939291906122e5565b60405180910390f35b61028161027c366004611c48565b610455565b005b610281610291366004611c48565b6104b0565b61029e610500565b6040516102659190611d2d565b61029e610505565b6102816102c1366004611c48565b61050c565b61029e6107e8565b6102816107ee565b61028161086f565b61029e610a5e565b61029e610b02565b6102f6610bbe565b6040516102659190611d22565b61030b610bce565b6040516102659190611cb7565b610281610326366004611c01565b610bdd565b610281610339366004611c48565b610c5a565b610281610cab565b61029e610d2a565b61029e610e74565b610281610eac565b610281610f2e565b61029e610f8e565b61030b610f94565b61029e610fa3565b61029e610fa9565b61029e61107e565b61028161039c366004611c48565b611084565b6102816103af366004611c48565b6110d4565b61029e61126a565b610281611270565b6102816103d2366004611c01565b61131b565b61029e611482565b61029e611488565b61030b61148e565b6102816103fd366004611c01565b6114b2565b610281610410366004611c01565b61152f565b61030b611570565b61030b61157f565b61030b6115a3565b6001602081905260009182526040909120805491810154600282015460039092015490919084565b6004546001600160a01b031633146104885760405162461bcd60e51b815260040161047f906121b8565b60405180910390fd5b6203f4808111156104ab5760405162461bcd60e51b815260040161047f90612214565b600955565b6004546001600160a01b031633146104da5760405162461bcd60e51b815260040161047f906121b8565b60648111156104fb5760405162461bcd60e51b815260040161047f90611fc6565b600755565b606481565b6203f48081565b610515336116dd565b156105325760405162461bcd60e51b815260040161047f9061218a565b3332146105515760405162461bcd60e51b815260040161047f90611dac565b3360009081526001602052604090208161057d5760405162461bcd60e51b815260040161047f90611e11565b805482111561059e5760405162461bcd60e51b815260040161047f90611f4a565b60006105be6002546105b8856105b2610d2a565b906116e3565b90611731565b82549091506105cd9084611773565b82556002546105dc9084611773565b60025560006105e9610a5e565b9050818110156106b35760006105ff8383611773565b604051631058d28160e01b81529091506001600160a01b037f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8521690631058d2819061064e908490600401611d2d565b600060405180830381600087803b15801561066857600080fd5b505af115801561067c573d6000803e3d6000fd5b50505050600061068a610a5e565b905060006106988285611773565b9050828110156106af576106ac84826117b5565b94505b5050505b60095460018401546106c4916117b5565b4210156107335760006106e86127106105b8600854866116e390919063ffffffff16565b600554909150610725906001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf07835181169116836117e4565b61072f8382611773565b9250505b82541561075d576107536002546105b861074b610d2a565b8654906116e3565b6002840155610765565b600060028401555b42600384015561079f6001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf0783511633846117e4565b336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56883866040516107da9291906122c1565b60405180910390a250505050565b60025481565b6004546001600160a01b031633146108185760405162461bcd60e51b815260040161047f906121b8565b610820610bbe565b61083c5760405162461bcd60e51b815260040161047f90611de3565b610844611803565b6040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b610878336116dd565b156108955760405162461bcd60e51b815260040161047f9061218a565b3332146108b45760405162461bcd60e51b815260040161047f90611dac565b6108bc610bbe565b156108d95760405162461bcd60e51b815260040161047f90612064565b604051631058d28160e01b81526001600160a01b037f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8521690631058d2819061092690600090600401611d2d565b600060405180830381600087803b15801561094057600080fd5b505af1158015610954573d6000803e3d6000fd5b505050506000610962610a5e565b905060006109816127106105b8600654856116e390919063ffffffff16565b6005549091506109be906001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf07835181169116836117e4565b60006109db6127106105b8600754866116e390919063ffffffff16565b9050610a116001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf0783511633836117e4565b610a19611874565b4260035560405133907f71bab65ced2e5750775a0613be067df48ef06cf92a496ebf7663ae066092495490610a5190859085906122c1565b60405180910390a2505050565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf07835116906370a0823190610aad903090600401611cb7565b60206040518083038186803b158015610ac557600080fd5b505afa158015610ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afd9190611c60565b905090565b6000807f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8526001600160a01b0316631175a1dd6000306040518363ffffffff1660e01b8152600401610b54929190611d36565b60206040518083038186803b158015610b6c57600080fd5b505afa158015610b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba49190611c60565b9050610bb8610bb1610a5e565b82906117b5565b91505090565b600054600160a01b900460ff1690565b6005546001600160a01b031681565b610be5611907565b6000546001600160a01b03908116911614610c125760405162461bcd60e51b815260040161047f90612155565b6001600160a01b038116610c385760405162461bcd60e51b815260040161047f9061208e565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610c845760405162461bcd60e51b815260040161047f906121b8565b6101f4811115610ca65760405162461bcd60e51b815260040161047f9061200e565b600655565b610cb3611907565b6000546001600160a01b03908116911614610ce05760405162461bcd60e51b815260040161047f90612155565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000807f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8526001600160a01b03166393f1a40b6000306040518363ffffffff1660e01b8152600401610d7c929190611d36565b604080518083038186803b158015610d9357600080fd5b505afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190611c78565b509050610bb8817f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf0783516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610e1e9190611cb7565b60206040518083038186803b158015610e3657600080fd5b505afa158015610e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6e9190611c60565b906117b5565b6000600254600014610e9f57610e9a6002546105b8670de0b6b3a76400006105b2610d2a565b610afd565b50670de0b6b3a764000090565b6004546001600160a01b03163314610ed65760405162461bcd60e51b815260040161047f906121b8565b610ede610bbe565b15610efb5760405162461bcd60e51b815260040161047f90612064565b610f0361190b565b6040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b610f37336116dd565b15610f545760405162461bcd60e51b815260040161047f9061218a565b333214610f735760405162461bcd60e51b815260040161047f90611dac565b33600090815260016020526040902054610f8c9061050c565b565b60065481565b6000546001600160a01b031690565b60075481565b6000807f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8526001600160a01b0316631175a1dd6000306040518363ffffffff1660e01b8152600401610ffb929190611d36565b60206040518083038186803b15801561101357600080fd5b505afa158015611027573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104b9190611c60565b9050611058610bb1610a5e565b905060006110776127106105b8600754856116e390919063ffffffff16565b9250505090565b60035481565b6004546001600160a01b031633146110ae5760405162461bcd60e51b815260040161047f906121b8565b60648111156110cf5760405162461bcd60e51b815260040161047f90612271565b600855565b6110dc610bbe565b156110f95760405162461bcd60e51b815260040161047f90612064565b611102336116dd565b1561111f5760405162461bcd60e51b815260040161047f9061218a565b33321461113e5760405162461bcd60e51b815260040161047f90611dac565b6000811161115e5760405162461bcd60e51b815260040161047f90611d80565b6000611168610d2a565b905061119f6001600160a01b037f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf0783511633308561196c565b60006002546000146111cb576111c4826105b8600254866116e390919063ffffffff16565b90506111ce565b50815b33600090815260016020526040902080546111e990836117b5565b81554260018201556002546111fe90836117b5565b600281905561121a906105b8611212610d2a565b8454906116e3565b600282015542600382015561122d611874565b336001600160a01b03167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e8584426040516107da939291906122cf565b6101f481565b6004546001600160a01b0316331461129a5760405162461bcd60e51b815260040161047f906121b8565b604051632989754760e11b81526001600160a01b037f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e8521690635312ea8e906112e790600090600401611d2d565b600060405180830381600087803b15801561130157600080fd5b505af1158015611315573d6000803e3d6000fd5b50505050565b6004546001600160a01b031633146113455760405162461bcd60e51b815260040161047f906121b8565b7f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf0783516001600160a01b0316816001600160a01b031614156113975760405162461bcd60e51b815260040161047f90611f05565b7f000000000000000000000000f84fb4a80dd211408699afa9c7a9d236feff1dd86001600160a01b0316816001600160a01b031614156113e95760405162461bcd60e51b815260040161047f90611f81565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190611418903090600401611cb7565b60206040518083038186803b15801561143057600080fd5b505afa158015611444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114689190611c60565b905061147e6001600160a01b03831633836117e4565b5050565b60095481565b60085481565b7f000000000000000000000000f84fb4a80dd211408699afa9c7a9d236feff1dd881565b6114ba611907565b6000546001600160a01b039081169116146114e75760405162461bcd60e51b815260040161047f90612155565b6001600160a01b03811661150d5760405162461bcd60e51b815260040161047f9061208e565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611537611907565b6000546001600160a01b039081169116146115645760405162461bcd60e51b815260040161047f90612155565b61156d8161198d565b50565b6004546001600160a01b031681565b7f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e85281565b7f000000000000000000000000abf26902fd7b624e0db40d31171ea9dddf07835181565b80158061164f5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906115fd9030908690600401611ccb565b60206040518083038186803b15801561161557600080fd5b505afa158015611629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164d9190611c60565b155b61166b5760405162461bcd60e51b815260040161047f906120ff565b6116c18363095ea7b360e01b848460405160240161168a929190611d09565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a0e565b505050565b60606116d58484600085611a9d565b949350505050565b3b151590565b6000826116f25750600061172b565b60006116fe8385612338565b90508261170b8583612318565b146117285760405162461bcd60e51b815260040161047f906120be565b90505b92915050565b600061172883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b60565b600061172883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b97565b6000806117c28385612300565b9050838110156117285760405162461bcd60e51b815260040161047f90611ece565b6116c18363a9059cbb60e01b848460405160240161168a929190611d09565b61180b610bbe565b6118275760405162461bcd60e51b815260040161047f90611de3565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61185d611907565b60405161186a9190611cb7565b60405180910390a1565b600061187e610a5e565b9050801561156d576040516341441d3b60e01b81526001600160a01b037f000000000000000000000000a7e8280b8ce4f87dfefc3d1f2254b5ccd971e85216906341441d3b906118d2908490600401611d2d565b600060405180830381600087803b1580156118ec57600080fd5b505af1158015611900573d6000803e3d6000fd5b5050505050565b3390565b611913610bbe565b156119305760405162461bcd60e51b815260040161047f90612064565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861185d611907565b611315846323b872dd60e01b85858560405160240161168a93929190611ce5565b6001600160a01b0381166119b35760405162461bcd60e51b815260040161047f90611e88565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000611a63826040518060400160405280602081526020017f5361666542455032303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116c69092919063ffffffff16565b8051909150156116c15780806020019051810190611a819190611c28565b6116c15760405162461bcd60e51b815260040161047f90611e3e565b6060611aa885611bc8565b611ac45760405162461bcd60e51b815260040161047f906121dd565b600080866001600160a01b03168587604051611ae09190611c9b565b60006040518083038185875af1925050503d8060008114611b1d576040519150601f19603f3d011682016040523d82523d6000602084013e611b22565b606091505b50915091508115611b365791506116d59050565b805115611b465780518082602001fd5b8360405162461bcd60e51b815260040161047f9190611d4d565b60008183611b815760405162461bcd60e51b815260040161047f9190611d4d565b506000611b8e8486612318565b95945050505050565b60008184841115611bbb5760405162461bcd60e51b815260040161047f9190611d4d565b506000611b8e8486612357565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906116d5575050151592915050565b600060208284031215611c12578081fd5b81356001600160a01b0381168114611728578182fd5b600060208284031215611c39578081fd5b81518015158114611728578182fd5b600060208284031215611c59578081fd5b5035919050565b600060208284031215611c71578081fd5b5051919050565b60008060408385031215611c8a578081fd5b505080516020909101519092909150565b60008251611cad81846020870161236e565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b9182526001600160a01b0316602082015260400190565b6000602082528251806020840152611d6c81604085016020870161236e565b601f01601f19169190910160400192915050565b602080825260129082015271139bdd1a1a5b99c81d1bc819195c1bdcda5d60721b604082015260600190565b6020808252601a908201527f70726f787920636f6e7472616374206e6f7420616c6c6f776564000000000000604082015260600190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b6020808252601390820152724e6f7468696e6720746f20776974686472617760681b604082015260600190565b6020808252602a908201527f5361666542455032303a204245503230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526025908201527f546f6b656e2063616e6e6f742062652073616d65206173206465706f736974206040820152643a37b5b2b760d91b606082015260800190565b6020808252601f908201527f576974686472617720616d6f756e7420657863656564732062616c616e636500604082015260600190565b60208082526025908201527f546f6b656e2063616e6e6f742062652073616d652061732072656365697074206040820152643a37b5b2b760d91b606082015260800190565b60208082526028908201527f63616c6c4665652063616e6e6f74206265206d6f7265207468616e204d41585f60408201526743414c4c5f46454560c01b606082015260800190565b60208082526036908201527f706572666f726d616e63654665652063616e6e6f74206265206d6f7265207468604082015275616e204d41585f504552464f524d414e43455f46454560501b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526016908201527543616e6e6f74206265207a65726f206164647265737360501b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526036908201527f5361666542455032303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526014908201527318dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b604082015260600190565b6020808252600b908201526a61646d696e3a207775743f60a81b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252603d908201527f7769746864726177466565506572696f642063616e6e6f74206265206d6f726560408201527f207468616e204d41585f57495448445241575f4645455f504552494f44000000606082015260800190565b60208082526030908201527f77697468647261774665652063616e6e6f74206265206d6f7265207468616e2060408201526f4d41585f57495448445241575f46454560801b606082015260800190565b918252602082015260400190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b600082198211156123135761231361239a565b500190565b60008261233357634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156123525761235261239a565b500290565b6000828210156123695761236961239a565b500390565b60005b83811015612389578181015183820152602001612371565b838111156113155750506000910152565b634e487b7160e01b600052601160045260246000fdfea26469706673582212203e2cf3618b9dbd4e309e7d0fbae3c123802a7b0b8ed6506e2119e00d170febd964736f6c63430008000033