ERC-20
Overview
Max Total Supply
944,217.934991 stackUSDC
Holders
6,399
Market
Price
$0.00 @ 0.000000 MATIC
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 6 Decimals)
Balance
0.001079 stackUSDCValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
FarmTreasuryV1
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/** *Submitted for verification at polygonscan.com on 2021-06-30 */ // SPDX-License-Identifier: MIT /* This is a Stacker.vc FarmTreasury version 1 contract. It deploys a rebase token where it rebases to be equivalent to it's underlying token. 1 stackUSDT = 1 USDT. The underlying assets are used to farm on different smart contract and produce yield via the ever-expanding DeFi ecosystem. THANKS! To Lido DAO for the inspiration in more ways than one, but especially for a lot of the code here. If you haven't already, stake your ETH for ETH2.0 with Lido.fi! Also thanks for Aragon for hosting our Stacker Ventures DAO, and for more inspiration! */ pragma solidity ^0.6.11; /* * @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; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } /** * @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); } /** * @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"); } } } abstract contract FarmTokenV1 is IERC20 { using SafeMath for uint256; using Address for address; // shares are how a users balance is generated. For rebase tokens, balances are always generated at runtime, while shares stay constant. // shares is your proportion of the total pool of invested UnderlyingToken // shares are like a Compound.finance cToken, while our token balances are like an Aave aToken. mapping(address => uint256) private shares; mapping(address => mapping (address => uint256)) private allowances; uint256 public totalShares; string public name; string public symbol; string public underlying; address public underlyingContract; uint8 public decimals; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor(string memory _name, uint8 _decimals, address _underlyingContract) public { name = string(abi.encodePacked(abi.encodePacked("Stacker Ventures ", _name), " v1")); symbol = string(abi.encodePacked("stack", _name)); underlying = _name; decimals = _decimals; underlyingContract = _underlyingContract; } // 1 stackToken = 1 underlying token function totalSupply() external override view returns (uint256){ return _getTotalUnderlying(); } function totalUnderlying() external view returns (uint256){ return _getTotalUnderlying(); } function balanceOf(address _account) public override view returns (uint256){ return getUnderlyingForShares(_sharesOf(_account)); } // transfer tokens, not shares function transfer(address _recipient, uint256 _amount) external override returns (bool){ _verify(msg.sender, _amount); _transfer(msg.sender, _recipient, _amount); return true; } function transferFrom(address _sender, address _recipient, uint256 _amount) external override returns (bool){ _verify(_sender, _amount); uint256 _currentAllowance = allowances[_sender][msg.sender]; require(_currentAllowance >= _amount, "FARMTOKENV1: not enough allowance"); _transfer(_sender, _recipient, _amount); _approve(_sender, msg.sender, _currentAllowance.sub(_amount)); return true; } // this checks if a transfer/transferFrom/withdraw is allowed. There are some conditions on withdraws/transfers from new deposits // function stub, this needs to be implemented in a contract which inherits this for a valid deployment // IMPLEMENT THIS function _verify(address _account, uint256 _amountUnderlyingToSend) internal virtual; // allow tokens, not shares function allowance(address _owner, address _spender) external override view returns (uint256){ return allowances[_owner][_spender]; } // approve tokens, not shares function approve(address _spender, uint256 _amount) external override returns (bool){ _approve(msg.sender, _spender, _amount); return true; } // shares of _account function sharesOf(address _account) external view returns (uint256) { return _sharesOf(_account); } // how many shares for _amount of underlying? // if there are no shares, or no underlying yet, we are initing the contract or suffered a total loss // either way, init this state at 1:1 shares:underlying function getSharesForUnderlying(uint256 _amountUnderlying) public view returns (uint256){ uint256 _totalUnderlying = _getTotalUnderlying(); if (_totalUnderlying == 0){ return _amountUnderlying; // this will init at 1:1 _underlying:_shares } uint256 _totalShares = totalShares; if (_totalShares == 0){ return _amountUnderlying; // this will init the first shares, expected contract underlying balance == 0, or there will be a bonus (doesn't belong to anyone so ok) } return _amountUnderlying.mul(_totalShares).div(_totalUnderlying); } // how many underlying for _amount of shares? // if there are no shares, or no underlying yet, we are initing the contract or suffered a total loss // either way, init this state at 1:1 shares:underlying function getUnderlyingForShares(uint256 _amountShares) public view returns (uint256){ uint256 _totalShares = totalShares; if (_totalShares == 0){ return _amountShares; // this will init at 1:1 _shares:_underlying } uint256 _totalUnderlying = _getTotalUnderlying(); if (_totalUnderlying == 0){ return _amountShares; // this will init at 1:1 } return _amountShares.mul(_totalUnderlying).div(_totalShares); } function _sharesOf(address _account) internal view returns (uint256){ return shares[_account]; } // function stub, this needs to be implemented in a contract which inherits this for a valid deployment // sum the contract balance + working balance withdrawn from the contract and actively farming // IMPLEMENT THIS function _getTotalUnderlying() internal virtual view returns (uint256); // in underlying function _transfer(address _sender, address _recipient, uint256 _amount) internal { uint256 _sharesToTransfer = getSharesForUnderlying(_amount); _transferShares(_sender, _recipient, _sharesToTransfer); emit Transfer(_sender, _recipient, _amount); } // in underlying function _approve(address _owner, address _spender, uint256 _amount) internal { require(_owner != address(0), "FARMTOKENV1: from == 0x0"); require(_spender != address(0), "FARMTOKENV1: to == 0x00"); allowances[_owner][_spender] = _amount; emit Approval(_owner, _spender, _amount); } function _transferShares(address _sender, address _recipient, uint256 _amountShares) internal { require(_sender != address(0), "FARMTOKENV1: from == 0x00"); require(_recipient != address(0), "FARMTOKENV1: to == 0x00"); uint256 _currentSenderShares = shares[_sender]; require(_amountShares <= _currentSenderShares, "FARMTOKENV1: transfer amount exceeds balance"); shares[_sender] = _currentSenderShares.sub(_amountShares); shares[_recipient] = shares[_recipient].add(_amountShares); } function _mintShares(address _recipient, uint256 _amountShares) internal { require(_recipient != address(0), "FARMTOKENV1: to == 0x00"); totalShares = totalShares.add(_amountShares); shares[_recipient] = shares[_recipient].add(_amountShares); // NOTE: we're not emitting a Transfer event from the zero address here // If we mint shares with no underlying, we basically just diluted everyone // It's not possible to send events from _everyone_ to reflect each balance dilution (ie: balance going down) // Not compliant to ERC20 standard... } function _burnShares(address _account, uint256 _amountShares) internal { require(_account != address(0), "FARMTOKENV1: burn from == 0x00"); uint256 _accountShares = shares[_account]; require(_amountShares <= _accountShares, "FARMTOKENV1: burn amount exceeds balance"); totalShares = totalShares.sub(_amountShares); shares[_account] = _accountShares.sub(_amountShares); // NOTE: we're not emitting a Transfer event to the zero address here // If we burn shares without burning/withdrawing the underlying // then it looks like a system wide credit to everyones balance // It's not possible to send events to _everyone_ to reflect each balance credit (ie: balance going up) // Not compliant to ERC20 standard... } } contract FarmTreasuryV1 is ReentrancyGuard, FarmTokenV1 { using SafeERC20 for IERC20; using SafeMath for uint256; using Address for address; mapping(address => DepositInfo) public userDeposits; mapping(address => bool) public noLockWhitelist; struct DepositInfo { uint256 amountUnderlyingLocked; uint256 timestampDeposit; uint256 timestampUnlocked; } uint256 internal constant LOOP_LIMIT = 200; address payable public governance; address public governanceRewards; address payable public farmBoss; bool public paused = false; bool public pausedDeposits = false; // fee schedule, can be changed by governance, in bips // performance fee is on any gains, base fee is on AUM/yearly uint256 public constant max = 10000; uint256 public performanceToTreasury = 1000; uint256 public performanceToFarmer = 1000; uint256 public baseToTreasury = 100; uint256 public baseToFarmer = 100; // limits on rebalancing from the farmer, trying to negate errant rebalances uint256 public rebalanceUpLimit = 100; // maximum of a 1.0% gain per rebalance uint256 public rebalanceUpWaitTime = 23 hours; uint256 public lastRebalanceUpTime; // waiting period on withdraws from time of deposit // locked amount linearly decreases until the time is up, so at waitPeriod/2 after deposit, you can withdraw depositAmt/2 funds. uint256 public waitPeriod = 1 weeks; // hot wallet holdings for instant withdraw, in bips // if the hot wallet balance expires, the users will need to wait for the next rebalance period in order to withdraw uint256 public hotWalletHoldings = 1000; // 10% initially uint256 public ACTIVELY_FARMED; event RebalanceHot(uint256 amountIn, uint256 amountToFarmer, uint256 timestamp); event ProfitDeclared(bool profit, uint256 amount, uint256 timestamp, uint256 totalAmountInPool, uint256 totalSharesInPool, uint256 performanceFeeTotal, uint256 baseFeeTotal); event Deposit(address depositor, uint256 amount, address referral); event Withdraw(address withdrawer, uint256 amount); constructor(string memory _nameUnderlying, uint8 _decimalsUnderlying, address _underlying) public FarmTokenV1(_nameUnderlying, _decimalsUnderlying, _underlying) { governance = msg.sender; governanceRewards = msg.sender; lastRebalanceUpTime = block.timestamp; } function setGovernance(address payable _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); governance = _new; } function setGovernanceRewards(address _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); governanceRewards = _new; } // the "farmBoss" is a trusted smart contract that functions kind of like an EOA. // HOWEVER specific contract addresses need to be whitelisted in order for this contract to be allowed to interact w/ them // the governance has full control over the farmBoss, and other addresses can have partial control for strategy rotation/rebalancing function setFarmBoss(address payable _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); farmBoss = _new; } function setNoLockWhitelist(address[] calldata _accounts, bool[] calldata _noLock) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_accounts.length == _noLock.length && _accounts.length <= LOOP_LIMIT, "FARMTREASURYV1: check array lengths"); for (uint256 i = 0; i < _accounts.length; i++){ noLockWhitelist[_accounts[i]] = _noLock[i]; } } function pause() external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); paused = true; } function unpause() external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); paused = false; } function pauseDeposits() external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); pausedDeposits = true; } function unpauseDeposits() external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); pausedDeposits = false; } function setFeeDistribution(uint256 _performanceToTreasury, uint256 _performanceToFarmer, uint256 _baseToTreasury, uint256 _baseToFarmer) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_performanceToTreasury.add(_performanceToFarmer) < max, "FARMTREASURYV1: too high performance"); require(_baseToTreasury.add(_baseToFarmer) <= 500, "FARMTREASURYV1: too high base"); performanceToTreasury = _performanceToTreasury; performanceToFarmer = _performanceToFarmer; baseToTreasury = _baseToTreasury; baseToFarmer = _baseToFarmer; } function setWaitPeriod(uint256 _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_new <= 10 weeks, "FARMTREASURYV1: too long wait"); waitPeriod = _new; } function setHotWalletHoldings(uint256 _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_new <= max && _new >= 100, "FARMTREASURYV1: hot wallet values bad"); hotWalletHoldings = _new; } function setRebalanceUpLimit(uint256 _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_new < max, "FARMTREASURYV1: >= max"); rebalanceUpLimit = _new; } function setRebalanceUpWaitTime(uint256 _new) external { require(msg.sender == governance, "FARMTREASURYV1: !governance"); require(_new <= 1 weeks, "FARMTREASURYV1: > 1 week"); rebalanceUpWaitTime = _new; } function deposit(uint256 _amountUnderlying, address _referral) external nonReentrant { require(_amountUnderlying > 0, "FARMTREASURYV1: amount == 0"); require(!paused && !pausedDeposits, "FARMTREASURYV1: paused"); _deposit(_amountUnderlying, _referral); IERC20 _underlying = IERC20(underlyingContract); uint256 _before = _underlying.balanceOf(address(this)); _underlying.safeTransferFrom(msg.sender, address(this), _amountUnderlying); uint256 _after = _underlying.balanceOf(address(this)); uint256 _total = _after.sub(_before); require(_total >= _amountUnderlying, "FARMTREASURYV1: bad transfer"); } function _deposit(uint256 _amountUnderlying, address _referral) internal { // determine how many shares this will be uint256 _sharesToMint = getSharesForUnderlying(_amountUnderlying); _mintShares(msg.sender, _sharesToMint); // store some important info for this deposit, that will be checked on withdraw/transfer of tokens _storeDepositInfo(msg.sender, _amountUnderlying); // emit deposit w/ referral event... can't refer yourself if (_referral != msg.sender){ emit Deposit(msg.sender, _amountUnderlying, _referral); } else { emit Deposit(msg.sender, _amountUnderlying, address(0)); } emit Transfer(address(0), msg.sender, _amountUnderlying); } function _storeDepositInfo(address _account, uint256 _amountUnderlying) internal { DepositInfo memory _existingInfo = userDeposits[_account]; // first deposit, make a new entry in the mapping, lock all funds for "waitPeriod" if (_existingInfo.timestampDeposit == 0){ DepositInfo memory _info = DepositInfo( { amountUnderlyingLocked: _amountUnderlying, timestampDeposit: block.timestamp, timestampUnlocked: block.timestamp.add(waitPeriod) } ); userDeposits[_account] = _info; } // not the first deposit, if there are still funds locked, then average out the waits (ie: 1 BTC locked 10 days = 2 BTC locked 5 days) else { uint256 _lockedAmt = _getLockedAmount(_account, _existingInfo.amountUnderlyingLocked, _existingInfo.timestampDeposit, _existingInfo.timestampUnlocked); // if there's no lock, disregard old info and make a new lock if (_lockedAmt == 0){ DepositInfo memory _info = DepositInfo( { amountUnderlyingLocked: _amountUnderlying, timestampDeposit: block.timestamp, timestampUnlocked: block.timestamp.add(waitPeriod) } ); userDeposits[_account] = _info; } // funds are still locked from a past deposit, average out the waittime remaining with the waittime for this new deposit /* solve this equation: newDepositAmt * waitPeriod + remainingAmt * existingWaitPeriod = (newDepositAmt + remainingAmt) * X waitPeriod therefore: (newDepositAmt * waitPeriod + remainingAmt * existingWaitPeriod) X waitPeriod = ---------------------------------------------------------------- (newDepositAmt + remainingAmt) Example: 7 BTC new deposit, with wait period of 2 weeks 1 BTC remaining, with remaining wait period of 1 week ... (7 BTC * 2 weeks + 1 BTC * 1 week) / 8 BTC = 1.875 weeks */ else { uint256 _lockedAmtTime = _lockedAmt.mul(_existingInfo.timestampUnlocked.sub(block.timestamp)); uint256 _newAmtTime = _amountUnderlying.mul(waitPeriod); uint256 _total = _amountUnderlying.add(_lockedAmt); uint256 _newLockedTime = (_lockedAmtTime.add(_newAmtTime)).div(_total); DepositInfo memory _info = DepositInfo( { amountUnderlyingLocked: _total, timestampDeposit: block.timestamp, timestampUnlocked: block.timestamp.add(_newLockedTime) } ); userDeposits[_account] = _info; } } } function getLockedAmount(address _account) public view returns (uint256) { DepositInfo memory _existingInfo = userDeposits[_account]; return _getLockedAmount(_account, _existingInfo.amountUnderlyingLocked, _existingInfo.timestampDeposit, _existingInfo.timestampUnlocked); } // the locked amount linearly decreases until the timestampUnlocked time, then it's zero // Example: if 5 BTC contributed (2 week lock), then after 1 week there will be 2.5 BTC locked, the rest is free to transfer/withdraw function _getLockedAmount(address _account, uint256 _amountLocked, uint256 _timestampDeposit, uint256 _timestampUnlocked) internal view returns (uint256) { if (_timestampUnlocked <= block.timestamp || noLockWhitelist[_account]){ return 0; } else { uint256 _remainingTime = _timestampUnlocked.sub(block.timestamp); uint256 _totalTime = _timestampUnlocked.sub(_timestampDeposit); return _amountLocked.mul(_remainingTime).div(_totalTime); } } function withdraw(uint256 _amountUnderlying) external nonReentrant { require(_amountUnderlying > 0, "FARMTREASURYV1: amount == 0"); require(!paused, "FARMTREASURYV1: paused"); _withdraw(_amountUnderlying); IERC20(underlyingContract).safeTransfer(msg.sender, _amountUnderlying); } function _withdraw(uint256 _amountUnderlying) internal { _verify(msg.sender, _amountUnderlying); // try and catch the more obvious error of hot wallet being depleted, otherwise proceed if (IERC20(underlyingContract).balanceOf(address(this)) < _amountUnderlying){ revert("FARMTREASURYV1: Hot wallet balance depleted. Please try smaller withdraw or wait for rebalancing."); } uint256 _sharesToBurn = getSharesForUnderlying(_amountUnderlying); _burnShares(msg.sender, _sharesToBurn); // they must have >= _sharesToBurn, checked here emit Transfer(msg.sender, address(0), _amountUnderlying); emit Withdraw(msg.sender, _amountUnderlying); } // wait time verification function _verify(address _account, uint256 _amountUnderlyingToSend) internal override { DepositInfo memory _existingInfo = userDeposits[_account]; uint256 _lockedAmt = _getLockedAmount(_account, _existingInfo.amountUnderlyingLocked, _existingInfo.timestampDeposit, _existingInfo.timestampUnlocked); uint256 _balance = balanceOf(_account); // require that any funds locked are not leaving the account in question. require(_balance.sub(_amountUnderlyingToSend) >= _lockedAmt, "FARMTREASURYV1: requested funds are temporarily locked"); } // this means that we made a GAIN, due to standard farming gains // operaratable by farmBoss, this is standard operating procedure, farmers can only report gains function rebalanceUp(uint256 _amount, address _farmerRewards) external nonReentrant returns (bool, uint256) { require(msg.sender == farmBoss, "FARMTREASURYV1: !farmBoss"); require(!paused, "FARMTREASURYV1: paused"); // fee logic & profit recording // check farmer limits on rebalance wait time for earning reportings. if there is no _amount reported, we don't take any fees and skip these checks // we should always allow pure hot wallet rebalances, however earnings needs some checks and restrictions if (_amount > 0){ require(block.timestamp.sub(lastRebalanceUpTime) >= rebalanceUpWaitTime, "FARMTREASURYV1: <rebalanceUpWaitTime"); require(ACTIVELY_FARMED.mul(rebalanceUpLimit).div(max) >= _amount, "FARMTREASURYV1 _amount > rebalanceUpLimit"); // farmer incurred a gain of _amount, add this to the amount being farmed ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amount); uint256 _totalPerformance = _performanceFee(_amount, _farmerRewards); uint256 _totalAnnual = _annualFee(_farmerRewards); // for farmer controls, and also for the annual fee time // only update this if there is a reported gain, otherwise this is just a hot wallet rebalance, and we should always allow these lastRebalanceUpTime = block.timestamp; // for off-chain APY calculations, fees assessed emit ProfitDeclared(true, _amount, block.timestamp, _getTotalUnderlying(), totalShares, _totalPerformance, _totalAnnual); } else { // for off-chain APY calculations, no fees assessed emit ProfitDeclared(true, _amount, block.timestamp, _getTotalUnderlying(), totalShares, 0, 0); } // end fee logic & profit recording // funds are in the contract and gains are accounted for, now determine if we need to further rebalance the hot wallet up, or can take funds in order to farm // start hot wallet and farmBoss rebalance logic (bool _fundsNeeded, uint256 _amountChange) = _calcHotWallet(); _rebalanceHot(_fundsNeeded, _amountChange); // if the hot wallet rebalance fails, revert() the entire function // end logic return (_fundsNeeded, _amountChange); // in case we need them, FE simulations and such } // this means that the system took a loss, and it needs to be reflected in the next rebalance // only operatable by governance, (large) losses should be extremely rare by good farming practices // this would look like a farmed smart contract getting exploited/hacked, and us not having the necessary insurance for it // possible that some more aggressive IL strategies could also need this function called function rebalanceDown(uint256 _amount, bool _rebalanceHotWallet) external nonReentrant returns (bool, uint256) { require(msg.sender == governance, "FARMTREASURYV1: !governance"); // require(!paused, "FARMTREASURYV1: paused"); <-- governance can only call this anyways, leave this commented out ACTIVELY_FARMED = ACTIVELY_FARMED.sub(_amount); if (_rebalanceHotWallet){ (bool _fundsNeeded, uint256 _amountChange) = _calcHotWallet(); _rebalanceHot(_fundsNeeded, _amountChange); // if the hot wallet rebalance fails, revert() the entire function return (_fundsNeeded, _amountChange); // in case we need them, FE simulations and such } // for off-chain APY calculations, no fees assessed emit ProfitDeclared(false, _amount, block.timestamp, _getTotalUnderlying(), totalShares, 0, 0); return (false, 0); } function _performanceFee(uint256 _amount, address _farmerRewards) internal returns (uint256){ uint256 _existingShares = totalShares; uint256 _balance = _getTotalUnderlying(); uint256 _performanceToFarmerUnderlying = _amount.mul(performanceToFarmer).div(max); uint256 _performanceToTreasuryUnderlying = _amount.mul(performanceToTreasury).div(max); uint256 _performanceTotalUnderlying = _performanceToFarmerUnderlying.add(_performanceToTreasuryUnderlying); if (_performanceTotalUnderlying == 0){ return 0; } uint256 _sharesToMint = _underlyingFeeToShares(_performanceTotalUnderlying, _balance, _existingShares); uint256 _sharesToFarmer = _sharesToMint.mul(_performanceToFarmerUnderlying).div(_performanceTotalUnderlying); // by the same ratio uint256 _sharesToTreasury = _sharesToMint.sub(_sharesToFarmer); _mintShares(_farmerRewards, _sharesToFarmer); _mintShares(governanceRewards, _sharesToTreasury); uint256 _underlyingFarmer = getUnderlyingForShares(_sharesToFarmer); uint256 _underlyingTreasury = getUnderlyingForShares(_sharesToTreasury); // do two mint events, in underlying, not shares emit Transfer(address(0), _farmerRewards, _underlyingFarmer); emit Transfer(address(0), governanceRewards, _underlyingTreasury); return _underlyingFarmer.add(_underlyingTreasury); } // we are taking baseToTreasury + baseToFarmer each year, every time this is called, look when we took fee last, and linearize the fee to now(); function _annualFee(address _farmerRewards) internal returns (uint256) { uint256 _lastAnnualFeeTime = lastRebalanceUpTime; if (_lastAnnualFeeTime >= block.timestamp){ return 0; } uint256 _elapsedTime = block.timestamp.sub(_lastAnnualFeeTime); uint256 _existingShares = totalShares; uint256 _balance = _getTotalUnderlying(); uint256 _annualPossibleUnderlying = _balance.mul(_elapsedTime).div(365 days); uint256 _annualToFarmerUnderlying = _annualPossibleUnderlying.mul(baseToFarmer).div(max); uint256 _annualToTreasuryUnderlying = _annualPossibleUnderlying.mul(baseToFarmer).div(max); uint256 _annualTotalUnderlying = _annualToFarmerUnderlying.add(_annualToTreasuryUnderlying); if (_annualTotalUnderlying == 0){ return 0; } uint256 _sharesToMint = _underlyingFeeToShares(_annualTotalUnderlying, _balance, _existingShares); uint256 _sharesToFarmer = _sharesToMint.mul(_annualToFarmerUnderlying).div(_annualTotalUnderlying); // by the same ratio uint256 _sharesToTreasury = _sharesToMint.sub(_sharesToFarmer); _mintShares(_farmerRewards, _sharesToFarmer); _mintShares(governanceRewards, _sharesToTreasury); uint256 _underlyingFarmer = getUnderlyingForShares(_sharesToFarmer); uint256 _underlyingTreasury = getUnderlyingForShares(_sharesToTreasury); // do two mint events, in underlying, not shares emit Transfer(address(0), _farmerRewards, _underlyingFarmer); emit Transfer(address(0), governanceRewards, _underlyingTreasury); return _underlyingFarmer.add(_underlyingTreasury); } function _underlyingFeeToShares(uint256 _totalFeeUnderlying, uint256 _balance, uint256 _existingShares) pure internal returns (uint256 _sharesToMint){ // to mint the required amount of fee shares, solve: /* ratio: currentShares newShares -------------------------- : --------------------, where newShares = (currentShares + mintShares) (totalUnderlying - feeAmt) totalUnderlying solved: ---> (currentShares / (totalUnderlying - feeAmt) * totalUnderlying) - currentShares = mintShares, where newBalanceLessFee = (totalUnderlying - feeAmt) */ return _existingShares .mul(_balance) .div(_balance.sub(_totalFeeUnderlying)) .sub(_existingShares); } function _calcHotWallet() internal view returns (bool _fundsNeeded, uint256 _amountChange) { uint256 _balanceHere = IERC20(underlyingContract).balanceOf(address(this)); uint256 _balanceFarmed = ACTIVELY_FARMED; uint256 _totalAmount = _balanceHere.add(_balanceFarmed); uint256 _hotAmount = _totalAmount.mul(hotWalletHoldings).div(max); // we have too much in hot wallet, send to farmBoss if (_balanceHere >= _hotAmount){ return (false, _balanceHere.sub(_hotAmount)); } // we have too little in hot wallet, pull from farmBoss if (_balanceHere < _hotAmount){ return (true, _hotAmount.sub(_balanceHere)); } } // usually paired with _calcHotWallet() function _rebalanceHot(bool _fundsNeeded, uint256 _amountChange) internal { if (_fundsNeeded){ uint256 _before = IERC20(underlyingContract).balanceOf(address(this)); IERC20(underlyingContract).safeTransferFrom(farmBoss, address(this), _amountChange); uint256 _after = IERC20(underlyingContract).balanceOf(address(this)); uint256 _total = _after.sub(_before); require(_total >= _amountChange, "FARMTREASURYV1: bad rebalance, hot wallet needs funds!"); // we took funds from the farmBoss to refill the hot wallet, reflect this in ACTIVELY_FARMED ACTIVELY_FARMED = ACTIVELY_FARMED.sub(_amountChange); emit RebalanceHot(_amountChange, 0, block.timestamp); } else { require(farmBoss != address(0), "FARMTREASURYV1: !FarmBoss"); // don't burn funds IERC20(underlyingContract).safeTransfer(farmBoss, _amountChange); // _calcHotWallet() guarantees we have funds here to send // we sent more funds for the farmer to farm, reflect this ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amountChange); emit RebalanceHot(0, _amountChange, block.timestamp); } } function _getTotalUnderlying() internal override view returns (uint256) { uint256 _balanceHere = IERC20(underlyingContract).balanceOf(address(this)); uint256 _balanceFarmed = ACTIVELY_FARMED; return _balanceHere.add(_balanceFarmed); } function rescue(address _token, uint256 _amount) external nonReentrant { require(msg.sender == governance, "FARMTREASURYV1: !governance"); if (_token != address(0)){ IERC20(_token).safeTransfer(governance, _amount); } else { // if _tokenContract is 0x0, then escape ETH governance.transfer(_amount); } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_nameUnderlying","type":"string"},{"internalType":"uint8","name":"_decimalsUnderlying","type":"uint8"},{"internalType":"address","name":"_underlying","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"referral","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"profit","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalAmountInPool","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSharesInPool","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"performanceFeeTotal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseFeeTotal","type":"uint256"}],"name":"ProfitDeclared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToFarmer","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RebalanceHot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"ACTIVELY_FARMED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseToFarmer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseToTreasury","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountUnderlying","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmBoss","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountUnderlying","type":"uint256"}],"name":"getSharesForUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountShares","type":"uint256"}],"name":"getUnderlyingForShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hotWalletHoldings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRebalanceUpTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"noLockWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pausedDeposits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceToFarmer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceToTreasury","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_rebalanceHotWallet","type":"bool"}],"name":"rebalanceDown","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_farmerRewards","type":"address"}],"name":"rebalanceUp","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rebalanceUpLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalanceUpWaitTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_new","type":"address"}],"name":"setFarmBoss","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceToTreasury","type":"uint256"},{"internalType":"uint256","name":"_performanceToFarmer","type":"uint256"},{"internalType":"uint256","name":"_baseToTreasury","type":"uint256"},{"internalType":"uint256","name":"_baseToFarmer","type":"uint256"}],"name":"setFeeDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_new","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_new","type":"address"}],"name":"setGovernanceRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"setHotWalletHoldings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"bool[]","name":"_noLock","type":"bool[]"}],"name":"setNoLockWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"setRebalanceUpLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"setRebalanceUpWaitTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"setWaitPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"sharesOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userDeposits","outputs":[{"internalType":"uint256","name":"amountUnderlyingLocked","type":"uint256"},{"internalType":"uint256","name":"timestampDeposit","type":"uint256"},{"internalType":"uint256","name":"timestampUnlocked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"waitPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountUnderlying","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052600c805461ffff60a01b191690556103e8600d819055600e8190556064600f81905560108190556011556201437060125562093a806014556015553480156200004c57600080fd5b5060405162003a8538038062003a85833981810160405260608110156200007257600080fd5b81019080805160405193929190846401000000008211156200009357600080fd5b908301906020820185811115620000a957600080fd5b8251640100000000811182820188101715620000c457600080fd5b82525081516020918201929091019080838360005b83811015620000f3578181015183820152602001620000d9565b50505050905090810190601f168015620001215780820380516001836020036101000a031916815260200191505b5060408181526020838101519390910151600160005570029ba30b1b5b2b9102b32b73a3ab932b99607d1b8284019081528751949650909450869386938693869392603190920191908401908083835b60208310620001925780518252601f19909201916020918201910162000171565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040516020018082805190602001908083835b60208310620001fa5780518252601f199092019160209182019101620001d9565b51815160209384036101000a60001901801990921691161790526220763160e81b9190930190815260408051808303601c190181526003909201905280516200024d955060049450920191905062000353565b5082604051602001808064737461636b60d81b81525060050182805190602001908083835b60208310620002935780518252601f19909201916020918201910162000272565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405260059080519060200190620002de92919062000353565b508251620002f490600690602086019062000353565b50600780546001600160a01b039092166001600160a01b031960ff909416600160a01b0260ff60a01b19909316929092178316919091179055600a8054821633908117909155600b805490921617905550504260135550620003ef9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200039657805160ff1916838001178555620003c6565b82800160010185558215620003c6579182015b82811115620003c6578251825591602001919060010190620003a9565b50620003d4929150620003d8565b5090565b5b80821115620003d45760008155600101620003d9565b61368680620003ff6000396000f3fe608060405234801561001057600080fd5b50600436106103275760003560e01c80636e553f65116101b8578063ab033ea911610104578063d5836ce8116100a2578063e54542b21161007c578063e54542b214610865578063ed3efad51461086d578063f5eb42dc1461092f578063fb6cc8821461095557610327565b8063d5836ce814610827578063dd2a1eab1461082f578063dd62ed3e1461083757610327565b8063b76e6be2116100de578063b76e6be2146107dc578063bf361544146107f9578063c70920bc146104ee578063c7c863f01461081f57610327565b8063ab033ea91461076b578063b0f122c114610791578063b4f82fdc146107b657610327565b80638456cb5911610171578063929ec5371161014b578063929ec537146106eb57806395d89b41146107115780639b0fbe4914610719578063a9059cbb1461073f57610327565b80638456cb59146106d3578063852b1901146106db5780638e26c09d146106e357610327565b80636e553f651461063d5780636f307dc31461066957806370a0823114610671578063797aeb99146106975780637a4e4ecf1461069f5780637f7d9a06146106cb57610327565b8063313ce567116102775780635aa6e675116102305780636068d6cb1161020a5780636068d6cb1461061d57806363d8882a146106255780636a62dd541461062d5780636ac5db191461063557610327565b80635aa6e675146106055780635c975abb1461060d5780635dfbaeaf1461061557610327565b8063313ce5671461056e5780633a98ef391461058c5780633f4ba83a1461059457806347662b381461059c5780634aa3c302146105b95780634e118982146105e857610327565b80630ba36dcd116102e4578063222a528f116102be578063222a528f146104f657806323b872dd146105135780632676440e146105495780632e1a7d4d1461055157610327565b80630ba36dcd1461048657806310cfe906146104ca57806318160ddd146104ee57610327565b8063013a6edd1461032c578063021919801461035b57806306fdde031461036557806307336908146103e2578063095ea7b3146104295780630b598a6814610469575b600080fd5b6103496004803603602081101561034257600080fd5b503561095d565b60408051918252519081900360200190f35b6103636109aa565b005b61036d610a0c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a757818101518382015260200161038f565b50505050905090810190601f1680156103d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61040e600480360360408110156103f857600080fd5b50803590602001356001600160a01b0316610a9a565b60408051921515835260208301919091528051918290030190f35b6104556004803603604081101561043f57600080fd5b506001600160a01b038135169060200135610d89565b604080519115158252519081900360200190f35b6103636004803603602081101561047f57600080fd5b5035610da0565b6104ac6004803603602081101561049c57600080fd5b50356001600160a01b0316610e41565b60408051938452602084019290925282820152519081900360600190f35b6104d2610e62565b604080516001600160a01b039092168252519081900360200190f35b610349610e71565b6103636004803603602081101561050c57600080fd5b5035610e80565b6104556004803603606081101561052957600080fd5b506001600160a01b03813581169160208101359091169060400135610f2a565b610349610fc5565b6103636004803603602081101561056757600080fd5b5035610fcb565b6105766110e8565b6040805160ff9092168252519081900360200190f35b6103496110f8565b6103636110fe565b610363600480360360208110156105b257600080fd5b503561115a565b610363600480360360808110156105cf57600080fd5b5080359060208101359060408101359060600135611204565b610349600480360360208110156105fe57600080fd5b503561130e565b6104d261133b565b61045561134a565b61034961135a565b610455611360565b610363611370565b6103496113cc565b6103496113d2565b6103636004803603604081101561065357600080fd5b50803590602001356001600160a01b03166113d8565b61036d61166d565b6103496004803603602081101561068757600080fd5b50356001600160a01b03166116c8565b6104d26116db565b610363600480360360408110156106b557600080fd5b506001600160a01b0381351690602001356116ea565b6103496117f5565b6103636117fb565b6104d261185d565b61034961186c565b6103496004803603602081101561070157600080fd5b50356001600160a01b0316611872565b61036d6118ca565b6103636004803603602081101561072f57600080fd5b50356001600160a01b0316611925565b6104556004803603604081101561075557600080fd5b506001600160a01b038135169060200135611994565b6103636004803603602081101561078157600080fd5b50356001600160a01b03166119ab565b61040e600480360360408110156107a757600080fd5b50803590602001351515611a1a565b610455600480360360208110156107cc57600080fd5b50356001600160a01b0316611b69565b610363600480360360208110156107f257600080fd5b5035611b7e565b6103636004803603602081101561080f57600080fd5b50356001600160a01b0316611c1e565b610349611c8d565b610349611c93565b610349611c99565b6103496004803603604081101561084d57600080fd5b506001600160a01b0381358116916020013516611c9f565b610349611cca565b6103636004803603604081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460208302840111640100000000831117156108d257600080fd5b9193909290916020810190356401000000008111156108f057600080fd5b82018360208201111561090257600080fd5b8035906020019184602083028401116401000000008311171561092457600080fd5b509092509050611cd0565b6103496004803603602081101561094557600080fd5b50356001600160a01b0316611dd8565b610349611de3565b6003546000908061097157829150506109a5565b600061097b611de9565b90508061098c5783925050506109a5565b6109a08261099a8684611e7c565b90611ed5565b925050505b919050565b600a546001600160a01b031633146109f7576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a81b1916600160a81b179055565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b820191906000526020600020905b815481529060010190602001808311610a7557829003601f168201915b505050505081565b60008060026000541415610ae3576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600c546001600160a01b03163314610b47576040805162461bcd60e51b815260206004820152601960248201527f4641524d545245415355525956313a20216661726d426f737300000000000000604482015290519081900360640190fd5b600c54600160a01b900460ff1615610b9f576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b8315610cf157601254601354610bb6904290611f3c565b1015610bf35760405162461bcd60e51b81526004018080602001828103825260248152602001806135186024913960400191505060405180910390fd5b83610c1161271061099a601154601654611e7c90919063ffffffff16565b1015610c4e5760405162461bcd60e51b81526004018080602001828103825260298152602001806134a26029913960400191505060405180910390fd5b601654610c5b9085611f99565b6016556000610c6a8585611ff3565b90506000610c778561214c565b9050426013819055507f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60018742610cad611de9565b6003546040805195151586526020860194909452848401929092526060840152608083015260a0820185905260c08201849052519081900360e00190a15050610d5c565b7f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60018542610d1e611de9565b60035460408051951515865260208601949094528484019290925260608401526080830152600060a0830181905260c0830152519081900360e00190a15b600080610d676122ed565b91509150610d7582826123db565b90925090505b600160005590939092509050565b6000610d96338484612665565b5060015b92915050565b600a546001600160a01b03163314610ded576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6127108110610e3c576040805162461bcd60e51b815260206004820152601660248201527508c82a49aa8a48a82a6aaa4b2ac6274407c7a40dac2f60531b604482015290519081900360640190fd5b601155565b60086020526000908152604090208054600182015460029092015490919083565b6007546001600160a01b031681565b6000610e7b611de9565b905090565b600a546001600160a01b03163314610ecd576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b62093a80811115610f25576040805162461bcd60e51b815260206004820152601860248201527f4641524d545245415355525956313a203e2031207765656b0000000000000000604482015290519081900360640190fd5b601255565b6000610f368483612777565b6001600160a01b038416600090815260026020908152604080832033845290915290205482811015610f995760405162461bcd60e51b815260040180806020018281038252602181526020018061353c6021913960400191505060405180910390fd5b610fa4858585612825565b610fb88533610fb38487611f3c565b612665565b60019150505b9392505050565b60135481565b60026000541415611011576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b600260005580611068576040805162461bcd60e51b815260206004820152601b60248201527f4641524d545245415355525956313a20616d6f756e74203d3d20300000000000604482015290519081900360640190fd5b600c54600160a01b900460ff16156110c0576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b6110c98161287c565b6007546110e0906001600160a01b031633836129b5565b506001600055565b600754600160a01b900460ff1681565b60035481565b600a546001600160a01b0316331461114b576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a01b19169055565b600a546001600160a01b031633146111a7576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b625c49008111156111ff576040805162461bcd60e51b815260206004820152601d60248201527f4641524d545245415355525956313a20746f6f206c6f6e672077616974000000604482015290519081900360640190fd5b601455565b600a546001600160a01b03163314611251576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b61271061125e8585611f99565b1061129a5760405162461bcd60e51b815260040180806020018281038252602481526020018061355d6024913960400191505060405180910390fd5b6101f46112a78383611f99565b11156112fa576040805162461bcd60e51b815260206004820152601d60248201527f4641524d545245415355525956313a20746f6f20686967682062617365000000604482015290519081900360640190fd5b600d93909355600e91909155600f55601055565b600080611319611de9565b90508061132957829150506109a5565b6003548061098c5783925050506109a5565b600a546001600160a01b031681565b600c54600160a01b900460ff1681565b60155481565b600c54600160a81b900460ff1681565b600a546001600160a01b031633146113bd576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a81b19169055565b60165481565b61271081565b6002600054141561141e576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b600260005581611475576040805162461bcd60e51b815260206004820152601b60248201527f4641524d545245415355525956313a20616d6f756e74203d3d20300000000000604482015290519081900360640190fd5b600c54600160a01b900460ff161580156114995750600c54600160a81b900460ff16155b6114e3576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b6114ed8282612a0c565b600754604080516370a0823160e01b815230600482015290516001600160a01b039092169160009183916370a0823191602480820192602092909190829003018186803b15801561153d57600080fd5b505afa158015611551573d6000803e3d6000fd5b505050506040513d602081101561156757600080fd5b505190506115806001600160a01b038316333087612af6565b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115cf57600080fd5b505afa1580156115e3573d6000803e3d6000fd5b505050506040513d60208110156115f957600080fd5b5051905060006116098284611f3c565b905085811015611660576040805162461bcd60e51b815260206004820152601c60248201527f4641524d545245415355525956313a20626164207472616e7366657200000000604482015290519081900360640190fd5b5050600160005550505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b6000610d9a6116d683612b56565b61095d565b600b546001600160a01b031681565b60026000541415611730576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600a546001600160a01b03163314611782576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6001600160a01b038216156117b057600a546117ab906001600160a01b038481169116836129b5565b6117ec565b600a546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156117ea573d6000803e3d6000fd5b505b50506001600055565b600f5481565b600a546001600160a01b03163314611848576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a01b1916600160a01b179055565b600c546001600160a01b031681565b60145481565b600061187c613389565b506001600160a01b03821660009081526008602090815260409182902082516060810184528154808252600183015493820184905260029092015493810184905292610fbe92869291612b71565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b600a546001600160a01b03163314611972576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60006119a03383612777565b610d96338484612825565b600a546001600160a01b031633146119f8576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60008060026000541415611a63576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600a546001600160a01b03163314611ab5576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b601654611ac29085611f3c565b6016558215611aee57600080611ad66122ed565b91509150611ae482826123db565b9092509050610d7b565b7f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60008542611b1b611de9565b60035460408051951515865260208601949094528484019290925260608401526080830152600060a0830181905260c0830152519081900360e00190a1505060016000908155928392509050565b60096020526000908152604090205460ff1681565b600a546001600160a01b03163314611bcb576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6127108111158015611bde575060648110155b611c195760405162461bcd60e51b81526004018080602001828103825260258152602001806136026025913960400191505060405180910390fd5b601555565b600a546001600160a01b03163314611c6b576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600e5481565b60105481565b60115481565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b60125481565b600a546001600160a01b03163314611d1d576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b8281148015611d2d575060c88311155b611d685760405162461bcd60e51b81526004018080602001828103825260238152602001806134496023913960400191505060405180910390fd5b60005b83811015611dd157828282818110611d7f57fe5b90506020020135151560096000878785818110611d9857fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101611d6b565b5050505050565b6000610d9a82612b56565b600d5481565b600754604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015611e3957600080fd5b505afa158015611e4d573d6000803e3d6000fd5b505050506040513d6020811015611e6357600080fd5b5051601654909150611e758282611f99565b9250505090565b600082611e8b57506000610d9a565b82820282848281611e9857fe5b0414610fbe5760405162461bcd60e51b81526004018080602001828103825260218152602001806134f76021913960400191505060405180910390fd5b6000808211611f2b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611f3457fe5b049392505050565b600082821115611f93576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610fbe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60035460009081612002611de9565b9050600061202161271061099a600e5489611e7c90919063ffffffff16565b9050600061204061271061099a600d548a611e7c90919063ffffffff16565b9050600061204e8383611f99565b90508061206357600095505050505050610d9a565b6000612070828688612bde565b905060006120828361099a8488611e7c565b905060006120908383611f3c565b905061209c8a83612c01565b600b546120b2906001600160a01b031682612c01565b60006120bd8361095d565b905060006120ca8361095d565b6040805184815290519192506001600160a01b038e1691600091600080516020613581833981519152919081900360200190a3600b546040805183815290516001600160a01b0390921691600091600080516020613581833981519152919081900360200190a361213b8282611f99565b9d9c50505050505050505050505050565b6013546000904281106121635760009150506109a5565b600061216f4283611f3c565b600354909150600061217f611de9565b905060006121956301e1338061099a8487611e7c565b905060006121b461271061099a60105485611e7c90919063ffffffff16565b905060006121d361271061099a60105486611e7c90919063ffffffff16565b905060006121e18383611f99565b9050806121f9576000985050505050505050506109a5565b6000612206828789612bde565b905060006122188361099a8488611e7c565b905060006122268383611f3c565b90506122328d83612c01565b600b54612248906001600160a01b031682612c01565b60006122538361095d565b905060006122608361095d565b90508e6001600160a01b031660006001600160a01b0316600080516020613581833981519152846040518082815260200191505060405180910390a3600b546040805183815290516001600160a01b0390921691600091600080516020613581833981519152919081900360200190a36122da8282611f99565b9f9e505050505050505050505050505050565b600754604080516370a0823160e01b81523060048201529051600092839283926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561233f57600080fd5b505afa158015612353573d6000803e3d6000fd5b505050506040513d602081101561236957600080fd5b5051601654909150600061237d8383611f99565b9050600061239c61271061099a60155485611e7c90919063ffffffff16565b90508084106123be5760006123b18583611f3c565b95509550505050506123d7565b808410156123d25760016123b18286611f3c565b505050505b9091565b811561259657600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561242c57600080fd5b505afa158015612440573d6000803e3d6000fd5b505050506040513d602081101561245657600080fd5b5051600c54600754919250612479916001600160a01b0390811691163085612af6565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156124c457600080fd5b505afa1580156124d8573d6000803e3d6000fd5b505050506040513d60208110156124ee57600080fd5b5051905060006124fe8284611f3c565b90508381101561253f5760405162461bcd60e51b81526004018080602001828103825260368152602001806133eb6036913960400191505060405180910390fd5b60165461254c9085611f3c565b6016556040805185815260006020820152428183015290517f18a2e1f028d901921e131f7cfb6ec21bbee608f341e3ba9f27b971ccc98738ba9181900360600190a1505050612661565b600c546001600160a01b03166125f3576040805162461bcd60e51b815260206004820152601960248201527f4641524d545245415355525956313a20214661726d426f737300000000000000604482015290519081900360640190fd5b600c54600754612610916001600160a01b039182169116836129b5565b60165461261d9082611f99565b601655604080516000815260208101839052428183015290517f18a2e1f028d901921e131f7cfb6ec21bbee608f341e3ba9f27b971ccc98738ba9181900360600190a15b5050565b6001600160a01b0383166126c0576040805162461bcd60e51b815260206004820152601860248201527f4641524d544f4b454e56313a2066726f6d203d3d203078300000000000000000604482015290519081900360640190fd5b6001600160a01b038216612715576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b61277f613389565b506001600160a01b038216600090815260086020908152604080832081516060810183528154808252600183015494820185905260029092015492810183905293926127ce9287929190612b71565b905060006127db856116c8565b9050816127e88286611f3c565b1015611dd15760405162461bcd60e51b815260040180806020018281038252603681526020018061346c6036913960400191505060405180910390fd5b60006128308261130e565b905061283d848483612ca9565b826001600160a01b0316846001600160a01b0316600080516020613581833981519152846040518082815260200191505060405180910390a350505050565b6128863382612777565b600754604080516370a0823160e01b8152306004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156128d057600080fd5b505afa1580156128e4573d6000803e3d6000fd5b505050506040513d60208110156128fa57600080fd5b505110156129395760405162461bcd60e51b81526004018080602001828103825260618152602001806135a16061913960800191505060405180910390fd5b60006129448261130e565b90506129503382612e0c565b60408051838152905160009133916000805160206135818339815191529181900360200190a3604080513381526020810184905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612a07908490612efa565b505050565b6000612a178361130e565b9050612a233382612c01565b612a2d3384612fab565b6001600160a01b0382163314612a8a5760408051338152602081018590526001600160a01b0384168183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a1612acb565b604080513381526020810185905260008183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a15b60408051848152905133916000916000805160206135818339815191529181900360200190a3505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612b50908590612efa565b50505050565b6001600160a01b031660009081526001602052604090205490565b60004282111580612b9a57506001600160a01b03851660009081526009602052604090205460ff165b15612ba757506000612bd6565b6000612bb38342611f3c565b90506000612bc18486611f3c565b9050612bd18161099a8885611e7c565b925050505b949350505050565b6000612bd682612bfb612bf18688611f3c565b61099a8688611e7c565b90611f3c565b6001600160a01b038216612c56576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b600354612c639082611f99565b6003556001600160a01b038216600090815260016020526040902054612c899082611f99565b6001600160a01b0390921660009081526001602052604090209190915550565b6001600160a01b038316612d04576040805162461bcd60e51b815260206004820152601960248201527f4641524d544f4b454e56313a2066726f6d203d3d203078303000000000000000604482015290519081900360640190fd5b6001600160a01b038216612d59576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b6001600160a01b03831660009081526001602052604090205480821115612db15760405162461bcd60e51b815260040180806020018281038252602c8152602001806134cb602c913960400191505060405180910390fd5b612dbb8183611f3c565b6001600160a01b038086166000908152600160205260408082209390935590851681522054612dea9083611f99565b6001600160a01b03909316600090815260016020526040902092909255505050565b6001600160a01b038216612e67576040805162461bcd60e51b815260206004820152601e60248201527f4641524d544f4b454e56313a206275726e2066726f6d203d3d20307830300000604482015290519081900360640190fd5b6001600160a01b03821660009081526001602052604090205480821115612ebf5760405162461bcd60e51b81526004018080602001828103825260288152602001806134216028913960400191505060405180910390fd5b600354612ecc9083611f3c565b600355612ed98183611f3c565b6001600160a01b039093166000908152600160205260409020929092555050565b6060612f4f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131c49092919063ffffffff16565b805190915015612a0757808060200190516020811015612f6e57600080fd5b5051612a075760405162461bcd60e51b815260040180806020018281038252602a815260200180613627602a913960400191505060405180910390fd5b612fb3613389565b506001600160a01b03821660009081526008602090815260409182902082516060810184528154815260018201549281018390526002909101549281019290925261306657613000613389565b604051806060016040528084815260200142815260200161302c60145442611f9990919063ffffffff16565b90526001600160a01b0385166000908152600860209081526040918290208351815590830151600182015591015160029091015550612a07565b600061308084836000015184602001518560400151612b71565b9050806130f55761308f613389565b60405180606001604052808581526020014281526020016130bb60145442611f9990919063ffffffff16565b90526001600160a01b0386166000908152600860209081526040918290208351815590830151600182015591015160029091015550612b50565b6000613118613111428560400151611f3c90919063ffffffff16565b8390611e7c565b9050600061313160145486611e7c90919063ffffffff16565b9050600061313f8685611f99565b905060006131518261099a8686611f99565b905061315b613389565b60405180606001604052808481526020014281526020016131858442611f9990919063ffffffff16565b90526001600160a01b038a1660009081526008602090815260409182902083518155908301516001820155910151600290910155505050505050505050565b6060612bd68484600085856131d8856132df565b613229576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106132685780518252601f199092019160209182019101613249565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132ca576040519150601f19603f3d011682016040523d82523d6000602084013e6132cf565b606091505b5091509150612bd18282866132e5565b3b151590565b606083156132f4575081610fbe565b8251156133045782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561334e578181015183820152602001613336565b50505050905090810190601f16801561337b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060600160405280600081526020016000815260200160008152509056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c004641524d545245415355525956313a2021676f7665726e616e636500000000004641524d545245415355525956313a2062616420726562616c616e63652c20686f742077616c6c6574206e656564732066756e6473214641524d544f4b454e56313a206275726e20616d6f756e7420657863656564732062616c616e63654641524d545245415355525956313a20636865636b206172726179206c656e677468734641524d545245415355525956313a207265717565737465642066756e6473206172652074656d706f726172696c79206c6f636b65644641524d54524541535552595631205f616d6f756e74203e20726562616c616e636555704c696d69744641524d544f4b454e56313a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774641524d545245415355525956313a203c726562616c616e636555705761697454696d654641524d544f4b454e56313a206e6f7420656e6f75676820616c6c6f77616e63654641524d545245415355525956313a20746f6f206869676820706572666f726d616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef4641524d545245415355525956313a20486f742077616c6c65742062616c616e6365206465706c657465642e20506c656173652074727920736d616c6c6572207769746864726177206f72207761697420666f7220726562616c616e63696e672e4641524d545245415355525956313a20686f742077616c6c65742076616c756573206261645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220b832cc40aaeac1fd273159aa39fcc88f65a8c8511bcbec19b575c62be79632fa64736f6c634300060c0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000060000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103275760003560e01c80636e553f65116101b8578063ab033ea911610104578063d5836ce8116100a2578063e54542b21161007c578063e54542b214610865578063ed3efad51461086d578063f5eb42dc1461092f578063fb6cc8821461095557610327565b8063d5836ce814610827578063dd2a1eab1461082f578063dd62ed3e1461083757610327565b8063b76e6be2116100de578063b76e6be2146107dc578063bf361544146107f9578063c70920bc146104ee578063c7c863f01461081f57610327565b8063ab033ea91461076b578063b0f122c114610791578063b4f82fdc146107b657610327565b80638456cb5911610171578063929ec5371161014b578063929ec537146106eb57806395d89b41146107115780639b0fbe4914610719578063a9059cbb1461073f57610327565b80638456cb59146106d3578063852b1901146106db5780638e26c09d146106e357610327565b80636e553f651461063d5780636f307dc31461066957806370a0823114610671578063797aeb99146106975780637a4e4ecf1461069f5780637f7d9a06146106cb57610327565b8063313ce567116102775780635aa6e675116102305780636068d6cb1161020a5780636068d6cb1461061d57806363d8882a146106255780636a62dd541461062d5780636ac5db191461063557610327565b80635aa6e675146106055780635c975abb1461060d5780635dfbaeaf1461061557610327565b8063313ce5671461056e5780633a98ef391461058c5780633f4ba83a1461059457806347662b381461059c5780634aa3c302146105b95780634e118982146105e857610327565b80630ba36dcd116102e4578063222a528f116102be578063222a528f146104f657806323b872dd146105135780632676440e146105495780632e1a7d4d1461055157610327565b80630ba36dcd1461048657806310cfe906146104ca57806318160ddd146104ee57610327565b8063013a6edd1461032c578063021919801461035b57806306fdde031461036557806307336908146103e2578063095ea7b3146104295780630b598a6814610469575b600080fd5b6103496004803603602081101561034257600080fd5b503561095d565b60408051918252519081900360200190f35b6103636109aa565b005b61036d610a0c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a757818101518382015260200161038f565b50505050905090810190601f1680156103d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61040e600480360360408110156103f857600080fd5b50803590602001356001600160a01b0316610a9a565b60408051921515835260208301919091528051918290030190f35b6104556004803603604081101561043f57600080fd5b506001600160a01b038135169060200135610d89565b604080519115158252519081900360200190f35b6103636004803603602081101561047f57600080fd5b5035610da0565b6104ac6004803603602081101561049c57600080fd5b50356001600160a01b0316610e41565b60408051938452602084019290925282820152519081900360600190f35b6104d2610e62565b604080516001600160a01b039092168252519081900360200190f35b610349610e71565b6103636004803603602081101561050c57600080fd5b5035610e80565b6104556004803603606081101561052957600080fd5b506001600160a01b03813581169160208101359091169060400135610f2a565b610349610fc5565b6103636004803603602081101561056757600080fd5b5035610fcb565b6105766110e8565b6040805160ff9092168252519081900360200190f35b6103496110f8565b6103636110fe565b610363600480360360208110156105b257600080fd5b503561115a565b610363600480360360808110156105cf57600080fd5b5080359060208101359060408101359060600135611204565b610349600480360360208110156105fe57600080fd5b503561130e565b6104d261133b565b61045561134a565b61034961135a565b610455611360565b610363611370565b6103496113cc565b6103496113d2565b6103636004803603604081101561065357600080fd5b50803590602001356001600160a01b03166113d8565b61036d61166d565b6103496004803603602081101561068757600080fd5b50356001600160a01b03166116c8565b6104d26116db565b610363600480360360408110156106b557600080fd5b506001600160a01b0381351690602001356116ea565b6103496117f5565b6103636117fb565b6104d261185d565b61034961186c565b6103496004803603602081101561070157600080fd5b50356001600160a01b0316611872565b61036d6118ca565b6103636004803603602081101561072f57600080fd5b50356001600160a01b0316611925565b6104556004803603604081101561075557600080fd5b506001600160a01b038135169060200135611994565b6103636004803603602081101561078157600080fd5b50356001600160a01b03166119ab565b61040e600480360360408110156107a757600080fd5b50803590602001351515611a1a565b610455600480360360208110156107cc57600080fd5b50356001600160a01b0316611b69565b610363600480360360208110156107f257600080fd5b5035611b7e565b6103636004803603602081101561080f57600080fd5b50356001600160a01b0316611c1e565b610349611c8d565b610349611c93565b610349611c99565b6103496004803603604081101561084d57600080fd5b506001600160a01b0381358116916020013516611c9f565b610349611cca565b6103636004803603604081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460208302840111640100000000831117156108d257600080fd5b9193909290916020810190356401000000008111156108f057600080fd5b82018360208201111561090257600080fd5b8035906020019184602083028401116401000000008311171561092457600080fd5b509092509050611cd0565b6103496004803603602081101561094557600080fd5b50356001600160a01b0316611dd8565b610349611de3565b6003546000908061097157829150506109a5565b600061097b611de9565b90508061098c5783925050506109a5565b6109a08261099a8684611e7c565b90611ed5565b925050505b919050565b600a546001600160a01b031633146109f7576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a81b1916600160a81b179055565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b820191906000526020600020905b815481529060010190602001808311610a7557829003601f168201915b505050505081565b60008060026000541415610ae3576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600c546001600160a01b03163314610b47576040805162461bcd60e51b815260206004820152601960248201527f4641524d545245415355525956313a20216661726d426f737300000000000000604482015290519081900360640190fd5b600c54600160a01b900460ff1615610b9f576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b8315610cf157601254601354610bb6904290611f3c565b1015610bf35760405162461bcd60e51b81526004018080602001828103825260248152602001806135186024913960400191505060405180910390fd5b83610c1161271061099a601154601654611e7c90919063ffffffff16565b1015610c4e5760405162461bcd60e51b81526004018080602001828103825260298152602001806134a26029913960400191505060405180910390fd5b601654610c5b9085611f99565b6016556000610c6a8585611ff3565b90506000610c778561214c565b9050426013819055507f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60018742610cad611de9565b6003546040805195151586526020860194909452848401929092526060840152608083015260a0820185905260c08201849052519081900360e00190a15050610d5c565b7f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60018542610d1e611de9565b60035460408051951515865260208601949094528484019290925260608401526080830152600060a0830181905260c0830152519081900360e00190a15b600080610d676122ed565b91509150610d7582826123db565b90925090505b600160005590939092509050565b6000610d96338484612665565b5060015b92915050565b600a546001600160a01b03163314610ded576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6127108110610e3c576040805162461bcd60e51b815260206004820152601660248201527508c82a49aa8a48a82a6aaa4b2ac6274407c7a40dac2f60531b604482015290519081900360640190fd5b601155565b60086020526000908152604090208054600182015460029092015490919083565b6007546001600160a01b031681565b6000610e7b611de9565b905090565b600a546001600160a01b03163314610ecd576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b62093a80811115610f25576040805162461bcd60e51b815260206004820152601860248201527f4641524d545245415355525956313a203e2031207765656b0000000000000000604482015290519081900360640190fd5b601255565b6000610f368483612777565b6001600160a01b038416600090815260026020908152604080832033845290915290205482811015610f995760405162461bcd60e51b815260040180806020018281038252602181526020018061353c6021913960400191505060405180910390fd5b610fa4858585612825565b610fb88533610fb38487611f3c565b612665565b60019150505b9392505050565b60135481565b60026000541415611011576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b600260005580611068576040805162461bcd60e51b815260206004820152601b60248201527f4641524d545245415355525956313a20616d6f756e74203d3d20300000000000604482015290519081900360640190fd5b600c54600160a01b900460ff16156110c0576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b6110c98161287c565b6007546110e0906001600160a01b031633836129b5565b506001600055565b600754600160a01b900460ff1681565b60035481565b600a546001600160a01b0316331461114b576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a01b19169055565b600a546001600160a01b031633146111a7576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b625c49008111156111ff576040805162461bcd60e51b815260206004820152601d60248201527f4641524d545245415355525956313a20746f6f206c6f6e672077616974000000604482015290519081900360640190fd5b601455565b600a546001600160a01b03163314611251576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b61271061125e8585611f99565b1061129a5760405162461bcd60e51b815260040180806020018281038252602481526020018061355d6024913960400191505060405180910390fd5b6101f46112a78383611f99565b11156112fa576040805162461bcd60e51b815260206004820152601d60248201527f4641524d545245415355525956313a20746f6f20686967682062617365000000604482015290519081900360640190fd5b600d93909355600e91909155600f55601055565b600080611319611de9565b90508061132957829150506109a5565b6003548061098c5783925050506109a5565b600a546001600160a01b031681565b600c54600160a01b900460ff1681565b60155481565b600c54600160a81b900460ff1681565b600a546001600160a01b031633146113bd576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a81b19169055565b60165481565b61271081565b6002600054141561141e576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b600260005581611475576040805162461bcd60e51b815260206004820152601b60248201527f4641524d545245415355525956313a20616d6f756e74203d3d20300000000000604482015290519081900360640190fd5b600c54600160a01b900460ff161580156114995750600c54600160a81b900460ff16155b6114e3576040805162461bcd60e51b8152602060048201526016602482015275119054935514915054d55496558c4e881c185d5cd95960521b604482015290519081900360640190fd5b6114ed8282612a0c565b600754604080516370a0823160e01b815230600482015290516001600160a01b039092169160009183916370a0823191602480820192602092909190829003018186803b15801561153d57600080fd5b505afa158015611551573d6000803e3d6000fd5b505050506040513d602081101561156757600080fd5b505190506115806001600160a01b038316333087612af6565b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115cf57600080fd5b505afa1580156115e3573d6000803e3d6000fd5b505050506040513d60208110156115f957600080fd5b5051905060006116098284611f3c565b905085811015611660576040805162461bcd60e51b815260206004820152601c60248201527f4641524d545245415355525956313a20626164207472616e7366657200000000604482015290519081900360640190fd5b5050600160005550505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b6000610d9a6116d683612b56565b61095d565b600b546001600160a01b031681565b60026000541415611730576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600a546001600160a01b03163314611782576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6001600160a01b038216156117b057600a546117ab906001600160a01b038481169116836129b5565b6117ec565b600a546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156117ea573d6000803e3d6000fd5b505b50506001600055565b600f5481565b600a546001600160a01b03163314611848576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c805460ff60a01b1916600160a01b179055565b600c546001600160a01b031681565b60145481565b600061187c613389565b506001600160a01b03821660009081526008602090815260409182902082516060810184528154808252600183015493820184905260029092015493810184905292610fbe92869291612b71565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b600a546001600160a01b03163314611972576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60006119a03383612777565b610d96338484612825565b600a546001600160a01b031633146119f8576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60008060026000541415611a63576040805162461bcd60e51b815260206004820152601f60248201526000805160206133ab833981519152604482015290519081900360640190fd5b6002600055600a546001600160a01b03163314611ab5576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b601654611ac29085611f3c565b6016558215611aee57600080611ad66122ed565b91509150611ae482826123db565b9092509050610d7b565b7f133173a0deb39808464c88239fe745075919e0093d1a15670d29eaade2f5dbca60008542611b1b611de9565b60035460408051951515865260208601949094528484019290925260608401526080830152600060a0830181905260c0830152519081900360e00190a1505060016000908155928392509050565b60096020526000908152604090205460ff1681565b600a546001600160a01b03163314611bcb576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b6127108111158015611bde575060648110155b611c195760405162461bcd60e51b81526004018080602001828103825260258152602001806136026025913960400191505060405180910390fd5b601555565b600a546001600160a01b03163314611c6b576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600e5481565b60105481565b60115481565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b60125481565b600a546001600160a01b03163314611d1d576040805162461bcd60e51b815260206004820152601b60248201526000805160206133cb833981519152604482015290519081900360640190fd5b8281148015611d2d575060c88311155b611d685760405162461bcd60e51b81526004018080602001828103825260238152602001806134496023913960400191505060405180910390fd5b60005b83811015611dd157828282818110611d7f57fe5b90506020020135151560096000878785818110611d9857fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101611d6b565b5050505050565b6000610d9a82612b56565b600d5481565b600754604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015611e3957600080fd5b505afa158015611e4d573d6000803e3d6000fd5b505050506040513d6020811015611e6357600080fd5b5051601654909150611e758282611f99565b9250505090565b600082611e8b57506000610d9a565b82820282848281611e9857fe5b0414610fbe5760405162461bcd60e51b81526004018080602001828103825260218152602001806134f76021913960400191505060405180910390fd5b6000808211611f2b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611f3457fe5b049392505050565b600082821115611f93576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610fbe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60035460009081612002611de9565b9050600061202161271061099a600e5489611e7c90919063ffffffff16565b9050600061204061271061099a600d548a611e7c90919063ffffffff16565b9050600061204e8383611f99565b90508061206357600095505050505050610d9a565b6000612070828688612bde565b905060006120828361099a8488611e7c565b905060006120908383611f3c565b905061209c8a83612c01565b600b546120b2906001600160a01b031682612c01565b60006120bd8361095d565b905060006120ca8361095d565b6040805184815290519192506001600160a01b038e1691600091600080516020613581833981519152919081900360200190a3600b546040805183815290516001600160a01b0390921691600091600080516020613581833981519152919081900360200190a361213b8282611f99565b9d9c50505050505050505050505050565b6013546000904281106121635760009150506109a5565b600061216f4283611f3c565b600354909150600061217f611de9565b905060006121956301e1338061099a8487611e7c565b905060006121b461271061099a60105485611e7c90919063ffffffff16565b905060006121d361271061099a60105486611e7c90919063ffffffff16565b905060006121e18383611f99565b9050806121f9576000985050505050505050506109a5565b6000612206828789612bde565b905060006122188361099a8488611e7c565b905060006122268383611f3c565b90506122328d83612c01565b600b54612248906001600160a01b031682612c01565b60006122538361095d565b905060006122608361095d565b90508e6001600160a01b031660006001600160a01b0316600080516020613581833981519152846040518082815260200191505060405180910390a3600b546040805183815290516001600160a01b0390921691600091600080516020613581833981519152919081900360200190a36122da8282611f99565b9f9e505050505050505050505050505050565b600754604080516370a0823160e01b81523060048201529051600092839283926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561233f57600080fd5b505afa158015612353573d6000803e3d6000fd5b505050506040513d602081101561236957600080fd5b5051601654909150600061237d8383611f99565b9050600061239c61271061099a60155485611e7c90919063ffffffff16565b90508084106123be5760006123b18583611f3c565b95509550505050506123d7565b808410156123d25760016123b18286611f3c565b505050505b9091565b811561259657600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561242c57600080fd5b505afa158015612440573d6000803e3d6000fd5b505050506040513d602081101561245657600080fd5b5051600c54600754919250612479916001600160a01b0390811691163085612af6565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156124c457600080fd5b505afa1580156124d8573d6000803e3d6000fd5b505050506040513d60208110156124ee57600080fd5b5051905060006124fe8284611f3c565b90508381101561253f5760405162461bcd60e51b81526004018080602001828103825260368152602001806133eb6036913960400191505060405180910390fd5b60165461254c9085611f3c565b6016556040805185815260006020820152428183015290517f18a2e1f028d901921e131f7cfb6ec21bbee608f341e3ba9f27b971ccc98738ba9181900360600190a1505050612661565b600c546001600160a01b03166125f3576040805162461bcd60e51b815260206004820152601960248201527f4641524d545245415355525956313a20214661726d426f737300000000000000604482015290519081900360640190fd5b600c54600754612610916001600160a01b039182169116836129b5565b60165461261d9082611f99565b601655604080516000815260208101839052428183015290517f18a2e1f028d901921e131f7cfb6ec21bbee608f341e3ba9f27b971ccc98738ba9181900360600190a15b5050565b6001600160a01b0383166126c0576040805162461bcd60e51b815260206004820152601860248201527f4641524d544f4b454e56313a2066726f6d203d3d203078300000000000000000604482015290519081900360640190fd5b6001600160a01b038216612715576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b61277f613389565b506001600160a01b038216600090815260086020908152604080832081516060810183528154808252600183015494820185905260029092015492810183905293926127ce9287929190612b71565b905060006127db856116c8565b9050816127e88286611f3c565b1015611dd15760405162461bcd60e51b815260040180806020018281038252603681526020018061346c6036913960400191505060405180910390fd5b60006128308261130e565b905061283d848483612ca9565b826001600160a01b0316846001600160a01b0316600080516020613581833981519152846040518082815260200191505060405180910390a350505050565b6128863382612777565b600754604080516370a0823160e01b8152306004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156128d057600080fd5b505afa1580156128e4573d6000803e3d6000fd5b505050506040513d60208110156128fa57600080fd5b505110156129395760405162461bcd60e51b81526004018080602001828103825260618152602001806135a16061913960800191505060405180910390fd5b60006129448261130e565b90506129503382612e0c565b60408051838152905160009133916000805160206135818339815191529181900360200190a3604080513381526020810184905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612a07908490612efa565b505050565b6000612a178361130e565b9050612a233382612c01565b612a2d3384612fab565b6001600160a01b0382163314612a8a5760408051338152602081018590526001600160a01b0384168183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a1612acb565b604080513381526020810185905260008183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a15b60408051848152905133916000916000805160206135818339815191529181900360200190a3505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612b50908590612efa565b50505050565b6001600160a01b031660009081526001602052604090205490565b60004282111580612b9a57506001600160a01b03851660009081526009602052604090205460ff165b15612ba757506000612bd6565b6000612bb38342611f3c565b90506000612bc18486611f3c565b9050612bd18161099a8885611e7c565b925050505b949350505050565b6000612bd682612bfb612bf18688611f3c565b61099a8688611e7c565b90611f3c565b6001600160a01b038216612c56576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b600354612c639082611f99565b6003556001600160a01b038216600090815260016020526040902054612c899082611f99565b6001600160a01b0390921660009081526001602052604090209190915550565b6001600160a01b038316612d04576040805162461bcd60e51b815260206004820152601960248201527f4641524d544f4b454e56313a2066726f6d203d3d203078303000000000000000604482015290519081900360640190fd5b6001600160a01b038216612d59576040805162461bcd60e51b815260206004820152601760248201527604641524d544f4b454e56313a20746f203d3d203078303604c1b604482015290519081900360640190fd5b6001600160a01b03831660009081526001602052604090205480821115612db15760405162461bcd60e51b815260040180806020018281038252602c8152602001806134cb602c913960400191505060405180910390fd5b612dbb8183611f3c565b6001600160a01b038086166000908152600160205260408082209390935590851681522054612dea9083611f99565b6001600160a01b03909316600090815260016020526040902092909255505050565b6001600160a01b038216612e67576040805162461bcd60e51b815260206004820152601e60248201527f4641524d544f4b454e56313a206275726e2066726f6d203d3d20307830300000604482015290519081900360640190fd5b6001600160a01b03821660009081526001602052604090205480821115612ebf5760405162461bcd60e51b81526004018080602001828103825260288152602001806134216028913960400191505060405180910390fd5b600354612ecc9083611f3c565b600355612ed98183611f3c565b6001600160a01b039093166000908152600160205260409020929092555050565b6060612f4f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131c49092919063ffffffff16565b805190915015612a0757808060200190516020811015612f6e57600080fd5b5051612a075760405162461bcd60e51b815260040180806020018281038252602a815260200180613627602a913960400191505060405180910390fd5b612fb3613389565b506001600160a01b03821660009081526008602090815260409182902082516060810184528154815260018201549281018390526002909101549281019290925261306657613000613389565b604051806060016040528084815260200142815260200161302c60145442611f9990919063ffffffff16565b90526001600160a01b0385166000908152600860209081526040918290208351815590830151600182015591015160029091015550612a07565b600061308084836000015184602001518560400151612b71565b9050806130f55761308f613389565b60405180606001604052808581526020014281526020016130bb60145442611f9990919063ffffffff16565b90526001600160a01b0386166000908152600860209081526040918290208351815590830151600182015591015160029091015550612b50565b6000613118613111428560400151611f3c90919063ffffffff16565b8390611e7c565b9050600061313160145486611e7c90919063ffffffff16565b9050600061313f8685611f99565b905060006131518261099a8686611f99565b905061315b613389565b60405180606001604052808481526020014281526020016131858442611f9990919063ffffffff16565b90526001600160a01b038a1660009081526008602090815260409182902083518155908301516001820155910151600290910155505050505050505050565b6060612bd68484600085856131d8856132df565b613229576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106132685780518252601f199092019160209182019101613249565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132ca576040519150601f19603f3d011682016040523d82523d6000602084013e6132cf565b606091505b5091509150612bd18282866132e5565b3b151590565b606083156132f4575081610fbe565b8251156133045782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561334e578181015183820152602001613336565b50505050905090810190601f16801561337b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060600160405280600081526020016000815260200160008152509056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c004641524d545245415355525956313a2021676f7665726e616e636500000000004641524d545245415355525956313a2062616420726562616c616e63652c20686f742077616c6c6574206e656564732066756e6473214641524d544f4b454e56313a206275726e20616d6f756e7420657863656564732062616c616e63654641524d545245415355525956313a20636865636b206172726179206c656e677468734641524d545245415355525956313a207265717565737465642066756e6473206172652074656d706f726172696c79206c6f636b65644641524d54524541535552595631205f616d6f756e74203e20726562616c616e636555704c696d69744641524d544f4b454e56313a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774641524d545245415355525956313a203c726562616c616e636555705761697454696d654641524d544f4b454e56313a206e6f7420656e6f75676820616c6c6f77616e63654641524d545245415355525956313a20746f6f206869676820706572666f726d616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef4641524d545245415355525956313a20486f742077616c6c65742062616c616e6365206465706c657465642e20506c656173652074727920736d616c6c6572207769746864726177206f72207761697420666f7220726562616c616e63696e672e4641524d545245415355525956313a20686f742077616c6c65742076616c756573206261645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220b832cc40aaeac1fd273159aa39fcc88f65a8c8511bcbec19b575c62be79632fa64736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000060000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _nameUnderlying (string): USDC
Arg [1] : _decimalsUnderlying (uint8): 6
Arg [2] : _underlying (address): 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [2] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [4] : 5553444300000000000000000000000000000000000000000000000000000000
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.