Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- KanvasStrategyForRubyV2Staking
- Optimization enabled
- true
- Compiler version
- v0.8.11+commit.d7f03943
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2022-08-19T04:09:51.869888Z
Constructor Arguments
0000000000000000000000003dc0c9f53cedeeb5afabc77885dc5d9b1195d030000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b0000000000000000000000000000000000000000000000000000000000000003
Arg [0] (address) : 0x3dc0c9f53cedeeb5afabc77885dc5d9b1195d030
Arg [1] (address) : 0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b
Arg [2] (uint256) : 3
Contract source code
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.3 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /* // File contracts/interfaces/IRubyChef.sol pragma solidity >=0.5.0; interface IRubyChef { struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. RUBYs to distribute per second. uint256 lastRewardTimestamp; // Last timestamp that RUBYs distribution occurs. uint256 accRubyPerShare; // Accumulated RUBYs per share, times 1e12. See below. address rewarder; } function poolInfo(uint256 pid) external view returns (PoolInfo memory); function totalAllocPoint() external view returns (uint256); function pendingTokens(uint256 _pid, address _user) external view returns (uint256 pendingRuby, address bonusTokenAddress, string memory bonusTokenSymbol, uint256 pendingBonusToken); function rewarderBonusTokenInfo(uint256 _pid) external view returns (address bonusTokenAddress, string memory bonusTokenSymbol); function updatePool(uint256 _pid) external; function deposit(uint256 _pid, uint256 _amount) external; function withdraw(uint256 _pid, uint256 _amount) external; function emergencyWithdraw(uint256 _pid) external; function userInfo(uint256 pid, address user) external view returns (uint256 amount, uint256 rewardDebt); } */ // File contracts/interfaces/IRouter.sol pragma solidity >=0.5.0; interface IRouter { function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityKAVA( address token, uint amountTokenDesired, uint amountTokenMin, uint amountKAVAMin, address to, uint deadline) external payable returns (uint amountToken, uint amountKAVA, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline) external returns (uint amountA, uint amountB); function removeLiquidityKAVA( address token, uint liquidity, uint amountTokenMin, uint amountKAVAMin, address to, uint deadline) external returns (uint amountToken, uint amountKAVA); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) external returns (uint amountA, uint amountB); function removeLiquidityKAVAWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountKAVAMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) external returns (uint amountToken, uint amountKAVA); function removeLiquidityKAVASupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountKAVAMin, address to, uint deadline) external returns (uint amountKAVA); function removeLiquidityKAVAWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountKAVAMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) external returns (uint amountKAVA); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactKAVAForTokens( uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactKAVA( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForKAVA( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapKAVAForExactTokens( uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external; function swapExactKAVAForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline) external payable; function swapExactTokensForKAVASupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external; function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] memory path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] memory path) external view returns (uint[] memory amounts); } // File contracts/interfaces/IKanvasStrategy.sol pragma solidity >=0.5.0; //owned by the ArtStudio contract interface IKanvasStrategy { //pending tokens for the user function pendingTokens(address user) external view returns(address[] memory tokens, uint256[] memory amounts); // Deposit amount of tokens for 'caller' to address 'to' function deposit(address caller, address to, uint256 tokenAmount, uint256 shareAmount) external; // Transfer tokens from strategy for 'caller' to address 'to' function withdraw(address caller, address to, uint256 tokenAmount, uint256 shareAmount) external; function inCaseTokensGetStuck(IERC20 token, address to, uint256 amount) external; function migrate(address newStrategy) external; function onMigration() external; function transferOwnership(address newOwner) external; function setPerformanceFeeBips(uint256 newPerformanceFeeBips) external; } // File contracts/interfaces/IArtStudio.sol pragma solidity >=0.5.0; interface IArtStudio { struct TokenInfo { address rewarder; // Address of rewarder for token address strategy; // Address of strategy for token uint256 lastRewardTime; // Last time that KANVAS distribution occurred for this token uint256 lastCumulativeReward; // Value of cumulativeAvgZraconPerWeightedDollar at last update uint256 storedPrice; // Latest value of token uint256 accSKANVASPerShare; // Accumulated KANVAS per share, times ACC_KANVAS_PRECISION. uint256 totalShares; //total number of shares for the token uint256 totalTokens; //total number of tokens deposited uint128 multiplier; // multiplier for this token uint16 withdrawFeeBP; // Withdrawal fee in basis points } function KANVAS() external view returns (address); //function KANVAS() external view returns (address); function strategyPool() external view returns (address); function performanceFeeAddress() external view returns (address); function updatePrice(address token, uint256 newPrice) external; function updatePrices(address[] calldata tokens, uint256[] calldata newPrices) external; function tokenList() external view returns (address[] memory); function tokenParameters(address tokenAddress) external view returns (TokenInfo memory); function deposit(address token, uint256 amount, address to) external; function harvest(address token, address to) external; function withdraw(address token, uint256 amountShares, address to) external; } // File @openzeppelin/contracts/utils/Context.sol@v4.3.3 pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File @openzeppelin/contracts/access/Ownable.sol@v4.3.3 pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/utils/Address.sol@v4.3.3 pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // 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; 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"); (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"); (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"); (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"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol@v4.3.3 pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using 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' 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File contracts/KanvasStrategyBase.sol pragma solidity ^0.8.6; contract KanvasStrategyBase is IKanvasStrategy, Ownable { using SafeERC20 for IERC20; IArtStudio public immutable artStudio; IERC20 public immutable depositToken; uint256 public performanceFeeBips = 1000; uint256 internal constant MAX_UINT = 115792089237316195423570985008687907853269984665640564039457584007913129639935; uint256 internal constant ACC_KANVAS_PRECISION = 1e18; uint256 internal constant MAX_BIPS = 10000; constructor( IArtStudio _artStudio, IERC20 _depositToken ){ require(address(_artStudio) != address(0) && address(_depositToken) != address(0),"zero bad"); artStudio = _artStudio; depositToken = _depositToken; transferOwnership(address(_artStudio)); } function pendingTokens(address) external view virtual override returns(address[] memory, uint256[] memory) { address[] memory tokens = new address[](0); uint256[] memory amounts = new uint256[](0); return (tokens, amounts); } function deposit(address, address, uint256, uint256) external virtual override onlyOwner { } function withdraw(address, address to, uint256 tokenAmount, uint256) external virtual override onlyOwner { if (tokenAmount > 0) { depositToken.safeTransfer(to, tokenAmount); } } function inCaseTokensGetStuck(IERC20 token, address to, uint256 amount) external virtual override onlyOwner { require(amount > 0, "cannot recover 0 tokens"); require(address(token) != address(depositToken), "cannot recover deposit token"); token.safeTransfer(to, amount); } function migrate(address newStrategy) external virtual override onlyOwner { uint256 toTransfer = depositToken.balanceOf(address(this)); depositToken.safeTransfer(newStrategy, toTransfer); } function onMigration() external virtual override onlyOwner { } function transferOwnership(address newOwner) public virtual override(Ownable, IKanvasStrategy) onlyOwner { Ownable.transferOwnership(newOwner); } function setPerformanceFeeBips(uint256 newPerformanceFeeBips) external virtual onlyOwner { require(newPerformanceFeeBips <= MAX_BIPS, "input too high"); performanceFeeBips = newPerformanceFeeBips; } } // File contracts/KanvasStrategyForDexStaking.sol pragma solidity ^0.8.6; abstract contract KanvasStrategyForDexStaking is KanvasStrategyBase { using SafeERC20 for IERC20; address internal constant WKAVA = 0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b; //token earned from DEX farm IERC20 public immutable REWARD_TOKEN; //DEX router IRouter public immutable ROUTER; //total REWARD_TOKEN harvested by the contract all time uint256 public totalHarvested; //stored rewardTokens to be withdrawn to performanceFeeAdress of ArtStudio uint256 public storedPerformanceFees; //swap path from REWARD_TOKEN to Kanvas address[] public pathRewardToKanvas; constructor( IArtStudio _artStudio, IERC20 _depositToken, IERC20 _REWARD_TOKEN, IRouter _ROUTER ) KanvasStrategyBase(_artStudio, _depositToken) { REWARD_TOKEN = _REWARD_TOKEN; ROUTER = _ROUTER; REWARD_TOKEN.safeApprove(address(ROUTER), MAX_UINT); } //VIEW FUNCTIONS //finds the pending rewards for the contract to claim function checkReward() public view virtual returns (uint256); //OWNER-ONlY FUNCTIONS function deposit(address, address, uint256 tokenAmount, uint256) external override onlyOwner { _claimRewards(); if (tokenAmount > 0) { _stake(tokenAmount); } } function withdraw(address, address to, uint256 tokenAmount, uint256) external override onlyOwner { _claimRewards(); if (tokenAmount > 0) { _withdraw(tokenAmount); depositToken.safeTransfer(to, tokenAmount); } } function migrate(address newStrategy) external override onlyOwner { uint256 toWithdraw = _checkDepositedBalance(); if (toWithdraw > 0) { _withdraw(toWithdraw); depositToken.safeTransfer(newStrategy, toWithdraw); } uint256 rewardsToTransfer = REWARD_TOKEN.balanceOf(address(this)); if (rewardsToTransfer > 0) { REWARD_TOKEN.safeTransfer(newStrategy, rewardsToTransfer); } } function onMigration() external override onlyOwner { uint256 toStake = depositToken.balanceOf(address(this)); _stake(toStake); } function withdrawPerformanceFees() external { uint256 toTransfer = storedPerformanceFees; storedPerformanceFees = 0; REWARD_TOKEN.safeTransfer(artStudio.performanceFeeAddress(), toTransfer); } //INTERNAL FUNCTIONS //claim any as-of-yet unclaimed rewards function _claimRewards() internal { uint256 unclaimedRewards = checkReward(); if (unclaimedRewards > 0) { uint256 balanceBefore = REWARD_TOKEN.balanceOf(address(this)); _getReward(); uint256 balanceDiff = REWARD_TOKEN.balanceOf(address(this)) - balanceBefore; totalHarvested += balanceDiff; _swapRewardForKanvas(); } } //swaps REWARD_TOKENs for KANVAS and sends the KANVAS to the strategyPool. a portion of REWARD_TOKENS may also be allocated to the Art Studio's performanceFeeAddress function _swapRewardForKanvas() internal { uint256 amountIn = REWARD_TOKEN.balanceOf(address(this)) - storedPerformanceFees; if (amountIn > 0) { if (performanceFeeBips > 0) { uint256 performanceFee = (amountIn * performanceFeeBips) / MAX_BIPS; storedPerformanceFees += performanceFee; amountIn -= performanceFee; } ROUTER.swapExactTokensForTokens(amountIn, 0, pathRewardToKanvas, artStudio.strategyPool(), block.timestamp); //distribute manually } } //stakes tokenAmount into farm function _stake(uint256 tokenAmount) internal virtual; //withdraws tokenAmount from farm function _withdraw(uint256 tokenAmount) internal virtual; //claims reward from the farm function _getReward() internal virtual; //checks how many depositTokens this contract has in the farm function _checkDepositedBalance() internal virtual returns (uint256); } interface IRubyRewardPool { function pendingShare(uint256 _pid, address _user) external view returns (uint256); function deposit(uint256 _pid, uint256 _amount) external; function withdraw(uint256 _pid, uint256 _amount) external; function userInfo(uint256 _pid, address _address) external view returns(uint256 amount, uint256 rewardDebt); } // File contracts/KanvasStrategyForRubyV2Staking.sol pragma solidity ^0.8.6; contract KanvasStrategyForRubyV2Staking is KanvasStrategyForDexStaking { using SafeERC20 for IERC20; address internal constant RUBY_TOKEN = 0xCa7350Ed65c2fC90A9DBF2D15C75E80EA91aB1c1; //ruby share RShare //0xa2c535EBF7A48572F61F9273E8dBF61a0A79610D old ruby token IRubyRewardPool public constant RUBY_CHEF = IRubyRewardPool(0x63c8069EE16BA666800cECaFd99f4C75ad6dd7Aa); //IRouter public constant RUBY_ROUTER = IRouter(0x8a340F39A468C2FcBFFf2122446a9A0745A313Ad); //Photon Router IRouter public constant RUBY_ROUTER = IRouter(0xEa3CB4Ba9d1fD6fb19Df1380958d5649bD3e7C50); //Jupiter Router uint256 public immutable RUBY_PID; constructor( address _artStudio, address _depositToken, //0xCa7350Ed65c2fC90A9DBF2D15C75E80EA91aB1c1 Ruby uint256 _RUBY_PID ) KanvasStrategyForDexStaking(IArtStudio(_artStudio), IERC20(_depositToken), IERC20(RUBY_TOKEN), RUBY_ROUTER) { RUBY_PID = _RUBY_PID; pathRewardToKanvas = new address[](3); pathRewardToKanvas[0] = RUBY_TOKEN; pathRewardToKanvas[1] = WKAVA; pathRewardToKanvas[2] = IArtStudio(_artStudio).KANVAS(); IERC20(_depositToken).safeApprove(address(RUBY_CHEF), MAX_UINT); } //finds the pending rewards for the contract to claim function checkReward() public view override returns (uint256) { uint256 pendingRuby = RUBY_CHEF.pendingShare(RUBY_PID, address(this)); return pendingRuby; } //stakes tokenAmount into farm function _stake(uint256 tokenAmount) internal override { RUBY_CHEF.deposit(RUBY_PID, tokenAmount); } //withdraws tokenAmount from farm function _withdraw(uint256 tokenAmount) internal override { RUBY_CHEF.withdraw(RUBY_PID, tokenAmount); } //claims reward from the farm function _getReward() internal override { RUBY_CHEF.withdraw(RUBY_PID, 0); } //checks how many depositTokens this contract has in the farm function _checkDepositedBalance() internal view override returns (uint256) { (uint256 depositedBalance, ) = RUBY_CHEF.userInfo(RUBY_PID, address(this)); return depositedBalance; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_artStudio","internalType":"address"},{"type":"address","name":"_depositToken","internalType":"address"},{"type":"uint256","name":"_RUBY_PID","internalType":"uint256"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"REWARD_TOKEN","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRouter"}],"name":"ROUTER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRubyRewardPool"}],"name":"RUBY_CHEF","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"RUBY_PID","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRouter"}],"name":"RUBY_ROUTER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IArtStudio"}],"name":"artStudio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"checkReward","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"depositToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"inCaseTokensGetStuck","inputs":[{"type":"address","name":"token","internalType":"contract IERC20"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"migrate","inputs":[{"type":"address","name":"newStrategy","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"onMigration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pathRewardToKanvas","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"},{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"pendingTokens","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceFeeBips","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPerformanceFeeBips","inputs":[{"type":"uint256","name":"newPerformanceFeeBips","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"storedPerformanceFees","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalHarvested","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPerformanceFees","inputs":[]}]
Contract Creation Code
0x6101206040526103e86001553480156200001857600080fd5b506040516200235c3803806200235c8339810160408190526200003b91620008ba565b828273ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c173ea3cb4ba9d1fd6fb19df1380958d5649bd3e7c5083836200007433620002f2565b6001600160a01b038216158015906200009557506001600160a01b03811615155b620000d25760405162461bcd60e51b81526020600482015260086024820152671e995c9bc818985960c21b60448201526064015b60405180910390fd5b6001600160a01b03808316608052811660a052620000f08262000342565b50506001600160a01b0382811660c081905290821660e0819052620001259190600019620003a6602090811b620009ca17901c565b5050506101008290525060408051600380825260808201909252906020820160608036833750508151620001619260049250602001906200081c565b5073ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c160046000815481106200018e576200018e620008fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555073c86c7c0efbd6a49b35e8714c5f59d99de09a225b6004600181548110620001e857620001e8620008fb565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b031663a2e000f76040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200027b919062000911565b6004600281548110620002925762000292620008fb565b60009182526020918290200180546001600160a01b0319166001600160a01b03938416179055620002e9918416907363c8069ee16ba666800cecafd99f4c75ad6dd7aa9060001990620003a6811b620009ca17901c565b505050620009f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146200038d5760405162461bcd60e51b815260206004820181905260248201526000805160206200233c8339815191526044820152606401620000c9565b620003a381620004f560201b62000b121760201c565b50565b801580620004245750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015620003fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200042291906200092f565b155b620004985760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401620000c9565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620004f0918591620005b216565b505050565b6000546001600160a01b03163314620005405760405162461bcd60e51b815260206004820181905260248201526000805160206200233c8339815191526044820152606401620000c9565b6001600160a01b038116620005a75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401620000c9565b620003a381620002f2565b60006200060e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200069060201b62000baa179092919060201c565b805190915015620004f057808060200190518101906200062f919062000949565b620004f05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620000c9565b6060620006a18484600085620006ab565b90505b9392505050565b6060824710156200070e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620000c9565b843b6200075e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620000c9565b600080866001600160a01b031685876040516200077c9190620009a0565b60006040518083038185875af1925050503d8060008114620007bb576040519150601f19603f3d011682016040523d82523d6000602084013e620007c0565b606091505b509092509050620007d3828286620007de565b979650505050505050565b60608315620007ef575081620006a4565b825115620008005782518084602001fd5b8160405162461bcd60e51b8152600401620000c99190620009be565b82805482825590600052602060002090810192821562000874579160200282015b828111156200087457825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200083d565b506200088292915062000886565b5090565b5b8082111562000882576000815560010162000887565b80516001600160a01b0381168114620008b557600080fd5b919050565b600080600060608486031215620008d057600080fd5b620008db846200089d565b9250620008eb602085016200089d565b9150604084015190509250925092565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200092457600080fd5b620006a4826200089d565b6000602082840312156200094257600080fd5b5051919050565b6000602082840312156200095c57600080fd5b81518015158114620006a457600080fd5b60005b838110156200098a57818101518382015260200162000970565b838111156200099a576000848401525b50505050565b60008251620009b48184602087016200096d565b9190910192915050565b6020815260008251806020840152620009df8160408501602087016200096d565b601f01601f19169190910160400192915050565b60805160a05160c05160e0516101005161188662000ab6600039600081816101fb0152818161063b01528181610d6201528181610e4101528181610e9f015261113d01526000818161019801526112a50152600081816102460152818161041d015281816107d30152818161085b01528181610c1d01528181610cbc01526111d90152600081816102c6015281816104d9015281816105db0152818161079401526109360152600081816103130152818161039301526112d901526118866000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806399248ea7116100c3578063ce5494bb1161007c578063ce5494bb146102fb578063cfd3464e1461030e578063da98f02214610335578063dfd0c09d14610350578063f2fde38b14610359578063f587268a1461036c57600080fd5b806399248ea7146102415780639a9099a914610268578063c031a66f14610283578063c4b24a46146102b9578063c89039c5146102c1578063c9101036146102e857600080fd5b8063715018a611610115578063715018a6146101d25780637bfe950c146101da578063864ec9b4146101ed5780638cea9505146101f65780638da5cb5b1461021d5780639441ee221461022e57600080fd5b806304a0906e1461015257806320e8c5651461015c57806323dc11421461016f5780632d39811f1461018b57806332fe7b2614610193575b600080fd5b61015a61037f565b005b61015a61016a366004611413565b610447565b61017860025481565b6040519081526020015b60405180910390f35b61015a610497565b6101ba7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610182565b61015a610557565b61015a6101e8366004611413565b61058d565b61017860035481565b6101787f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03166101ba565b6101ba61023c366004611459565b610602565b6101ba7f000000000000000000000000000000000000000000000000000000000000000081565b6101ba7363c8069ee16ba666800cecafd99f4c75ad6dd7aa81565b6102ab610291366004611472565b506040805160008082526020820190815281830190925291565b60405161018292919061148f565b61017861062c565b6101ba7f000000000000000000000000000000000000000000000000000000000000000081565b61015a6102f6366004611459565b6106d0565b61015a610309366004611472565b610742565b6101ba7f000000000000000000000000000000000000000000000000000000000000000081565b6101ba73ea3cb4ba9d1fd6fb19df1380958d5649bd3e7c5081565b61017860015481565b61015a610367366004611472565b610887565b61015a61037a366004611513565b6108ba565b6000600354905060006003819055506104447f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638471692a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104139190611554565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169083610bc3565b50565b6000546001600160a01b0316331461047a5760405162461bcd60e51b815260040161047190611571565b60405180910390fd5b610482610bf3565b81156104915761049182610d53565b50505050565b6000546001600160a01b031633146104c15760405162461bcd60e51b815260040161047190611571565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c91906115a6565b905061044481610d53565b6000546001600160a01b031633146105815760405162461bcd60e51b815260040161047190611571565b61058b6000610de2565b565b6000546001600160a01b031633146105b75760405162461bcd60e51b815260040161047190611571565b6105bf610bf3565b8115610491576105ce82610e32565b6104916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484610bc3565b6004818154811061061257600080fd5b6000918252602090912001546001600160a01b0316905081565b60405163cf4b55cb60e01b81527f0000000000000000000000000000000000000000000000000000000000000000600482015230602482015260009081907363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063cf4b55cb90604401602060405180830381865afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca91906115a6565b92915050565b6000546001600160a01b031633146106fa5760405162461bcd60e51b815260040161047190611571565b61271081111561073d5760405162461bcd60e51b815260206004820152600e60248201526d0d2dce0eae840e8dede40d0d2ced60931b6044820152606401610471565b600155565b6000546001600160a01b0316331461076c5760405162461bcd60e51b815260040161047190611571565b6000610776610e90565b905080156107bb5761078781610e32565b6107bb6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383610bc3565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906115a6565b90508015610882576108826001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483610bc3565b505050565b6000546001600160a01b031633146108b15760405162461bcd60e51b815260040161047190611571565b61044481610b12565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161047190611571565b600081116109345760405162461bcd60e51b815260206004820152601760248201527f63616e6e6f74207265636f766572203020746f6b656e730000000000000000006044820152606401610471565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614156109b65760405162461bcd60e51b815260206004820152601c60248201527f63616e6e6f74207265636f766572206465706f73697420746f6b656e000000006044820152606401610471565b6108826001600160a01b0384168383610bc3565b801580610a445750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4291906115a6565b155b610aaf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610471565b6040516001600160a01b03831660248201526044810182905261088290849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f34565b6000546001600160a01b03163314610b3c5760405162461bcd60e51b815260040161047190611571565b6001600160a01b038116610ba15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610471565b61044481610de2565b6060610bb98484600085611006565b90505b9392505050565b6040516001600160a01b03831660248201526044810182905261088290849063a9059cbb60e01b90606401610adb565b6000610bfd61062c565b90508015610444576040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9091906115a6565b9050610c9a61112e565b6040516370a0823160e01b815230600482015260009082906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2791906115a6565b610d3191906115eb565b90508060026000828254610d459190611602565b9091555061088290506111b5565b604051631c57762b60e31b81527f00000000000000000000000000000000000000000000000000000000000000006004820152602481018290527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063e2bbb158906044015b600060405180830381600087803b158015610dc757600080fd5b505af1158015610ddb573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604051630441a3e760e41b81527f00000000000000000000000000000000000000000000000000000000000000006004820152602481018290527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063441a3e7090604401610dad565b6040516393f1a40b60e01b81527f0000000000000000000000000000000000000000000000000000000000000000600482015230602482015260009081907363c8069ee16ba666800cecafd99f4c75ad6dd7aa906393f1a40b906044016040805180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2d919061161a565b5092915050565b6000610f89826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610baa9092919063ffffffff16565b8051909150156108825780806020019051810190610fa7919061163e565b6108825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610471565b6060824710156110675760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610471565b843b6110b55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610471565b600080866001600160a01b031685876040516110d1919061168c565b60006040518083038185875af1925050503d806000811461110e576040519150601f19603f3d011682016040523d82523d6000602084013e611113565b606091505b50915091506111238282866113c5565b979650505050505050565b604051630441a3e760e41b81527f00000000000000000000000000000000000000000000000000000000000000006004820152600060248201527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063441a3e7090604401600060405180830381600087803b1580156111a157600080fd5b505af1158015610491573d6000803e3d6000fd5b6003546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611220573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124491906115a6565b61124e91906115eb565b9050801561044457600154156112a35760006127106001548361127191906116a8565b61127b91906116c7565b9050806003600082825461128f9190611602565b9091555061129f905081836115eb565b9150505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338ed173982600060047f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166302ed05f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611335573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113599190611554565b426040518663ffffffff1660e01b815260040161137a9594939291906116e9565b6000604051808303816000875af1158015611399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c1919081019061175f565b5050565b606083156113d4575081610bbc565b8251156113e45782518084602001fd5b8160405162461bcd60e51b8152600401610471919061181d565b6001600160a01b038116811461044457600080fd5b6000806000806080858703121561142957600080fd5b8435611434816113fe565b93506020850135611444816113fe565b93969395505050506040820135916060013590565b60006020828403121561146b57600080fd5b5035919050565b60006020828403121561148457600080fd5b8135610bbc816113fe565b604080825283519082018190526000906020906060840190828701845b828110156114d15781516001600160a01b0316845292840192908401906001016114ac565b5050508381038285015284518082528583019183019060005b81811015611506578351835292840192918401916001016114ea565b5090979650505050505050565b60008060006060848603121561152857600080fd5b8335611533816113fe565b92506020840135611543816113fe565b929592945050506040919091013590565b60006020828403121561156657600080fd5b8151610bbc816113fe565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156115b857600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156115fd576115fd6115d5565b500390565b60008219821115611615576116156115d5565b500190565b6000806040838503121561162d57600080fd5b505080516020909101519092909150565b60006020828403121561165057600080fd5b81518015158114610bbc57600080fd5b60005b8381101561167b578181015183820152602001611663565b838111156104915750506000910152565b6000825161169e818460208701611660565b9190910192915050565b60008160001904831182151516156116c2576116c26115d5565b500290565b6000826116e457634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875480845260c0860191508860005282600020935060005b8181101561173e5784546001600160a01b031683526001948501949284019201611719565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561177257600080fd5b825167ffffffffffffffff8082111561178a57600080fd5b818501915085601f83011261179e57600080fd5b8151818111156117b0576117b06115bf565b8060051b604051601f19603f830116810181811085821117156117d5576117d56115bf565b6040529182528482019250838101850191888311156117f357600080fd5b938501935b82851015611811578451845293850193928501926117f8565b98975050505050505050565b602081526000825180602084015261183c816040850160208701611660565b601f01601f1916919091016040019291505056fea2646970667358221220d10957037ede75189475a5048df05780debe6574d9ab22954c7af865b4ec0b3964736f6c634300080b00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65720000000000000000000000003dc0c9f53cedeeb5afabc77885dc5d9b1195d030000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b0000000000000000000000000000000000000000000000000000000000000003
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806399248ea7116100c3578063ce5494bb1161007c578063ce5494bb146102fb578063cfd3464e1461030e578063da98f02214610335578063dfd0c09d14610350578063f2fde38b14610359578063f587268a1461036c57600080fd5b806399248ea7146102415780639a9099a914610268578063c031a66f14610283578063c4b24a46146102b9578063c89039c5146102c1578063c9101036146102e857600080fd5b8063715018a611610115578063715018a6146101d25780637bfe950c146101da578063864ec9b4146101ed5780638cea9505146101f65780638da5cb5b1461021d5780639441ee221461022e57600080fd5b806304a0906e1461015257806320e8c5651461015c57806323dc11421461016f5780632d39811f1461018b57806332fe7b2614610193575b600080fd5b61015a61037f565b005b61015a61016a366004611413565b610447565b61017860025481565b6040519081526020015b60405180910390f35b61015a610497565b6101ba7f000000000000000000000000ea3cb4ba9d1fd6fb19df1380958d5649bd3e7c5081565b6040516001600160a01b039091168152602001610182565b61015a610557565b61015a6101e8366004611413565b61058d565b61017860035481565b6101787f000000000000000000000000000000000000000000000000000000000000000381565b6000546001600160a01b03166101ba565b6101ba61023c366004611459565b610602565b6101ba7f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c181565b6101ba7363c8069ee16ba666800cecafd99f4c75ad6dd7aa81565b6102ab610291366004611472565b506040805160008082526020820190815281830190925291565b60405161018292919061148f565b61017861062c565b6101ba7f000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b81565b61015a6102f6366004611459565b6106d0565b61015a610309366004611472565b610742565b6101ba7f0000000000000000000000003dc0c9f53cedeeb5afabc77885dc5d9b1195d03081565b6101ba73ea3cb4ba9d1fd6fb19df1380958d5649bd3e7c5081565b61017860015481565b61015a610367366004611472565b610887565b61015a61037a366004611513565b6108ba565b6000600354905060006003819055506104447f0000000000000000000000003dc0c9f53cedeeb5afabc77885dc5d9b1195d0306001600160a01b0316638471692a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104139190611554565b6001600160a01b037f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c1169083610bc3565b50565b6000546001600160a01b0316331461047a5760405162461bcd60e51b815260040161047190611571565b60405180910390fd5b610482610bf3565b81156104915761049182610d53565b50505050565b6000546001600160a01b031633146104c15760405162461bcd60e51b815260040161047190611571565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b6001600160a01b0316906370a0823190602401602060405180830381865afa158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c91906115a6565b905061044481610d53565b6000546001600160a01b031633146105815760405162461bcd60e51b815260040161047190611571565b61058b6000610de2565b565b6000546001600160a01b031633146105b75760405162461bcd60e51b815260040161047190611571565b6105bf610bf3565b8115610491576105ce82610e32565b6104916001600160a01b037f000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b168484610bc3565b6004818154811061061257600080fd5b6000918252602090912001546001600160a01b0316905081565b60405163cf4b55cb60e01b81527f0000000000000000000000000000000000000000000000000000000000000003600482015230602482015260009081907363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063cf4b55cb90604401602060405180830381865afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca91906115a6565b92915050565b6000546001600160a01b031633146106fa5760405162461bcd60e51b815260040161047190611571565b61271081111561073d5760405162461bcd60e51b815260206004820152600e60248201526d0d2dce0eae840e8dede40d0d2ced60931b6044820152606401610471565b600155565b6000546001600160a01b0316331461076c5760405162461bcd60e51b815260040161047190611571565b6000610776610e90565b905080156107bb5761078781610e32565b6107bb6001600160a01b037f000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b168383610bc3565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c16001600160a01b0316906370a0823190602401602060405180830381865afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906115a6565b90508015610882576108826001600160a01b037f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c1168483610bc3565b505050565b6000546001600160a01b031633146108b15760405162461bcd60e51b815260040161047190611571565b61044481610b12565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161047190611571565b600081116109345760405162461bcd60e51b815260206004820152601760248201527f63616e6e6f74207265636f766572203020746f6b656e730000000000000000006044820152606401610471565b7f000000000000000000000000c86c7c0efbd6a49b35e8714c5f59d99de09a225b6001600160a01b0316836001600160a01b031614156109b65760405162461bcd60e51b815260206004820152601c60248201527f63616e6e6f74207265636f766572206465706f73697420746f6b656e000000006044820152606401610471565b6108826001600160a01b0384168383610bc3565b801580610a445750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4291906115a6565b155b610aaf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610471565b6040516001600160a01b03831660248201526044810182905261088290849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f34565b6000546001600160a01b03163314610b3c5760405162461bcd60e51b815260040161047190611571565b6001600160a01b038116610ba15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610471565b61044481610de2565b6060610bb98484600085611006565b90505b9392505050565b6040516001600160a01b03831660248201526044810182905261088290849063a9059cbb60e01b90606401610adb565b6000610bfd61062c565b90508015610444576040516370a0823160e01b81523060048201526000907f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c16001600160a01b0316906370a0823190602401602060405180830381865afa158015610c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9091906115a6565b9050610c9a61112e565b6040516370a0823160e01b815230600482015260009082906001600160a01b037f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c116906370a0823190602401602060405180830381865afa158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2791906115a6565b610d3191906115eb565b90508060026000828254610d459190611602565b9091555061088290506111b5565b604051631c57762b60e31b81527f00000000000000000000000000000000000000000000000000000000000000036004820152602481018290527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063e2bbb158906044015b600060405180830381600087803b158015610dc757600080fd5b505af1158015610ddb573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604051630441a3e760e41b81527f00000000000000000000000000000000000000000000000000000000000000036004820152602481018290527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063441a3e7090604401610dad565b6040516393f1a40b60e01b81527f0000000000000000000000000000000000000000000000000000000000000003600482015230602482015260009081907363c8069ee16ba666800cecafd99f4c75ad6dd7aa906393f1a40b906044016040805180830381865afa158015610f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2d919061161a565b5092915050565b6000610f89826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610baa9092919063ffffffff16565b8051909150156108825780806020019051810190610fa7919061163e565b6108825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610471565b6060824710156110675760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610471565b843b6110b55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610471565b600080866001600160a01b031685876040516110d1919061168c565b60006040518083038185875af1925050503d806000811461110e576040519150601f19603f3d011682016040523d82523d6000602084013e611113565b606091505b50915091506111238282866113c5565b979650505050505050565b604051630441a3e760e41b81527f00000000000000000000000000000000000000000000000000000000000000036004820152600060248201527363c8069ee16ba666800cecafd99f4c75ad6dd7aa9063441a3e7090604401600060405180830381600087803b1580156111a157600080fd5b505af1158015610491573d6000803e3d6000fd5b6003546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000ca7350ed65c2fc90a9dbf2d15c75e80ea91ab1c116906370a0823190602401602060405180830381865afa158015611220573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124491906115a6565b61124e91906115eb565b9050801561044457600154156112a35760006127106001548361127191906116a8565b61127b91906116c7565b9050806003600082825461128f9190611602565b9091555061129f905081836115eb565b9150505b7f000000000000000000000000ea3cb4ba9d1fd6fb19df1380958d5649bd3e7c506001600160a01b03166338ed173982600060047f0000000000000000000000003dc0c9f53cedeeb5afabc77885dc5d9b1195d0306001600160a01b03166302ed05f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611335573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113599190611554565b426040518663ffffffff1660e01b815260040161137a9594939291906116e9565b6000604051808303816000875af1158015611399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c1919081019061175f565b5050565b606083156113d4575081610bbc565b8251156113e45782518084602001fd5b8160405162461bcd60e51b8152600401610471919061181d565b6001600160a01b038116811461044457600080fd5b6000806000806080858703121561142957600080fd5b8435611434816113fe565b93506020850135611444816113fe565b93969395505050506040820135916060013590565b60006020828403121561146b57600080fd5b5035919050565b60006020828403121561148457600080fd5b8135610bbc816113fe565b604080825283519082018190526000906020906060840190828701845b828110156114d15781516001600160a01b0316845292840192908401906001016114ac565b5050508381038285015284518082528583019183019060005b81811015611506578351835292840192918401916001016114ea565b5090979650505050505050565b60008060006060848603121561152857600080fd5b8335611533816113fe565b92506020840135611543816113fe565b929592945050506040919091013590565b60006020828403121561156657600080fd5b8151610bbc816113fe565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156115b857600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156115fd576115fd6115d5565b500390565b60008219821115611615576116156115d5565b500190565b6000806040838503121561162d57600080fd5b505080516020909101519092909150565b60006020828403121561165057600080fd5b81518015158114610bbc57600080fd5b60005b8381101561167b578181015183820152602001611663565b838111156104915750506000910152565b6000825161169e818460208701611660565b9190910192915050565b60008160001904831182151516156116c2576116c26115d5565b500290565b6000826116e457634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875480845260c0860191508860005282600020935060005b8181101561173e5784546001600160a01b031683526001948501949284019201611719565b50506001600160a01b03969096166060850152505050608001529392505050565b6000602080838503121561177257600080fd5b825167ffffffffffffffff8082111561178a57600080fd5b818501915085601f83011261179e57600080fd5b8151818111156117b0576117b06115bf565b8060051b604051601f19603f830116810181811085821117156117d5576117d56115bf565b6040529182528482019250838101850191888311156117f357600080fd5b938501935b82851015611811578451845293850193928501926117f8565b98975050505050505050565b602081526000825180602084015261183c816040850160208701611660565b601f01601f1916919091016040019291505056fea2646970667358221220d10957037ede75189475a5048df05780debe6574d9ab22954c7af865b4ec0b3964736f6c634300080b0033