Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 119 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Bond | 19170905 | 764 days ago | IN | 0 ETH | 0.00372849 | ||||
| Rescue ERC20 | 19170903 | 764 days ago | IN | 0 ETH | 0.00219667 | ||||
| Bond | 19170901 | 764 days ago | IN | 0 ETH | 0.00390203 | ||||
| Rescue ERC20 | 19170900 | 764 days ago | IN | 0 ETH | 0.00224367 | ||||
| Bond | 19170899 | 764 days ago | IN | 0 ETH | 0.00443531 | ||||
| Rescue ERC20 | 19170898 | 764 days ago | IN | 0 ETH | 0.00233292 | ||||
| Bond | 19170890 | 764 days ago | IN | 0 ETH | 0.00391957 | ||||
| Rescue ERC20 | 19170888 | 764 days ago | IN | 0 ETH | 0.00242182 | ||||
| Bond | 19170886 | 764 days ago | IN | 0 ETH | 0.00413334 | ||||
| Rescue ERC20 | 19170885 | 764 days ago | IN | 0 ETH | 0.00238961 | ||||
| Bond | 19170882 | 764 days ago | IN | 0 ETH | 0.00401453 | ||||
| Rescue ERC20 | 19170880 | 764 days ago | IN | 0 ETH | 0.00245022 | ||||
| Rescue ERC20 | 19170878 | 764 days ago | IN | 0 ETH | 0.00240966 | ||||
| Bond | 19170877 | 764 days ago | IN | 0 ETH | 0.0040599 | ||||
| Rescue ERC20 | 19170876 | 764 days ago | IN | 0 ETH | 0.00233895 | ||||
| Bond | 19170875 | 764 days ago | IN | 0 ETH | 0.00455922 | ||||
| Rescue ERC20 | 19170871 | 764 days ago | IN | 0 ETH | 0.00181568 | ||||
| Approve | 19170794 | 764 days ago | IN | 0 ETH | 0.00223552 | ||||
| Bond | 19170683 | 764 days ago | IN | 0 ETH | 0.00330069 | ||||
| Rescue ERC20 | 19170680 | 764 days ago | IN | 0 ETH | 0.00185013 | ||||
| Rescue ERC20 | 19170670 | 764 days ago | IN | 0 ETH | 0.00216154 | ||||
| Bond | 19170669 | 764 days ago | IN | 0 ETH | 0.00339668 | ||||
| Rescue ERC20 | 19170668 | 764 days ago | IN | 0 ETH | 0.00206539 | ||||
| Bond | 19170667 | 764 days ago | IN | 0 ETH | 0.00435575 | ||||
| Rescue ERC20 | 19170660 | 764 days ago | IN | 0 ETH | 0.00205074 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x60806040 | 19107187 | 773 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WeightedIndex
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// Website: https://barley.finance/
// Docs: https://docs.barley.finance/
// Twitter: https://twitter.com/Barley_Finance
// Telegram Group: https://t.me/Barley_Finance
// Telegram Channel: https://t.me/BarleyFinance
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IV3TwapUtilities.sol";
import "./DecentralizedIndex.sol";
contract WeightedIndex is DecentralizedIndex {
using SafeERC20 for IERC20;
IUniswapV2Factory immutable V2_FACTORY;
uint256 _totalWeights;
constructor(
string memory _name,
string memory _symbol,
uint256 _bondFee,
uint256 _debondFee,
address[] memory _tokens,
uint256[] memory _weights,
address _lpRewardsToken,
address _v2Router,
address _dai,
bool _stakeRestriction,
IV3TwapUtilities _v3TwapUtilities
)
DecentralizedIndex(
_name,
_symbol,
_bondFee,
_debondFee,
_lpRewardsToken,
_v2Router,
_dai,
_stakeRestriction,
_v3TwapUtilities
)
{
indexType = IndexType.WEIGHTED;
V2_FACTORY = IUniswapV2Factory(IUniswapV2Router02(_v2Router).factory());
require(_tokens.length == _weights.length, "INIT");
for (uint256 _i; _i < _tokens.length; _i++) {
indexTokens.push(
IndexAssetInfo({
token: _tokens[_i],
basePriceUSDX96: 0,
weighting: _weights[_i],
c1: address(0),
q1: 0 // amountsPerIdxTokenX96
})
);
_totalWeights += _weights[_i];
_fundTokenIdx[_tokens[_i]] = _i;
_isTokenInIndex[_tokens[_i]] = true;
}
// at idx == 0, need to find X in [1/X = tokenWeightAtIdx/totalWeights]
// at idx > 0, need to find Y in (Y/X = tokenWeightAtIdx/totalWeights)
uint256 _xX96 = (FixedPoint96.Q96 * _totalWeights) / _weights[0];
for (uint256 _i; _i < _tokens.length; _i++) {
indexTokens[_i].q1 =
(_weights[_i] *
_xX96 *
10 ** IERC20Metadata(_tokens[_i]).decimals()) /
_totalWeights;
}
}
function _getNativePriceUSDX96() internal view returns (uint256) {
IUniswapV2Pair _nativeStablePool = IUniswapV2Pair(
V2_FACTORY.getPair(DAI, WETH)
);
address _token0 = _nativeStablePool.token0();
(uint8 _decimals0, uint8 _decimals1) = (
IERC20Metadata(_token0).decimals(),
IERC20Metadata(_nativeStablePool.token1()).decimals()
);
(uint112 _res0, uint112 _res1, ) = _nativeStablePool.getReserves();
return
_token0 == DAI
? (FixedPoint96.Q96 * _res0 * 10 ** _decimals1) /
_res1 /
10 ** _decimals0
: (FixedPoint96.Q96 * _res1 * 10 ** _decimals0) /
_res0 /
10 ** _decimals1;
}
function _getTokenPriceUSDX96(
address _token
) internal view returns (uint256) {
if (_token == WETH) {
return _getNativePriceUSDX96();
}
IUniswapV2Pair _pool = IUniswapV2Pair(V2_FACTORY.getPair(_token, WETH));
address _token0 = _pool.token0();
uint8 _decimals0 = IERC20Metadata(_token0).decimals();
uint8 _decimals1 = IERC20Metadata(_pool.token1()).decimals();
(uint112 _res0, uint112 _res1, ) = _pool.getReserves();
uint256 _nativePriceUSDX96 = _getNativePriceUSDX96();
return
_token0 == WETH
? (_nativePriceUSDX96 * _res0 * 10 ** _decimals1) /
_res1 /
10 ** _decimals0
: (_nativePriceUSDX96 * _res1 * 10 ** _decimals0) /
_res0 /
10 ** _decimals1;
}
function bond(
address _token,
uint256 _amount
) external override lock noSwap {
require(_isTokenInIndex[_token], "INVALIDTOKEN");
uint256 _tokenIdx = _fundTokenIdx[_token];
uint256 _tokensMinted = (_amount *
FixedPoint96.Q96 *
10 ** decimals()) / indexTokens[_tokenIdx].q1;
uint256 _feeTokens = _isFirstIn()
? 0
: (_tokensMinted * BOND_FEE) / 10000;
_mint(_msgSender(), _tokensMinted - _feeTokens);
if (_feeTokens > 0) {
_mint(address(this), _feeTokens);
}
for (uint256 _i; _i < indexTokens.length; _i++) {
uint256 _transferAmount = _i == _tokenIdx
? _amount
: (_amount *
indexTokens[_i].weighting *
10 ** IERC20Metadata(indexTokens[_i].token).decimals()) /
indexTokens[_tokenIdx].weighting /
10 ** IERC20Metadata(_token).decimals();
_transferAndValidate(
IERC20(indexTokens[_i].token),
_msgSender(),
_transferAmount
);
}
emit Bond(_msgSender(), _token, _amount, _tokensMinted);
}
function debond(
uint256 _amount,
address[] memory,
uint8[] memory
) external override lock noSwap {
uint256 _amountAfterFee = _isLastOut(_amount)
? _amount
: (_amount * (10000 - DEBOND_FEE)) / 10000;
uint256 _percAfterFeeX96 = (_amountAfterFee * FixedPoint96.Q96) /
totalSupply();
_transfer(_msgSender(), address(this), _amount);
_burn(address(this), _amountAfterFee);
for (uint256 _i; _i < indexTokens.length; _i++) {
uint256 _tokenSupply = IERC20(indexTokens[_i].token).balanceOf(
address(this)
);
uint256 _debondAmount = (_tokenSupply * _percAfterFeeX96) /
FixedPoint96.Q96;
IERC20(indexTokens[_i].token).safeTransfer(
_msgSender(),
_debondAmount
);
require(
IERC20(indexTokens[_i].token).balanceOf(address(this)) >=
_tokenSupply - _debondAmount,
"HEAVY"
);
}
emit Debond(_msgSender(), _amount);
}
function getTokenPriceUSDX96(
address _token
) external view override returns (uint256) {
return _getTokenPriceUSDX96(_token);
}
function getIdxPriceUSDX96()
public
view
override
returns (uint256, uint256)
{
uint256 _priceX96;
uint256 _X96_2 = 2 ** (96 / 2);
for (uint256 _i; _i < indexTokens.length; _i++) {
uint256 _tokenPriceUSDX96_2 = _getTokenPriceUSDX96(
indexTokens[_i].token
) / _X96_2;
_priceX96 +=
(_tokenPriceUSDX96_2 * indexTokens[_i].q1) /
10 ** IERC20Metadata(indexTokens[_i].token).decimals() /
_X96_2;
}
return (0, _priceX96);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal virtual {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
/**
* @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");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <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;
// 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);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev In the implementation you must pay the pool tokens owed for the swap.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
/// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;
/// @title FixedPoint96
/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
/// @dev Used in SqrtPriceMath.sol
library FixedPoint96 {
uint8 internal constant RESOLUTION = 96;
uint256 internal constant Q96 = 0x1000000000000000000000000;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Immutable state
/// @notice Functions that return immutable state of the router
interface IPeripheryImmutableState {
/// @return Returns the address of the Uniswap V3 factory
function factory() external view returns (address);
/// @return Returns the address of WETH9
function WETH9() external view returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
struct ExactOutputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
struct ExactOutputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
library PoolAddress {
bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
/// @notice The identifying key of the pool
struct PoolKey {
address token0;
address token1;
uint24 fee;
}
/// @notice Returns PoolKey: the ordered tokens with the matched fee levels
/// @param tokenA The first token of a pool, unsorted
/// @param tokenB The second token of a pool, unsorted
/// @param fee The fee level of the pool
/// @return Poolkey The pool details with ordered token0 and token1 assignments
function getPoolKey(
address tokenA,
address tokenB,
uint24 fee
) internal pure returns (PoolKey memory) {
if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
}
/// @notice Deterministically computes the pool address given the factory and PoolKey
/// @param factory The Uniswap V3 factory contract address
/// @param key The PoolKey
/// @return pool The contract address of the V3 pool
function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {
require(key.token0 < key.token1);
pool = address(
uint256(
keccak256(
abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encode(key.token0, key.token1, key.fee)),
POOL_INIT_CODE_HASH
)
)
)
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IDecentralizedIndex.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IFlashLoanRecipient.sol";
import "./interfaces/ITokenRewards.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./StakingPoolToken.sol";
abstract contract DecentralizedIndex is IDecentralizedIndex, ERC20 {
using SafeERC20 for IERC20;
uint256 public constant override FLASH_FEE_DAI = 10; // 10 DAI
uint256 public immutable override BOND_FEE;
uint256 public immutable override DEBOND_FEE;
address immutable V2_ROUTER;
address immutable V2_POOL;
address immutable DAI;
address immutable WETH;
IV3TwapUtilities immutable V3_TWAP_UTILS;
IndexType public override indexType;
uint256 public override created;
address public override lpStakingPool;
address public override lpRewardsToken;
IndexAssetInfo[] public indexTokens;
mapping(address => bool) _isTokenInIndex;
mapping(address => uint256) _fundTokenIdx;
bool _swapping;
bool _swapOn = true;
bool _unlocked = true;
modifier noSwap() {
_swapOn = false;
_;
_swapOn = true;
}
modifier lock() {
require(_unlocked, "LOCKED");
_unlocked = false;
_;
_unlocked = true;
}
constructor(
string memory _name,
string memory _symbol,
uint256 _bondFee,
uint256 _debondFee,
address _lpRewardsToken,
address _v2Router,
address _dai,
bool _stakeRestriction,
IV3TwapUtilities _v3TwapUtilities
) ERC20(_name, _symbol) {
created = block.timestamp;
BOND_FEE = _bondFee;
DEBOND_FEE = _debondFee;
lpRewardsToken = _lpRewardsToken;
V2_ROUTER = _v2Router;
address _v2Pool = IUniswapV2Factory(
IUniswapV2Router02(_v2Router).factory()
).createPair(address(this), _dai);
lpStakingPool = address(
new StakingPoolToken(
string(abi.encodePacked("Staked ", _name)),
string(abi.encodePacked("s", _symbol)),
_dai,
_v2Pool,
lpRewardsToken,
_stakeRestriction ? _msgSender() : address(0),
_v3TwapUtilities
)
);
V2_POOL = _v2Pool;
DAI = _dai;
WETH = IUniswapV2Router02(_v2Router).WETH();
V3_TWAP_UTILS = _v3TwapUtilities;
emit Create(address(this), _msgSender());
}
function _transfer(
address _from,
address _to,
uint256 _amount
) internal virtual override {
if (_swapOn && !_swapping) {
uint256 _bal = balanceOf(address(this));
uint256 _min = totalSupply() / 10000; // 0.01%
if (_from != V2_POOL && _bal >= _min && balanceOf(V2_POOL) > 0) {
_swapping = true;
_feeSwap(
_bal >= _min * 100 ? _min * 100 : _bal >= _min * 20
? _min * 20
: _min
);
_swapping = false;
}
}
super._transfer(_from, _to, _amount);
}
function _feeSwap(uint256 _amount) internal {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = DAI;
_approve(address(this), V2_ROUTER, _amount);
address _rewards = StakingPoolToken(lpStakingPool).poolRewards();
IUniswapV2Router02(V2_ROUTER)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
_amount,
0,
path,
_rewards,
block.timestamp
);
uint256 _rewardsDAIBal = IERC20(DAI).balanceOf(_rewards);
if (_rewardsDAIBal > 0) {
ITokenRewards(_rewards).depositFromDAI(0);
}
}
function _transferAndValidate(
IERC20 _token,
address _sender,
uint256 _amount
) internal {
uint256 _balanceBefore = _token.balanceOf(address(this));
_token.safeTransferFrom(_sender, address(this), _amount);
require(
_token.balanceOf(address(this)) >= _balanceBefore + _amount,
"TFRVAL"
);
}
function _isFirstIn() internal view returns (bool) {
return totalSupply() == 0;
}
function _isLastOut(uint256 _debondAmount) internal view returns (bool) {
return _debondAmount >= (totalSupply() * 98) / 100;
}
function isAsset(address _token) public view override returns (bool) {
return _isTokenInIndex[_token];
}
function getAllAssets()
external
view
override
returns (IndexAssetInfo[] memory)
{
return indexTokens;
}
function addLiquidityV2(
uint256 _idxLPTokens,
uint256 _daiLPTokens,
uint256 _slippage // 100 == 10%, 1000 == 100%
) external override noSwap {
uint256 _idxTokensBefore = balanceOf(address(this));
uint256 _daiBefore = IERC20(DAI).balanceOf(address(this));
_transfer(_msgSender(), address(this), _idxLPTokens);
_approve(address(this), V2_ROUTER, _idxLPTokens);
IERC20(DAI).safeTransferFrom(_msgSender(), address(this), _daiLPTokens);
IERC20(DAI).safeIncreaseAllowance(V2_ROUTER, _daiLPTokens);
IUniswapV2Router02(V2_ROUTER).addLiquidity(
address(this),
DAI,
_idxLPTokens,
_daiLPTokens,
(_idxLPTokens * (1000 - _slippage)) / 1000,
(_daiLPTokens * (1000 - _slippage)) / 1000,
_msgSender(),
block.timestamp
);
// check & refund excess tokens from LPing
if (balanceOf(address(this)) > _idxTokensBefore) {
_transfer(
address(this),
_msgSender(),
balanceOf(address(this)) - _idxTokensBefore
);
}
if (IERC20(DAI).balanceOf(address(this)) > _daiBefore) {
IERC20(DAI).safeTransfer(
_msgSender(),
IERC20(DAI).balanceOf(address(this)) - _daiBefore
);
}
emit AddLiquidity(_msgSender(), _idxLPTokens, _daiLPTokens);
}
function removeLiquidityV2(
uint256 _lpTokens,
uint256 _minIdxTokens, // 0 == 100% slippage
uint256 _minDAI // 0 == 100% slippage
) external override noSwap {
_lpTokens = _lpTokens == 0
? IERC20(V2_POOL).balanceOf(_msgSender())
: _lpTokens;
require(_lpTokens > 0, "LPREM");
uint256 _balBefore = IERC20(V2_POOL).balanceOf(address(this));
IERC20(V2_POOL).safeTransferFrom(
_msgSender(),
address(this),
_lpTokens
);
IERC20(V2_POOL).safeIncreaseAllowance(V2_ROUTER, _lpTokens);
IUniswapV2Router02(V2_ROUTER).removeLiquidity(
address(this),
DAI,
_lpTokens,
_minIdxTokens,
_minDAI,
_msgSender(),
block.timestamp
);
if (IERC20(V2_POOL).balanceOf(address(this)) > _balBefore) {
IERC20(V2_POOL).safeTransfer(
_msgSender(),
IERC20(V2_POOL).balanceOf(address(this)) - _balBefore
);
}
emit RemoveLiquidity(_msgSender(), _lpTokens);
}
function rescueERC20(address _token) external {
// cannot withdraw tokens/assets that belong to the index
require(_token != address(this), "UNAVAILABLE");
require(
_msgSender() == Ownable(address(V3_TWAP_UTILS)).owner(),
"UNAUTHORIZED"
);
IERC20(_token).safeTransfer(
Ownable(address(V3_TWAP_UTILS)).owner(),
IERC20(_token).balanceOf(address(this))
);
}
function rescueETH() external {
require(address(this).balance > 0, "NOETH");
_rescueETH(address(this).balance);
}
function _rescueETH(uint256 _amount) internal {
if (_amount == 0) {
return;
}
(bool _sent, ) = Ownable(address(V3_TWAP_UTILS)).owner().call{
value: _amount
}("");
require(_sent, "SENT");
}
receive() external payable {
_rescueETH(msg.value);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
interface IBARL is IERC20 {
event Burn(address indexed user, uint256 amount);
function burn(uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IDecentralizedIndex is IERC20 {
enum IndexType {
WEIGHTED,
UNWEIGHTED
}
struct IndexAssetInfo {
address token;
uint256 weighting;
uint256 basePriceUSDX96;
address c1; // arbitrary contract/address field we can use for an index
uint256 q1; // arbitrary quantity/number field we can use for an index
}
event Create(address indexed newIdx, address indexed wallet);
event Bond(
address indexed wallet,
address indexed token,
uint256 amountTokensBonded,
uint256 amountTokensMinted
);
event Debond(address indexed wallet, uint256 amountDebonded);
event AddLiquidity(
address indexed wallet,
uint256 amountTokens,
uint256 amountDAI
);
event RemoveLiquidity(address indexed wallet, uint256 amountLiquidity);
function FLASH_FEE_DAI() external view returns (uint256);
function BOND_FEE() external view returns (uint256); // 1 == 0.01%, 10 == 0.1%, 100 == 1%
function DEBOND_FEE() external view returns (uint256); // 1 == 0.01%, 10 == 0.1%, 100 == 1%
function indexType() external view returns (IndexType);
function created() external view returns (uint256);
function lpStakingPool() external view returns (address);
function lpRewardsToken() external view returns (address);
function getIdxPriceUSDX96() external view returns (uint256, uint256);
function isAsset(address token) external view returns (bool);
function getAllAssets() external view returns (IndexAssetInfo[] memory);
function getTokenPriceUSDX96(address token) external view returns (uint256);
function bond(address token, uint256 amount) external;
function debond(
uint256 amount,
address[] memory token,
uint8[] memory percentage
) external;
function addLiquidityV2(
uint256 idxTokens,
uint256 daiTokens,
uint256 slippage
) external;
function removeLiquidityV2(
uint256 lpTokens,
uint256 minTokens,
uint256 minDAI
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IERC20Metadata {
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IFlashLoanRecipient {
function callback(bytes calldata data) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IReferral {
function caller() external view returns (address);
function getRelationsREF(
address _wallet
) external view returns (address[2] memory);
function getUserInTeamByIndex(
address _user,
uint256 _index
) external view returns (address);
function isSetted(address) external view returns (bool);
function owner() external view returns (address);
function referralLevel() external view returns (uint256);
function relations(address, uint256) external view returns (address);
function renounceOwnership() external;
function updateSetted(address _address) external;
function setReferral(address _from, address _to) external;
function teamSize(address _user) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IStakingPoolToken {
event Stake(address indexed executor, address indexed user, uint256 amount);
event Unstake(address indexed user, uint256 amount);
function indexFund() external view returns (address);
function stakingToken() external view returns (address);
function poolRewards() external view returns (address);
function stakeUserRestriction() external view returns (address);
function stake(address user, uint256 amount) external;
function unstake(uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface ITokenRewards {
event AddShares(address indexed wallet, uint256 amount);
event RemoveShares(address indexed wallet, uint256 amount);
event ClaimReward(address indexed wallet);
event DistributeReward(address indexed wallet, uint256 amount);
event DepositRewards(address indexed wallet, uint256 amount);
event ReferralDistribution(
address indexed wallet,
address indexed referrer,
uint256 level,
uint256 amount
);
function totalShares() external view returns (uint256);
function totalStakers() external view returns (uint256);
function rewardsToken() external view returns (address);
function trackingToken() external view returns (address);
function depositFromDAI(uint256 amount) external;
function depositRewards(uint256 amount) external;
function claimReward(address wallet, address referrer) external;
function setShares(
address wallet,
uint256 amount,
bool sharesRemoving
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
interface IUniswapV2Factory {
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
function getPair(
address tokenA,
address tokenB
) external view returns (address pair);
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
interface IUniswapV2Pair {
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
interface IUniswapV2Router02 {
function factory() external view returns (address);
function WETH() external view returns (address);
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 removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IV3TwapUtilities {
function getV3Pool(
address v3Factory,
address token0,
address token1,
uint24 poolFee
) external view returns (address);
function getPoolPriceUSDX96(
address pricePool,
address nativeStablePool,
address WETH9
) external view returns (uint256);
function sqrtPriceX96FromPoolAndInterval(
address pool
) external view returns (uint160);
function priceX96FromSqrtPriceX96(
uint160 sqrtPriceX96
) external pure returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.00
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Conventions:
// Unit | Range | Notes
// :-------- |:-------------:|:-----
// timestamp | >= 0 | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC
// year | 1970 ... 2345 |
// month | 1 ... 12 |
// day | 1 ... 31 |
// hour | 0 ... 23 |
// minute | 0 ... 59 |
// second | 0 ... 59 |
// dayOfWeek | 1 ... 7 | 1 = Monday, ..., 7 = Sunday
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018.
//
// GNU Lesser General Public License 3.0
// https://www.gnu.org/licenses/lgpl-3.0.en.html
// ----------------------------------------------------------------------------
library BokkyPooBahsDateTimeLibrary {
uint constant SECONDS_PER_DAY = 24 * 60 * 60;
int constant OFFSET19700101 = 2440588;
// ------------------------------------------------------------------------
// Calculate year/month/day from the number of days since 1970/01/01 using
// the date conversion algorithm from
// http://aa.usno.navy.mil/faq/docs/JD_Formula.php
// and adding the offset 2440588 so that 1970/01/01 is day 0
//
// int L = days + 68569 + offset
// int N = 4 * L / 146097
// L = L - (146097 * N + 3) / 4
// year = 4000 * (L + 1) / 1461001
// L = L - 1461 * year / 4 + 31
// month = 80 * L / 2447
// dd = L - 2447 * month / 80
// L = month / 11
// month = month + 2 - 12 * L
// year = 100 * (N - 49) + year + L
// ------------------------------------------------------------------------
function _daysToDate(
uint _days
) internal pure returns (uint year, uint month, uint day) {
int __days = int(_days);
int L = __days + 68569 + OFFSET19700101;
int N = (4 * L) / 146097;
L = L - (146097 * N + 3) / 4;
int _year = (4000 * (L + 1)) / 1461001;
L = L - (1461 * _year) / 4 + 31;
int _month = (80 * L) / 2447;
int _day = L - (2447 * _month) / 80;
L = _month / 11;
_month = _month + 2 - 12 * L;
_year = 100 * (N - 49) + _year + L;
year = uint(_year);
month = uint(_month);
day = uint(_day);
}
function timestampToDate(
uint timestamp
) internal pure returns (uint year, uint month, uint day) {
(year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
}
}// Website: https://barley.finance/
// Docs: https://docs.barley.finance/
// Twitter: https://twitter.com/Barley_Finance
// Telegram Group: https://t.me/Barley_Finance
// Telegram Channel: https://t.me/BarleyFinance
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import './interfaces/IStakingPoolToken.sol';
import './TokenRewards.sol';
contract StakingPoolToken is IStakingPoolToken, ERC20 {
using SafeERC20 for IERC20;
address public override indexFund;
address public override stakingToken;
address public override poolRewards;
address public override stakeUserRestriction;
modifier onlyRestricted() {
require(_msgSender() == stakeUserRestriction, 'RESUSERAUTH');
_;
}
constructor(
string memory _name,
string memory _symbol,
address _dai,
address _stakingToken,
address _rewardsToken,
address _stakeUserRestriction,
IV3TwapUtilities _v3TwapUtilities
) ERC20(_name, _symbol) {
indexFund = _msgSender();
stakingToken = _stakingToken;
stakeUserRestriction = _stakeUserRestriction;
poolRewards = address(
new TokenRewards(_v3TwapUtilities, _dai, address(this), _rewardsToken)
);
}
function stake(address _user, uint256 _amount) external override {
if (stakeUserRestriction != address(0)) {
require(_user == stakeUserRestriction, 'RESTRICT');
}
_mint(_user, _amount);
IERC20(stakingToken).safeTransferFrom(_msgSender(), address(this), _amount);
emit Stake(_msgSender(), _user, _amount);
}
function unstake(uint256 _amount) external override {
_burn(_msgSender(), _amount);
IERC20(stakingToken).safeTransfer(_msgSender(), _amount);
emit Unstake(_msgSender(), _amount);
}
function removeStakeUserRestriction() external onlyRestricted {
stakeUserRestriction = address(0);
}
function setStakeUserRestriction(address _user) external onlyRestricted {
stakeUserRestriction = _user;
}
function _transfer(
address _from,
address _to,
uint256 _amount
) internal virtual override {
super._transfer(_from, _to, _amount);
_afterTokenTransfer(_from, _to, _amount);
}
function _mint(address _to, uint256 _amount) internal override {
super._mint(_to, _amount);
_afterTokenTransfer(address(0), _to, _amount);
}
function _burn(address _from, uint256 _amount) internal override {
super._burn(_from, _amount);
_afterTokenTransfer(_from, address(0), _amount);
}
function _afterTokenTransfer(
address _from,
address _to,
uint256 _amount
) internal {
if (_from != address(0) && _from != address(0xdead)) {
TokenRewards(poolRewards).setShares(_from, _amount, true);
}
if (_to != address(0) && _to != address(0xdead)) {
TokenRewards(poolRewards).setShares(_to, _amount, false);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol";
import "@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol";
import "./libraries/BokkyPooBahsDateTimeLibrary.sol";
import "./interfaces/IBARL.sol";
import "./interfaces/ITokenRewards.sol";
import "./interfaces/IV3TwapUtilities.sol";
import "./interfaces/IReferral.sol";
contract TokenRewards is ITokenRewards, Context {
using SafeERC20 for IERC20;
address constant V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
uint256 constant PRECISION = 10 ** 36;
uint24 constant REWARDS_POOL_FEE = 10000; // 1%
address immutable DAI;
IV3TwapUtilities immutable V3_TWAP_UTILS;
IReferral public referral;
struct Reward {
uint256 excluded;
uint256 realized;
}
address public override trackingToken;
address public override rewardsToken;
uint256 public override totalShares;
uint256 public override totalStakers;
mapping(address => uint256) public shares;
mapping(address => Reward) public rewards;
uint256 _rewardsSwapSlippage = 10; // 1%
uint256 _rewardsPerShare;
uint256 public rewardsDistributed;
uint256 public rewardsDeposited;
mapping(uint256 => uint256) public rewardsDepMonthly;
modifier onlyTrackingToken() {
require(_msgSender() == trackingToken, "UNAUTHORIZED");
_;
}
constructor(
IV3TwapUtilities _v3TwapUtilities,
address _dai,
address _trackingToken,
address _rewardsToken
) {
V3_TWAP_UTILS = _v3TwapUtilities;
DAI = _dai;
trackingToken = _trackingToken;
rewardsToken = _rewardsToken;
}
function updateReferral(address _referral) external {
if (address(referral) == address(0)) {
referral = IReferral(_referral);
} else {
require(_msgSender() == referral.owner(), "UNAUTHORIZED");
referral = IReferral(_referral);
}
}
function setShares(
address _wallet,
uint256 _amount,
bool _sharesRemoving
) external override onlyTrackingToken {
_setShares(_wallet, _amount, _sharesRemoving);
}
function _setShares(
address _wallet,
uint256 _amount,
bool _sharesRemoving
) internal {
if (_sharesRemoving) {
_removeShares(_wallet, _amount);
emit RemoveShares(_wallet, _amount);
} else {
_addShares(_wallet, _amount);
emit AddShares(_wallet, _amount);
}
}
function _addShares(address _wallet, uint256 _amount) internal {
if (shares[_wallet] > 0) {
_distributeReward(_wallet);
}
uint256 sharesBefore = shares[_wallet];
totalShares += _amount;
shares[_wallet] += _amount;
if (sharesBefore == 0 && shares[_wallet] > 0) {
totalStakers++;
}
rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]);
}
function _removeShares(address _wallet, uint256 _amount) internal {
require(shares[_wallet] > 0 && _amount <= shares[_wallet], "REMOVE");
_distributeReward(_wallet);
totalShares -= _amount;
shares[_wallet] -= _amount;
if (shares[_wallet] == 0) {
totalStakers--;
}
rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]);
}
function depositFromDAI(uint256 _amountDAIDepositing) external override {
if (_amountDAIDepositing > 0) {
IERC20(DAI).safeTransferFrom(
_msgSender(),
address(this),
_amountDAIDepositing
);
}
uint256 _amountDAI = IERC20(DAI).balanceOf(address(this));
require(_amountDAI > 0, "NEEDDAI");
(address _token0, address _token1) = DAI < rewardsToken
? (DAI, rewardsToken)
: (rewardsToken, DAI);
PoolAddress.PoolKey memory _poolKey = PoolAddress.PoolKey({
token0: _token0,
token1: _token1,
fee: REWARDS_POOL_FEE
});
address _pool = PoolAddress.computeAddress(
IPeripheryImmutableState(V3_ROUTER).factory(),
_poolKey
);
uint160 _rewardsSqrtPriceX96 = V3_TWAP_UTILS
.sqrtPriceX96FromPoolAndInterval(_pool);
uint256 _rewardsPriceX96 = V3_TWAP_UTILS.priceX96FromSqrtPriceX96(
_rewardsSqrtPriceX96
);
uint256 _amountOut = _token0 == DAI
? (_rewardsPriceX96 * _amountDAI) / FixedPoint96.Q96
: (_amountDAI * FixedPoint96.Q96) / _rewardsPriceX96;
uint256 _rewardsBalBefore = IERC20(rewardsToken).balanceOf(
address(this)
);
IERC20(DAI).safeIncreaseAllowance(V3_ROUTER, _amountDAI);
try
ISwapRouter(V3_ROUTER).exactInputSingle(
ISwapRouter.ExactInputSingleParams({
tokenIn: DAI,
tokenOut: rewardsToken,
fee: REWARDS_POOL_FEE,
recipient: address(this),
deadline: block.timestamp,
amountIn: _amountDAI,
amountOutMinimum: (_amountOut *
(1000 - _rewardsSwapSlippage)) / 1000,
sqrtPriceLimitX96: 0
})
)
{
_rewardsSwapSlippage = 10;
_depositRewards(
IERC20(rewardsToken).balanceOf(address(this)) -
_rewardsBalBefore
);
} catch {
_rewardsSwapSlippage += 10;
IERC20(DAI).safeDecreaseAllowance(V3_ROUTER, _amountDAI);
}
}
function depositRewards(uint256 _amount) external override {
require(_amount > 0, "DEPAM");
uint256 _rewardsBalBefore = IERC20(rewardsToken).balanceOf(
address(this)
);
IERC20(rewardsToken).safeTransferFrom(
_msgSender(),
address(this),
_amount
);
_depositRewards(
IERC20(rewardsToken).balanceOf(address(this)) - _rewardsBalBefore
);
}
function _depositRewards(uint256 _amountTotal) internal {
if (_amountTotal == 0) {
return;
}
if (totalShares == 0) {
_burnRewards(_amountTotal);
return;
}
uint256 _burnAmount = _amountTotal / 20; // 5% burn, 95% to rewards
uint256 _depositAmount = _amountTotal - _burnAmount;
_burnRewards(_burnAmount);
rewardsDeposited += _depositAmount;
rewardsDepMonthly[beginningOfMonth(block.timestamp)] += _depositAmount;
_rewardsPerShare += (PRECISION * _depositAmount) / totalShares;
emit DepositRewards(_msgSender(), _depositAmount);
}
function _distributeReward(address _wallet) internal {
if (shares[_wallet] == 0) {
return;
}
uint256 _amount = getUnpaid(_wallet);
rewards[_wallet].realized += _amount;
rewards[_wallet].excluded = _cumulativeRewards(shares[_wallet]);
if (_amount > 0) {
rewardsDistributed += _amount;
address[2] memory referrers = referral.getRelationsREF(_wallet);
uint256 amount2Referrer = (_amount * ((100 - 5) * 7)) / 10000;
IERC20(rewardsToken).safeTransfer(
_wallet,
_amount - amount2Referrer
);
emit DistributeReward(_wallet, _amount);
uint256 amount2Level1 = (amount2Referrer * 5) / 7;
uint256 amount2Level2 = amount2Referrer - amount2Level1;
if (referrers[0] == address(0)) {
_burnRewards(amount2Level1);
} else {
IERC20(rewardsToken).safeTransfer(referrers[0], amount2Level1);
emit ReferralDistribution(
_wallet,
referrers[0],
1,
amount2Level1
);
}
if (referrers[1] == address(0)) {
_burnRewards(amount2Level2);
} else {
IERC20(rewardsToken).safeTransfer(referrers[1], amount2Level2);
emit ReferralDistribution(
_wallet,
referrers[1],
2,
amount2Level2
);
}
}
}
function _burnRewards(uint256 _burnAmount) internal {
try IBARL(rewardsToken).burn(_burnAmount) {} catch {
IERC20(rewardsToken).safeTransfer(address(0xdead), _burnAmount);
}
}
function beginningOfMonth(
uint256 _timestamp
) public pure returns (uint256) {
(, , uint256 _dayOfMonth) = BokkyPooBahsDateTimeLibrary.timestampToDate(
_timestamp
);
return
_timestamp - ((_dayOfMonth - 1) * 1 days) - (_timestamp % 1 days);
}
function claimReward(address _wallet, address _referrer) external override {
if (!referral.isSetted(_wallet) && _referrer != address(0)) {
referral.setReferral(_referrer, _wallet);
}
_distributeReward(_wallet);
emit ClaimReward(_wallet);
}
function getUnpaid(address _wallet) public view returns (uint256) {
if (shares[_wallet] == 0) {
return 0;
}
uint256 earnedRewards = _cumulativeRewards(shares[_wallet]);
uint256 rewardsExcluded = rewards[_wallet].excluded;
if (earnedRewards <= rewardsExcluded) {
return 0;
}
return earnedRewards - rewardsExcluded;
}
function _cumulativeRewards(
uint256 _share
) internal view returns (uint256) {
return (_share * _rewardsPerShare) / PRECISION;
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_bondFee","type":"uint256"},{"internalType":"uint256","name":"_debondFee","type":"uint256"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"},{"internalType":"address","name":"_lpRewardsToken","type":"address"},{"internalType":"address","name":"_v2Router","type":"address"},{"internalType":"address","name":"_dai","type":"address"},{"internalType":"bool","name":"_stakeRestriction","type":"bool"},{"internalType":"contract IV3TwapUtilities","name":"_v3TwapUtilities","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountDAI","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"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":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTokensBonded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokensMinted","type":"uint256"}],"name":"Bond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newIdx","type":"address"},{"indexed":true,"internalType":"address","name":"wallet","type":"address"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDebonded","type":"uint256"}],"name":"Debond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountLiquidity","type":"uint256"}],"name":"RemoveLiquidity","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"},{"inputs":[],"name":"BOND_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEBOND_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FLASH_FEE_DAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idxLPTokens","type":"uint256"},{"internalType":"uint256","name":"_daiLPTokens","type":"uint256"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"addLiquidityV2","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"bond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"created","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint8[]","name":"","type":"uint8[]"}],"name":"debond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllAssets","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weighting","type":"uint256"},{"internalType":"uint256","name":"basePriceUSDX96","type":"uint256"},{"internalType":"address","name":"c1","type":"address"},{"internalType":"uint256","name":"q1","type":"uint256"}],"internalType":"struct IDecentralizedIndex.IndexAssetInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIdxPriceUSDX96","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getTokenPriceUSDX96","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"indexTokens","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weighting","type":"uint256"},{"internalType":"uint256","name":"basePriceUSDX96","type":"uint256"},{"internalType":"address","name":"c1","type":"address"},{"internalType":"uint256","name":"q1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"indexType","outputs":[{"internalType":"enum IDecentralizedIndex.IndexType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpRewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpStakingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lpTokens","type":"uint256"},{"internalType":"uint256","name":"_minIdxTokens","type":"uint256"},{"internalType":"uint256","name":"_minDAI","type":"uint256"}],"name":"removeLiquidityV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
610180604052600c805462ff00001961ff00199091166101001716620100001790553480156200002e57600080fd5b50604051620084c8380380620084c8833981016040819052620000519162000984565b8a8a8a8a8888888888888881600390805190602001906200007492919062000737565b5080516200008a90600490602084019062000737565b50506005805460ff191660121790555042600655608087905260a0869052600880546001600160a01b038088166001600160a01b0319909216919091179091556001600160601b0319606086901b1660c0526040805163c45a015560e01b8152905160009287169163c45a0155916004808301926020929190829003018186803b1580156200011857600080fd5b505afa1580156200012d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015391906200095e565b6001600160a01b031663c9c6539630866040518363ffffffff1660e01b81526004016200018292919062000b6c565b602060405180830381600087803b1580156200019d57600080fd5b505af1158015620001b2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d891906200095e565b905089604051602001620001ed919062000b10565b604051602081830303815290604052896040516020016200020f919062000b41565b60408051601f19818403018152919052600854869084906001600160a01b0316876200023d57600062000247565b6200024762000733565b876040516200025690620007cc565b62000268979695949392919062000b86565b604051809103906000f08015801562000285573d6000803e3d6000fd5b50600780546001600160a01b039283166001600160a01b03199091161790556001600160601b0319606083811b821660e05286901b1661010052604080516315ab88c960e31b815290519187169163ad5c464891600480820192602092909190829003018186803b158015620002fa57600080fd5b505afa1580156200030f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200033591906200095e565b6001600160601b0319606091821b8116610120529083901b16610140526200035c62000733565b6001600160a01b0316306001600160a01b03167f96b5b9b8a7193304150caccf9b80d150675fa3d6af57761d8d8ef1d6f9a1a90960405160405180910390a35050600580546000995090975061ff00191695506101009450879350620003c192505050565b0217905550836001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156200040057600080fd5b505afa15801562000415573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200043b91906200095e565b60601b6001600160601b031916610160528551875114620004795760405162461bcd60e51b8152600401620004709062000beb565b60405180910390fd5b60005b8751811015620005ff5760096040518060a001604052808a8481518110620004a057fe5b60200260200101516001600160a01b03168152602001898481518110620004c357fe5b602090810291909101810151825260008282018190526040808401829052606093840182905285546001818101885596835291839020855160059093020180546001600160a01b039384166001600160a01b031991821617825593860151968101969096558401516002860155918301516003850180549190931691161790556080015160049091015586518790829081106200055c57fe5b6020026020010151600d6000828254019250508190555080600b60008a84815181106200058557fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055506001600a60008a8481518110620005c457fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016200047c565b506000866000815181106200061057fe5b6020026020010151600d546c0100000000000000000000000002816200063257fe5b04905060005b88518110156200072057600d548982815181106200065257fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200069357600080fd5b505afa158015620006a8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006ce919062000abf565b60ff16600a0a838a8481518110620006e257fe5b6020026020010151020281620006f457fe5b04600982815481106200070357fe5b600091825260209091206004600590920201015560010162000638565b5050505050505050505050505062000c97565b3390565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200076f5760008555620007ba565b82601f106200078a57805160ff1916838001178555620007ba565b82800160010185558215620007ba579182015b82811115620007ba5782518255916020019190600101906200079d565b50620007c8929150620007da565b5090565b6139518062004b7783390190565b5b80821115620007c85760008155600101620007db565b8051620007fe8162000c7e565b919050565b600082601f83011262000814578081fd5b815160206200082d620008278362000c2d565b62000c09565b82815281810190858301838502870184018810156200084a578586fd5b855b8581101562000875578151620008628162000c7e565b845292840192908401906001016200084c565b5090979650505050505050565b600082601f83011262000893578081fd5b81516020620008a6620008278362000c2d565b8281528181019085830183850287018401881015620008c3578586fd5b855b858110156200087557815184529284019290840190600101620008c5565b80518015158114620007fe57600080fd5b600082601f83011262000905578081fd5b81516001600160401b038111156200091957fe5b6200092e601f8201601f191660200162000c09565b81815284602083860101111562000943578283fd5b6200095682602083016020870162000c4b565b949350505050565b60006020828403121562000970578081fd5b81516200097d8162000c7e565b9392505050565b60008060008060008060008060008060006101608c8e031215620009a6578687fd5b8b516001600160401b03811115620009bc578788fd5b620009ca8e828f01620008f4565b60208e0151909c5090506001600160401b03811115620009e8578788fd5b620009f68e828f01620008f4565b9a505060408c0151985060608c0151975060808c015160018060401b0381111562000a1f578788fd5b62000a2d8e828f0162000803565b60a08e015190985090506001600160401b0381111562000a4b578687fd5b62000a598e828f0162000882565b96505062000a6a60c08d01620007f1565b945062000a7a60e08d01620007f1565b935062000a8b6101008d01620007f1565b925062000a9c6101208d01620008e3565b915062000aad6101408d01620007f1565b90509295989b509295989b9093969950565b60006020828403121562000ad1578081fd5b815160ff811681146200097d578182fd5b6000815180845262000afc81602086016020860162000c4b565b601f01601f19169290920160200192915050565b600066029ba30b5b2b2160cd1b8252825162000b3481600785016020870162000c4b565b9190910160070192915050565b6000607360f81b8252825162000b5f81600185016020870162000c4b565b9190910160010192915050565b6001600160a01b0392831681529116602082015260400190565b600060e0825262000b9b60e083018a62000ae2565b828103602084015262000baf818a62000ae2565b6001600160a01b03988916604085015296881660608401525050928516608084015290841660a083015290921660c09092019190915292915050565b6020808252600490820152631253925560e21b604082015260600190565b6040518181016001600160401b038111828210171562000c2557fe5b604052919050565b60006001600160401b0382111562000c4157fe5b5060209081020190565b60005b8381101562000c6857818101518382015260200162000c4e565b8381111562000c78576000848401525b50505050565b6001600160a01b038116811462000c9457600080fd5b50565b60805160a05160c05160601c60e05160601c6101005160601c6101205160601c6101405160601c6101605160601c613dcb62000dac600039806122ad5280612e9c52508061057252806118a1528061196c52508061224c52806122dc52806125ac5280612eec5250806108c85280610e4f5280610f3d5280610f725280610feb52806110e4528061119352806112225280612ab25280612c495280612ecb52806131c35250806106a1528061077e528061081a528061084f52806109815280610a305280610abf528061208552806120d352508061087152806108985280610f035280610f945280610fc35280612b045280612bc05250806118365280611b0c5250806115985280611d8c5250613dcb6000f3fe6080604052600436106101c65760003560e01c806370a08231116100f7578063a9059cbb11610095578063d757a9fb11610064578063d757a9fb146104ef578063dd62ed3e1461050f578063ee9c79da1461052f578063ff140ca61461054f576101d6565b8063a9059cbb1461047a578063bdc8d0601461049a578063c87fa42a146104af578063ccec3716146104cf576101d6565b806395b3921e116100d157806395b3921e1461040257806395d89b4114610425578063a457c2d71461043a578063a515366a1461045a576101d6565b806370a08231146103ad5780638071c8ec146103cd57806394cc699e146103ed576101d6565b8063313ce567116101645780634a437f881161013e5780634a437f88146103235780634b6f16491461035457806353f504471461036957806358f4dcc31461038b576101d6565b8063313ce567146102cc578063325a19f1146102ee5780633950935114610303576101d6565b806318160ddd116101a057806318160ddd1461025357806320800a001461027557806323b872dd1461028a5780632acada4d146102aa576101d6565b806306917a54146101db57806306fdde03146101fb578063095ea7b314610226576101d6565b366101d6576101d434610564565b005b600080fd5b3480156101e757600080fd5b506101d46101f636600461378b565b610688565b34801561020757600080fd5b50610210610b45565b60405161021d9190613990565b60405180910390f35b34801561023257600080fd5b506102466102413660046135f4565b610bdb565b60405161021d9190613968565b34801561025f57600080fd5b50610268610bf8565b60405161021d9190613987565b34801561028157600080fd5b506101d4610bfe565b34801561029657600080fd5b506102466102a53660046135b4565b610c29565b3480156102b657600080fd5b506102bf610cb1565b60405161021d91906138ec565b3480156102d857600080fd5b506102e1610d48565b60405161021d9190613b8d565b3480156102fa57600080fd5b50610268610d51565b34801561030f57600080fd5b5061024661031e3660046135f4565b610d57565b34801561032f57600080fd5b5061034361033e36600461366d565b610da5565b60405161021d9594939291906138b9565b34801561036057600080fd5b50610268610df2565b34801561037557600080fd5b5061037e610df7565b60405161021d9190613973565b34801561039757600080fd5b506103a0610e05565b60405161021d9190613802565b3480156103b957600080fd5b506102686103c8366004613544565b610e14565b3480156103d957600080fd5b506101d46103e836600461378b565b610e33565b3480156103f957600080fd5b506103a06112ab565b34801561040e57600080fd5b506104176112ba565b60405161021d929190613b7f565b34801561043157600080fd5b506102106113f4565b34801561044657600080fd5b506102466104553660046135f4565b611455565b34801561046657600080fd5b506101d46104753660046135f4565b6114bd565b34801561048657600080fd5b506102466104953660046135f4565b611820565b3480156104a657600080fd5b50610268611834565b3480156104bb57600080fd5b506102466104ca366004613544565b611858565b3480156104db57600080fd5b506101d46104ea366004613544565b611876565b3480156104fb57600080fd5b5061026861050a366004613544565b611a88565b34801561051b57600080fd5b5061026861052a36600461357c565b611a99565b34801561053b57600080fd5b506101d461054a36600461369d565b611ac4565b34801561055b57600080fd5b50610268611d8a565b8061056e57610685565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c957600080fd5b505afa1580156105dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106019190613560565b6001600160a01b031682604051610617906137ff565b60006040518083038185875af1925050503d8060008114610654576040519150601f19603f3d011682016040523d82523d6000602084013e610659565b606091505b50509050806106835760405162461bcd60e51b815260040161067a90613a8c565b60405180910390fd5b505b50565b600c805461ff0019169055821561069f5782610742565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a082316106d6611dae565b6040518263ffffffff1660e01b81526004016106f29190613802565b60206040518083038186803b15801561070a57600080fd5b505afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190613685565b9250600083116107645760405162461bcd60e51b815260040161067a90613a6d565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906107b3903090600401613802565b60206040518083038186803b1580156107cb57600080fd5b505afa1580156107df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108039190613685565b9050610842610810611dae565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903087611db2565b6108966001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000086611e12565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663baa2abde307f00000000000000000000000000000000000000000000000000000000000000008787876108f2611dae565b426040518863ffffffff1660e01b81526004016109159796959493929190613816565b6040805180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190613768565b50506040516370a0823160e01b815281906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906109b6903090600401613802565b60206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190613685565b1115610ae857610ae8610a17611dae565b6040516370a0823160e01b815283906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610a65903090600401613802565b60206040518083038186803b158015610a7d57600080fd5b505afa158015610a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab59190613685565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692919003611efd565b610af0611dae565b6001600160a01b03167fdfdd120ded9b7afc0c23dd5310e93aaa3e1c3b9f75af9b805fab3030842439f285604051610b289190613987565b60405180910390a25050600c805461ff0019166101001790555050565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bd15780601f10610ba657610100808354040283529160200191610bd1565b820191906000526020600020905b815481529060010190602001808311610bb457829003601f168201915b5050505050905090565b6000610bef610be8611dae565b8484611f54565b50600192915050565b60025490565b60004711610c1e5760405162461bcd60e51b815260040161067a90613a09565b610c2747610564565b565b6000610c36848484612040565b610ca684610c42611dae565b610ca185604051806060016040528060288152602001613cb5602891396001600160a01b038a16600090815260016020526040812090610c80611dae565b6001600160a01b031681526020810191909152604001600020549190612157565b611f54565b5060015b9392505050565b60606009805480602002602001604051908101604052809291908181526020016000905b82821015610d3f5760008481526020908190206040805160a0810182526005860290920180546001600160a01b0390811684526001808301548587015260028301549385019390935260038201541660608401526004015460808301529083529092019101610cd5565b50505050905090565b60055460ff1690565b60065481565b6000610bef610d64611dae565b84610ca18560016000610d75611dae565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906121ee565b60098181548110610db557600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939092169085565b600a81565b600554610100900460ff1681565b6008546001600160a01b031681565b6001600160a01b0381166000908152602081905260409020545b919050565b600c805461ff00191690556000610e4930610e14565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610e999190613802565b60206040518083038186803b158015610eb157600080fd5b505afa158015610ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee99190613685565b9050610efd610ef6611dae565b3087612040565b610f28307f000000000000000000000000000000000000000000000000000000000000000087611f54565b610f65610f33611dae565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903087611db2565b610fb96001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000086611e12565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663e8e33700307f000000000000000000000000000000000000000000000000000000000000000088886103e88981038302046103e88a81038c0204611026611dae565b426040518963ffffffff1660e01b815260040161104a989796959493929190613856565b606060405180830381600087803b15801561106457600080fd5b505af1158015611078573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109c91906137b6565b505050816110a930610e14565b11156110cb576110cb306110bb611dae565b846110c530610e14565b03612040565b6040516370a0823160e01b815281906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611119903090600401613802565b60206040518083038186803b15801561113157600080fd5b505afa158015611145573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111699190613685565b111561124b5761124b61117a611dae565b6040516370a0823160e01b815283906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906111c8903090600401613802565b60206040518083038186803b1580156111e057600080fd5b505afa1580156111f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112189190613685565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692919003611efd565b611253611dae565b6001600160a01b03167f06239653922ac7bea6aa2b19dc486b9361821d37712eb796adfd38d81de278ca868660405161128d929190613b7f565b60405180910390a25050600c805461ff001916610100179055505050565b6007546001600160a01b031681565b600080806601000000000000815b6009548110156113e757600082611304600984815481106112e557fe5b60009182526020909120600590910201546001600160a01b0316612248565b8161130b57fe5b049050826009838154811061131c57fe5b6000918252602091829020600590910201546040805163313ce56760e01b815290516001600160a01b039092169263313ce56792600480840193829003018186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a291906137e3565b60ff16600a0a600984815481106113b557fe5b9060005260206000209060050201600401548302816113d057fe5b04816113d857fe5b049390930192506001016112c8565b5060009350909150509091565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bd15780601f10610ba657610100808354040283529160200191610bd1565b6000610bef611462611dae565b84610ca185604051806060016040528060258152602001613d71602591396001600061148c611dae565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612157565b600c5462010000900460ff166114e55760405162461bcd60e51b815260040161067a90613aef565b600c805462ffff00191690556001600160a01b0382166000908152600a602052604090205460ff166115295760405162461bcd60e51b815260040161067a90613aaa565b6001600160a01b0382166000908152600b6020526040812054600980549192918390811061155357fe5b90600052602060002090600502016004015461156d610d48565b60ff16600a0a600160601b8502028161158257fe5b049050600061158f612660565b6115bf576127107f00000000000000000000000000000000000000000000000000000000000000008302046115c2565b60005b90506115d76115cf611dae565b828403612670565b80156115e7576115e73082612670565b60005b6009548110156117a857600084821461176357866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561163657600080fd5b505afa15801561164a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166e91906137e3565b60ff16600a0a6009868154811061168157fe5b906000526020600020906005020160010154600984815481106116a057fe5b6000918252602091829020600590910201546040805163313ce56760e01b815290516001600160a01b039092169263313ce56792600480840193829003018186803b1580156116ee57600080fd5b505afa158015611702573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172691906137e3565b60ff16600a0a6009858154811061173957fe5b9060005260206000209060050201600101548902028161175557fe5b048161175d57fe5b04611765565b855b905061179f6009838154811061177757fe5b60009182526020909120600590910201546001600160a01b0316611799611dae565b83612760565b506001016115ea565b50846001600160a01b03166117bb611dae565b6001600160a01b03167fad49529616fd9fe4b34e00ac3f98d5cc3531e1232a95f249113b23fdf13c7e8586856040516117f5929190613b7f565b60405180910390a35050600c805462ff00001961ff0019909116610100171662010000179055505050565b6000610bef61182d611dae565b8484612040565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03166000908152600a602052604090205460ff1690565b6001600160a01b03811630141561189f5760405162461bcd60e51b815260040161067a90613a28565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f857600080fd5b505afa15801561190c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119309190613560565b6001600160a01b0316611941611dae565b6001600160a01b0316146119675760405162461bcd60e51b815260040161067a906139e3565b6106857f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119c357600080fd5b505afa1580156119d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fb9190613560565b6040516370a0823160e01b81526001600160a01b038416906370a0823190611a27903090600401613802565b60206040518083038186803b158015611a3f57600080fd5b505afa158015611a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a779190613685565b6001600160a01b0384169190611efd565b6000611a9382612248565b92915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600c5462010000900460ff16611aec5760405162461bcd60e51b815260040161067a90613aef565b600c805462ffff00191690556000611b0384612894565b611b35576127107f00000000000000000000000000000000000000000000000000000000000000008103850204611b37565b835b90506000611b43610bf8565b600160601b830281611b5157fe5b049050611b5f610ef6611dae565b611b6930836128b4565b60005b600954811015611d1e57600060098281548110611b8557fe5b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611bc3903090600401613802565b60206040518083038186803b158015611bdb57600080fd5b505afa158015611bef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c139190613685565b9050600160601b83820204611c58611c29611dae565b8260098681548110611c3757fe5b60009182526020909120600590910201546001600160a01b03169190611efd565b80820360098481548110611c6857fe5b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611ca6903090600401613802565b60206040518083038186803b158015611cbe57600080fd5b505afa158015611cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf69190613685565b1015611d145760405162461bcd60e51b815260040161067a90613ad0565b5050600101611b6c565b50611d27611dae565b6001600160a01b03167fe4bf69c2fff7ace5eed72842e9abf52af2218a3a78cb83d7824f999dbfd75e7186604051611d5f9190613987565b60405180910390a25050600c805462ff00001961ff0019909116610100171662010000179055505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611e0c9085906129b0565b50505050565b6000611ea882856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015611e7657600080fd5b505afa158015611e8a573d6000803e3d6000fd5b505050506040513d6020811015611ea057600080fd5b5051906121ee565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150611e0c9085906129b0565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611f4f9084906129b0565b505050565b6001600160a01b038316611f995760405162461bcd60e51b8152600401808060200182810382526024815260200180613d236024913960400191505060405180910390fd5b6001600160a01b038216611fde5760405162461bcd60e51b8152600401808060200182810382526022815260200180613c476022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600c54610100900460ff16801561205a5750600c5460ff16155b1561214c57600061206a30610e14565b90506000612710612079610bf8565b8161208057fe5b0490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b0316141580156120c55750808210155b80156120f9575060006120f77f0000000000000000000000000000000000000000000000000000000000000000610e14565b115b1561214957600c805460ff1916600117905561213e60648202831015612134578160140283101561212a578161212f565b816014025b612139565b816064025b612a61565b600c805460ff191690555b50505b611f4f838383612d3c565b600081848411156121e65760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121ab578181015183820152602001612193565b50505050905090810190601f1680156121d85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610caa576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614156122935761228c612e97565b9050610e2e565b60405163e6a4390560e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e6a43905906123049086907f00000000000000000000000000000000000000000000000000000000000000009060040161389f565b60206040518083038186803b15801561231c57600080fd5b505afa158015612330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123549190613560565b90506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561239157600080fd5b505afa1580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c99190613560565b90506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561240657600080fd5b505afa15801561241a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243e91906137e3565b90506000836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561247b57600080fd5b505afa15801561248f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b39190613560565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156124eb57600080fd5b505afa1580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252391906137e3565b9050600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561256157600080fd5b505afa158015612575573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612599919061361f565b509150915060006125a8612e97565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b03161461261d578360ff16600a0a836001600160701b03168660ff16600a0a846001600160701b03168402028161260f57fe5b048161261757fe5b04612653565b8460ff16600a0a826001600160701b03168560ff16600a0a856001600160701b03168402028161264957fe5b048161265157fe5b045b9998505050505050505050565b600061266a610bf8565b15905090565b6001600160a01b0382166126cb576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6126d760008383611f4f565b6002546126e490826121ee565b6002556001600160a01b03821660009081526020819052604090205461270a90826121ee565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061278f903090600401613802565b60206040518083038186803b1580156127a757600080fd5b505afa1580156127bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127df9190613685565b90506127f66001600160a01b038516843085611db2565b6040516370a0823160e01b8152818301906001600160a01b038616906370a0823190612826903090600401613802565b60206040518083038186803b15801561283e57600080fd5b505afa158015612852573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128769190613685565b1015611e0c5760405162461bcd60e51b815260040161067a90613a4d565b600060646128a0610bf8565b606202816128aa57fe5b0490911015919050565b6001600160a01b0382166128f95760405162461bcd60e51b8152600401808060200182810382526021815260200180613cdd6021913960400191505060405180910390fd5b61290582600083611f4f565b61294281604051806060016040528060228152602001613c25602291396001600160a01b0385166000908152602081905260409020549190612157565b6001600160a01b038316600090815260208190526040902055600254612968908261327d565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000612a05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132da9092919063ffffffff16565b805190915015611f4f57808060200190516020811015612a2457600080fd5b5051611f4f5760405162461bcd60e51b815260040180806020018281038252602a815260200180613d47602a913960400191505060405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612a9057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110612ade57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050612b29307f000000000000000000000000000000000000000000000000000000000000000084611f54565b600754604080516345e35f5960e11b815290516000926001600160a01b031691638bc6beb2916004808301926020929190829003018186803b158015612b6e57600080fd5b505afa158015612b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba69190613560565b604051635c11d79560e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635c11d79590612bfe908690600090879087904290600401613b0f565b600060405180830381600087803b158015612c1857600080fd5b505af1158015612c2c573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691506370a0823190612c7f908590600401613802565b60206040518083038186803b158015612c9757600080fd5b505afa158015612cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ccf9190613685565b90508015611e0c576040516344ab194b60e01b81526001600160a01b038316906344ab194b90612d0490600090600401613987565b600060405180830381600087803b158015612d1e57600080fd5b505af1158015612d32573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316612d815760405162461bcd60e51b8152600401808060200182810382526025815260200180613cfe6025913960400191505060405180910390fd5b6001600160a01b038216612dc65760405162461bcd60e51b8152600401808060200182810382526023815260200180613c026023913960400191505060405180910390fd5b612dd1838383611f4f565b612e0e81604051806060016040528060268152602001613c69602691396001600160a01b0386166000908152602081905260409020549190612157565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612e3d90826121ee565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e6a439057f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040518363ffffffff1660e01b8152600401612f2892919061389f565b60206040518083038186803b158015612f4057600080fd5b505afa158015612f54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f789190613560565b90506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015612fb557600080fd5b505afa158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190613560565b9050600080826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561302b57600080fd5b505afa15801561303f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306391906137e3565b846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d49190613560565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561310c57600080fd5b505afa158015613120573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314491906137e3565b91509150600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561318457600080fd5b505afa158015613198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131bc919061361f565b50915091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b031614613238578260ff16600a0a826001600160701b03168560ff16600a0a836001600160701b0316600160601b02028161322a57fe5b048161323257fe5b04613272565b8360ff16600a0a816001600160701b03168460ff16600a0a846001600160701b0316600160601b02028161326857fe5b048161327057fe5b045b965050505050505090565b6000828211156132d4576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60606132e984846000856132f1565b949350505050565b6060824710156133325760405162461bcd60e51b8152600401808060200182810382526026815260200180613c8f6026913960400191505060405180910390fd5b61333b8561344c565b61338c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106133ca5780518252601f1990920191602091820191016133ab565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461342c576040519150601f19603f3d011682016040523d82523d6000602084013e613431565b606091505b5091509150613441828286613452565b979650505050505050565b3b151590565b60608315613461575081610caa565b8251156134715782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156121ab578181015183820152602001612193565b600082601f8301126134c8578081fd5b813560206134dd6134d883613bbf565b613b9b565b82815281810190858301838502870184018810156134f9578586fd5b855b8581101561352057813561350e81613bf2565b845292840192908401906001016134fb565b5090979650505050505050565b80516001600160701b0381168114610e2e57600080fd5b600060208284031215613555578081fd5b8135610caa81613bdd565b600060208284031215613571578081fd5b8151610caa81613bdd565b6000806040838503121561358e578081fd5b823561359981613bdd565b915060208301356135a981613bdd565b809150509250929050565b6000806000606084860312156135c8578081fd5b83356135d381613bdd565b925060208401356135e381613bdd565b929592945050506040919091013590565b60008060408385031215613606578182fd5b823561361181613bdd565b946020939093013593505050565b600080600060608486031215613633578283fd5b61363c8461352d565b925061364a6020850161352d565b9150604084015163ffffffff81168114613662578182fd5b809150509250925092565b60006020828403121561367e578081fd5b5035919050565b600060208284031215613696578081fd5b5051919050565b6000806000606084860312156136b1578283fd5b8335925060208085013567ffffffffffffffff808211156136d0578485fd5b818701915087601f8301126136e3578485fd5b81356136f16134d882613bbf565b81815284810190848601868402860187018c101561370d578889fd5b8895505b8386101561373857803561372481613bdd565b835260019590950194918601918601613711565b50965050506040870135925080831115613750578384fd5b505061375e868287016134b8565b9150509250925092565b6000806040838503121561377a578182fd5b505080516020909101519092909150565b60008060006060848603121561379f578283fd5b505081359360208301359350604090920135919050565b6000806000606084860312156137ca578081fd5b8351925060208401519150604084015190509250925092565b6000602082840312156137f4578081fd5b8151610caa81613bf2565b90565b6001600160a01b0391909116815260200190565b6001600160a01b039788168152958716602087015260408601949094526060850192909252608084015290921660a082015260c081019190915260e00190565b6001600160a01b039889168152968816602088015260408701959095526060860193909352608085019190915260a084015290921660c082015260e08101919091526101000190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b602080825282518282018190526000919060409081850190868401855b8281101561395b57815180516001600160a01b03908116865287820151888701528682015187870152606080830151909116908601526080908101519085015260a09093019290850190600101613909565b5091979650505050505050565b901515815260200190565b602081016002831061398157fe5b91905290565b90815260200190565b6000602080835283518082850152825b818110156139bc578581018301518582016040015282016139a0565b818111156139cd5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60208082526005908201526409c9e8aa8960db1b604082015260600190565b6020808252600b908201526a554e415641494c41424c4560a81b604082015260600190565b60208082526006908201526515119495905360d21b604082015260600190565b6020808252600590820152644c5052454d60d81b604082015260600190565b60208082526004908201526314d1539560e21b604082015260600190565b6020808252600c908201526b24a72b20a624a22a27a5a2a760a11b604082015260600190565b602080825260059082015264484541565960d81b604082015260600190565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015613b5e5784516001600160a01b031683529383019391830191600101613b39565b50506001600160a01b03969096166060850152505050608001529392505050565b918252602082015260400190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715613bb757fe5b604052919050565b600067ffffffffffffffff821115613bd357fe5b5060209081020190565b6001600160a01b038116811461068557600080fd5b60ff8116811461068557600080fdfe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220784e8fb62a20b277782e242a420760088dacc64a620ebef6f243e9eb26bda39664736f6c6343000706003360806040523480156200001157600080fd5b506040516200395138038062003951833981810160405260e08110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b506040908152602082810151918301516060840151608085015160a09095015189519497509195509392909188918891620001d991600391850190620002e2565b508051620001ef906004906020840190620002e2565b50506005805460ff191660121790555062000209620002de565b60058054610100600160a81b0319166101006001600160a01b0393841602179055600680546001600160a01b031990811687841617909155600880549091169184169190911790556040518190869030908690620002679062000377565b6001600160a01b039485168152928416602084015290831660408084019190915292166060820152905190819003608001906000f080158015620002af573d6000803e3d6000fd5b50600780546001600160a01b0319166001600160a01b0392909216919091179055506200039c95505050505050565b3390565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200031a576000855562000365565b82601f106200033557805160ff191683800117855562000365565b8280016001018555821562000365579182015b828111156200036557825182559160200191906001019062000348565b506200037392915062000385565b5090565b61206780620018ea83390190565b5b8082111562000373576000815560010162000386565b61153e80620003ac6000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80638bc6beb2116100ad578063adc9772e11610071578063adc9772e14610356578063c56e0ad814610382578063da0e1dab1461038a578063dba802d914610392578063dd62ed3e146103b857610121565b80638bc6beb2146102e657806390eb3911146102ee57806395d89b41146102f6578063a457c2d7146102fe578063a9059cbb1461032a57610121565b80632e17de78116100f45780632e17de7814610233578063313ce56714610252578063395093511461027057806370a082311461029c57806372f702f3146102c257610121565b806306fdde0314610126578063095ea7b3146101a357806318160ddd146101e357806323b872dd146101fd575b600080fd5b61012e6103e6565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cf600480360360408110156101b957600080fd5b506001600160a01b03813516906020013561047c565b604080519115158252519081900360200190f35b6101eb610499565b60408051918252519081900360200190f35b6101cf6004803603606081101561021357600080fd5b506001600160a01b0381358116916020810135909116906040013561049f565b6102506004803603602081101561024957600080fd5b5035610527565b005b61025a6105a1565b6040805160ff9092168252519081900360200190f35b6101cf6004803603604081101561028657600080fd5b506001600160a01b0381351690602001356105aa565b6101eb600480360360208110156102b257600080fd5b50356001600160a01b03166105f8565b6102ca610613565b604080516001600160a01b039092168252519081900360200190f35b6102ca610622565b6102ca610631565b61012e610645565b6101cf6004803603604081101561031457600080fd5b506001600160a01b0381351690602001356106a6565b6101cf6004803603604081101561034057600080fd5b506001600160a01b03813516906020013561070e565b6102506004803603604081101561036c57600080fd5b506001600160a01b038135169060200135610722565b6102506107ff565b6102ca61086e565b610250600480360360208110156103a857600080fd5b50356001600160a01b031661087d565b6101eb600480360360408110156103ce57600080fd5b506001600160a01b03813581169160200135166108fc565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104725780601f1061044757610100808354040283529160200191610472565b820191906000526020600020905b81548152906001019060200180831161045557829003601f168201915b5050505050905090565b6000610490610489610927565b848461092b565b50600192915050565b60025490565b60006104ac848484610a17565b61051c846104b8610927565b61051785604051806060016040528060288152602001611428602891396001600160a01b038a166000908152600160205260408120906104f6610927565b6001600160a01b031681526020810191909152604001600020549190610a32565b61092b565b5060015b9392505050565b610538610532610927565b82610ac9565b610556610543610927565b6006546001600160a01b03169083610ae3565b61055e610927565b6001600160a01b03167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd826040518082815260200191505060405180910390a250565b60055460ff1690565b60006104906105b7610927565b8461051785600160006105c8610927565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610b35565b6001600160a01b031660009081526020819052604090205490565b6006546001600160a01b031681565b6007546001600160a01b031681565b60055461010090046001600160a01b031681565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104725780601f1061044757610100808354040283529160200191610472565b60006104906106b3610927565b84610517856040518060600160405280602581526020016114e460259139600160006106dd610927565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610a32565b600061049061071b610927565b8484610a17565b6008546001600160a01b031615610780576008546001600160a01b03838116911614610780576040805162461bcd60e51b8152602060048201526008602482015267149154d5149250d560c21b604482015290519081900360640190fd5b61078a8282610b8f565b6107a9610795610927565b6006546001600160a01b0316903084610ba5565b816001600160a01b03166107bb610927565b6001600160a01b03167f99039fcf0a98f484616c5196ee8b2ecfa971babf0b519848289ea4db381f85f7836040518082815260200191505060405180910390a35050565b6008546001600160a01b0316610813610927565b6001600160a01b03161461085c576040805162461bcd60e51b815260206004820152600b60248201526a0a48aa6aaa68aa482aaa8960ab1b604482015290519081900360640190fd5b600880546001600160a01b0319169055565b6008546001600160a01b031681565b6008546001600160a01b0316610891610927565b6001600160a01b0316146108da576040805162461bcd60e51b815260206004820152600b60248201526a0a48aa6aaa68aa482aaa8960ab1b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166109705760405162461bcd60e51b81526004018080602001828103825260248152602001806114966024913960400191505060405180910390fd5b6001600160a01b0382166109b55760405162461bcd60e51b81526004018080602001828103825260228152602001806113ba6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b610a22838383610c05565b610a2d838383610d60565b505050565b60008184841115610ac15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a86578181015183820152602001610a6e565b50505050905090810190601f168015610ab35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b610ad38282610e9c565b610adf82600083610d60565b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a2d908490610f98565b600082820183811015610520576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b610b998282611049565b610adf60008383610d60565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610bff908590610f98565b50505050565b6001600160a01b038316610c4a5760405162461bcd60e51b81526004018080602001828103825260258152602001806114716025913960400191505060405180910390fd5b6001600160a01b038216610c8f5760405162461bcd60e51b81526004018080602001828103825260238152602001806113756023913960400191505060405180910390fd5b610c9a838383610a2d565b610cd7816040518060600160405280602681526020016113dc602691396001600160a01b0386166000908152602081905260409020549190610a32565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610d069082610b35565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001600160a01b03831615801590610d8357506001600160a01b03831661dead14155b15610dfd576007546040805163d6460b4b60e01b81526001600160a01b03868116600483015260248201859052600160448301529151919092169163d6460b4b91606480830192600092919082900301818387803b158015610de457600080fd5b505af1158015610df8573d6000803e3d6000fd5b505050505b6001600160a01b03821615801590610e2057506001600160a01b03821661dead14155b15610a2d576007546040805163d6460b4b60e01b81526001600160a01b03858116600483015260248201859052600060448301819052925193169263d6460b4b9260648084019391929182900301818387803b158015610e7f57600080fd5b505af1158015610e93573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216610ee15760405162461bcd60e51b81526004018080602001828103825260218152602001806114506021913960400191505060405180910390fd5b610eed82600083610a2d565b610f2a81604051806060016040528060228152602001611398602291396001600160a01b0385166000908152602081905260409020549190610a32565b6001600160a01b038316600090815260208190526040902055600254610f509082611139565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610fed826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111969092919063ffffffff16565b805190915015610a2d5780806020019051602081101561100c57600080fd5b5051610a2d5760405162461bcd60e51b815260040180806020018281038252602a8152602001806114ba602a913960400191505060405180910390fd5b6001600160a01b0382166110a4576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6110b060008383610a2d565b6002546110bd9082610b35565b6002556001600160a01b0382166000908152602081905260409020546110e39082610b35565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082821115611190576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60606111a584846000856111ad565b949350505050565b6060824710156111ee5760405162461bcd60e51b81526004018080602001828103825260268152602001806114026026913960400191505060405180910390fd5b6111f785611308565b611248576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106112865780518252601f199092019160209182019101611267565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146112e8576040519150601f19603f3d011682016040523d82523d6000602084013e6112ed565b606091505b50915091506112fd82828661130e565b979650505050505050565b3b151590565b6060831561131d575081610520565b82511561132d5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315610a86578181015183820152602001610a6e56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122026fb6ccc18e2514144edb5f3d2cf11ff208c7e99b55157a9c5e9c656a8b88d2d64736f6c6343000706003360c0604052600a6007553480156200001657600080fd5b506040516200206738038062002067833981016040819052620000399162000088565b6001600160601b0319606094851b811660a0529290931b909116608052600180546001600160a01b039283166001600160a01b0319918216179091556002805492909316911617905562000108565b600080600080608085870312156200009e578384fd5b8451620000ab81620000ef565b6020860151909450620000be81620000ef565b6040860151909350620000d181620000ef565b6060860151909250620000e481620000ef565b939692955090935050565b6001600160a01b03811681146200010557600080fd5b50565b60805160601c60a05160601c611f086200015f600039806104e3528061058352508061028252806102c4528061038952806103be52806103e75280610623528061070e528061075e52806108555250611f086000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80638bdf67f2116100a2578063bde3081811610071578063bde30818146101f0578063ce7c2ac2146101f8578063d076eabc1461020b578063d1af0c7d1461021e578063d6460b4b146102265761010b565b80638bdf67f2146101ba5780639c1454d4146101cd578063a95ae7eb146101d5578063ba32722e146101dd5761010b565b80634953c782116100de5780634953c78214610179578063773f400e1461018c578063869890381461019f57806389d96917146101a75761010b565b80630700037d146101105780631441a5a91461013a5780633a98ef391461014f57806344ab194b14610164575b600080fd5b61012361011e366004611b7d565b610239565b604051610131929190611d30565b60405180910390f35b610142610252565b6040516101319190611d02565b610157610261565b6040516101319190611e2d565b610177610172366004611cd2565b610267565b005b610177610187366004611bb5565b610933565b61017761019a366004611b7d565b610a73565b610157610b7d565b6101576101b5366004611b7d565b610b83565b6101776101c8366004611cd2565b610c02565b610157610cfe565b610157610d04565b6101576101eb366004611cd2565b610d0a565b610142610d1c565b610157610206366004611b7d565b610d2b565b610157610219366004611cd2565b610d3d565b610142610d6e565b610177610234366004611bed565b610d7d565b6006602052600090815260409020805460019091015482565b6000546001600160a01b031681565b60035481565b80156102aa576102aa610278610dc7565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903084610dcb565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906102f9903090600401611d02565b60206040518083038186803b15801561031157600080fd5b505afa158015610325573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103499190611cea565b9050600081116103745760405162461bcd60e51b815260040161036b90611d83565b60405180910390fd5b60025460009081906001600160a01b039081167f0000000000000000000000000000000000000000000000000000000000000000909116106103e2576002546001600160a01b03167f0000000000000000000000000000000000000000000000000000000000000000610411565b6002547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03165b9150915060006040518060600160405280846001600160a01b03168152602001836001600160a01b0316815260200161271062ffffff16815250905060006104dd73e592427a0aece92de3edee1f18e0157c058615646001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561049f57600080fd5b505afa1580156104b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d79190611b99565b83610e2b565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637fb4f79d836040518263ffffffff1660e01b815260040161052d9190611d02565b60206040518083038186803b15801561054557600080fd5b505afa158015610559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057d9190611b99565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d4bf1334836040518263ffffffff1660e01b81526004016105cd9190611d02565b60206040518083038186803b1580156105e557600080fd5b505afa1580156105f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061d9190611cea565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b03161461066f5781600160601b89028161066957fe5b04610679565b600160601b828902045b6002546040516370a0823160e01b81529192506000916001600160a01b03909116906370a08231906106af903090600401611d02565b60206040518083038186803b1580156106c757600080fd5b505afa1580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff9190611cea565b90506107496001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001673e592427a0aece92de3edee1f18e0157c058615648b610f0f565b60408051610100810182526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682526002541660208201526127108183015230606082015242608082015260a081018b90526007546103e890810385020460c0820152600060e0820152905163414bf38960e01b815273e592427a0aece92de3edee1f18e0157c058615649163414bf389916107f19190600401611dc4565b602060405180830381600087803b15801561080b57600080fd5b505af192505050801561083b575060408051601f3d908101601f1916820190925261083891810190611cea565b60015b6108955760078054600a0190556108906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001673e592427a0aece92de3edee1f18e0157c058615648b610ffa565b610927565b50600a6007556002546040516370a0823160e01b81526109279183916001600160a01b03909116906370a08231906108d1903090600401611d02565b60206040518083038186803b1580156108e957600080fd5b505afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109219190611cea565b0361109c565b50505050505050505050565b60005460405163745149f760e11b81526001600160a01b039091169063e8a293ee90610963908590600401611d02565b60206040518083038186803b15801561097b57600080fd5b505afa15801561098f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b39190611cb6565b1580156109c857506001600160a01b03811615155b15610a32576000546040516307543e3f60e41b81526001600160a01b0390911690637543e3f0906109ff9084908690600401611d16565b600060405180830381600087803b158015610a1957600080fd5b505af1158015610a2d573d6000803e3d6000fd5b505050505b610a3b8261116e565b6040516001600160a01b038316907f63e32091e4445d16e29c33a6b264577c2d86694021aa4e6f4dd590048f5792e890600090a25050565b6000546001600160a01b0316610aa357600080546001600160a01b0319166001600160a01b038316179055610b7a565b60008054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610aef57600080fd5b505afa158015610b03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b279190611b99565b6001600160a01b0316610b38610dc7565b6001600160a01b031614610b5e5760405162461bcd60e51b815260040161036b90611d5d565b600080546001600160a01b0319166001600160a01b0383161790555b50565b60045481565b6001600160a01b038116600090815260056020526040812054610ba857506000610bfd565b6001600160a01b038216600090815260056020526040812054610bca90611417565b6001600160a01b038416600090815260066020526040902054909150808211610bf857600092505050610bfd565b900390505b919050565b60008111610c225760405162461bcd60e51b815260040161036b90611d3e565b6002546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610c53903090600401611d02565b60206040518083038186803b158015610c6b57600080fd5b505afa158015610c7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca39190611cea565b9050610cc4610cb0610dc7565b6002546001600160a01b0316903085610dcb565b6002546040516370a0823160e01b8152610cfa9183916001600160a01b03909116906370a08231906108d1903090600401611d02565b5050565b60095481565b600a5481565b600b6020526000908152604090205481565b6001546001600160a01b031681565b60056020526000908152604090205481565b600080610d498361143c565b92505050620151808381610d5957fe5b06600182036201518002840303915050919050565b6002546001600160a01b031681565b6001546001600160a01b0316610d91610dc7565b6001600160a01b031614610db75760405162461bcd60e51b815260040161036b90611d5d565b610dc283838361145b565b505050565b3390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610e259085906114f4565b50505050565b600081602001516001600160a01b031682600001516001600160a01b031610610e5357600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301206001600160f81b031960a085015294901b6bffffffffffffffffffffffff191660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b6000610fa582856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015610f7357600080fd5b505afa158015610f87573d6000803e3d6000fd5b505050506040513d6020811015610f9d57600080fd5b5051906115a5565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150610e259085906114f4565b6000610fa582604051806060016040528060298152602001611e5a6029913960408051636eb1769f60e11b81523060048201526001600160a01b03888116602483015291519189169163dd62ed3e91604480820192602092909190829003018186803b15801561106957600080fd5b505afa15801561107d573d6000803e3d6000fd5b505050506040513d602081101561109357600080fd5b50519190611606565b806110a657610b7a565b6003546110bb576110b68161169d565b610b7a565b601481048082036110cb8261169d565b600a80548201905580600b60006110e142610d3d565b81526020810191909152604001600020805490910190556003546ec097ce7bc90715b34b9f100000000082028161111457fe5b60088054929091049091019055611129610dc7565b6001600160a01b03167fb9ad861b752f80117b35bea6dec99933d8a5ae360f2839ee8784b750d5613409826040516111619190611e2d565b60405180910390a2505050565b6001600160a01b03811660009081526005602052604090205461119057610b7a565b600061119b82610b83565b6001600160a01b038316600090815260066020908152604080832060010180548501905560059091529020549091506111d390611417565b6001600160a01b0383166000908152600660205260409020558015610cfa57600980548201905560008054604051637ea6214160e01b81526001600160a01b0390911690637ea621419061122b908690600401611d02565b604080518083038186803b15801561124257600080fd5b505afa158015611256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127a9190611c2e565b600254909150612710610299840204906112a0906001600160a01b031685838603611711565b836001600160a01b03167fe8b160e373db99a103e0a2abfa029b9c3fc8b328984a1ead8a65ae68ae646db7846040516112d99190611e2d565b60405180910390a281516007600583020490818303906001600160a01b031661130a576113058261169d565b61137b565b8351600254611325916001600160a01b039091169084611711565b83600060200201516001600160a01b0316866001600160a01b03167f3c9cdf8031af5e42bf108b83dc6f1cfbb2174081f2754d093e4382c9925586a0600185604051611372929190611d30565b60405180910390a35b60208401516001600160a01b031661139b576113968161169d565b61140f565b6113b984600160200201516002546001600160a01b03169083611711565b83600160200201516001600160a01b0316866001600160a01b03167f3c9cdf8031af5e42bf108b83dc6f1cfbb2174081f2754d093e4382c9925586a0600284604051611406929190611d30565b60405180910390a35b505050505050565b60006ec097ce7bc90715b34b9f100000000060085483028161143557fe5b0492915050565b6000808061144e620151808504611763565b9196909550909350915050565b80156114b15761146b83836117f9565b826001600160a01b03167fae0577e1c96b26fbc0b9df702431f5470979d001d24f136eded791b8b6521d6f836040516114a49190611e2d565b60405180910390a2610dc2565b6114bb83836118d8565b826001600160a01b03167fba8f3777cf908803bf1f3dd58e7f4b7d3de4dbe3c234c4ccab0975d98f7cd388836040516111619190611e2d565b6000611549826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661199f9092919063ffffffff16565b805190915015610dc25780806020019051602081101561156857600080fd5b5051610dc25760405162461bcd60e51b815260040180806020018281038252602a815260200180611ea9602a913960400191505060405180910390fd5b6000828201838110156115ff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600081848411156116955760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561165a578181015183820152602001611642565b50505050905090810190601f1680156116875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600254604051630852cd8d60e31b81526001600160a01b03909116906342966c68906116cd908490600401611e2d565b600060405180830381600087803b1580156116e757600080fd5b505af19250505080156116f8575060015b610b7a576002546110b6906001600160a01b031661dead835b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610dc29084906114f4565b60008080836226496581018262023ab1600483020590506004600362023ab18302010590910390600062164b09610fa0600185010205905060046105b58202058303601f019250600061098f84605002816117ba57fe5b0590506000605061098f83020585039050600b820560301994909401606402929092018301996002600c90940290910392909201975095509350505050565b6001600160a01b0382166000908152600560205260409020541580159061183857506001600160a01b0382166000908152600560205260409020548111155b6118545760405162461bcd60e51b815260040161036b90611da4565b61185d8261116e565b6003805482900390556001600160a01b038216600090815260056020526040902080548290039081905561189657600480546000190190555b6001600160a01b0382166000908152600560205260409020546118b890611417565b6001600160a01b0390921660009081526006602052604090209190915550565b6001600160a01b038216600090815260056020526040902054156118ff576118ff8261116e565b6001600160a01b038216600090815260056020526040902080546003805484019055815483019091558015801561194d57506001600160a01b03831660009081526005602052604090205415155b1561195c576004805460010190555b6001600160a01b03831660009081526005602052604090205461197e90611417565b6001600160a01b039093166000908152600660205260409020929092555050565b60606119ae84846000856119b6565b949350505050565b6060824710156119f75760405162461bcd60e51b8152600401808060200182810382526026815260200180611e836026913960400191505060405180910390fd5b611a0085611b11565b611a51576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310611a8f5780518252601f199092019160209182019101611a70565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611af1576040519150601f19603f3d011682016040523d82523d6000602084013e611af6565b606091505b5091509150611b06828286611b17565b979650505050505050565b3b151590565b60608315611b265750816115ff565b825115611b365782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561165a578181015183820152602001611642565b600060208284031215611b8e578081fd5b81356115ff81611e36565b600060208284031215611baa578081fd5b81516115ff81611e36565b60008060408385031215611bc7578081fd5b8235611bd281611e36565b91506020830135611be281611e36565b809150509250929050565b600080600060608486031215611c01578081fd5b8335611c0c81611e36565b9250602084013591506040840135611c2381611e4b565b809150509250925092565b600060408284031215611c3f578081fd5b82601f830112611c4d578081fd5b6040516040810181811067ffffffffffffffff82111715611c6a57fe5b8060405250808385604086011115611c80578384fd5b835b6002811015611cab578151611c9681611e36565b83526020928301929190910190600101611c82565b509195945050505050565b600060208284031215611cc7578081fd5b81516115ff81611e4b565b600060208284031215611ce3578081fd5b5035919050565b600060208284031215611cfb578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b918252602082015260400190565b602080825260059082015264444550414d60d81b604082015260600190565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b6020808252600790820152664e45454444414960c81b604082015260600190565b60208082526006908201526552454d4f564560d01b604082015260600190565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b90815260200190565b6001600160a01b0381168114610b7a57600080fd5b8015158114610b7a57600080fdfe5361666545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212207dc10dc2fd759c3d6bc436d90113940563b09ffe800a9743419392835b82345464736f6c63430007060033000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000012c00000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e000000000000000000000000000000000000000000000000000000000000000e57726170706564204261726c65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005774241524c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x6080604052600436106101c65760003560e01c806370a08231116100f7578063a9059cbb11610095578063d757a9fb11610064578063d757a9fb146104ef578063dd62ed3e1461050f578063ee9c79da1461052f578063ff140ca61461054f576101d6565b8063a9059cbb1461047a578063bdc8d0601461049a578063c87fa42a146104af578063ccec3716146104cf576101d6565b806395b3921e116100d157806395b3921e1461040257806395d89b4114610425578063a457c2d71461043a578063a515366a1461045a576101d6565b806370a08231146103ad5780638071c8ec146103cd57806394cc699e146103ed576101d6565b8063313ce567116101645780634a437f881161013e5780634a437f88146103235780634b6f16491461035457806353f504471461036957806358f4dcc31461038b576101d6565b8063313ce567146102cc578063325a19f1146102ee5780633950935114610303576101d6565b806318160ddd116101a057806318160ddd1461025357806320800a001461027557806323b872dd1461028a5780632acada4d146102aa576101d6565b806306917a54146101db57806306fdde03146101fb578063095ea7b314610226576101d6565b366101d6576101d434610564565b005b600080fd5b3480156101e757600080fd5b506101d46101f636600461378b565b610688565b34801561020757600080fd5b50610210610b45565b60405161021d9190613990565b60405180910390f35b34801561023257600080fd5b506102466102413660046135f4565b610bdb565b60405161021d9190613968565b34801561025f57600080fd5b50610268610bf8565b60405161021d9190613987565b34801561028157600080fd5b506101d4610bfe565b34801561029657600080fd5b506102466102a53660046135b4565b610c29565b3480156102b657600080fd5b506102bf610cb1565b60405161021d91906138ec565b3480156102d857600080fd5b506102e1610d48565b60405161021d9190613b8d565b3480156102fa57600080fd5b50610268610d51565b34801561030f57600080fd5b5061024661031e3660046135f4565b610d57565b34801561032f57600080fd5b5061034361033e36600461366d565b610da5565b60405161021d9594939291906138b9565b34801561036057600080fd5b50610268610df2565b34801561037557600080fd5b5061037e610df7565b60405161021d9190613973565b34801561039757600080fd5b506103a0610e05565b60405161021d9190613802565b3480156103b957600080fd5b506102686103c8366004613544565b610e14565b3480156103d957600080fd5b506101d46103e836600461378b565b610e33565b3480156103f957600080fd5b506103a06112ab565b34801561040e57600080fd5b506104176112ba565b60405161021d929190613b7f565b34801561043157600080fd5b506102106113f4565b34801561044657600080fd5b506102466104553660046135f4565b611455565b34801561046657600080fd5b506101d46104753660046135f4565b6114bd565b34801561048657600080fd5b506102466104953660046135f4565b611820565b3480156104a657600080fd5b50610268611834565b3480156104bb57600080fd5b506102466104ca366004613544565b611858565b3480156104db57600080fd5b506101d46104ea366004613544565b611876565b3480156104fb57600080fd5b5061026861050a366004613544565b611a88565b34801561051b57600080fd5b5061026861052a36600461357c565b611a99565b34801561053b57600080fd5b506101d461054a36600461369d565b611ac4565b34801561055b57600080fd5b50610268611d8a565b8061056e57610685565b60007f000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c957600080fd5b505afa1580156105dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106019190613560565b6001600160a01b031682604051610617906137ff565b60006040518083038185875af1925050503d8060008114610654576040519150601f19603f3d011682016040523d82523d6000602084013e610659565b606091505b50509050806106835760405162461bcd60e51b815260040161067a90613a8c565b60405180910390fd5b505b50565b600c805461ff0019169055821561069f5782610742565b7f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b5796001600160a01b03166370a082316106d6611dae565b6040518263ffffffff1660e01b81526004016106f29190613802565b60206040518083038186803b15801561070a57600080fd5b505afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190613685565b9250600083116107645760405162461bcd60e51b815260040161067a90613a6d565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b57916906370a08231906107b3903090600401613802565b60206040518083038186803b1580156107cb57600080fd5b505afa1580156107df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108039190613685565b9050610842610810611dae565b6001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b57916903087611db2565b6108966001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b579167f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d86611e12565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663baa2abde307f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f8787876108f2611dae565b426040518863ffffffff1660e01b81526004016109159796959493929190613816565b6040805180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190613768565b50506040516370a0823160e01b815281906001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b57916906370a08231906109b6903090600401613802565b60206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190613685565b1115610ae857610ae8610a17611dae565b6040516370a0823160e01b815283906001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b57916906370a0823190610a65903090600401613802565b60206040518083038186803b158015610a7d57600080fd5b505afa158015610a91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab59190613685565b6001600160a01b037f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b5791692919003611efd565b610af0611dae565b6001600160a01b03167fdfdd120ded9b7afc0c23dd5310e93aaa3e1c3b9f75af9b805fab3030842439f285604051610b289190613987565b60405180910390a25050600c805461ff0019166101001790555050565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bd15780601f10610ba657610100808354040283529160200191610bd1565b820191906000526020600020905b815481529060010190602001808311610bb457829003601f168201915b5050505050905090565b6000610bef610be8611dae565b8484611f54565b50600192915050565b60025490565b60004711610c1e5760405162461bcd60e51b815260040161067a90613a09565b610c2747610564565b565b6000610c36848484612040565b610ca684610c42611dae565b610ca185604051806060016040528060288152602001613cb5602891396001600160a01b038a16600090815260016020526040812090610c80611dae565b6001600160a01b031681526020810191909152604001600020549190612157565b611f54565b5060015b9392505050565b60606009805480602002602001604051908101604052809291908181526020016000905b82821015610d3f5760008481526020908190206040805160a0810182526005860290920180546001600160a01b0390811684526001808301548587015260028301549385019390935260038201541660608401526004015460808301529083529092019101610cd5565b50505050905090565b60055460ff1690565b60065481565b6000610bef610d64611dae565b84610ca18560016000610d75611dae565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906121ee565b60098181548110610db557600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939092169085565b600a81565b600554610100900460ff1681565b6008546001600160a01b031681565b6001600160a01b0381166000908152602081905260409020545b919050565b600c805461ff00191690556000610e4930610e14565b905060007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610e999190613802565b60206040518083038186803b158015610eb157600080fd5b505afa158015610ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee99190613685565b9050610efd610ef6611dae565b3087612040565b610f28307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d87611f54565b610f65610f33611dae565b6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16903087611db2565b610fb96001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f167f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d86611e12565b6001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d1663e8e33700307f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f88886103e88981038302046103e88a81038c0204611026611dae565b426040518963ffffffff1660e01b815260040161104a989796959493929190613856565b606060405180830381600087803b15801561106457600080fd5b505af1158015611078573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109c91906137b6565b505050816110a930610e14565b11156110cb576110cb306110bb611dae565b846110c530610e14565b03612040565b6040516370a0823160e01b815281906001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906370a0823190611119903090600401613802565b60206040518083038186803b15801561113157600080fd5b505afa158015611145573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111699190613685565b111561124b5761124b61117a611dae565b6040516370a0823160e01b815283906001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906370a08231906111c8903090600401613802565b60206040518083038186803b1580156111e057600080fd5b505afa1580156111f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112189190613685565b6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1692919003611efd565b611253611dae565b6001600160a01b03167f06239653922ac7bea6aa2b19dc486b9361821d37712eb796adfd38d81de278ca868660405161128d929190613b7f565b60405180910390a25050600c805461ff001916610100179055505050565b6007546001600160a01b031681565b600080806601000000000000815b6009548110156113e757600082611304600984815481106112e557fe5b60009182526020909120600590910201546001600160a01b0316612248565b8161130b57fe5b049050826009838154811061131c57fe5b6000918252602091829020600590910201546040805163313ce56760e01b815290516001600160a01b039092169263313ce56792600480840193829003018186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a291906137e3565b60ff16600a0a600984815481106113b557fe5b9060005260206000209060050201600401548302816113d057fe5b04816113d857fe5b049390930192506001016112c8565b5060009350909150509091565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bd15780601f10610ba657610100808354040283529160200191610bd1565b6000610bef611462611dae565b84610ca185604051806060016040528060258152602001613d71602591396001600061148c611dae565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612157565b600c5462010000900460ff166114e55760405162461bcd60e51b815260040161067a90613aef565b600c805462ffff00191690556001600160a01b0382166000908152600a602052604090205460ff166115295760405162461bcd60e51b815260040161067a90613aaa565b6001600160a01b0382166000908152600b6020526040812054600980549192918390811061155357fe5b90600052602060002090600502016004015461156d610d48565b60ff16600a0a600160601b8502028161158257fe5b049050600061158f612660565b6115bf576127107f00000000000000000000000000000000000000000000000000000000000000648302046115c2565b60005b90506115d76115cf611dae565b828403612670565b80156115e7576115e73082612670565b60005b6009548110156117a857600084821461176357866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561163657600080fd5b505afa15801561164a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166e91906137e3565b60ff16600a0a6009868154811061168157fe5b906000526020600020906005020160010154600984815481106116a057fe5b6000918252602091829020600590910201546040805163313ce56760e01b815290516001600160a01b039092169263313ce56792600480840193829003018186803b1580156116ee57600080fd5b505afa158015611702573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172691906137e3565b60ff16600a0a6009858154811061173957fe5b9060005260206000209060050201600101548902028161175557fe5b048161175d57fe5b04611765565b855b905061179f6009838154811061177757fe5b60009182526020909120600590910201546001600160a01b0316611799611dae565b83612760565b506001016115ea565b50846001600160a01b03166117bb611dae565b6001600160a01b03167fad49529616fd9fe4b34e00ac3f98d5cc3531e1232a95f249113b23fdf13c7e8586856040516117f5929190613b7f565b60405180910390a35050600c805462ff00001961ff0019909116610100171662010000179055505050565b6000610bef61182d611dae565b8484612040565b7f000000000000000000000000000000000000000000000000000000000000012c81565b6001600160a01b03166000908152600a602052604090205460ff1690565b6001600160a01b03811630141561189f5760405162461bcd60e51b815260040161067a90613a28565b7f000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f857600080fd5b505afa15801561190c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119309190613560565b6001600160a01b0316611941611dae565b6001600160a01b0316146119675760405162461bcd60e51b815260040161067a906139e3565b6106857f000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119c357600080fd5b505afa1580156119d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fb9190613560565b6040516370a0823160e01b81526001600160a01b038416906370a0823190611a27903090600401613802565b60206040518083038186803b158015611a3f57600080fd5b505afa158015611a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a779190613685565b6001600160a01b0384169190611efd565b6000611a9382612248565b92915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600c5462010000900460ff16611aec5760405162461bcd60e51b815260040161067a90613aef565b600c805462ffff00191690556000611b0384612894565b611b35576127107f000000000000000000000000000000000000000000000000000000000000012c8103850204611b37565b835b90506000611b43610bf8565b600160601b830281611b5157fe5b049050611b5f610ef6611dae565b611b6930836128b4565b60005b600954811015611d1e57600060098281548110611b8557fe5b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611bc3903090600401613802565b60206040518083038186803b158015611bdb57600080fd5b505afa158015611bef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c139190613685565b9050600160601b83820204611c58611c29611dae565b8260098681548110611c3757fe5b60009182526020909120600590910201546001600160a01b03169190611efd565b80820360098481548110611c6857fe5b60009182526020909120600590910201546040516370a0823160e01b81526001600160a01b03909116906370a0823190611ca6903090600401613802565b60206040518083038186803b158015611cbe57600080fd5b505afa158015611cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf69190613685565b1015611d145760405162461bcd60e51b815260040161067a90613ad0565b5050600101611b6c565b50611d27611dae565b6001600160a01b03167fe4bf69c2fff7ace5eed72842e9abf52af2218a3a78cb83d7824f999dbfd75e7186604051611d5f9190613987565b60405180910390a25050600c805462ff00001961ff0019909116610100171662010000179055505050565b7f000000000000000000000000000000000000000000000000000000000000006481565b3390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611e0c9085906129b0565b50505050565b6000611ea882856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015611e7657600080fd5b505afa158015611e8a573d6000803e3d6000fd5b505050506040513d6020811015611ea057600080fd5b5051906121ee565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150611e0c9085906129b0565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611f4f9084906129b0565b505050565b6001600160a01b038316611f995760405162461bcd60e51b8152600401808060200182810382526024815260200180613d236024913960400191505060405180910390fd5b6001600160a01b038216611fde5760405162461bcd60e51b8152600401808060200182810382526022815260200180613c476022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600c54610100900460ff16801561205a5750600c5460ff16155b1561214c57600061206a30610e14565b90506000612710612079610bf8565b8161208057fe5b0490507f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b5796001600160a01b0316856001600160a01b0316141580156120c55750808210155b80156120f9575060006120f77f000000000000000000000000335d4433bcb18ee26161b236988d93b50310b579610e14565b115b1561214957600c805460ff1916600117905561213e60648202831015612134578160140283101561212a578161212f565b816014025b612139565b816064025b612a61565b600c805460ff191690555b50505b611f4f838383612d3c565b600081848411156121e65760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121ab578181015183820152602001612193565b50505050905090810190601f1680156121d85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610caa576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b031614156122935761228c612e97565b9050610e2e565b60405163e6a4390560e01b81526000906001600160a01b037f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f169063e6a43905906123049086907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29060040161389f565b60206040518083038186803b15801561231c57600080fd5b505afa158015612330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123549190613560565b90506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561239157600080fd5b505afa1580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c99190613560565b90506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561240657600080fd5b505afa15801561241a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243e91906137e3565b90506000836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561247b57600080fd5b505afa15801561248f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b39190613560565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156124eb57600080fd5b505afa1580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252391906137e3565b9050600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561256157600080fd5b505afa158015612575573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612599919061361f565b509150915060006125a8612e97565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b03161461261d578360ff16600a0a836001600160701b03168660ff16600a0a846001600160701b03168402028161260f57fe5b048161261757fe5b04612653565b8460ff16600a0a826001600160701b03168560ff16600a0a856001600160701b03168402028161264957fe5b048161265157fe5b045b9998505050505050505050565b600061266a610bf8565b15905090565b6001600160a01b0382166126cb576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6126d760008383611f4f565b6002546126e490826121ee565b6002556001600160a01b03821660009081526020819052604090205461270a90826121ee565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061278f903090600401613802565b60206040518083038186803b1580156127a757600080fd5b505afa1580156127bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127df9190613685565b90506127f66001600160a01b038516843085611db2565b6040516370a0823160e01b8152818301906001600160a01b038616906370a0823190612826903090600401613802565b60206040518083038186803b15801561283e57600080fd5b505afa158015612852573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128769190613685565b1015611e0c5760405162461bcd60e51b815260040161067a90613a4d565b600060646128a0610bf8565b606202816128aa57fe5b0490911015919050565b6001600160a01b0382166128f95760405162461bcd60e51b8152600401808060200182810382526021815260200180613cdd6021913960400191505060405180910390fd5b61290582600083611f4f565b61294281604051806060016040528060228152602001613c25602291396001600160a01b0385166000908152602081905260409020549190612157565b6001600160a01b038316600090815260208190526040902055600254612968908261327d565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000612a05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132da9092919063ffffffff16565b805190915015611f4f57808060200190516020811015612a2457600080fd5b5051611f4f5760405162461bcd60e51b815260040180806020018281038252602a815260200180613d47602a913960400191505060405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612a9057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81600181518110612ade57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050612b29307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611f54565b600754604080516345e35f5960e11b815290516000926001600160a01b031691638bc6beb2916004808301926020929190829003018186803b158015612b6e57600080fd5b505afa158015612b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba69190613560565b604051635c11d79560e01b81529091506001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d1690635c11d79590612bfe908690600090879087904290600401613b0f565b600060405180830381600087803b158015612c1857600080fd5b505af1158015612c2c573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1691506370a0823190612c7f908590600401613802565b60206040518083038186803b158015612c9757600080fd5b505afa158015612cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ccf9190613685565b90508015611e0c576040516344ab194b60e01b81526001600160a01b038316906344ab194b90612d0490600090600401613987565b600060405180830381600087803b158015612d1e57600080fd5b505af1158015612d32573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316612d815760405162461bcd60e51b8152600401808060200182810382526025815260200180613cfe6025913960400191505060405180910390fd5b6001600160a01b038216612dc65760405162461bcd60e51b8152600401808060200182810382526023815260200180613c026023913960400191505060405180910390fd5b612dd1838383611f4f565b612e0e81604051806060016040528060268152602001613c69602691396001600160a01b0386166000908152602081905260409020549190612157565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612e3d90826121ee565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000807f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f6001600160a01b031663e6a439057f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26040518363ffffffff1660e01b8152600401612f2892919061389f565b60206040518083038186803b158015612f4057600080fd5b505afa158015612f54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f789190613560565b90506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015612fb557600080fd5b505afa158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190613560565b9050600080826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561302b57600080fd5b505afa15801561303f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061306391906137e3565b846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d49190613560565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561310c57600080fd5b505afa158015613120573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314491906137e3565b91509150600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561318457600080fd5b505afa158015613198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131bc919061361f565b50915091507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b0316856001600160a01b031614613238578260ff16600a0a826001600160701b03168560ff16600a0a836001600160701b0316600160601b02028161322a57fe5b048161323257fe5b04613272565b8360ff16600a0a816001600160701b03168460ff16600a0a846001600160701b0316600160601b02028161326857fe5b048161327057fe5b045b965050505050505090565b6000828211156132d4576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60606132e984846000856132f1565b949350505050565b6060824710156133325760405162461bcd60e51b8152600401808060200182810382526026815260200180613c8f6026913960400191505060405180910390fd5b61333b8561344c565b61338c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106133ca5780518252601f1990920191602091820191016133ab565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461342c576040519150601f19603f3d011682016040523d82523d6000602084013e613431565b606091505b5091509150613441828286613452565b979650505050505050565b3b151590565b60608315613461575081610caa565b8251156134715782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156121ab578181015183820152602001612193565b600082601f8301126134c8578081fd5b813560206134dd6134d883613bbf565b613b9b565b82815281810190858301838502870184018810156134f9578586fd5b855b8581101561352057813561350e81613bf2565b845292840192908401906001016134fb565b5090979650505050505050565b80516001600160701b0381168114610e2e57600080fd5b600060208284031215613555578081fd5b8135610caa81613bdd565b600060208284031215613571578081fd5b8151610caa81613bdd565b6000806040838503121561358e578081fd5b823561359981613bdd565b915060208301356135a981613bdd565b809150509250929050565b6000806000606084860312156135c8578081fd5b83356135d381613bdd565b925060208401356135e381613bdd565b929592945050506040919091013590565b60008060408385031215613606578182fd5b823561361181613bdd565b946020939093013593505050565b600080600060608486031215613633578283fd5b61363c8461352d565b925061364a6020850161352d565b9150604084015163ffffffff81168114613662578182fd5b809150509250925092565b60006020828403121561367e578081fd5b5035919050565b600060208284031215613696578081fd5b5051919050565b6000806000606084860312156136b1578283fd5b8335925060208085013567ffffffffffffffff808211156136d0578485fd5b818701915087601f8301126136e3578485fd5b81356136f16134d882613bbf565b81815284810190848601868402860187018c101561370d578889fd5b8895505b8386101561373857803561372481613bdd565b835260019590950194918601918601613711565b50965050506040870135925080831115613750578384fd5b505061375e868287016134b8565b9150509250925092565b6000806040838503121561377a578182fd5b505080516020909101519092909150565b60008060006060848603121561379f578283fd5b505081359360208301359350604090920135919050565b6000806000606084860312156137ca578081fd5b8351925060208401519150604084015190509250925092565b6000602082840312156137f4578081fd5b8151610caa81613bf2565b90565b6001600160a01b0391909116815260200190565b6001600160a01b039788168152958716602087015260408601949094526060850192909252608084015290921660a082015260c081019190915260e00190565b6001600160a01b039889168152968816602088015260408701959095526060860193909352608085019190915260a084015290921660c082015260e08101919091526101000190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b602080825282518282018190526000919060409081850190868401855b8281101561395b57815180516001600160a01b03908116865287820151888701528682015187870152606080830151909116908601526080908101519085015260a09093019290850190600101613909565b5091979650505050505050565b901515815260200190565b602081016002831061398157fe5b91905290565b90815260200190565b6000602080835283518082850152825b818110156139bc578581018301518582016040015282016139a0565b818111156139cd5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b60208082526005908201526409c9e8aa8960db1b604082015260600190565b6020808252600b908201526a554e415641494c41424c4560a81b604082015260600190565b60208082526006908201526515119495905360d21b604082015260600190565b6020808252600590820152644c5052454d60d81b604082015260600190565b60208082526004908201526314d1539560e21b604082015260600190565b6020808252600c908201526b24a72b20a624a22a27a5a2a760a11b604082015260600190565b602080825260059082015264484541565960d81b604082015260600190565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015613b5e5784516001600160a01b031683529383019391830191600101613b39565b50506001600160a01b03969096166060850152505050608001529392505050565b918252602082015260400190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715613bb757fe5b604052919050565b600067ffffffffffffffff821115613bd357fe5b5060209081020190565b6001600160a01b038116811461068557600080fd5b60ff8116811461068557600080fdfe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220784e8fb62a20b277782e242a420760088dacc64a620ebef6f243e9eb26bda39664736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000012c00000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e000000000000000000000000000000000000000000000000000000000000000e57726170706564204261726c65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005774241524c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _name (string): Wrapped Barley
Arg [1] : _symbol (string): wBARL
Arg [2] : _bondFee (uint256): 100
Arg [3] : _debondFee (uint256): 300
Arg [4] : _tokens (address[]): 0x3e2324342bF5B8A1Dca42915f0489497203d640E
Arg [5] : _weights (uint256[]): 1
Arg [6] : _lpRewardsToken (address): 0x3e2324342bF5B8A1Dca42915f0489497203d640E
Arg [7] : _v2Router (address): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
Arg [8] : _dai (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F
Arg [9] : _stakeRestriction (bool): False
Arg [10] : _v3TwapUtilities (address): 0xA20803CCA2C4F3c6127239Bb964BdfDc93E2e05e
-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [3] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [6] : 0000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e
Arg [7] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [8] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 000000000000000000000000a20803cca2c4f3c6127239bb964bdfdc93e2e05e
Arg [11] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [12] : 57726170706564204261726c6579000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [14] : 774241524c000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [16] : 0000000000000000000000003e2324342bf5b8a1dca42915f0489497203d640e
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [18] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Net Worth in USD
$858.96
Net Worth in ETH
0.419563
Token Allocations
BARL
100.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.004963 | 173,076.5886 | $858.96 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.