ERC-20
Overview
Max Total Supply
52,742.4969118 ERC20 ***
Holders
4
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 8 Decimals)
Balance
12,327.38743615 ERC20 ***Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
gcDAI
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2020-11-29 */ // SPDX-License-Identifier: GPL-3.0-only pragma experimental ABIEncoderV2; // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.6.0; /** * @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; using Address for address; 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 returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view 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 { _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 { } } // File: @openzeppelin/contracts/utils/ReentrancyGuard.sol pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: contracts/GToken.sol pragma solidity ^0.6.0; /** * @dev Minimal interface for gTokens, implemented by the GTokenBase contract. * See GTokenBase.sol for further documentation. */ interface GToken is IERC20 { // pure functions function calcDepositSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) external pure returns (uint256 _netShares, uint256 _feeShares); function calcDepositCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) external pure returns (uint256 _cost, uint256 _feeShares); function calcWithdrawalSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) external pure returns (uint256 _grossShares, uint256 _feeShares); function calcWithdrawalCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) external pure returns (uint256 _cost, uint256 _feeShares); // view functions function reserveToken() external view returns (address _reserveToken); function totalReserve() external view returns (uint256 _totalReserve); function depositFee() external view returns (uint256 _depositFee); function withdrawalFee() external view returns (uint256 _withdrawalFee); // open functions function deposit(uint256 _cost) external; function withdraw(uint256 _grossShares) external; } // File: contracts/GPooler.sol pragma solidity ^0.6.0; /** * @dev An interface to extend gTokens with locked liquidity pools. * See GTokenBase.sol for further documentation. */ interface GPooler { // view functions function stakesToken() external view returns (address _stakesToken); function liquidityPool() external view returns (address _liquidityPool); function liquidityPoolBurningRate() external view returns (uint256 _burningRate); function liquidityPoolLastBurningTime() external view returns (uint256 _lastBurningTime); function liquidityPoolMigrationRecipient() external view returns (address _migrationRecipient); function liquidityPoolMigrationUnlockTime() external view returns (uint256 _migrationUnlockTime); // priviledged functions function allocateLiquidityPool(uint256 _stakesAmount, uint256 _sharesAmount) external; function setLiquidityPoolBurningRate(uint256 _burningRate) external; function burnLiquidityPoolPortion() external; function initiateLiquidityPoolMigration(address _migrationRecipient) external; function cancelLiquidityPoolMigration() external; function completeLiquidityPoolMigration() external; // emitted events event BurnLiquidityPoolPortion(uint256 _stakesAmount, uint256 _sharesAmount); event InitiateLiquidityPoolMigration(address indexed _migrationRecipient); event CancelLiquidityPoolMigration(address indexed _migrationRecipient); event CompleteLiquidityPoolMigration(address indexed _migrationRecipient, uint256 _stakesAmount, uint256 _sharesAmount); } // File: contracts/GFormulae.sol pragma solidity ^0.6.0; /** * @dev Pure implementation of deposit/minting and withdrawal/burning formulas * for gTokens. * All operations assume that, if total supply is 0, then the total * reserve is also 0, and vice-versa. * Fees are calculated percentually based on the gross amount. * See GTokenBase.sol for further documentation. */ library GFormulae { using SafeMath for uint256; /* deposit(cost): * price = reserve / supply * gross = cost / price * net = gross * 0.99 # fee is assumed to be 1% for simplicity * fee = gross - net * return net, fee */ function _calcDepositSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) internal pure returns (uint256 _netShares, uint256 _feeShares) { uint256 _grossShares = _totalSupply == _totalReserve ? _cost : _cost.mul(_totalSupply).div(_totalReserve); _netShares = _grossShares.mul(uint256(1e18).sub(_depositFee)).div(1e18); _feeShares = _grossShares.sub(_netShares); return (_netShares, _feeShares); } /* deposit_reverse(net): * price = reserve / supply * gross = net / 0.99 # fee is assumed to be 1% for simplicity * cost = gross * price * fee = gross - net * return cost, fee */ function _calcDepositCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) internal pure returns (uint256 _cost, uint256 _feeShares) { uint256 _grossShares = _netShares.mul(1e18).div(uint256(1e18).sub(_depositFee)); _cost = _totalReserve == _totalSupply ? _grossShares : _grossShares.mul(_totalReserve).div(_totalSupply); _feeShares = _grossShares.sub(_netShares); return (_cost, _feeShares); } /* withdrawal_reverse(cost): * price = reserve / supply * net = cost / price * gross = net / 0.99 # fee is assumed to be 1% for simplicity * fee = gross - net * return gross, fee */ function _calcWithdrawalSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) internal pure returns (uint256 _grossShares, uint256 _feeShares) { uint256 _netShares = _cost == _totalReserve ? _totalSupply : _cost.mul(_totalSupply).div(_totalReserve); _grossShares = _netShares.mul(1e18).div(uint256(1e18).sub(_withdrawalFee)); _feeShares = _grossShares.sub(_netShares); return (_grossShares, _feeShares); } /* withdrawal(gross): * price = reserve / supply * net = gross * 0.99 # fee is assumed to be 1% for simplicity * cost = net * price * fee = gross - net * return cost, fee */ function _calcWithdrawalCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) internal pure returns (uint256 _cost, uint256 _feeShares) { uint256 _netShares = _grossShares.mul(uint256(1e18).sub(_withdrawalFee)).div(1e18); _cost = _netShares == _totalSupply ? _totalReserve : _netShares.mul(_totalReserve).div(_totalSupply); _feeShares = _grossShares.sub(_netShares); return (_cost, _feeShares); } } // File: contracts/modules/Math.sol pragma solidity ^0.6.0; /** * @dev This library implements auxiliary math definitions. */ library Math { function _min(uint256 _amount1, uint256 _amount2) internal pure returns (uint256 _minAmount) { return _amount1 < _amount2 ? _amount1 : _amount2; } function _max(uint256 _amount1, uint256 _amount2) internal pure returns (uint256 _maxAmount) { return _amount1 > _amount2 ? _amount1 : _amount2; } } // File: contracts/interop/WrappedEther.sol pragma solidity ^0.6.0; /** * @dev Minimal set of declarations for WETH interoperability. */ interface WETH is IERC20 { function deposit() external payable; function withdraw(uint256 _amount) external; } // File: contracts/network/$.sol pragma solidity ^0.6.0; /** * @dev This library is provided for conveniece. It is the single source for * the current network and all related hardcoded contract addresses. It * also provide useful definitions for debuging faultless code via events. */ library $ { address constant stkGRO = 0xD93f98b483CC2F9EFE512696DF8F5deCB73F9497; address constant GRO = 0x09e64c2B61a5f1690Ee6fbeD9baf5D6990F8dFd0; address constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address constant cDAI = 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643; address constant cUSDC = 0x39AA39c021dfbaE8faC545936693aC917d5E7563; address constant cETH = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5; address constant cWBTC = 0xC11b1268C1A384e55C48c2391d8d480264A3A7F4; address constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888; address constant Aave_AAVE_LENDING_POOL = 0x398eC7346DcD622eDc5ae82352F02bE94C62d119; address constant Aave_AAVE_LENDING_POOL_CORE = 0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3; address constant Balancer_FACTORY = 0x9424B1412450D0f8Fc2255FAf6046b98213B76Bd; address constant Compound_COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B; address constant Dydx_SOLO_MARGIN = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e; } // File: contracts/modules/Wrapping.sol pragma solidity ^0.6.0; /** * @dev This library abstracts Wrapped Ether operations. */ library Wrapping { /** * @dev Sends some ETH to the Wrapped Ether contract in exchange for WETH. * @param _amount The amount of ETH to be wrapped in WETH. * @return _success A boolean indicating whether or not the operation suceeded. */ function _wrap(uint256 _amount) internal returns (bool _success) { try WETH($.WETH).deposit{value: _amount}() { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev Receives some ETH from the Wrapped Ether contract in exchange for WETH. * Note that the contract using this library function must declare a * payable receive/fallback function. * @param _amount The amount of ETH to be wrapped in WETH. * @return _success A boolean indicating whether or not the operation suceeded. */ function _unwrap(uint256 _amount) internal returns (bool _success) { try WETH($.WETH).withdraw(_amount) { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev Sends some ETH to the Wrapped Ether contract in exchange for WETH. * This operation will revert if it does not succeed. * @param _amount The amount of ETH to be wrapped in WETH. */ function _safeWrap(uint256 _amount) internal { require(_wrap(_amount), "wrap failed"); } /** * @dev Receives some ETH from the Wrapped Ether contract in exchange for WETH. * This operation will revert if it does not succeed. Note that * the contract using this library function must declare a payable * receive/fallback function. * @param _amount The amount of ETH to be wrapped in WETH. */ function _safeUnwrap(uint256 _amount) internal { require(_unwrap(_amount), "unwrap failed"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.6.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/modules/Transfers.sol pragma solidity ^0.6.0; /** * @dev This library abstracts ERC-20 operations. */ library Transfers { using SafeERC20 for IERC20; /** * @dev Retrieves a given ERC-20 token balance for the current contract. * @param _token An ERC-20 compatible token address. * @return _balance The current contract balance of the given ERC-20 token. */ function _getBalance(address _token) internal view returns (uint256 _balance) { return IERC20(_token).balanceOf(address(this)); } /** * @dev Allows a spender to access a given ERC-20 balance for the current contract. * @param _token An ERC-20 compatible token address. * @param _to The spender address. * @param _amount The exact spending allowance amount. */ function _approveFunds(address _token, address _to, uint256 _amount) internal { uint256 _allowance = IERC20(_token).allowance(address(this), _to); if (_allowance > _amount) { IERC20(_token).safeDecreaseAllowance(_to, _allowance - _amount); } else if (_allowance < _amount) { IERC20(_token).safeIncreaseAllowance(_to, _amount - _allowance); } } /** * @dev Transfer a given ERC-20 token amount into the current contract. * @param _token An ERC-20 compatible token address. * @param _from The source address. * @param _amount The amount to be transferred. */ function _pullFunds(address _token, address _from, uint256 _amount) internal { if (_amount == 0) return; IERC20(_token).safeTransferFrom(_from, address(this), _amount); } /** * @dev Transfer a given ERC-20 token amount from the current contract. * @param _token An ERC-20 compatible token address. * @param _to The target address. * @param _amount The amount to be transferred. */ function _pushFunds(address _token, address _to, uint256 _amount) internal { if (_amount == 0) return; IERC20(_token).safeTransfer(_to, _amount); } } // File: contracts/GExchange.sol pragma solidity ^0.6.0; /** * @dev Custom and uniform interface to a decentralized exchange. It is used * to estimate and convert funds whenever necessary. This furnishes * client contracts with the flexibility to replace conversion strategy * and routing, dynamically, by delegating these operations to different * external contracts that share this common interface. See * GUniswapV2Exchange.sol for further documentation. */ interface GExchange { // view functions function calcConversionOutputFromInput(address _from, address _to, uint256 _inputAmount) external view returns (uint256 _outputAmount); function calcConversionInputFromOutput(address _from, address _to, uint256 _outputAmount) external view returns (uint256 _inputAmount); // open functions function convertFunds(address _from, address _to, uint256 _inputAmount, uint256 _minOutputAmount) external returns (uint256 _outputAmount); } // File: contracts/modules/Conversions.sol pragma solidity ^0.6.0; library Conversions { function _dynamicConvertFunds(address _exchange, address _from, address _to, uint256 _inputAmount, uint256 _minOutputAmount) internal returns (uint256 _outputAmount) { Transfers._approveFunds(_from, _exchange, _inputAmount); try GExchange(_exchange).convertFunds(_from, _to, _inputAmount, _minOutputAmount) returns (uint256 _outAmount) { return _outAmount; } catch (bytes memory /* _data */) { Transfers._approveFunds(_from, _exchange, 0); return 0; } } } // File: contracts/interop/Aave.sol pragma solidity ^0.6.0; /** * @dev Minimal set of declarations for Aave interoperability. */ interface LendingPoolAddressesProvider { function getLendingPool() external view returns (address _pool); function getLendingPoolCore() external view returns (address payable _lendingPoolCore); function getPriceOracle() external view returns (address _priceOracle); } interface LendingPool { function getReserveConfigurationData(address _reserve) external view returns (uint256 _ltv, uint256 _liquidationThreshold, uint256 _liquidationBonus, address _interestRateStrategyAddress, bool _usageAsCollateralEnabled, bool _borrowingEnabled, bool _stableBorrowRateEnabled, bool _isActive); function getUserAccountData(address _user) external view returns (uint256 _totalLiquidityETH, uint256 _totalCollateralETH, uint256 _totalBorrowsETH, uint256 _totalFeesETH, uint256 _availableBorrowsETH, uint256 _currentLiquidationThreshold, uint256 _ltv, uint256 _healthFactor); function getUserReserveData(address _reserve, address _user) external view returns (uint256 _currentATokenBalance, uint256 _currentBorrowBalance, uint256 _principalBorrowBalance, uint256 _borrowRateMode, uint256 _borrowRate, uint256 _liquidityRate, uint256 _originationFee, uint256 _variableBorrowIndex, uint256 _lastUpdateTimestamp, bool _usageAsCollateralEnabled); function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external payable; function borrow(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode) external; function repay(address _reserve, uint256 _amount, address payable _onBehalfOf) external payable; function flashLoan(address _receiver, address _reserve, uint256 _amount, bytes calldata _params) external; } interface LendingPoolCore { function getReserveDecimals(address _reserve) external view returns (uint256 _decimals); function getReserveAvailableLiquidity(address _reserve) external view returns (uint256 _availableLiquidity); } interface AToken is IERC20 { function underlyingAssetAddress() external view returns (address _underlyingAssetAddress); function redeem(uint256 _amount) external; } interface APriceOracle { function getAssetPrice(address _asset) external view returns (uint256 _assetPrice); } interface FlashLoanReceiver { function executeOperation(address _reserve, uint256 _amount, uint256 _fee, bytes calldata _params) external; } // File: contracts/modules/AaveFlashLoanAbstraction.sol pragma solidity ^0.6.0; /** * @dev This library abstracts the Aave flash loan functionality. It has a * standardized flash loan interface. See GFlashBorrower.sol, * FlashLoans.sol, and DydxFlashLoanAbstraction.sol for further documentation. */ library AaveFlashLoanAbstraction { using SafeMath for uint256; uint256 constant FLASH_LOAN_FEE_RATIO = 9e14; // 0.09% /** * @dev Estimates the flash loan fee given the reserve token and required amount. * @param _token The ERC-20 token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _feeAmount the expected fee to be payed in excees of the loan amount. */ function _estimateFlashLoanFee(address _token, uint256 _netAmount) internal pure returns (uint256 _feeAmount) { _token; // silences warnings return _netAmount.mul(FLASH_LOAN_FEE_RATIO).div(1e18); } /** * @dev Retrieves the current market liquidity for a given reserve. * @param _token The reserve token to flash borrow from. * @return _liquidityAmount The reserve token available market liquidity. */ function _getFlashLoanLiquidity(address _token) internal view returns (uint256 _liquidityAmount) { address _core = $.Aave_AAVE_LENDING_POOL_CORE; return LendingPoolCore(_core).getReserveAvailableLiquidity(_token); } /** * @dev Triggers a flash loan. The current contract will receive a call * back with the loan amount and should repay it, including fees, * before returning. See GFlashBorrow.sol. * @param _token The reserve token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _context Additional data to be passed to the call back. * @return _success A boolean indicating whether or not the operation suceeded. */ function _requestFlashLoan(address _token, uint256 _netAmount, bytes memory _context) internal returns (bool _success) { address _pool = $.Aave_AAVE_LENDING_POOL; try LendingPool(_pool).flashLoan(address(this), _token, _netAmount, _context) { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev This function should be called as the final step of the flash * loan to properly implement the repay of the loan. * @param _token The reserve token. * @param _grossAmount The amount to be repayed including repay fees. */ function _paybackFlashLoan(address _token, uint256 _grossAmount) internal { address _poolCore = $.Aave_AAVE_LENDING_POOL_CORE; Transfers._pushFunds(_token, _poolCore, _grossAmount); } } // File: contracts/interop/Dydx.sol pragma solidity ^0.6.0; /** * @dev Minimal set of declarations for Dydx interoperability. */ interface SoloMargin { function getMarketTokenAddress(uint256 _marketId) external view returns (address _token); function getNumMarkets() external view returns (uint256 _numMarkets); function operate(Account.Info[] memory _accounts, Actions.ActionArgs[] memory _actions) external; } interface ICallee { function callFunction(address _sender, Account.Info memory _accountInfo, bytes memory _data) external; } library Account { struct Info { address owner; uint256 number; } } library Actions { enum ActionType { Deposit, Withdraw, Transfer, Buy, Sell, Trade, Liquidate, Vaporize, Call } struct ActionArgs { ActionType actionType; uint256 accountId; Types.AssetAmount amount; uint256 primaryMarketId; uint256 secondaryMarketId; address otherAddress; uint256 otherAccountId; bytes data; } } library Types { enum AssetDenomination { Wei, Par } enum AssetReference { Delta, Target } struct AssetAmount { bool sign; AssetDenomination denomination; AssetReference ref; uint256 value; } } // File: contracts/modules/DydxFlashLoanAbstraction.sol pragma solidity ^0.6.0; /** * @dev This library abstracts the Dydx flash loan functionality. It has a * standardized flash loan interface. See GFlashBorrower.sol, * FlashLoans.sol, and AaveFlashLoanAbstraction.sol for further documentation. */ library DydxFlashLoanAbstraction { using SafeMath for uint256; /** * @dev Estimates the flash loan fee given the reserve token and required amount. * @param _token The ERC-20 token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _feeAmount the expected fee to be payed in excees of the loan amount. */ function _estimateFlashLoanFee(address _token, uint256 _netAmount) internal pure returns (uint256 _feeAmount) { _token; _netAmount; // silences warnings return 2; // dydx has no fees, 2 wei is just a recommendation } /** * @dev Retrieves the current market liquidity for a given reserve. * @param _token The reserve token to flash borrow from. * @return _liquidityAmount The reserve token available market liquidity. */ function _getFlashLoanLiquidity(address _token) internal view returns (uint256 _liquidityAmount) { address _solo = $.Dydx_SOLO_MARGIN; return IERC20(_token).balanceOf(_solo); } /** * @dev Triggers a flash loan. The current contract will receive a call * back with the loan amount and should repay it, including fees, * before returning. See GFlashBorrow.sol. * @param _token The reserve token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _context Additional data to be passed to the call back. * @return _success A boolean indicating whether or not the operation suceeded. */ function _requestFlashLoan(address _token, uint256 _netAmount, bytes memory _context) internal returns (bool _success) { address _solo = $.Dydx_SOLO_MARGIN; uint256 _feeAmount = 2; uint256 _grossAmount = _netAmount.add(_feeAmount); // attempts to find the market id given a reserve token uint256 _marketId = uint256(-1); uint256 _numMarkets = SoloMargin(_solo).getNumMarkets(); for (uint256 _i = 0; _i < _numMarkets; _i++) { address _address = SoloMargin(_solo).getMarketTokenAddress(_i); if (_address == _token) { _marketId = _i; break; } } if (_marketId == uint256(-1)) return false; // a flash loan on Dydx is achieved by the following sequence of // actions: withdrawal, user call back, and finally a deposit; // which is configured below Account.Info[] memory _accounts = new Account.Info[](1); _accounts[0] = Account.Info({ owner: address(this), number: 1 }); Actions.ActionArgs[] memory _actions = new Actions.ActionArgs[](3); _actions[0] = Actions.ActionArgs({ actionType: Actions.ActionType.Withdraw, accountId: 0, amount: Types.AssetAmount({ sign: false, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: _netAmount }), primaryMarketId: _marketId, secondaryMarketId: 0, otherAddress: address(this), otherAccountId: 0, data: "" }); _actions[1] = Actions.ActionArgs({ actionType: Actions.ActionType.Call, accountId: 0, amount: Types.AssetAmount({ sign: false, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: 0 }), primaryMarketId: 0, secondaryMarketId: 0, otherAddress: address(this), otherAccountId: 0, data: abi.encode(_token, _netAmount, _feeAmount, _context) }); _actions[2] = Actions.ActionArgs({ actionType: Actions.ActionType.Deposit, accountId: 0, amount: Types.AssetAmount({ sign: true, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: _grossAmount }), primaryMarketId: _marketId, secondaryMarketId: 0, otherAddress: address(this), otherAccountId: 0, data: "" }); try SoloMargin(_solo).operate(_accounts, _actions) { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev This function should be called as the final step of the flash * loan to properly implement the repay of the loan. * @param _token The reserve token. * @param _grossAmount The amount to be repayed including repay fees. */ function _paybackFlashLoan(address _token, uint256 _grossAmount) internal { address _solo = $.Dydx_SOLO_MARGIN; Transfers._approveFunds(_token, _solo, _grossAmount); } } // File: contracts/modules/FlashLoans.sol pragma solidity ^0.6.0; /** * @dev This library abstracts the flash loan request combining both Aave/Dydx. * See GFlashBorrower.sol, AaveFlashLoanAbstraction.sol, and * DydxFlashLoanAbstraction.sol for further documentation. */ library FlashLoans { enum Provider { Aave, Dydx } /** * @dev Estimates the flash loan fee given the reserve token and required amount. * @param _provider The flash loan provider, either Aave or Dydx. * @param _token The ERC-20 token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _feeAmount the expected fee to be payed in excees of the loan amount. */ function _estimateFlashLoanFee(Provider _provider, address _token, uint256 _netAmount) internal pure returns (uint256 _feeAmount) { if (_provider == Provider.Aave) return AaveFlashLoanAbstraction._estimateFlashLoanFee(_token, _netAmount); if (_provider == Provider.Dydx) return DydxFlashLoanAbstraction._estimateFlashLoanFee(_token, _netAmount); } /** * @dev Retrieves the maximum market liquidity for a given reserve on * both Aave and Dydx. * @param _token The reserve token to flash borrow from. * @return _liquidityAmount The reserve token available market liquidity. */ function _getFlashLoanLiquidity(address _token) internal view returns (uint256 _liquidityAmount) { uint256 _liquidityAmountDydx = 0; _liquidityAmountDydx = DydxFlashLoanAbstraction._getFlashLoanLiquidity(_token); uint256 _liquidityAmountAave = 0; _liquidityAmountAave = AaveFlashLoanAbstraction._getFlashLoanLiquidity(_token); return Math._max(_liquidityAmountDydx, _liquidityAmountAave); } /** * @dev Triggers a flash loan on Dydx and, if unsuccessful, on Aave. * The current contract will receive a call back with the loan * amount and should repay it, including fees, before returning. * See GFlashBorrow.sol. * @param _token The reserve token to flash borrow from. * @param _netAmount The amount to be borrowed without considering repay fees. * @param _context Additional data to be passed to the call back. * @return _success A boolean indicating whether or not the operation suceeded. */ function _requestFlashLoan(address _token, uint256 _netAmount, bytes memory _context) internal returns (bool _success) { _success = DydxFlashLoanAbstraction._requestFlashLoan(_token, _netAmount, _context); if (_success) return true; _success = AaveFlashLoanAbstraction._requestFlashLoan(_token, _netAmount, _context); if (_success) return true; return false; } /** * @dev This function should be called as the final step of the flash * loan to properly implement the repay of the loan. * @param _provider The flash loan provider, either Aave or Dydx. * @param _token The reserve token. * @param _grossAmount The amount to be repayed including repay fees. */ function _paybackFlashLoan(Provider _provider, address _token, uint256 _grossAmount) internal { if (_provider == Provider.Aave) return AaveFlashLoanAbstraction._paybackFlashLoan(_token, _grossAmount); if (_provider == Provider.Dydx) return DydxFlashLoanAbstraction._paybackFlashLoan(_token, _grossAmount); } } // File: contracts/interop/Balancer.sol pragma solidity ^0.6.0; /** * @dev Minimal set of declarations for Balancer interoperability. */ interface BFactory { function newBPool() external returns (address _pool); } interface BPool is IERC20 { function getFinalTokens() external view returns (address[] memory _tokens); function getBalance(address _token) external view returns (uint256 _balance); function setSwapFee(uint256 _swapFee) external; function finalize() external; function bind(address _token, uint256 _balance, uint256 _denorm) external; function exitPool(uint256 _poolAmountIn, uint256[] calldata _minAmountsOut) external; function joinswapExternAmountIn(address _tokenIn, uint256 _tokenAmountIn, uint256 _minPoolAmountOut) external returns (uint256 _poolAmountOut); } // File: contracts/modules/BalancerLiquidityPoolAbstraction.sol pragma solidity ^0.6.0; /** * @dev This library abstracts the Balancer liquidity pool operations. */ library BalancerLiquidityPoolAbstraction { using SafeMath for uint256; uint256 constant MIN_AMOUNT = 1e6; // transported from Balancer uint256 constant TOKEN0_WEIGHT = 25e18; // 25/50 = 50% uint256 constant TOKEN1_WEIGHT = 25e18; // 25/50 = 50% uint256 constant SWAP_FEE = 10e16; // 10% /** * @dev Creates a two-asset liquidity pool and funds it by depositing * both assets. The create pool is public with a 50%/50% * distribution and 10% swap fee. * @param _token0 The ERC-20 token for the first asset of the pair. * @param _amount0 The amount of the first asset of the pair to be deposited. * @param _token1 The ERC-20 token for the second asset of the pair. * @param _amount1 The amount of the second asset of the pair to be deposited. * @return _pool The address of the newly created pool. */ function _createPool(address _token0, uint256 _amount0, address _token1, uint256 _amount1) internal returns (address _pool) { require(_amount0 >= MIN_AMOUNT && _amount1 >= MIN_AMOUNT, "amount below the minimum"); _pool = BFactory($.Balancer_FACTORY).newBPool(); Transfers._approveFunds(_token0, _pool, _amount0); Transfers._approveFunds(_token1, _pool, _amount1); BPool(_pool).bind(_token0, _amount0, TOKEN0_WEIGHT); BPool(_pool).bind(_token1, _amount1, TOKEN1_WEIGHT); BPool(_pool).setSwapFee(SWAP_FEE); BPool(_pool).finalize(); return _pool; } /** * @dev Deposits a single asset into the liquidity pool. * @param _pool The liquidity pool address. * @param _token The ERC-20 token for the asset being deposited. * @param _maxAmount The maximum amount to be deposited. * @return _amount The actual amount deposited. */ function _joinPool(address _pool, address _token, uint256 _maxAmount) internal returns (uint256 _amount) { if (_maxAmount == 0) return 0; uint256 _balanceAmount = BPool(_pool).getBalance(_token); if (_balanceAmount == 0) return 0; // caps the deposit amount to half the liquidity to mitigate error uint256 _limitAmount = _balanceAmount.div(2); _amount = Math._min(_maxAmount, _limitAmount); Transfers._approveFunds(_token, _pool, _amount); BPool(_pool).joinswapExternAmountIn(_token, _amount, 0); return _amount; } /** * @dev Withdraws a percentage of the pool shares. * @param _pool The liquidity pool address. * @param _percent The percent amount normalized to 1e18 (100%). * @return _amount0 The amount received of the first asset of the pair. * @return _amount1 The amount received of the second asset of the pair. */ function _exitPool(address _pool, uint256 _percent) internal returns (uint256 _amount0, uint256 _amount1) { if (_percent == 0) return (0, 0); address[] memory _tokens = BPool(_pool).getFinalTokens(); _amount0 = Transfers._getBalance(_tokens[0]); _amount1 = Transfers._getBalance(_tokens[1]); uint256 _poolAmount = Transfers._getBalance(_pool); uint256 _poolExitAmount = _poolAmount.mul(_percent).div(1e18); uint256[] memory _minAmountsOut = new uint256[](2); _minAmountsOut[0] = 0; _minAmountsOut[1] = 0; BPool(_pool).exitPool(_poolExitAmount, _minAmountsOut); _amount0 = Transfers._getBalance(_tokens[0]).sub(_amount0); _amount1 = Transfers._getBalance(_tokens[1]).sub(_amount1); return (_amount0, _amount1); } } // File: contracts/G.sol pragma solidity ^0.6.0; /** * @dev This public library provides a single entrypoint to most of the relevant * internal libraries available in the modules folder. It exists to * circunvent the contract size limitation imposed by the EVM. All function * calls are directly delegated to the target library function preserving * argument and return values exactly as they are. This library is shared * by many contracts and even other public libraries from this repository, * therefore it needs to be published alongside them. */ library G { function min(uint256 _amount1, uint256 _amount2) public pure returns (uint256 _minAmount) { return Math._min(_amount1, _amount2); } function safeWrap(uint256 _amount) public { Wrapping._safeWrap(_amount); } function safeUnwrap(uint256 _amount) public { Wrapping._safeUnwrap(_amount); } function getBalance(address _token) public view returns (uint256 _balance) { return Transfers._getBalance(_token); } function pullFunds(address _token, address _from, uint256 _amount) public { Transfers._pullFunds(_token, _from, _amount); } function pushFunds(address _token, address _to, uint256 _amount) public { Transfers._pushFunds(_token, _to, _amount); } function approveFunds(address _token, address _to, uint256 _amount) public { Transfers._approveFunds(_token, _to, _amount); } function dynamicConvertFunds(address _exchange, address _from, address _to, uint256 _inputAmount, uint256 _minOutputAmount) public returns (uint256 _outputAmount) { return Conversions._dynamicConvertFunds(_exchange, _from, _to, _inputAmount, _minOutputAmount); } function getFlashLoanLiquidity(address _token) public view returns (uint256 _liquidityAmount) { return FlashLoans._getFlashLoanLiquidity(_token); } function requestFlashLoan(address _token, uint256 _amount, bytes memory _context) public returns (bool _success) { return FlashLoans._requestFlashLoan(_token, _amount, _context); } function paybackFlashLoan(FlashLoans.Provider _provider, address _token, uint256 _grossAmount) public { FlashLoans._paybackFlashLoan(_provider, _token, _grossAmount); } function createPool(address _token0, uint256 _amount0, address _token1, uint256 _amount1) public returns (address _pool) { return BalancerLiquidityPoolAbstraction._createPool(_token0, _amount0, _token1, _amount1); } function joinPool(address _pool, address _token, uint256 _maxAmount) public returns (uint256 _amount) { return BalancerLiquidityPoolAbstraction._joinPool(_pool, _token, _maxAmount); } function exitPool(address _pool, uint256 _percent) public returns (uint256 _amount0, uint256 _amount1) { return BalancerLiquidityPoolAbstraction._exitPool(_pool, _percent); } } // File: contracts/GLiquidityPoolManager.sol pragma solidity ^0.6.0; /** * @dev This library implements data structure abstraction for the liquidity * pool management code in order to circuvent the EVM contract size limit. * It is therefore a public library shared by all gToken contracts and * needs to be published alongside them. See GTokenBase.sol for further * documentation. */ library GLiquidityPoolManager { using GLiquidityPoolManager for GLiquidityPoolManager.Self; uint256 constant MAXIMUM_BURNING_RATE = 2e16; // 2% uint256 constant DEFAULT_BURNING_RATE = 5e15; // 0.5% uint256 constant BURNING_INTERVAL = 7 days; uint256 constant MIGRATION_INTERVAL = 7 days; enum State { Created, Allocated, Migrating, Migrated } struct Self { address stakesToken; address sharesToken; State state; address liquidityPool; uint256 burningRate; uint256 lastBurningTime; address migrationRecipient; uint256 migrationUnlockTime; } /** * @dev Initializes the data structure. This method is exposed publicly. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _sharesToken The ERC-20 token address to be used as shares * token (gToken). */ function init(Self storage _self, address _stakesToken, address _sharesToken) public { _self.stakesToken = _stakesToken; _self.sharesToken = _sharesToken; _self.state = State.Created; _self.liquidityPool = address(0); _self.burningRate = DEFAULT_BURNING_RATE; _self.lastBurningTime = 0; _self.migrationRecipient = address(0); _self.migrationUnlockTime = uint256(-1); } /** * @dev Verifies whether or not a liquidity pool is migrating or * has migrated. This method is exposed publicly. * @return _hasMigrated A boolean indicating whether or not the pool * migration has started. */ function hasMigrated(Self storage _self) public view returns (bool _hasMigrated) { return _self.state == State.Migrating || _self.state == State.Migrated; } /** * @dev Moves the current balances (if any) of stakes and shares tokens * to the liquidity pool. This method is exposed publicly. */ function gulpPoolAssets(Self storage _self) public { if (!_self._hasPool()) return; G.joinPool(_self.liquidityPool, _self.stakesToken, G.getBalance(_self.stakesToken)); G.joinPool(_self.liquidityPool, _self.sharesToken, G.getBalance(_self.sharesToken)); } /** * @dev Sets the liquidity pool burning rate. This method is exposed * publicly. * @param _burningRate The percent value of the liquidity pool to be * burned at each 7-day period. */ function setBurningRate(Self storage _self, uint256 _burningRate) public { require(_burningRate <= MAXIMUM_BURNING_RATE, "invalid rate"); _self.burningRate = _burningRate; } /** * @dev Burns a portion of the liquidity pool according to the defined * burning rate. It must happen at most once every 7-days. This * method does not actually burn the funds, but it will redeem * the amounts from the pool to the caller contract, which is then * assumed to perform the burn. This method is exposed publicly. * @return _stakesAmount The amount of stakes (GRO) redeemed from the pool. * @return _sharesAmount The amount of shares (gToken) redeemed from the pool. */ function burnPoolPortion(Self storage _self) public returns (uint256 _stakesAmount, uint256 _sharesAmount) { require(_self._hasPool(), "pool not available"); require(now >= _self.lastBurningTime + BURNING_INTERVAL, "must wait lock interval"); _self.lastBurningTime = now; return G.exitPool(_self.liquidityPool, _self.burningRate); } /** * @dev Creates a fresh new liquidity pool and deposits the initial * amounts of the stakes token and the shares token. The pool * if configure 50%/50% with a 10% swap fee. This method is exposed * publicly. * @param _stakesAmount The amount of stakes token initially deposited * into the pool. * @param _sharesAmount The amount of shares token initially deposited * into the pool. */ function allocatePool(Self storage _self, uint256 _stakesAmount, uint256 _sharesAmount) public { require(_self.state == State.Created, "pool cannot be allocated"); _self.state = State.Allocated; _self.liquidityPool = G.createPool(_self.stakesToken, _stakesAmount, _self.sharesToken, _sharesAmount); } /** * @dev Initiates the liquidity pool migration by setting a funds * recipent and starting the clock towards the 7-day grace period. * This method is exposed publicly. * @param _migrationRecipient The recipient address to where funds will * be transfered. */ function initiatePoolMigration(Self storage _self, address _migrationRecipient) public { require(_self.state == State.Allocated || _self.state == State.Migrated, "migration unavailable"); _self.state = State.Migrating; _self.migrationRecipient = _migrationRecipient; _self.migrationUnlockTime = now + MIGRATION_INTERVAL; } /** * @dev Cancels the liquidity pool migration by reseting the procedure * to its original state. This method is exposed publicly. * @return _migrationRecipient The address of the former recipient. */ function cancelPoolMigration(Self storage _self) public returns (address _migrationRecipient) { require(_self.state == State.Migrating, "migration not initiated"); _migrationRecipient = _self.migrationRecipient; _self.state = State.Allocated; _self.migrationRecipient = address(0); _self.migrationUnlockTime = uint256(-1); return _migrationRecipient; } /** * @dev Completes the liquidity pool migration by redeeming all funds * from the pool. This method does not actually transfer the * redemeed funds to the recipient, it assumes the caller contract * will perform that. This method is exposed publicly. * @return _migrationRecipient The address of the recipient. * @return _stakesAmount The amount of stakes (GRO) redeemed from the pool. * @return _sharesAmount The amount of shares (gToken) redeemed from the pool. */ function completePoolMigration(Self storage _self) public returns (address _migrationRecipient, uint256 _stakesAmount, uint256 _sharesAmount) { require(_self.state == State.Migrating, "migration not initiated"); require(now >= _self.migrationUnlockTime, "must wait lock interval"); _migrationRecipient = _self.migrationRecipient; _self.state = State.Migrated; _self.migrationRecipient = address(0); _self.migrationUnlockTime = uint256(-1); (_stakesAmount, _sharesAmount) = G.exitPool(_self.liquidityPool, 1e18); return (_migrationRecipient, _stakesAmount, _sharesAmount); } /** * @dev Verifies whether or not a liquidity pool has been allocated. * @return _poolAvailable A boolean indicating whether or not the pool * is available. */ function _hasPool(Self storage _self) internal view returns (bool _poolAvailable) { return _self.state != State.Created; } } // File: contracts/GTokenBase.sol pragma solidity ^0.6.0; /** * @notice This abstract contract provides the basis implementation for all * gTokens. It extends the ERC20 functionality by implementing all * the methods of the GToken interface. The gToken basic functionality * comprises of a reserve, provided in the reserve token, and a supply * of shares. Every time someone deposits into the contract some amount * of reserve tokens it will receive a given amount of this gToken * shares. Conversely, upon withdrawal, someone redeems their previously * deposited assets by providing the associated amount of gToken shares. * The nominal price of a gToken is given by the ratio between the * reserve balance and the total supply of shares. Upon deposit and * withdrawal of funds a 1% fee is applied and collected from shares. * Half of it is immediately burned, which is equivalent to * redistributing it to all gToken holders, and the other half is * provided to a liquidity pool configured as a 50% GRO/50% gToken with * a 10% swap fee. Every week a percentage of the liquidity pool is * burned to account for the accumulated swap fees for that period. * Finally, the gToken contract provides functionality to migrate the * total amount of funds locked in the liquidity pool to an external * address, this mechanism is provided to facilitate the upgrade of * this gToken contract by future implementations. After migration has * started the fee for deposits becomes 2% and the fee for withdrawals * becomes 0%, in order to incentivise others to follow the migration. */ abstract contract GTokenBase is ERC20, Ownable, ReentrancyGuard, GToken, GPooler { using GLiquidityPoolManager for GLiquidityPoolManager.Self; uint256 constant DEPOSIT_FEE = 1e16; // 1% uint256 constant WITHDRAWAL_FEE = 1e16; // 1% uint256 constant DEPOSIT_FEE_AFTER_MIGRATION = 2e16; // 2% uint256 constant WITHDRAWAL_FEE_AFTER_MIGRATION = 0e16; // 0% address public immutable override stakesToken; address public immutable override reserveToken; GLiquidityPoolManager.Self lpm; /** * @dev Constructor for the gToken contract. * @param _name The ERC-20 token name. * @param _symbol The ERC-20 token symbol. * @param _decimals The ERC-20 token decimals. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _reserveToken The ERC-20 token address to be used as reserve * token (e.g. cDAI for gcDAI). */ constructor (string memory _name, string memory _symbol, uint8 _decimals, address _stakesToken, address _reserveToken) ERC20(_name, _symbol) public { _setupDecimals(_decimals); stakesToken = _stakesToken; reserveToken = _reserveToken; lpm.init(_stakesToken, address(this)); } /** * @notice Allows for the beforehand calculation of shares to be * received/minted upon depositing to the contract. * @param _cost The amount of reserve token being deposited. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _depositFee The current deposit fee as obtained by depositFee(). * @return _netShares The net amount of shares being received. * @return _feeShares The fee amount of shares being deducted. */ function calcDepositSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) public pure override returns (uint256 _netShares, uint256 _feeShares) { return GFormulae._calcDepositSharesFromCost(_cost, _totalReserve, _totalSupply, _depositFee); } /** * @notice Allows for the beforehand calculation of the amount of * reserve token to be deposited in order to receive the desired * amount of shares. * @param _netShares The amount of this gToken shares to receive. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _depositFee The current deposit fee as obtained by depositFee(). * @return _cost The cost, in the reserve token, to be paid. * @return _feeShares The fee amount of shares being deducted. */ function calcDepositCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) public pure override returns (uint256 _cost, uint256 _feeShares) { return GFormulae._calcDepositCostFromShares(_netShares, _totalReserve, _totalSupply, _depositFee); } /** * @notice Allows for the beforehand calculation of shares to be * given/burned upon withdrawing from the contract. * @param _cost The amount of reserve token being withdrawn. * @param _totalReserve The reserve balance as obtained by totalReserve() * @param _totalSupply The shares supply as obtained by totalSupply() * @param _withdrawalFee The current withdrawal fee as obtained by withdrawalFee() * @return _grossShares The total amount of shares being deducted, * including fees. * @return _feeShares The fee amount of shares being deducted. */ function calcWithdrawalSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) public pure override returns (uint256 _grossShares, uint256 _feeShares) { return GFormulae._calcWithdrawalSharesFromCost(_cost, _totalReserve, _totalSupply, _withdrawalFee); } /** * @notice Allows for the beforehand calculation of the amount of * reserve token to be withdrawn given the desired amount of * shares. * @param _grossShares The amount of this gToken shares to provide. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _withdrawalFee The current withdrawal fee as obtained by withdrawalFee(). * @return _cost The cost, in the reserve token, to be received. * @return _feeShares The fee amount of shares being deducted. */ function calcWithdrawalCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee) public pure override returns (uint256 _cost, uint256 _feeShares) { return GFormulae._calcWithdrawalCostFromShares(_grossShares, _totalReserve, _totalSupply, _withdrawalFee); } /** * @notice Provides the amount of reserve tokens currently being help by * this contract. * @return _totalReserve The amount of the reserve token corresponding * to this contract's balance. */ function totalReserve() public view virtual override returns (uint256 _totalReserve) { return G.getBalance(reserveToken); } /** * @notice Provides the current minting/deposit fee. This fee is * applied to the amount of this gToken shares being created * upon deposit. The fee defaults to 1% and is set to 2% * after the liquidity pool has been migrated. * @return _depositFee A percent value that accounts for the percentage * of shares being minted at each deposit that be * collected as fee. */ function depositFee() public view override returns (uint256 _depositFee) { return lpm.hasMigrated() ? DEPOSIT_FEE_AFTER_MIGRATION : DEPOSIT_FEE; } /** * @notice Provides the current burning/withdrawal fee. This fee is * applied to the amount of this gToken shares being redeemed * upon withdrawal. The fee defaults to 1% and is set to 0% * after the liquidity pool is migrated. * @return _withdrawalFee A percent value that accounts for the * percentage of shares being burned at each * withdrawal that be collected as fee. */ function withdrawalFee() public view override returns (uint256 _withdrawalFee) { return lpm.hasMigrated() ? WITHDRAWAL_FEE_AFTER_MIGRATION : WITHDRAWAL_FEE; } /** * @notice Provides the address of the liquidity pool contract. * @return _liquidityPool An address identifying the liquidity pool. */ function liquidityPool() public view override returns (address _liquidityPool) { return lpm.liquidityPool; } /** * @notice Provides the percentage of the liquidity pool to be burned. * This amount should account approximately for the swap fees * collected by the liquidity pool during a 7-day period. * @return _burningRate A percent value that corresponds to the current * amount of the liquidity pool to be burned at * each 7-day cycle. */ function liquidityPoolBurningRate() public view override returns (uint256 _burningRate) { return lpm.burningRate; } /** * @notice Marks when the last liquidity pool burn took place. There is * a minimum 7-day grace period between consecutive burnings of * the liquidity pool. * @return _lastBurningTime A timestamp for when the liquidity pool * burning took place for the last time. */ function liquidityPoolLastBurningTime() public view override returns (uint256 _lastBurningTime) { return lpm.lastBurningTime; } /** * @notice Provides the address receiving the liquidity pool migration. * @return _migrationRecipient An address to which funds will be sent * upon liquidity pool migration completion. */ function liquidityPoolMigrationRecipient() public view override returns (address _migrationRecipient) { return lpm.migrationRecipient; } /** * @notice Provides the timestamp for when the liquidity pool migration * can be completed. * @return _migrationUnlockTime A timestamp that defines the end of the * 7-day grace period for liquidity pool * migration. */ function liquidityPoolMigrationUnlockTime() public view override returns (uint256 _migrationUnlockTime) { return lpm.migrationUnlockTime; } /** * @notice Performs the minting of gToken shares upon the deposit of the * reserve token. The actual number of shares being minted can * be calculated using the calcDepositSharesFromCost function. * In every deposit, 1% of the shares is retained in terms of * deposit fee. Half of it is immediately burned and the other * half is provided to the locked liquidity pool. The funds * will be pulled in by this contract, therefore they must be * previously approved. * @param _cost The amount of reserve token being deposited in the * operation. */ function deposit(uint256 _cost) public override nonReentrant { address _from = msg.sender; require(_cost > 0, "cost must be greater than 0"); (uint256 _netShares, uint256 _feeShares) = GFormulae._calcDepositSharesFromCost(_cost, totalReserve(), totalSupply(), depositFee()); require(_netShares > 0, "shares must be greater than 0"); G.pullFunds(reserveToken, _from, _cost); require(_prepareDeposit(_cost), "not available at the moment"); _mint(_from, _netShares); _mint(address(this), _feeShares.div(2)); } /** * @notice Performs the burning of gToken shares upon the withdrawal of * the reserve token. The actual amount of the reserve token to * be received can be calculated using the * calcWithdrawalCostFromShares function. In every withdrawal, * 1% of the shares is retained in terms of withdrawal fee. * Half of it is immediately burned and the other half is * provided to the locked liquidity pool. * @param _grossShares The gross amount of this gToken shares being * redeemed in the operation. */ function withdraw(uint256 _grossShares) public override nonReentrant { address _from = msg.sender; require(_grossShares > 0, "shares must be greater than 0"); (uint256 _cost, uint256 _feeShares) = GFormulae._calcWithdrawalCostFromShares(_grossShares, totalReserve(), totalSupply(), withdrawalFee()); require(_cost > 0, "cost must be greater than 0"); require(_prepareWithdrawal(_cost), "not available at the moment"); _cost = G.min(_cost, G.getBalance(reserveToken)); G.pushFunds(reserveToken, _from, _cost); _burn(_from, _grossShares); _mint(address(this), _feeShares.div(2)); } /** * @notice Allocates a liquidity pool with the given amount of funds and * locks it to this contract. This function should be called * shortly after the contract is created to associated a newly * created liquidity pool to it, which will collect fees * associated with the minting and burning of this gToken shares. * The liquidity pool will consist of a 50%/50% balance of the * stakes token (GRO) and this gToken shares with a swap fee of * 10%. The rate between the amount of the two assets deposited * via this function defines the initial price. The minimum * amount to be provided for each is 1,000,000 wei. The funds * will be pulled in by this contract, therefore they must be * previously approved. This is a priviledged function * restricted to the contract owner. * @param _stakesAmount The initial amount of stakes token. * @param _sharesAmount The initial amount of this gToken shares. */ function allocateLiquidityPool(uint256 _stakesAmount, uint256 _sharesAmount) public override onlyOwner nonReentrant { address _from = msg.sender; G.pullFunds(stakesToken, _from, _stakesAmount); _transfer(_from, address(this), _sharesAmount); lpm.allocatePool(_stakesAmount, _sharesAmount); } /** * @notice Changes the percentual amount of the funds to be burned from * the liquidity pool at each 7-day period. This is a * priviledged function restricted to the contract owner. * @param _burningRate The percentage of the liquidity pool to be burned. */ function setLiquidityPoolBurningRate(uint256 _burningRate) public override onlyOwner nonReentrant { lpm.setBurningRate(_burningRate); } /** * @notice Burns part of the liquidity pool funds decreasing the supply * of both the stakes token and this gToken shares. * The amount to be burned is set via the function * setLiquidityPoolBurningRate and defaults to 0.5%. * After this function is called there must be a 7-day wait * period before it can be called again. * The purpose of this function is to burn the aproximate amount * of fees collected from swaps that take place in the liquidity * pool during the previous 7-day period. This function will * emit a BurnLiquidityPoolPortion event upon success. This is * a priviledged function restricted to the contract owner. */ function burnLiquidityPoolPortion() public override onlyOwner nonReentrant { lpm.gulpPoolAssets(); (uint256 _stakesAmount, uint256 _sharesAmount) = lpm.burnPoolPortion(); _burnStakes(_stakesAmount); _burn(address(this), _sharesAmount); emit BurnLiquidityPoolPortion(_stakesAmount, _sharesAmount); } /** * @notice Initiates the liquidity pool migration. It consists of * setting the migration recipient address and starting a * 7-day grace period. After the 7-day grace period the * migration can be completed via the * completeLiquidityPoolMigration fuction. Anytime before * the migration is completed is can be cancelled via * cancelLiquidityPoolMigration. This function will emit a * InitiateLiquidityPoolMigration event upon success. This is * a priviledged function restricted to the contract owner. * @param _migrationRecipient The receiver of the liquidity pool funds. */ function initiateLiquidityPoolMigration(address _migrationRecipient) public override onlyOwner nonReentrant { lpm.initiatePoolMigration(_migrationRecipient); emit InitiateLiquidityPoolMigration(_migrationRecipient); } /** * @notice Cancels the liquidity pool migration if it has been already * initiated. This will reset the state of the liquidity pool * migration. This function will emit a * CancelLiquidityPoolMigration event upon success. This is * a priviledged function restricted to the contract owner. */ function cancelLiquidityPoolMigration() public override onlyOwner nonReentrant { address _migrationRecipient = lpm.cancelPoolMigration(); emit CancelLiquidityPoolMigration(_migrationRecipient); } /** * @notice Completes the liquidity pool migration at least 7-days after * it has been started. The migration consists of sendind the * the full balance held in the liquidity pool, both in the * stakes token and gToken shares, to the address set when * the migration was initiated. This function will emit a * CompleteLiquidityPoolMigration event upon success. This is * a priviledged function restricted to the contract owner. */ function completeLiquidityPoolMigration() public override onlyOwner nonReentrant { lpm.gulpPoolAssets(); (address _migrationRecipient, uint256 _stakesAmount, uint256 _sharesAmount) = lpm.completePoolMigration(); G.pushFunds(stakesToken, _migrationRecipient, _stakesAmount); _transfer(address(this), _migrationRecipient, _sharesAmount); emit CompleteLiquidityPoolMigration(_migrationRecipient, _stakesAmount, _sharesAmount); } /** * @dev This abstract method must be implemented by subcontracts in * order to adjust the underlying reserve after a deposit takes * place. The actual implementation depends on the strategy and * algorithm used to handle the reserve. * @param _cost The amount of the reserve token being deposited. */ function _prepareDeposit(uint256 _cost) internal virtual returns (bool _success); /** * @dev This abstract method must be implemented by subcontracts in * order to adjust the underlying reserve before a withdrawal takes * place. The actual implementation depends on the strategy and * algorithm used to handle the reserve. * @param _cost The amount of the reserve token being withdrawn. */ function _prepareWithdrawal(uint256 _cost) internal virtual returns (bool _success); /** * @dev Burns the given amount of the stakes token. The default behavior * of the function for general ERC-20 is to send the funds to * address(0), but that can be overriden by a subcontract. * @param _stakesAmount The amount of the stakes token being burned. */ function _burnStakes(uint256 _stakesAmount) internal virtual { G.pushFunds(stakesToken, address(0), _stakesAmount); } } // File: contracts/GPortfolio.sol pragma solidity ^0.6.0; /** * @dev An interface with the extended functionality of portfolio management * gTokens. See GTokenType0.sol for further documentation. */ interface GPortfolio { // view functions function tokenCount() external view returns (uint256 _count); function tokenAt(uint256 _index) external view returns (address _token); function tokenPercent(address _token) external view returns (uint256 _percent); function getRebalanceMargins() external view returns (uint256 _liquidRebalanceMargin, uint256 _portfolioRebalanceMargin); // priviledged functions function insertToken(address _token) external; function removeToken(address _token) external; function anounceTokenPercentTransfer(address _sourceToken, address _targetToken, uint256 _percent) external; function transferTokenPercent(address _sourceToken, address _targetToken, uint256 _percent) external; function setRebalanceMargins(uint256 _liquidRebalanceMargin, uint256 _portfolioRebalanceMargin) external; // emitted events event InsertToken(address indexed _token); event RemoveToken(address indexed _token); event AnnounceTokenPercentTransfer(address indexed _sourceToken, address indexed _targetToken, uint256 _percent); event TransferTokenPercent(address indexed _sourceToken, address indexed _targetToken, uint256 _percent); event ChangeTokenPercent(address indexed _token, uint256 _oldPercent, uint256 _newPercent); } // File: @openzeppelin/contracts/utils/EnumerableSet.sol pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: contracts/GCToken.sol pragma solidity ^0.6.0; /** * @dev Minimal interface for gcTokens, implemented by the GCTokenBase contract. * See GCTokenBase.sol for further documentation. */ interface GCToken is GToken { // pure functions function calcCostFromUnderlyingCost(uint256 _underlyingCost, uint256 _exchangeRate) external pure returns (uint256 _cost); function calcUnderlyingCostFromCost(uint256 _cost, uint256 _exchangeRate) external pure returns (uint256 _underlyingCost); function calcDepositSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) external pure returns (uint256 _netShares, uint256 _feeShares); function calcDepositUnderlyingCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) external pure returns (uint256 _underlyingCost, uint256 _feeShares); function calcWithdrawalSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) external pure returns (uint256 _grossShares, uint256 _feeShares); function calcWithdrawalUnderlyingCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) external pure returns (uint256 _underlyingCost, uint256 _feeShares); // view functions function underlyingToken() external view returns (address _underlyingToken); function exchangeRate() external view returns (uint256 _exchangeRate); function totalReserveUnderlying() external view returns (uint256 _totalReserveUnderlying); function lendingReserveUnderlying() external view returns (uint256 _lendingReserveUnderlying); function borrowingReserveUnderlying() external view returns (uint256 _borrowingReserveUnderlying); function collateralizationRatio() external view returns (uint256 _collateralizationRatio, uint256 _collateralizationMargin); // open functions function depositUnderlying(uint256 _underlyingCost) external; function withdrawUnderlying(uint256 _grossShares) external; // priviledged functions function setCollateralizationRatio(uint256 _collateralizationRatio, uint256 _collateralizationMargin) external; } // File: contracts/GPortfolioReserveManager.sol pragma solidity ^0.6.0; /** * @dev This library implements data structure abstraction for the portfolio * reserve management code in order to circuvent the EVM contract size limit. * It is therefore a public library shared by all gToken Type 0 contracts and * needs to be published alongside them. See GTokenType0.sol for further * documentation. */ library GPortfolioReserveManager { using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; using GPortfolioReserveManager for GPortfolioReserveManager.Self; uint256 constant DEFAULT_LIQUID_REBALANCE_MARGIN = 95e15; // 9.5% uint256 constant DEFAULT_PORTFOLIO_REBALANCE_MARGIN = 1e16; // 1% uint256 constant MAXIMUM_TOKEN_COUNT = 5; uint256 constant PORTFOLIO_CHANGE_WAIT_INTERVAL = 1 days; uint256 constant PORTFOLIO_CHANGE_OPEN_INTERVAL = 1 days; struct Self { address reserveToken; EnumerableSet.AddressSet tokens; mapping (address => uint256) percents; mapping (uint256 => uint256) announcements; uint256 liquidRebalanceMargin; uint256 portfolioRebalanceMargin; } /** * @dev Initializes the data structure. This method is exposed publicly. * @param _reserveToken The ERC-20 token address of the reserve token. */ function init(Self storage _self, address _reserveToken) public { _self.reserveToken = _reserveToken; _self.percents[_reserveToken] = 1e18; _self.liquidRebalanceMargin = DEFAULT_LIQUID_REBALANCE_MARGIN; _self.portfolioRebalanceMargin = DEFAULT_PORTFOLIO_REBALANCE_MARGIN; } /** * @dev The total number of gTokens added to the portfolio. This method * is exposed publicly. * @return _count The number of gTokens that make up the portfolio. */ function tokenCount(Self storage _self) public view returns (uint256 _count) { return _self.tokens.length(); } /** * @dev Returns one of the gTokens that makes up the portfolio. This * method is exposed publicly. * @param _index The desired index, must be less than the token count. * @return _token The gToken currently present at the given index. */ function tokenAt(Self storage _self, uint256 _index) public view returns (address _token) { require(_index < _self.tokens.length(), "invalid index"); return _self.tokens.at(_index); } /** * @dev Returns the percentual participation of a token (including * the reserve token) in the portfolio composition. This method is * exposed publicly. * @param _token The given token address. * @return _percent The token percentual share of the portfolio. */ function tokenPercent(Self storage _self, address _token) public view returns (uint256 _percent) { return _self.percents[_token]; } /** * @dev Inserts a new gToken into the portfolio. The new gToken must * have the reserve token as its underlying token. The initial * portfolio share of the new token will be 0%. This method is * exposed publicly. * @param _token The contract address of the new gToken to be incorporated * into the portfolio. */ function insertToken(Self storage _self, address _token) public { require(_self.tokens.length() < MAXIMUM_TOKEN_COUNT, "limit reached"); address _underlyingToken = GCToken(_token).underlyingToken(); require(_underlyingToken == _self.reserveToken, "mismatched token"); require(_self.tokens.add(_token), "duplicate token"); assert(_self.percents[_token] == 0); } /** * @dev Removes a gToken from the portfolio. The portfolio share of the * token must be 0% before it can be removed. The underlying reserve * is redeemed upon removal. This method is exposed publicly. * @param _token The contract address of the gToken to be removed from * the portfolio. */ function removeToken(Self storage _self, address _token) public { require(_self.percents[_token] == 0, "positive percent"); require(_self.tokens.remove(_token), "unknown token"); _self._withdrawUnderlying(_token, _self._getUnderlyingReserve(_token)); } /** * @dev Announces a token percent transfer before it can happen. * @param _sourceToken The token address to provide the share. * @param _targetToken The token address to receive the share. * @param _percent The percentual share to shift. */ function announceTokenPercentTransfer(Self storage _self, address _sourceToken, address _targetToken, uint256 _percent) public { uint256 _hash = uint256(keccak256(abi.encode(uint256(_sourceToken), uint256(_targetToken), _percent))); uint256 _announcementTime = now; _self.announcements[_hash] = _announcementTime; } /** * @dev Shifts a percentual share of the portfolio allocation from * one gToken to another gToken. The reserve token can also be * used as source or target of the operation. This does not * actually shifts funds, only reconfigures the allocation. * This method is exposed publicly. Note that in order to perform * a token transfer where the target token is not the reserve token * one must account the transfer ahead of time. * See anounceTokenPercentTransfer(). * @param _sourceToken The token address to provide the share. * @param _targetToken The token address to receive the share. * @param _percent The percentual share to shift. */ function transferTokenPercent(Self storage _self, address _sourceToken, address _targetToken, uint256 _percent) public { require(_percent <= _self.percents[_sourceToken], "invalid percent"); require(_sourceToken != _targetToken, "invalid transfer"); require(_targetToken == _self.reserveToken || _self.tokens.contains(_targetToken), "unknown token"); uint256 _hash = uint256(keccak256(abi.encode(uint256(_sourceToken), uint256(_targetToken), _percent))); uint256 _announcementTime = _self.announcements[_hash]; uint256 _effectiveTime = _announcementTime + PORTFOLIO_CHANGE_WAIT_INTERVAL; uint256 _cutoffTime = _effectiveTime + PORTFOLIO_CHANGE_OPEN_INTERVAL; require(_targetToken == _self.reserveToken || _effectiveTime <= now && now < _cutoffTime, "unannounced transfer"); _self.announcements[_hash] = 0; _self.percents[_sourceToken] -= _percent; _self.percents[_targetToken] += _percent; } /** * @dev Sets the percentual margins tolerable before triggering a * rebalance action (i.e. an underlying deposit or withdrawal). * This method is exposed publicly. * @param _liquidRebalanceMargin The liquid percentual rebalance margin, * to be configured by the owner. * @param _portfolioRebalanceMargin The portfolio percentual rebalance * margin, to be configured by the owner. */ function setRebalanceMargins(Self storage _self, uint256 _liquidRebalanceMargin, uint256 _portfolioRebalanceMargin) public { require(0 <= _liquidRebalanceMargin && _liquidRebalanceMargin <= 1e18, "invalid margin"); require(0 <= _portfolioRebalanceMargin && _portfolioRebalanceMargin <= 1e18, "invalid margin"); _self.liquidRebalanceMargin = _liquidRebalanceMargin; _self.portfolioRebalanceMargin = _portfolioRebalanceMargin; } /** * @dev Returns the total reserve amount held liquid by the contract * summed up with the underlying reserve of all gTokens that make up * the portfolio. This method is exposed publicly. * @return _totalReserve The computed total reserve amount. */ function totalReserve(Self storage _self) public view returns (uint256 _totalReserve) { return _self._calcTotalReserve(); } /** * @dev Performs the reserve adjustment actions leaving a liquidity room, * if necessary. It will attempt to perform the operation using the * liquid pool and, if necessary, either withdrawal from an underlying * gToken to get more liquidity, or deposit/withdrawal from an * underlying gToken to move towards the desired reserve allocation * if any of them falls beyond the rebalance margin thresholds. * To save on gas costs the reserve adjusment will request at most * one operation from any of the underlying gTokens. This method is * exposed publicly. * @param _roomAmount The underlying token amount to be available after the * operation. This is revelant for withdrawals, once the * room amount is withdrawn the reserve should reflect * the configured collateralization ratio. * @return _success A boolean indicating whether or not both actions suceeded. */ function adjustReserve(Self storage _self, uint256 _roomAmount) public returns (bool _success) { // the reserve amount must deduct the room requested uint256 _reserveAmount = _self._calcTotalReserve(); _roomAmount = G.min(_roomAmount, _reserveAmount); _reserveAmount = _reserveAmount.sub(_roomAmount); // the liquid amount must deduct the room requested uint256 _liquidAmount = G.getBalance(_self.reserveToken); uint256 _blockedAmount = G.min(_roomAmount, _liquidAmount); _liquidAmount = _liquidAmount.sub(_blockedAmount); // calculates whether or not the liquid amount exceeds the // configured range and requires either a deposit or a withdrawal // to be performed (uint256 _depositAmount, uint256 _withdrawalAmount) = _self._calcLiquidAdjustment(_reserveAmount, _liquidAmount); // if the liquid amount is not enough to process a withdrawal // we will need to withdraw the missing amount from one of the // underlying gTokens (actually we will choose the one for which // the withdrawal will produce the least impact in terms of // percentual share deviation from its configured target) uint256 _requiredAmount = _roomAmount.sub(_blockedAmount); if (_requiredAmount > 0) { _withdrawalAmount = _withdrawalAmount.add(_requiredAmount); (address _adjustToken, uint256 _adjustAmount) = _self._findRequiredWithdrawal(_reserveAmount, _requiredAmount, _withdrawalAmount); if (_adjustToken == address(0)) return false; return _self._withdrawUnderlying(_adjustToken, _adjustAmount); } // finds the gToken that will have benefited more of this deposit // in terms of its target percentual share deviation and performs // the deposit on it if (_depositAmount > 0) { (address _adjustToken, uint256 _adjustAmount) = _self._findDeposit(_reserveAmount); if (_adjustToken == address(0)) return true; return _self._depositUnderlying(_adjustToken, G.min(_adjustAmount, _depositAmount)); } // finds the gToken that will have benefited more of this withdrawal // in terms of its target percentual share deviation and performs // the withdrawal on it if (_withdrawalAmount > 0) { (address _adjustToken, uint256 _adjustAmount) = _self._findWithdrawal(_reserveAmount); if (_adjustToken == address(0)) return true; return _self._withdrawUnderlying(_adjustToken, G.min(_adjustAmount, _withdrawalAmount)); } return true; } /** * @dev Calculates the total reserve amount. It sums up the reserve held * by the contract with the underlying reserve held by the gTokens * that make up the portfolio. * @return _totalReserve The computed total reserve amount. */ function _calcTotalReserve(Self storage _self) internal view returns (uint256 _totalReserve) { _totalReserve = G.getBalance(_self.reserveToken); uint256 _tokenCount = _self.tokens.length(); for (uint256 _index = 0; _index < _tokenCount; _index++) { address _token = _self.tokens.at(_index); uint256 _tokenReserve = _self._getUnderlyingReserve(_token); _totalReserve = _totalReserve.add(_tokenReserve); } return _totalReserve; } /** * @dev Calculates the amount that falls either above or below * the rebalance margin for the liquid pool. If we have more * liquid amount than its configured share plus the rebalance * margin it returns that amount paired with zero. If we have less * liquid amount than its configured share minus the rebalance * margin it returns zero paired with that amount. If none of these * two situations happen, then the liquid amount falls within the * acceptable parameters, and it returns a pair of zeros. * @param _reserveAmount The total reserve amount used for calculation. * @param _liquidAmount The liquid amount available used for calculation. * @return _depositAmount The amount to be deposited or zero. * @return _withdrawalAmount The amount to be withdrawn or zero. */ function _calcLiquidAdjustment(Self storage _self, uint256 _reserveAmount, uint256 _liquidAmount) internal view returns (uint256 _depositAmount, uint256 _withdrawalAmount) { uint256 _tokenPercent = _self.percents[_self.reserveToken]; uint256 _tokenReserve = _reserveAmount.mul(_tokenPercent).div(1e18); if (_liquidAmount > _tokenReserve) { uint256 _upperPercent = G.min(1e18, _tokenPercent.add(_self.liquidRebalanceMargin)); uint256 _upperReserve = _reserveAmount.mul(_upperPercent).div(1e18); if (_liquidAmount > _upperReserve) return (_liquidAmount.sub(_tokenReserve), 0); } else if (_liquidAmount < _tokenReserve) { uint256 _lowerPercent = _tokenPercent.sub(G.min(_tokenPercent, _self.liquidRebalanceMargin)); uint256 _lowerReserve = _reserveAmount.mul(_lowerPercent).div(1e18); if (_liquidAmount < _lowerReserve) return (0, _tokenReserve.sub(_liquidAmount)); } return (0, 0); } /** * @dev Search the list of gTokens and selects the one that has enough * liquidity and for which the withdrawal of the required amount * will yield the least deviation from its target share. * @param _reserveAmount The total reserve amount used for calculation. * @param _minimumAmount The minimum liquidity amount used for calculation. * @param _targetAmount The target liquidity amount used for calculation. * @return _adjustToken The gToken to withdraw from. * @return _adjustAmount The amount to be withdrawn. */ function _findRequiredWithdrawal(Self storage _self, uint256 _reserveAmount, uint256 _minimumAmount, uint256 _targetAmount) internal view returns (address _adjustToken, uint256 _adjustAmount) { uint256 _minPercent = 1e18; _adjustToken = address(0); _adjustAmount = 0; uint256 _tokenCount = _self.tokens.length(); for (uint256 _index = 0; _index < _tokenCount; _index++) { address _token = _self.tokens.at(_index); uint256 _tokenReserve = _self._getUnderlyingReserve(_token); if (_tokenReserve < _minimumAmount) continue; uint256 _maximumAmount = G.min(_tokenReserve, _targetAmount); uint256 _oldTokenReserve = _tokenReserve.sub(_maximumAmount); uint256 _oldTokenPercent = _oldTokenReserve.mul(1e18).div(_reserveAmount); uint256 _newTokenPercent = _self.percents[_token]; uint256 _percent = 0; if (_newTokenPercent > _oldTokenPercent) _percent = _newTokenPercent.sub(_oldTokenPercent); else if (_newTokenPercent < _oldTokenPercent) _percent = _oldTokenPercent.sub(_newTokenPercent); if (_maximumAmount > _adjustAmount || _maximumAmount == _adjustAmount && _percent < _minPercent) { _minPercent = _percent; _adjustToken = _token; _adjustAmount = _maximumAmount; } } return (_adjustToken, _adjustAmount); } /** * @dev Search the list of gTokens and selects the one for which the * deposit will provide the best correction of deviation from * its target share. * @param _reserveAmount The total reserve amount used for calculation. * @return _adjustToken The gToken to deposit to. * @return _adjustAmount The amount to be deposited. */ function _findDeposit(Self storage _self, uint256 _reserveAmount) internal view returns (address _adjustToken, uint256 _adjustAmount) { uint256 _maxPercent = _self.portfolioRebalanceMargin; _adjustToken = address(0); _adjustAmount = 0; uint256 _tokenCount = _self.tokens.length(); for (uint256 _index = 0; _index < _tokenCount; _index++) { address _token = _self.tokens.at(_index); uint256 _oldTokenReserve = _self._getUnderlyingReserve(_token); uint256 _oldTokenPercent = _oldTokenReserve.mul(1e18).div(_reserveAmount); uint256 _newTokenPercent = _self.percents[_token]; if (_newTokenPercent > _oldTokenPercent) { uint256 _percent = _newTokenPercent.sub(_oldTokenPercent); if (_percent > _maxPercent) { uint256 _newTokenReserve = _reserveAmount.mul(_newTokenPercent).div(1e18); uint256 _amount = _newTokenReserve.sub(_oldTokenReserve); _maxPercent = _percent; _adjustToken = _token; _adjustAmount = _amount; } } } return (_adjustToken, _adjustAmount); } /** * @dev Search the list of gTokens and selects the one for which the * withdrawal will provide the best correction of deviation from * its target share. * @param _reserveAmount The total reserve amount used for calculation. * @return _adjustToken The gToken to withdraw from. * @return _adjustAmount The amount to be withdrawn. */ function _findWithdrawal(Self storage _self, uint256 _reserveAmount) internal view returns (address _adjustToken, uint256 _adjustAmount) { uint256 _maxPercent = _self.portfolioRebalanceMargin; _adjustToken = address(0); _adjustAmount = 0; uint256 _tokenCount = _self.tokens.length(); for (uint256 _index = 0; _index < _tokenCount; _index++) { address _token = _self.tokens.at(_index); uint256 _oldTokenReserve = _self._getUnderlyingReserve(_token); uint256 _oldTokenPercent = _oldTokenReserve.mul(1e18).div(_reserveAmount); uint256 _newTokenPercent = _self.percents[_token]; if (_newTokenPercent < _oldTokenPercent) { uint256 _percent = _oldTokenPercent.sub(_newTokenPercent); if (_percent > _maxPercent) { uint256 _newTokenReserve = _reserveAmount.mul(_newTokenPercent).div(1e18); uint256 _amount = _oldTokenReserve.sub(_newTokenReserve); _maxPercent = _percent; _adjustToken = _token; _adjustAmount = _amount; } } } return (_adjustToken, _adjustAmount); } /** * @dev Performs a deposit of the reserve asset to the given gToken. * @param _token The gToken to deposit to. * @param _amount The amount to be deposited. * @return _success A boolean indicating whether or not the action succeeded. */ function _depositUnderlying(Self storage _self, address _token, uint256 _amount) internal returns (bool _success) { _amount = G.min(_amount, G.getBalance(_self.reserveToken)); if (_amount == 0) return true; G.approveFunds(_self.reserveToken, _token, _amount); try GCToken(_token).depositUnderlying(_amount) { return true; } catch (bytes memory /* _data */) { G.approveFunds(_self.reserveToken, _token, 0); return false; } } /** * @dev Performs a withdrawal of the reserve asset from the given gToken. * @param _token The gToken to withdraw from. * @param _amount The amount to be withdrawn. * @return _success A boolean indicating whether or not the action succeeded. */ function _withdrawUnderlying(Self storage _self, address _token, uint256 _amount) internal returns (bool _success) { uint256 _grossShares = _self._calcWithdrawalSharesFromUnderlyingCost(_token, _amount); _grossShares = G.min(_grossShares, G.getBalance(_token)); if (_grossShares == 0) return true; try GCToken(_token).withdrawUnderlying(_grossShares) { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev Calculates how much of the reserve token is available for * withdrawal by the current contract for the given gToken. * @param _token The gToken to withdraw from. * @return _underlyingCost The total amount redeemable by the current * contract from the given gToken. */ function _getUnderlyingReserve(Self storage _self, address _token) internal view returns (uint256 _underlyingCost) { uint256 _grossShares = G.getBalance(_token); return _self._calcWithdrawalUnderlyingCostFromShares(_token, _grossShares); } /** * @dev Calculates how much will be received for withdrawing the provided * number of shares from a given gToken. * @param _token The gToken to withdraw from. * @param _grossShares The number of shares to be provided. * @return _underlyingCost The amount to be received. */ function _calcWithdrawalUnderlyingCostFromShares(Self storage /* _self */, address _token, uint256 _grossShares) internal view returns (uint256 _underlyingCost) { uint256 _totalReserve = GCToken(_token).totalReserve(); uint256 _totalSupply = GCToken(_token).totalSupply(); uint256 _withdrawalFee = GCToken(_token).withdrawalFee(); uint256 _exchangeRate = GCToken(_token).exchangeRate(); (_underlyingCost,) = GCToken(_token).calcWithdrawalUnderlyingCostFromShares(_grossShares, _totalReserve, _totalSupply, _withdrawalFee, _exchangeRate); return _underlyingCost; } /** * @dev Calculates how many shares are required to withdraw so much from * a given gToken. * @param _token The gToken to withdraw from. * @param _underlyingCost The desired amount to be withdrawn. * @return _grossShares The number of shares required to withdraw the desired amount. */ function _calcWithdrawalSharesFromUnderlyingCost(Self storage /* _self */, address _token, uint256 _underlyingCost) internal view returns (uint256 _grossShares) { uint256 _totalReserve = GCToken(_token).totalReserve(); uint256 _totalSupply = GCToken(_token).totalSupply(); uint256 _withdrawalFee = GCToken(_token).withdrawalFee(); uint256 _exchangeRate = GCToken(_token).exchangeRate(); (_grossShares,) = GCToken(_token).calcWithdrawalSharesFromUnderlyingCost(_underlyingCost, _totalReserve, _totalSupply, _withdrawalFee, _exchangeRate); return _grossShares; } } // File: contracts/GTokenType0.sol pragma solidity ^0.6.0; /** * @notice This contract implements the functionality for the gToken Type 0. * The gToken Type 0 provides a simple portfolio management strategy * that splits the reserve asset percentually among multiple other * gTokens. Also, it allows for part of the reserve to be kept liquid, * in the reserve token itself, to save on gas fees. The contract owner * can add and remove gTokens that compose the portfolio, as much as * reconfigure their percentual shares. There is also a configurable * rebalance margins that serves as threshold for when the contract will * or not attempt to rebalance the reserve according to the set * percentual ratios. The algorithm that maintains the proper * distribution of the reserve token does so incrementally based on the * following principles: 1) At each deposit/withdrawal, at most one * underlying deposit/withdrawal is performed; 2) When the * deposit/withdrawal can be served from the liquid pool, and within the * bounds of the rebalance margin, no underlying deposit/withdrawal is * performed; 3) When performing a rebalance the gToken with the * most discrepant reserve share is chosen for rebalancing; 4) When * performing an withdrawal, if it cannot be served entirely from * the liquid pool, the we choose the gToken that can provide the * required additional liquidity with the least percentual impact to * its reserve share. As with all gTokens, gTokens Type 0 have an * associated locked liquidity pool and follow the same fee structure. * See GTokenBase and GPortfolioReserveManager for further documentation. */ contract GTokenType0 is GTokenBase, GPortfolio { using GPortfolioReserveManager for GPortfolioReserveManager.Self; GPortfolioReserveManager.Self prm; /** * @dev Constructor for the gToken Type 0 contract. * @param _name The ERC-20 token name. * @param _symbol The ERC-20 token symbol. * @param _decimals The ERC-20 token decimals. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _reserveToken The ERC-20 token address to be used as reserve * token (e.g. DAI for gDAI). */ constructor (string memory _name, string memory _symbol, uint8 _decimals, address _stakesToken, address _reserveToken) GTokenBase(_name, _symbol, _decimals, _stakesToken, _reserveToken) public { prm.init(_reserveToken); } /** * @notice Overrides the default total reserve definition in order to * account, not only for the reserve asset being kept liquid by * this contract, but also sum up the reserve portions delegated * to all gTokens that make up the portfolio. * @return _totalReserve The amount of the reserve token corresponding * to this contract's worth. */ function totalReserve() public view override returns (uint256 _totalReserve) { return prm.totalReserve(); } /** * @notice Provides the number of gTokens that were added to this * contract by the owner. * @return _count The number of gTokens that make up the portfolio. */ function tokenCount() public view override returns (uint256 _count) { return prm.tokenCount(); } /** * @notice Provides a gToken that was added to this contract by the owner * at a given index. Note that the index to token association * is preserved in between token removals, however removals may * may shuffle it around. * @param _index The desired index, must be less than the token count. * @return _token The gToken currently present at the given index. */ function tokenAt(uint256 _index) public view override returns (address _token) { return prm.tokenAt(_index); } /** * @notice Provides the percentual share of a gToken in the composition * of the portfolio. Note that the value returned is the desired * percentual share and not the actual reserve share. * @param _token The given token address. * @return _percent The token percentual share of the portfolio, as * configured by the owner. */ function tokenPercent(address _token) public view override returns (uint256 _percent) { return prm.tokenPercent(_token); } /** * @notice Provides the percentual margins tolerable before triggering a * rebalance action (i.e. an underlying deposit or withdrawal). * @return _liquidRebalanceMargin The liquid percentual rebalance margin, * as configured by the owner. * @return _portfolioRebalanceMargin The portfolio percentual rebalance * margin, as configured by the owner. */ function getRebalanceMargins() public view override returns (uint256 _liquidRebalanceMargin, uint256 _portfolioRebalanceMargin) { return (prm.liquidRebalanceMargin, prm.portfolioRebalanceMargin); } /** * @notice Inserts a new gToken into the portfolio. The new gToken must * have the reserve token as its underlying token. The initial * portfolio share of the new token will be 0%. * @param _token The contract address of the new gToken to be incorporated * into the portfolio. */ function insertToken(address _token) public override onlyOwner nonReentrant { prm.insertToken(_token); emit InsertToken(_token); } /** * @notice Removes a gToken from the portfolio. The portfolio share of * the token must be 0% before it can be removed. The underlying * reserve is redeemed upon removal. * @param _token The contract address of the gToken to be removed from * the portfolio. */ function removeToken(address _token) public override onlyOwner nonReentrant { prm.removeToken(_token); emit RemoveToken(_token); } /** * @notice Announces a token percent transfer before it can happen, * signaling the intention to modify the porfolio distribution. * @param _sourceToken The token address to provide the share. * @param _targetToken The token address to receive the share. * @param _percent The percentual share to shift. */ function anounceTokenPercentTransfer(address _sourceToken, address _targetToken, uint256 _percent) public override onlyOwner nonReentrant { prm.announceTokenPercentTransfer(_sourceToken, _targetToken, _percent); emit AnnounceTokenPercentTransfer(_sourceToken, _targetToken, _percent); } /** * @notice Shifts a percentual share of the portfolio allocation from * one gToken to another gToken. The reserve token can also be * used as source or target of the operation. This does not * actually shifts funds, only reconfigures the allocation. * @param _sourceToken The token address to provide the share. * @param _targetToken The token address to receive the share. * @param _percent The percentual share to shift. */ function transferTokenPercent(address _sourceToken, address _targetToken, uint256 _percent) public override onlyOwner nonReentrant { uint256 _oldSourceTokenPercent = prm.tokenPercent(_sourceToken); uint256 _oldTargetTokenPercent = prm.tokenPercent(_targetToken); prm.transferTokenPercent(_sourceToken, _targetToken, _percent); uint256 _newSourceTokenPercent = prm.tokenPercent(_sourceToken); uint256 _newTargetTokenPercent = prm.tokenPercent(_targetToken); emit TransferTokenPercent(_sourceToken, _targetToken, _percent); emit ChangeTokenPercent(_sourceToken, _oldSourceTokenPercent, _newSourceTokenPercent); emit ChangeTokenPercent(_targetToken, _oldTargetTokenPercent, _newTargetTokenPercent); } /** * @notice Sets the percentual margins tolerable before triggering a * rebalance action (i.e. an underlying deposit or withdrawal). * @param _liquidRebalanceMargin The liquid percentual rebalance margin, * to be configured by the owner. * @param _portfolioRebalanceMargin The portfolio percentual rebalance * margin, to be configured by the owner. */ function setRebalanceMargins(uint256 _liquidRebalanceMargin, uint256 _portfolioRebalanceMargin) public override onlyOwner nonReentrant { prm.setRebalanceMargins(_liquidRebalanceMargin, _portfolioRebalanceMargin); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * after a deposit comes along. This method uses the GPortfolioReserveManager * to adjust the reserve implementing the rebalance policy. * See GPortfolioReserveManager.sol. * @param _cost The amount of reserve being deposited (ignored). * @return _success A boolean indicating whether or not the operation * succeeded. This operation should not fail unless * any of the underlying components (Compound, Aave, * Dydx) also fails. */ function _prepareDeposit(uint256 _cost) internal override returns (bool _success) { _cost; // silences warnings return prm.adjustReserve(0); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * before a withdrawal comes along. This method uses the GPortfolioReserveManager * to adjust the reserve implementing the rebalance policy. * See GPortfolioReserveManager.sol. * @param _cost The amount of reserve being withdrawn and that needs to * be immediately liquid. * @return _success A boolean indicating whether or not the operation succeeded. * The operation may fail if it is not possible to recover * the required liquidity (e.g. low liquidity in the markets). */ function _prepareWithdrawal(uint256 _cost) internal override returns (bool _success) { return prm.adjustReserve(_cost); } } // File: contracts/GCFormulae.sol pragma solidity ^0.6.0; /** * @dev Pure implementation of deposit/minting and withdrawal/burning formulas * for gTokens calculated based on the cToken underlying asset * (e.g. DAI for cDAI). See GFormulae.sol and GCTokenBase.sol for further * documentation. */ library GCFormulae { using SafeMath for uint256; /** * @dev Simple token to cToken formula from Compound */ function _calcCostFromUnderlyingCost(uint256 _underlyingCost, uint256 _exchangeRate) internal pure returns (uint256 _cost) { return _underlyingCost.mul(1e18).div(_exchangeRate); } /** * @dev Simple cToken to token formula from Compound */ function _calcUnderlyingCostFromCost(uint256 _cost, uint256 _exchangeRate) internal pure returns (uint256 _underlyingCost) { return _cost.mul(_exchangeRate).div(1e18); } /** * @dev Composition of the gToken deposit formula with the Compound * conversion formula to obtain the gcToken deposit formula in * terms of the cToken underlying asset. */ function _calcDepositSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) internal pure returns (uint256 _netShares, uint256 _feeShares) { uint256 _cost = _calcCostFromUnderlyingCost(_underlyingCost, _exchangeRate); return GFormulae._calcDepositSharesFromCost(_cost, _totalReserve, _totalSupply, _depositFee); } /** * @dev Composition of the gToken reserve deposit formula with the * Compound conversion formula to obtain the gcToken reverse * deposit formula in terms of the cToken underlying asset. */ function _calcDepositUnderlyingCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) internal pure returns (uint256 _underlyingCost, uint256 _feeShares) { uint256 _cost; (_cost, _feeShares) = GFormulae._calcDepositCostFromShares(_netShares, _totalReserve, _totalSupply, _depositFee); return (_calcUnderlyingCostFromCost(_cost, _exchangeRate), _feeShares); } /** * @dev Composition of the gToken reserve withdrawal formula with the * Compound conversion formula to obtain the gcToken reverse * withdrawal formula in terms of the cToken underlying asset. */ function _calcWithdrawalSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) internal pure returns (uint256 _grossShares, uint256 _feeShares) { uint256 _cost = _calcCostFromUnderlyingCost(_underlyingCost, _exchangeRate); return GFormulae._calcWithdrawalSharesFromCost(_cost, _totalReserve, _totalSupply, _withdrawalFee); } /** * @dev Composition of the gToken withdrawal formula with the Compound * conversion formula to obtain the gcToken withdrawal formula in * terms of the cToken underlying asset. */ function _calcWithdrawalUnderlyingCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) internal pure returns (uint256 _underlyingCost, uint256 _feeShares) { uint256 _cost; (_cost, _feeShares) = GFormulae._calcWithdrawalCostFromShares(_grossShares, _totalReserve, _totalSupply, _withdrawalFee); return (_calcUnderlyingCostFromCost(_cost, _exchangeRate), _feeShares); } } // File: contracts/GMining.sol pragma solidity ^0.6.0; /** * @dev An interface to extend gTokens with liquidity mining capabilities. * See GCTokenBase.sol and GATokenBase.sol for further documentation. */ interface GMining { // view functions function miningToken() external view returns (address _miningToken); function growthToken() external view returns (address _growthToken); function exchange() external view returns (address _exchange); function miningGulpRange() external view returns (uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount); function growthGulpRange() external view returns (uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount); // priviledged functions function setExchange(address _exchange) external; function setMiningGulpRange(uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) external; function setGrowthGulpRange(uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) external; } // File: contracts/interop/Compound.sol pragma solidity ^0.6.0; /** * @dev Minimal set of declarations for Compound interoperability. */ interface Comptroller { function oracle() external view returns (address _oracle); function enterMarkets(address[] calldata _ctokens) external returns (uint256[] memory _errorCodes); function markets(address _ctoken) external view returns (bool _isListed, uint256 _collateralFactorMantissa); function getAccountLiquidity(address _account) external view returns (uint256 _error, uint256 _liquidity, uint256 _shortfall); } interface CPriceOracle { function getUnderlyingPrice(address _ctoken) external view returns (uint256 _price); } interface CToken is IERC20 { function underlying() external view returns (address _token); function exchangeRateStored() external view returns (uint256 _exchangeRate); function borrowBalanceStored(address _account) external view returns (uint256 _borrowBalance); function exchangeRateCurrent() external returns (uint256 _exchangeRate); function getCash() external view returns (uint256 _cash); function borrowBalanceCurrent(address _account) external returns (uint256 _borrowBalance); function balanceOfUnderlying(address _owner) external returns (uint256 _underlyingBalance); function mint() external payable; function mint(uint256 _mintAmount) external returns (uint256 _errorCode); function repayBorrow() external payable; function repayBorrow(uint256 _repayAmount) external returns (uint256 _errorCode); function redeemUnderlying(uint256 _redeemAmount) external returns (uint256 _errorCode); function borrow(uint256 _borrowAmount) external returns (uint256 _errorCode); } // File: contracts/modules/CompoundLendingMarketAbstraction.sol pragma solidity ^0.6.0; /** * @dev This library abstracts the Compound lending market. It has a standardized * lending market interface. See AaveLendingMarket.sol. */ library CompoundLendingMarketAbstraction { using SafeMath for uint256; /** * @dev Retreives an underlying token given a cToken. * @param _ctoken The Compound cToken address. * @return _token The underlying reserve token. */ function _getUnderlyingToken(address _ctoken) internal view returns (address _token) { if (_ctoken == $.cETH) return $.WETH; return CToken(_ctoken).underlying(); } /** * @dev Retrieves the maximum collateralization ratio for a given cToken. * @param _ctoken The Compound cToken address. * @return _collateralRatio The percentual ratio normalized to 1e18 (100%). */ function _getCollateralRatio(address _ctoken) internal view returns (uint256 _collateralRatio) { address _comptroller = $.Compound_COMPTROLLER; (, _collateralRatio) = Comptroller(_comptroller).markets(_ctoken); return _collateralRatio; } /** * @dev Retrieves the current market liquidity for a given cToken. * @param _ctoken The Compound cToken address. * @return _marketAmount The underlying reserve token available * market liquidity. */ function _getMarketAmount(address _ctoken) internal view returns (uint256 _marketAmount) { return CToken(_ctoken).getCash(); } /** * @dev Retrieves the current account liquidity in terms of a cToken * underlying reserve. * @param _ctoken The Compound cToken address. * @return _liquidityAmount The available account liquidity for the * underlying reserve token. */ function _getLiquidityAmount(address _ctoken) internal view returns (uint256 _liquidityAmount) { address _comptroller = $.Compound_COMPTROLLER; (uint256 _result, uint256 _liquidity, uint256 _shortfall) = Comptroller(_comptroller).getAccountLiquidity(address(this)); if (_result != 0) return 0; if (_shortfall > 0) return 0; address _priceOracle = Comptroller(_comptroller).oracle(); uint256 _price = CPriceOracle(_priceOracle).getUnderlyingPrice(_ctoken); return _liquidity.mul(1e18).div(_price); } /** * @dev Retrieves the calculated account liquidity in terms of a cToken * underlying reserve. It also considers the current market liquidity. * A safety margin can be provided to deflate the actual liquidity amount. * @param _ctoken The Compound cToken address. * @param _marginAmount The safety room to be left in terms of the * underlying reserve token. * @return _availableAmount The safe available liquidity in terms of the * underlying reserve token. */ function _getAvailableAmount(address _ctoken, uint256 _marginAmount) internal view returns (uint256 _availableAmount) { uint256 _liquidityAmount = _getLiquidityAmount(_ctoken); if (_liquidityAmount <= _marginAmount) return 0; return Math._min(_liquidityAmount.sub(_marginAmount), _getMarketAmount(_ctoken)); } /** * @dev Retrieves the last read-only exchange rate between the cToken * and its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _exchangeRate The exchange rate between the cToken and its * underlying reserve token. */ function _getExchangeRate(address _ctoken) internal view returns (uint256 _exchangeRate) { return CToken(_ctoken).exchangeRateStored(); } /** * @dev Retrieves the last up-to-date exchange rate between the cToken * and its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _exchangeRate The exchange rate between the cToken and its * underlying reserve token. */ function _fetchExchangeRate(address _ctoken) internal returns (uint256 _exchangeRate) { return CToken(_ctoken).exchangeRateCurrent(); } /** * @dev Retrieves the last read-only value for the cToken lending * balance in terms of its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _amount The lending balance in terms of the underlying * reserve token. */ function _getLendAmount(address _ctoken) internal view returns (uint256 _amount) { return CToken(_ctoken).balanceOf(address(this)).mul(_getExchangeRate(_ctoken)).div(1e18); } /** * @dev Retrieves the last up-to-date value for the cToken lending * balance in terms of its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _amount The lending balance in terms of the underlying * reserve token. */ function _fetchLendAmount(address _ctoken) internal returns (uint256 _amount) { return CToken(_ctoken).balanceOfUnderlying(address(this)); } /** * @dev Retrieves the last read-only value for the cToken borrowing * balance in terms of its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _amount The borrowing balance in terms of the underlying * reserve token. */ function _getBorrowAmount(address _ctoken) internal view returns (uint256 _amount) { return CToken(_ctoken).borrowBalanceStored(address(this)); } /** * @dev Retrieves the last up-to-date value for the cToken borrowing * balance in terms of its underlying reserve token. * @param _ctoken The Compound cToken address. * @return _amount The borrowing balance in terms of the underlying * reserve token. */ function _fetchBorrowAmount(address _ctoken) internal returns (uint256 _amount) { return CToken(_ctoken).borrowBalanceCurrent(address(this)); } /** * @dev Signals the usage of a given cToken underlying reserve as * collateral for borrowing funds in the lending market. * @param _ctoken The Compound cToken address. * @return _success A boolean indicating whether or not the operation suceeded. */ function _enter(address _ctoken) internal returns (bool _success) { address _comptroller = $.Compound_COMPTROLLER; address[] memory _ctokens = new address[](1); _ctokens[0] = _ctoken; try Comptroller(_comptroller).enterMarkets(_ctokens) returns (uint256[] memory _errorCodes) { return _errorCodes[0] == 0; } catch (bytes memory /* _data */) { return false; } } /** * @dev Lend funds to a given cToken's market. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to lend. * @return _success A boolean indicating whether or not the operation suceeded. */ function _lend(address _ctoken, uint256 _amount) internal returns (bool _success) { if (_ctoken == $.cETH) { if (!Wrapping._unwrap(_amount)) return false; try CToken(_ctoken).mint{value: _amount}() { return true; } catch (bytes memory /* _data */) { assert(Wrapping._wrap(_amount)); return false; } } else { address _token = _getUnderlyingToken(_ctoken); Transfers._approveFunds(_token, _ctoken, _amount); try CToken(_ctoken).mint(_amount) returns (uint256 _errorCode) { return _errorCode == 0; } catch (bytes memory /* _data */) { Transfers._approveFunds(_token, _ctoken, 0); return false; } } } /** * @dev Redeem funds lent to a given cToken's market. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to redeem. * @return _success A boolean indicating whether or not the operation suceeded. */ function _redeem(address _ctoken, uint256 _amount) internal returns (bool _success) { if (_ctoken == $.cETH) { try CToken(_ctoken).redeemUnderlying(_amount) returns (uint256 _errorCode) { if (_errorCode == 0) { assert(Wrapping._wrap(_amount)); return true; } else { return false; } } catch (bytes memory /* _data */) { return false; } } else { try CToken(_ctoken).redeemUnderlying(_amount) returns (uint256 _errorCode) { return _errorCode == 0; } catch (bytes memory /* _data */) { return false; } } } /** * @dev Borrow funds from a given cToken's market. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to borrow. * @return _success A boolean indicating whether or not the operation suceeded. */ function _borrow(address _ctoken, uint256 _amount) internal returns (bool _success) { if (_ctoken == $.cETH) { try CToken(_ctoken).borrow(_amount) returns (uint256 _errorCode) { if (_errorCode == 0) { assert(Wrapping._wrap(_amount)); return true; } else { return false; } } catch (bytes memory /* _data */) { return false; } } else { try CToken(_ctoken).borrow(_amount) returns (uint256 _errorCode) { return _errorCode == 0; } catch (bytes memory /* _data */) { return false; } } } /** * @dev Repays a loan taken from a given cToken's market. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to repay. * @return _success A boolean indicating whether or not the operation suceeded. */ function _repay(address _ctoken, uint256 _amount) internal returns (bool _success) { if (_ctoken == $.cETH) { if (!Wrapping._unwrap(_amount)) return false; try CToken(_ctoken).repayBorrow{value: _amount}() { return true; } catch (bytes memory /* _data */) { assert(Wrapping._wrap(_amount)); return false; } } else { address _token = _getUnderlyingToken(_ctoken); Transfers._approveFunds(_token, _ctoken, _amount); try CToken(_ctoken).repayBorrow(_amount) returns (uint256 _errorCode) { return _errorCode == 0; } catch (bytes memory /* _data */) { Transfers._approveFunds(_token, _ctoken, 0); return false; } } } /** * @dev Signals the usage of a given cToken underlying reserve as * collateral for borrowing funds in the lending market. This * operation will revert if it does not succeed. * @param _ctoken The Compound cToken address. */ function _safeEnter(address _ctoken) internal { require(_enter(_ctoken), "enter failed"); } /** * @dev Lend funds to a given cToken's market. This * operation will revert if it does not succeed. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to lend. */ function _safeLend(address _ctoken, uint256 _amount) internal { require(_lend(_ctoken, _amount), "lend failure"); } /** * @dev Redeem funds lent to a given cToken's market. This * operation will revert if it does not succeed. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to redeem. */ function _safeRedeem(address _ctoken, uint256 _amount) internal { require(_redeem(_ctoken, _amount), "redeem failure"); } /** * @dev Borrow funds from a given cToken's market. This * operation will revert if it does not succeed. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to borrow. */ function _safeBorrow(address _ctoken, uint256 _amount) internal { require(_borrow(_ctoken, _amount), "borrow failure"); } /** * @dev Repays a loan taken from a given cToken's market. This * operation will revert if it does not succeed. * @param _ctoken The Compound cToken address. * @param _amount The amount of the underlying token to repay. */ function _safeRepay(address _ctoken, uint256 _amount) internal { require(_repay(_ctoken, _amount), "repay failure"); } } // File: contracts/GC.sol pragma solidity ^0.6.0; /** * @dev This public library provides a single entrypoint to the Compound lending * market internal library available in the modules folder. It is a * complement to the G.sol library. Both libraries exists to circunvent the * contract size limitation imposed by the EVM. See G.sol for further * documentation. */ library GC { function getUnderlyingToken(address _ctoken) public view returns (address _token) { return CompoundLendingMarketAbstraction._getUnderlyingToken(_ctoken); } function getCollateralRatio(address _ctoken) public view returns (uint256 _collateralFactor) { return CompoundLendingMarketAbstraction._getCollateralRatio(_ctoken); } function getMarketAmount(address _ctoken) public view returns (uint256 _marketAmount) { return CompoundLendingMarketAbstraction._getMarketAmount(_ctoken); } function getLiquidityAmount(address _ctoken) public view returns (uint256 _liquidityAmount) { return CompoundLendingMarketAbstraction._getLiquidityAmount(_ctoken); } function getExchangeRate(address _ctoken) public view returns (uint256 _exchangeRate) { return CompoundLendingMarketAbstraction._getExchangeRate(_ctoken); } function fetchExchangeRate(address _ctoken) public returns (uint256 _exchangeRate) { return CompoundLendingMarketAbstraction._fetchExchangeRate(_ctoken); } function getLendAmount(address _ctoken) public view returns (uint256 _amount) { return CompoundLendingMarketAbstraction._getLendAmount(_ctoken); } function fetchLendAmount(address _ctoken) public returns (uint256 _amount) { return CompoundLendingMarketAbstraction._fetchLendAmount(_ctoken); } function getBorrowAmount(address _ctoken) public view returns (uint256 _amount) { return CompoundLendingMarketAbstraction._getBorrowAmount(_ctoken); } function fetchBorrowAmount(address _ctoken) public returns (uint256 _amount) { return CompoundLendingMarketAbstraction._fetchBorrowAmount(_ctoken); } function lend(address _ctoken, uint256 _amount) public returns (bool _success) { return CompoundLendingMarketAbstraction._lend(_ctoken, _amount); } function redeem(address _ctoken, uint256 _amount) public returns (bool _success) { return CompoundLendingMarketAbstraction._redeem(_ctoken, _amount); } function borrow(address _ctoken, uint256 _amount) public returns (bool _success) { return CompoundLendingMarketAbstraction._borrow(_ctoken, _amount); } function repay(address _ctoken, uint256 _amount) public returns (bool _success) { return CompoundLendingMarketAbstraction._repay(_ctoken, _amount); } function safeEnter(address _ctoken) public { CompoundLendingMarketAbstraction._safeEnter(_ctoken); } function safeLend(address _ctoken, uint256 _amount) public { CompoundLendingMarketAbstraction._safeLend(_ctoken, _amount); } function safeRedeem(address _ctoken, uint256 _amount) public { CompoundLendingMarketAbstraction._safeRedeem(_ctoken, _amount); } } // File: contracts/GCTokenBase.sol pragma solidity ^0.6.0; /** * @notice This abstract contract provides the basis implementation for all * gcTokens, i.e. gTokens that use Compound cTokens as reserve, and * implements the common functionality shared amongst them. * In a nutshell, it extends the functinality of the GTokenBase contract * to support operating directly using the cToken underlying asset. * Therefore this contract provides functions that encapsulate minting * and redeeming of cTokens internally, allowing users to interact with * the contract providing funds directly in their underlying asset. */ abstract contract GCTokenBase is GTokenBase, GCToken, GMining { address public immutable override miningToken; address public immutable override growthToken; address public immutable override underlyingToken; /** * @dev Constructor for the gcToken contract. * @param _name The ERC-20 token name. * @param _symbol The ERC-20 token symbol. * @param _decimals The ERC-20 token decimals. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _reserveToken The ERC-20 token address to be used as reserve * token (e.g. cDAI for gcDAI). * @param _miningToken The ERC-20 token used for liquidity mining on * compound (COMP). * @param _growthToken The ERC-20 token address of the associated * gToken, for gcTokens Type 2, or address(0), * if this contract is a gcToken Type 1. */ constructor (string memory _name, string memory _symbol, uint8 _decimals, address _stakesToken, address _reserveToken, address _miningToken, address _growthToken) GTokenBase(_name, _symbol, _decimals, _stakesToken, _reserveToken) public { miningToken = _miningToken; growthToken = _growthToken; address _underlyingToken = GC.getUnderlyingToken(_reserveToken); underlyingToken = _underlyingToken; } /** * @notice Allows for the beforehand calculation of the cToken amount * given the amount of the underlying token and an exchange rate. * @param _underlyingCost The cost in terms of the cToken underlying asset. * @param _exchangeRate The given exchange rate as provided by exchangeRate(). * @return _cost The equivalent cost in terms of cToken */ function calcCostFromUnderlyingCost(uint256 _underlyingCost, uint256 _exchangeRate) public pure override returns (uint256 _cost) { return GCFormulae._calcCostFromUnderlyingCost(_underlyingCost, _exchangeRate); } /** * @notice Allows for the beforehand calculation of the underlying token * amount given the cToken amount and an exchange rate. * @param _cost The cost in terms of the cToken. * @param _exchangeRate The given exchange rate as provided by exchangeRate(). * @return _underlyingCost The equivalent cost in terms of the cToken underlying asset. */ function calcUnderlyingCostFromCost(uint256 _cost, uint256 _exchangeRate) public pure override returns (uint256 _underlyingCost) { return GCFormulae._calcUnderlyingCostFromCost(_cost, _exchangeRate); } /** * @notice Allows for the beforehand calculation of shares to be * received/minted upon depositing the underlying asset to the * contract. * @param _underlyingCost The amount of the underlying asset being deposited. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _depositFee The current deposit fee as obtained by depositFee(). * @param _exchangeRate The exchange rate as obtained by exchangeRate(). * @return _netShares The net amount of shares being received. * @return _feeShares The fee amount of shares being deducted. */ function calcDepositSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) public pure override returns (uint256 _netShares, uint256 _feeShares) { return GCFormulae._calcDepositSharesFromUnderlyingCost(_underlyingCost, _totalReserve, _totalSupply, _depositFee, _exchangeRate); } /** * @notice Allows for the beforehand calculation of the amount of the * underlying asset to be deposited in order to receive the desired * amount of shares. * @param _netShares The amount of this gcToken shares to receive. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _depositFee The current deposit fee as obtained by depositFee(). * @param _exchangeRate The exchange rate as obtained by exchangeRate(). * @return _underlyingCost The cost, in the underlying asset, to be paid. * @return _feeShares The fee amount of shares being deducted. */ function calcDepositUnderlyingCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) public pure override returns (uint256 _underlyingCost, uint256 _feeShares) { return GCFormulae._calcDepositUnderlyingCostFromShares(_netShares, _totalReserve, _totalSupply, _depositFee, _exchangeRate); } /** * @notice Allows for the beforehand calculation of shares to be * given/burned upon withdrawing the underlying asset from the * contract. * @param _underlyingCost The amount of the underlying asset being withdrawn. * @param _totalReserve The reserve balance as obtained by totalReserve() * @param _totalSupply The shares supply as obtained by totalSupply() * @param _withdrawalFee The current withdrawl fee as obtained by withdrawalFee() * @param _exchangeRate The exchange rate as obtained by exchangeRate(). * @return _grossShares The total amount of shares being deducted, * including fees. * @return _feeShares The fee amount of shares being deducted. */ function calcWithdrawalSharesFromUnderlyingCost(uint256 _underlyingCost, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) public pure override returns (uint256 _grossShares, uint256 _feeShares) { return GCFormulae._calcWithdrawalSharesFromUnderlyingCost(_underlyingCost, _totalReserve, _totalSupply, _withdrawalFee, _exchangeRate); } /** * @notice Allows for the beforehand calculation of the amount of the * underlying asset to be withdrawn given the desired amount of * shares. * @param _grossShares The amount of this gcToken shares to provide. * @param _totalReserve The reserve balance as obtained by totalReserve(). * @param _totalSupply The shares supply as obtained by totalSupply(). * @param _withdrawalFee The current withdrawal fee as obtained by withdrawalFee(). * @param _exchangeRate The exchange rate as obtained by exchangeRate(). * @return _underlyingCost The cost, in the underlying asset, to be received. * @return _feeShares The fee amount of shares being deducted. */ function calcWithdrawalUnderlyingCostFromShares(uint256 _grossShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _withdrawalFee, uint256 _exchangeRate) public pure override returns (uint256 _underlyingCost, uint256 _feeShares) { return GCFormulae._calcWithdrawalUnderlyingCostFromShares(_grossShares, _totalReserve, _totalSupply, _withdrawalFee, _exchangeRate); } /** * @notice Provides the Compound exchange rate since their last update. * @return _exchangeRate The exchange rate between cToken and its * underlying asset */ function exchangeRate() public view override returns (uint256 _exchangeRate) { return GC.getExchangeRate(reserveToken); } /** * @notice Provides the total amount kept in the reserve in terms of the * underlying asset. * @return _totalReserveUnderlying The underlying asset balance on reserve. */ function totalReserveUnderlying() public view virtual override returns (uint256 _totalReserveUnderlying) { return GCFormulae._calcUnderlyingCostFromCost(totalReserve(), exchangeRate()); } /** * @notice Provides the total amount of the underlying asset (or equivalent) * this contract is currently lending on Compound. * @return _lendingReserveUnderlying The underlying asset lending * balance on Compound. */ function lendingReserveUnderlying() public view virtual override returns (uint256 _lendingReserveUnderlying) { return GC.getLendAmount(reserveToken); } /** * @notice Provides the total amount of the underlying asset (or equivalent) * this contract is currently borrowing on Compound. * @return _borrowingReserveUnderlying The underlying asset borrowing * balance on Compound. */ function borrowingReserveUnderlying() public view virtual override returns (uint256 _borrowingReserveUnderlying) { return GC.getBorrowAmount(reserveToken); } /** * @notice Performs the minting of gcToken shares upon the deposit of the * cToken underlying asset. The funds will be pulled in by this * contract, therefore they must be previously approved. This * function builds upon the GTokenBase deposit function. See * GTokenBase.sol for further documentation. * @param _underlyingCost The amount of the underlying asset being * deposited in the operation. */ function depositUnderlying(uint256 _underlyingCost) public override nonReentrant { address _from = msg.sender; require(_underlyingCost > 0, "underlying cost must be greater than 0"); uint256 _cost = GCFormulae._calcCostFromUnderlyingCost(_underlyingCost, exchangeRate()); (uint256 _netShares, uint256 _feeShares) = GFormulae._calcDepositSharesFromCost(_cost, totalReserve(), totalSupply(), depositFee()); require(_netShares > 0, "shares must be greater than 0"); G.pullFunds(underlyingToken, _from, _underlyingCost); GC.safeLend(reserveToken, _underlyingCost); require(_prepareDeposit(_cost), "not available at the moment"); _mint(_from, _netShares); _mint(address(this), _feeShares.div(2)); } /** * @notice Performs the burning of gcToken shares upon the withdrawal of * the underlying asset. This function builds upon the * GTokenBase withdrawal function. See GTokenBase.sol for * further documentation. * @param _grossShares The gross amount of this gcToken shares being * redeemed in the operation. */ function withdrawUnderlying(uint256 _grossShares) public override nonReentrant { address _from = msg.sender; require(_grossShares > 0, "shares must be greater than 0"); (uint256 _cost, uint256 _feeShares) = GFormulae._calcWithdrawalCostFromShares(_grossShares, totalReserve(), totalSupply(), withdrawalFee()); uint256 _underlyingCost = GCFormulae._calcUnderlyingCostFromCost(_cost, exchangeRate()); require(_underlyingCost > 0, "underlying cost must be greater than 0"); require(_prepareWithdrawal(_cost), "not available at the moment"); _underlyingCost = G.min(_underlyingCost, GC.getLendAmount(reserveToken)); GC.safeRedeem(reserveToken, _underlyingCost); G.pushFunds(underlyingToken, _from, _underlyingCost); _burn(_from, _grossShares); _mint(address(this), _feeShares.div(2)); } /** * @dev The default behavior of this function is to send the funds to * address(0), but we override it and send the funds to the stkGRO * contract instead. * @param _stakesAmount The amount of the stakes token being burned. */ function _burnStakes(uint256 _stakesAmount) internal override { G.pushFunds(stakesToken, $.stkGRO, _stakesAmount); } } // File: contracts/GCLeveragedReserveManager.sol pragma solidity ^0.6.0; /** * @dev This library implements data structure abstraction for the leveraged * reserve management code in order to circuvent the EVM contract size limit. * It is therefore a public library shared by all gcToken Type 1 contracts and * needs to be published alongside them. See GCTokenType1.sol for further * documentation. */ library GCLeveragedReserveManager { using SafeMath for uint256; using GCLeveragedReserveManager for GCLeveragedReserveManager.Self; uint256 constant MAXIMUM_COLLATERALIZATION_RATIO = 98e16; // 98% of 75% = 73.5% uint256 constant DEFAULT_COLLATERALIZATION_RATIO = 94e16; // 94% of 75% = 70.5% uint256 constant DEFAULT_COLLATERALIZATION_MARGIN = 2e16; // 2% of 75% = 1.5% struct Self { address reserveToken; address underlyingToken; address exchange; address miningToken; uint256 miningMinGulpAmount; uint256 miningMaxGulpAmount; uint256 collateralizationRatio; uint256 collateralizationMargin; } /** * @dev Initializes the data structure. This method is exposed publicly. * @param _reserveToken The ERC-20 token address of the reserve token (cToken). * @param _miningToken The ERC-20 token address to be collected from * liquidity mining (COMP). */ function init(Self storage _self, address _reserveToken, address _miningToken) public { address _underlyingToken = GC.getUnderlyingToken(_reserveToken); _self.reserveToken = _reserveToken; _self.underlyingToken = _underlyingToken; _self.exchange = address(0); _self.miningToken = _miningToken; _self.miningMinGulpAmount = 0; _self.miningMaxGulpAmount = 0; _self.collateralizationRatio = DEFAULT_COLLATERALIZATION_RATIO; _self.collateralizationMargin = DEFAULT_COLLATERALIZATION_MARGIN; GC.safeEnter(_reserveToken); } /** * @dev Sets the contract address for asset conversion delegation. * This library converts the miningToken into the underlyingToken * and use the assets to back the reserveToken. See GExchange.sol * for further documentation. This method is exposed publicly. * @param _exchange The address of the contract that implements the * GExchange interface. */ function setExchange(Self storage _self, address _exchange) public { _self.exchange = _exchange; } /** * @dev Sets the range for converting liquidity mining assets. This * method is exposed publicly. * @param _miningMinGulpAmount The minimum amount, funds will only be * converted once the minimum is accumulated. * @param _miningMaxGulpAmount The maximum amount, funds beyond this * limit will not be converted and are left * for future rounds of conversion. */ function setMiningGulpRange(Self storage _self, uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) public { require(_miningMinGulpAmount <= _miningMaxGulpAmount, "invalid range"); _self.miningMinGulpAmount = _miningMinGulpAmount; _self.miningMaxGulpAmount = _miningMaxGulpAmount; } /** * @dev Sets the collateralization ratio and margin. These values are * percentual and relative to the maximum collateralization ratio * provided by the underlying asset. This method is exposed publicly. * @param _collateralizationRatio The target collateralization ratio, * between lend and borrow, that the * reserve will try to maintain. * @param _collateralizationMargin The deviation from the target ratio * that should be accepted. */ function setCollateralizationRatio(Self storage _self, uint256 _collateralizationRatio, uint256 _collateralizationMargin) public { require(_collateralizationMargin <= _collateralizationRatio && _collateralizationRatio.add(_collateralizationMargin) <= MAXIMUM_COLLATERALIZATION_RATIO, "invalid ratio"); _self.collateralizationRatio = _collateralizationRatio; _self.collateralizationMargin = _collateralizationMargin; } /** * @dev Performs the reserve adjustment actions leaving a liquidity room, * if necessary. It will attempt to incorporate the liquidity mining * assets into the reserve and adjust the collateralization * targeting the configured ratio. This method is exposed publicly. * @param _roomAmount The underlying token amount to be available after the * operation. This is revelant for withdrawals, once the * room amount is withdrawn the reserve should reflect * the configured collateralization ratio. * @return _success A boolean indicating whether or not both actions suceeded. */ function adjustReserve(Self storage _self, uint256 _roomAmount) public returns (bool _success) { bool success1 = _self._gulpMiningAssets(); bool success2 = _self._adjustLeverage(_roomAmount); return success1 && success2; } /** * @dev Calculates the collateralization ratio and range relative to the * maximum collateralization ratio provided by the underlying asset. * @return _collateralizationRatio The target absolute collateralization ratio. * @return _minCollateralizationRatio The minimum absolute collateralization ratio. * @return _maxCollateralizationRatio The maximum absolute collateralization ratio. */ function _calcCollateralizationRatio(Self storage _self) internal view returns (uint256 _collateralizationRatio, uint256 _minCollateralizationRatio, uint256 _maxCollateralizationRatio) { uint256 _collateralRatio = GC.getCollateralRatio(_self.reserveToken); _collateralizationRatio = _collateralRatio.mul(_self.collateralizationRatio).div(1e18); _minCollateralizationRatio = _collateralRatio.mul(_self.collateralizationRatio.sub(_self.collateralizationMargin)).div(1e18); _maxCollateralizationRatio = _collateralRatio.mul(_self.collateralizationRatio.add(_self.collateralizationMargin)).div(1e18); return (_collateralizationRatio, _minCollateralizationRatio, _maxCollateralizationRatio); } /** * @dev Incorporates the liquidity mining assets into the reserve. Assets * are converted to the underlying asset and then added to the reserve. * If the amount available is below the minimum, or if the exchange * contract is not set, nothing is done. Otherwise the operation is * performed, limited to the maximum amount. Note that this operation * will incorporate to the reserve all the underlying token balance * including funds sent to it or left over somehow. * @return _success A boolean indicating whether or not the action succeeded. */ function _gulpMiningAssets(Self storage _self) internal returns (bool _success) { if (_self.exchange == address(0)) return true; if (_self.miningMaxGulpAmount == 0) return true; uint256 _miningAmount = G.getBalance(_self.miningToken); if (_miningAmount == 0) return true; if (_miningAmount < _self.miningMinGulpAmount) return true; _self._convertMiningToUnderlying(G.min(_miningAmount, _self.miningMaxGulpAmount)); return GC.lend(_self.reserveToken, G.getBalance(_self.underlyingToken)); } /** * @dev Adjusts the reserve to match the configured collateralization * ratio. It calculates how much the collateralization must be * increased or decreased and either: 1) lend/borrow, or * 2) repay/redeem, respectivelly. The funds required to perform * the operation are obtained via FlashLoan to avoid having to * maneuver around margin when moving in/out of leverage. * @param _roomAmount The amount of underlying token to be liquid after * the operation. * @return _success A boolean indicating whether or not the action succeeded. */ function _adjustLeverage(Self storage _self, uint256 _roomAmount) internal returns (bool _success) { // the reserve is the diference between lend and borrow uint256 _lendAmount = GC.fetchLendAmount(_self.reserveToken); uint256 _borrowAmount = GC.fetchBorrowAmount(_self.reserveToken); uint256 _reserveAmount = _lendAmount.sub(_borrowAmount); // caps the room in case it is larger than the reserve _roomAmount = G.min(_roomAmount, _reserveAmount); // The new reserve must deduct the room requested uint256 _newReserveAmount = _reserveAmount.sub(_roomAmount); // caculates the assumed lend amount deducting the requested room uint256 _oldLendAmount = _lendAmount.sub(_roomAmount); // the new lend amount is the new reserve with leverage applied uint256 _newLendAmount; uint256 _minNewLendAmount; uint256 _maxNewLendAmount; { (uint256 _collateralizationRatio, uint256 _minCollateralizationRatio, uint256 _maxCollateralizationRatio) = _self._calcCollateralizationRatio(); _newLendAmount = _newReserveAmount.mul(1e18).div(uint256(1e18).sub(_collateralizationRatio)); _minNewLendAmount = _newReserveAmount.mul(1e18).div(uint256(1e18).sub(_minCollateralizationRatio)); _maxNewLendAmount = _newReserveAmount.mul(1e18).div(uint256(1e18).sub(_maxCollateralizationRatio)); } // adjust the reserve by: // 1- increasing collateralization by the difference // 2- decreasing collateralization by the difference // the adjustment is capped by the liquidity available on the market uint256 _liquidityAmount = G.getFlashLoanLiquidity(_self.underlyingToken); if (_minNewLendAmount > _oldLendAmount) { { uint256 _minAmount = _minNewLendAmount.sub(_oldLendAmount); require(_liquidityAmount >= _minAmount, "cannot maintain collateralization ratio"); } uint256 _amount = _newLendAmount.sub(_oldLendAmount); return _self._dispatchFlashLoan(G.min(_amount, _liquidityAmount), 1); } if (_maxNewLendAmount < _oldLendAmount) { { uint256 _minAmount = _oldLendAmount.sub(_maxNewLendAmount); require(_liquidityAmount >= _minAmount, "cannot maintain collateralization ratio"); } uint256 _amount = _oldLendAmount.sub(_newLendAmount); return _self._dispatchFlashLoan(G.min(_amount, _liquidityAmount), 2); } return true; } /** * @dev This is the continuation of _adjustLeverage once funds are * borrowed via the FlashLoan callback. * @param _amount The borrowed amount as requested. * @param _fee The additional fee that needs to be paid for the FlashLoan. * @param _which A flag indicating whether the funds were borrowed to * 1) increase or 2) decrease the collateralization ratio. * @return _success A boolean indicating whether or not the action succeeded. */ function _continueAdjustLeverage(Self storage _self, uint256 _amount, uint256 _fee, uint256 _which) internal returns (bool _success) { // note that the reserve adjustment is not 100% accurate as we // did not account for FlashLoan fees in the initial calculation if (_which == 1) { bool _success1 = GC.lend(_self.reserveToken, _amount.sub(_fee)); bool _success2 = GC.borrow(_self.reserveToken, _amount); return _success1 && _success2; } if (_which == 2) { bool _success1 = GC.repay(_self.reserveToken, _amount); bool _success2 = GC.redeem(_self.reserveToken, _amount.add(_fee)); return _success1 && _success2; } assert(false); } /** * @dev Abstracts the details of dispatching the FlashLoan by encoding * the extra parameters. * @param _amount The amount to be borrowed. * @param _which A flag indicating whether the funds are borrowed to * 1) increase or 2) decrease the collateralization ratio. * @return _success A boolean indicating whether or not the action succeeded. */ function _dispatchFlashLoan(Self storage _self, uint256 _amount, uint256 _which) internal returns (bool _success) { return G.requestFlashLoan(_self.underlyingToken, _amount, abi.encode(_which)); } /** * @dev Abstracts the details of receiving a FlashLoan by decoding * the extra parameters. * @param _token The asset being borrowed. * @param _amount The borrowed amount. * @param _fee The fees to be paid along with the borrowed amount. * @param _params Additional encoded parameters to be decoded. * @return _success A boolean indicating whether or not the action succeeded. */ function _receiveFlashLoan(Self storage _self, address _token, uint256 _amount, uint256 _fee, bytes memory _params) external returns (bool _success) { assert(_token == _self.underlyingToken); uint256 _which = abi.decode(_params, (uint256)); return _self._continueAdjustLeverage(_amount, _fee, _which); } /** * @dev Converts a given amount of the mining token to the underlying * token using the external exchange contract. Both amounts are * deducted and credited, respectively, from the current contract. * @param _inputAmount The amount to be converted. */ function _convertMiningToUnderlying(Self storage _self, uint256 _inputAmount) internal { G.dynamicConvertFunds(_self.exchange, _self.miningToken, _self.underlyingToken, _inputAmount, 0); } } // File: contracts/GFlashBorrower.sol pragma solidity ^0.6.0; /** * @dev This abstract contract provides an uniform interface for receiving * flash loans. It encapsulates the required functionality provided by * both Aave and Dydx. It performs the basic validation to ensure that * only Aave/Dydx contracts can dispatch the operation and only the * current contract (that inherits from it) can initiate it. */ abstract contract GFlashBorrower is FlashLoanReceiver, ICallee { using SafeMath for uint256; uint256 private allowOperationLevel = 0; /** * @dev Handy definition to ensure that flash loans are only initiated * from within the current contract. */ modifier mayFlashBorrow() { allowOperationLevel++; _; allowOperationLevel--; } /** * @dev Handles Aave callback. Delegates the processing of the funds * to the virtual function _processFlashLoan and later takes care * of paying it back. * @param _token The ERC-20 contract address. * @param _amount The amount being borrowed. * @param _fee The fee, in addition to the amount borrowed, to be repaid. * @param _params Additional user parameters provided when the flash * loan was requested. */ function executeOperation(address _token, uint256 _amount, uint256 _fee, bytes calldata _params) external override { assert(allowOperationLevel > 0); address _from = msg.sender; address _pool = $.Aave_AAVE_LENDING_POOL; assert(_from == _pool); require(_processFlashLoan(_token, _amount, _fee, _params)/*, "failure processing flash loan"*/); G.paybackFlashLoan(FlashLoans.Provider.Aave, _token, _amount.add(_fee)); } /** * @dev Handles Dydx callback. Delegates the processing of the funds * to the virtual function _processFlashLoan and later takes care * of paying it back. * @param _sender The contract address of the initiator of the flash * loan, expected to be the current contract. * @param _account Dydx account info provided in the callback. * @param _data Aditional external data provided to the Dydx callback, * this is used by the Dydx module to pass the ERC-20 token * address, the amount and fee, as well as user parameters. */ function callFunction(address _sender, Account.Info memory _account, bytes memory _data) external override { assert(allowOperationLevel > 0); address _from = msg.sender; address _solo = $.Dydx_SOLO_MARGIN; assert(_from == _solo); assert(_sender == address(this)); assert(_account.owner == address(this)); (address _token, uint256 _amount, uint256 _fee, bytes memory _params) = abi.decode(_data, (address,uint256,uint256,bytes)); require(_processFlashLoan(_token, _amount, _fee, _params)/*, "failure processing flash loan"*/); G.paybackFlashLoan(FlashLoans.Provider.Dydx, _token, _amount.add(_fee)); } /** * @dev Internal function that abstracts the algorithm to be performed * with borrowed funds. It receives the funds, deposited in the * current contract, and must ensure they are available as balance * of the current contract, including fees, before it returns. * @param _token The ERC-20 contract address. * @param _amount The amount being borrowed. * @param _fee The fee, in addition to the amount borrowed, to be repaid. * @param _params Additional user parameters provided when the flash * loan was requested. * @return _success A boolean indicating success. */ function _processFlashLoan(address _token, uint256 _amount, uint256 _fee, bytes memory _params) internal virtual returns (bool _success); } // File: contracts/GCTokenType1.sol pragma solidity ^0.6.0; /** * @notice This contract implements the functionality for the gcToken Type 1. * As with all gcTokens, gcTokens Type 1 use a Compound cToken as * reserve token. Furthermore, Type 1 tokens may apply leverage to the * reserve by using the cToken balance to borrow its associated * underlying asset which in turn is used to mint more cToken. This * process is performed to the limit where the actual reserve balance * ends up accounting for the difference between the total amount lent * and the total amount borrowed. One may observe that there is * always a net loss when considering just the yield accrued for * lending minus the yield accrued for borrowing on Compound. However, * if we consider COMP being credited for liquidity mining the net * balance may become positive and that is when the leverage mechanism * should be applied. The COMP is periodically converted to the * underlying asset and naturally becomes part of the reserve. * In order to easily and efficiently adjust the leverage, this contract * performs flash loans. See GCTokenBase, GFlashBorrower and * GCLeveragedReserveManager for further documentation. */ contract GCTokenType1 is GCTokenBase, GFlashBorrower { using GCLeveragedReserveManager for GCLeveragedReserveManager.Self; GCLeveragedReserveManager.Self lrm; /** * @dev Constructor for the gcToken Type 1 contract. * @param _name The ERC-20 token name. * @param _symbol The ERC-20 token symbol. * @param _decimals The ERC-20 token decimals. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _reserveToken The ERC-20 token address to be used as reserve * token (e.g. cDAI for gcDAI). * @param _miningToken The ERC-20 token used for liquidity mining on * compound (COMP). */ constructor (string memory _name, string memory _symbol, uint8 _decimals, address _stakesToken, address _reserveToken, address _miningToken) GCTokenBase(_name, _symbol, _decimals, _stakesToken, _reserveToken, _miningToken, address(0)) public { lrm.init(_reserveToken, _miningToken); } /** * @notice Overrides the default total reserve definition in order to * account only for the diference between assets being lent * and assets being borrowed. * @return _totalReserve The amount of the reserve token corresponding * to this contract's worth. */ function totalReserve() public view override returns (uint256 _totalReserve) { return GCFormulae._calcCostFromUnderlyingCost(totalReserveUnderlying(), exchangeRate()); } /** * @notice Overrides the default total underlying reserve definition in * order to account only for the diference between assets being * lent and assets being borrowed. * @return _totalReserveUnderlying The amount of the underlying asset * corresponding to this contract's worth. */ function totalReserveUnderlying() public view override returns (uint256 _totalReserveUnderlying) { return lendingReserveUnderlying().sub(borrowingReserveUnderlying()); } /** * @notice Provides the contract address for the GExchange implementation * currently being used to convert the mining token (COMP) into * the underlying asset. * @return _exchange A GExchange compatible contract address, or address(0) * if it has not been set. */ function exchange() public view override returns (address _exchange) { return lrm.exchange; } /** * @notice Provides the minimum and maximum amount of the mining token to * be processed on every operation. If the contract balance * is below the minimum it waits until more accumulates. * If the total amount is beyond the maximum it processes the * maximum and leaves the rest for future operations. The mining * token accumulated via liquidity mining is converted to the * underlying asset and used to mint the associated cToken. * This range is used to avoid wasting gas converting small * amounts as well as mitigating slipage converting large amounts. * @return _miningMinGulpAmount The minimum amount of the mining token * to be processed per deposit/withdrawal. * @return _miningMaxGulpAmount The maximum amount of the mining token * to be processed per deposit/withdrawal. */ function miningGulpRange() public view override returns (uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) { return (lrm.miningMinGulpAmount, lrm.miningMaxGulpAmount); } /** * @notice Provides the minimum and maximum amount of the gcToken Type 1 to * be processed on every operation. This method applies only to * gcTokens Type 2 and is not relevant for gcTokens Type 1. * @return _growthMinGulpAmount The minimum amount of the gcToken Type 1 * to be processed per deposit/withdrawal * (always 0). * @return _growthMaxGulpAmount The maximum amount of the gcToken Type 1 * to be processed per deposit/withdrawal * (always 0). */ function growthGulpRange() public view override returns (uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) { return (0, 0); } /** * @notice Provides the target collateralization ratio and margin to be * maintained by this contract. The amount is relative to the * maximum collateralization available for the associated cToken * on Compound. gcToken Type 1 uses leveraged collateralization * where the cToken is used to borrow its underlying token which * in turn is used to mint new cToken and repeat. This is * performed to the maximal level where the actual reserve * ends up corresponding to the difference between the amount * lent and the amount borrowed. * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * (defaults to 94%) * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * margin (defaults to 2%) */ function collateralizationRatio() public view override returns (uint256 _collateralizationRatio, uint256 _collateralizationMargin) { return (lrm.collateralizationRatio, lrm.collateralizationMargin); } /** * @notice Sets the contract address for the GExchange implementation * to be used in converting the mining token (COMP) into * the underlying asset. This is a priviledged function * restricted to the contract owner. * @param _exchange A GExchange compatible contract address. */ function setExchange(address _exchange) public override onlyOwner nonReentrant { lrm.setExchange(_exchange); } /** * @notice Sets the minimum and maximum amount of the mining token to * be processed on every operation. See miningGulpRange(). * This is a priviledged function restricted to the contract owner. * @param _miningMinGulpAmount The minimum amount of the mining token * to be processed per deposit/withdrawal. * @param _miningMaxGulpAmount The maximum amount of the mining token * to be processed per deposit/withdrawal. */ function setMiningGulpRange(uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) public override onlyOwner nonReentrant { lrm.setMiningGulpRange(_miningMinGulpAmount, _miningMaxGulpAmount); } /** * @notice Sets the minimum and maximum amount of the gcToken Type 1 to * be processed on every operation. This method applies only to * gcTokens Type 2 and is not relevant for gcTokens Type 1. * This is a priviledged function restricted to the contract owner. * @param _growthMinGulpAmount The minimum amount of the gcToken Type 1 * to be processed per deposit/withdrawal * (ignored). * @param _growthMaxGulpAmount The maximum amount of the gcToken Type 1 * to be processed per deposit/withdrawal * (ignored). */ function setGrowthGulpRange(uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) public override /*onlyOwner nonReentrant*/ { _growthMinGulpAmount; _growthMaxGulpAmount; // silences warnings } /** * @notice Sets the target collateralization ratio and margin to be * maintained by this contract. See collateralizationRatio(). * Setting both parameters to 0 turns off collateralization and * leveraging. This is a priviledged function restricted to the * contract owner. * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * (defaults to 94%) * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * margin (defaults to 2%) */ function setCollateralizationRatio(uint256 _collateralizationRatio, uint256 _collateralizationMargin) public override onlyOwner nonReentrant { lrm.setCollateralizationRatio(_collateralizationRatio, _collateralizationMargin); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * after a deposit comes along. It basically adjusts the * collateralization/leverage to reflect the new increased reserve * balance. This method uses the GCLeveragedReserveManager to * adjust the reserve and this is done via flash loans. * See GCLeveragedReserveManager.sol. * @param _cost The amount of reserve being deposited (ignored). * @return _success A boolean indicating whether or not the operation * succeeded. This operation should not fail unless * any of the underlying components (Compound, Aave, * Dydx) also fails. */ function _prepareDeposit(uint256 _cost) internal override mayFlashBorrow returns (bool _success) { _cost; // silences warnings return lrm.adjustReserve(0); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * before a withdrawal comes along. It basically calculates the * the amount that will be left in the reserve, in terms of cToken * cost, and adjusts the collateralization/leverage accordingly. This * method uses the GCLeveragedReserveManager to adjust the reserve * and this is done via flash loans. See GCLeveragedReserveManager.sol. * @param _cost The amount of reserve being withdrawn and that needs to * be immediately liquid. * @return _success A boolean indicating whether or not the operation succeeded. * The operation may fail if it is not possible to recover * the required liquidity (e.g. low liquidity in the markets). */ function _prepareWithdrawal(uint256 _cost) internal override mayFlashBorrow returns (bool _success) { return lrm.adjustReserve(GCFormulae._calcUnderlyingCostFromCost(_cost, GC.fetchExchangeRate(reserveToken))); } /** * @dev This method dispatches the flash loan callback back to the * GCLeveragedReserveManager library. See GCLeveragedReserveManager.sol * and GFlashBorrower.sol. */ function _processFlashLoan(address _token, uint256 _amount, uint256 _fee, bytes memory _params) internal override returns (bool _success) { return lrm._receiveFlashLoan(_token, _amount, _fee, _params); } } // File: contracts/GCDelegatedReserveManager.sol pragma solidity ^0.6.0; /** * @dev This library implements data structure abstraction for the delegated * reserve management code in order to circuvent the EVM contract size limit. * It is therefore a public library shared by all gcToken Type 2 contracts and * needs to be published alongside them. See GCTokenType2.sol for further * documentation. */ library GCDelegatedReserveManager { using SafeMath for uint256; using GCDelegatedReserveManager for GCDelegatedReserveManager.Self; uint256 constant MAXIMUM_COLLATERALIZATION_RATIO = 96e16; // 96% of 50% = 48% uint256 constant DEFAULT_COLLATERALIZATION_RATIO = 66e16; // 66% of 50% = 33% uint256 constant DEFAULT_COLLATERALIZATION_MARGIN = 8e16; // 8% of 50% = 4% struct Self { address reserveToken; address underlyingToken; address exchange; address miningToken; uint256 miningMinGulpAmount; uint256 miningMaxGulpAmount; address borrowToken; address growthToken; address growthReserveToken; uint256 growthMinGulpAmount; uint256 growthMaxGulpAmount; uint256 collateralizationRatio; uint256 collateralizationMargin; } /** * @dev Initializes the data structure. This method is exposed publicly. * Note that the underlying borrowing token must match the growth * reserve token given that funds borrowed will be reinvested in * the provided growth token (gToken). * @param _reserveToken The ERC-20 token address of the reserve token (cToken). * @param _miningToken The ERC-20 token address to be collected from * liquidity mining (COMP). * @param _borrowToken The ERC-20 token address of the borrow token (cToken). * @param _growthToken The ERC-20 token address of the growth token (gToken). */ function init(Self storage _self, address _reserveToken, address _miningToken, address _borrowToken, address _growthToken) public { address _underlyingToken = GC.getUnderlyingToken(_reserveToken); address _borrowUnderlyingToken = GC.getUnderlyingToken(_borrowToken); address _growthReserveToken = GToken(_growthToken).reserveToken(); assert(_borrowUnderlyingToken == _growthReserveToken); _self.reserveToken = _reserveToken; _self.underlyingToken = _underlyingToken; _self.exchange = address(0); _self.miningToken = _miningToken; _self.miningMinGulpAmount = 0; _self.miningMaxGulpAmount = 0; _self.borrowToken = _borrowToken; _self.growthToken = _growthToken; _self.growthReserveToken = _growthReserveToken; _self.growthMinGulpAmount = 0; _self.growthMaxGulpAmount = 0; _self.collateralizationRatio = DEFAULT_COLLATERALIZATION_RATIO; _self.collateralizationMargin = DEFAULT_COLLATERALIZATION_MARGIN; GC.safeEnter(_reserveToken); } /** * @dev Sets the contract address for asset conversion delegation. * This library converts the miningToken into the underlyingToken * and use the assets to back the reserveToken. See GExchange.sol * for further documentation. This method is exposed publicly. * @param _exchange The address of the contract that implements the * GExchange interface. */ function setExchange(Self storage _self, address _exchange) public { _self.exchange = _exchange; } /** * @dev Sets the range for converting liquidity mining assets. This * method is exposed publicly. * @param _miningMinGulpAmount The minimum amount, funds will only be * converted once the minimum is accumulated. * @param _miningMaxGulpAmount The maximum amount, funds beyond this * limit will not be converted and are left * for future rounds of conversion. */ function setMiningGulpRange(Self storage _self, uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) public { require(_miningMinGulpAmount <= _miningMaxGulpAmount, "invalid range"); _self.miningMinGulpAmount = _miningMinGulpAmount; _self.miningMaxGulpAmount = _miningMaxGulpAmount; } /** * @dev Sets the range for converting growth profits. This * method is exposed publicly. * @param _growthMinGulpAmount The minimum amount, funds will only be * converted once the minimum is accumulated. * @param _growthMaxGulpAmount The maximum amount, funds beyond this * limit will not be converted and are left * for future rounds of conversion. */ function setGrowthGulpRange(Self storage _self, uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) public { require(_growthMinGulpAmount <= _growthMaxGulpAmount, "invalid range"); _self.growthMinGulpAmount = _growthMinGulpAmount; _self.growthMaxGulpAmount = _growthMaxGulpAmount; } /** * @dev Sets the collateralization ratio and margin. These values are * percentual and relative to the maximum collateralization ratio * provided by the underlying asset. This method is exposed publicly. * @param _collateralizationRatio The target collateralization ratio, * between lend and borrow, that the * reserve will try to maintain. * @param _collateralizationMargin The deviation from the target ratio * that should be accepted. */ function setCollateralizationRatio(Self storage _self, uint256 _collateralizationRatio, uint256 _collateralizationMargin) public { require(_collateralizationMargin <= _collateralizationRatio && _collateralizationRatio.add(_collateralizationMargin) <= MAXIMUM_COLLATERALIZATION_RATIO, "invalid ratio"); _self.collateralizationRatio = _collateralizationRatio; _self.collateralizationMargin = _collateralizationMargin; } /** * @dev Performs the reserve adjustment actions leaving a liquidity room, * if necessary. It will attempt to incorporate the liquidity mining * assets into the reserve, the profits from the underlying growth * investment and adjust the collateralization targeting the * configured ratio. This method is exposed publicly. * @param _roomAmount The underlying token amount to be available after the * operation. This is revelant for withdrawals, once the * room amount is withdrawn the reserve should reflect * the configured collateralization ratio. * @return _success A boolean indicating whether or not both actions suceeded. */ function adjustReserve(Self storage _self, uint256 _roomAmount) public returns (bool _success) { bool _success1 = _self._gulpMiningAssets(); bool _success2 = _self._gulpGrowthAssets(); bool _success3 = _self._adjustReserve(_roomAmount); return _success1 && _success2 && _success3; } /** * @dev Calculates the collateralization ratio relative to the maximum * collateralization ratio provided by the underlying asset. * @return _collateralizationRatio The target absolute collateralization ratio. */ function _calcCollateralizationRatio(Self storage _self) internal view returns (uint256 _collateralizationRatio) { return GC.getCollateralRatio(_self.reserveToken).mul(_self.collateralizationRatio).div(1e18); } /** * @dev Incorporates the liquidity mining assets into the reserve. Assets * are converted to the underlying asset and then added to the reserve. * If the amount available is below the minimum, or if the exchange * contract is not set, nothing is done. Otherwise the operation is * performed, limited to the maximum amount. Note that this operation * will incorporate to the reserve all the underlying token balance * including funds sent to it or left over somehow. * @return _success A boolean indicating whether or not the action succeeded. */ function _gulpMiningAssets(Self storage _self) internal returns (bool _success) { if (_self.exchange == address(0)) return true; if (_self.miningMaxGulpAmount == 0) return true; uint256 _miningAmount = G.getBalance(_self.miningToken); if (_miningAmount == 0) return true; if (_miningAmount < _self.miningMinGulpAmount) return true; _self._convertMiningToUnderlying(G.min(_miningAmount, _self.miningMaxGulpAmount)); return GC.lend(_self.reserveToken, G.getBalance(_self.underlyingToken)); } /** * @dev Incorporates the profits from growth into the reserve. Assets * are converted to the underlying asset and then added to the reserve. * If the amount available is below the minimum, or if the exchange * contract is not set, nothing is done. Otherwise the operation is * performed, limited to the maximum amount. Note that this operation * will incorporate to the reserve all the growth reserve token balance * including funds sent to it or left over somehow. * @return _success A boolean indicating whether or not the action succeeded. */ function _gulpGrowthAssets(Self storage _self) internal returns (bool _success) { if (_self.exchange == address(0)) return true; if (_self.growthMaxGulpAmount == 0) return true; // calculates how much was borrowed uint256 _borrowAmount = GC.fetchBorrowAmount(_self.borrowToken); // calculates how much can be redeemed from the growth token uint256 _totalShares = G.getBalance(_self.growthToken); uint256 _redeemableAmount = _self._calcWithdrawalCostFromShares(_totalShares); // if there is a profit and that amount is within range // it gets converted to the underlying reserve token and // incorporated to the reserve if (_redeemableAmount <= _borrowAmount) return true; uint256 _growthAmount = _redeemableAmount.sub(_borrowAmount); if (_growthAmount < _self.growthMinGulpAmount) return true; uint256 _grossShares = _self._calcWithdrawalSharesFromCost(G.min(_growthAmount, _self.growthMaxGulpAmount)); _grossShares = G.min(_grossShares, _totalShares); if (_grossShares == 0) return true; _success = _self._withdraw(_grossShares); if (!_success) return false; _self._convertGrowthReserveToUnderlying(G.getBalance(_self.growthReserveToken)); return GC.lend(_self.reserveToken, G.getBalance(_self.underlyingToken)); } /** * @dev Adjusts the reserve to match the configured collateralization * ratio. It uses the reserve collateral to borrow a proper amount * of the growth token reserve asset and deposit it. Or it * redeems from the growth token and repays the loan. * @param _roomAmount The amount of underlying token to be liquid after * the operation. * @return _success A boolean indicating whether or not the action succeeded. */ function _adjustReserve(Self storage _self, uint256 _roomAmount) internal returns (bool _success) { // calculates the percental change from the current reserve // and the reserve deducting the room amount uint256 _scalingRatio; { uint256 _reserveAmount = GC.fetchLendAmount(_self.reserveToken); _roomAmount = G.min(_roomAmount, _reserveAmount); uint256 _newReserveAmount = _reserveAmount.sub(_roomAmount); _scalingRatio = _reserveAmount > 0 ? uint256(1e18).mul(_newReserveAmount).div(_reserveAmount) : 0; } // calculates the borrowed amount and range in terms of the reserve token uint256 _borrowAmount = GC.fetchBorrowAmount(_self.borrowToken); uint256 _newBorrowAmount; uint256 _minBorrowAmount; uint256 _maxBorrowAmount; { uint256 _freeAmount = GC.getLiquidityAmount(_self.borrowToken); uint256 _totalAmount = _borrowAmount.add(_freeAmount); // applies the scaling ratio to account for the required room uint256 _newTotalAmount = _totalAmount.mul(_scalingRatio).div(1e18); _newBorrowAmount = _newTotalAmount.mul(_self.collateralizationRatio).div(1e18); uint256 _newMarginAmount = _newTotalAmount.mul(_self.collateralizationMargin).div(1e18); _minBorrowAmount = _newBorrowAmount.sub(G.min(_newMarginAmount, _newBorrowAmount)); _maxBorrowAmount = G.min(_newBorrowAmount.add(_newMarginAmount), _newTotalAmount); } // if the borrow amount is below the lower bound, // borrows the diference and deposits in the growth token contract if (_borrowAmount < _minBorrowAmount) { uint256 _amount = _newBorrowAmount.sub(_borrowAmount); _amount = G.min(_amount, GC.getMarketAmount(_self.borrowToken)); _success = GC.borrow(_self.borrowToken, _amount); if (!_success) return false; _success = _self._deposit(_amount); if (_success) return true; GC.repay(_self.borrowToken, _amount); return false; } // if the borrow amount is above the upper bound, // redeems the diference from the growth token contract and // repays the loan if (_borrowAmount > _maxBorrowAmount) { uint256 _amount = _borrowAmount.sub(_newBorrowAmount); uint256 _grossShares = _self._calcWithdrawalSharesFromCost(_amount); _grossShares = G.min(_grossShares, G.getBalance(_self.growthToken)); if (_grossShares == 0) return true; _success = _self._withdraw(_grossShares); if (!_success) return false; uint256 _repayAmount = G.min(_borrowAmount, G.getBalance(_self.growthReserveToken)); return GC.repay(_self.borrowToken, _repayAmount); } return true; } /** * @dev Calculates how much of the growth reserve token can be redeemed * from a given amount of shares. * @param _grossShares The number of shares to redeem. * @return _cost The reserve token amount to be withdraw. */ function _calcWithdrawalCostFromShares(Self storage _self, uint256 _grossShares) internal view returns (uint256 _cost) { uint256 _totalReserve = GToken(_self.growthToken).totalReserve(); uint256 _totalSupply = GToken(_self.growthToken).totalSupply(); uint256 _withdrawalFee = GToken(_self.growthToken).withdrawalFee(); (_cost,) = GToken(_self.growthToken).calcWithdrawalCostFromShares(_grossShares, _totalReserve, _totalSupply, _withdrawalFee); return _cost; } /** * @dev Calculates how many shares must be redeemed in order to withdraw * so much of the growth reserve token. * @param _cost The amount of the reserve token to be received on * withdrawal. * @return _grossShares The number of shares one must redeem. */ function _calcWithdrawalSharesFromCost(Self storage _self, uint256 _cost) internal view returns (uint256 _grossShares) { uint256 _totalReserve = GToken(_self.growthToken).totalReserve(); uint256 _totalSupply = GToken(_self.growthToken).totalSupply(); uint256 _withdrawalFee = GToken(_self.growthToken).withdrawalFee(); (_grossShares,) = GToken(_self.growthToken).calcWithdrawalSharesFromCost(_cost, _totalReserve, _totalSupply, _withdrawalFee); return _grossShares; } /** * @dev Deposits into the growth token contract. * @param _cost The amount of thr growth reserve token to be deposited. * @return _success A boolean indicating whether or not the action succeeded. */ function _deposit(Self storage _self, uint256 _cost) internal returns (bool _success) { G.approveFunds(_self.growthReserveToken, _self.growthToken, _cost); try GToken(_self.growthToken).deposit(_cost) { return true; } catch (bytes memory /* _data */) { G.approveFunds(_self.growthReserveToken, _self.growthToken, 0); return false; } } /** * @dev Withdraws from the growth token contract. * @param _grossShares The number of shares to be redeemed. * @return _success A boolean indicating whether or not the action succeeded. */ function _withdraw(Self storage _self, uint256 _grossShares) internal returns (bool _success) { try GToken(_self.growthToken).withdraw(_grossShares) { return true; } catch (bytes memory /* _data */) { return false; } } /** * @dev Converts a given amount of the mining token to the underlying * token using the external exchange contract. Both amounts are * deducted and credited, respectively, from the current contract. * @param _inputAmount The amount to be converted. */ function _convertMiningToUnderlying(Self storage _self, uint256 _inputAmount) internal { G.dynamicConvertFunds(_self.exchange, _self.miningToken, _self.underlyingToken, _inputAmount, 0); } /** * @dev Converts a given amount of the growth reserve token to the * underlying token using the external exchange contract. Both * amounts are deducted and credited, respectively, from the * current contract. * @param _inputAmount The amount to be converted. */ function _convertGrowthReserveToUnderlying(Self storage _self, uint256 _inputAmount) internal { G.dynamicConvertFunds(_self.exchange, _self.growthReserveToken, _self.underlyingToken, _inputAmount, 0); } } // File: contracts/GCTokenType2.sol pragma solidity ^0.6.0; /** * @notice This contract implements the functionality for the gcToken Type 2. * As with all gcTokens, gcTokens Type 2 use a Compound cToken as * reserve token. Furthermore, Type 2 tokens will use that cToken * balance to borrow funds that are then deposited into another gToken. * Periodically the gcToken Type 2 will collect profits from liquidity * mining COMP, as well as profits from investing borrowed assets in * the gToken. These profits are converted into the cToken underlying * asset and incorporated to the reserve. See GCTokenBase and * GCDelegatedReserveManager for further documentation. */ contract GCTokenType2 is GCTokenBase { using GCDelegatedReserveManager for GCDelegatedReserveManager.Self; GCDelegatedReserveManager.Self drm; /** * @dev Constructor for the gcToken Type 2 contract. * @param _name The ERC-20 token name. * @param _symbol The ERC-20 token symbol. * @param _decimals The ERC-20 token decimals. * @param _stakesToken The ERC-20 token address to be used as stakes * token (GRO). * @param _reserveToken The ERC-20 token address to be used as reserve * token (e.g. cDAI for gcDAI). * @param _miningToken The ERC-20 token used for liquidity mining on * compound (COMP). * @param _borrowToken The cToken used for borrowing funds on compound (cDAI). * @param _growthToken The gToken used for reinvesting borrowed funds (gDAI). */ constructor (string memory _name, string memory _symbol, uint8 _decimals, address _stakesToken, address _reserveToken, address _miningToken, address _borrowToken, address _growthToken) GCTokenBase(_name, _symbol, _decimals, _stakesToken, _reserveToken, _miningToken, _growthToken) public { drm.init(_reserveToken, _miningToken, _borrowToken, _growthToken); } /** * @notice Provides the total amount of the underlying asset (or equivalent) * this contract is currently borrowing on Compound. * @return _borrowingReserveUnderlying The underlying asset borrowing * balance on Compound. */ function borrowingReserveUnderlying() public view override returns (uint256 _borrowingReserveUnderlying) { uint256 _lendAmount = GC.getLendAmount(reserveToken); uint256 _availableAmount = _lendAmount.mul(GC.getCollateralRatio(reserveToken)).div(1e18); uint256 _borrowAmount = GC.getBorrowAmount(drm.borrowToken); uint256 _freeAmount = GC.getLiquidityAmount(drm.borrowToken); uint256 _totalAmount = _borrowAmount.add(_freeAmount); return _totalAmount > 0 ? _availableAmount.mul(_borrowAmount).div(_totalAmount) : 0; } /** * @notice Provides the contract address for the GExchange implementation * currently being used to convert the mining token (COMP), and * the gToken reserve token (DAI), into the underlying asset. * @return _exchange A GExchange compatible contract address, or address(0) * if it has not been set. */ function exchange() public view override returns (address _exchange) { return drm.exchange; } /** * @notice Provides the minimum and maximum amount of the mining token to * be processed on every operation. If the contract balance * is below the minimum it waits until more accumulates. * If the total amount is beyond the maximum it processes the * maximum and leaves the rest for future operations. The mining * token accumulated via liquidity mining is converted to the * underlying asset and used to mint the associated cToken. * This range is used to avoid wasting gas converting small * amounts as well as mitigating slipage converting large amounts. * @return _miningMinGulpAmount The minimum amount of the mining token * to be processed per deposit/withdrawal. * @return _miningMaxGulpAmount The maximum amount of the mining token * to be processed per deposit/withdrawal. */ function miningGulpRange() public view override returns (uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) { return (drm.miningMinGulpAmount, drm.miningMaxGulpAmount); } /** * @notice Provides the minimum and maximum amount of the gToken reserve * profit to be processed on every operation. If the profit balance * is below the minimum it waits until more accumulates. * If the total profit is beyond the maximum it processes the * maximum and leaves the rest for future operations. The profit * accumulated via gToken reinvestment is converted to the * underlying asset and used to mint the associated cToken. * This range is used to avoid wasting gas converting small * amounts as well as mitigating slipage converting large amounts. * @return _growthMinGulpAmount The minimum profit of the gToken reserve * to be processed per deposit/withdrawal. * @return _growthMaxGulpAmount The maximum profit of the gToken reserve * to be processed per deposit/withdrawal. */ function growthGulpRange() public view override returns (uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) { return (drm.growthMinGulpAmount, drm.growthMaxGulpAmount); } /** * @notice Provides the target collateralization ratio and margin to be * maintained by this contract. The amount is relative to the * maximum collateralization available for the associated cToken * on Compound. gcToken Type 2 uses the reserve token as collateral * to borrow funds and revinvest into the gToken. * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * (defaults to 66%) * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * margin (defaults to 8%) */ function collateralizationRatio() public view override returns (uint256 _collateralizationRatio, uint256 _collateralizationMargin) { return (drm.collateralizationRatio, drm.collateralizationMargin); } /** * @notice Sets the contract address for the GExchange implementation * to be used in converting the mining token (COMP), and * the gToken reserve token (DAI), into the underlying asset. * This is a priviledged function restricted to the contract owner. * @param _exchange A GExchange compatible contract address. */ function setExchange(address _exchange) public override onlyOwner nonReentrant { drm.setExchange(_exchange); } /** * @notice Sets the minimum and maximum amount of the mining token to * be processed on every operation. See miningGulpRange(). * This is a priviledged function restricted to the contract owner. * @param _miningMinGulpAmount The minimum amount of the mining token * to be processed per deposit/withdrawal. * @param _miningMaxGulpAmount The maximum amount of the mining token * to be processed per deposit/withdrawal. */ function setMiningGulpRange(uint256 _miningMinGulpAmount, uint256 _miningMaxGulpAmount) public override onlyOwner nonReentrant { drm.setMiningGulpRange(_miningMinGulpAmount, _miningMaxGulpAmount); } /** * @notice Sets the minimum and maximum amount of the gToken reserve profit * to be processed on every operation. See growthGulpRange(). * This is a priviledged function restricted to the contract owner. * @param _growthMinGulpAmount The minimum profit of the gToken reserve * to be processed per deposit/withdrawal. * @param _growthMaxGulpAmount The maximum profit of the gToken reserve * to be processed per deposit/withdrawal. */ function setGrowthGulpRange(uint256 _growthMinGulpAmount, uint256 _growthMaxGulpAmount) public override onlyOwner nonReentrant { drm.setGrowthGulpRange(_growthMinGulpAmount, _growthMaxGulpAmount); } /** * @notice Sets the target collateralization ratio and margin to be * maintained by this contract. See collateralizationRatio(). * Setting both parameters to 0 turns off collateralization. * This is a priviledged function restricted to the contract owner. * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * (defaults to 66%) * @param _collateralizationRatio The percent value relative to the * maximum allowed that this contract * will target for collateralization * margin (defaults to 8%) */ function setCollateralizationRatio(uint256 _collateralizationRatio, uint256 _collateralizationMargin) public override onlyOwner nonReentrant { drm.setCollateralizationRatio(_collateralizationRatio, _collateralizationMargin); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * after a deposit comes along. It basically adjusts the * collateralization to reflect the new increased reserve * balance. This method uses the GCDelegatedReserveManager to * adjust the reserve. See GCDelegatedReserveManager.sol. * @param _cost The amount of reserve being deposited (ignored). * @return _success A boolean indicating whether or not the operation * succeeded. */ function _prepareDeposit(uint256 _cost) internal override returns (bool _success) { _cost; // silences warnings return drm.adjustReserve(0); } /** * @dev This method is overriden from GTokenBase and sets up the reserve * before a withdrawal comes along. It basically calculates the * the amount that will be left in the reserve, in terms of cToken * cost, and adjusts the collateralization accordingly. This * method uses the GCDelegatedReserveManager to adjust the reserve. * See GCDelegatedReserveManager.sol. * @param _cost The amount of reserve being withdrawn and that needs to * be immediately liquid. * @return _success A boolean indicating whether or not the operation succeeded. * The operation may fail if it is not possible to recover * the required liquidity (e.g. low liquidity in the markets). */ function _prepareWithdrawal(uint256 _cost) internal override returns (bool _success) { return drm.adjustReserve(GCFormulae._calcUnderlyingCostFromCost(_cost, GC.fetchExchangeRate(reserveToken))); } } // File: contracts/GEtherBridge.sol pragma solidity ^0.6.0; /** * @dev This contract serves as a useful bridge between ETH and the WETH * ERC-20 based gTokens. It accepts deposits/withdrawals in ETH performing * the wrapping/unwrapping behind the scenes. */ contract GEtherBridge { /** * @notice Accepts a deposit to the gToken using ETH. The gToken must * have WETH as its reserveToken. This is a payable method and * expects ETH to be sent; which in turn will be converted into * shares. See GToken.sol and GTokenBase.sol for further * documentation. * @param _growthToken The WETH based gToken. */ function deposit(address _growthToken) public payable { address _from = msg.sender; uint256 _cost = msg.value; address _reserveToken = GToken(_growthToken).reserveToken(); require(_reserveToken == $.WETH, "ETH operation not supported by token"); G.safeWrap(_cost); G.approveFunds(_reserveToken, _growthToken, _cost); GToken(_growthToken).deposit(_cost); uint256 _netShares = G.getBalance(_growthToken); G.pushFunds(_growthToken, _from, _netShares); } /** * @notice Accepts a withdrawal to the gToken using ETH. The gToken must * have WETH as its reserveToken. This method will redeem the * sender's required balance in shares; which in turn will receive * ETH. See GToken.sol and GTokenBase.sol for further documentation. * @param _growthToken The WETH based gToken. * @param _grossShares The number of shares to be redeemed. */ function withdraw(address _growthToken, uint256 _grossShares) public { address payable _from = msg.sender; address _reserveToken = GToken(_growthToken).reserveToken(); require(_reserveToken == $.WETH, "ETH operation not supported by token"); G.pullFunds(_reserveToken, _from, _grossShares); GToken(_growthToken).withdraw(_grossShares); uint256 _cost = G.getBalance(_reserveToken); G.safeUnwrap(_cost); _from.transfer(_cost); } /** * @notice Accepts a deposit to the gcToken using ETH. The gcToken must * have WETH as its underlyingToken. This is a payable method and * expects ETH to be sent; which in turn will be converted into * shares. See GCToken.sol and GCTokenBase.sol for further * documentation. * @param _growthToken The WETH based gcToken (e.g. gcETH). */ function depositUnderlying(address _growthToken) public payable { address _from = msg.sender; uint256 _underlyingCost = msg.value; address _underlyingToken = GCToken(_growthToken).underlyingToken(); require(_underlyingToken == $.WETH, "ETH operation not supported by token"); G.safeWrap(_underlyingCost); G.approveFunds(_underlyingToken, _growthToken, _underlyingCost); GCToken(_growthToken).depositUnderlying(_underlyingCost); uint256 _netShares = G.getBalance(_growthToken); G.pushFunds(_growthToken, _from, _netShares); } /** * @notice Accepts a withdrawal to the gcToken using ETH. The gcToken must * have WETH as its underlyingToken. This method will redeem the * sender's required balance in shares; which in turn will receive * ETH. See GCToken.sol and GCTokenBase.sol for further documentation. * @param _growthToken The WETH based gcToken (e.g. gcETH). * @param _grossShares The number of shares to be redeemed. */ function withdrawUnderlying(address _growthToken, uint256 _grossShares) public { address payable _from = msg.sender; address _underlyingToken = GCToken(_growthToken).underlyingToken(); require(_underlyingToken == $.WETH, "ETH operation not supported by token"); G.pullFunds(_growthToken, _from, _grossShares); GCToken(_growthToken).withdrawUnderlying(_grossShares); uint256 _underlyingCost = G.getBalance(_underlyingToken); G.safeUnwrap(_underlyingCost); _from.transfer(_underlyingCost); } receive() external payable {} // not to be used directly } // File: contracts/GTokens.sol pragma solidity ^0.6.0; /** * @notice Definition of gDAI. As a gToken Type 0, it uses DAI as reserve and * distributes to other gToken types. */ contract gDAI is GTokenType0 { constructor () GTokenType0("growth DAI", "gDAI", 18, $.GRO, $.DAI) public { } } /** * @notice Definition of gUSDC. As a gToken Type 0, it uses USDC as reserve and * distributes to other gToken types. */ contract gUSDC is GTokenType0 { constructor () GTokenType0("growth USDC", "gUSDC", 6, $.GRO, $.USDC) public { } } /** * @notice Definition of gETH. As a gToken Type 0, it uses WETH as reserve and * distributes to other gToken types. */ contract gETH is GTokenType0 { constructor () GTokenType0("growth ETH", "gETH", 18, $.GRO, $.WETH) public { } } /** * @notice Definition of gWBTC. As a gToken Type 0, it uses WBTC as reserve and * distributes to other gToken types. */ contract gWBTC is GTokenType0 { constructor () GTokenType0("growth WBTC", "gWBTC", 8, $.GRO, $.WBTC) public { } } /** * @notice Definition of gcDAI. As a gcToken Type 1, it uses cDAI as reserve * and employs leverage to maximize returns. */ contract gcDAI is GCTokenType1 { constructor () GCTokenType1("growth cDAI v2", "gcDAI", 8, $.GRO, $.cDAI, $.COMP) public { } } /** * @notice Definition of gcUSDC. As a gcToken Type 1, it uses cUSDC as reserve * and employs leverage to maximize returns. */ contract gcUSDC is GCTokenType1 { constructor () GCTokenType1("growth cUSDC v2", "gcUSDC", 8, $.GRO, $.cUSDC, $.COMP) public { } } /** * @notice Definition of gcETH. As a gcToken Type 2, it uses cETH as reserve * which serves as collateral for minting gDAI. */ contract gcETH is GCTokenType2 { constructor (address _growthToken) GCTokenType2("growth cETH", "gcETH", 8, $.GRO, $.cETH, $.COMP, $.cDAI, _growthToken) public { } receive() external payable {} // not to be used directly } /** * @notice Definition of gcWBTC. As a gcToken Type 2, it uses cWBTC as reserve * which serves as collateral for minting gDAI. */ contract gcWBTC is GCTokenType2 { constructor (address _growthToken) GCTokenType2("growth cWBTC", "gcWBTC", 8, $.GRO, $.cWBTC, $.COMP, $.cDAI, _growthToken) public { } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_stakesAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sharesAmount","type":"uint256"}],"name":"BurnLiquidityPoolPortion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_migrationRecipient","type":"address"}],"name":"CancelLiquidityPoolMigration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_migrationRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_stakesAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_sharesAmount","type":"uint256"}],"name":"CompleteLiquidityPoolMigration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_migrationRecipient","type":"address"}],"name":"InitiateLiquidityPoolMigration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":[{"internalType":"uint256","name":"_stakesAmount","type":"uint256"},{"internalType":"uint256","name":"_sharesAmount","type":"uint256"}],"name":"allocateLiquidityPool","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":[],"name":"borrowingReserveUnderlying","outputs":[{"internalType":"uint256","name":"_borrowingReserveUnderlying","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnLiquidityPoolPortion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcCostFromUnderlyingCost","outputs":[{"internalType":"uint256","name":"_cost","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_netShares","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_depositFee","type":"uint256"}],"name":"calcDepositCostFromShares","outputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_depositFee","type":"uint256"}],"name":"calcDepositSharesFromCost","outputs":[{"internalType":"uint256","name":"_netShares","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcDepositSharesFromUnderlyingCost","outputs":[{"internalType":"uint256","name":"_netShares","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_netShares","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcDepositUnderlyingCostFromShares","outputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcUnderlyingCostFromCost","outputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"}],"name":"calcWithdrawalCostFromShares","outputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"}],"name":"calcWithdrawalSharesFromCost","outputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcWithdrawalSharesFromUnderlyingCost","outputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"},{"internalType":"uint256","name":"_totalReserve","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"},{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"name":"calcWithdrawalUnderlyingCostFromShares","outputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"},{"internalType":"uint256","name":"_feeShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"number","type":"uint256"}],"internalType":"struct Account.Info","name":"_account","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"callFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelLiquidityPoolMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collateralizationRatio","outputs":[{"internalType":"uint256","name":"_collateralizationRatio","type":"uint256"},{"internalType":"uint256","name":"_collateralizationMargin","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"completeLiquidityPoolMigration","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":[{"internalType":"uint256","name":"_cost","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"_depositFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_underlyingCost","type":"uint256"}],"name":"depositUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchange","outputs":[{"internalType":"address","name":"_exchange","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"bytes","name":"_params","type":"bytes"}],"name":"executeOperation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"growthGulpRange","outputs":[{"internalType":"uint256","name":"_growthMinGulpAmount","type":"uint256"},{"internalType":"uint256","name":"_growthMaxGulpAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"growthToken","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"address","name":"_migrationRecipient","type":"address"}],"name":"initiateLiquidityPoolMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lendingReserveUnderlying","outputs":[{"internalType":"uint256","name":"_lendingReserveUnderlying","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPool","outputs":[{"internalType":"address","name":"_liquidityPool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPoolBurningRate","outputs":[{"internalType":"uint256","name":"_burningRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPoolLastBurningTime","outputs":[{"internalType":"uint256","name":"_lastBurningTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPoolMigrationRecipient","outputs":[{"internalType":"address","name":"_migrationRecipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPoolMigrationUnlockTime","outputs":[{"internalType":"uint256","name":"_migrationUnlockTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"miningGulpRange","outputs":[{"internalType":"uint256","name":"_miningMinGulpAmount","type":"uint256"},{"internalType":"uint256","name":"_miningMaxGulpAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"miningToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collateralizationRatio","type":"uint256"},{"internalType":"uint256","name":"_collateralizationMargin","type":"uint256"}],"name":"setCollateralizationRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_exchange","type":"address"}],"name":"setExchange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_growthMinGulpAmount","type":"uint256"},{"internalType":"uint256","name":"_growthMaxGulpAmount","type":"uint256"}],"name":"setGrowthGulpRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_burningRate","type":"uint256"}],"name":"setLiquidityPoolBurningRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_miningMinGulpAmount","type":"uint256"},{"internalType":"uint256","name":"_miningMaxGulpAmount","type":"uint256"}],"name":"setMiningGulpRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakesToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReserve","outputs":[{"internalType":"uint256","name":"_totalReserve","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReserveUnderlying","outputs":[{"internalType":"uint256","name":"_totalReserveUnderlying","type":"uint256"}],"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"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_grossShares","type":"uint256"}],"name":"withdrawUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalFee","outputs":[{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101206040526000600e553480156200001757600080fd5b506040518060400160405280600e81526020017f67726f77746820634441492076320000000000000000000000000000000000008152506040518060400160405280600581526020017f676344414900000000000000000000000000000000000000000000000000000081525060087309e64c2b61a5f1690ee6fbed9baf5d6990f8dfd0735d3a536e4d6dbd6114cc1ead35777bab948e364373c00e94cb662c3520282e6f5717214004a7f268888585858585856000868686868684848160039080519060200190620000ec929190620004b6565b50806004908051906020019062000105929190620004b6565b506012600560006101000a81548160ff021916908360ff16021790555050506000620001366200049060201b60201c565b905080600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3506001600681905550620001ee836200049860201b60201c565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b81525050600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c63785cdc58909184306040518463ffffffff1660e01b81526004016200029c93929190620005db565b60006040518083038186803b158015620002b557600080fd5b505af4158015620002ca573d6000803e3d6000fd5b5050505050505050508173ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff1660601b81525050600073a4afe5ef27a54f8b5345bb911a380b806175c42e63691bcc88856040518263ffffffff1660e01b81526004016200037c9190620005be565b60206040518083038186803b1580156200039557600080fd5b505af4158015620003aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003d0919062000573565b90508073ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff1660601b815250505050505050505050600f73f2ac73e0228002bf40559a0ed540c81b80e240bb63b1500d30909184846040518463ffffffff1660e01b8152600401620004529392919062000618565b60006040518083038186803b1580156200046b57600080fd5b505af415801562000480573d6000803e3d6000fd5b50505050505050505050620006a3565b600033905090565b80600560006101000a81548160ff021916908360ff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004f957805160ff19168380011785556200052a565b828001600101855582156200052a579182015b82811115620005295782518255916020019190600101906200050c565b5b5090506200053991906200053d565b5090565b5b80821115620005585760008160009055506001016200053e565b5090565b6000815190506200056d8162000689565b92915050565b6000602082840312156200058657600080fd5b600062000596848285016200055c565b91505092915050565b620005aa8162000655565b82525050565b8082525050565b8082525050565b6000602082019050620005d560008301846200059f565b92915050565b6000606082019050620005f26000830186620005b0565b6200060160208301856200059f565b6200061060408301846200059f565b949350505050565b60006060820190506200062f6000830186620005b7565b6200063e60208301856200059f565b6200064d60408301846200059f565b949350505050565b6000620006628262000669565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b620006948162000655565b8114620006a057600080fd5b50565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c615d676200073d60003980610fc952806111535280612ced5250806120b1525080611c77525080610e2a5280610f405280611302528061141852806115c05280612acf5280612d785280612e81528061318852806135205280613bac525080611db3528061258f52806128d752806144e55250615d676000f3fe608060405234801561001057600080fd5b50600436106103af5760003560e01c806382eb9fb2116101f4578063b6b55f251161011a578063e7d5f879116100ad578063f4325d671161007c578063f4325d6714610b36578063f496684314610b54578063f648af6714610b5e578063f98d98f714610b7a576103af565b8063e7d5f87914610aaf578063eb6f41c214610ae0578063ee87255814610afe578063f2fde38b14610b1a576103af565b8063d2f7265a116100e9578063d2f7265a14610a23578063dca1597614610a41578063dcaf9c4414610a60578063dd62ed3e14610a7f576103af565b8063b6b55f25146109b1578063b9f5be41146109cd578063bea69808146109e9578063cd08ae7b14610a07576103af565b806397f04e2511610192578063a682305011610161578063a68230501461093d578063a9059cbb1461095b578063ab9c7db51461098b578063ae42be3614610995576103af565b806397f04e251461089f57806399ae0858146108d0578063a207b3d5146108ee578063a457c2d71461090d576103af565b80638b418713116101ce5780638b418713146108295780638bc7e8c4146108455780638da5cb5b1461086357806395d89b4114610881576103af565b806382eb9fb2146107bf5780638359b782146107ef578063865c6bc11461080d576103af565b80634957c2bc116102d957806369cf7ac311610277578063715018a611610246578063715018a61461074857806376c445e21461075257806377d1d592146107835780637a131252146107a1576103af565b806369cf7ac3146106ae5780636be51698146106cc5780636f6e2156146106fc57806370a0823114610718576103af565b8063665a11ca116102b3578063665a11ca1461063a57806367a527931461065857806367b1f5df1461067657806367f339c914610692576103af565b80634957c2bc146105e15780634c68df67146106125780635514fc8b14610630576103af565b80632495a5991161035157806339509351116103205780633950935114610531578063397808f6146105615780633ba0b9a9146105925780633dc481ec146105b0576103af565b80632495a599146104bb5780632d870006146104d95780632e1a7d4d146104f7578063313ce56714610513576103af565b806309f038141161038d57806309f03814146104205780631071a2901461045157806318160ddd1461046d57806323b872dd1461048b576103af565b8063012abcd7146103b457806306fdde03146103d2578063095ea7b3146103f0575b600080fd5b6103bc610bab565b6040516103c99190615a29565b60405180910390f35b6103da610bb8565b6040516103e79190615677565b60405180910390f35b61040a60048036038101906104059190614ccf565b610c5a565b6040516104179190615625565b60405180910390f35b61043a60048036038101906104359190614f30565b610c78565b604051610448929190615a6d565b60405180910390f35b61046b60048036038101906104669190614e03565b610c96565b005b61047561106e565b6040516104829190615a29565b60405180910390f35b6104a560048036038101906104a09190614c19565b611078565b6040516104b29190615625565b60405180910390f35b6104c3611151565b6040516104d091906155aa565b60405180910390f35b6104e1611175565b6040516104ee9190615a29565b60405180910390f35b610511600480360381019061050c9190614e03565b611182565b005b61051b6114bc565b6040516105289190615a96565b60405180910390f35b61054b60048036038101906105469190614ccf565b6114d3565b6040516105589190615625565b60405180910390f35b61057b60048036038101906105769190614ecd565b611586565b604051610589929190615a6d565b60405180910390f35b61059a6115a2565b6040516105a79190615a29565b60405180910390f35b6105ca60048036038101906105c59190614f30565b611650565b6040516105d8929190615a6d565b60405180910390f35b6105fb60048036038101906105f69190614f30565b61166e565b604051610609929190615a6d565b60405180910390f35b61061a61168c565b6040516106279190615a29565b60405180910390f35b6106386116ab565b005b6106426118e2565b60405161064f91906155aa565b60405180910390f35b61066061190f565b60405161066d9190615a29565b60405180910390f35b610690600480360381019061068b9190614b10565b6119ba565b005b6106ac60048036038101906106a79190614e55565b611b16565b005b6106b6611c75565b6040516106c391906155aa565b60405180910390f35b6106e660048036038101906106e19190614e55565b611c99565b6040516106f39190615a29565b60405180910390f35b61071660048036038101906107119190614e55565b611cad565b005b610732600480360381019061072d9190614b10565b611ea8565b60405161073f9190615a29565b60405180910390f35b610750611ef0565b005b61076c60048036038101906107679190614f30565b612048565b60405161077a929190615a6d565b60405180910390f35b61078b612066565b6040516107989190615a29565b60405180910390f35b6107a961208e565b6040516107b69190615a29565b60405180910390f35b6107d960048036038101906107d49190614e55565b61209b565b6040516107e69190615a29565b60405180910390f35b6107f76120af565b60405161080491906155aa565b60405180910390f35b61082760048036038101906108229190614b10565b6120d3565b005b610843600480360381019061083e9190614c68565b612272565b005b61084d612400565b60405161085a9190615a29565b60405180910390f35b61086b6124a5565b60405161087891906155aa565b60405180910390f35b6108896124cf565b6040516108969190615677565b60405180910390f35b6108b960048036038101906108b49190614ecd565b612571565b6040516108c7929190615a6d565b60405180910390f35b6108d861258d565b6040516108e591906155aa565b60405180910390f35b6108f66125b1565b604051610904929190615a6d565b60405180910390f35b61092760048036038101906109229190614ccf565b6125bf565b6040516109349190615625565b60405180910390f35b61094561268c565b60405161095291906155aa565b60405180910390f35b61097560048036038101906109709190614ccf565b6126b9565b6040516109829190615625565b60405180910390f35b6109936126d7565b005b6109af60048036038101906109aa9190614e55565b6129ae565b005b6109cb60048036038101906109c69190614e03565b6129b2565b005b6109e760048036038101906109e29190614e03565b612bbb565b005b6109f1612e63565b6040516109fe9190615a29565b60405180910390f35b610a216004803603810190610a1c9190614e03565b612f11565b005b610a2b61306d565b604051610a3891906155aa565b60405180910390f35b610a4961309a565b604051610a57929190615a6d565b60405180910390f35b610a686130b1565b604051610a76929190615a6d565b60405180910390f35b610a996004803603810190610a949190614bdd565b6130c8565b604051610aa69190615a29565b60405180910390f35b610ac96004803603810190610ac49190614ecd565b61314f565b604051610ad7929190615a6d565b60405180910390f35b610ae861316b565b604051610af59190615a29565b60405180910390f35b610b186004803603810190610b139190614d5a565b613218565b005b610b346004803603810190610b2f9190614b10565b613357565b005b610b3e61351e565b604051610b4b91906155aa565b60405180910390f35b610b5c613542565b005b610b786004803603810190610b739190614e55565b613703565b005b610b946004803603810190610b8f9190614ecd565b613862565b604051610ba2929190615a6d565b60405180910390f35b6000600760040154905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c505780601f10610c2557610100808354040283529160200191610c50565b820191906000526020600020905b815481529060010190602001808311610c3357829003601f168201915b5050505050905090565b6000610c6e610c6761387e565b8484613886565b6001905092915050565b600080610c888787878787613a51565b915091509550959350505050565b60026006541415610cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd390615819565b60405180910390fd5b6002600681905550600033905060008211610d2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d23906156f9565b60405180910390fd5b600080610d5084610d3b61168c565b610d4361106e565b610d4b612400565b613a81565b915091506000610d6783610d626115a2565b613b23565b905060008111610dac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da390615839565b60405180910390fd5b610db583613b5a565b610df4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610deb906157f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce08637ae2b5c78273a4afe5ef27a54f8b5345bb911a380b806175c42e62177b3f7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610e65919061558f565b60206040518083038186803b158015610e7d57600080fd5b505af4158015610e91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb59190614e2c565b6040518363ffffffff1660e01b8152600401610ed2929190615a44565b60206040518083038186803b158015610eea57600080fd5b505af4158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f229190614e2c565b905073a4afe5ef27a54f8b5345bb911a380b806175c42e634ffa48cd7f0000000000000000000000000000000000000000000000000000000000000000836040518363ffffffff1660e01b8152600401610f7d9291906155fc565b60006040518083038186803b158015610f9557600080fd5b505af4158015610fa9573d6000803e3d6000fd5b50505050732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b8152600401611008939291906155c5565b60006040518083038186803b15801561102057600080fd5b505af4158015611034573d6000803e3d6000fd5b505050506110428486613cc3565b61105f3061105a600285613e7190919063ffffffff16565b613ebb565b50505050600160068190555050565b6000600254905090565b600061108584848461404f565b6111468461109161387e565b61114185604051806060016040528060288152602001615ce560289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006110f761387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b613886565b600190509392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600760030154905090565b600260065414156111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bf90615819565b60405180910390fd5b6002600681905550600033905060008211611218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120f906156f9565b60405180910390fd5b60008061123c8461122761168c565b61122f61106e565b611237612400565b613a81565b9150915060008211611283576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127a90615739565b60405180910390fd5b61128c82613b5a565b6112cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c2906157f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce08637ae2b5c783732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f8b2cb4f7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b815260040161133d919061558f565b60206040518083038186803b15801561135557600080fd5b505af4158015611369573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138d9190614e2c565b6040518363ffffffff1660e01b81526004016113aa929190615a44565b60206040518083038186803b1580156113c257600080fd5b505af41580156113d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fa9190614e2c565b9150732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f000000000000000000000000000000000000000000000000000000000000000085856040518463ffffffff1660e01b8152600401611457939291906155c5565b60006040518083038186803b15801561146f57600080fd5b505af4158015611483573d6000803e3d6000fd5b505050506114918385613cc3565b6114ae306114a9600284613e7190919063ffffffff16565b613ebb565b505050600160068190555050565b6000600560009054906101000a900460ff16905090565b600061157c6114e061387e565b8461157785600160006114f161387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b613886565b6001905092915050565b60008061159586868686614394565b9150915094509492505050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e63efb7601d7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016115fb919061558f565b60206040518083038186803b15801561161357600080fd5b505af4158015611627573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164b9190614e2c565b905090565b6000806116608787878787614436565b915091509550959350505050565b60008061167e8787878787614466565b915091509550959350505050565b60006116a6611699612066565b6116a16115a2565b614492565b905090565b6116b361387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173990615779565b60405180910390fd5b60026006541415611788576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177f90615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631a70d5d590916040518263ffffffff1660e01b81526004016117ca9190615879565b60006040518083038186803b1580156117e257600080fd5b505af41580156117f6573d6000803e3d6000fd5b50505050600080600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631b980af290916040518263ffffffff1660e01b81526004016118379190615879565b604080518083038186803b15801561184e57600080fd5b505af4158015611862573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118869190614e91565b91509150611893826144c9565b61189d3082613cc3565b7f5de3db43e9093f1849590792cc2d3e9cda3d767d7180190ca7937c59f234b7d782826040516118ce929190615a6d565b60405180910390a150506001600681905550565b6000600760020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c634571ca8a90916040518263ffffffff1660e01b815260040161194b9190615879565b60206040518083038186803b15801561196357600080fd5b505af4158015611977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199b9190614dda565b6119ac57662386f26fc100006119b5565b66470de4df8200005b905090565b6119c261387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4890615779565b60405180910390fd5b60026006541415611a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8e90615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb632b0d7c8e9091836040518363ffffffff1660e01b8152600401611adb92919061591d565b60006040518083038186803b158015611af357600080fd5b505af4158015611b07573d6000803e3d6000fd5b50505050600160068190555050565b611b1e61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611bad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba490615779565b60405180910390fd5b60026006541415611bf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bea90615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631d63d195909184846040518463ffffffff1660e01b8152600401611c39939291906159f2565b60006040518083038186803b158015611c5157600080fd5b505af4158015611c65573d6000803e3d6000fd5b5050505060016006819055505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000611ca58383614492565b905092915050565b611cb561387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3b90615779565b60405180910390fd5b60026006541415611d8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8190615819565b60405180910390fd5b60026006819055506000339050732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f000000000000000000000000000000000000000000000000000000000000000083866040518463ffffffff1660e01b8152600401611df2939291906155c5565b60006040518083038186803b158015611e0a57600080fd5b505af4158015611e1e573d6000803e3d6000fd5b50505050611e2d81308461404f565b600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c63b2f9dd74909185856040518463ffffffff1660e01b8152600401611e6b939291906158e6565b60006040518083038186803b158015611e8357600080fd5b505af4158015611e97573d6000803e3d6000fd5b505050505060016006819055505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611ef861387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7e90615779565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600080612058878787878761456b565b915091509550959350505050565b6000612089612073612e63565b61207b61316b565b61459790919063ffffffff16565b905090565b6000600760060154905090565b60006120a78383613b23565b905092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6120db61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190615779565b60405180910390fd5b600260065414156121b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a790615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c635de508599091836040518363ffffffff1660e01b81526004016121f4929190615894565b60006040518083038186803b15801561220c57600080fd5b505af4158015612220573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff167f2da3691fd2703bfd89093c0616be6ea99148d085f6236cda85ffc3af9071b00660405160405180910390a2600160068190555050565b6000600e541161227e57fe5b60003390506000731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e90508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146122d157fe5b3073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461230657fe5b3073ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff161461233f57fe5b600080600060608680602001905181019061235a9190614b62565b935093509350935061236e848484846145e1565b61237757600080fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f1b393f16001866123a7868861433f90919063ffffffff16565b6040518463ffffffff1660e01b81526004016123c593929190615640565b60006040518083038186803b1580156123dd57600080fd5b505af41580156123f1573d6000803e3d6000fd5b50505050505050505050505050565b6000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c634571ca8a90916040518263ffffffff1660e01b815260040161243c9190615879565b60206040518083038186803b15801561245457600080fd5b505af4158015612468573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248c9190614dda565b61249d57662386f26fc100006124a0565b60005b905090565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156125675780601f1061253c57610100808354040283529160200191612567565b820191906000526020600020905b81548152906001019060200180831161254a57829003601f168201915b5050505050905090565b60008061258086868686613a81565b9150915094509492505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600080915091509091565b60006126826125cc61387e565b8461267d85604051806060016040528060258152602001615d0d60259139600160006125f661387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b613886565b6001905092915050565b6000600760050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006126cd6126c661387e565b848461404f565b6001905092915050565b6126df61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590615779565b60405180910390fd5b600260065414156127b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ab90615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631a70d5d590916040518263ffffffff1660e01b81526004016127f69190615879565b60006040518083038186803b15801561280e57600080fd5b505af4158015612822573d6000803e3d6000fd5b505050506000806000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c63fc3b6efd90916040518263ffffffff1660e01b81526004016128659190615879565b60606040518083038186803b15801561287d57600080fd5b505af4158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b59190614d0b565b925092509250732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f000000000000000000000000000000000000000000000000000000000000000085856040518463ffffffff1660e01b8152600401612916939291906155c5565b60006040518083038186803b15801561292e57600080fd5b505af4158015612942573d6000803e3d6000fd5b5050505061295130848361404f565b8273ffffffffffffffffffffffffffffffffffffffff167f32ff16b7e2d85978fd6c5c010a46b09c8cd011cc35fd2c69c214f9f188756b608383604051612999929190615a6d565b60405180910390a25050506001600681905550565b5050565b600260065414156129f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ef90615819565b60405180910390fd5b6002600681905550600033905060008211612a48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a3f90615739565b60405180910390fd5b600080612a6c84612a5761168c565b612a5f61106e565b612a6761190f565b61467f565b9150915060008211612ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aaa906156f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f000000000000000000000000000000000000000000000000000000000000000085876040518463ffffffff1660e01b8152600401612b0e939291906155c5565b60006040518083038186803b158015612b2657600080fd5b505af4158015612b3a573d6000803e3d6000fd5b50505050612b4784614721565b612b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7d906157f9565b60405180910390fd5b612b908383613ebb565b612bad30612ba8600284613e7190919063ffffffff16565b613ebb565b505050600160068190555050565b60026006541415612c01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bf890615819565b60405180910390fd5b6002600681905550600033905060008211612c51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c4890615839565b60405180910390fd5b6000612c6483612c5f6115a2565b614492565b9050600080612c8a83612c7561168c565b612c7d61106e565b612c8561190f565b61467f565b9150915060008211612cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc8906156f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f000000000000000000000000000000000000000000000000000000000000000086886040518463ffffffff1660e01b8152600401612d2c939291906155c5565b60006040518083038186803b158015612d4457600080fd5b505af4158015612d58573d6000803e3d6000fd5b5050505073a4afe5ef27a54f8b5345bb911a380b806175c42e632451c2837f0000000000000000000000000000000000000000000000000000000000000000876040518363ffffffff1660e01b8152600401612db59291906155fc565b60006040518083038186803b158015612dcd57600080fd5b505af4158015612de1573d6000803e3d6000fd5b50505050612dee83614721565b612e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e24906157f9565b60405180910390fd5b612e378483613ebb565b612e5430612e4f600284613e7190919063ffffffff16565b613ebb565b50505050600160068190555050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e636df1e2b87f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401612ebc919061558f565b60206040518083038186803b158015612ed457600080fd5b505af4158015612ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0c9190614e2c565b905090565b612f1961387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f9f90615779565b60405180910390fd5b60026006541415612fee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fe590615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c632fc518b29091836040518363ffffffff1660e01b81526004016130329291906158bd565b60006040518083038186803b15801561304a57600080fd5b505af415801561305e573d6000803e3d6000fd5b50505050600160068190555050565b6000600f60020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600f60040154600f60050154915091509091565b600080600f60060154600f60070154915091509091565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008061315e868686866147dc565b9150915094509492505050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e62177b3f7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016131c3919061558f565b60206040518083038186803b1580156131db57600080fd5b505af41580156131ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132139190614e2c565b905090565b6000600e541161322457fe5b6000339050600073398ec7346dcd622edc5ae82352f02be94c62d11990508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461327757fe5b6132c787878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506145e1565b6132d057600080fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f1b393f1600089613300898b61433f90919063ffffffff16565b6040518463ffffffff1660e01b815260040161331e93929190615640565b60006040518083038186803b15801561333657600080fd5b505af415801561334a573d6000803e3d6000fd5b5050505050505050505050565b61335f61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146133ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133e590615779565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561345e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613455906156b9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b61354a61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146135d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135d090615779565b60405180910390fd5b6002600654141561361f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161361690615819565b60405180910390fd5b60026006819055506000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c630eaced8190916040518263ffffffff1660e01b81526004016136639190615879565b60206040518083038186803b15801561367b57600080fd5b505af415801561368f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136b39190614b39565b90508073ffffffffffffffffffffffffffffffffffffffff167f2d38b612ec22e51eb40a71fe7d58e1a7ebb9989673619ae9f96cc0da907773d360405160405180910390a2506001600681905550565b61370b61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461379a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161379190615779565b60405180910390fd5b600260065414156137e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137d790615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb63b4e46dce909184846040518463ffffffff1660e01b8152600401613826939291906159f2565b60006040518083038186803b15801561383e57600080fd5b505af4158015613852573d6000803e3d6000fd5b5050505060016006819055505050565b6000806138718686868661467f565b9150915094509492505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156138f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ed906157d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161395d906156d9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051613a449190615a29565b60405180910390a3505050565b6000806000613a6288888888613a81565b8093508192505050613a748185613b23565b9250509550959350505050565b6000806000613acd670de0b6b3a7640000613abf613ab087670de0b6b3a764000061459790919063ffffffff16565b8a61487e90919063ffffffff16565b613e7190919063ffffffff16565b9050848114613b0057613afb85613aed888461487e90919063ffffffff16565b613e7190919063ffffffff16565b613b02565b855b9250613b17818861459790919063ffffffff16565b91505094509492505050565b6000613b52670de0b6b3a7640000613b44848661487e90919063ffffffff16565b613e7190919063ffffffff16565b905092915050565b6000600e60008154809291906001019190505550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631f4fd96e9091613c3c8573a4afe5ef27a54f8b5345bb911a380b806175c42e633ff443b87f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401613be7919061558f565b60206040518083038186803b158015613bff57600080fd5b505af4158015613c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c379190614e2c565b613b23565b6040518363ffffffff1660e01b8152600401613c599291906159c9565b60206040518083038186803b158015613c7157600080fd5b505af4158015613c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ca99190614dda565b9050600e6000815480929190600190039190505550919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d2a90615799565b60405180910390fd5b613d3f826000836148ee565b613daa81604051806060016040528060228152602001615c9d602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613e018160025461459790919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613e659190615a29565b60405180910390a35050565b6000613eb383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506148f3565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f2290615859565b60405180910390fd5b613f37600083836148ee565b613f4c8160025461433f90919063ffffffff16565b600281905550613fa3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516140439190615a29565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156140bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016140b6906157b9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561412f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161412690615699565b60405180910390fd5b61413a8383836148ee565b6141a581604051806060016040528060268152602001615cbf602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614238816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516142d79190615a29565b60405180910390a3505050565b600083831115829061432c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016143239190615677565b60405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561438a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161438190615719565b60405180910390fd5b8091505092915050565b60008060008587146143ca576143c5866143b7878a61487e90919063ffffffff16565b613e7190919063ffffffff16565b6143cc565b845b90506144156143ec85670de0b6b3a764000061459790919063ffffffff16565b614407670de0b6b3a76400008461487e90919063ffffffff16565b613e7190919063ffffffff16565b925061442a818461459790919063ffffffff16565b91505094509492505050565b6000806000614447888888886147dc565b80935081925050506144598185613b23565b9250509550959350505050565b60008060006144758885614492565b905061448381888888614394565b92509250509550959350505050565b60006144c1826144b3670de0b6b3a76400008661487e90919063ffffffff16565b613e7190919063ffffffff16565b905092915050565b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f000000000000000000000000000000000000000000000000000000000000000073d93f98b483cc2f9efe512696df8f5decb73f9497846040518463ffffffff1660e01b8152600401614538939291906155c5565b60006040518083038186803b15801561455057600080fd5b505af4158015614564573d6000803e3d6000fd5b5050505050565b600080600061457a8885614492565b90506145888188888861467f565b92509250509550959350505050565b60006145d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506142e4565b905092915050565b6000600f73f2ac73e0228002bf40559a0ed540c81b80e240bb6329480b0c9091878787876040518663ffffffff1660e01b8152600401614625959493929190615946565b60206040518083038186803b15801561463d57600080fd5b505af4158015614651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146759190614dda565b9050949350505050565b60008060008585146146b5576146b0866146a2878a61487e90919063ffffffff16565b613e7190919063ffffffff16565b6146b7565b865b9050614700670de0b6b3a76400006146f26146e387670de0b6b3a764000061459790919063ffffffff16565b8461487e90919063ffffffff16565b613e7190919063ffffffff16565b9250614715838261459790919063ffffffff16565b91505094509492505050565b6000600e60008154809291906001019190505550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631f4fd96e909160006040518363ffffffff1660e01b81526004016147729291906159a0565b60206040518083038186803b15801561478a57600080fd5b505af415801561479e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c29190614dda565b9050600e6000815480929190600190039190505550919050565b60008060006148286147ff85670de0b6b3a764000061459790919063ffffffff16565b61481a670de0b6b3a76400008a61487e90919063ffffffff16565b613e7190919063ffffffff16565b905084861461485b5761485685614848888461487e90919063ffffffff16565b613e7190919063ffffffff16565b61485d565b805b9250614872878261459790919063ffffffff16565b91505094509492505050565b60008083141561489157600090506148e8565b60008284029050828482816148a257fe5b04146148e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016148da90615759565b60405180910390fd5b809150505b92915050565b505050565b6000808311829061493a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016149319190615677565b60405180910390fd5b50600083858161494657fe5b049050809150509392505050565b60008135905061496381615c40565b92915050565b60008151905061497881615c40565b92915050565b60008151905061498d81615c57565b92915050565b6000815190506149a281615c6e565b92915050565b60008083601f8401126149ba57600080fd5b8235905067ffffffffffffffff8111156149d357600080fd5b6020830191508360018202830111156149eb57600080fd5b9250929050565b600082601f830112614a0357600080fd5b8135614a16614a1182615ade565b615ab1565b91508082526020830160208301858383011115614a3257600080fd5b614a3d838284615be0565b50505092915050565b600082601f830112614a5757600080fd5b8151614a6a614a6582615ade565b615ab1565b91508082526020830160208301858383011115614a8657600080fd5b614a91838284615bef565b50505092915050565b600060408284031215614aac57600080fd5b614ab66040615ab1565b90506000614ac684828501614954565b6000830152506020614ada84828501614ae6565b60208301525092915050565b600081359050614af581615c85565b92915050565b600081519050614b0a81615c85565b92915050565b600060208284031215614b2257600080fd5b6000614b3084828501614954565b91505092915050565b600060208284031215614b4b57600080fd5b6000614b5984828501614969565b91505092915050565b60008060008060808587031215614b7857600080fd5b6000614b868782880161497e565b9450506020614b9787828801614afb565b9350506040614ba887828801614afb565b925050606085015167ffffffffffffffff811115614bc557600080fd5b614bd187828801614a46565b91505092959194509250565b60008060408385031215614bf057600080fd5b6000614bfe85828601614954565b9250506020614c0f85828601614954565b9150509250929050565b600080600060608486031215614c2e57600080fd5b6000614c3c86828701614954565b9350506020614c4d86828701614954565b9250506040614c5e86828701614ae6565b9150509250925092565b600080600060808486031215614c7d57600080fd5b6000614c8b86828701614954565b9350506020614c9c86828701614a9a565b925050606084013567ffffffffffffffff811115614cb957600080fd5b614cc5868287016149f2565b9150509250925092565b60008060408385031215614ce257600080fd5b6000614cf085828601614954565b9250506020614d0185828601614ae6565b9150509250929050565b600080600060608486031215614d2057600080fd5b6000614d2e86828701614969565b9350506020614d3f86828701614afb565b9250506040614d5086828701614afb565b9150509250925092565b600080600080600060808688031215614d7257600080fd5b6000614d8088828901614954565b9550506020614d9188828901614ae6565b9450506040614da288828901614ae6565b935050606086013567ffffffffffffffff811115614dbf57600080fd5b614dcb888289016149a8565b92509250509295509295909350565b600060208284031215614dec57600080fd5b6000614dfa84828501614993565b91505092915050565b600060208284031215614e1557600080fd5b6000614e2384828501614ae6565b91505092915050565b600060208284031215614e3e57600080fd5b6000614e4c84828501614afb565b91505092915050565b60008060408385031215614e6857600080fd5b6000614e7685828601614ae6565b9250506020614e8785828601614ae6565b9150509250929050565b60008060408385031215614ea457600080fd5b6000614eb285828601614afb565b9250506020614ec385828601614afb565b9150509250929050565b60008060008060808587031215614ee357600080fd5b6000614ef187828801614ae6565b9450506020614f0287828801614ae6565b9350506040614f1387828801614ae6565b9250506060614f2487828801614ae6565b91505092959194509250565b600080600080600060a08688031215614f4857600080fd5b6000614f5688828901614ae6565b9550506020614f6788828901614ae6565b9450506040614f7888828901614ae6565b9350506060614f8988828901614ae6565b9250506080614f9a88828901614ae6565b9150509295509295909350565b614fb081615b42565b82525050565b614fbf81615b42565b82525050565b614fce81615b66565b82525050565b6000614fdf82615b0a565b614fe98185615b20565b9350614ff9818560208601615bef565b61500281615c22565b840191505092915050565b61501681615bbc565b82525050565b61502581615bce565b82525050565b600061503682615b15565b6150408185615b31565b9350615050818560208601615bef565b61505981615c22565b840191505092915050565b6000615071602383615b31565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006150d7602683615b31565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061513d602283615b31565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006151a3601d83615b31565b91507f736861726573206d7573742062652067726561746572207468616e20300000006000830152602082019050919050565b60006151e3601b83615b31565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000615223601b83615b31565b91507f636f7374206d7573742062652067726561746572207468616e203000000000006000830152602082019050919050565b6000615263602183615b31565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006152c9602083615b31565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000615309602183615b31565b91507f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061536f602583615b31565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006153d5602483615b31565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061543b601b83615b31565b91507f6e6f7420617661696c61626c6520617420746865206d6f6d656e7400000000006000830152602082019050919050565b600061547b601f83615b31565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b60006154bb602683615b31565b91507f756e6465726c79696e6720636f7374206d75737420626520677265617465722060008301527f7468616e203000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000615521601f83615b31565b91507f45524332303a206d696e7420746f20746865207a65726f2061646472657373006000830152602082019050919050565b8082525050565b8082525050565b61556b81615ba5565b82525050565b61557a81615ba5565b82525050565b61558981615baf565b82525050565b60006020820190506155a46000830184614fb6565b92915050565b60006020820190506155bf6000830184614fa7565b92915050565b60006060820190506155da6000830186614fb6565b6155e76020830185614fb6565b6155f46040830184615571565b949350505050565b60006040820190506156116000830185614fb6565b61561e6020830184615571565b9392505050565b600060208201905061563a6000830184614fc5565b92915050565b6000606082019050615655600083018661500d565b6156626020830185614fb6565b61566f6040830184615571565b949350505050565b60006020820190508181036000830152615691818461502b565b905092915050565b600060208201905081810360008301526156b281615064565b9050919050565b600060208201905081810360008301526156d2816150ca565b9050919050565b600060208201905081810360008301526156f281615130565b9050919050565b6000602082019050818103600083015261571281615196565b9050919050565b60006020820190508181036000830152615732816151d6565b9050919050565b6000602082019050818103600083015261575281615216565b9050919050565b6000602082019050818103600083015261577281615256565b9050919050565b60006020820190508181036000830152615792816152bc565b9050919050565b600060208201905081810360008301526157b2816152fc565b9050919050565b600060208201905081810360008301526157d281615362565b9050919050565b600060208201905081810360008301526157f2816153c8565b9050919050565b600060208201905081810360008301526158128161542e565b9050919050565b600060208201905081810360008301526158328161546e565b9050919050565b60006020820190508181036000830152615852816154ae565b9050919050565b6000602082019050818103600083015261587281615514565b9050919050565b600060208201905061588e6000830184615554565b92915050565b60006040820190506158a96000830185615554565b6158b66020830184614fb6565b9392505050565b60006040820190506158d26000830185615554565b6158df6020830184615571565b9392505050565b60006060820190506158fb6000830186615554565b6159086020830185615571565b6159156040830184615571565b949350505050565b6000604082019050615932600083018561555b565b61593f6020830184614fb6565b9392505050565b600060a08201905061595b600083018861555b565b6159686020830187614fb6565b6159756040830186615571565b6159826060830185615571565b81810360808301526159948184614fd4565b90509695505050505050565b60006040820190506159b5600083018561555b565b6159c2602083018461501c565b9392505050565b60006040820190506159de600083018561555b565b6159eb6020830184615571565b9392505050565b6000606082019050615a07600083018661555b565b615a146020830185615571565b615a216040830184615571565b949350505050565b6000602082019050615a3e6000830184615562565b92915050565b6000604082019050615a596000830185615571565b615a666020830184615571565b9392505050565b6000604082019050615a826000830185615562565b615a8f6020830184615562565b9392505050565b6000602082019050615aab6000830184615580565b92915050565b6000604051905081810181811067ffffffffffffffff82111715615ad457600080fd5b8060405250919050565b600067ffffffffffffffff821115615af557600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000615b4d82615b85565b9050919050565b6000615b5f82615b85565b9050919050565b60008115159050919050565b6000819050615b8082615c33565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000615bc782615b72565b9050919050565b6000615bd982615ba5565b9050919050565b82818337600083830152505050565b60005b83811015615c0d578082015181840152602081019050615bf2565b83811115615c1c576000848401525b50505050565b6000601f19601f8301169050919050565b60028110615c3d57fe5b50565b615c4981615b42565b8114615c5457600080fd5b50565b615c6081615b54565b8114615c6b57600080fd5b50565b615c7781615b66565b8114615c8257600080fd5b50565b615c8e81615ba5565b8114615c9957600080fd5b5056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ed9b8ae9a6178013b2cf6f36b5149ac1d20315d1975778db56f1bfd461e4550564736f6c634300060c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103af5760003560e01c806382eb9fb2116101f4578063b6b55f251161011a578063e7d5f879116100ad578063f4325d671161007c578063f4325d6714610b36578063f496684314610b54578063f648af6714610b5e578063f98d98f714610b7a576103af565b8063e7d5f87914610aaf578063eb6f41c214610ae0578063ee87255814610afe578063f2fde38b14610b1a576103af565b8063d2f7265a116100e9578063d2f7265a14610a23578063dca1597614610a41578063dcaf9c4414610a60578063dd62ed3e14610a7f576103af565b8063b6b55f25146109b1578063b9f5be41146109cd578063bea69808146109e9578063cd08ae7b14610a07576103af565b806397f04e2511610192578063a682305011610161578063a68230501461093d578063a9059cbb1461095b578063ab9c7db51461098b578063ae42be3614610995576103af565b806397f04e251461089f57806399ae0858146108d0578063a207b3d5146108ee578063a457c2d71461090d576103af565b80638b418713116101ce5780638b418713146108295780638bc7e8c4146108455780638da5cb5b1461086357806395d89b4114610881576103af565b806382eb9fb2146107bf5780638359b782146107ef578063865c6bc11461080d576103af565b80634957c2bc116102d957806369cf7ac311610277578063715018a611610246578063715018a61461074857806376c445e21461075257806377d1d592146107835780637a131252146107a1576103af565b806369cf7ac3146106ae5780636be51698146106cc5780636f6e2156146106fc57806370a0823114610718576103af565b8063665a11ca116102b3578063665a11ca1461063a57806367a527931461065857806367b1f5df1461067657806367f339c914610692576103af565b80634957c2bc146105e15780634c68df67146106125780635514fc8b14610630576103af565b80632495a5991161035157806339509351116103205780633950935114610531578063397808f6146105615780633ba0b9a9146105925780633dc481ec146105b0576103af565b80632495a599146104bb5780632d870006146104d95780632e1a7d4d146104f7578063313ce56714610513576103af565b806309f038141161038d57806309f03814146104205780631071a2901461045157806318160ddd1461046d57806323b872dd1461048b576103af565b8063012abcd7146103b457806306fdde03146103d2578063095ea7b3146103f0575b600080fd5b6103bc610bab565b6040516103c99190615a29565b60405180910390f35b6103da610bb8565b6040516103e79190615677565b60405180910390f35b61040a60048036038101906104059190614ccf565b610c5a565b6040516104179190615625565b60405180910390f35b61043a60048036038101906104359190614f30565b610c78565b604051610448929190615a6d565b60405180910390f35b61046b60048036038101906104669190614e03565b610c96565b005b61047561106e565b6040516104829190615a29565b60405180910390f35b6104a560048036038101906104a09190614c19565b611078565b6040516104b29190615625565b60405180910390f35b6104c3611151565b6040516104d091906155aa565b60405180910390f35b6104e1611175565b6040516104ee9190615a29565b60405180910390f35b610511600480360381019061050c9190614e03565b611182565b005b61051b6114bc565b6040516105289190615a96565b60405180910390f35b61054b60048036038101906105469190614ccf565b6114d3565b6040516105589190615625565b60405180910390f35b61057b60048036038101906105769190614ecd565b611586565b604051610589929190615a6d565b60405180910390f35b61059a6115a2565b6040516105a79190615a29565b60405180910390f35b6105ca60048036038101906105c59190614f30565b611650565b6040516105d8929190615a6d565b60405180910390f35b6105fb60048036038101906105f69190614f30565b61166e565b604051610609929190615a6d565b60405180910390f35b61061a61168c565b6040516106279190615a29565b60405180910390f35b6106386116ab565b005b6106426118e2565b60405161064f91906155aa565b60405180910390f35b61066061190f565b60405161066d9190615a29565b60405180910390f35b610690600480360381019061068b9190614b10565b6119ba565b005b6106ac60048036038101906106a79190614e55565b611b16565b005b6106b6611c75565b6040516106c391906155aa565b60405180910390f35b6106e660048036038101906106e19190614e55565b611c99565b6040516106f39190615a29565b60405180910390f35b61071660048036038101906107119190614e55565b611cad565b005b610732600480360381019061072d9190614b10565b611ea8565b60405161073f9190615a29565b60405180910390f35b610750611ef0565b005b61076c60048036038101906107679190614f30565b612048565b60405161077a929190615a6d565b60405180910390f35b61078b612066565b6040516107989190615a29565b60405180910390f35b6107a961208e565b6040516107b69190615a29565b60405180910390f35b6107d960048036038101906107d49190614e55565b61209b565b6040516107e69190615a29565b60405180910390f35b6107f76120af565b60405161080491906155aa565b60405180910390f35b61082760048036038101906108229190614b10565b6120d3565b005b610843600480360381019061083e9190614c68565b612272565b005b61084d612400565b60405161085a9190615a29565b60405180910390f35b61086b6124a5565b60405161087891906155aa565b60405180910390f35b6108896124cf565b6040516108969190615677565b60405180910390f35b6108b960048036038101906108b49190614ecd565b612571565b6040516108c7929190615a6d565b60405180910390f35b6108d861258d565b6040516108e591906155aa565b60405180910390f35b6108f66125b1565b604051610904929190615a6d565b60405180910390f35b61092760048036038101906109229190614ccf565b6125bf565b6040516109349190615625565b60405180910390f35b61094561268c565b60405161095291906155aa565b60405180910390f35b61097560048036038101906109709190614ccf565b6126b9565b6040516109829190615625565b60405180910390f35b6109936126d7565b005b6109af60048036038101906109aa9190614e55565b6129ae565b005b6109cb60048036038101906109c69190614e03565b6129b2565b005b6109e760048036038101906109e29190614e03565b612bbb565b005b6109f1612e63565b6040516109fe9190615a29565b60405180910390f35b610a216004803603810190610a1c9190614e03565b612f11565b005b610a2b61306d565b604051610a3891906155aa565b60405180910390f35b610a4961309a565b604051610a57929190615a6d565b60405180910390f35b610a686130b1565b604051610a76929190615a6d565b60405180910390f35b610a996004803603810190610a949190614bdd565b6130c8565b604051610aa69190615a29565b60405180910390f35b610ac96004803603810190610ac49190614ecd565b61314f565b604051610ad7929190615a6d565b60405180910390f35b610ae861316b565b604051610af59190615a29565b60405180910390f35b610b186004803603810190610b139190614d5a565b613218565b005b610b346004803603810190610b2f9190614b10565b613357565b005b610b3e61351e565b604051610b4b91906155aa565b60405180910390f35b610b5c613542565b005b610b786004803603810190610b739190614e55565b613703565b005b610b946004803603810190610b8f9190614ecd565b613862565b604051610ba2929190615a6d565b60405180910390f35b6000600760040154905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c505780601f10610c2557610100808354040283529160200191610c50565b820191906000526020600020905b815481529060010190602001808311610c3357829003601f168201915b5050505050905090565b6000610c6e610c6761387e565b8484613886565b6001905092915050565b600080610c888787878787613a51565b915091509550959350505050565b60026006541415610cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd390615819565b60405180910390fd5b6002600681905550600033905060008211610d2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d23906156f9565b60405180910390fd5b600080610d5084610d3b61168c565b610d4361106e565b610d4b612400565b613a81565b915091506000610d6783610d626115a2565b613b23565b905060008111610dac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da390615839565b60405180910390fd5b610db583613b5a565b610df4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610deb906157f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce08637ae2b5c78273a4afe5ef27a54f8b5345bb911a380b806175c42e62177b3f7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b8152600401610e65919061558f565b60206040518083038186803b158015610e7d57600080fd5b505af4158015610e91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb59190614e2c565b6040518363ffffffff1660e01b8152600401610ed2929190615a44565b60206040518083038186803b158015610eea57600080fd5b505af4158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f229190614e2c565b905073a4afe5ef27a54f8b5345bb911a380b806175c42e634ffa48cd7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e3643836040518363ffffffff1660e01b8152600401610f7d9291906155fc565b60006040518083038186803b158015610f9557600080fd5b505af4158015610fa9573d6000803e3d6000fd5b50505050732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f86846040518463ffffffff1660e01b8152600401611008939291906155c5565b60006040518083038186803b15801561102057600080fd5b505af4158015611034573d6000803e3d6000fd5b505050506110428486613cc3565b61105f3061105a600285613e7190919063ffffffff16565b613ebb565b50505050600160068190555050565b6000600254905090565b600061108584848461404f565b6111468461109161387e565b61114185604051806060016040528060288152602001615ce560289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006110f761387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b613886565b600190509392505050565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b6000600760030154905090565b600260065414156111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bf90615819565b60405180910390fd5b6002600681905550600033905060008211611218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120f906156f9565b60405180910390fd5b60008061123c8461122761168c565b61122f61106e565b611237612400565b613a81565b9150915060008211611283576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127a90615739565b60405180910390fd5b61128c82613b5a565b6112cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c2906157f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce08637ae2b5c783732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f8b2cb4f7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b815260040161133d919061558f565b60206040518083038186803b15801561135557600080fd5b505af4158015611369573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138d9190614e2c565b6040518363ffffffff1660e01b81526004016113aa929190615a44565b60206040518083038186803b1580156113c257600080fd5b505af41580156113d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fa9190614e2c565b9150732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e364385856040518463ffffffff1660e01b8152600401611457939291906155c5565b60006040518083038186803b15801561146f57600080fd5b505af4158015611483573d6000803e3d6000fd5b505050506114918385613cc3565b6114ae306114a9600284613e7190919063ffffffff16565b613ebb565b505050600160068190555050565b6000600560009054906101000a900460ff16905090565b600061157c6114e061387e565b8461157785600160006114f161387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b613886565b6001905092915050565b60008061159586868686614394565b9150915094509492505050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e63efb7601d7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b81526004016115fb919061558f565b60206040518083038186803b15801561161357600080fd5b505af4158015611627573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164b9190614e2c565b905090565b6000806116608787878787614436565b915091509550959350505050565b60008061167e8787878787614466565b915091509550959350505050565b60006116a6611699612066565b6116a16115a2565b614492565b905090565b6116b361387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173990615779565b60405180910390fd5b60026006541415611788576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177f90615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631a70d5d590916040518263ffffffff1660e01b81526004016117ca9190615879565b60006040518083038186803b1580156117e257600080fd5b505af41580156117f6573d6000803e3d6000fd5b50505050600080600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631b980af290916040518263ffffffff1660e01b81526004016118379190615879565b604080518083038186803b15801561184e57600080fd5b505af4158015611862573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118869190614e91565b91509150611893826144c9565b61189d3082613cc3565b7f5de3db43e9093f1849590792cc2d3e9cda3d767d7180190ca7937c59f234b7d782826040516118ce929190615a6d565b60405180910390a150506001600681905550565b6000600760020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c634571ca8a90916040518263ffffffff1660e01b815260040161194b9190615879565b60206040518083038186803b15801561196357600080fd5b505af4158015611977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199b9190614dda565b6119ac57662386f26fc100006119b5565b66470de4df8200005b905090565b6119c261387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4890615779565b60405180910390fd5b60026006541415611a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8e90615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb632b0d7c8e9091836040518363ffffffff1660e01b8152600401611adb92919061591d565b60006040518083038186803b158015611af357600080fd5b505af4158015611b07573d6000803e3d6000fd5b50505050600160068190555050565b611b1e61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611bad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba490615779565b60405180910390fd5b60026006541415611bf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bea90615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631d63d195909184846040518463ffffffff1660e01b8152600401611c39939291906159f2565b60006040518083038186803b158015611c5157600080fd5b505af4158015611c65573d6000803e3d6000fd5b5050505060016006819055505050565b7f000000000000000000000000c00e94cb662c3520282e6f5717214004a7f2688881565b6000611ca58383614492565b905092915050565b611cb561387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3b90615779565b60405180910390fd5b60026006541415611d8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8190615819565b60405180910390fd5b60026006819055506000339050732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f00000000000000000000000009e64c2b61a5f1690ee6fbed9baf5d6990f8dfd083866040518463ffffffff1660e01b8152600401611df2939291906155c5565b60006040518083038186803b158015611e0a57600080fd5b505af4158015611e1e573d6000803e3d6000fd5b50505050611e2d81308461404f565b600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c63b2f9dd74909185856040518463ffffffff1660e01b8152600401611e6b939291906158e6565b60006040518083038186803b158015611e8357600080fd5b505af4158015611e97573d6000803e3d6000fd5b505050505060016006819055505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611ef861387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7e90615779565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600080612058878787878761456b565b915091509550959350505050565b6000612089612073612e63565b61207b61316b565b61459790919063ffffffff16565b905090565b6000600760060154905090565b60006120a78383613b23565b905092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6120db61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190615779565b60405180910390fd5b600260065414156121b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a790615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c635de508599091836040518363ffffffff1660e01b81526004016121f4929190615894565b60006040518083038186803b15801561220c57600080fd5b505af4158015612220573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff167f2da3691fd2703bfd89093c0616be6ea99148d085f6236cda85ffc3af9071b00660405160405180910390a2600160068190555050565b6000600e541161227e57fe5b60003390506000731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e90508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146122d157fe5b3073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461230657fe5b3073ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff161461233f57fe5b600080600060608680602001905181019061235a9190614b62565b935093509350935061236e848484846145e1565b61237757600080fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f1b393f16001866123a7868861433f90919063ffffffff16565b6040518463ffffffff1660e01b81526004016123c593929190615640565b60006040518083038186803b1580156123dd57600080fd5b505af41580156123f1573d6000803e3d6000fd5b50505050505050505050505050565b6000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c634571ca8a90916040518263ffffffff1660e01b815260040161243c9190615879565b60206040518083038186803b15801561245457600080fd5b505af4158015612468573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248c9190614dda565b61249d57662386f26fc100006124a0565b60005b905090565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156125675780601f1061253c57610100808354040283529160200191612567565b820191906000526020600020905b81548152906001019060200180831161254a57829003601f168201915b5050505050905090565b60008061258086868686613a81565b9150915094509492505050565b7f00000000000000000000000009e64c2b61a5f1690ee6fbed9baf5d6990f8dfd081565b600080600080915091509091565b60006126826125cc61387e565b8461267d85604051806060016040528060258152602001615d0d60259139600160006125f661387e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b613886565b6001905092915050565b6000600760050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006126cd6126c661387e565b848461404f565b6001905092915050565b6126df61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590615779565b60405180910390fd5b600260065414156127b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ab90615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c631a70d5d590916040518263ffffffff1660e01b81526004016127f69190615879565b60006040518083038186803b15801561280e57600080fd5b505af4158015612822573d6000803e3d6000fd5b505050506000806000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c63fc3b6efd90916040518263ffffffff1660e01b81526004016128659190615879565b60606040518083038186803b15801561287d57600080fd5b505af4158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b59190614d0b565b925092509250732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f00000000000000000000000009e64c2b61a5f1690ee6fbed9baf5d6990f8dfd085856040518463ffffffff1660e01b8152600401612916939291906155c5565b60006040518083038186803b15801561292e57600080fd5b505af4158015612942573d6000803e3d6000fd5b5050505061295130848361404f565b8273ffffffffffffffffffffffffffffffffffffffff167f32ff16b7e2d85978fd6c5c010a46b09c8cd011cc35fd2c69c214f9f188756b608383604051612999929190615a6d565b60405180910390a25050506001600681905550565b5050565b600260065414156129f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ef90615819565b60405180910390fd5b6002600681905550600033905060008211612a48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a3f90615739565b60405180910390fd5b600080612a6c84612a5761168c565b612a5f61106e565b612a6761190f565b61467f565b9150915060008211612ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aaa906156f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e364385876040518463ffffffff1660e01b8152600401612b0e939291906155c5565b60006040518083038186803b158015612b2657600080fd5b505af4158015612b3a573d6000803e3d6000fd5b50505050612b4784614721565b612b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7d906157f9565b60405180910390fd5b612b908383613ebb565b612bad30612ba8600284613e7190919063ffffffff16565b613ebb565b505050600160068190555050565b60026006541415612c01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bf890615819565b60405180910390fd5b6002600681905550600033905060008211612c51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c4890615839565b60405180910390fd5b6000612c6483612c5f6115a2565b614492565b9050600080612c8a83612c7561168c565b612c7d61106e565b612c8561190f565b61467f565b9150915060008211612cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc8906156f9565b60405180910390fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863201add9b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f86886040518463ffffffff1660e01b8152600401612d2c939291906155c5565b60006040518083038186803b158015612d4457600080fd5b505af4158015612d58573d6000803e3d6000fd5b5050505073a4afe5ef27a54f8b5345bb911a380b806175c42e632451c2837f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e3643876040518363ffffffff1660e01b8152600401612db59291906155fc565b60006040518083038186803b158015612dcd57600080fd5b505af4158015612de1573d6000803e3d6000fd5b50505050612dee83614721565b612e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e24906157f9565b60405180910390fd5b612e378483613ebb565b612e5430612e4f600284613e7190919063ffffffff16565b613ebb565b50505050600160068190555050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e636df1e2b87f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b8152600401612ebc919061558f565b60206040518083038186803b158015612ed457600080fd5b505af4158015612ee8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0c9190614e2c565b905090565b612f1961387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f9f90615779565b60405180910390fd5b60026006541415612fee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fe590615819565b60405180910390fd5b6002600681905550600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c632fc518b29091836040518363ffffffff1660e01b81526004016130329291906158bd565b60006040518083038186803b15801561304a57600080fd5b505af415801561305e573d6000803e3d6000fd5b50505050600160068190555050565b6000600f60020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600f60040154600f60050154915091509091565b600080600f60060154600f60070154915091509091565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008061315e868686866147dc565b9150915094509492505050565b600073a4afe5ef27a54f8b5345bb911a380b806175c42e62177b3f7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b81526004016131c3919061558f565b60206040518083038186803b1580156131db57600080fd5b505af41580156131ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132139190614e2c565b905090565b6000600e541161322457fe5b6000339050600073398ec7346dcd622edc5ae82352f02be94c62d11990508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461327757fe5b6132c787878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506145e1565b6132d057600080fd5b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce0863f1b393f1600089613300898b61433f90919063ffffffff16565b6040518463ffffffff1660e01b815260040161331e93929190615640565b60006040518083038186803b15801561333657600080fd5b505af415801561334a573d6000803e3d6000fd5b5050505050505050505050565b61335f61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146133ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133e590615779565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561345e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613455906156b9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e364381565b61354a61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146135d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135d090615779565b60405180910390fd5b6002600654141561361f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161361690615819565b60405180910390fd5b60026006819055506000600773ca54c7ae9a33a2a6f16eee603c97a2dd9ea6201c630eaced8190916040518263ffffffff1660e01b81526004016136639190615879565b60206040518083038186803b15801561367b57600080fd5b505af415801561368f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136b39190614b39565b90508073ffffffffffffffffffffffffffffffffffffffff167f2d38b612ec22e51eb40a71fe7d58e1a7ebb9989673619ae9f96cc0da907773d360405160405180910390a2506001600681905550565b61370b61387e565b73ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461379a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161379190615779565b60405180910390fd5b600260065414156137e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137d790615819565b60405180910390fd5b6002600681905550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb63b4e46dce909184846040518463ffffffff1660e01b8152600401613826939291906159f2565b60006040518083038186803b15801561383e57600080fd5b505af4158015613852573d6000803e3d6000fd5b5050505060016006819055505050565b6000806138718686868661467f565b9150915094509492505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156138f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ed906157d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161395d906156d9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051613a449190615a29565b60405180910390a3505050565b6000806000613a6288888888613a81565b8093508192505050613a748185613b23565b9250509550959350505050565b6000806000613acd670de0b6b3a7640000613abf613ab087670de0b6b3a764000061459790919063ffffffff16565b8a61487e90919063ffffffff16565b613e7190919063ffffffff16565b9050848114613b0057613afb85613aed888461487e90919063ffffffff16565b613e7190919063ffffffff16565b613b02565b855b9250613b17818861459790919063ffffffff16565b91505094509492505050565b6000613b52670de0b6b3a7640000613b44848661487e90919063ffffffff16565b613e7190919063ffffffff16565b905092915050565b6000600e60008154809291906001019190505550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631f4fd96e9091613c3c8573a4afe5ef27a54f8b5345bb911a380b806175c42e633ff443b87f0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e36436040518263ffffffff1660e01b8152600401613be7919061558f565b60206040518083038186803b158015613bff57600080fd5b505af4158015613c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c379190614e2c565b613b23565b6040518363ffffffff1660e01b8152600401613c599291906159c9565b60206040518083038186803b158015613c7157600080fd5b505af4158015613c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ca99190614dda565b9050600e6000815480929190600190039190505550919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d2a90615799565b60405180910390fd5b613d3f826000836148ee565b613daa81604051806060016040528060228152602001615c9d602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613e018160025461459790919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613e659190615a29565b60405180910390a35050565b6000613eb383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506148f3565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f2290615859565b60405180910390fd5b613f37600083836148ee565b613f4c8160025461433f90919063ffffffff16565b600281905550613fa3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516140439190615a29565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156140bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016140b6906157b9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561412f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161412690615699565b60405180910390fd5b61413a8383836148ee565b6141a581604051806060016040528060268152602001615cbf602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e49092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614238816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461433f90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516142d79190615a29565b60405180910390a3505050565b600083831115829061432c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016143239190615677565b60405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561438a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161438190615719565b60405180910390fd5b8091505092915050565b60008060008587146143ca576143c5866143b7878a61487e90919063ffffffff16565b613e7190919063ffffffff16565b6143cc565b845b90506144156143ec85670de0b6b3a764000061459790919063ffffffff16565b614407670de0b6b3a76400008461487e90919063ffffffff16565b613e7190919063ffffffff16565b925061442a818461459790919063ffffffff16565b91505094509492505050565b6000806000614447888888886147dc565b80935081925050506144598185613b23565b9250509550959350505050565b60008060006144758885614492565b905061448381888888614394565b92509250509550959350505050565b60006144c1826144b3670de0b6b3a76400008661487e90919063ffffffff16565b613e7190919063ffffffff16565b905092915050565b732f8bc65e6587b4ac6408c92a66209a9f1ef2ce086312111b487f00000000000000000000000009e64c2b61a5f1690ee6fbed9baf5d6990f8dfd073d93f98b483cc2f9efe512696df8f5decb73f9497846040518463ffffffff1660e01b8152600401614538939291906155c5565b60006040518083038186803b15801561455057600080fd5b505af4158015614564573d6000803e3d6000fd5b5050505050565b600080600061457a8885614492565b90506145888188888861467f565b92509250509550959350505050565b60006145d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506142e4565b905092915050565b6000600f73f2ac73e0228002bf40559a0ed540c81b80e240bb6329480b0c9091878787876040518663ffffffff1660e01b8152600401614625959493929190615946565b60206040518083038186803b15801561463d57600080fd5b505af4158015614651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146759190614dda565b9050949350505050565b60008060008585146146b5576146b0866146a2878a61487e90919063ffffffff16565b613e7190919063ffffffff16565b6146b7565b865b9050614700670de0b6b3a76400006146f26146e387670de0b6b3a764000061459790919063ffffffff16565b8461487e90919063ffffffff16565b613e7190919063ffffffff16565b9250614715838261459790919063ffffffff16565b91505094509492505050565b6000600e60008154809291906001019190505550600f73f2ac73e0228002bf40559a0ed540c81b80e240bb631f4fd96e909160006040518363ffffffff1660e01b81526004016147729291906159a0565b60206040518083038186803b15801561478a57600080fd5b505af415801561479e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c29190614dda565b9050600e6000815480929190600190039190505550919050565b60008060006148286147ff85670de0b6b3a764000061459790919063ffffffff16565b61481a670de0b6b3a76400008a61487e90919063ffffffff16565b613e7190919063ffffffff16565b905084861461485b5761485685614848888461487e90919063ffffffff16565b613e7190919063ffffffff16565b61485d565b805b9250614872878261459790919063ffffffff16565b91505094509492505050565b60008083141561489157600090506148e8565b60008284029050828482816148a257fe5b04146148e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016148da90615759565b60405180910390fd5b809150505b92915050565b505050565b6000808311829061493a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016149319190615677565b60405180910390fd5b50600083858161494657fe5b049050809150509392505050565b60008135905061496381615c40565b92915050565b60008151905061497881615c40565b92915050565b60008151905061498d81615c57565b92915050565b6000815190506149a281615c6e565b92915050565b60008083601f8401126149ba57600080fd5b8235905067ffffffffffffffff8111156149d357600080fd5b6020830191508360018202830111156149eb57600080fd5b9250929050565b600082601f830112614a0357600080fd5b8135614a16614a1182615ade565b615ab1565b91508082526020830160208301858383011115614a3257600080fd5b614a3d838284615be0565b50505092915050565b600082601f830112614a5757600080fd5b8151614a6a614a6582615ade565b615ab1565b91508082526020830160208301858383011115614a8657600080fd5b614a91838284615bef565b50505092915050565b600060408284031215614aac57600080fd5b614ab66040615ab1565b90506000614ac684828501614954565b6000830152506020614ada84828501614ae6565b60208301525092915050565b600081359050614af581615c85565b92915050565b600081519050614b0a81615c85565b92915050565b600060208284031215614b2257600080fd5b6000614b3084828501614954565b91505092915050565b600060208284031215614b4b57600080fd5b6000614b5984828501614969565b91505092915050565b60008060008060808587031215614b7857600080fd5b6000614b868782880161497e565b9450506020614b9787828801614afb565b9350506040614ba887828801614afb565b925050606085015167ffffffffffffffff811115614bc557600080fd5b614bd187828801614a46565b91505092959194509250565b60008060408385031215614bf057600080fd5b6000614bfe85828601614954565b9250506020614c0f85828601614954565b9150509250929050565b600080600060608486031215614c2e57600080fd5b6000614c3c86828701614954565b9350506020614c4d86828701614954565b9250506040614c5e86828701614ae6565b9150509250925092565b600080600060808486031215614c7d57600080fd5b6000614c8b86828701614954565b9350506020614c9c86828701614a9a565b925050606084013567ffffffffffffffff811115614cb957600080fd5b614cc5868287016149f2565b9150509250925092565b60008060408385031215614ce257600080fd5b6000614cf085828601614954565b9250506020614d0185828601614ae6565b9150509250929050565b600080600060608486031215614d2057600080fd5b6000614d2e86828701614969565b9350506020614d3f86828701614afb565b9250506040614d5086828701614afb565b9150509250925092565b600080600080600060808688031215614d7257600080fd5b6000614d8088828901614954565b9550506020614d9188828901614ae6565b9450506040614da288828901614ae6565b935050606086013567ffffffffffffffff811115614dbf57600080fd5b614dcb888289016149a8565b92509250509295509295909350565b600060208284031215614dec57600080fd5b6000614dfa84828501614993565b91505092915050565b600060208284031215614e1557600080fd5b6000614e2384828501614ae6565b91505092915050565b600060208284031215614e3e57600080fd5b6000614e4c84828501614afb565b91505092915050565b60008060408385031215614e6857600080fd5b6000614e7685828601614ae6565b9250506020614e8785828601614ae6565b9150509250929050565b60008060408385031215614ea457600080fd5b6000614eb285828601614afb565b9250506020614ec385828601614afb565b9150509250929050565b60008060008060808587031215614ee357600080fd5b6000614ef187828801614ae6565b9450506020614f0287828801614ae6565b9350506040614f1387828801614ae6565b9250506060614f2487828801614ae6565b91505092959194509250565b600080600080600060a08688031215614f4857600080fd5b6000614f5688828901614ae6565b9550506020614f6788828901614ae6565b9450506040614f7888828901614ae6565b9350506060614f8988828901614ae6565b9250506080614f9a88828901614ae6565b9150509295509295909350565b614fb081615b42565b82525050565b614fbf81615b42565b82525050565b614fce81615b66565b82525050565b6000614fdf82615b0a565b614fe98185615b20565b9350614ff9818560208601615bef565b61500281615c22565b840191505092915050565b61501681615bbc565b82525050565b61502581615bce565b82525050565b600061503682615b15565b6150408185615b31565b9350615050818560208601615bef565b61505981615c22565b840191505092915050565b6000615071602383615b31565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006150d7602683615b31565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061513d602283615b31565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006151a3601d83615b31565b91507f736861726573206d7573742062652067726561746572207468616e20300000006000830152602082019050919050565b60006151e3601b83615b31565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000615223601b83615b31565b91507f636f7374206d7573742062652067726561746572207468616e203000000000006000830152602082019050919050565b6000615263602183615b31565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006152c9602083615b31565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000615309602183615b31565b91507f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061536f602583615b31565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006153d5602483615b31565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061543b601b83615b31565b91507f6e6f7420617661696c61626c6520617420746865206d6f6d656e7400000000006000830152602082019050919050565b600061547b601f83615b31565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b60006154bb602683615b31565b91507f756e6465726c79696e6720636f7374206d75737420626520677265617465722060008301527f7468616e203000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000615521601f83615b31565b91507f45524332303a206d696e7420746f20746865207a65726f2061646472657373006000830152602082019050919050565b8082525050565b8082525050565b61556b81615ba5565b82525050565b61557a81615ba5565b82525050565b61558981615baf565b82525050565b60006020820190506155a46000830184614fb6565b92915050565b60006020820190506155bf6000830184614fa7565b92915050565b60006060820190506155da6000830186614fb6565b6155e76020830185614fb6565b6155f46040830184615571565b949350505050565b60006040820190506156116000830185614fb6565b61561e6020830184615571565b9392505050565b600060208201905061563a6000830184614fc5565b92915050565b6000606082019050615655600083018661500d565b6156626020830185614fb6565b61566f6040830184615571565b949350505050565b60006020820190508181036000830152615691818461502b565b905092915050565b600060208201905081810360008301526156b281615064565b9050919050565b600060208201905081810360008301526156d2816150ca565b9050919050565b600060208201905081810360008301526156f281615130565b9050919050565b6000602082019050818103600083015261571281615196565b9050919050565b60006020820190508181036000830152615732816151d6565b9050919050565b6000602082019050818103600083015261575281615216565b9050919050565b6000602082019050818103600083015261577281615256565b9050919050565b60006020820190508181036000830152615792816152bc565b9050919050565b600060208201905081810360008301526157b2816152fc565b9050919050565b600060208201905081810360008301526157d281615362565b9050919050565b600060208201905081810360008301526157f2816153c8565b9050919050565b600060208201905081810360008301526158128161542e565b9050919050565b600060208201905081810360008301526158328161546e565b9050919050565b60006020820190508181036000830152615852816154ae565b9050919050565b6000602082019050818103600083015261587281615514565b9050919050565b600060208201905061588e6000830184615554565b92915050565b60006040820190506158a96000830185615554565b6158b66020830184614fb6565b9392505050565b60006040820190506158d26000830185615554565b6158df6020830184615571565b9392505050565b60006060820190506158fb6000830186615554565b6159086020830185615571565b6159156040830184615571565b949350505050565b6000604082019050615932600083018561555b565b61593f6020830184614fb6565b9392505050565b600060a08201905061595b600083018861555b565b6159686020830187614fb6565b6159756040830186615571565b6159826060830185615571565b81810360808301526159948184614fd4565b90509695505050505050565b60006040820190506159b5600083018561555b565b6159c2602083018461501c565b9392505050565b60006040820190506159de600083018561555b565b6159eb6020830184615571565b9392505050565b6000606082019050615a07600083018661555b565b615a146020830185615571565b615a216040830184615571565b949350505050565b6000602082019050615a3e6000830184615562565b92915050565b6000604082019050615a596000830185615571565b615a666020830184615571565b9392505050565b6000604082019050615a826000830185615562565b615a8f6020830184615562565b9392505050565b6000602082019050615aab6000830184615580565b92915050565b6000604051905081810181811067ffffffffffffffff82111715615ad457600080fd5b8060405250919050565b600067ffffffffffffffff821115615af557600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000615b4d82615b85565b9050919050565b6000615b5f82615b85565b9050919050565b60008115159050919050565b6000819050615b8082615c33565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000615bc782615b72565b9050919050565b6000615bd982615ba5565b9050919050565b82818337600083830152505050565b60005b83811015615c0d578082015181840152602081019050615bf2565b83811115615c1c576000848401525b50505050565b6000601f19601f8301169050919050565b60028110615c3d57fe5b50565b615c4981615b42565b8114615c5457600080fd5b50565b615c6081615b54565b8114615c6b57600080fd5b50565b615c7781615b66565b8114615c8257600080fd5b50565b615c8e81615ba5565b8114615c9957600080fd5b5056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ed9b8ae9a6178013b2cf6f36b5149ac1d20315d1975778db56f1bfd461e4550564736f6c634300060c0033
Libraries Used
GLiquidityPoolManager : 0xca54c7ae9a33a2a6f16eee603c97a2dd9ea6201cGCLeveragedReserveManager : 0xf2ac73e0228002bf40559a0ed540c81b80e240bb
Deployed Bytecode Sourcemap
238749:137:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;87416:134;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;19762:83;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;21868:169;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;170256:380;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;173863:819;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;20837:100;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;22511:321;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;163880:49;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;86958:122;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;90184:610;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;20689:83;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;23241:218;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;83399:304;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;170839:128;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;168055:364;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;169162:383;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;194942:176;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;93360:317;;;:::i;:::-;;86424:115;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;85475:151;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;199709:117;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;200352:205;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;163782:45;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;165478:218;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;91850:307;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;21000:119;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2791:148;;;:::i;:::-;;166976:369;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;195477:176;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;88244:146;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;166076:208;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;163831:45;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;94361:227;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;190811:631;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;86107:163;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2149:79;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;19964:87;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;84318:311;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;80154:45;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;197853:142;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;23962:269;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;87788:143;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;21332:175;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;95657:444;;;:::i;:::-;;201250:206;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;89047:534;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;172752:727;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;172098:164;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;92456:142;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;195980:100;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;197040:186;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;199170:207;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;21570:151;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;82486:295;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;171647:158;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;189762:437;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;3094:244;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;80203:46;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;94940:205;;;:::i;:::-;;202328:233;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;81582:290;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;87416:134;87486:24;87526:3;:19;;;87519:26;;87416:134;:::o;19762:83::-;19799:13;19832:5;19825:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19762:83;:::o;21868:169::-;21951:4;21968:39;21977:12;:10;:12::i;:::-;21991:7;22000:6;21968:8;:39::i;:::-;22025:4;22018:11;;21868:169;;;;:::o;170256:380::-;170448:23;170473:18;170507:124;170558:12;170572:13;170587:12;170601:14;170617:13;170507:50;:124::i;:::-;170500:131;;;;170256:380;;;;;;;;:::o;173863:819::-;30310:1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;173949:13:::1;173965:10;173949:26;;174003:1;173988:12;:16;173980:58;;;;;;;;;;;;:::i;:::-;;;;;;;;;174044:13;174059:18:::0;174081:101:::1;174121:12;174135:14;:12;:14::i;:::-;174151:13;:11;:13::i;:::-;174166:15;:13;:15::i;:::-;174081:39;:101::i;:::-;174043:139;;;;174187:23;174213:61;174252:5;174259:14;:12;:14::i;:::-;174213:38;:61::i;:::-;174187:87;;174305:1;174287:15;:19;174279:70;;;;;;;;;;;;:::i;:::-;;;;;;;;;174362:25;174381:5;174362:18;:25::i;:::-;174354:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;174442:1;:5;174448:15;174465:2;:16;174482:12;174465:30;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;174442:54;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;174424:72;;174501:2;:13;174515:12;174529:15;174501:44;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;174550:1;:11;174562:15;174579:5;174586:15;174550:52;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;174607:26;174613:5;174620:12;174607:5;:26::i;:::-;174638:39;174652:4;174659:17;174674:1;174659:10;:14;;:17;;;;:::i;:::-;174638:5;:39::i;:::-;31080:1;;;;30266::::0;31228:7;:22;;;;173863:819;:::o;20837:100::-;20890:7;20917:12;;20910:19;;20837:100;:::o;22511:321::-;22617:4;22634:36;22644:6;22652:9;22663:6;22634:9;:36::i;:::-;22681:121;22690:6;22698:12;:10;:12::i;:::-;22712:89;22750:6;22712:89;;;;;;;;;;;;;;;;;:11;:19;22724:6;22712:19;;;;;;;;;;;;;;;:33;22732:12;:10;:12::i;:::-;22712:33;;;;;;;;;;;;;;;;:37;;:89;;;;;:::i;:::-;22681:8;:121::i;:::-;22820:4;22813:11;;22511:321;;;;;:::o;163880:49::-;;;:::o;86958:122::-;87024:20;87060:3;:15;;;87053:22;;86958:122;:::o;90184:610::-;30310:1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;90260:13:::1;90276:10;90260:26;;90314:1;90299:12;:16;90291:58;;;;;;;;;;;;:::i;:::-;;;;;;;;;90355:13;90370:18:::0;90392:101:::1;90432:12;90446:14;:12;:14::i;:::-;90462:13;:11;:13::i;:::-;90477:15;:13;:15::i;:::-;90392:39;:101::i;:::-;90354:139;;;;90514:1;90506:5;:9;90498:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;90560:25;90579:5;90560:18;:25::i;:::-;90552:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;90630:1;:5;90636;90643:1;:12;90656;90643:26;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;90630:40;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;90622:48;;90675:1;:11;90687:12;90701:5;90708;90675:39;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;90719:26;90725:5;90732:12;90719:5;:26::i;:::-;90750:39;90764:4;90771:17;90786:1;90771:10;:14;;:17;;;;:::i;:::-;90750:5;:39::i;:::-;31080:1;;;30266::::0;31228:7;:22;;;;90184:610;:::o;20689:83::-;20730:5;20755:9;;;;;;;;;;;20748:16;;20689:83;:::o;23241:218::-;23329:4;23346:83;23355:12;:10;:12::i;:::-;23369:7;23378:50;23417:10;23378:11;:25;23390:12;:10;:12::i;:::-;23378:25;;;;;;;;;;;;;;;:34;23404:7;23378:34;;;;;;;;;;;;;;;;:38;;:50;;;;:::i;:::-;23346:8;:83::i;:::-;23447:4;23440:11;;23241:218;;;;:::o;83399:304::-;83551:20;83573:18;83607:91;83647:5;83654:13;83669:12;83683:14;83607:39;:91::i;:::-;83600:98;;;;83399:304;;;;;;;:::o;170839:128::-;170893:21;170930:2;:18;170949:12;170930:32;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;170923:39;;170839:128;:::o;168055:364::-;168239:23;168264:18;168298:116;168346:10;168358:13;168373:12;168387:11;168400:13;168298:47;:116::i;:::-;168291:123;;;;168055:364;;;;;;;;:::o;169162:383::-;169357:20;169379:18;169413:127;169464:15;169481:13;169496:12;169510:14;169526:13;169413:50;:127::i;:::-;169406:134;;;;169162:383;;;;;;;;:::o;194942:176::-;194996:21;195033:80;195072:24;:22;:24::i;:::-;195098:14;:12;:14::i;:::-;195033:38;:80::i;:::-;195026:87;;194942:176;:::o;93360:317::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;93442:3:::2;:18;;;;:20;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;93468:21;93491::::0;93516:3:::2;:19;;;;:21;;;;;;;;;;;;;;;:::i;:::-;;::::0;::::2;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;93467:70;;;;93542:26;93554:13;93542:11;:26::i;:::-;93573:35;93587:4;93594:13;93573:5;:35::i;:::-;93618:54;93643:13;93658;93618:54;;;;;;;:::i;:::-;;;;;;;;31080:1;;30266::::1;31228:7;:22;;;;93360:317::o:0;86424:115::-;86479:22;86517:3;:17;;;;;;;;;;;;86510:24;;86424:115;:::o;85475:151::-;85527:19;85560:3;:15;;;;:17;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:61;;79965:4;85560:61;;;80074:4;85560:61;85553:68;;85475:151;:::o;199709:117::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;199795:3:::2;:15;;;;199811:9;199795:26;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;30266:1:::1;31228:7;:22;;;;199709:117:::0;:::o;200352:205::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;200486:3:::2;:22;;;;200509:20;200531;200486:66;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;30266:1:::1;31228:7;:22;;;;200352:205:::0;;:::o;163782:45::-;;;:::o;165478:218::-;165592:13;165621:70;165660:15;165677:13;165621:38;:70::i;:::-;165614:77;;165478:218;;;;:::o;91850:307::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;91973:13:::2;91989:10;91973:26;;92004:1;:11;92016;92029:5;92036:13;92004:46;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;92055;92065:5;92080:4;92087:13;92055:9;:46::i;:::-;92106:3;:16;;;;92123:13;92138;92106:46;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;31080:1;30266::::1;31228:7;:22;;;;91850:307:::0;;:::o;21000:119::-;21066:7;21093:9;:18;21103:7;21093:18;;;;;;;;;;;;;;;;21086:25;;21000:119;;;:::o;2791:148::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;2898:1:::1;2861:40;;2882:6;;;;;;;;;;;2861:40;;;;;;;;;;;;2929:1;2912:6;;:19;;;;;;;;;;;;;;;;;;2791:148::o:0;166976:369::-;167165:18;167185;167219:121;167267:15;167284:13;167299:12;167313:11;167326:13;167219:47;:121::i;:::-;167212:128;;;;166976:369;;;;;;;;:::o;195477:176::-;195541:31;195588:60;195619:28;:26;:28::i;:::-;195588:26;:24;:26::i;:::-;:30;;:60;;;;:::i;:::-;195581:67;;195477:176;:::o;88244:146::-;88318:28;88362:3;:23;;;88355:30;;88244:146;:::o;166076:208::-;166180:23;166219:60;166258:5;166265:13;166219:38;:60::i;:::-;166212:67;;166076:208;;;;:::o;163831:45::-;;;:::o;94361:227::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;94476:3:::2;:25;;;;94502:19;94476:46;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;94563:19;94532:51;;;;;;;;;;;;30266:1:::1;31228:7;:22;;;;94361:227:::0;:::o;190811:631::-;190954:1;190932:19;;:23;190925:31;;;;190961:13;190977:10;190961:26;;190992:13;39686:42;190992:34;;191047:5;191038:14;;:5;:14;;;191031:22;;;;191084:4;191065:24;;:7;:24;;;191058:32;;;;191128:4;191102:31;;:8;:14;;;:31;;;191095:39;;;;191140:14;191156:15;191173:12;191187:20;191222:5;191211:50;;;;;;;;;;;;:::i;:::-;191139:122;;;;;;;;191274:49;191292:6;191300:7;191309:4;191315:7;191274:17;:49::i;:::-;191266:95;;;;;;191366:1;:18;191385:24;191411:6;191419:17;191431:4;191419:7;:11;;:17;;;;:::i;:::-;191366:71;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190811:631;;;;;;;;;:::o;86107:163::-;86162:22;86198:3;:15;;;;:17;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:67;;80013:4;86198:67;;;80138:4;86198:67;86191:74;;86107:163;:::o;2149:79::-;2187:7;2214:6;;;;;;;;;;;2207:13;;2149:79;:::o;19964:87::-;20003:13;20036:7;20029:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19964:87;:::o;84318:311::-;84477:13;84492:18;84526:98;84566:12;84580:13;84595:12;84609:14;84526:39;:98::i;:::-;84519:105;;;;84318:311;;;;;;;:::o;80154:45::-;;;:::o;197853:142::-;197910:28;197940;197985:1;197988;197977:13;;;;197853:142;;:::o;23962:269::-;24055:4;24072:129;24081:12;:10;:12::i;:::-;24095:7;24104:96;24143:15;24104:96;;;;;;;;;;;;;;;;;:11;:25;24116:12;:10;:12::i;:::-;24104:25;;;;;;;;;;;;;;;:34;24130:7;24104:34;;;;;;;;;;;;;;;;:38;;:96;;;;;:::i;:::-;24072:8;:129::i;:::-;24219:4;24212:11;;23962:269;;;;:::o;87788:143::-;87861:27;87904:3;:22;;;;;;;;;;;;87897:29;;87788:143;:::o;21332:175::-;21418:4;21435:42;21445:12;:10;:12::i;:::-;21459:9;21470:6;21435:9;:42::i;:::-;21495:4;21488:11;;21332:175;;;;:::o;95657:444::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;95745:3:::2;:18;;;;:20;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;95771:27;95800:21:::0;95823::::2;95848:3;:25;;;;:27;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;95770:105;;;;;;95880:1;:11;95892;95905:19;95926:13;95880:60;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;95945;95963:4;95970:19;95991:13;95945:9;:60::i;:::-;96046:19;96015:81;;;96067:13;96082;96015:81;;;;;;;:::i;:::-;;;;;;;;31080:1;;;30266::::1;31228:7;:22;;;;95657:444::o:0;201250:206::-;;;:::o;89047:534::-;30310:1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;89115:13:::1;89131:10;89115:26;;89162:1;89154:5;:9;89146:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;89201:18;89221::::0;89243:88:::1;89280:5;89287:14;:12;:14::i;:::-;89303:13;:11;:13::i;:::-;89318:12;:10;:12::i;:::-;89243:36;:88::i;:::-;89200:131;;;;89357:1;89344:10;:14;89336:56;;;;;;;;;;;;:::i;:::-;;;;;;;;;89397:1;:11;89409:12;89423:5;89430;89397:39;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;89449:22;89465:5;89449:15;:22::i;:::-;89441:62;;;;;;;;;;;;:::i;:::-;;;;;;;;;89508:24;89514:5;89521:10;89508:5;:24::i;:::-;89537:39;89551:4;89558:17;89573:1;89558:10;:14;;:17;;;;:::i;:::-;89537:5;:39::i;:::-;31080:1;;;30266::::0;31228:7;:22;;;;89047:534;:::o;172752:727::-;30310:1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;172840:13:::1;172856:10;172840:26;;172897:1;172879:15;:19;172871:70;;;;;;;;;;;;:::i;:::-;;;;;;;;;172946:13;172962:71;173001:15;173018:14;:12;:14::i;:::-;172962:38;:71::i;:::-;172946:87;;173039:18;173059::::0;173081:88:::1;173118:5;173125:14;:12;:14::i;:::-;173141:13;:11;:13::i;:::-;173156:12;:10;:12::i;:::-;173081:36;:88::i;:::-;173038:131;;;;173195:1;173182:10;:14;173174:56;;;;;;;;;;;;:::i;:::-;;;;;;;;;173235:1;:11;173247:15;173264:5;173271:15;173235:52;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;173292:2;:11;173304:12;173318:15;173292:42;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;173347:22;173363:5;173347:15;:22::i;:::-;173339:62;;;;;;;;;;;;:::i;:::-;;;;;;;;;173406:24;173412:5;173419:10;173406:5;:24::i;:::-;173435:39;173449:4;173456:17;173471:1;173456:10;:14;;:17;;;;:::i;:::-;173435:5;:39::i;:::-;31080:1;;;;30266::::0;31228:7;:22;;;;172752:727;:::o;172098:164::-;172174:35;172225:2;:18;172244:12;172225:32;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;172218:39;;172098:164;:::o;92456:142::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;92561:3:::2;:18;;;;92580:12;92561:32;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;30266:1:::1;31228:7;:22;;;;92456:142:::0;:::o;195980:100::-;196030:17;196063:3;:12;;;;;;;;;;;;196056:19;;195980:100;:::o;197040:186::-;197097:28;197127;197172:3;:23;;;197197:3;:23;;;197164:57;;;;197040:186;;:::o;199170:207::-;199234:31;199267:32;199316:3;:26;;;199344:3;:27;;;199308:64;;;;199170:207;;:::o;21570:151::-;21659:7;21686:11;:18;21698:5;21686:18;;;;;;;;;;;;;;;:27;21705:7;21686:27;;;;;;;;;;;;;;;;21679:34;;21570:151;;;;:::o;82486:295::-;82637:13;82652:18;82686:90;82723:10;82735:13;82750:12;82764:11;82686:36;:90::i;:::-;82679:97;;;;82486:295;;;;;;;:::o;171647:158::-;171721:33;171770:2;:16;171787:12;171770:30;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;171763:37;;171647:158;:::o;189762:437::-;189913:1;189891:19;;:23;189884:31;;;;189920:13;189936:10;189920:26;;189951:13;39335:42;189951:40;;190012:5;190003:14;;:5;:14;;;189996:22;;;;190031:49;190049:6;190057:7;190066:4;190072:7;;190031:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:17;:49::i;:::-;190023:95;;;;;;190123:1;:18;190142:24;190168:6;190176:17;190188:4;190176:7;:11;;:17;;;;:::i;:::-;190123:71;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;189762:437;;;;;;;:::o;3094:244::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;3203:1:::1;3183:22;;:8;:22;;;;3175:73;;;;;;;;;;;;:::i;:::-;;;;;;;;;3293:8;3264:38;;3285:6;;;;;;;;;;;3264:38;;;;;;;;;;;;3322:8;3313:6;;:17;;;;;;;;;;;;;;;;;;3094:244:::0;:::o;80203:46::-;;;:::o;94940:205::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;95026:27:::2;95056:3;:23;;;;:25;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;95026:55;;95120:19;95091:49;;;;;;;;;;;;31080:1;30266::::1;31228:7;:22;;;;94940:205::o:0;202328:233::-;2371:12;:10;:12::i;:::-;2361:22;;:6;;;;;;;;;;;:22;;;2353:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1:::1;30916:7;;:19;;30908:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;30310:1;31049:7;:18;;;;202476:3:::2;:29;;;;202506:23;202531:24;202476:80;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;30266:1:::1;31228:7;:22;;;;202328:233:::0;;:::o;81582:290::-;81728:18;81748;81782:85;81819:5;81826:13;81841:12;81855:11;81782:36;:85::i;:::-;81775:92;;;;81582:290;;;;;;;:::o;703:106::-;756:15;791:10;784:17;;703:106;:::o;27107:346::-;27226:1;27209:19;;:5;:19;;;;27201:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;27307:1;27288:21;;:7;:21;;;;27280:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;27391:6;27361:11;:18;27373:5;27361:18;;;;;;;;;;;;;;;:27;27380:7;27361:27;;;;;;;;;;;;;;;:36;;;;27429:7;27413:32;;27422:5;27413:32;;;27438:6;27413:32;;;;;;:::i;:::-;;;;;;;;27107:346;;;:::o;144814:456::-;145000:23;145025:18;145052:13;145092:98;145132:12;145146:13;145161:12;145175:14;145092:39;:98::i;:::-;145070:120;;;;;;;;145203:49;145231:5;145238:13;145203:27;:49::i;:::-;145195:70;;;144814:456;;;;;;;;:::o;36960:464::-;37113:13;37128:18;37155;37176:61;37232:4;37176:51;37193:33;37211:14;37201:4;37193:17;;:33;;;;:::i;:::-;37176:12;:16;;:51;;;;:::i;:::-;:55;;:61;;;;:::i;:::-;37155:82;;37264:12;37250:10;:26;:92;;37295:47;37329:12;37295:29;37310:13;37295:10;:14;;:29;;;;:::i;:::-;:33;;:47;;;;:::i;:::-;37250:92;;;37279:13;37250:92;37242:100;;37360:28;37377:10;37360:12;:16;;:28;;;;:::i;:::-;37347:41;;37393:26;36960:464;;;;;;;:::o;142506:176::-;142604:23;142643:34;142672:4;142643:24;142653:13;142643:5;:9;;:24;;;;:::i;:::-;:28;;:34;;;;:::i;:::-;142636:41;;142506:176;;;;:::o;204282:219::-;204367:13;189232:19;;:21;;;;;;;;;;;;;204396:3:::1;:17;;;;204414:81;204453:5;204460:2;:20;204481:12;204460:34;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;204414:38;:81::i;:::-;204396:100;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;204389:107;;189264:19:::0;;:21;;;;;;;;;;;;;;204282:219;;;:::o;26251:418::-;26354:1;26335:21;;:7;:21;;;;26327:67;;;;;;;;;;;;:::i;:::-;;;;;;;;;26407:49;26428:7;26445:1;26449:6;26407:20;:49::i;:::-;26490:68;26513:6;26490:68;;;;;;;;;;;;;;;;;:9;:18;26500:7;26490:18;;;;;;;;;;;;;;;;:22;;:68;;;;;:::i;:::-;26469:9;:18;26479:7;26469:18;;;;;;;;;;;;;;;:89;;;;26584:24;26601:6;26584:12;;:16;;:24;;;;:::i;:::-;26569:12;:39;;;;26650:1;26624:37;;26633:7;26624:37;;;26654:6;26624:37;;;;;;:::i;:::-;;;;;;;;26251:418;;:::o;9370:132::-;9428:7;9455:39;9459:1;9462;9455:39;;;;;;;;;;;;;;;;;:3;:39::i;:::-;9448:46;;9370:132;;;;:::o;25541:378::-;25644:1;25625:21;;:7;:21;;;;25617:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;25695:49;25724:1;25728:7;25737:6;25695:20;:49::i;:::-;25772:24;25789:6;25772:12;;:16;;:24;;;;:::i;:::-;25757:12;:39;;;;25828:30;25851:6;25828:9;:18;25838:7;25828:18;;;;;;;;;;;;;;;;:22;;:30;;;;:::i;:::-;25807:9;:18;25817:7;25807:18;;;;;;;;;;;;;;;:51;;;;25895:7;25874:37;;25891:1;25874:37;;;25904:6;25874:37;;;;;;:::i;:::-;;;;;;;;25541:378;;:::o;24721:539::-;24845:1;24827:20;;:6;:20;;;;24819:70;;;;;;;;;;;;:::i;:::-;;;;;;;;;24929:1;24908:23;;:9;:23;;;;24900:71;;;;;;;;;;;;:::i;:::-;;;;;;;;;24984:47;25005:6;25013:9;25024:6;24984:20;:47::i;:::-;25064:71;25086:6;25064:71;;;;;;;;;;;;;;;;;:9;:17;25074:6;25064:17;;;;;;;;;;;;;;;;:21;;:71;;;;;:::i;:::-;25044:9;:17;25054:6;25044:17;;;;;;;;;;;;;;;:91;;;;25169:32;25194:6;25169:9;:20;25179:9;25169:20;;;;;;;;;;;;;;;;:24;;:32;;;;:::i;:::-;25146:9;:20;25156:9;25146:20;;;;;;;;;;;;;;;:55;;;;25234:9;25217:35;;25226:6;25217:35;;;25245:6;25217:35;;;;;;:::i;:::-;;;;;;;;24721:539;;;:::o;7972:192::-;8058:7;8091:1;8086;:6;;8094:12;8078:29;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;8118:9;8134:1;8130;:5;8118:17;;8155:1;8148:8;;;7972:192;;;;;:::o;7069:181::-;7127:7;7147:9;7163:1;7159;:5;7147:17;;7188:1;7183;:6;;7175:46;;;;;;;;;;;;:::i;:::-;;;;;;;;;7241:1;7234:8;;;7069:181;;;;:::o;36285:466::-;36431:20;36453:18;36480;36510:13;36501:5;:22;:82;;36541:42;36569:13;36541:23;36551:12;36541:5;:9;;:23;;;;:::i;:::-;:27;;:42;;;;:::i;:::-;36501:82;;;36526:12;36501:82;36480:103;;36603:59;36628:33;36646:14;36636:4;36628:17;;:33;;;;:::i;:::-;36603:20;36618:4;36603:10;:14;;:20;;;;:::i;:::-;:24;;:59;;;;:::i;:::-;36588:74;;36680:28;36697:10;36680:12;:16;;:28;;;;:::i;:::-;36667:41;;36713:33;36285:466;;;;;;;:::o;143515:440::-;143693:23;143718:18;143745:13;143785:90;143822:10;143834:13;143849:12;143863:11;143785:36;:90::i;:::-;143763:112;;;;;;;;143888:49;143916:5;143923:13;143888:27;:49::i;:::-;143880:70;;;143515:440;;;;;;;;:::o;144182:421::-;144371:20;144393:18;144420:13;144436:59;144464:15;144481:13;144436:27;:59::i;:::-;144420:75;;144507:91;144547:5;144554:13;144569:12;144583:14;144507:39;:91::i;:::-;144500:98;;;;;144182:421;;;;;;;;:::o;142248:186::-;142356:13;142385:44;142415:13;142385:25;142405:4;142385:15;:19;;:25;;;;:::i;:::-;:29;;:44;;;;:::i;:::-;142378:51;;142248:186;;;;:::o;174944:123::-;175013:1;:11;175025;38525:42;175048:13;175013:49;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;174944:123;:::o;142887:407::-;143070:18;143090;143117:13;143133:59;143161:15;143178:13;143133:27;:59::i;:::-;143117:75;;143204:85;143241:5;143248:13;143263:12;143277:11;143204:36;:85::i;:::-;143197:92;;;;;142887:407;;;;;;;;:::o;7533:136::-;7591:7;7618:43;7622:1;7625;7618:43;;;;;;;;;;;;;;;;;:3;:43::i;:::-;7611:50;;7533:136;;;;:::o;204700:210::-;204823:13;204852:3;:21;;;;204874:6;204882:7;204891:4;204897:7;204852:53;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;204845:60;;204700:210;;;;;;:::o;34942:455::-;35082:18;35102;35129:20;35168:13;35152:12;:29;:82;;35192:42;35220:13;35192:23;35202:12;35192:5;:9;;:23;;;;:::i;:::-;:27;;:42;;;;:::i;:::-;35152:82;;;35184:5;35152:82;35129:105;;35252:58;35305:4;35252:48;35269:30;35287:11;35277:4;35269:17;;:30;;;;:::i;:::-;35252:12;:16;;:48;;;;:::i;:::-;:52;;:58;;;;:::i;:::-;35239:71;;35328:28;35345:10;35328:12;:16;;:28;;;;:::i;:::-;35315:41;;35361:31;34942:455;;;;;;;:::o;203290:167::-;203372:13;189232:19;;:21;;;;;;;;;;;;;203432:3:::1;:17;;;;203450:1;203432:20;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;203425:27;;189264:19:::0;;:21;;;;;;;;;;;;;;203290:167;;;:::o;35611:457::-;35756:13;35771:18;35798:20;35821:56;35846:30;35864:11;35854:4;35846:17;;:30;;;;:::i;:::-;35821:20;35836:4;35821:10;:14;;:20;;;;:::i;:::-;:24;;:56;;;;:::i;:::-;35798:79;;35907:12;35890:13;:29;:96;;35937:49;35973:12;35937:31;35954:13;35937:12;:16;;:31;;;;:::i;:::-;:35;;:49;;;;:::i;:::-;35890:96;;;35922:12;35890:96;35882:104;;36004:28;36021:10;36004:12;:16;;:28;;;;:::i;:::-;35991:41;;36037:26;35611:457;;;;;;;:::o;8423:471::-;8481:7;8731:1;8726;:6;8722:47;;;8756:1;8749:8;;;;8722:47;8781:9;8797:1;8793;:5;8781:17;;8826:1;8821;8817;:5;;;;;;:10;8809:56;;;;;;;;;;;;:::i;:::-;;;;;;;;;8885:1;8878:8;;;8423:471;;;;;:::o;28478:92::-;;;;:::o;9998:278::-;10084:7;10116:1;10112;:5;10119:12;10104:28;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;10143:9;10159:1;10155;:5;;;;;;10143:17;;10267:1;10260:8;;;9998:278;;;;;:::o;5:130:-1:-;;85:6;72:20;63:29;;97:33;124:5;97:33;:::i;:::-;57:78;;;;:::o;142:134::-;;226:6;220:13;211:22;;238:33;265:5;238:33;:::i;:::-;205:71;;;;:::o;283:150::-;;375:6;369:13;360:22;;387:41;422:5;387:41;:::i;:::-;354:79;;;;:::o;440:128::-;;521:6;515:13;506:22;;533:30;557:5;533:30;:::i;:::-;500:68;;;;:::o;589:336::-;;;703:3;696:4;688:6;684:17;680:27;670:2;;721:1;718;711:12;670:2;754:6;741:20;731:30;;781:18;773:6;770:30;767:2;;;813:1;810;803:12;767:2;847:4;839:6;835:17;823:29;;898:3;890:4;882:6;878:17;868:8;864:32;861:41;858:2;;;915:1;912;905:12;858:2;663:262;;;;;:::o;934:440::-;;1035:3;1028:4;1020:6;1016:17;1012:27;1002:2;;1053:1;1050;1043:12;1002:2;1090:6;1077:20;1112:64;1127:48;1168:6;1127:48;:::i;:::-;1112:64;:::i;:::-;1103:73;;1196:6;1189:5;1182:21;1232:4;1224:6;1220:17;1265:4;1258:5;1254:16;1300:3;1291:6;1286:3;1282:16;1279:25;1276:2;;;1317:1;1314;1307:12;1276:2;1327:41;1361:6;1356:3;1351;1327:41;:::i;:::-;995:379;;;;;;;:::o;1383:442::-;;1495:3;1488:4;1480:6;1476:17;1472:27;1462:2;;1513:1;1510;1503:12;1462:2;1543:6;1537:13;1565:64;1580:48;1621:6;1580:48;:::i;:::-;1565:64;:::i;:::-;1556:73;;1649:6;1642:5;1635:21;1685:4;1677:6;1673:17;1718:4;1711:5;1707:16;1753:3;1744:6;1739:3;1735:16;1732:25;1729:2;;;1770:1;1767;1760:12;1729:2;1780:39;1812:6;1807:3;1802;1780:39;:::i;:::-;1455:370;;;;;;;:::o;1859:467::-;;1970:4;1958:9;1953:3;1949:19;1945:30;1942:2;;;1988:1;1985;1978:12;1942:2;2006:20;2021:4;2006:20;:::i;:::-;1997:29;;2077:1;2109:49;2154:3;2145:6;2134:9;2130:22;2109:49;:::i;:::-;2102:4;2095:5;2091:16;2084:75;2036:134;2222:2;2255:49;2300:3;2291:6;2280:9;2276:22;2255:49;:::i;:::-;2248:4;2241:5;2237:16;2230:75;2180:136;1936:390;;;;:::o;2333:130::-;;2413:6;2400:20;2391:29;;2425:33;2452:5;2425:33;:::i;:::-;2385:78;;;;:::o;2470:134::-;;2554:6;2548:13;2539:22;;2566:33;2593:5;2566:33;:::i;:::-;2533:71;;;;:::o;2611:241::-;;2715:2;2703:9;2694:7;2690:23;2686:32;2683:2;;;2731:1;2728;2721:12;2683:2;2766:1;2783:53;2828:7;2819:6;2808:9;2804:22;2783:53;:::i;:::-;2773:63;;2745:97;2677:175;;;;:::o;2859:263::-;;2974:2;2962:9;2953:7;2949:23;2945:32;2942:2;;;2990:1;2987;2980:12;2942:2;3025:1;3042:64;3098:7;3089:6;3078:9;3074:22;3042:64;:::i;:::-;3032:74;;3004:108;2936:186;;;;:::o;3129:785::-;;;;;3312:3;3300:9;3291:7;3287:23;3283:33;3280:2;;;3329:1;3326;3319:12;3280:2;3364:1;3381:72;3445:7;3436:6;3425:9;3421:22;3381:72;:::i;:::-;3371:82;;3343:116;3490:2;3508:64;3564:7;3555:6;3544:9;3540:22;3508:64;:::i;:::-;3498:74;;3469:109;3609:2;3627:64;3683:7;3674:6;3663:9;3659:22;3627:64;:::i;:::-;3617:74;;3588:109;3749:2;3738:9;3734:18;3728:25;3773:18;3765:6;3762:30;3759:2;;;3805:1;3802;3795:12;3759:2;3825:73;3890:7;3881:6;3870:9;3866:22;3825:73;:::i;:::-;3815:83;;3707:197;3274:640;;;;;;;:::o;3921:366::-;;;4042:2;4030:9;4021:7;4017:23;4013:32;4010:2;;;4058:1;4055;4048:12;4010:2;4093:1;4110:53;4155:7;4146:6;4135:9;4131:22;4110:53;:::i;:::-;4100:63;;4072:97;4200:2;4218:53;4263:7;4254:6;4243:9;4239:22;4218:53;:::i;:::-;4208:63;;4179:98;4004:283;;;;;:::o;4294:491::-;;;;4432:2;4420:9;4411:7;4407:23;4403:32;4400:2;;;4448:1;4445;4438:12;4400:2;4483:1;4500:53;4545:7;4536:6;4525:9;4521:22;4500:53;:::i;:::-;4490:63;;4462:97;4590:2;4608:53;4653:7;4644:6;4633:9;4629:22;4608:53;:::i;:::-;4598:63;;4569:98;4698:2;4716:53;4761:7;4752:6;4741:9;4737:22;4716:53;:::i;:::-;4706:63;;4677:98;4394:391;;;;;:::o;4792:640::-;;;;4961:3;4949:9;4940:7;4936:23;4932:33;4929:2;;;4978:1;4975;4968:12;4929:2;5013:1;5030:53;5075:7;5066:6;5055:9;5051:22;5030:53;:::i;:::-;5020:63;;4992:97;5120:2;5138:75;5205:7;5196:6;5185:9;5181:22;5138:75;:::i;:::-;5128:85;;5099:120;5278:2;5267:9;5263:18;5250:32;5302:18;5294:6;5291:30;5288:2;;;5334:1;5331;5324:12;5288:2;5354:62;5408:7;5399:6;5388:9;5384:22;5354:62;:::i;:::-;5344:72;;5229:193;4923:509;;;;;:::o;5439:366::-;;;5560:2;5548:9;5539:7;5535:23;5531:32;5528:2;;;5576:1;5573;5566:12;5528:2;5611:1;5628:53;5673:7;5664:6;5653:9;5649:22;5628:53;:::i;:::-;5618:63;;5590:97;5718:2;5736:53;5781:7;5772:6;5761:9;5757:22;5736:53;:::i;:::-;5726:63;;5697:98;5522:283;;;;;:::o;5812:535::-;;;;5961:2;5949:9;5940:7;5936:23;5932:32;5929:2;;;5977:1;5974;5967:12;5929:2;6012:1;6029:64;6085:7;6076:6;6065:9;6061:22;6029:64;:::i;:::-;6019:74;;5991:108;6130:2;6148:64;6204:7;6195:6;6184:9;6180:22;6148:64;:::i;:::-;6138:74;;6109:109;6249:2;6267:64;6323:7;6314:6;6303:9;6299:22;6267:64;:::i;:::-;6257:74;;6228:109;5923:424;;;;;:::o;6354:741::-;;;;;;6528:3;6516:9;6507:7;6503:23;6499:33;6496:2;;;6545:1;6542;6535:12;6496:2;6580:1;6597:53;6642:7;6633:6;6622:9;6618:22;6597:53;:::i;:::-;6587:63;;6559:97;6687:2;6705:53;6750:7;6741:6;6730:9;6726:22;6705:53;:::i;:::-;6695:63;;6666:98;6795:2;6813:53;6858:7;6849:6;6838:9;6834:22;6813:53;:::i;:::-;6803:63;;6774:98;6931:2;6920:9;6916:18;6903:32;6955:18;6947:6;6944:30;6941:2;;;6987:1;6984;6977:12;6941:2;7015:64;7071:7;7062:6;7051:9;7047:22;7015:64;:::i;:::-;6997:82;;;;6882:203;6490:605;;;;;;;;:::o;7102:257::-;;7214:2;7202:9;7193:7;7189:23;7185:32;7182:2;;;7230:1;7227;7220:12;7182:2;7265:1;7282:61;7335:7;7326:6;7315:9;7311:22;7282:61;:::i;:::-;7272:71;;7244:105;7176:183;;;;:::o;7366:241::-;;7470:2;7458:9;7449:7;7445:23;7441:32;7438:2;;;7486:1;7483;7476:12;7438:2;7521:1;7538:53;7583:7;7574:6;7563:9;7559:22;7538:53;:::i;:::-;7528:63;;7500:97;7432:175;;;;:::o;7614:263::-;;7729:2;7717:9;7708:7;7704:23;7700:32;7697:2;;;7745:1;7742;7735:12;7697:2;7780:1;7797:64;7853:7;7844:6;7833:9;7829:22;7797:64;:::i;:::-;7787:74;;7759:108;7691:186;;;;:::o;7884:366::-;;;8005:2;7993:9;7984:7;7980:23;7976:32;7973:2;;;8021:1;8018;8011:12;7973:2;8056:1;8073:53;8118:7;8109:6;8098:9;8094:22;8073:53;:::i;:::-;8063:63;;8035:97;8163:2;8181:53;8226:7;8217:6;8206:9;8202:22;8181:53;:::i;:::-;8171:63;;8142:98;7967:283;;;;;:::o;8257:399::-;;;8389:2;8377:9;8368:7;8364:23;8360:32;8357:2;;;8405:1;8402;8395:12;8357:2;8440:1;8457:64;8513:7;8504:6;8493:9;8489:22;8457:64;:::i;:::-;8447:74;;8419:108;8558:2;8576:64;8632:7;8623:6;8612:9;8608:22;8576:64;:::i;:::-;8566:74;;8537:109;8351:305;;;;;:::o;8663:617::-;;;;;8818:3;8806:9;8797:7;8793:23;8789:33;8786:2;;;8835:1;8832;8825:12;8786:2;8870:1;8887:53;8932:7;8923:6;8912:9;8908:22;8887:53;:::i;:::-;8877:63;;8849:97;8977:2;8995:53;9040:7;9031:6;9020:9;9016:22;8995:53;:::i;:::-;8985:63;;8956:98;9085:2;9103:53;9148:7;9139:6;9128:9;9124:22;9103:53;:::i;:::-;9093:63;;9064:98;9193:2;9211:53;9256:7;9247:6;9236:9;9232:22;9211:53;:::i;:::-;9201:63;;9172:98;8780:500;;;;;;;:::o;9287:743::-;;;;;;9459:3;9447:9;9438:7;9434:23;9430:33;9427:2;;;9476:1;9473;9466:12;9427:2;9511:1;9528:53;9573:7;9564:6;9553:9;9549:22;9528:53;:::i;:::-;9518:63;;9490:97;9618:2;9636:53;9681:7;9672:6;9661:9;9657:22;9636:53;:::i;:::-;9626:63;;9597:98;9726:2;9744:53;9789:7;9780:6;9769:9;9765:22;9744:53;:::i;:::-;9734:63;;9705:98;9834:2;9852:53;9897:7;9888:6;9877:9;9873:22;9852:53;:::i;:::-;9842:63;;9813:98;9942:3;9961:53;10006:7;9997:6;9986:9;9982:22;9961:53;:::i;:::-;9951:63;;9921:99;9421:609;;;;;;;;:::o;10037:113::-;10120:24;10138:5;10120:24;:::i;:::-;10115:3;10108:37;10102:48;;:::o;10157:121::-;10248:24;10266:5;10248:24;:::i;:::-;10243:3;10236:37;10230:48;;:::o;10285:104::-;10362:21;10377:5;10362:21;:::i;:::-;10357:3;10350:34;10344:45;;:::o;10396:359::-;;10514:38;10546:5;10514:38;:::i;:::-;10564:78;10635:6;10630:3;10564:78;:::i;:::-;10557:85;;10647:52;10692:6;10687:3;10680:4;10673:5;10669:16;10647:52;:::i;:::-;10720:29;10742:6;10720:29;:::i;:::-;10715:3;10711:39;10704:46;;10494:261;;;;;:::o;10762:156::-;10864:48;10906:5;10864:48;:::i;:::-;10859:3;10852:61;10846:72;;:::o;10925:150::-;11024:45;11063:5;11024:45;:::i;:::-;11019:3;11012:58;11006:69;;:::o;11082:347::-;;11194:39;11227:5;11194:39;:::i;:::-;11245:71;11309:6;11304:3;11245:71;:::i;:::-;11238:78;;11321:52;11366:6;11361:3;11354:4;11347:5;11343:16;11321:52;:::i;:::-;11394:29;11416:6;11394:29;:::i;:::-;11389:3;11385:39;11378:46;;11174:255;;;;;:::o;11437:372::-;;11597:67;11661:2;11656:3;11597:67;:::i;:::-;11590:74;;11697:34;11693:1;11688:3;11684:11;11677:55;11766:5;11761:2;11756:3;11752:12;11745:27;11800:2;11795:3;11791:12;11784:19;;11583:226;;;:::o;11818:375::-;;11978:67;12042:2;12037:3;11978:67;:::i;:::-;11971:74;;12078:34;12074:1;12069:3;12065:11;12058:55;12147:8;12142:2;12137:3;12133:12;12126:30;12184:2;12179:3;12175:12;12168:19;;11964:229;;;:::o;12202:371::-;;12362:67;12426:2;12421:3;12362:67;:::i;:::-;12355:74;;12462:34;12458:1;12453:3;12449:11;12442:55;12531:4;12526:2;12521:3;12517:12;12510:26;12564:2;12559:3;12555:12;12548:19;;12348:225;;;:::o;12582:329::-;;12742:67;12806:2;12801:3;12742:67;:::i;:::-;12735:74;;12842:31;12838:1;12833:3;12829:11;12822:52;12902:2;12897:3;12893:12;12886:19;;12728:183;;;:::o;12920:327::-;;13080:67;13144:2;13139:3;13080:67;:::i;:::-;13073:74;;13180:29;13176:1;13171:3;13167:11;13160:50;13238:2;13233:3;13229:12;13222:19;;13066:181;;;:::o;13256:327::-;;13416:67;13480:2;13475:3;13416:67;:::i;:::-;13409:74;;13516:29;13512:1;13507:3;13503:11;13496:50;13574:2;13569:3;13565:12;13558:19;;13402:181;;;:::o;13592:370::-;;13752:67;13816:2;13811:3;13752:67;:::i;:::-;13745:74;;13852:34;13848:1;13843:3;13839:11;13832:55;13921:3;13916:2;13911:3;13907:12;13900:25;13953:2;13948:3;13944:12;13937:19;;13738:224;;;:::o;13971:332::-;;14131:67;14195:2;14190:3;14131:67;:::i;:::-;14124:74;;14231:34;14227:1;14222:3;14218:11;14211:55;14294:2;14289:3;14285:12;14278:19;;14117:186;;;:::o;14312:370::-;;14472:67;14536:2;14531:3;14472:67;:::i;:::-;14465:74;;14572:34;14568:1;14563:3;14559:11;14552:55;14641:3;14636:2;14631:3;14627:12;14620:25;14673:2;14668:3;14664:12;14657:19;;14458:224;;;:::o;14691:374::-;;14851:67;14915:2;14910:3;14851:67;:::i;:::-;14844:74;;14951:34;14947:1;14942:3;14938:11;14931:55;15020:7;15015:2;15010:3;15006:12;14999:29;15056:2;15051:3;15047:12;15040:19;;14837:228;;;:::o;15074:373::-;;15234:67;15298:2;15293:3;15234:67;:::i;:::-;15227:74;;15334:34;15330:1;15325:3;15321:11;15314:55;15403:6;15398:2;15393:3;15389:12;15382:28;15438:2;15433:3;15429:12;15422:19;;15220:227;;;:::o;15456:327::-;;15616:67;15680:2;15675:3;15616:67;:::i;:::-;15609:74;;15716:29;15712:1;15707:3;15703:11;15696:50;15774:2;15769:3;15765:12;15758:19;;15602:181;;;:::o;15792:331::-;;15952:67;16016:2;16011:3;15952:67;:::i;:::-;15945:74;;16052:33;16048:1;16043:3;16039:11;16032:54;16114:2;16109:3;16105:12;16098:19;;15938:185;;;:::o;16132:375::-;;16292:67;16356:2;16351:3;16292:67;:::i;:::-;16285:74;;16392:34;16388:1;16383:3;16379:11;16372:55;16461:8;16456:2;16451:3;16447:12;16440:30;16498:2;16493:3;16489:12;16482:19;;16278:229;;;:::o;16516:331::-;;16676:67;16740:2;16735:3;16676:67;:::i;:::-;16669:74;;16776:33;16772:1;16767:3;16763:11;16756:54;16838:2;16833:3;16829:12;16822:19;;16662:185;;;:::o;16855:125::-;16969:5;16964:3;16957:18;16951:29;;:::o;16987:125::-;17101:5;17096:3;17089:18;17083:29;;:::o;17119:113::-;17202:24;17220:5;17202:24;:::i;:::-;17197:3;17190:37;17184:48;;:::o;17239:121::-;17330:24;17348:5;17330:24;:::i;:::-;17325:3;17318:37;17312:48;;:::o;17367:107::-;17446:22;17462:5;17446:22;:::i;:::-;17441:3;17434:35;17428:46;;:::o;17481:238::-;;17616:2;17605:9;17601:18;17593:26;;17630:79;17706:1;17695:9;17691:17;17682:6;17630:79;:::i;:::-;17587:132;;;;:::o;17726:222::-;;17853:2;17842:9;17838:18;17830:26;;17867:71;17935:1;17924:9;17920:17;17911:6;17867:71;:::i;:::-;17824:124;;;;:::o;17955:476::-;;18146:2;18135:9;18131:18;18123:26;;18160:79;18236:1;18225:9;18221:17;18212:6;18160:79;:::i;:::-;18250:80;18326:2;18315:9;18311:18;18302:6;18250:80;:::i;:::-;18341;18417:2;18406:9;18402:18;18393:6;18341:80;:::i;:::-;18117:314;;;;;;:::o;18438:357::-;;18601:2;18590:9;18586:18;18578:26;;18615:79;18691:1;18680:9;18676:17;18667:6;18615:79;:::i;:::-;18705:80;18781:2;18770:9;18766:18;18757:6;18705:80;:::i;:::-;18572:223;;;;;:::o;18802:210::-;;18923:2;18912:9;18908:18;18900:26;;18937:65;18999:1;18988:9;18984:17;18975:6;18937:65;:::i;:::-;18894:118;;;;:::o;19019:498::-;;19221:2;19210:9;19206:18;19198:26;;19235:90;19322:1;19311:9;19307:17;19298:6;19235:90;:::i;:::-;19336:80;19412:2;19401:9;19397:18;19388:6;19336:80;:::i;:::-;19427;19503:2;19492:9;19488:18;19479:6;19427:80;:::i;:::-;19192:325;;;;;;:::o;19524:310::-;;19671:2;19660:9;19656:18;19648:26;;19721:9;19715:4;19711:20;19707:1;19696:9;19692:17;19685:47;19746:78;19819:4;19810:6;19746:78;:::i;:::-;19738:86;;19642:192;;;;:::o;19841:416::-;;20041:2;20030:9;20026:18;20018:26;;20091:9;20085:4;20081:20;20077:1;20066:9;20062:17;20055:47;20116:131;20242:4;20116:131;:::i;:::-;20108:139;;20012:245;;;:::o;20264:416::-;;20464:2;20453:9;20449:18;20441:26;;20514:9;20508:4;20504:20;20500:1;20489:9;20485:17;20478:47;20539:131;20665:4;20539:131;:::i;:::-;20531:139;;20435:245;;;:::o;20687:416::-;;20887:2;20876:9;20872:18;20864:26;;20937:9;20931:4;20927:20;20923:1;20912:9;20908:17;20901:47;20962:131;21088:4;20962:131;:::i;:::-;20954:139;;20858:245;;;:::o;21110:416::-;;21310:2;21299:9;21295:18;21287:26;;21360:9;21354:4;21350:20;21346:1;21335:9;21331:17;21324:47;21385:131;21511:4;21385:131;:::i;:::-;21377:139;;21281:245;;;:::o;21533:416::-;;21733:2;21722:9;21718:18;21710:26;;21783:9;21777:4;21773:20;21769:1;21758:9;21754:17;21747:47;21808:131;21934:4;21808:131;:::i;:::-;21800:139;;21704:245;;;:::o;21956:416::-;;22156:2;22145:9;22141:18;22133:26;;22206:9;22200:4;22196:20;22192:1;22181:9;22177:17;22170:47;22231:131;22357:4;22231:131;:::i;:::-;22223:139;;22127:245;;;:::o;22379:416::-;;22579:2;22568:9;22564:18;22556:26;;22629:9;22623:4;22619:20;22615:1;22604:9;22600:17;22593:47;22654:131;22780:4;22654:131;:::i;:::-;22646:139;;22550:245;;;:::o;22802:416::-;;23002:2;22991:9;22987:18;22979:26;;23052:9;23046:4;23042:20;23038:1;23027:9;23023:17;23016:47;23077:131;23203:4;23077:131;:::i;:::-;23069:139;;22973:245;;;:::o;23225:416::-;;23425:2;23414:9;23410:18;23402:26;;23475:9;23469:4;23465:20;23461:1;23450:9;23446:17;23439:47;23500:131;23626:4;23500:131;:::i;:::-;23492:139;;23396:245;;;:::o;23648:416::-;;23848:2;23837:9;23833:18;23825:26;;23898:9;23892:4;23888:20;23884:1;23873:9;23869:17;23862:47;23923:131;24049:4;23923:131;:::i;:::-;23915:139;;23819:245;;;:::o;24071:416::-;;24271:2;24260:9;24256:18;24248:26;;24321:9;24315:4;24311:20;24307:1;24296:9;24292:17;24285:47;24346:131;24472:4;24346:131;:::i;:::-;24338:139;;24242:245;;;:::o;24494:416::-;;24694:2;24683:9;24679:18;24671:26;;24744:9;24738:4;24734:20;24730:1;24719:9;24715:17;24708:47;24769:131;24895:4;24769:131;:::i;:::-;24761:139;;24665:245;;;:::o;24917:416::-;;25117:2;25106:9;25102:18;25094:26;;25167:9;25161:4;25157:20;25153:1;25142:9;25138:17;25131:47;25192:131;25318:4;25192:131;:::i;:::-;25184:139;;25088:245;;;:::o;25340:416::-;;25540:2;25529:9;25525:18;25517:26;;25590:9;25584:4;25580:20;25576:1;25565:9;25561:17;25554:47;25615:131;25741:4;25615:131;:::i;:::-;25607:139;;25511:245;;;:::o;25763:416::-;;25963:2;25952:9;25948:18;25940:26;;26013:9;26007:4;26003:20;25999:1;25988:9;25984:17;25977:47;26038:131;26164:4;26038:131;:::i;:::-;26030:139;;25934:245;;;:::o;26186:284::-;;26344:2;26333:9;26329:18;26321:26;;26358:102;26457:1;26446:9;26442:17;26433:6;26358:102;:::i;:::-;26315:155;;;;:::o;26477:403::-;;26663:2;26652:9;26648:18;26640:26;;26677:102;26776:1;26765:9;26761:17;26752:6;26677:102;:::i;:::-;26790:80;26866:2;26855:9;26851:18;26842:6;26790:80;:::i;:::-;26634:246;;;;;:::o;26887:403::-;;27073:2;27062:9;27058:18;27050:26;;27087:102;27186:1;27175:9;27171:17;27162:6;27087:102;:::i;:::-;27200:80;27276:2;27265:9;27261:18;27252:6;27200:80;:::i;:::-;27044:246;;;;;:::o;27297:522::-;;27511:2;27500:9;27496:18;27488:26;;27525:102;27624:1;27613:9;27609:17;27600:6;27525:102;:::i;:::-;27638:80;27714:2;27703:9;27699:18;27690:6;27638:80;:::i;:::-;27729;27805:2;27794:9;27790:18;27781:6;27729:80;:::i;:::-;27482:337;;;;;;:::o;27826:403::-;;28012:2;28001:9;27997:18;27989:26;;28026:102;28125:1;28114:9;28110:17;28101:6;28026:102;:::i;:::-;28139:80;28215:2;28204:9;28200:18;28191:6;28139:80;:::i;:::-;27983:246;;;;;:::o;28236:846::-;;28524:3;28513:9;28509:19;28501:27;;28539:102;28638:1;28627:9;28623:17;28614:6;28539:102;:::i;:::-;28652:80;28728:2;28717:9;28713:18;28704:6;28652:80;:::i;:::-;28743;28819:2;28808:9;28804:18;28795:6;28743:80;:::i;:::-;28834;28910:2;28899:9;28895:18;28886:6;28834:80;:::i;:::-;28963:9;28957:4;28953:20;28947:3;28936:9;28932:19;28925:49;28988:84;29067:4;29058:6;28988:84;:::i;:::-;28980:92;;28495:587;;;;;;;;:::o;29089:419::-;;29283:2;29272:9;29268:18;29260:26;;29297:102;29396:1;29385:9;29381:17;29372:6;29297:102;:::i;:::-;29410:88;29494:2;29483:9;29479:18;29470:6;29410:88;:::i;:::-;29254:254;;;;;:::o;29515:403::-;;29701:2;29690:9;29686:18;29678:26;;29715:102;29814:1;29803:9;29799:17;29790:6;29715:102;:::i;:::-;29828:80;29904:2;29893:9;29889:18;29880:6;29828:80;:::i;:::-;29672:246;;;;;:::o;29925:522::-;;30139:2;30128:9;30124:18;30116:26;;30153:102;30252:1;30241:9;30237:17;30228:6;30153:102;:::i;:::-;30266:80;30342:2;30331:9;30327:18;30318:6;30266:80;:::i;:::-;30357;30433:2;30422:9;30418:18;30409:6;30357:80;:::i;:::-;30110:337;;;;;;:::o;30454:222::-;;30581:2;30570:9;30566:18;30558:26;;30595:71;30663:1;30652:9;30648:17;30639:6;30595:71;:::i;:::-;30552:124;;;;:::o;30683:357::-;;30846:2;30835:9;30831:18;30823:26;;30860:79;30936:1;30925:9;30921:17;30912:6;30860:79;:::i;:::-;30950:80;31026:2;31015:9;31011:18;31002:6;30950:80;:::i;:::-;30817:223;;;;;:::o;31047:333::-;;31202:2;31191:9;31187:18;31179:26;;31216:71;31284:1;31273:9;31269:17;31260:6;31216:71;:::i;:::-;31298:72;31366:2;31355:9;31351:18;31342:6;31298:72;:::i;:::-;31173:207;;;;;:::o;31387:214::-;;31510:2;31499:9;31495:18;31487:26;;31524:67;31588:1;31577:9;31573:17;31564:6;31524:67;:::i;:::-;31481:120;;;;:::o;31608:256::-;;31670:2;31664:9;31654:19;;31708:4;31700:6;31696:17;31807:6;31795:10;31792:22;31771:18;31759:10;31756:34;31753:62;31750:2;;;31828:1;31825;31818:12;31750:2;31848:10;31844:2;31837:22;31648:216;;;;:::o;31871:321::-;;32014:18;32006:6;32003:30;32000:2;;;32046:1;32043;32036:12;32000:2;32113:4;32109:9;32102:4;32094:6;32090:17;32086:33;32078:41;;32177:4;32171;32167:15;32159:23;;31937:255;;;:::o;32199:121::-;;32292:5;32286:12;32276:22;;32257:63;;;:::o;32327:122::-;;32421:5;32415:12;32405:22;;32386:63;;;:::o;32457:170::-;;32579:6;32574:3;32567:19;32616:4;32611:3;32607:14;32592:29;;32560:67;;;;:::o;32636:163::-;;32751:6;32746:3;32739:19;32788:4;32783:3;32779:14;32764:29;;32732:67;;;;:::o;32807:91::-;;32869:24;32887:5;32869:24;:::i;:::-;32858:35;;32852:46;;;:::o;32905:99::-;;32975:24;32993:5;32975:24;:::i;:::-;32964:35;;32958:46;;;:::o;33011:85::-;;33084:5;33077:13;33070:21;33059:32;;33053:43;;;:::o;33103:132::-;;33178:5;33167:16;;33184:46;33224:5;33184:46;:::i;:::-;33161:74;;;:::o;33242:121::-;;33315:42;33308:5;33304:54;33293:65;;33287:76;;;:::o;33370:72::-;;33432:5;33421:16;;33415:27;;;:::o;33449:81::-;;33520:4;33513:5;33509:16;33498:27;;33492:38;;;:::o;33537:132::-;;33627:37;33658:5;33627:37;:::i;:::-;33614:50;;33608:61;;;:::o;33676:116::-;;33763:24;33781:5;33763:24;:::i;:::-;33750:37;;33744:48;;;:::o;33800:145::-;33881:6;33876:3;33871;33858:30;33937:1;33928:6;33923:3;33919:16;33912:27;33851:94;;;:::o;33954:268::-;34019:1;34026:101;34040:6;34037:1;34034:13;34026:101;;;34116:1;34111:3;34107:11;34101:18;34097:1;34092:3;34088:11;34081:39;34062:2;34059:1;34055:10;34050:15;;34026:101;;;34142:6;34139:1;34136:13;34133:2;;;34207:1;34198:6;34193:3;34189:16;34182:27;34133:2;34003:219;;;;:::o;34230:97::-;;34318:2;34314:7;34309:2;34302:5;34298:14;34294:28;34284:38;;34278:49;;;:::o;34335:104::-;34417:1;34410:5;34407:12;34397:2;;34423:9;34397:2;34391:48;:::o;34446:117::-;34515:24;34533:5;34515:24;:::i;:::-;34508:5;34505:35;34495:2;;34554:1;34551;34544:12;34495:2;34489:74;:::o;34570:133::-;34647:32;34673:5;34647:32;:::i;:::-;34640:5;34637:43;34627:2;;34694:1;34691;34684:12;34627:2;34621:82;:::o;34710:111::-;34776:21;34791:5;34776:21;:::i;:::-;34769:5;34766:32;34756:2;;34812:1;34809;34802:12;34756:2;34750:71;:::o;34828:117::-;34897:24;34915:5;34897:24;:::i;:::-;34890:5;34887:35;34877:2;;34936:1;34933;34926:12;34877:2;34871:74;:::o
Swarm Source
ipfs://ed9b8ae9a6178013b2cf6f36b5149ac1d20315d1975778db56f1bfd461e45505
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.