Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 27 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw All Fro... | 12394265 | 1363 days ago | IN | 0 ETH | 0.02140992 | ||||
Deposit To Pool | 12332465 | 1373 days ago | IN | 0 ETH | 0.00547909 | ||||
Deposit To Pool | 12292715 | 1379 days ago | IN | 0 ETH | 0.00984379 | ||||
Deposit To Pool | 12249013 | 1386 days ago | IN | 0 ETH | 0.00975093 | ||||
Deposit To Pool | 12235455 | 1388 days ago | IN | 0 ETH | 0.01445433 | ||||
Deposit To Pool | 12091422 | 1410 days ago | IN | 0 ETH | 0.01714136 | ||||
Transfer Ownersh... | 12076858 | 1412 days ago | IN | 0 ETH | 0.00606333 | ||||
Deposit To Pool | 11954329 | 1431 days ago | IN | 0 ETH | 0.00843169 | ||||
Deposit To Pool | 11922369 | 1436 days ago | IN | 0 ETH | 0.01797526 | ||||
Deposit To Pool | 11908724 | 1438 days ago | IN | 0 ETH | 0.01593683 | ||||
Deposit To Pool | 11882850 | 1442 days ago | IN | 0 ETH | 0.017763 | ||||
Withdraw All | 11880902 | 1442 days ago | IN | 0 ETH | 0.00361337 | ||||
Deposit To Pool | 11877071 | 1443 days ago | IN | 0 ETH | 0.01677073 | ||||
Deposit To Pool | 11863145 | 1445 days ago | IN | 0 ETH | 0.015531 | ||||
Deposit To Pool | 11854269 | 1446 days ago | IN | 0 ETH | 0.00994843 | ||||
Deposit To Pool | 11851872 | 1447 days ago | IN | 0 ETH | 0.014136 | ||||
Deposit To Pool | 11844107 | 1448 days ago | IN | 0 ETH | 0.02010635 | ||||
Deposit To Pool | 11838978 | 1449 days ago | IN | 0 ETH | 0.011253 | ||||
Deposit To Pool | 11831232 | 1450 days ago | IN | 0 ETH | 0.01506211 | ||||
Deposit To Pool | 11824398 | 1451 days ago | IN | 0 ETH | 0.01924603 | ||||
Deposit To Pool | 11820045 | 1452 days ago | IN | 0 ETH | 0.02175919 | ||||
Deposit To Pool | 11819741 | 1452 days ago | IN | 0 ETH | 0.0230232 | ||||
Transfer Ownersh... | 11819263 | 1452 days ago | IN | 0 ETH | 0.00693396 | ||||
Set Fund Rebalan... | 11819260 | 1452 days ago | IN | 0 ETH | 0.01001961 | ||||
Set Aave Referra... | 11819259 | 1452 days ago | IN | 0 ETH | 0.00967262 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
12904645 | 1284 days ago | 269.60134584 ETH | ||||
12893788 | 1286 days ago | 0.69415347 ETH | ||||
12890764 | 1286 days ago | 19.36031573 ETH | ||||
12887365 | 1287 days ago | 0.19584724 ETH | ||||
12886508 | 1287 days ago | 0.22051277 ETH | ||||
12884478 | 1287 days ago | 4.6575234 ETH | ||||
12879507 | 1288 days ago | 3.89990749 ETH | ||||
12877709 | 1288 days ago | 3.12416372 ETH | ||||
12871799 | 1289 days ago | 0.04999999 ETH | ||||
12868315 | 1290 days ago | 0.05 ETH | ||||
12866899 | 1290 days ago | 1.16694704 ETH | ||||
12864914 | 1290 days ago | 0.77360709 ETH | ||||
12864061 | 1290 days ago | 14.88803055 ETH | ||||
12863470 | 1290 days ago | 0.15301083 ETH | ||||
12856358 | 1291 days ago | 1.09999999 ETH | ||||
12856276 | 1291 days ago | 1.1 ETH | ||||
12847095 | 1293 days ago | 0.06499999 ETH | ||||
12847034 | 1293 days ago | 0.065 ETH | ||||
12846267 | 1293 days ago | 1.17931591 ETH | ||||
12844572 | 1293 days ago | 2.99999999 ETH | ||||
12842712 | 1294 days ago | 3 ETH | ||||
12842618 | 1294 days ago | 0.85799201 ETH | ||||
12841747 | 1294 days ago | 0.4 ETH | ||||
12839054 | 1294 days ago | 1.28726593 ETH | ||||
12780765 | 1303 days ago | 27.25084937 ETH |
Loading...
Loading
This contract contains unverified libraries: DydxPoolController, CompoundPoolController, KeeperDaoPoolController, AavePoolController, AlphaPoolController, EnzymePoolController
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 Source Code Verified (Exact Match)
Contract Name:
RariFundController
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-02-14 */ // File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.5.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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts-ethereum-package/contracts/drafts/SignedSafeMath.sol pragma solidity ^0.5.0; /** * @title SignedSafeMath * @dev Signed math operations with safety checks that revert on error. */ library SignedSafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two signed integers, reverts on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // 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; } require(!(a == -1 && b == INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Integer division of two signed integers truncating the quotient, reverts on division by zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Subtracts two signed integers, reverts on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Adds two signed integers, reverts on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } } // File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol pragma solidity ^0.5.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. */ contract Context is Initializable { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol pragma solidity ^0.5.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. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */ contract Ownable is Initializable, Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); } /** * @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(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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-ethereum-package/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @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]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.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 ERC20;` 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)); } 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. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "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: @0x/contracts-utils/contracts/src/LibEIP712.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibEIP712 { // Hash of the EIP712 Domain Separator Schema // keccak256(abi.encodePacked( // "EIP712Domain(", // "string name,", // "string version,", // "uint256 chainId,", // "address verifyingContract", // ")" // )) bytes32 constant internal _EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; /// @dev Calculates a EIP712 domain separator. /// @param name The EIP712 domain name. /// @param version The EIP712 domain version. /// @param verifyingContract The EIP712 verifying contract. /// @return EIP712 domain separator. function hashEIP712Domain( string memory name, string memory version, uint256 chainId, address verifyingContract ) internal pure returns (bytes32 result) { bytes32 schemaHash = _EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH; // Assembly for more efficient computing: // keccak256(abi.encodePacked( // _EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH, // keccak256(bytes(name)), // keccak256(bytes(version)), // chainId, // uint256(verifyingContract) // )) assembly { // Calculate hashes of dynamic data let nameHash := keccak256(add(name, 32), mload(name)) let versionHash := keccak256(add(version, 32), mload(version)) // Load free memory pointer let memPtr := mload(64) // Store params in memory mstore(memPtr, schemaHash) mstore(add(memPtr, 32), nameHash) mstore(add(memPtr, 64), versionHash) mstore(add(memPtr, 96), chainId) mstore(add(memPtr, 128), verifyingContract) // Compute hash result := keccak256(memPtr, 160) } return result; } /// @dev Calculates EIP712 encoding for a hash struct with a given domain hash. /// @param eip712DomainHash Hash of the domain domain separator data, computed /// with getDomainHash(). /// @param hashStruct The EIP712 hash struct. /// @return EIP712 hash applied to the given EIP712 Domain. function hashEIP712Message(bytes32 eip712DomainHash, bytes32 hashStruct) internal pure returns (bytes32 result) { // Assembly for more efficient computing: // keccak256(abi.encodePacked( // EIP191_HEADER, // EIP712_DOMAIN_HASH, // hashStruct // )); assembly { // Load free memory pointer let memPtr := mload(64) mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash mstore(add(memPtr, 34), hashStruct) // Hash of struct // Compute hash result := keccak256(memPtr, 66) } return result; } } // File: @0x/contracts-exchange-libs/contracts/src/LibOrder.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibOrder { using LibOrder for Order; // Hash for the EIP712 Order Schema: // keccak256(abi.encodePacked( // "Order(", // "address makerAddress,", // "address takerAddress,", // "address feeRecipientAddress,", // "address senderAddress,", // "uint256 makerAssetAmount,", // "uint256 takerAssetAmount,", // "uint256 makerFee,", // "uint256 takerFee,", // "uint256 expirationTimeSeconds,", // "uint256 salt,", // "bytes makerAssetData,", // "bytes takerAssetData,", // "bytes makerFeeAssetData,", // "bytes takerFeeAssetData", // ")" // )) bytes32 constant internal _EIP712_ORDER_SCHEMA_HASH = 0xf80322eb8376aafb64eadf8f0d7623f22130fd9491a221e902b713cb984a7534; // A valid order remains fillable until it is expired, fully filled, or cancelled. // An order's status is unaffected by external factors, like account balances. enum OrderStatus { INVALID, // Default value INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount FILLABLE, // Order is fillable EXPIRED, // Order has already expired FULLY_FILLED, // Order is fully filled CANCELLED // Order has been cancelled } // solhint-disable max-line-length /// @dev Canonical order structure. struct Order { address makerAddress; // Address that created the order. address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. address feeRecipientAddress; // Address that will recieve fees when order is filled. address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods. uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. uint256 makerFee; // Fee paid to feeRecipient by maker when order is filled. uint256 takerFee; // Fee paid to feeRecipient by taker when order is filled. uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The leading bytes4 references the id of the asset proxy. bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The leading bytes4 references the id of the asset proxy. bytes makerFeeAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerFeeAsset. The leading bytes4 references the id of the asset proxy. bytes takerFeeAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerFeeAsset. The leading bytes4 references the id of the asset proxy. } // solhint-enable max-line-length /// @dev Order information returned by `getOrderInfo()`. struct OrderInfo { OrderStatus orderStatus; // Status that describes order's validity and fillability. bytes32 orderHash; // EIP712 typed data hash of the order (see LibOrder.getTypedDataHash). uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled. } /// @dev Calculates the EIP712 typed data hash of an order with a given domain separator. /// @param order The order structure. /// @return EIP712 typed data hash of the order. function getTypedDataHash(Order memory order, bytes32 eip712ExchangeDomainHash) internal pure returns (bytes32 orderHash) { orderHash = LibEIP712.hashEIP712Message( eip712ExchangeDomainHash, order.getStructHash() ); return orderHash; } /// @dev Calculates EIP712 hash of the order struct. /// @param order The order structure. /// @return EIP712 hash of the order struct. function getStructHash(Order memory order) internal pure returns (bytes32 result) { bytes32 schemaHash = _EIP712_ORDER_SCHEMA_HASH; bytes memory makerAssetData = order.makerAssetData; bytes memory takerAssetData = order.takerAssetData; bytes memory makerFeeAssetData = order.makerFeeAssetData; bytes memory takerFeeAssetData = order.takerFeeAssetData; // Assembly for more efficiently computing: // keccak256(abi.encodePacked( // EIP712_ORDER_SCHEMA_HASH, // uint256(order.makerAddress), // uint256(order.takerAddress), // uint256(order.feeRecipientAddress), // uint256(order.senderAddress), // order.makerAssetAmount, // order.takerAssetAmount, // order.makerFee, // order.takerFee, // order.expirationTimeSeconds, // order.salt, // keccak256(order.makerAssetData), // keccak256(order.takerAssetData), // keccak256(order.makerFeeAssetData), // keccak256(order.takerFeeAssetData) // )); assembly { // Assert order offset (this is an internal error that should never be triggered) if lt(order, 32) { invalid() } // Calculate memory addresses that will be swapped out before hashing let pos1 := sub(order, 32) let pos2 := add(order, 320) let pos3 := add(order, 352) let pos4 := add(order, 384) let pos5 := add(order, 416) // Backup let temp1 := mload(pos1) let temp2 := mload(pos2) let temp3 := mload(pos3) let temp4 := mload(pos4) let temp5 := mload(pos5) // Hash in place mstore(pos1, schemaHash) mstore(pos2, keccak256(add(makerAssetData, 32), mload(makerAssetData))) // store hash of makerAssetData mstore(pos3, keccak256(add(takerAssetData, 32), mload(takerAssetData))) // store hash of takerAssetData mstore(pos4, keccak256(add(makerFeeAssetData, 32), mload(makerFeeAssetData))) // store hash of makerFeeAssetData mstore(pos5, keccak256(add(takerFeeAssetData, 32), mload(takerFeeAssetData))) // store hash of takerFeeAssetData result := keccak256(pos1, 480) // Restore mstore(pos1, temp1) mstore(pos2, temp2) mstore(pos3, temp3) mstore(pos4, temp4) mstore(pos5, temp5) } return result; } } // File: @0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IERC20Token { // solhint-disable no-simple-event-func-name event Transfer( address indexed _from, address indexed _to, uint256 _value ); event Approval( address indexed _owner, address indexed _spender, uint256 _value ); /// @dev send `value` token to `to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return True if transfer was successful function transfer(address _to, uint256 _value) external returns (bool); /// @dev send `value` token to `to` from `from` on the condition it is approved by `from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return True if transfer was successful function transferFrom( address _from, address _to, uint256 _value ) external returns (bool); /// @dev `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Always true if the call has enough gas to complete execution function approve(address _spender, uint256 _value) external returns (bool); /// @dev Query total supply of token /// @return Total supply of token function totalSupply() external view returns (uint256); /// @param _owner The address from which the balance will be retrieved /// @return Balance of owner function balanceOf(address _owner) external view returns (uint256); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) external view returns (uint256); } // File: @0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IEtherToken is IERC20Token { function deposit() public payable; function withdraw(uint256 amount) public; } // File: contracts/external/dydx/lib/Account.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; /** * @title Account * @author dYdX * * Library of structs and functions that represent an account */ library Account { // Represents the unique key that specifies an account struct Info { address owner; // The address that owns the account uint256 number; // A nonce that allows a single address to control many accounts } } // File: contracts/external/dydx/lib/Types.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; /** * @title Types * @author dYdX * * Library for interacting with the basic structs used in Solo */ library Types { // ============ AssetAmount ============ enum AssetDenomination { Wei, // the amount is denominated in wei Par // the amount is denominated in par } enum AssetReference { Delta, // the amount is given as a delta from the current value Target // the amount is given as an exact number to end up at } struct AssetAmount { bool sign; // true if positive AssetDenomination denomination; AssetReference ref; uint256 value; } // ============ Par (Principal Amount) ============ // Individual principal amount for an account struct Par { bool sign; // true if positive uint128 value; } // ============ Wei (Token Amount) ============ // Individual token amount for an account struct Wei { bool sign; // true if positive uint256 value; } } // File: contracts/external/dydx/Getters.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; /** * @title Getters * @author dYdX * * Public read-only functions that allow transparency into the state of Solo */ contract Getters { using Types for Types.Par; /** * Get an account's summary for each market. * * @param account The account to query * @return The following values: * - The ERC20 token address for each market * - The account's principal value for each market * - The account's (supplied or borrowed) number of tokens for each market */ function getAccountBalances( Account.Info memory account ) public view returns ( address[] memory, Types.Par[] memory, Types.Wei[] memory ); } // File: contracts/external/dydx/lib/Actions.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; /** * @title Actions * @author dYdX * * Library that defines and parses valid Actions */ library Actions { // ============ Enums ============ enum ActionType { Deposit, // supply tokens Withdraw, // borrow tokens Transfer, // transfer balance between accounts Buy, // buy an amount of some token (externally) Sell, // sell an amount of some token (externally) Trade, // trade tokens against another account Liquidate, // liquidate an undercollateralized or expiring account Vaporize, // use excess tokens to zero-out a completely negative account Call // send arbitrary data to an address } // ============ Structs ============ /* * Arguments that are passed to Solo in an ordered list as part of a single operation. * Each ActionArgs has an actionType which specifies which action struct that this data will be * parsed into before being processed. */ struct ActionArgs { ActionType actionType; uint256 accountId; Types.AssetAmount amount; uint256 primaryMarketId; uint256 secondaryMarketId; address otherAddress; uint256 otherAccountId; bytes data; } } // File: contracts/external/dydx/Operation.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; /** * @title Operation * @author dYdX * * Primary public function for allowing users and contracts to manage accounts within Solo */ contract Operation { /** * The main entry-point to Solo that allows users and contracts to manage accounts. * Take one or more actions on one or more accounts. The msg.sender must be the owner or * operator of all accounts except for those being liquidated, vaporized, or traded with. * One call to operate() is considered a singular "operation". Account collateralization is * ensured only after the completion of the entire operation. * * @param accounts A list of all accounts that will be used in this operation. Cannot contain * duplicates. In each action, the relevant account will be referred-to by its * index in the list. * @param actions An ordered list of all actions that will be taken in this operation. The * actions will be processed in order. */ function operate( Account.Info[] memory accounts, Actions.ActionArgs[] memory actions ) public; } // File: contracts/external/dydx/SoloMargin.sol /* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.17; /** * @title SoloMargin * @author dYdX * * Main contract that inherits from other contracts */ contract SoloMargin is Getters, Operation { } // File: contracts/lib/pools/DydxPoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title DydxPoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @author Richter Brzeski <[email protected]> (https://github.com/richtermb) * @dev This library handles deposits to and withdrawals from dYdX liquidity pools. */ library DydxPoolController { using SafeMath for uint256; using SafeERC20 for IERC20; address constant private SOLO_MARGIN_CONTRACT = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e; SoloMargin constant private _soloMargin = SoloMargin(SOLO_MARGIN_CONTRACT); uint256 constant private WETH_MARKET_ID = 0; address constant private WETH_CONTRACT = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; IEtherToken constant private _weth = IEtherToken(WETH_CONTRACT); /** * @dev Returns the fund's balance of the specified currency in the dYdX pool. */ function getBalance() external view returns (uint256) { Account.Info memory account = Account.Info(address(this), 0); (, , Types.Wei[] memory weis) = _soloMargin.getAccountBalances(account); return weis[WETH_MARKET_ID].sign ? weis[WETH_MARKET_ID].value : 0; } /** * @dev Approves WETH to dYdX without spending gas on every deposit. * @param amount Amount of the WETH to approve to dYdX. */ function approve(uint256 amount) external { uint256 allowance = _weth.allowance(address(this), SOLO_MARGIN_CONTRACT); if (allowance == amount) return; if (amount > 0 && allowance > 0) _weth.approve(SOLO_MARGIN_CONTRACT, 0); _weth.approve(SOLO_MARGIN_CONTRACT, amount); } /** * @dev Deposits funds to the dYdX pool. Assumes that you have already approved >= the amount of WETH to dYdX. * @param amount The amount of ETH to be deposited. */ function deposit(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _weth.deposit.value(amount)(); Account.Info memory account = Account.Info(address(this), 0); Account.Info[] memory accounts = new Account.Info[](1); accounts[0] = account; Types.AssetAmount memory assetAmount = Types.AssetAmount(true, Types.AssetDenomination.Wei, Types.AssetReference.Delta, amount); bytes memory emptyData; Actions.ActionArgs memory action = Actions.ActionArgs( Actions.ActionType.Deposit, 0, assetAmount, WETH_MARKET_ID, 0, address(this), 0, emptyData ); Actions.ActionArgs[] memory actions = new Actions.ActionArgs[](1); actions[0] = action; _soloMargin.operate(accounts, actions); } /** * @dev Withdraws funds from the dYdX pool. * @param amount The amount of ETH to be withdrawn. */ function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); Account.Info memory account = Account.Info(address(this), 0); Account.Info[] memory accounts = new Account.Info[](1); accounts[0] = account; Types.AssetAmount memory assetAmount = Types.AssetAmount(false, Types.AssetDenomination.Wei, Types.AssetReference.Delta, amount); bytes memory emptyData; Actions.ActionArgs memory action = Actions.ActionArgs( Actions.ActionType.Withdraw, 0, assetAmount, WETH_MARKET_ID, 0, address(this), 0, emptyData ); Actions.ActionArgs[] memory actions = new Actions.ActionArgs[](1); actions[0] = action; _soloMargin.operate(accounts, actions); _weth.withdraw(amount); // Convert WETH to ETH } /** * @dev Withdraws all funds from the dYdX pool. */ function withdrawAll() external { Account.Info memory account = Account.Info(address(this), 0); Account.Info[] memory accounts = new Account.Info[](1); accounts[0] = account; Types.AssetAmount memory assetAmount = Types.AssetAmount(true, Types.AssetDenomination.Par, Types.AssetReference.Target, 0); bytes memory emptyData; Actions.ActionArgs memory action = Actions.ActionArgs( Actions.ActionType.Withdraw, 0, assetAmount, WETH_MARKET_ID, 0, address(this), 0, emptyData ); Actions.ActionArgs[] memory actions = new Actions.ActionArgs[](1); actions[0] = action; _soloMargin.operate(accounts, actions); _weth.withdraw(_weth.balanceOf(address(this))); // Convert WETH to ETH } } // File: contracts/external/compound/CEther.sol /** * Copyright 2020 Compound Labs, Inc. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ pragma solidity 0.5.17; /** * @title Compound's CEther Contract * @notice CToken which wraps Ether * @author Compound */ interface CEther { function mint() external payable; function redeem(uint redeemTokens) external returns (uint); function redeemUnderlying(uint redeemAmount) external returns (uint); function balanceOf(address account) external view returns (uint); function balanceOfUnderlying(address owner) external returns (uint); } // File: contracts/lib/pools/CompoundPoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title CompoundPoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @author Richter Brzeski <[email protected]> (https://github.com/richtermb) * @dev This library handles deposits to and withdrawals from Compound liquidity pools. */ library CompoundPoolController { using SafeMath for uint256; using SafeERC20 for IERC20; address constant private cETH_CONTACT_ADDRESS = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5; CEther constant private _cETHContract = CEther(cETH_CONTACT_ADDRESS); /** * @dev Returns the fund's balance of the specified currency in the Compound pool. */ function getBalance() external returns (uint256) { return _cETHContract.balanceOfUnderlying(address(this)); } /** * @dev Deposits funds to the Compound pool. Assumes that you have already approved >= the amount to Compound. * @param amount The amount of tokens to be deposited. */ function deposit(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _cETHContract.mint.value(amount)(); } /** * @dev Withdraws funds from the Compound pool. * @param amount The amount of tokens to be withdrawn. */ function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than to 0."); uint256 redeemResult = _cETHContract.redeemUnderlying(amount); require(redeemResult == 0, "Error calling redeemUnderlying on Compound cToken: error code not equal to 0"); } /** * @dev Withdraws all funds from the Compound pool. * @return Boolean indicating success. */ function withdrawAll() external returns (bool) { uint256 balance = _cETHContract.balanceOf(address(this)); if (balance <= 0) return false; uint256 redeemResult = _cETHContract.redeem(balance); require(redeemResult == 0, "Error calling redeem on Compound cToken: error code not equal to 0"); return true; } } // File: contracts/external/keeperdao/IKToken.sol pragma solidity 0.5.17; interface IKToken { function underlying() external view returns (address); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function mint(address recipient, uint256 amount) external returns (bool); function burnFrom(address sender, uint256 amount) external; function addMinter(address sender) external; function renounceMinter() external; } // File: contracts/external/keeperdao/ILiquidityPool.sol pragma solidity 0.5.17; interface ILiquidityPool { function () external payable; function kToken(address _token) external view returns (IKToken); function register(IKToken _kToken) external; function renounceOperator() external; function deposit(address _token, uint256 _amount) external payable returns (uint256); function withdraw(address payable _to, IKToken _kToken, uint256 _kTokenAmount) external; function borrowableBalance(address _token) external view returns (uint256); function underlyingBalance(address _token, address _owner) external view returns (uint256); } // File: contracts/lib/pools/KeeperDaoPoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title KeeperDaoPoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @author Richter Brzeski <[email protected]> (https://github.com/richtermb) * @dev This library handles deposits to and withdrawals from KeeperDAO liquidity pools. */ library KeeperDaoPoolController { using SafeMath for uint256; using SafeERC20 for IERC20; address payable constant private KEEPERDAO_CONTRACT = 0x35fFd6E268610E764fF6944d07760D0EFe5E40E5; ILiquidityPool constant private _liquidityPool = ILiquidityPool(KEEPERDAO_CONTRACT); // KeeperDAO's representation of ETH address constant private ETHEREUM_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); /** * @dev Returns the fund's balance in the KeeperDAO pool. */ function getBalance() external view returns (uint256) { return _liquidityPool.underlyingBalance(ETHEREUM_ADDRESS, address(this)); } /** * @dev Approves kEther to KeeperDAO to burn without spending gas on every deposit. * @param amount Amount of kEther to approve to KeeperDAO. */ function approve(uint256 amount) external { IKToken kEther = _liquidityPool.kToken(ETHEREUM_ADDRESS); uint256 allowance = kEther.allowance(address(this), KEEPERDAO_CONTRACT); if (allowance == amount) return; if (amount > 0 && allowance > 0) kEther.approve(KEEPERDAO_CONTRACT, 0); kEther.approve(KEEPERDAO_CONTRACT, amount); } /** * @dev Deposits funds to the KeeperDAO pool.. * @param amount The amount of ETH to be deposited. */ function deposit(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _liquidityPool.deposit.value(amount)(ETHEREUM_ADDRESS, amount); } /** * @dev Withdraws funds from the KeeperDAO pool. * @param amount The amount of ETH to be withdrawn. */ function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _liquidityPool.withdraw(address(uint160(address(this))), _liquidityPool.kToken(ETHEREUM_ADDRESS), calculatekEtherWithdrawAmount(amount)); } /** * @dev Withdraws all funds from the KeeperDAO pool. * @return Boolean indicating success. */ function withdrawAll() external returns (bool) { IKToken kEther = _liquidityPool.kToken(ETHEREUM_ADDRESS); uint256 balance = kEther.balanceOf(address(this)); if (balance <= 0) return false; _liquidityPool.withdraw(address(uint160(address(this))), kEther, balance); return true; } /** * @dev Calculates an amount of kEther to withdraw equivalent to amount parameter in ETH. * @return amount to withdraw in kEther. */ function calculatekEtherWithdrawAmount(uint256 amount) internal view returns (uint256) { IKToken kEther = _liquidityPool.kToken(ETHEREUM_ADDRESS); uint256 totalSupply = kEther.totalSupply(); uint256 borrowableBalance = _liquidityPool.borrowableBalance(ETHEREUM_ADDRESS); uint256 kEtherAmount = amount.mul(totalSupply).div(borrowableBalance); if (kEtherAmount.mul(borrowableBalance).div(totalSupply) < amount) kEtherAmount++; return kEtherAmount; } } // File: contracts/external/aave/LendingPool.sol /** * Aave Protocol * Copyright (C) 2019 Aave * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details */ pragma solidity 0.5.17; /** * @title LendingPool contract * @notice Implements the actions of the LendingPool, and exposes accessory methods to fetch the users and reserve data * @author Aave */ contract LendingPool { /** * @dev deposits The underlying asset into the reserve. A corresponding amount of the overlying asset (aTokens) * is minted. * @param _reserve the address of the reserve * @param _amount the amount to be deposited * @param _referralCode integrators are assigned a referral code and can potentially receive rewards. */ function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external payable; } // File: contracts/external/aave/AToken.sol /** * Aave Protocol * Copyright (C) 2019 Aave * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details */ pragma solidity 0.5.17; /** * @title Aave ERC20 AToken * @dev Implementation of the interest bearing token for the DLP protocol. * @author Aave */ contract AToken { /** * @dev redeems aToken for the underlying asset * @param _amount the amount being redeemed */ function redeem(uint256 _amount) external; /** * @dev calculates the balance of the user, which is the * principal balance + interest generated by the principal balance + interest generated by the redirected balance * @param _user the user for which the balance is being calculated * @return the total balance of the user */ function balanceOf(address _user) public view returns (uint256); } // File: contracts/lib/pools/AavePoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title AavePoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @author Richter Brzeski <[email protected]> (https://github.com/richtermb) * @dev This library handles deposits to and withdrawals from Aave liquidity pools. */ library AavePoolController { using SafeMath for uint256; using SafeERC20 for IERC20; /** * @dev Aave LendingPool contract address. */ address constant private LENDING_POOL_CONTRACT = 0x398eC7346DcD622eDc5ae82352F02bE94C62d119; /** * @dev Aave LendingPool contract object. */ LendingPool constant private _lendingPool = LendingPool(LENDING_POOL_CONTRACT); /** * @dev Aave LendingPoolCore contract address. */ address constant private LENDING_POOL_CORE_CONTRACT = 0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3; /** * @dev AETH contract address. */ address constant private AETH_CONTRACT = 0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04; /** * @dev AETH contract. */ AToken constant private aETH = AToken(AETH_CONTRACT); /** * @dev Ethereum address abstraction */ address constant private ETHEREUM_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); /** * @dev Returns the fund's balance of the specified currency in the Aave pool. */ function getBalance() external view returns (uint256) { return aETH.balanceOf(address(this)); } /** * @dev Deposits funds to the Aave pool. Assumes that you have already approved >= the amount to Aave. * @param amount The amount of tokens to be deposited. * @param referralCode Referral code. */ function deposit(uint256 amount, uint16 referralCode) external { require(amount > 0, "Amount must be greater than 0."); _lendingPool.deposit.value(amount)(ETHEREUM_ADDRESS, amount, referralCode); } /** * @dev Withdraws funds from the Aave pool. * @param amount The amount of tokens to be withdrawn. */ function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); aETH.redeem(amount); } /** * @dev Withdraws all funds from the Aave pool. */ function withdrawAll() external { aETH.redeem(uint256(-1)); } } // File: contracts/external/alpha/Bank.sol // SPDX-License-Identifier: MIT pragma solidity 0.5.17; contract Bank is IERC20 { /// @dev Return the total ETH entitled to the token holders. Be careful of unaccrued interests. function totalETH() public view returns (uint256); /// @dev Add more ETH to the bank. Hope to get some good returns. function deposit() external payable; /// @dev Withdraw ETH from the bank by burning the share tokens. function withdraw(uint256 share) external; } // File: contracts/lib/pools/AlphaPoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title AlphaPoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @dev This library handles deposits to and withdrawals from Alpha Homora's ibETH pool. */ library AlphaPoolController { using SafeMath for uint256; using SafeERC20 for IERC20; /** * @dev Alpha Homora ibETH token contract address. */ address constant private IBETH_CONTRACT = 0x67B66C99D3Eb37Fa76Aa3Ed1ff33E8e39F0b9c7A; /** * @dev Alpha Homora ibETH token contract object. */ Bank constant private _ibEth = Bank(IBETH_CONTRACT); /** * @dev Returns the fund's balance of the specified currency in the ibETH pool. */ function getBalance() external view returns (uint256) { return _ibEth.balanceOf(address(this)).mul(_ibEth.totalETH()).div(_ibEth.totalSupply()); } /** * @dev Deposits funds to the ibETH pool. Assumes that you have already approved >= the amount to the ibETH token contract. * @param amount The amount of ETH to be deposited. */ function deposit(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _ibEth.deposit.value(amount)(); } /** * @dev Withdraws funds from the ibETH pool. * @param amount The amount of tokens to be withdrawn. */ function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); uint256 totalEth = _ibEth.totalETH(); uint256 totalSupply = _ibEth.totalSupply(); uint256 credits = amount.mul(totalSupply).div(totalEth); if (credits.mul(totalEth).div(totalSupply) < amount) credits++; // Round up if necessary (i.e., if the division above left a remainder) _ibEth.withdraw(credits); } /** * @dev Withdraws all funds from the ibETH pool. * @return Boolean indicating success. */ function withdrawAll() external returns (bool) { uint256 balance = _ibEth.balanceOf(address(this)); if (balance <= 0) return false; _ibEth.withdraw(balance); return true; } } // File: contracts/external/enzyme/ComptrollerLib.sol // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.5.17; /// @title ComptrollerLib Contract /// @author Enzyme Council <[email protected]> /// @notice The core logic library shared by all funds interface ComptrollerLib { //////////////// // ACCOUNTING // //////////////// /// @notice Calculates the gross value of 1 unit of shares in the fund's denomination asset /// @param _requireFinality True if all assets must have exact final balances settled /// @return grossShareValue_ The amount of the denomination asset per share /// @return isValid_ True if the conversion rates to derive the value are all valid /// @dev Does not account for any fees outstanding. function calcGrossShareValue(bool _requireFinality) external returns (uint256 grossShareValue_, bool isValid_); /////////////////// // PARTICIPATION // /////////////////// // BUY SHARES /// @notice Buys shares in the fund for multiple sets of criteria /// @param _buyers The accounts for which to buy shares /// @param _investmentAmounts The amounts of the fund's denomination asset /// with which to buy shares for the corresponding _buyers /// @param _minSharesQuantities The minimum quantities of shares to buy /// with the corresponding _investmentAmounts /// @return sharesReceivedAmounts_ The actual amounts of shares received /// by the corresponding _buyers /// @dev Param arrays have indexes corresponding to individual __buyShares() orders. function buyShares( address[] calldata _buyers, uint256[] calldata _investmentAmounts, uint256[] calldata _minSharesQuantities ) external returns (uint256[] memory sharesReceivedAmounts_); // REDEEM SHARES /// @notice Redeem all of the sender's shares for a proportionate slice of the fund's assets /// @return payoutAssets_ The assets paid out to the redeemer /// @return payoutAmounts_ The amount of each asset paid out to the redeemer /// @dev See __redeemShares() for further detail function redeemShares() external returns (address[] memory payoutAssets_, uint256[] memory payoutAmounts_); /// @notice Redeem a specified quantity of the sender's shares for a proportionate slice of /// the fund's assets, optionally specifying additional assets and assets to skip. /// @param _sharesQuantity The quantity of shares to redeem /// @param _additionalAssets Additional (non-tracked) assets to claim /// @param _assetsToSkip Tracked assets to forfeit /// @return payoutAssets_ The assets paid out to the redeemer /// @return payoutAmounts_ The amount of each asset paid out to the redeemer /// @dev Any claim to passed _assetsToSkip will be forfeited entirely. This should generally /// only be exercised if a bad asset is causing redemption to fail. function redeemSharesDetailed( uint256 _sharesQuantity, address[] calldata _additionalAssets, address[] calldata _assetsToSkip ) external returns (address[] memory payoutAssets_, uint256[] memory payoutAmounts_); /////////////////// // STATE GETTERS // /////////////////// /// @notice Gets the `vaultProxy` variable /// @return vaultProxy_ The `vaultProxy` variable value function getVaultProxy() external view returns (address vaultProxy_); } // File: contracts/lib/pools/EnzymePoolController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title EnzymePoolController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @dev This library handles deposits to and withdrawals from Enzyme's Rari ETH (technically WETH) pool. */ library EnzymePoolController { using SafeMath for uint256; using SafeERC20 for IERC20; /** * @dev The WETH contract address. */ address constant private WETH_CONTRACT = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /** * @dev The WETH contract object. */ IEtherToken constant private _weth = IEtherToken(WETH_CONTRACT); /** * @dev Alpha Homora ibETH token contract address. */ address constant private IBETH_CONTRACT = 0x67B66C99D3Eb37Fa76Aa3Ed1ff33E8e39F0b9c7A; /** * @dev Returns the fund's balance of ETH (technically WETH) in the Enzyme pool. */ function getBalance(address comptroller) external returns (uint256) { ComptrollerLib _comptroller = ComptrollerLib(comptroller); (uint256 price, bool valid) = _comptroller.calcGrossShareValue(true); require(valid, "Enzyme gross share value not valid."); return IERC20(_comptroller.getVaultProxy()).balanceOf(address(this)).mul(price).div(1e18); } /** * @dev Approves WETH to the Enzyme pool Comptroller without spending gas on every deposit. * @param comptroller The Enzyme pool Comptroller contract address. * @param amount Amount of the WETH to approve to the Enzyme pool Comptroller. */ function approve(address comptroller, uint256 amount) external { uint256 allowance = _weth.allowance(address(this), comptroller); if (allowance == amount) return; if (amount > 0 && allowance > 0) _weth.approve(comptroller, 0); _weth.approve(comptroller, amount); } /** * @dev Deposits funds to the Enzyme pool. Assumes that you have already approved >= the amount to the Enzyme Comptroller contract. * @param comptroller The Enzyme pool Comptroller contract address. * @param amount The amount of ETH to be deposited. */ function deposit(address comptroller, uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); _weth.deposit.value(amount)(); address[] memory buyers = new address[](1); buyers[0] = address(this); uint256[] memory amounts = new uint256[](1); amounts[0] = amount; uint256[] memory minShares = new uint256[](1); minShares[0] = 0; ComptrollerLib(comptroller).buyShares(buyers, amounts, minShares); } /** * @dev Withdraws funds from the Enzyme pool. * @param comptroller The Enzyme pool Comptroller contract address. * @param amount The amount of tokens to be withdrawn. */ function withdraw(address comptroller, uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); ComptrollerLib _comptroller = ComptrollerLib(comptroller); (uint256 price, bool valid) = _comptroller.calcGrossShareValue(true); require(valid, "Enzyme gross share value not valid."); uint256 shares = amount.mul(1e18).div(price); if (shares.mul(price).div(1e18) < amount) shares++; // Round up if necessary (i.e., if the division above left a remainder) address[] memory additionalAssets = new address[](0); address[] memory assetsToSkip = new address[](0); _comptroller.redeemSharesDetailed(shares, additionalAssets, assetsToSkip); _weth.withdraw(_weth.balanceOf(address(this))); } /** * @dev Withdraws all funds from the Enzyme pool. * @param comptroller The Enzyme pool Comptroller contract address. */ function withdrawAll(address comptroller) external { ComptrollerLib(comptroller).redeemShares(); _weth.withdraw(_weth.balanceOf(address(this))); } } // File: @0x/contracts-utils/contracts/src/LibRichErrors.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibRichErrors { // bytes4(keccak256("Error(string)")) bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0; // solhint-disable func-name-mixedcase /// @dev ABI encode a standard, string revert error payload. /// This is the same payload that would be included by a `revert(string)` /// solidity statement. It has the function signature `Error(string)`. /// @param message The error string. /// @return The ABI encoded error. function StandardError( string memory message ) internal pure returns (bytes memory) { return abi.encodeWithSelector( STANDARD_ERROR_SELECTOR, bytes(message) ); } // solhint-enable func-name-mixedcase /// @dev Reverts an encoded rich revert reason `errorData`. /// @param errorData ABI encoded error data. function rrevert(bytes memory errorData) internal pure { assembly { revert(add(errorData, 0x20), mload(errorData)) } } } // File: @0x/contracts-utils/contracts/src/LibSafeMathRichErrors.sol pragma solidity ^0.5.9; library LibSafeMathRichErrors { // bytes4(keccak256("Uint256BinOpError(uint8,uint256,uint256)")) bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR = 0xe946c1bb; // bytes4(keccak256("Uint256DowncastError(uint8,uint256)")) bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR = 0xc996af7b; enum BinOpErrorCodes { ADDITION_OVERFLOW, MULTIPLICATION_OVERFLOW, SUBTRACTION_UNDERFLOW, DIVISION_BY_ZERO } enum DowncastErrorCodes { VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32, VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64, VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96 } // solhint-disable func-name-mixedcase function Uint256BinOpError( BinOpErrorCodes errorCode, uint256 a, uint256 b ) internal pure returns (bytes memory) { return abi.encodeWithSelector( UINT256_BINOP_ERROR_SELECTOR, errorCode, a, b ); } function Uint256DowncastError( DowncastErrorCodes errorCode, uint256 a ) internal pure returns (bytes memory) { return abi.encodeWithSelector( UINT256_DOWNCAST_ERROR_SELECTOR, errorCode, a ); } } // File: @0x/contracts-utils/contracts/src/LibSafeMath.sol pragma solidity ^0.5.9; library LibSafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; if (c / a != b) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); } return c; } function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); } uint256 c = a / b; return c; } function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { if (b > a) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); } return a - b; } function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; if (c < a) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); } return c; } function max256(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } // File: @0x/contracts-exchange-libs/contracts/src/LibMathRichErrors.sol pragma solidity ^0.5.9; library LibMathRichErrors { // bytes4(keccak256("DivisionByZeroError()")) bytes internal constant DIVISION_BY_ZERO_ERROR = hex"a791837c"; // bytes4(keccak256("RoundingError(uint256,uint256,uint256)")) bytes4 internal constant ROUNDING_ERROR_SELECTOR = 0x339f3de2; // solhint-disable func-name-mixedcase function DivisionByZeroError() internal pure returns (bytes memory) { return DIVISION_BY_ZERO_ERROR; } function RoundingError( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bytes memory) { return abi.encodeWithSelector( ROUNDING_ERROR_SELECTOR, numerator, denominator, target ); } } // File: @0x/contracts-exchange-libs/contracts/src/LibMath.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibMath { using LibSafeMath for uint256; /// @dev Calculates partial value given a numerator and denominator rounded down. /// Reverts if rounding error is >= 0.1% /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to calculate partial of. /// @return Partial value of target rounded down. function safeGetPartialAmountFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount) { if (isRoundingErrorFloor( numerator, denominator, target )) { LibRichErrors.rrevert(LibMathRichErrors.RoundingError( numerator, denominator, target )); } partialAmount = numerator.safeMul(target).safeDiv(denominator); return partialAmount; } /// @dev Calculates partial value given a numerator and denominator rounded down. /// Reverts if rounding error is >= 0.1% /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to calculate partial of. /// @return Partial value of target rounded up. function safeGetPartialAmountCeil( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount) { if (isRoundingErrorCeil( numerator, denominator, target )) { LibRichErrors.rrevert(LibMathRichErrors.RoundingError( numerator, denominator, target )); } // safeDiv computes `floor(a / b)`. We use the identity (a, b integer): // ceil(a / b) = floor((a + b - 1) / b) // To implement `ceil(a / b)` using safeDiv. partialAmount = numerator.safeMul(target) .safeAdd(denominator.safeSub(1)) .safeDiv(denominator); return partialAmount; } /// @dev Calculates partial value given a numerator and denominator rounded down. /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to calculate partial of. /// @return Partial value of target rounded down. function getPartialAmountFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount) { partialAmount = numerator.safeMul(target).safeDiv(denominator); return partialAmount; } /// @dev Calculates partial value given a numerator and denominator rounded down. /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to calculate partial of. /// @return Partial value of target rounded up. function getPartialAmountCeil( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount) { // safeDiv computes `floor(a / b)`. We use the identity (a, b integer): // ceil(a / b) = floor((a + b - 1) / b) // To implement `ceil(a / b)` using safeDiv. partialAmount = numerator.safeMul(target) .safeAdd(denominator.safeSub(1)) .safeDiv(denominator); return partialAmount; } /// @dev Checks if rounding error >= 0.1% when rounding down. /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to multiply with numerator/denominator. /// @return Rounding error is present. function isRoundingErrorFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError) { if (denominator == 0) { LibRichErrors.rrevert(LibMathRichErrors.DivisionByZeroError()); } // The absolute rounding error is the difference between the rounded // value and the ideal value. The relative rounding error is the // absolute rounding error divided by the absolute value of the // ideal value. This is undefined when the ideal value is zero. // // The ideal value is `numerator * target / denominator`. // Let's call `numerator * target % denominator` the remainder. // The absolute error is `remainder / denominator`. // // When the ideal value is zero, we require the absolute error to // be zero. Fortunately, this is always the case. The ideal value is // zero iff `numerator == 0` and/or `target == 0`. In this case the // remainder and absolute error are also zero. if (target == 0 || numerator == 0) { return false; } // Otherwise, we want the relative rounding error to be strictly // less than 0.1%. // The relative error is `remainder / (numerator * target)`. // We want the relative error less than 1 / 1000: // remainder / (numerator * denominator) < 1 / 1000 // or equivalently: // 1000 * remainder < numerator * target // so we have a rounding error iff: // 1000 * remainder >= numerator * target uint256 remainder = mulmod( target, numerator, denominator ); isError = remainder.safeMul(1000) >= numerator.safeMul(target); return isError; } /// @dev Checks if rounding error >= 0.1% when rounding up. /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to multiply with numerator/denominator. /// @return Rounding error is present. function isRoundingErrorCeil( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError) { if (denominator == 0) { LibRichErrors.rrevert(LibMathRichErrors.DivisionByZeroError()); } // See the comments in `isRoundingError`. if (target == 0 || numerator == 0) { // When either is zero, the ideal value and rounded value are zero // and there is no rounding error. (Although the relative error // is undefined.) return false; } // Compute remainder as before uint256 remainder = mulmod( target, numerator, denominator ); remainder = denominator.safeSub(remainder) % denominator; isError = remainder.safeMul(1000) >= numerator.safeMul(target); return isError; } } // File: @0x/contracts-exchange-libs/contracts/src/LibFillResults.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibFillResults { using LibSafeMath for uint256; struct BatchMatchedFillResults { FillResults[] left; // Fill results for left orders FillResults[] right; // Fill results for right orders uint256 profitInLeftMakerAsset; // Profit taken from left makers uint256 profitInRightMakerAsset; // Profit taken from right makers } struct FillResults { uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled. uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled. uint256 makerFeePaid; // Total amount of fees paid by maker(s) to feeRecipient(s). uint256 takerFeePaid; // Total amount of fees paid by taker to feeRecipients(s). uint256 protocolFeePaid; // Total amount of fees paid by taker to the staking contract. } struct MatchedFillResults { FillResults left; // Amounts filled and fees paid of left order. FillResults right; // Amounts filled and fees paid of right order. uint256 profitInLeftMakerAsset; // Profit taken from the left maker uint256 profitInRightMakerAsset; // Profit taken from the right maker } /// @dev Calculates amounts filled and fees paid by maker and taker. /// @param order to be filled. /// @param takerAssetFilledAmount Amount of takerAsset that will be filled. /// @param protocolFeeMultiplier The current protocol fee of the exchange contract. /// @param gasPrice The gasprice of the transaction. This is provided so that the function call can continue /// to be pure rather than view. /// @return fillResults Amounts filled and fees paid by maker and taker. function calculateFillResults( LibOrder.Order memory order, uint256 takerAssetFilledAmount, uint256 protocolFeeMultiplier, uint256 gasPrice ) internal pure returns (FillResults memory fillResults) { // Compute proportional transfer amounts fillResults.takerAssetFilledAmount = takerAssetFilledAmount; fillResults.makerAssetFilledAmount = LibMath.safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount ); fillResults.makerFeePaid = LibMath.safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerFee ); fillResults.takerFeePaid = LibMath.safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.takerFee ); // Compute the protocol fee that should be paid for a single fill. fillResults.protocolFeePaid = gasPrice.safeMul(protocolFeeMultiplier); return fillResults; } /// @dev Calculates fill amounts for the matched orders. /// Each order is filled at their respective price point. However, the calculations are /// carried out as though the orders are both being filled at the right order's price point. /// The profit made by the leftOrder order goes to the taker (who matched the two orders). /// @param leftOrder First order to match. /// @param rightOrder Second order to match. /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled. /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled. /// @param protocolFeeMultiplier The current protocol fee of the exchange contract. /// @param gasPrice The gasprice of the transaction. This is provided so that the function call can continue /// to be pure rather than view. /// @param shouldMaximallyFillOrders A value that indicates whether or not this calculation should use /// the maximal fill order matching strategy. /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders. function calculateMatchedFillResults( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, uint256 leftOrderTakerAssetFilledAmount, uint256 rightOrderTakerAssetFilledAmount, uint256 protocolFeeMultiplier, uint256 gasPrice, bool shouldMaximallyFillOrders ) internal pure returns (MatchedFillResults memory matchedFillResults) { // Derive maker asset amounts for left & right orders, given store taker assert amounts uint256 leftTakerAssetAmountRemaining = leftOrder.takerAssetAmount.safeSub(leftOrderTakerAssetFilledAmount); uint256 leftMakerAssetAmountRemaining = LibMath.safeGetPartialAmountFloor( leftOrder.makerAssetAmount, leftOrder.takerAssetAmount, leftTakerAssetAmountRemaining ); uint256 rightTakerAssetAmountRemaining = rightOrder.takerAssetAmount.safeSub(rightOrderTakerAssetFilledAmount); uint256 rightMakerAssetAmountRemaining = LibMath.safeGetPartialAmountFloor( rightOrder.makerAssetAmount, rightOrder.takerAssetAmount, rightTakerAssetAmountRemaining ); // Maximally fill the orders and pay out profits to the matcher in one or both of the maker assets. if (shouldMaximallyFillOrders) { matchedFillResults = _calculateMatchedFillResultsWithMaximalFill( leftOrder, rightOrder, leftMakerAssetAmountRemaining, leftTakerAssetAmountRemaining, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } else { matchedFillResults = _calculateMatchedFillResults( leftOrder, rightOrder, leftMakerAssetAmountRemaining, leftTakerAssetAmountRemaining, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } // Compute fees for left order matchedFillResults.left.makerFeePaid = LibMath.safeGetPartialAmountFloor( matchedFillResults.left.makerAssetFilledAmount, leftOrder.makerAssetAmount, leftOrder.makerFee ); matchedFillResults.left.takerFeePaid = LibMath.safeGetPartialAmountFloor( matchedFillResults.left.takerAssetFilledAmount, leftOrder.takerAssetAmount, leftOrder.takerFee ); // Compute fees for right order matchedFillResults.right.makerFeePaid = LibMath.safeGetPartialAmountFloor( matchedFillResults.right.makerAssetFilledAmount, rightOrder.makerAssetAmount, rightOrder.makerFee ); matchedFillResults.right.takerFeePaid = LibMath.safeGetPartialAmountFloor( matchedFillResults.right.takerAssetFilledAmount, rightOrder.takerAssetAmount, rightOrder.takerFee ); // Compute the protocol fee that should be paid for a single fill. In this // case this should be made the protocol fee for both the left and right orders. uint256 protocolFee = gasPrice.safeMul(protocolFeeMultiplier); matchedFillResults.left.protocolFeePaid = protocolFee; matchedFillResults.right.protocolFeePaid = protocolFee; // Return fill results return matchedFillResults; } /// @dev Adds properties of both FillResults instances. /// @param fillResults1 The first FillResults. /// @param fillResults2 The second FillResults. /// @return The sum of both fill results. function addFillResults( FillResults memory fillResults1, FillResults memory fillResults2 ) internal pure returns (FillResults memory totalFillResults) { totalFillResults.makerAssetFilledAmount = fillResults1.makerAssetFilledAmount.safeAdd(fillResults2.makerAssetFilledAmount); totalFillResults.takerAssetFilledAmount = fillResults1.takerAssetFilledAmount.safeAdd(fillResults2.takerAssetFilledAmount); totalFillResults.makerFeePaid = fillResults1.makerFeePaid.safeAdd(fillResults2.makerFeePaid); totalFillResults.takerFeePaid = fillResults1.takerFeePaid.safeAdd(fillResults2.takerFeePaid); totalFillResults.protocolFeePaid = fillResults1.protocolFeePaid.safeAdd(fillResults2.protocolFeePaid); return totalFillResults; } /// @dev Calculates part of the matched fill results for a given situation using the fill strategy that only /// awards profit denominated in the left maker asset. /// @param leftOrder The left order in the order matching situation. /// @param rightOrder The right order in the order matching situation. /// @param leftMakerAssetAmountRemaining The amount of the left order maker asset that can still be filled. /// @param leftTakerAssetAmountRemaining The amount of the left order taker asset that can still be filled. /// @param rightMakerAssetAmountRemaining The amount of the right order maker asset that can still be filled. /// @param rightTakerAssetAmountRemaining The amount of the right order taker asset that can still be filled. /// @return MatchFillResults struct that does not include fees paid. function _calculateMatchedFillResults( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, uint256 leftMakerAssetAmountRemaining, uint256 leftTakerAssetAmountRemaining, uint256 rightMakerAssetAmountRemaining, uint256 rightTakerAssetAmountRemaining ) private pure returns (MatchedFillResults memory matchedFillResults) { // Calculate fill results for maker and taker assets: at least one order will be fully filled. // The maximum amount the left maker can buy is `leftTakerAssetAmountRemaining` // The maximum amount the right maker can sell is `rightMakerAssetAmountRemaining` // We have two distinct cases for calculating the fill results: // Case 1. // If the left maker can buy more than the right maker can sell, then only the right order is fully filled. // If the left maker can buy exactly what the right maker can sell, then both orders are fully filled. // Case 2. // If the left maker cannot buy more than the right maker can sell, then only the left order is fully filled. // Case 3. // If the left maker can buy exactly as much as the right maker can sell, then both orders are fully filled. if (leftTakerAssetAmountRemaining > rightMakerAssetAmountRemaining) { // Case 1: Right order is fully filled matchedFillResults = _calculateCompleteRightFill( leftOrder, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } else if (leftTakerAssetAmountRemaining < rightMakerAssetAmountRemaining) { // Case 2: Left order is fully filled matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining; matchedFillResults.right.makerAssetFilledAmount = leftTakerAssetAmountRemaining; // Round up to ensure the maker's exchange rate does not exceed the price specified by the order. // We favor the maker when the exchange rate must be rounded. matchedFillResults.right.takerAssetFilledAmount = LibMath.safeGetPartialAmountCeil( rightOrder.takerAssetAmount, rightOrder.makerAssetAmount, leftTakerAssetAmountRemaining // matchedFillResults.right.makerAssetFilledAmount ); } else { // leftTakerAssetAmountRemaining == rightMakerAssetAmountRemaining // Case 3: Both orders are fully filled. Technically, this could be captured by the above cases, but // this calculation will be more precise since it does not include rounding. matchedFillResults = _calculateCompleteFillBoth( leftMakerAssetAmountRemaining, leftTakerAssetAmountRemaining, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } // Calculate amount given to taker matchedFillResults.profitInLeftMakerAsset = matchedFillResults.left.makerAssetFilledAmount.safeSub( matchedFillResults.right.takerAssetFilledAmount ); return matchedFillResults; } /// @dev Calculates part of the matched fill results for a given situation using the maximal fill order matching /// strategy. /// @param leftOrder The left order in the order matching situation. /// @param rightOrder The right order in the order matching situation. /// @param leftMakerAssetAmountRemaining The amount of the left order maker asset that can still be filled. /// @param leftTakerAssetAmountRemaining The amount of the left order taker asset that can still be filled. /// @param rightMakerAssetAmountRemaining The amount of the right order maker asset that can still be filled. /// @param rightTakerAssetAmountRemaining The amount of the right order taker asset that can still be filled. /// @return MatchFillResults struct that does not include fees paid. function _calculateMatchedFillResultsWithMaximalFill( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, uint256 leftMakerAssetAmountRemaining, uint256 leftTakerAssetAmountRemaining, uint256 rightMakerAssetAmountRemaining, uint256 rightTakerAssetAmountRemaining ) private pure returns (MatchedFillResults memory matchedFillResults) { // If a maker asset is greater than the opposite taker asset, than there will be a spread denominated in that maker asset. bool doesLeftMakerAssetProfitExist = leftMakerAssetAmountRemaining > rightTakerAssetAmountRemaining; bool doesRightMakerAssetProfitExist = rightMakerAssetAmountRemaining > leftTakerAssetAmountRemaining; // Calculate the maximum fill results for the maker and taker assets. At least one of the orders will be fully filled. // // The maximum that the left maker can possibly buy is the amount that the right order can sell. // The maximum that the right maker can possibly buy is the amount that the left order can sell. // // If the left order is fully filled, profit will be paid out in the left maker asset. If the right order is fully filled, // the profit will be out in the right maker asset. // // There are three cases to consider: // Case 1. // If the left maker can buy more than the right maker can sell, then only the right order is fully filled. // Case 2. // If the right maker can buy more than the left maker can sell, then only the right order is fully filled. // Case 3. // If the right maker can sell the max of what the left maker can buy and the left maker can sell the max of // what the right maker can buy, then both orders are fully filled. if (leftTakerAssetAmountRemaining > rightMakerAssetAmountRemaining) { // Case 1: Right order is fully filled with the profit paid in the left makerAsset matchedFillResults = _calculateCompleteRightFill( leftOrder, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } else if (rightTakerAssetAmountRemaining > leftMakerAssetAmountRemaining) { // Case 2: Left order is fully filled with the profit paid in the right makerAsset. matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining; // Round down to ensure the right maker's exchange rate does not exceed the price specified by the order. // We favor the right maker when the exchange rate must be rounded and the profit is being paid in the // right maker asset. matchedFillResults.right.makerAssetFilledAmount = LibMath.safeGetPartialAmountFloor( rightOrder.makerAssetAmount, rightOrder.takerAssetAmount, leftMakerAssetAmountRemaining ); matchedFillResults.right.takerAssetFilledAmount = leftMakerAssetAmountRemaining; } else { // Case 3: The right and left orders are fully filled matchedFillResults = _calculateCompleteFillBoth( leftMakerAssetAmountRemaining, leftTakerAssetAmountRemaining, rightMakerAssetAmountRemaining, rightTakerAssetAmountRemaining ); } // Calculate amount given to taker in the left order's maker asset if the left spread will be part of the profit. if (doesLeftMakerAssetProfitExist) { matchedFillResults.profitInLeftMakerAsset = matchedFillResults.left.makerAssetFilledAmount.safeSub( matchedFillResults.right.takerAssetFilledAmount ); } // Calculate amount given to taker in the right order's maker asset if the right spread will be part of the profit. if (doesRightMakerAssetProfitExist) { matchedFillResults.profitInRightMakerAsset = matchedFillResults.right.makerAssetFilledAmount.safeSub( matchedFillResults.left.takerAssetFilledAmount ); } return matchedFillResults; } /// @dev Calculates the fill results for the maker and taker in the order matching and writes the results /// to the fillResults that are being collected on the order. Both orders will be fully filled in this /// case. /// @param leftMakerAssetAmountRemaining The amount of the left maker asset that is remaining to be filled. /// @param leftTakerAssetAmountRemaining The amount of the left taker asset that is remaining to be filled. /// @param rightMakerAssetAmountRemaining The amount of the right maker asset that is remaining to be filled. /// @param rightTakerAssetAmountRemaining The amount of the right taker asset that is remaining to be filled. /// @return MatchFillResults struct that does not include fees paid or spreads taken. function _calculateCompleteFillBoth( uint256 leftMakerAssetAmountRemaining, uint256 leftTakerAssetAmountRemaining, uint256 rightMakerAssetAmountRemaining, uint256 rightTakerAssetAmountRemaining ) private pure returns (MatchedFillResults memory matchedFillResults) { // Calculate the fully filled results for both orders. matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining; matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining; matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining; return matchedFillResults; } /// @dev Calculates the fill results for the maker and taker in the order matching and writes the results /// to the fillResults that are being collected on the order. /// @param leftOrder The left order that is being maximally filled. All of the information about fill amounts /// can be derived from this order and the right asset remaining fields. /// @param rightMakerAssetAmountRemaining The amount of the right maker asset that is remaining to be filled. /// @param rightTakerAssetAmountRemaining The amount of the right taker asset that is remaining to be filled. /// @return MatchFillResults struct that does not include fees paid or spreads taken. function _calculateCompleteRightFill( LibOrder.Order memory leftOrder, uint256 rightMakerAssetAmountRemaining, uint256 rightTakerAssetAmountRemaining ) private pure returns (MatchedFillResults memory matchedFillResults) { matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining; matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining; matchedFillResults.left.takerAssetFilledAmount = rightMakerAssetAmountRemaining; // Round down to ensure the left maker's exchange rate does not exceed the price specified by the order. // We favor the left maker when the exchange rate must be rounded and the profit is being paid in the // left maker asset. matchedFillResults.left.makerAssetFilledAmount = LibMath.safeGetPartialAmountFloor( leftOrder.makerAssetAmount, leftOrder.takerAssetAmount, rightMakerAssetAmountRemaining ); return matchedFillResults; } } // File: @0x/contracts-exchange/contracts/src/interfaces/IExchangeCore.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IExchangeCore { // Fill event is emitted whenever an order is filled. event Fill( address indexed makerAddress, // Address that created the order. address indexed feeRecipientAddress, // Address that received fees. bytes makerAssetData, // Encoded data specific to makerAsset. bytes takerAssetData, // Encoded data specific to takerAsset. bytes makerFeeAssetData, // Encoded data specific to makerFeeAsset. bytes takerFeeAssetData, // Encoded data specific to takerFeeAsset. bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getTypedDataHash). address takerAddress, // Address that filled the order. address senderAddress, // Address that called the Exchange contract (msg.sender). uint256 makerAssetFilledAmount, // Amount of makerAsset sold by maker and bought by taker. uint256 takerAssetFilledAmount, // Amount of takerAsset sold by taker and bought by maker. uint256 makerFeePaid, // Amount of makerFeeAssetData paid to feeRecipient by maker. uint256 takerFeePaid, // Amount of takerFeeAssetData paid to feeRecipient by taker. uint256 protocolFeePaid // Amount of eth or weth paid to the staking contract. ); // Cancel event is emitted whenever an individual order is cancelled. event Cancel( address indexed makerAddress, // Address that created the order. address indexed feeRecipientAddress, // Address that would have recieved fees if order was filled. bytes makerAssetData, // Encoded data specific to makerAsset. bytes takerAssetData, // Encoded data specific to takerAsset. address senderAddress, // Address that called the Exchange contract (msg.sender). bytes32 indexed orderHash // EIP712 hash of order (see LibOrder.getTypedDataHash). ); // CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully. event CancelUpTo( address indexed makerAddress, // Orders cancelled must have been created by this address. address indexed orderSenderAddress, // Orders cancelled must have a `senderAddress` equal to this address. uint256 orderEpoch // Orders with specified makerAddress and senderAddress with a salt less than this value are considered cancelled. ); /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress). /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. function cancelOrdersUpTo(uint256 targetOrderEpoch) external payable; /// @dev Fills the input order. /// @param order Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signature Proof that order has been created by maker. /// @return Amounts filled and fees paid by maker and taker. function fillOrder( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev After calling, the order can not be filled anymore. /// @param order Order struct containing order specifications. function cancelOrder(LibOrder.Order memory order) public payable; /// @dev Gets information about an order: status, hash, and amount filled. /// @param order Order to gather information on. /// @return OrderInfo Information about the order and its state. /// See LibOrder.OrderInfo for a complete description. function getOrderInfo(LibOrder.Order memory order) public view returns (LibOrder.OrderInfo memory orderInfo); } // File: @0x/contracts-exchange/contracts/src/interfaces/IProtocolFees.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IProtocolFees { // Logs updates to the protocol fee multiplier. event ProtocolFeeMultiplier(uint256 oldProtocolFeeMultiplier, uint256 updatedProtocolFeeMultiplier); // Logs updates to the protocolFeeCollector address. event ProtocolFeeCollectorAddress(address oldProtocolFeeCollector, address updatedProtocolFeeCollector); /// @dev Allows the owner to update the protocol fee multiplier. /// @param updatedProtocolFeeMultiplier The updated protocol fee multiplier. function setProtocolFeeMultiplier(uint256 updatedProtocolFeeMultiplier) external; /// @dev Allows the owner to update the protocolFeeCollector address. /// @param updatedProtocolFeeCollector The updated protocolFeeCollector contract address. function setProtocolFeeCollectorAddress(address updatedProtocolFeeCollector) external; /// @dev Returns the protocolFeeMultiplier function protocolFeeMultiplier() external view returns (uint256); /// @dev Returns the protocolFeeCollector address function protocolFeeCollector() external view returns (address); } // File: @0x/contracts-exchange/contracts/src/interfaces/IMatchOrders.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IMatchOrders { /// @dev Match complementary orders that have a profitable spread. /// Each order is filled at their respective price point, and /// the matcher receives a profit denominated in the left maker asset. /// @param leftOrders Set of orders with the same maker / taker asset. /// @param rightOrders Set of orders to match against `leftOrders` /// @param leftSignatures Proof that left orders were created by the left makers. /// @param rightSignatures Proof that right orders were created by the right makers. /// @return batchMatchedFillResults Amounts filled and profit generated. function batchMatchOrders( LibOrder.Order[] memory leftOrders, LibOrder.Order[] memory rightOrders, bytes[] memory leftSignatures, bytes[] memory rightSignatures ) public payable returns (LibFillResults.BatchMatchedFillResults memory batchMatchedFillResults); /// @dev Match complementary orders that have a profitable spread. /// Each order is maximally filled at their respective price point, and /// the matcher receives a profit denominated in either the left maker asset, /// right maker asset, or a combination of both. /// @param leftOrders Set of orders with the same maker / taker asset. /// @param rightOrders Set of orders to match against `leftOrders` /// @param leftSignatures Proof that left orders were created by the left makers. /// @param rightSignatures Proof that right orders were created by the right makers. /// @return batchMatchedFillResults Amounts filled and profit generated. function batchMatchOrdersWithMaximalFill( LibOrder.Order[] memory leftOrders, LibOrder.Order[] memory rightOrders, bytes[] memory leftSignatures, bytes[] memory rightSignatures ) public payable returns (LibFillResults.BatchMatchedFillResults memory batchMatchedFillResults); /// @dev Match two complementary orders that have a profitable spread. /// Each order is filled at their respective price point. However, the calculations are /// carried out as though the orders are both being filled at the right order's price point. /// The profit made by the left order goes to the taker (who matched the two orders). /// @param leftOrder First order to match. /// @param rightOrder Second order to match. /// @param leftSignature Proof that order was created by the left maker. /// @param rightSignature Proof that order was created by the right maker. /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders. function matchOrders( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, bytes memory leftSignature, bytes memory rightSignature ) public payable returns (LibFillResults.MatchedFillResults memory matchedFillResults); /// @dev Match two complementary orders that have a profitable spread. /// Each order is maximally filled at their respective price point, and /// the matcher receives a profit denominated in either the left maker asset, /// right maker asset, or a combination of both. /// @param leftOrder First order to match. /// @param rightOrder Second order to match. /// @param leftSignature Proof that order was created by the left maker. /// @param rightSignature Proof that order was created by the right maker. /// @return matchedFillResults Amounts filled by maker and taker of matched orders. function matchOrdersWithMaximalFill( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, bytes memory leftSignature, bytes memory rightSignature ) public payable returns (LibFillResults.MatchedFillResults memory matchedFillResults); } // File: @0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; library LibZeroExTransaction { using LibZeroExTransaction for ZeroExTransaction; // Hash for the EIP712 0x transaction schema // keccak256(abi.encodePacked( // "ZeroExTransaction(", // "uint256 salt,", // "uint256 expirationTimeSeconds,", // "uint256 gasPrice,", // "address signerAddress,", // "bytes data", // ")" // )); bytes32 constant internal _EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = 0xec69816980a3a3ca4554410e60253953e9ff375ba4536a98adfa15cc71541508; struct ZeroExTransaction { uint256 salt; // Arbitrary number to ensure uniqueness of transaction hash. uint256 expirationTimeSeconds; // Timestamp in seconds at which transaction expires. uint256 gasPrice; // gasPrice that transaction is required to be executed with. address signerAddress; // Address of transaction signer. bytes data; // AbiV2 encoded calldata. } /// @dev Calculates the EIP712 typed data hash of a transaction with a given domain separator. /// @param transaction 0x transaction structure. /// @return EIP712 typed data hash of the transaction. function getTypedDataHash(ZeroExTransaction memory transaction, bytes32 eip712ExchangeDomainHash) internal pure returns (bytes32 transactionHash) { // Hash the transaction with the domain separator of the Exchange contract. transactionHash = LibEIP712.hashEIP712Message( eip712ExchangeDomainHash, transaction.getStructHash() ); return transactionHash; } /// @dev Calculates EIP712 hash of the 0x transaction struct. /// @param transaction 0x transaction structure. /// @return EIP712 hash of the transaction struct. function getStructHash(ZeroExTransaction memory transaction) internal pure returns (bytes32 result) { bytes32 schemaHash = _EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH; bytes memory data = transaction.data; uint256 salt = transaction.salt; uint256 expirationTimeSeconds = transaction.expirationTimeSeconds; uint256 gasPrice = transaction.gasPrice; address signerAddress = transaction.signerAddress; // Assembly for more efficiently computing: // result = keccak256(abi.encodePacked( // schemaHash, // salt, // expirationTimeSeconds, // gasPrice, // uint256(signerAddress), // keccak256(data) // )); assembly { // Compute hash of data let dataHash := keccak256(add(data, 32), mload(data)) // Load free memory pointer let memPtr := mload(64) mstore(memPtr, schemaHash) // hash of schema mstore(add(memPtr, 32), salt) // salt mstore(add(memPtr, 64), expirationTimeSeconds) // expirationTimeSeconds mstore(add(memPtr, 96), gasPrice) // gasPrice mstore(add(memPtr, 128), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress mstore(add(memPtr, 160), dataHash) // hash of data // Compute hash result := keccak256(memPtr, 192) } return result; } } // File: @0x/contracts-exchange/contracts/src/interfaces/ISignatureValidator.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract ISignatureValidator { // Allowed signature types. enum SignatureType { Illegal, // 0x00, default value Invalid, // 0x01 EIP712, // 0x02 EthSign, // 0x03 Wallet, // 0x04 Validator, // 0x05 PreSigned, // 0x06 EIP1271Wallet, // 0x07 NSignatureTypes // 0x08, number of signature types. Always leave at end. } event SignatureValidatorApproval( address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures. address indexed validatorAddress, // Address of signature validator contract. bool isApproved // Approval or disapproval of validator contract. ); /// @dev Approves a hash on-chain. /// After presigning a hash, the preSign signature type will become valid for that hash and signer. /// @param hash Any 32-byte hash. function preSign(bytes32 hash) external payable; /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf. /// @param validatorAddress Address of Validator contract. /// @param approval Approval or disapproval of Validator contract. function setSignatureValidatorApproval( address validatorAddress, bool approval ) external payable; /// @dev Verifies that a hash has been signed by the given signer. /// @param hash Any 32-byte hash. /// @param signature Proof that the hash has been signed by signer. /// @return isValid `true` if the signature is valid for the given hash and signer. function isValidHashSignature( bytes32 hash, address signerAddress, bytes memory signature ) public view returns (bool isValid); /// @dev Verifies that a signature for an order is valid. /// @param order The order. /// @param signature Proof that the order has been signed by signer. /// @return isValid true if the signature is valid for the given order and signer. function isValidOrderSignature( LibOrder.Order memory order, bytes memory signature ) public view returns (bool isValid); /// @dev Verifies that a signature for a transaction is valid. /// @param transaction The transaction. /// @param signature Proof that the order has been signed by signer. /// @return isValid true if the signature is valid for the given transaction and signer. function isValidTransactionSignature( LibZeroExTransaction.ZeroExTransaction memory transaction, bytes memory signature ) public view returns (bool isValid); /// @dev Verifies that an order, with provided order hash, has been signed /// by the given signer. /// @param order The order. /// @param orderHash The hash of the order. /// @param signature Proof that the hash has been signed by signer. /// @return isValid True if the signature is valid for the given order and signer. function _isValidOrderWithHashSignature( LibOrder.Order memory order, bytes32 orderHash, bytes memory signature ) internal view returns (bool isValid); /// @dev Verifies that a transaction, with provided order hash, has been signed /// by the given signer. /// @param transaction The transaction. /// @param transactionHash The hash of the transaction. /// @param signature Proof that the hash has been signed by signer. /// @return isValid True if the signature is valid for the given transaction and signer. function _isValidTransactionWithHashSignature( LibZeroExTransaction.ZeroExTransaction memory transaction, bytes32 transactionHash, bytes memory signature ) internal view returns (bool isValid); } // File: @0x/contracts-exchange/contracts/src/interfaces/ITransactions.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract ITransactions { // TransactionExecution event is emitted when a ZeroExTransaction is executed. event TransactionExecution(bytes32 indexed transactionHash); /// @dev Executes an Exchange method call in the context of signer. /// @param transaction 0x transaction containing salt, signerAddress, and data. /// @param signature Proof that transaction has been signed by signer. /// @return ABI encoded return data of the underlying Exchange function call. function executeTransaction( LibZeroExTransaction.ZeroExTransaction memory transaction, bytes memory signature ) public payable returns (bytes memory); /// @dev Executes a batch of Exchange method calls in the context of signer(s). /// @param transactions Array of 0x transactions containing salt, signerAddress, and data. /// @param signatures Array of proofs that transactions have been signed by signer(s). /// @return Array containing ABI encoded return data for each of the underlying Exchange function calls. function batchExecuteTransactions( LibZeroExTransaction.ZeroExTransaction[] memory transactions, bytes[] memory signatures ) public payable returns (bytes[] memory); /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`). /// If calling a fill function, this address will represent the taker. /// If calling a cancel function, this address will represent the maker. /// @return Signer of 0x transaction if entry point is `executeTransaction`. /// `msg.sender` if entry point is any other function. function _getCurrentContextAddress() internal view returns (address); } // File: @0x/contracts-exchange/contracts/src/interfaces/IAssetProxyDispatcher.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IAssetProxyDispatcher { // Logs registration of new asset proxy event AssetProxyRegistered( bytes4 id, // Id of new registered AssetProxy. address assetProxy // Address of new registered AssetProxy. ); /// @dev Registers an asset proxy to its asset proxy id. /// Once an asset proxy is registered, it cannot be unregistered. /// @param assetProxy Address of new asset proxy to register. function registerAssetProxy(address assetProxy) external; /// @dev Gets an asset proxy. /// @param assetProxyId Id of the asset proxy. /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered. function getAssetProxy(bytes4 assetProxyId) external view returns (address); } // File: @0x/contracts-exchange/contracts/src/interfaces/IWrapperFunctions.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract IWrapperFunctions { /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled. /// @param order Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signature Proof that order has been created by maker. function fillOrKillOrder( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev Executes multiple calls of fillOrder. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Array of amounts filled and fees paid by makers and taker. function batchFillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults[] memory fillResults); /// @dev Executes multiple calls of fillOrKillOrder. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Array of amounts filled and fees paid by makers and taker. function batchFillOrKillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults[] memory fillResults); /// @dev Executes multiple calls of fillOrder. If any fill reverts, the error is caught and ignored. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Array of amounts filled and fees paid by makers and taker. function batchFillOrdersNoThrow( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults[] memory fillResults); /// @dev Executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. /// If any fill reverts, the error is caught and ignored. /// NOTE: This function does not enforce that the takerAsset is the same for each order. /// @param orders Array of order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketSellOrdersNoThrow( LibOrder.Order[] memory orders, uint256 takerAssetFillAmount, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev Executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. /// If any fill reverts, the error is caught and ignored. /// NOTE: This function does not enforce that the makerAsset is the same for each order. /// @param orders Array of order specifications. /// @param makerAssetFillAmount Desired amount of makerAsset to buy. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketBuyOrdersNoThrow( LibOrder.Order[] memory orders, uint256 makerAssetFillAmount, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev Calls marketSellOrdersNoThrow then reverts if < takerAssetFillAmount has been sold. /// NOTE: This function does not enforce that the takerAsset is the same for each order. /// @param orders Array of order specifications. /// @param takerAssetFillAmount Minimum amount of takerAsset to sell. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketSellOrdersFillOrKill( LibOrder.Order[] memory orders, uint256 takerAssetFillAmount, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev Calls marketBuyOrdersNoThrow then reverts if < makerAssetFillAmount has been bought. /// NOTE: This function does not enforce that the makerAsset is the same for each order. /// @param orders Array of order specifications. /// @param makerAssetFillAmount Minimum amount of makerAsset to buy. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketBuyOrdersFillOrKill( LibOrder.Order[] memory orders, uint256 makerAssetFillAmount, bytes[] memory signatures ) public payable returns (LibFillResults.FillResults memory fillResults); /// @dev Executes multiple calls of cancelOrder. /// @param orders Array of order specifications. function batchCancelOrders(LibOrder.Order[] memory orders) public payable; } // File: @0x/contracts-exchange/contracts/src/interfaces/ITransferSimulator.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; contract ITransferSimulator { /// @dev This function may be used to simulate any amount of transfers /// As they would occur through the Exchange contract. Note that this function /// will always revert, even if all transfers are successful. However, it may /// be used with eth_call or with a try/catch pattern in order to simulate /// the results of the transfers. /// @param assetData Array of asset details, each encoded per the AssetProxy contract specification. /// @param fromAddresses Array containing the `from` addresses that correspond with each transfer. /// @param toAddresses Array containing the `to` addresses that correspond with each transfer. /// @param amounts Array containing the amounts that correspond to each transfer. /// @return This function does not return a value. However, it will always revert with /// `Error("TRANSFERS_SUCCESSFUL")` if all of the transfers were successful. function simulateDispatchTransferFromCalls( bytes[] memory assetData, address[] memory fromAddresses, address[] memory toAddresses, uint256[] memory amounts ) public; } // File: @0x/contracts-exchange/contracts/src/interfaces/IExchange.sol /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.5.9; // solhint-disable no-empty-blocks contract IExchange is IProtocolFees, IExchangeCore, IMatchOrders, ISignatureValidator, ITransactions, IAssetProxyDispatcher, ITransferSimulator, IWrapperFunctions {} // File: contracts/lib/exchanges/ZeroExExchangeController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title ZeroExExchangeController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @dev This library handles exchanges via 0x. */ library ZeroExExchangeController { using SafeMath for uint256; using SafeERC20 for IERC20; address constant private EXCHANGE_CONTRACT = 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef; IExchange constant private _exchange = IExchange(EXCHANGE_CONTRACT); address constant private ERC20_PROXY_CONTRACT = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF; /** * @dev Gets allowance of the specified token to 0x. * @param erc20Contract The ERC20 contract address of the token. */ function allowance(address erc20Contract) internal view returns (uint256) { return IERC20(erc20Contract).allowance(address(this), ERC20_PROXY_CONTRACT); } /** * @dev Approves tokens to 0x without spending gas on every deposit. * @param erc20Contract The ERC20 contract address of the token. * @param amount Amount of the specified token to approve to dYdX. * @return Boolean indicating success. */ function approve(address erc20Contract, uint256 amount) internal returns (bool) { IERC20 token = IERC20(erc20Contract); uint256 _allowance = token.allowance(address(this), ERC20_PROXY_CONTRACT); if (_allowance == amount) return true; if (amount > 0 && _allowance > 0) token.safeApprove(ERC20_PROXY_CONTRACT, 0); token.safeApprove(ERC20_PROXY_CONTRACT, amount); return true; } /** * @dev Market sells to 0x exchange orders up to a certain amount of input. * @param orders The limit orders to be filled in ascending order of price. * @param signatures The signatures for the orders. * @param takerAssetFillAmount The amount of the taker asset to sell (excluding taker fees). * @param protocolFee The protocol fee in ETH to pay to 0x. * @return Array containing the taker asset filled amount (sold) and maker asset filled amount (bought). */ function marketSellOrdersFillOrKill(LibOrder.Order[] memory orders, bytes[] memory signatures, uint256 takerAssetFillAmount, uint256 protocolFee) internal returns (uint256[2] memory) { require(orders.length > 0, "At least one order and matching signature is required."); require(orders.length == signatures.length, "Mismatch between number of orders and signatures."); require(takerAssetFillAmount > 0, "Taker asset fill amount must be greater than 0."); LibFillResults.FillResults memory fillResults = _exchange.marketSellOrdersFillOrKill.value(protocolFee)(orders, takerAssetFillAmount, signatures); return [fillResults.takerAssetFilledAmount, fillResults.makerAssetFilledAmount]; } /** * @dev Market buys from 0x exchange orders up to a certain amount of output. * @param orders The limit orders to be filled in ascending order of price. * @param signatures The signatures for the orders. * @param makerAssetFillAmount The amount of the maker asset to buy. * @param protocolFee The protocol fee in ETH to pay to 0x. * @return Array containing the taker asset filled amount (sold) and maker asset filled amount (bought). */ function marketBuyOrdersFillOrKill(LibOrder.Order[] memory orders, bytes[] memory signatures, uint256 makerAssetFillAmount, uint256 protocolFee) internal returns (uint256[2] memory) { require(orders.length > 0, "At least one order and matching signature is required."); require(orders.length == signatures.length, "Mismatch between number of orders and signatures."); require(makerAssetFillAmount > 0, "Maker asset fill amount must be greater than 0."); LibFillResults.FillResults memory fillResults = _exchange.marketBuyOrdersFillOrKill.value(protocolFee)(orders, makerAssetFillAmount, signatures); return [fillResults.takerAssetFilledAmount, fillResults.makerAssetFilledAmount]; } } // File: contracts/RariFundController.sol /** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any license), provided that the application does not abuse the APIs or act against the interests of Rari Capital, Inc. * Anyone is free to study, review, and analyze the source code contained in this package. * Reuse (including deployment of smart contracts other than private testing on a private network), modification, redistribution, or sublicensing of any source code contained in this package is not permitted without the explicit permission of David Lucid of Rari Capital, Inc. * No one is permitted to use the software for any purpose other than those allowed by this license. * This license is liable to change at any time at the sole discretion of David Lucid of Rari Capital, Inc. */ pragma solidity 0.5.17; /** * @title RariFundController * @author David Lucid <[email protected]> (https://github.com/davidlucid) * @author Richter Brzeski <[email protected]> (https://github.com/richtermb) * @dev This contract handles deposits to and withdrawals from the liquidity pools that power the Rari Ethereum Pool as well as currency exchanges via 0x. */ contract RariFundController is Ownable { using SafeMath for uint256; using SignedSafeMath for int256; using SafeERC20 for IERC20; /** * @dev Boolean to be checked on `upgradeFundController`. */ bool public constant IS_RARI_FUND_CONTROLLER = true; /** * @dev Boolean that, if true, disables the primary functionality of this RariFundController. */ bool private _fundDisabled; /** * @dev Address of the RariFundManager. */ address payable private _rariFundManagerContract; /** * @dev Address of the rebalancer. */ address private _rariFundRebalancerAddress; /** * @dev Enum for liqudity pools supported by Rari. */ enum LiquidityPool { dYdX, Compound, KeeperDAO, Aave, Alpha, Enzyme } /** * @dev Maps arrays of supported pools to currency codes. */ uint8[] private _supportedPools; /** * @dev COMP token address. */ address constant private COMP_TOKEN = 0xc00e94Cb662C3520282E6f5717214004A7f26888; /** * @dev ROOK token address. */ address constant private ROOK_TOKEN = 0xfA5047c9c78B8877af97BDcb85Db743fD7313d4a; /** * @dev WETH token contract. */ IEtherToken constant private _weth = IEtherToken(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); /** * @dev Caches the balances for each pool, with the sum cached at the end */ uint256[] private _cachedBalances; /** * @dev Constructor that sets supported ERC20 token contract addresses and supported pools for each supported token. */ constructor () public { Ownable.initialize(msg.sender); // Add supported pools addPool(0); // dYdX addPool(1); // Compound addPool(2); // KeeperDAO addPool(3); // Aave addPool(4); // Alpha addPool(5); // Enzyme } /** * @dev Adds a supported pool for a token. * @param pool Pool ID to be supported. */ function addPool(uint8 pool) internal { _supportedPools.push(pool); } /** * @dev Payable fallback function called by 0x exchange to refund unspent protocol fee. */ function () external payable { } /** * @dev Emitted when the RariFundManager of the RariFundController is set. */ event FundManagerSet(address newAddress); /** * @dev Sets or upgrades the RariFundManager of the RariFundController. * @param newContract The address of the new RariFundManager contract. */ function setFundManager(address payable newContract) external onlyOwner { _rariFundManagerContract = newContract; emit FundManagerSet(newContract); } /** * @dev Throws if called by any account other than the RariFundManager. */ modifier onlyManager() { require(_rariFundManagerContract == msg.sender, "Caller is not the fund manager."); _; } /** * @dev Emitted when the rebalancer of the RariFundController is set. */ event FundRebalancerSet(address newAddress); /** * @dev Sets or upgrades the rebalancer of the RariFundController. * @param newAddress The Ethereum address of the new rebalancer server. */ function setFundRebalancer(address newAddress) external onlyOwner { _rariFundRebalancerAddress = newAddress; emit FundRebalancerSet(newAddress); } /** * @dev Throws if called by any account other than the rebalancer. */ modifier onlyRebalancer() { require(_rariFundRebalancerAddress == msg.sender, "Caller is not the rebalancer."); _; } /** * @dev Emitted when the primary functionality of this RariFundController contract has been disabled. */ event FundDisabled(); /** * @dev Emitted when the primary functionality of this RariFundController contract has been enabled. */ event FundEnabled(); /** * @dev Disables primary functionality of this RariFundController so contract(s) can be upgraded. */ function disableFund() external onlyOwner { require(!_fundDisabled, "Fund already disabled."); _fundDisabled = true; emit FundDisabled(); } /** * @dev Enables primary functionality of this RariFundController once contract(s) are upgraded. */ function enableFund() external onlyOwner { require(_fundDisabled, "Fund already enabled."); _fundDisabled = false; emit FundEnabled(); } /** * @dev Throws if fund is disabled. */ modifier fundEnabled() { require(!_fundDisabled, "This fund controller contract is disabled. This may be due to an upgrade."); _; } /** * @dev Sets or upgrades RariFundController by forwarding immediate balance of ETH from the old to the new. * @param newContract The address of the new RariFundController contract. */ function _upgradeFundController(address payable newContract) public onlyOwner { // Verify fund is disabled + verify new fund controller contract require(_fundDisabled, "This fund controller contract must be disabled before it can be upgraded."); require(RariFundController(newContract).IS_RARI_FUND_CONTROLLER(), "New contract does not have IS_RARI_FUND_CONTROLLER set to true."); // Transfer all ETH to new fund controller uint256 balance = address(this).balance; if (balance > 0) { (bool success, ) = newContract.call.value(balance)(""); require(success, "Failed to transfer ETH."); } } /** * @dev Sets or upgrades RariFundController by withdrawing all ETH from all pools and forwarding them from the old to the new. * @param newContract The address of the new RariFundController contract. */ function upgradeFundController(address payable newContract) external onlyOwner { // Withdraw all from Enzyme first because they output other LP tokens if (hasETHInPool(5)) _withdrawAllFromPool(5); // Then withdraw all from all other pools for (uint256 i = 0; i < _supportedPools.length; i++) if (hasETHInPool(_supportedPools[i])) _withdrawAllFromPool(_supportedPools[i]); // Transfer all ETH to new fund controller _upgradeFundController(newContract); } /** * @dev Returns the fund controller's balance of the specified currency in the specified pool. * @dev Ideally, we can add the view modifier, but Compound's `getUnderlyingBalance` function (called by `CompoundPoolController.getBalance`) potentially modifies the state. * @param pool The index of the pool. */ function _getPoolBalance(uint8 pool) public returns (uint256) { if (pool == 0) return DydxPoolController.getBalance(); else if (pool == 1) return CompoundPoolController.getBalance(); else if (pool == 2) return KeeperDaoPoolController.getBalance(); else if (pool == 3) return AavePoolController.getBalance(); else if (pool == 4) return AlphaPoolController.getBalance(); else if (pool == 5) return EnzymePoolController.getBalance(_enzymeComptroller); else revert("Invalid pool index."); } /** * @dev Returns the fund controller's balance of the specified currency in the specified pool. * @dev Ideally, we can add the view modifier, but Compound's `getUnderlyingBalance` function (called by `CompoundPoolController.getBalance`) potentially modifies the state. * @param pool The index of the pool. */ function getPoolBalance(uint8 pool) public returns (uint256) { if (!_poolsWithFunds[pool]) return 0; return _getPoolBalance(pool); } /** * @notice Returns the fund controller's balance of each pool of the specified currency. * @dev Ideally, we can add the view modifier, but Compound's `getUnderlyingBalance` function (called by `getPoolBalance`) potentially modifies the state. * @return An array of pool indexes and an array of corresponding balances. */ function getEntireBalance() public returns (uint256) { uint256 sum = address(this).balance; // start with immediate eth balance for (uint256 i = 0; i < _supportedPools.length; i++) { sum = getPoolBalance(_supportedPools[i]).add(sum); } return sum; } /** * @dev Approves WETH to pool without spending gas on every deposit. * @param pool The index of the pool. * @param amount The amount of WETH to be approved. */ function approveWethToPool(uint8 pool, uint256 amount) external fundEnabled onlyRebalancer { if (pool == 0) return DydxPoolController.approve(amount); else if (pool == 5) return EnzymePoolController.approve(_enzymeComptroller, amount); else revert("Invalid pool index."); } /** * @dev Approves kEther to the specified pool without spending gas on every deposit. * @param amount The amount of kEther to be approved. */ function approvekEtherToKeeperDaoPool(uint256 amount) external fundEnabled onlyRebalancer { KeeperDaoPoolController.approve(amount); } /** * @dev Mapping of bools indicating the presence of funds to pools. */ mapping(uint8 => bool) _poolsWithFunds; /** * @dev Return a boolean indicating if the fund controller has funds in `currencyCode` in `pool`. * @param pool The index of the pool to check. */ function hasETHInPool(uint8 pool) public view returns (bool) { return _poolsWithFunds[pool]; } /** * @dev Referral code for Aave deposits. */ uint16 _aaveReferralCode; /** * @dev Sets the referral code for Aave deposits. * @param referralCode The referral code. */ function setAaveReferralCode(uint16 referralCode) external onlyOwner { _aaveReferralCode = referralCode; } /** * @dev The Enzyme pool Comptroller contract address. */ address _enzymeComptroller; /** * @dev Sets the Enzyme pool Comptroller contract address. * @param comptroller The Enzyme pool Comptroller contract address. */ function setEnzymeComptroller(address comptroller) external onlyOwner { _enzymeComptroller = comptroller; } /** * @dev Enum for pool allocation action types supported by Rari. */ enum PoolAllocationAction { Deposit, Withdraw, WithdrawAll } /** * @dev Emitted when a deposit or withdrawal is made. * Note that `amount` is not set for `WithdrawAll` actions. */ event PoolAllocation(PoolAllocationAction indexed action, LiquidityPool indexed pool, uint256 amount); /** * @dev Deposits funds to the specified pool. * @param pool The index of the pool. */ function depositToPool(uint8 pool, uint256 amount) external fundEnabled onlyRebalancer { require(amount > 0, "Amount must be greater than 0."); if (pool == 0) DydxPoolController.deposit(amount); else if (pool == 1) CompoundPoolController.deposit(amount); else if (pool == 2) KeeperDaoPoolController.deposit(amount); else if (pool == 3) AavePoolController.deposit(amount, _aaveReferralCode); else if (pool == 4) AlphaPoolController.deposit(amount); else if (pool == 5) EnzymePoolController.deposit(_enzymeComptroller, amount); else revert("Invalid pool index."); _poolsWithFunds[pool] = true; emit PoolAllocation(PoolAllocationAction.Deposit, LiquidityPool(pool), amount); } /** * @dev Internal function to withdraw funds from the specified pool. * @param pool The index of the pool. * @param amount The amount of tokens to be withdrawn. */ function _withdrawFromPool(uint8 pool, uint256 amount) internal { if (pool == 0) DydxPoolController.withdraw(amount); else if (pool == 1) CompoundPoolController.withdraw(amount); else if (pool == 2) KeeperDaoPoolController.withdraw(amount); else if (pool == 3) AavePoolController.withdraw(amount); else if (pool == 4) AlphaPoolController.withdraw(amount); else if (pool == 5) EnzymePoolController.withdraw(_enzymeComptroller, amount); else revert("Invalid pool index."); emit PoolAllocation(PoolAllocationAction.Withdraw, LiquidityPool(pool), amount); } /** * @dev Withdraws funds from the specified pool. * @param pool The index of the pool. * @param amount The amount of tokens to be withdrawn. */ function withdrawFromPool(uint8 pool, uint256 amount) external fundEnabled onlyRebalancer { require(amount > 0, "Amount must be greater than 0."); _withdrawFromPool(pool, amount); _poolsWithFunds[pool] = _getPoolBalance(pool) > 0; } /** * @dev Withdraws funds from the specified pool (caching the `initialBalance` parameter). * @param pool The index of the pool. * @param amount The amount of tokens to be withdrawn. * @param initialBalance The fund's balance of the specified currency in the specified pool before the withdrawal. */ function withdrawFromPoolKnowingBalance(uint8 pool, uint256 amount, uint256 initialBalance) public fundEnabled onlyManager { _withdrawFromPool(pool, amount); if (amount == initialBalance) _poolsWithFunds[pool] = false; } /** * @dev Internal function that withdraws all funds from the specified pool. * @param pool The index of the pool. */ function _withdrawAllFromPool(uint8 pool) internal { if (pool == 0) DydxPoolController.withdrawAll(); else if (pool == 1) require(CompoundPoolController.withdrawAll(), "No Compound balance to withdraw from."); else if (pool == 2) require(KeeperDaoPoolController.withdrawAll(), "No KeeperDAO balance to withdraw from."); else if (pool == 3) AavePoolController.withdrawAll(); else if (pool == 4) require(AlphaPoolController.withdrawAll(), "No Alpha Homora balance to withdraw from."); else if (pool == 5) EnzymePoolController.withdrawAll(_enzymeComptroller); else revert("Invalid pool index."); _poolsWithFunds[pool] = false; emit PoolAllocation(PoolAllocationAction.WithdrawAll, LiquidityPool(pool), 0); } /** * @dev Withdraws all funds from the specified pool. * @param pool The index of the pool. * @return Boolean indicating success. */ function withdrawAllFromPool(uint8 pool) external fundEnabled onlyRebalancer { _withdrawAllFromPool(pool); } /** * @dev Withdraws all funds from the specified pool (without requiring the fund to be enabled). * @param pool The index of the pool. * @return Boolean indicating success. */ function withdrawAllFromPoolOnUpgrade(uint8 pool) external onlyOwner { _withdrawAllFromPool(pool); } /** * @dev Withdraws ETH and sends amount to the manager. * @param amount Amount of ETH to withdraw. */ function withdrawToManager(uint256 amount) external onlyManager { // Input validation require(amount > 0, "Withdrawal amount must be greater than 0."); // Check contract balance and withdraw from pools if necessary uint256 contractBalance = address(this).balance; // get ETH balance if (contractBalance < amount) { uint256 poolBalance = getPoolBalance(5); if (poolBalance > 0) { uint256 amountLeft = amount.sub(contractBalance); uint256 poolAmount = amountLeft < poolBalance ? amountLeft : poolBalance; withdrawFromPoolKnowingBalance(5, poolAmount, poolBalance); contractBalance = address(this).balance; } } for (uint256 i = 0; i < _supportedPools.length; i++) { if (contractBalance >= amount) break; uint8 pool = _supportedPools[i]; if (pool == 5) continue; uint256 poolBalance = getPoolBalance(pool); if (poolBalance <= 0) continue; uint256 amountLeft = amount.sub(contractBalance); uint256 poolAmount = amountLeft < poolBalance ? amountLeft : poolBalance; withdrawFromPoolKnowingBalance(pool, poolAmount, poolBalance); contractBalance = contractBalance.add(poolAmount); } require(address(this).balance >= amount, "Too little ETH to transfer."); (bool success, ) = _rariFundManagerContract.call.value(amount)(""); require(success, "Failed to transfer ETH to RariFundManager."); } /** * @dev Emitted when COMP is exchanged to ETH via 0x. */ event CurrencyTrade(address inputErc20Contract, uint256 inputAmount, uint256 outputAmount); /** * @dev Approves tokens (COMP or ROOK) to 0x without spending gas on every deposit. * @param erc20Contract The ERC20 contract address of the token to be approved (must be COMP or ROOK). * @param amount The amount of tokens to be approved. */ function approveTo0x(address erc20Contract, uint256 amount) external fundEnabled onlyRebalancer { require(erc20Contract == COMP_TOKEN || erc20Contract == ROOK_TOKEN, "Supplied token address is not COMP or ROOK."); ZeroExExchangeController.approve(erc20Contract, amount); } /** * @dev Market sell (COMP or ROOK) to 0x exchange orders (reverting if `takerAssetFillAmount` is not filled). * We should be able to make this function external and use calldata for all parameters, but Solidity does not support calldata structs (https://github.com/ethereum/solidity/issues/5479). * @param inputErc20Contract The input ERC20 token contract address (must be COMP or ROOK). * @param orders The limit orders to be filled in ascending order of price. * @param signatures The signatures for the orders. * @param takerAssetFillAmount The amount of the taker asset to sell (excluding taker fees). */ function marketSell0xOrdersFillOrKill(address inputErc20Contract, LibOrder.Order[] memory orders, bytes[] memory signatures, uint256 takerAssetFillAmount) public payable fundEnabled onlyRebalancer { // Exchange COMP/ROOK to ETH uint256 ethBalanceBefore = address(this).balance; uint256[2] memory filledAmounts = ZeroExExchangeController.marketSellOrdersFillOrKill(orders, signatures, takerAssetFillAmount, msg.value); uint256 ethBalanceAfter = address(this).balance; emit CurrencyTrade(inputErc20Contract, filledAmounts[0], filledAmounts[1]); // Unwrap outputted WETH uint256 wethBalance = _weth.balanceOf(address(this)); require(wethBalance > 0, "No WETH outputted."); _weth.withdraw(wethBalance); // Refund unspent ETH protocol fee uint256 refund = ethBalanceAfter.sub(ethBalanceBefore.sub(msg.value)); if (refund > 0) { (bool success, ) = msg.sender.call.value(refund)(""); require(success, "Failed to refund unspent ETH protocol fee."); } } /** * Unwraps all WETH currently owned by the fund controller. */ function unwrapAllWeth() external fundEnabled onlyRebalancer { uint256 wethBalance = _weth.balanceOf(address(this)); require(wethBalance > 0, "No WETH to withdraw."); _weth.withdraw(wethBalance); } /** * @notice Returns the fund controller's contract ETH balance and balance of each pool (checking `_poolsWithFunds` first to save gas). * @dev Ideally, we can add the `view` modifier, but Compound's `getUnderlyingBalance` function (called by `getPoolBalance`) potentially modifies the state. * @return The fund controller ETH contract balance, an array of pool indexes, and an array of corresponding balances for each pool. */ function getRawFundBalances() external returns (uint256, uint8[] memory, uint256[] memory) { uint8[] memory pools = new uint8[](_supportedPools.length); uint256[] memory poolBalances = new uint256[](_supportedPools.length); for (uint256 i = 0; i < _supportedPools.length; i++) { pools[i] = _supportedPools[i]; poolBalances[i] = getPoolBalance(_supportedPools[i]); } return (address(this).balance, pools, poolBalances); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inputErc20Contract","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"}],"name":"CurrencyTrade","type":"event"},{"anonymous":false,"inputs":[],"name":"FundDisabled","type":"event"},{"anonymous":false,"inputs":[],"name":"FundEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"FundManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"FundRebalancerSet","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":"enum RariFundController.PoolAllocationAction","name":"action","type":"uint8"},{"indexed":true,"internalType":"enum RariFundController.LiquidityPool","name":"pool","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PoolAllocation","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"IS_RARI_FUND_CONTROLLER","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"}],"name":"_getPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newContract","type":"address"}],"name":"_upgradeFundController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"erc20Contract","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveTo0x","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveWethToPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approvekEtherToKeeperDaoPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositToPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"disableFund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"enableFund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getEntireBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"}],"name":"getPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getRawFundBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint8[]","name":"","type":"uint8[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"}],"name":"hasETHInPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"inputErc20Contract","type":"address"},{"components":[{"internalType":"address","name":"makerAddress","type":"address"},{"internalType":"address","name":"takerAddress","type":"address"},{"internalType":"address","name":"feeRecipientAddress","type":"address"},{"internalType":"address","name":"senderAddress","type":"address"},{"internalType":"uint256","name":"makerAssetAmount","type":"uint256"},{"internalType":"uint256","name":"takerAssetAmount","type":"uint256"},{"internalType":"uint256","name":"makerFee","type":"uint256"},{"internalType":"uint256","name":"takerFee","type":"uint256"},{"internalType":"uint256","name":"expirationTimeSeconds","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"bytes","name":"makerAssetData","type":"bytes"},{"internalType":"bytes","name":"takerAssetData","type":"bytes"},{"internalType":"bytes","name":"makerFeeAssetData","type":"bytes"},{"internalType":"bytes","name":"takerFeeAssetData","type":"bytes"}],"internalType":"struct LibOrder.Order[]","name":"orders","type":"tuple[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"uint256","name":"takerAssetFillAmount","type":"uint256"}],"name":"marketSell0xOrdersFillOrKill","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint16","name":"referralCode","type":"uint16"}],"name":"setAaveReferralCode","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"comptroller","type":"address"}],"name":"setEnzymeComptroller","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newContract","type":"address"}],"name":"setFundManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setFundRebalancer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unwrapAllWeth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newContract","type":"address"}],"name":"upgradeFundController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"}],"name":"withdrawAllFromPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"}],"name":"withdrawAllFromPoolOnUpgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFromPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"pool","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"initialBalance","type":"uint256"}],"name":"withdrawFromPoolKnowingBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200002833620000ac60201b620014701760201c565b6200003d60006001600160e01b036200019a16565b6200005260016001600160e01b036200019a16565b6200006760026001600160e01b036200019a16565b6200007c60036001600160e01b036200019a16565b6200009160046001600160e01b036200019a16565b620000a660056001600160e01b036200019a16565b6200026c565b600054610100900460ff1680620000d15750620000d16001600160e01b03620001f316565b80620000e0575060005460ff16155b620001085760405162461bcd60e51b8152600401620000ff906200024b565b60405180910390fd5b600054610100900460ff1615801562000134576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3801562000196576000805461ff00191690555b5050565b60688054600181018255600091909152602081047fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775301805460ff938416601f9093166101000a9283029390920219909116919091179055565b303b1590565b600062000208602e8362000263565b7f436f6e747261637420696e7374616e63652068617320616c726561647920626581526d195b881a5b9a5d1a585b1a5e995960921b602082015260400192915050565b602080825281016200025d81620001f9565b92915050565b90815260200190565b613e4a806200027c6000396000f3fe6080604052600436106101cd5760003560e01c806398e40131116100f7578063c66dc09711610095578063f2fde38b11610064578063f2fde38b146104f6578063f3b4338614610516578063fa95e83d1461052b578063fbc9dfc41461053e576101cd565b8063c66dc0971461047d578063e2e4c60c1461049d578063e8bee352146104c1578063ef44ea8b146104d6576101cd565b8063b02c0065116100d1578063b02c0065146103fd578063b9d9f62b1461041d578063bef48c371461043d578063c4d66de81461045d576101cd565b806398e401311461039d5780639b53ff49146103bd578063a9065581146103dd576101cd565b806351cbf3481161016f578063715018a61161013e578063715018a6146103315780638da5cb5b146103465780638f32d59b146103685780638fe6b38d1461037d576101cd565b806351cbf348146102af57806362016d42146102cf57806365df2918146102ef5780636cf0a7b014610304576101cd565b80631c5b0923116101ab5780631c5b09231461022f578063232a30601461025a578063375426861461027a5780634e02bebc1461029a576101cd565b806308e169d9146101cf5780630fcb042c146101ef578063126afd7c1461020f575b005b3480156101db57600080fd5b506101cd6101ea366004612c86565b61055e565b3480156101fb57600080fd5b506101cd61020a366004612b61565b6105a3565b34801561021b57600080fd5b506101cd61022a366004612ce0565b6106ff565b34801561023b57600080fd5b50610244610758565b6040516102519190613c60565b60405180910390f35b34801561026657600080fd5b506101cd610275366004612b61565b6107bc565b34801561028657600080fd5b506101cd610295366004612cfe565b61083b565b3480156102a657600080fd5b506101cd61096a565b3480156102bb57600080fd5b506101cd6102ca366004612ca4565b610acf565b3480156102db57600080fd5b506102446102ea366004612ce0565b610b7f565b3480156102fb57600080fd5b506101cd610dbd565b34801561031057600080fd5b5061032461031f366004612ce0565b610e38565b6040516102519190613a43565b34801561033d57600080fd5b506101cd610e50565b34801561035257600080fd5b5061035b610ebe565b6040516102519190613997565b34801561037457600080fd5b50610324610ecd565b34801561038957600080fd5b506101cd610398366004612c10565b610ef3565b3480156103a957600080fd5b506101cd6103b8366004612b61565b610fad565b3480156103c957600080fd5b506101cd6103d8366004612ca4565b610ffb565b3480156103e957600080fd5b506101cd6103f8366004612b61565b61120f565b34801561040957600080fd5b506101cd610418366004612b61565b61127e565b34801561042957600080fd5b506101cd610438366004612d1d565b611349565b34801561044957600080fd5b506101cd610458366004612cfe565b6113ca565b34801561046957600080fd5b506101cd610478366004612b61565b611470565b34801561048957600080fd5b506101cd610498366004612cfe565b611542565b3480156104a957600080fd5b506104b2611800565b60405161025193929190613c6e565b3480156104cd57600080fd5b50610324611902565b3480156104e257600080fd5b506101cd6104f1366004612ce0565b611907565b34801561050257600080fd5b506101cd610511366004612b61565b61192b565b34801561052257600080fd5b506101cd611958565b6101cd610539366004612b7f565b6119d7565b34801561054a57600080fd5b50610244610559366004612ce0565b611c48565b610566610ecd565b61058b5760405162461bcd60e51b815260040161058290613b90565b60405180910390fd5b606b805461ffff191661ffff92909216919091179055565b6105ab610ecd565b6105c75760405162461bcd60e51b815260040161058290613b90565b60665460ff166105e95760405162461bcd60e51b815260040161058290613be0565b806001600160a01b031663e8bee3526040518163ffffffff1660e01b815260040160206040518083038186803b15801561062257600080fd5b505afa158015610636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061065a9190810190612c4a565b6106765760405162461bcd60e51b815260040161058290613b40565b4780156106fb576000826001600160a01b0316826040516106969061398c565b60006040518083038185875af1925050503d80600081146106d3576040519150601f19603f3d011682016040523d82523d6000602084013e6106d8565b606091505b50509050806106f95760405162461bcd60e51b815260040161058290613ad0565b505b5050565b60665460ff16156107225760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b0316331461074c5760405162461bcd60e51b815260040161058290613a70565b61075581611c7a565b50565b600047815b6068548110156107b6576107ac826107a06068848154811061077b57fe5b90600052602060002090602091828204019190069054906101000a900460ff16611c48565b9063ffffffff611ffd16565b915060010161075d565b50905090565b6107c4610ecd565b6107e05760405162461bcd60e51b815260040161058290613b90565b60668054610100600160a81b0319166101006001600160a01b038416021790556040517ff980c1430e55b1867cd9337a1f20246ab3b7255032486d0b71c24e820eebf3ab906108309083906139a5565b60405180910390a150565b60665460ff161561085e5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146108885760405162461bcd60e51b815260040161058290613a70565b60ff82166108fc57604051632dd67e5560e21b8152735add5c070902e4b535f76bafac486cc689095d719063b759f954906108c7908490600401613c60565b60006040518083038186803b1580156108df57600080fd5b505af41580156108f3573d6000803e3d6000fd5b505050506106fb565b8160ff166005141561095257606b5460405163095ea7b360e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163095ea7b3916108c7916201000090046001600160a01b03169085906004016139ce565b60405162461bcd60e51b815260040161058290613c40565b60665460ff161561098d5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146109b75760405162461bcd60e51b815260040161058290613a70565b6040516370a0823160e01b815260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a08231906109f19030906004016139a5565b60206040518083038186803b158015610a0957600080fd5b505afa158015610a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a419190810190612cc2565b905060008111610a635760405162461bcd60e51b815260040161058290613ae0565b604051632e1a7d4d60e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90610a9a908490600401613c60565b600060405180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b5050505050565b60665460ff1615610af25760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314610b1c5760405162461bcd60e51b815260040161058290613a70565b604051632dd67e5560e21b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae669063b759f95490610b53908490600401613c60565b60006040518083038186803b158015610b6b57600080fd5b505af4158015610ac8573d6000803e3d6000fd5b600060ff8216610c0c57735add5c070902e4b535f76bafac486cc689095d716312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b505af4158015610be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c059190810190612cc2565b9050610db8565b8160ff1660011415610c5c5773de6796aa414173b63f626be1f13e419d8e35fc096312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660021415610cac5773948e587a4c175e3b4208f8084e6b8c5c0c4dae666312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660031415610cfc577325f9cebb75ebbaa7b7eddc70d33ffb993896ecb96312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660041415610d4c5773ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f6312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff166005141561095257606b5460405163f8b2cb4f60e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163f8b2cb4f91610da0916201000090046001600160a01b031690600401613997565b60206040518083038186803b158015610bcd57600080fd5b919050565b610dc5610ecd565b610de15760405162461bcd60e51b815260040161058290613b90565b60665460ff16610e035760405162461bcd60e51b815260040161058290613b00565b6066805460ff191690556040517f8e1c35fbf7cd686deedf8310574cf4ad038a00a86d3317c831afaeec58f1eeae90600090a1565b60ff9081166000908152606a60205260409020541690565b610e58610ecd565b610e745760405162461bcd60e51b815260040161058290613b90565b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b6033546000906001600160a01b0316610ee4612029565b6001600160a01b031614905090565b60665460ff1615610f165760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314610f405760405162461bcd60e51b815260040161058290613a70565b6001600160a01b03821673c00e94cb662c3520282e6f5717214004a7f268881480610f8757506001600160a01b03821673fa5047c9c78b8877af97bdcb85db743fd7313d4a145b610fa35760405162461bcd60e51b815260040161058290613b30565b6106f9828261202d565b610fb5610ecd565b610fd15760405162461bcd60e51b815260040161058290613b90565b606b80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60665461010090046001600160a01b0316331461102a5760405162461bcd60e51b815260040161058290613b10565b6000811161104a5760405162461bcd60e51b815260040161058290613c10565b47818110156110a257600061105f6005611c48565b905080156110a0576000611079848463ffffffff61215816565b9050600082821061108a578261108c565b815b905061109a60058285611349565b47935050505b505b60005b606854811015611168578282106110bb57611168565b6000606882815481106110ca57fe5b60009182526020918290209181049091015460ff601f9092166101000a900416905060058114156110fb5750611160565b600061110682611c48565b905060008111611117575050611160565b6000611129868663ffffffff61215816565b9050600082821061113a578261113c565b815b9050611149848285611349565b611159868263ffffffff611ffd16565b9550505050505b6001016110a5565b50814710156111895760405162461bcd60e51b815260040161058290613b50565b60665460405160009161010090046001600160a01b03169084906111ac9061398c565b60006040518083038185875af1925050503d80600081146111e9576040519150601f19603f3d011682016040523d82523d6000602084013e6111ee565b606091505b50509050806106f95760405162461bcd60e51b815260040161058290613bb0565b611217610ecd565b6112335760405162461bcd60e51b815260040161058290613b90565b606780546001600160a01b0319166001600160a01b0383161790556040517feb9b68c1cca2a0c5d180f75c6324fad517a04867907b0f3bee85d98fdf57ee9490610830908390613997565b611286610ecd565b6112a25760405162461bcd60e51b815260040161058290613b90565b6112ac6005610e38565b156112bb576112bb6005611c7a565b60005b60685481101561133f576112fd606882815481106112d857fe5b90600052602060002090602091828204019190069054906101000a900460ff16610e38565b15611337576113376068828154811061131257fe5b90600052602060002090602091828204019190069054906101000a900460ff16611c7a565b6001016112be565b50610755816105a3565b60665460ff161561136c5760405162461bcd60e51b815260040161058290613aa0565b60665461010090046001600160a01b0316331461139b5760405162461bcd60e51b815260040161058290613b10565b6113a5838361219a565b808214156106f957505060ff166000908152606a60205260409020805460ff19169055565b60665460ff16156113ed5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146114175760405162461bcd60e51b815260040161058290613a70565b600081116114375760405162461bcd60e51b815260040161058290613a80565b611441828261219a565b600061144c83610b7f565b60ff9093166000908152606a60205260409020805460ff1916919093111790915550565b600054610100900460ff16806114895750611489612391565b80611497575060005460ff16155b6114b35760405162461bcd60e51b815260040161058290613ba0565b600054610100900460ff161580156114de576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a380156106fb576000805461ff00191690555050565b60665460ff16156115655760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b0316331461158f5760405162461bcd60e51b815260040161058290613a70565b600081116115af5760405162461bcd60e51b815260040161058290613a80565b60ff82166116235760405163b6b55f2560e01b8152735add5c070902e4b535f76bafac486cc689095d719063b6b55f25906115ee908490600401613c60565b60006040518083038186803b15801561160657600080fd5b505af415801561161a573d6000803e3d6000fd5b5050505061178f565b8160ff16600114156116665760405163b6b55f2560e01b815273de6796aa414173b63f626be1f13e419d8e35fc099063b6b55f25906115ee908490600401613c60565b8160ff16600214156116a95760405163b6b55f2560e01b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae669063b6b55f25906115ee908490600401613c60565b8160ff16600314156116f657606b5460405163422b01d360e11b81527325f9cebb75ebbaa7b7eddc70d33ffb993896ecb99163845603a6916115ee91859161ffff90911690600401613ca2565b8160ff16600414156117395760405163b6b55f2560e01b815273ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f9063b6b55f25906115ee908490600401613c60565b8160ff166005141561095257606b546040516311f9fbc960e21b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc3916347e7ef24916115ee916201000090046001600160a01b03169085906004016139ce565b60ff82166000818152606a60205260409020805460ff1916600117905560058111156117b757fe5b60058111156117c257fe5b60005b7f9e17470c2398acb1637f3cd25310210eb4c04c2f91adee1cef82fd1230f1f6ad836040516117f49190613c60565b60405180910390a35050565b60006060806060606880549050604051908082528060200260200182016040528015611836578160200160208202803883390190505b509050606060688054905060405190808252806020026020018201604052801561186a578160200160208202803883390190505b50905060005b6068548110156118f6576068818154811061188757fe5b90600052602060002090602091828204019190069054906101000a900460ff168382815181106118b357fe5b602002602001019060ff16908160ff16815250506118d76068828154811061077b57fe5b8282815181106118e357fe5b6020908102919091010152600101611870565b50479591945092509050565b600181565b61190f610ecd565b61074c5760405162461bcd60e51b815260040161058290613b90565b611933610ecd565b61194f5760405162461bcd60e51b815260040161058290613b90565b61075581612397565b611960610ecd565b61197c5760405162461bcd60e51b815260040161058290613b90565b60665460ff161561199f5760405162461bcd60e51b815260040161058290613bd0565b6066805460ff191660011790556040517f0a6b9c6c74d93f230c4346c52ac415dd7dda5a0efb4f7394c0bfb5baa87d326590600090a1565b60665460ff16156119fa5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314611a245760405162461bcd60e51b815260040161058290613a70565b47611a2d612792565b611a3985858534612419565b8051602082015160405192935047927fbdf71678f3f7c296138b1bb2ac053c1d65f5c41347edd3ef7bb8c139bc3e3dd392611a75928b926139e9565b60405180910390a16040516370a0823160e01b815260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190611ab79030906004016139a5565b60206040518083038186803b158015611acf57600080fd5b505afa158015611ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b079190810190612cc2565b905060008111611b295760405162461bcd60e51b815260040161058290613bf0565b604051632e1a7d4d60e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90611b60908490600401613c60565b600060405180830381600087803b158015611b7a57600080fd5b505af1158015611b8e573d6000803e3d6000fd5b505050506000611bb7611baa348761215890919063ffffffff16565b849063ffffffff61215816565b90508015611c3d576000336001600160a01b031682604051611bd89061398c565b60006040518083038185875af1925050503d8060008114611c15576040519150601f19603f3d011682016040523d82523d6000602084013e611c1a565b606091505b5050905080611c3b5760405162461bcd60e51b815260040161058290613b80565b505b505050505050505050565b60ff8082166000908152606a6020526040812054909116611c6b57506000610db8565b611c7482610b7f565b92915050565b60ff8116611ce357735add5c070902e4b535f76bafac486cc689095d7163853828b66040518163ffffffff1660e01b815260040160006040518083038186803b158015611cc657600080fd5b505af4158015611cda573d6000803e3d6000fd5b50505050611f90565b8060ff1660011415611d8c5773de6796aa414173b63f626be1f13e419d8e35fc0963853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611d3357600080fd5b505af4158015611d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d6b9190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613b60565b611f90565b8060ff1660021415611e305773948e587a4c175e3b4208f8084e6b8c5c0c4dae6663853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ddc57600080fd5b505af4158015611df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e149190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613b70565b8060ff1660031415611e80577325f9cebb75ebbaa7b7eddc70d33ffb993896ecb963853828b66040518163ffffffff1660e01b815260040160006040518083038186803b158015611cc657600080fd5b8060ff1660041415611f245773ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f63853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ed057600080fd5b505af4158015611ee4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611f089190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613a90565b8060ff166005141561095257606b54604051630fa09e6360e41b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163fa09e63091611f78916201000090046001600160a01b031690600401613997565b60006040518083038186803b158015611cc657600080fd5b60ff81166000818152606a60205260409020805460ff191690556005811115611fb557fe5b6005811115611fc057fe5b60027f9e17470c2398acb1637f3cd25310210eb4c04c2f91adee1cef82fd1230f1f6ad6000604051611ff29190613a51565b60405180910390a350565b6000828201838110156120225760405162461bcd60e51b815260040161058290613af0565b9392505050565b3390565b604051636eb1769f60e11b8152600090839082906001600160a01b0383169063dd62ed3e906120769030907395e6f48254609a6ee006f7d493c8e5fb97094cef906004016139b3565b60206040518083038186803b15801561208e57600080fd5b505afa1580156120a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120c69190810190612cc2565b9050838114156120db57600192505050611c74565b6000841180156120eb5750600081115b1561211f5761211f6001600160a01b0383167395e6f48254609a6ee006f7d493c8e5fb97094cef600063ffffffff61254516565b61214d6001600160a01b0383167395e6f48254609a6ee006f7d493c8e5fb97094cef8663ffffffff61254516565b506001949350505050565b600061202283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612642565b60ff821661220e57604051632e1a7d4d60e01b8152735add5c070902e4b535f76bafac486cc689095d7190632e1a7d4d906121d9908490600401613c60565b60006040518083038186803b1580156121f157600080fd5b505af4158015612205573d6000803e3d6000fd5b50505050612370565b8160ff166001141561225157604051632e1a7d4d60e01b815273de6796aa414173b63f626be1f13e419d8e35fc0990632e1a7d4d906121d9908490600401613c60565b8160ff166002141561229457604051632e1a7d4d60e01b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae6690632e1a7d4d906121d9908490600401613c60565b8160ff16600314156122d757604051632e1a7d4d60e01b81527325f9cebb75ebbaa7b7eddc70d33ffb993896ecb990632e1a7d4d906121d9908490600401613c60565b8160ff166004141561231a57604051632e1a7d4d60e01b815273ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f90632e1a7d4d906121d9908490600401613c60565b8160ff166005141561095257606b5460405163f3fef3a360e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163f3fef3a3916121d9916201000090046001600160a01b03169085906004016139ce565b8160ff16600581111561237f57fe5b600581111561238a57fe5b60016117c5565b303b1590565b6001600160a01b0381166123bd5760405162461bcd60e51b815260040161058290613ac0565b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b612421612792565b60008551116124425760405162461bcd60e51b815260040161058290613ab0565b83518551146124635760405162461bcd60e51b815260040161058290613bc0565b600083116124835760405162461bcd60e51b815260040161058290613c00565b61248b6127b0565b60405163a6c3bf3360e01b81527361935cbdd02287b511119ddb11aeb42f1593b7ef9063a6c3bf339085906124c8908a9089908b90600401613a11565b60a0604051808303818588803b1580156124e157600080fd5b505af11580156124f5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525061251a9190810190612c68565b905060405180604001604052808260200151815260200182600001518152509150505b949350505050565b8015806125cd5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e9061257b90309086906004016139b3565b60206040518083038186803b15801561259357600080fd5b505afa1580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125cb9190810190612cc2565b155b6125e95760405162461bcd60e51b815260040161058290613c30565b6040516106f990849063095ea7b360e01b9061260b90869086906024016139ce565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261266e565b600081848411156126665760405162461bcd60e51b81526004016105829190613a5f565b505050900390565b612680826001600160a01b0316612759565b61269c5760405162461bcd60e51b815260040161058290613c50565b60006060836001600160a01b0316836040516126b89190613980565b6000604051808303816000865af19150503d80600081146126f5576040519150601f19603f3d011682016040523d82523d6000602084013e6126fa565b606091505b50915091508161271c5760405162461bcd60e51b815260040161058290613b20565b80511561275357808060200190516127379190810190612c4a565b6127535760405162461bcd60e51b815260040161058290613c20565b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061253d575050151592915050565b60405180604001604052806002906020820280388339509192915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b8035611c7481613dcf565b600082601f8301126127fb57600080fd5b813561280e61280982613ce4565b613cbd565b81815260209384019390925082018360005b8381101561284c578135860161283688826128be565b8452506020928301929190910190600101612820565b5050505092915050565b600082601f83011261286757600080fd5b813561287561280982613ce4565b81815260209384019390925082018360005b8381101561284c578135860161289d8882612990565b8452506020928301929190910190600101612887565b8051611c7481613de3565b600082601f8301126128cf57600080fd5b81356128dd61280982613d05565b915080825260208301602083018583830111156128f957600080fd5b612904838284613d8d565b50505092915050565b600060a0828403121561291f57600080fd5b61292960a0613cbd565b905060006129378484612b4b565b825250602061294884848301612b4b565b602083015250604061295c84828501612b4b565b604083015250606061297084828501612b4b565b606083015250608061298484828501612b4b565b60808301525092915050565b60006101c082840312156129a357600080fd5b6129ae6101c0613cbd565b905060006129bc84846127df565b82525060206129cd848483016127df565b60208301525060406129e1848285016127df565b60408301525060606129f5848285016127df565b6060830152506080612a0984828501612b40565b60808301525060a0612a1d84828501612b40565b60a08301525060c0612a3184828501612b40565b60c08301525060e0612a4584828501612b40565b60e083015250610100612a5a84828501612b40565b61010083015250610120612a7084828501612b40565b6101208301525061014082013567ffffffffffffffff811115612a9257600080fd5b612a9e848285016128be565b6101408301525061016082013567ffffffffffffffff811115612ac057600080fd5b612acc848285016128be565b6101608301525061018082013567ffffffffffffffff811115612aee57600080fd5b612afa848285016128be565b610180830152506101a082013567ffffffffffffffff811115612b1c57600080fd5b612b28848285016128be565b6101a08301525092915050565b8035611c7481613dec565b8035611c7481613df5565b8051611c7481613df5565b8035611c7481613dfe565b600060208284031215612b7357600080fd5b600061253d84846127df565b60008060008060808587031215612b9557600080fd5b6000612ba187876127df565b945050602085013567ffffffffffffffff811115612bbe57600080fd5b612bca87828801612856565b935050604085013567ffffffffffffffff811115612be757600080fd5b612bf3878288016127ea565b9250506060612c0487828801612b40565b91505092959194509250565b60008060408385031215612c2357600080fd5b6000612c2f85856127df565b9250506020612c4085828601612b40565b9150509250929050565b600060208284031215612c5c57600080fd5b600061253d84846128b3565b600060a08284031215612c7a57600080fd5b600061253d848461290d565b600060208284031215612c9857600080fd5b600061253d8484612b35565b600060208284031215612cb657600080fd5b600061253d8484612b40565b600060208284031215612cd457600080fd5b600061253d8484612b4b565b600060208284031215612cf257600080fd5b600061253d8484612b56565b60008060408385031215612d1157600080fd5b6000612c2f8585612b56565b600080600060608486031215612d3257600080fd5b6000612d3e8686612b56565b9350506020612d4f86828701612b40565b9250506040612d6086828701612b40565b9150509250925092565b60006120228383612f68565b6000612022838361382a565b6000612d8e838361396e565b505060200190565b6000612d8e8383613977565b612dab81613d6c565b82525050565b612dab81613d40565b6000612dc582613d33565b612dcf8185613d37565b935083602082028501612de185613d2d565b8060005b85811015612e1b5784840389528151612dfe8582612d6a565b9450612e0983613d2d565b60209a909a0199925050600101612de5565b5091979650505050505050565b6000612e3382613d33565b612e3d8185613d37565b935083602082028501612e4f85613d2d565b8060005b85811015612e1b5784840389528151612e6c8582612d76565b9450612e7783613d2d565b60209a909a0199925050600101612e53565b6000612e9482613d33565b612e9e8185613d37565b9350612ea983613d2d565b8060005b83811015612ed7578151612ec18882612d82565b9750612ecc83613d2d565b925050600101612ead565b509495945050505050565b6000612eed82613d33565b612ef78185613d37565b9350612f0283613d2d565b8060005b83811015612ed7578151612f1a8882612d96565b9750612f2583613d2d565b925050600101612f06565b612dab81613d4b565b6000612f4482613d33565b612f4e8185610db8565b9350612f5e818560208601613d99565b9290920192915050565b6000612f7382613d33565b612f7d8185613d37565b9350612f8d818560208601613d99565b612f9681613dc5565b9093019392505050565b612dab81613d77565b6000612fb6601d83613d37565b7f43616c6c6572206973206e6f742074686520726562616c616e6365722e000000815260200192915050565b6000612fef601e83613d37565b7f416d6f756e74206d7573742062652067726561746572207468616e20302e0000815260200192915050565b6000613028602983613d37565b7f4e6f20416c70686120486f6d6f72612062616c616e636520746f2077697468648152683930bb90333937b69760b91b602082015260400192915050565b6000613073604983613d37565b7f546869732066756e6420636f6e74726f6c6c657220636f6e747261637420697381527f2064697361626c65642e2054686973206d61792062652064756520746f20616e602082015268103ab833b930b2329760b91b604082015260600192915050565b60006130e4603683613d37565b7f4174206c65617374206f6e65206f7264657220616e64206d61746368696e672081527539b4b3b730ba3ab9329034b9903932b8bab4b932b21760511b602082015260400192915050565b600061313c602683613d37565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b6000613184601783613d37565b7f4661696c656420746f207472616e73666572204554482e000000000000000000815260200192915050565b60006131bd601483613d37565b732737902ba2aa24103a37903bb4ba34323930bb9760611b815260200192915050565b60006131ed601b83613d37565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000613226601583613d37565b74233ab7321030b63932b0b23c9032b730b13632b21760591b815260200192915050565b6000613257601f83613d37565b7f43616c6c6572206973206e6f74207468652066756e64206d616e616765722e00815260200192915050565b6000613290602083613d37565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b60006132c9602b83613d37565b7f537570706c69656420746f6b656e2061646472657373206973206e6f7420434f81526a26a81037b9102927a7a59760a91b602082015260400192915050565b6000613316603f83613d37565b7f4e657720636f6e747261637420646f6573206e6f7420686176652049535f524181527f52495f46554e445f434f4e54524f4c4c45522073657420746f20747275652e00602082015260400192915050565b6000613375601b83613d37565b7f546f6f206c6974746c652045544820746f207472616e736665722e0000000000815260200192915050565b60006133ae602583613d37565b7f4e6f20436f6d706f756e642062616c616e636520746f20776974686472617720815264333937b69760d91b602082015260400192915050565b60006133f5602683613d37565b7f4e6f204b656570657244414f2062616c616e636520746f20776974686472617781526510333937b69760d11b602082015260400192915050565b600061343d602a83613d37565b7f4661696c656420746f20726566756e6420756e7370656e74204554482070726f8152693a37b1b7b6103332b29760b11b602082015260400192915050565b6000613489602083613d37565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b60006134c2602e83613d37565b7f436f6e747261637420696e7374616e63652068617320616c726561647920626581526d195b881a5b9a5d1a585b1a5e995960921b602082015260400192915050565b6000613512602a83613d37565b7f4661696c656420746f207472616e736665722045544820746f20526172694675815269373226b0b730b3b2b91760b11b602082015260400192915050565b600061355e603183613d37565b7f4d69736d61746368206265747765656e206e756d626572206f66206f72646572815270399030b7321039b4b3b730ba3ab932b99760791b602082015260400192915050565b60006135b1601683613d37565b75233ab7321030b63932b0b23c903234b9b0b13632b21760511b815260200192915050565b60006135e3604983613d37565b7f546869732066756e6420636f6e74726f6c6c657220636f6e7472616374206d7581527f73742062652064697361626c6564206265666f72652069742063616e206265206020820152683ab833b930b232b21760b91b604082015260600192915050565b6000613654601283613d37565b712737902ba2aa241037baba383aba3a32b21760711b815260200192915050565b6000611c74600083610db8565b600061368f602f83613d37565b7f54616b65722061737365742066696c6c20616d6f756e74206d7573742062652081526e33b932b0ba32b9103a3430b710181760891b602082015260400192915050565b60006136e0602983613d37565b7f5769746864726177616c20616d6f756e74206d7573742062652067726561746581526839103a3430b710181760b91b602082015260400192915050565b600061372b602a83613d37565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b6000613777603683613d37565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b60006137cf601383613d37565b7224b73b30b634b2103837b7b61034b73232bc1760691b815260200192915050565b60006137fe601f83613d37565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b80516000906101c084019061383f8582612db1565b5060208301516138526020860182612db1565b5060408301516138656040860182612db1565b5060608301516138786060860182612db1565b50608083015161388b608086018261396e565b5060a083015161389e60a086018261396e565b5060c08301516138b160c086018261396e565b5060e08301516138c460e086018261396e565b506101008301516138d961010086018261396e565b506101208301516138ee61012086018261396e565b506101408301518482036101408601526139088282612f68565b9150506101608301518482036101608601526139248282612f68565b9150506101808301518482036101808601526139408282612f68565b9150506101a08301518482036101a086015261395c8282612f68565b95945050505050565b612dab81613d50565b612dab81613d63565b612dab81613d66565b60006120228284612f39565b6000611c7482613675565b60208101611c748284612db1565b60208101611c748284612da2565b604081016139c18285612db1565b6120226020830184612db1565b604081016139dc8285612db1565b612022602083018461396e565b606081016139f78286612db1565b613a04602083018561396e565b61253d604083018461396e565b60608082528101613a228186612e28565b9050613a31602083018561396e565b818103604083015261395c8184612dba565b60208101611c748284612f30565b60208101611c748284612fa0565b602080825281016120228184612f68565b60208082528101611c7481612fa9565b60208082528101611c7481612fe2565b60208082528101611c748161301b565b60208082528101611c7481613066565b60208082528101611c74816130d7565b60208082528101611c748161312f565b60208082528101611c7481613177565b60208082528101611c74816131b0565b60208082528101611c74816131e0565b60208082528101611c7481613219565b60208082528101611c748161324a565b60208082528101611c7481613283565b60208082528101611c74816132bc565b60208082528101611c7481613309565b60208082528101611c7481613368565b60208082528101611c74816133a1565b60208082528101611c74816133e8565b60208082528101611c7481613430565b60208082528101611c748161347c565b60208082528101611c74816134b5565b60208082528101611c7481613505565b60208082528101611c7481613551565b60208082528101611c74816135a4565b60208082528101611c74816135d6565b60208082528101611c7481613647565b60208082528101611c7481613682565b60208082528101611c74816136d3565b60208082528101611c748161371e565b60208082528101611c748161376a565b60208082528101611c74816137c2565b60208082528101611c74816137f1565b60208101611c74828461396e565b60608101613c7c828661396e565b8181036020830152613c8e8185612ee2565b9050818103604083015261395c8184612e89565b60408101613cb0828561396e565b6120226020830184613965565b60405181810167ffffffffffffffff81118282101715613cdc57600080fd5b604052919050565b600067ffffffffffffffff821115613cfb57600080fd5b5060209081020190565b600067ffffffffffffffff821115613d1c57600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000611c7482613d57565b151590565b61ffff1690565b6001600160a01b031690565b90565b60ff1690565b6000611c7482613d82565b6000611c7482613d63565b6000611c7482613d40565b82818337506000910152565b60005b83811015613db4578181015183820152602001613d9c565b838111156127535750506000910152565b601f01601f191690565b613dd881613d40565b811461075557600080fd5b613dd881613d4b565b613dd881613d50565b613dd881613d63565b613dd881613d6656fea365627a7a7231582018c111957dfae0d5b1bbea23cdfb7090bbefb11004f4a52e317da7fe113cba9a6c6578706572696d656e74616cf564736f6c63430005110040
Deployed Bytecode
0x6080604052600436106101cd5760003560e01c806398e40131116100f7578063c66dc09711610095578063f2fde38b11610064578063f2fde38b146104f6578063f3b4338614610516578063fa95e83d1461052b578063fbc9dfc41461053e576101cd565b8063c66dc0971461047d578063e2e4c60c1461049d578063e8bee352146104c1578063ef44ea8b146104d6576101cd565b8063b02c0065116100d1578063b02c0065146103fd578063b9d9f62b1461041d578063bef48c371461043d578063c4d66de81461045d576101cd565b806398e401311461039d5780639b53ff49146103bd578063a9065581146103dd576101cd565b806351cbf3481161016f578063715018a61161013e578063715018a6146103315780638da5cb5b146103465780638f32d59b146103685780638fe6b38d1461037d576101cd565b806351cbf348146102af57806362016d42146102cf57806365df2918146102ef5780636cf0a7b014610304576101cd565b80631c5b0923116101ab5780631c5b09231461022f578063232a30601461025a578063375426861461027a5780634e02bebc1461029a576101cd565b806308e169d9146101cf5780630fcb042c146101ef578063126afd7c1461020f575b005b3480156101db57600080fd5b506101cd6101ea366004612c86565b61055e565b3480156101fb57600080fd5b506101cd61020a366004612b61565b6105a3565b34801561021b57600080fd5b506101cd61022a366004612ce0565b6106ff565b34801561023b57600080fd5b50610244610758565b6040516102519190613c60565b60405180910390f35b34801561026657600080fd5b506101cd610275366004612b61565b6107bc565b34801561028657600080fd5b506101cd610295366004612cfe565b61083b565b3480156102a657600080fd5b506101cd61096a565b3480156102bb57600080fd5b506101cd6102ca366004612ca4565b610acf565b3480156102db57600080fd5b506102446102ea366004612ce0565b610b7f565b3480156102fb57600080fd5b506101cd610dbd565b34801561031057600080fd5b5061032461031f366004612ce0565b610e38565b6040516102519190613a43565b34801561033d57600080fd5b506101cd610e50565b34801561035257600080fd5b5061035b610ebe565b6040516102519190613997565b34801561037457600080fd5b50610324610ecd565b34801561038957600080fd5b506101cd610398366004612c10565b610ef3565b3480156103a957600080fd5b506101cd6103b8366004612b61565b610fad565b3480156103c957600080fd5b506101cd6103d8366004612ca4565b610ffb565b3480156103e957600080fd5b506101cd6103f8366004612b61565b61120f565b34801561040957600080fd5b506101cd610418366004612b61565b61127e565b34801561042957600080fd5b506101cd610438366004612d1d565b611349565b34801561044957600080fd5b506101cd610458366004612cfe565b6113ca565b34801561046957600080fd5b506101cd610478366004612b61565b611470565b34801561048957600080fd5b506101cd610498366004612cfe565b611542565b3480156104a957600080fd5b506104b2611800565b60405161025193929190613c6e565b3480156104cd57600080fd5b50610324611902565b3480156104e257600080fd5b506101cd6104f1366004612ce0565b611907565b34801561050257600080fd5b506101cd610511366004612b61565b61192b565b34801561052257600080fd5b506101cd611958565b6101cd610539366004612b7f565b6119d7565b34801561054a57600080fd5b50610244610559366004612ce0565b611c48565b610566610ecd565b61058b5760405162461bcd60e51b815260040161058290613b90565b60405180910390fd5b606b805461ffff191661ffff92909216919091179055565b6105ab610ecd565b6105c75760405162461bcd60e51b815260040161058290613b90565b60665460ff166105e95760405162461bcd60e51b815260040161058290613be0565b806001600160a01b031663e8bee3526040518163ffffffff1660e01b815260040160206040518083038186803b15801561062257600080fd5b505afa158015610636573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061065a9190810190612c4a565b6106765760405162461bcd60e51b815260040161058290613b40565b4780156106fb576000826001600160a01b0316826040516106969061398c565b60006040518083038185875af1925050503d80600081146106d3576040519150601f19603f3d011682016040523d82523d6000602084013e6106d8565b606091505b50509050806106f95760405162461bcd60e51b815260040161058290613ad0565b505b5050565b60665460ff16156107225760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b0316331461074c5760405162461bcd60e51b815260040161058290613a70565b61075581611c7a565b50565b600047815b6068548110156107b6576107ac826107a06068848154811061077b57fe5b90600052602060002090602091828204019190069054906101000a900460ff16611c48565b9063ffffffff611ffd16565b915060010161075d565b50905090565b6107c4610ecd565b6107e05760405162461bcd60e51b815260040161058290613b90565b60668054610100600160a81b0319166101006001600160a01b038416021790556040517ff980c1430e55b1867cd9337a1f20246ab3b7255032486d0b71c24e820eebf3ab906108309083906139a5565b60405180910390a150565b60665460ff161561085e5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146108885760405162461bcd60e51b815260040161058290613a70565b60ff82166108fc57604051632dd67e5560e21b8152735add5c070902e4b535f76bafac486cc689095d719063b759f954906108c7908490600401613c60565b60006040518083038186803b1580156108df57600080fd5b505af41580156108f3573d6000803e3d6000fd5b505050506106fb565b8160ff166005141561095257606b5460405163095ea7b360e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163095ea7b3916108c7916201000090046001600160a01b03169085906004016139ce565b60405162461bcd60e51b815260040161058290613c40565b60665460ff161561098d5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146109b75760405162461bcd60e51b815260040161058290613a70565b6040516370a0823160e01b815260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a08231906109f19030906004016139a5565b60206040518083038186803b158015610a0957600080fd5b505afa158015610a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a419190810190612cc2565b905060008111610a635760405162461bcd60e51b815260040161058290613ae0565b604051632e1a7d4d60e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90610a9a908490600401613c60565b600060405180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b5050505050565b60665460ff1615610af25760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314610b1c5760405162461bcd60e51b815260040161058290613a70565b604051632dd67e5560e21b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae669063b759f95490610b53908490600401613c60565b60006040518083038186803b158015610b6b57600080fd5b505af4158015610ac8573d6000803e3d6000fd5b600060ff8216610c0c57735add5c070902e4b535f76bafac486cc689095d716312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b505af4158015610be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c059190810190612cc2565b9050610db8565b8160ff1660011415610c5c5773de6796aa414173b63f626be1f13e419d8e35fc096312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660021415610cac5773948e587a4c175e3b4208f8084e6b8c5c0c4dae666312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660031415610cfc577325f9cebb75ebbaa7b7eddc70d33ffb993896ecb96312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff1660041415610d4c5773ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f6312065fe06040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcd57600080fd5b8160ff166005141561095257606b5460405163f8b2cb4f60e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163f8b2cb4f91610da0916201000090046001600160a01b031690600401613997565b60206040518083038186803b158015610bcd57600080fd5b919050565b610dc5610ecd565b610de15760405162461bcd60e51b815260040161058290613b90565b60665460ff16610e035760405162461bcd60e51b815260040161058290613b00565b6066805460ff191690556040517f8e1c35fbf7cd686deedf8310574cf4ad038a00a86d3317c831afaeec58f1eeae90600090a1565b60ff9081166000908152606a60205260409020541690565b610e58610ecd565b610e745760405162461bcd60e51b815260040161058290613b90565b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b6033546000906001600160a01b0316610ee4612029565b6001600160a01b031614905090565b60665460ff1615610f165760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314610f405760405162461bcd60e51b815260040161058290613a70565b6001600160a01b03821673c00e94cb662c3520282e6f5717214004a7f268881480610f8757506001600160a01b03821673fa5047c9c78b8877af97bdcb85db743fd7313d4a145b610fa35760405162461bcd60e51b815260040161058290613b30565b6106f9828261202d565b610fb5610ecd565b610fd15760405162461bcd60e51b815260040161058290613b90565b606b80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60665461010090046001600160a01b0316331461102a5760405162461bcd60e51b815260040161058290613b10565b6000811161104a5760405162461bcd60e51b815260040161058290613c10565b47818110156110a257600061105f6005611c48565b905080156110a0576000611079848463ffffffff61215816565b9050600082821061108a578261108c565b815b905061109a60058285611349565b47935050505b505b60005b606854811015611168578282106110bb57611168565b6000606882815481106110ca57fe5b60009182526020918290209181049091015460ff601f9092166101000a900416905060058114156110fb5750611160565b600061110682611c48565b905060008111611117575050611160565b6000611129868663ffffffff61215816565b9050600082821061113a578261113c565b815b9050611149848285611349565b611159868263ffffffff611ffd16565b9550505050505b6001016110a5565b50814710156111895760405162461bcd60e51b815260040161058290613b50565b60665460405160009161010090046001600160a01b03169084906111ac9061398c565b60006040518083038185875af1925050503d80600081146111e9576040519150601f19603f3d011682016040523d82523d6000602084013e6111ee565b606091505b50509050806106f95760405162461bcd60e51b815260040161058290613bb0565b611217610ecd565b6112335760405162461bcd60e51b815260040161058290613b90565b606780546001600160a01b0319166001600160a01b0383161790556040517feb9b68c1cca2a0c5d180f75c6324fad517a04867907b0f3bee85d98fdf57ee9490610830908390613997565b611286610ecd565b6112a25760405162461bcd60e51b815260040161058290613b90565b6112ac6005610e38565b156112bb576112bb6005611c7a565b60005b60685481101561133f576112fd606882815481106112d857fe5b90600052602060002090602091828204019190069054906101000a900460ff16610e38565b15611337576113376068828154811061131257fe5b90600052602060002090602091828204019190069054906101000a900460ff16611c7a565b6001016112be565b50610755816105a3565b60665460ff161561136c5760405162461bcd60e51b815260040161058290613aa0565b60665461010090046001600160a01b0316331461139b5760405162461bcd60e51b815260040161058290613b10565b6113a5838361219a565b808214156106f957505060ff166000908152606a60205260409020805460ff19169055565b60665460ff16156113ed5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b031633146114175760405162461bcd60e51b815260040161058290613a70565b600081116114375760405162461bcd60e51b815260040161058290613a80565b611441828261219a565b600061144c83610b7f565b60ff9093166000908152606a60205260409020805460ff1916919093111790915550565b600054610100900460ff16806114895750611489612391565b80611497575060005460ff16155b6114b35760405162461bcd60e51b815260040161058290613ba0565b600054610100900460ff161580156114de576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a380156106fb576000805461ff00191690555050565b60665460ff16156115655760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b0316331461158f5760405162461bcd60e51b815260040161058290613a70565b600081116115af5760405162461bcd60e51b815260040161058290613a80565b60ff82166116235760405163b6b55f2560e01b8152735add5c070902e4b535f76bafac486cc689095d719063b6b55f25906115ee908490600401613c60565b60006040518083038186803b15801561160657600080fd5b505af415801561161a573d6000803e3d6000fd5b5050505061178f565b8160ff16600114156116665760405163b6b55f2560e01b815273de6796aa414173b63f626be1f13e419d8e35fc099063b6b55f25906115ee908490600401613c60565b8160ff16600214156116a95760405163b6b55f2560e01b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae669063b6b55f25906115ee908490600401613c60565b8160ff16600314156116f657606b5460405163422b01d360e11b81527325f9cebb75ebbaa7b7eddc70d33ffb993896ecb99163845603a6916115ee91859161ffff90911690600401613ca2565b8160ff16600414156117395760405163b6b55f2560e01b815273ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f9063b6b55f25906115ee908490600401613c60565b8160ff166005141561095257606b546040516311f9fbc960e21b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc3916347e7ef24916115ee916201000090046001600160a01b03169085906004016139ce565b60ff82166000818152606a60205260409020805460ff1916600117905560058111156117b757fe5b60058111156117c257fe5b60005b7f9e17470c2398acb1637f3cd25310210eb4c04c2f91adee1cef82fd1230f1f6ad836040516117f49190613c60565b60405180910390a35050565b60006060806060606880549050604051908082528060200260200182016040528015611836578160200160208202803883390190505b509050606060688054905060405190808252806020026020018201604052801561186a578160200160208202803883390190505b50905060005b6068548110156118f6576068818154811061188757fe5b90600052602060002090602091828204019190069054906101000a900460ff168382815181106118b357fe5b602002602001019060ff16908160ff16815250506118d76068828154811061077b57fe5b8282815181106118e357fe5b6020908102919091010152600101611870565b50479591945092509050565b600181565b61190f610ecd565b61074c5760405162461bcd60e51b815260040161058290613b90565b611933610ecd565b61194f5760405162461bcd60e51b815260040161058290613b90565b61075581612397565b611960610ecd565b61197c5760405162461bcd60e51b815260040161058290613b90565b60665460ff161561199f5760405162461bcd60e51b815260040161058290613bd0565b6066805460ff191660011790556040517f0a6b9c6c74d93f230c4346c52ac415dd7dda5a0efb4f7394c0bfb5baa87d326590600090a1565b60665460ff16156119fa5760405162461bcd60e51b815260040161058290613aa0565b6067546001600160a01b03163314611a245760405162461bcd60e51b815260040161058290613a70565b47611a2d612792565b611a3985858534612419565b8051602082015160405192935047927fbdf71678f3f7c296138b1bb2ac053c1d65f5c41347edd3ef7bb8c139bc3e3dd392611a75928b926139e9565b60405180910390a16040516370a0823160e01b815260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190611ab79030906004016139a5565b60206040518083038186803b158015611acf57600080fd5b505afa158015611ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b079190810190612cc2565b905060008111611b295760405162461bcd60e51b815260040161058290613bf0565b604051632e1a7d4d60e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90611b60908490600401613c60565b600060405180830381600087803b158015611b7a57600080fd5b505af1158015611b8e573d6000803e3d6000fd5b505050506000611bb7611baa348761215890919063ffffffff16565b849063ffffffff61215816565b90508015611c3d576000336001600160a01b031682604051611bd89061398c565b60006040518083038185875af1925050503d8060008114611c15576040519150601f19603f3d011682016040523d82523d6000602084013e611c1a565b606091505b5050905080611c3b5760405162461bcd60e51b815260040161058290613b80565b505b505050505050505050565b60ff8082166000908152606a6020526040812054909116611c6b57506000610db8565b611c7482610b7f565b92915050565b60ff8116611ce357735add5c070902e4b535f76bafac486cc689095d7163853828b66040518163ffffffff1660e01b815260040160006040518083038186803b158015611cc657600080fd5b505af4158015611cda573d6000803e3d6000fd5b50505050611f90565b8060ff1660011415611d8c5773de6796aa414173b63f626be1f13e419d8e35fc0963853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611d3357600080fd5b505af4158015611d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d6b9190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613b60565b611f90565b8060ff1660021415611e305773948e587a4c175e3b4208f8084e6b8c5c0c4dae6663853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ddc57600080fd5b505af4158015611df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e149190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613b70565b8060ff1660031415611e80577325f9cebb75ebbaa7b7eddc70d33ffb993896ecb963853828b66040518163ffffffff1660e01b815260040160006040518083038186803b158015611cc657600080fd5b8060ff1660041415611f245773ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f63853828b66040518163ffffffff1660e01b815260040160206040518083038186803b158015611ed057600080fd5b505af4158015611ee4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611f089190810190612c4a565b611d875760405162461bcd60e51b815260040161058290613a90565b8060ff166005141561095257606b54604051630fa09e6360e41b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163fa09e63091611f78916201000090046001600160a01b031690600401613997565b60006040518083038186803b158015611cc657600080fd5b60ff81166000818152606a60205260409020805460ff191690556005811115611fb557fe5b6005811115611fc057fe5b60027f9e17470c2398acb1637f3cd25310210eb4c04c2f91adee1cef82fd1230f1f6ad6000604051611ff29190613a51565b60405180910390a350565b6000828201838110156120225760405162461bcd60e51b815260040161058290613af0565b9392505050565b3390565b604051636eb1769f60e11b8152600090839082906001600160a01b0383169063dd62ed3e906120769030907395e6f48254609a6ee006f7d493c8e5fb97094cef906004016139b3565b60206040518083038186803b15801561208e57600080fd5b505afa1580156120a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120c69190810190612cc2565b9050838114156120db57600192505050611c74565b6000841180156120eb5750600081115b1561211f5761211f6001600160a01b0383167395e6f48254609a6ee006f7d493c8e5fb97094cef600063ffffffff61254516565b61214d6001600160a01b0383167395e6f48254609a6ee006f7d493c8e5fb97094cef8663ffffffff61254516565b506001949350505050565b600061202283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612642565b60ff821661220e57604051632e1a7d4d60e01b8152735add5c070902e4b535f76bafac486cc689095d7190632e1a7d4d906121d9908490600401613c60565b60006040518083038186803b1580156121f157600080fd5b505af4158015612205573d6000803e3d6000fd5b50505050612370565b8160ff166001141561225157604051632e1a7d4d60e01b815273de6796aa414173b63f626be1f13e419d8e35fc0990632e1a7d4d906121d9908490600401613c60565b8160ff166002141561229457604051632e1a7d4d60e01b815273948e587a4c175e3b4208f8084e6b8c5c0c4dae6690632e1a7d4d906121d9908490600401613c60565b8160ff16600314156122d757604051632e1a7d4d60e01b81527325f9cebb75ebbaa7b7eddc70d33ffb993896ecb990632e1a7d4d906121d9908490600401613c60565b8160ff166004141561231a57604051632e1a7d4d60e01b815273ed2cd60c0000a990a5ffaf0e7ddc70a37d7c623f90632e1a7d4d906121d9908490600401613c60565b8160ff166005141561095257606b5460405163f3fef3a360e01b81527397b6879573ae5c09cbe200c96b407ef9ac74fcc39163f3fef3a3916121d9916201000090046001600160a01b03169085906004016139ce565b8160ff16600581111561237f57fe5b600581111561238a57fe5b60016117c5565b303b1590565b6001600160a01b0381166123bd5760405162461bcd60e51b815260040161058290613ac0565b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b612421612792565b60008551116124425760405162461bcd60e51b815260040161058290613ab0565b83518551146124635760405162461bcd60e51b815260040161058290613bc0565b600083116124835760405162461bcd60e51b815260040161058290613c00565b61248b6127b0565b60405163a6c3bf3360e01b81527361935cbdd02287b511119ddb11aeb42f1593b7ef9063a6c3bf339085906124c8908a9089908b90600401613a11565b60a0604051808303818588803b1580156124e157600080fd5b505af11580156124f5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525061251a9190810190612c68565b905060405180604001604052808260200151815260200182600001518152509150505b949350505050565b8015806125cd5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e9061257b90309086906004016139b3565b60206040518083038186803b15801561259357600080fd5b505afa1580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125cb9190810190612cc2565b155b6125e95760405162461bcd60e51b815260040161058290613c30565b6040516106f990849063095ea7b360e01b9061260b90869086906024016139ce565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261266e565b600081848411156126665760405162461bcd60e51b81526004016105829190613a5f565b505050900390565b612680826001600160a01b0316612759565b61269c5760405162461bcd60e51b815260040161058290613c50565b60006060836001600160a01b0316836040516126b89190613980565b6000604051808303816000865af19150503d80600081146126f5576040519150601f19603f3d011682016040523d82523d6000602084013e6126fa565b606091505b50915091508161271c5760405162461bcd60e51b815260040161058290613b20565b80511561275357808060200190516127379190810190612c4a565b6127535760405162461bcd60e51b815260040161058290613c20565b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061253d575050151592915050565b60405180604001604052806002906020820280388339509192915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b8035611c7481613dcf565b600082601f8301126127fb57600080fd5b813561280e61280982613ce4565b613cbd565b81815260209384019390925082018360005b8381101561284c578135860161283688826128be565b8452506020928301929190910190600101612820565b5050505092915050565b600082601f83011261286757600080fd5b813561287561280982613ce4565b81815260209384019390925082018360005b8381101561284c578135860161289d8882612990565b8452506020928301929190910190600101612887565b8051611c7481613de3565b600082601f8301126128cf57600080fd5b81356128dd61280982613d05565b915080825260208301602083018583830111156128f957600080fd5b612904838284613d8d565b50505092915050565b600060a0828403121561291f57600080fd5b61292960a0613cbd565b905060006129378484612b4b565b825250602061294884848301612b4b565b602083015250604061295c84828501612b4b565b604083015250606061297084828501612b4b565b606083015250608061298484828501612b4b565b60808301525092915050565b60006101c082840312156129a357600080fd5b6129ae6101c0613cbd565b905060006129bc84846127df565b82525060206129cd848483016127df565b60208301525060406129e1848285016127df565b60408301525060606129f5848285016127df565b6060830152506080612a0984828501612b40565b60808301525060a0612a1d84828501612b40565b60a08301525060c0612a3184828501612b40565b60c08301525060e0612a4584828501612b40565b60e083015250610100612a5a84828501612b40565b61010083015250610120612a7084828501612b40565b6101208301525061014082013567ffffffffffffffff811115612a9257600080fd5b612a9e848285016128be565b6101408301525061016082013567ffffffffffffffff811115612ac057600080fd5b612acc848285016128be565b6101608301525061018082013567ffffffffffffffff811115612aee57600080fd5b612afa848285016128be565b610180830152506101a082013567ffffffffffffffff811115612b1c57600080fd5b612b28848285016128be565b6101a08301525092915050565b8035611c7481613dec565b8035611c7481613df5565b8051611c7481613df5565b8035611c7481613dfe565b600060208284031215612b7357600080fd5b600061253d84846127df565b60008060008060808587031215612b9557600080fd5b6000612ba187876127df565b945050602085013567ffffffffffffffff811115612bbe57600080fd5b612bca87828801612856565b935050604085013567ffffffffffffffff811115612be757600080fd5b612bf3878288016127ea565b9250506060612c0487828801612b40565b91505092959194509250565b60008060408385031215612c2357600080fd5b6000612c2f85856127df565b9250506020612c4085828601612b40565b9150509250929050565b600060208284031215612c5c57600080fd5b600061253d84846128b3565b600060a08284031215612c7a57600080fd5b600061253d848461290d565b600060208284031215612c9857600080fd5b600061253d8484612b35565b600060208284031215612cb657600080fd5b600061253d8484612b40565b600060208284031215612cd457600080fd5b600061253d8484612b4b565b600060208284031215612cf257600080fd5b600061253d8484612b56565b60008060408385031215612d1157600080fd5b6000612c2f8585612b56565b600080600060608486031215612d3257600080fd5b6000612d3e8686612b56565b9350506020612d4f86828701612b40565b9250506040612d6086828701612b40565b9150509250925092565b60006120228383612f68565b6000612022838361382a565b6000612d8e838361396e565b505060200190565b6000612d8e8383613977565b612dab81613d6c565b82525050565b612dab81613d40565b6000612dc582613d33565b612dcf8185613d37565b935083602082028501612de185613d2d565b8060005b85811015612e1b5784840389528151612dfe8582612d6a565b9450612e0983613d2d565b60209a909a0199925050600101612de5565b5091979650505050505050565b6000612e3382613d33565b612e3d8185613d37565b935083602082028501612e4f85613d2d565b8060005b85811015612e1b5784840389528151612e6c8582612d76565b9450612e7783613d2d565b60209a909a0199925050600101612e53565b6000612e9482613d33565b612e9e8185613d37565b9350612ea983613d2d565b8060005b83811015612ed7578151612ec18882612d82565b9750612ecc83613d2d565b925050600101612ead565b509495945050505050565b6000612eed82613d33565b612ef78185613d37565b9350612f0283613d2d565b8060005b83811015612ed7578151612f1a8882612d96565b9750612f2583613d2d565b925050600101612f06565b612dab81613d4b565b6000612f4482613d33565b612f4e8185610db8565b9350612f5e818560208601613d99565b9290920192915050565b6000612f7382613d33565b612f7d8185613d37565b9350612f8d818560208601613d99565b612f9681613dc5565b9093019392505050565b612dab81613d77565b6000612fb6601d83613d37565b7f43616c6c6572206973206e6f742074686520726562616c616e6365722e000000815260200192915050565b6000612fef601e83613d37565b7f416d6f756e74206d7573742062652067726561746572207468616e20302e0000815260200192915050565b6000613028602983613d37565b7f4e6f20416c70686120486f6d6f72612062616c616e636520746f2077697468648152683930bb90333937b69760b91b602082015260400192915050565b6000613073604983613d37565b7f546869732066756e6420636f6e74726f6c6c657220636f6e747261637420697381527f2064697361626c65642e2054686973206d61792062652064756520746f20616e602082015268103ab833b930b2329760b91b604082015260600192915050565b60006130e4603683613d37565b7f4174206c65617374206f6e65206f7264657220616e64206d61746368696e672081527539b4b3b730ba3ab9329034b9903932b8bab4b932b21760511b602082015260400192915050565b600061313c602683613d37565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b6000613184601783613d37565b7f4661696c656420746f207472616e73666572204554482e000000000000000000815260200192915050565b60006131bd601483613d37565b732737902ba2aa24103a37903bb4ba34323930bb9760611b815260200192915050565b60006131ed601b83613d37565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000613226601583613d37565b74233ab7321030b63932b0b23c9032b730b13632b21760591b815260200192915050565b6000613257601f83613d37565b7f43616c6c6572206973206e6f74207468652066756e64206d616e616765722e00815260200192915050565b6000613290602083613d37565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b60006132c9602b83613d37565b7f537570706c69656420746f6b656e2061646472657373206973206e6f7420434f81526a26a81037b9102927a7a59760a91b602082015260400192915050565b6000613316603f83613d37565b7f4e657720636f6e747261637420646f6573206e6f7420686176652049535f524181527f52495f46554e445f434f4e54524f4c4c45522073657420746f20747275652e00602082015260400192915050565b6000613375601b83613d37565b7f546f6f206c6974746c652045544820746f207472616e736665722e0000000000815260200192915050565b60006133ae602583613d37565b7f4e6f20436f6d706f756e642062616c616e636520746f20776974686472617720815264333937b69760d91b602082015260400192915050565b60006133f5602683613d37565b7f4e6f204b656570657244414f2062616c616e636520746f20776974686472617781526510333937b69760d11b602082015260400192915050565b600061343d602a83613d37565b7f4661696c656420746f20726566756e6420756e7370656e74204554482070726f8152693a37b1b7b6103332b29760b11b602082015260400192915050565b6000613489602083613d37565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b60006134c2602e83613d37565b7f436f6e747261637420696e7374616e63652068617320616c726561647920626581526d195b881a5b9a5d1a585b1a5e995960921b602082015260400192915050565b6000613512602a83613d37565b7f4661696c656420746f207472616e736665722045544820746f20526172694675815269373226b0b730b3b2b91760b11b602082015260400192915050565b600061355e603183613d37565b7f4d69736d61746368206265747765656e206e756d626572206f66206f72646572815270399030b7321039b4b3b730ba3ab932b99760791b602082015260400192915050565b60006135b1601683613d37565b75233ab7321030b63932b0b23c903234b9b0b13632b21760511b815260200192915050565b60006135e3604983613d37565b7f546869732066756e6420636f6e74726f6c6c657220636f6e7472616374206d7581527f73742062652064697361626c6564206265666f72652069742063616e206265206020820152683ab833b930b232b21760b91b604082015260600192915050565b6000613654601283613d37565b712737902ba2aa241037baba383aba3a32b21760711b815260200192915050565b6000611c74600083610db8565b600061368f602f83613d37565b7f54616b65722061737365742066696c6c20616d6f756e74206d7573742062652081526e33b932b0ba32b9103a3430b710181760891b602082015260400192915050565b60006136e0602983613d37565b7f5769746864726177616c20616d6f756e74206d7573742062652067726561746581526839103a3430b710181760b91b602082015260400192915050565b600061372b602a83613d37565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b6000613777603683613d37565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b60006137cf601383613d37565b7224b73b30b634b2103837b7b61034b73232bc1760691b815260200192915050565b60006137fe601f83613d37565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b80516000906101c084019061383f8582612db1565b5060208301516138526020860182612db1565b5060408301516138656040860182612db1565b5060608301516138786060860182612db1565b50608083015161388b608086018261396e565b5060a083015161389e60a086018261396e565b5060c08301516138b160c086018261396e565b5060e08301516138c460e086018261396e565b506101008301516138d961010086018261396e565b506101208301516138ee61012086018261396e565b506101408301518482036101408601526139088282612f68565b9150506101608301518482036101608601526139248282612f68565b9150506101808301518482036101808601526139408282612f68565b9150506101a08301518482036101a086015261395c8282612f68565b95945050505050565b612dab81613d50565b612dab81613d63565b612dab81613d66565b60006120228284612f39565b6000611c7482613675565b60208101611c748284612db1565b60208101611c748284612da2565b604081016139c18285612db1565b6120226020830184612db1565b604081016139dc8285612db1565b612022602083018461396e565b606081016139f78286612db1565b613a04602083018561396e565b61253d604083018461396e565b60608082528101613a228186612e28565b9050613a31602083018561396e565b818103604083015261395c8184612dba565b60208101611c748284612f30565b60208101611c748284612fa0565b602080825281016120228184612f68565b60208082528101611c7481612fa9565b60208082528101611c7481612fe2565b60208082528101611c748161301b565b60208082528101611c7481613066565b60208082528101611c74816130d7565b60208082528101611c748161312f565b60208082528101611c7481613177565b60208082528101611c74816131b0565b60208082528101611c74816131e0565b60208082528101611c7481613219565b60208082528101611c748161324a565b60208082528101611c7481613283565b60208082528101611c74816132bc565b60208082528101611c7481613309565b60208082528101611c7481613368565b60208082528101611c74816133a1565b60208082528101611c74816133e8565b60208082528101611c7481613430565b60208082528101611c748161347c565b60208082528101611c74816134b5565b60208082528101611c7481613505565b60208082528101611c7481613551565b60208082528101611c74816135a4565b60208082528101611c74816135d6565b60208082528101611c7481613647565b60208082528101611c7481613682565b60208082528101611c74816136d3565b60208082528101611c748161371e565b60208082528101611c748161376a565b60208082528101611c74816137c2565b60208082528101611c74816137f1565b60208101611c74828461396e565b60608101613c7c828661396e565b8181036020830152613c8e8185612ee2565b9050818103604083015261395c8184612e89565b60408101613cb0828561396e565b6120226020830184613965565b60405181810167ffffffffffffffff81118282101715613cdc57600080fd5b604052919050565b600067ffffffffffffffff821115613cfb57600080fd5b5060209081020190565b600067ffffffffffffffff821115613d1c57600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000611c7482613d57565b151590565b61ffff1690565b6001600160a01b031690565b90565b60ff1690565b6000611c7482613d82565b6000611c7482613d63565b6000611c7482613d40565b82818337506000910152565b60005b83811015613db4578181015183820152602001613d9c565b838111156127535750506000910152565b601f01601f191690565b613dd881613d40565b811461075557600080fd5b613dd881613d4b565b613dd881613d50565b613dd881613d63565b613dd881613d6656fea365627a7a7231582018c111957dfae0d5b1bbea23cdfb7090bbefb11004f4a52e317da7fe113cba9a6c6578706572696d656e74616cf564736f6c63430005110040
Libraries Used
DydxPoolController : 0x5add5c070902e4b535f76bafac486cc689095d71UnverifiedCompoundPoolController : 0xde6796aa414173b63f626be1f13e419d8e35fc09UnverifiedKeeperDaoPoolController : 0x948e587a4c175e3b4208f8084e6b8c5c0c4dae66UnverifiedAavePoolController : 0x25f9cebb75ebbaa7b7eddc70d33ffb993896ecb9UnverifiedAlphaPoolController : 0xed2cd60c0000a990a5ffaf0e7ddc70a37d7c623fUnverifiedEnzymePoolController : 0x97b6879573ae5c09cbe200c96b407ef9ac74fcc3Unverified
Deployed Bytecode Sourcemap
162360:20950:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;172498:120;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;172498:120:0;;;;;;;;:::i;167463:686::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;167463:686:0;;;;;;;;:::i;177289:122::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;177289:122:0;;;;;;;;:::i;170715:303::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;170715:303:0;;;:::i;:::-;;;;;;;;;;;;;;;;164986:172;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;164986:172:0;;;;;;;;:::i;171218:305::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;171218:305:0;;;;;;;;:::i;182112:229::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;182112:229:0;;;:::i;171698:148::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;171698:148:0;;;;;;;;:::i;169297:554::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;169297:554:0;;;;;;;;:::i;166856:168::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;166856:168:0;;;:::i;172165:108::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;172165:108:0;;;;;;;;:::i;:::-;;;;;;;;12696:140;;8:9:-1;5:2;;;30:1;27;20:12;5:2;12696:140:0;;;:::i;11883:79::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11883:79:0;;;:::i;:::-;;;;;;;;12249:94;;8:9:-1;5:2;;;30:1;27;20:12;5:2;12249:94:0;;;:::i;179953:295::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;179953:295:0;;;;;;;;:::i;172893:121::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;172893:121:0;;;;;;;;:::i;177874:1621::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;177874:1621:0;;;;;;;;:::i;165717:169::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;165717:169:0;;;;;;;;:::i;168388:559::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;168388:559:0;;;;;;;;:::i;175935:243::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;175935:243:0;;;;;;;;:::i;175327:264::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;175327:264:0;;;;;;;;:::i;11657:145::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11657:145:0;;;;;;;;:::i;173542:769::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;173542:769:0;;;;;;;;:::i;182807:500::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;182807:500:0;;;:::i;:::-;;;;;;;;;;162593:51;;8:9:-1;5:2;;;30:1;27;20:12;5:2;162593:51:0;;;:::i;177625:114::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;177625:114:0;;;;;;;;:::i;12991:109::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12991:109:0;;;;;;;;:::i;166558:171::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;166558:171:0;;;:::i;180915:1106::-;;;;;;;;;:::i;170199:155::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;170199:155:0;;;;;;;;:::i;172498:120::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;;;;;;;;;172578:17;:32;;-1:-1:-1;;172578:32:0;;;;;;;;;;;;172498:120::o;167463:686::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;167634:13;;;;167626:99;;;;-1:-1:-1;;;167626:99:0;;;;;;;;;167763:11;-1:-1:-1;;;;;167744:55:0;;:57;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;167744:57:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;167744:57:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;167744:57:0;;;;;;;;;167736:133;;;;-1:-1:-1;;;167736:133:0;;;;;;;;;167952:21;167990:11;;167986:156;;168019:12;168037:11;-1:-1:-1;;;;;168037:16:0;168060:7;168037:35;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;168018:54:0;;;168095:7;168087:43;;;;-1:-1:-1;;;168087:43:0;;;;;;;;;167986:156;;12152:1;167463:686;:::o;177289:122::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;177377:26;177398:4;177377:20;:26::i;:::-;177289:122;:::o;170715:303::-;170759:7;170793:21;170759:7;170861:129;170885:15;:22;170881:26;;170861:129;;;170935:43;170974:3;170935:34;170950:15;170966:1;170950:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;170935:14;:34::i;:::-;:38;:43;:38;:43;:::i;:::-;170929:49;-1:-1:-1;170909:3:0;;170861:129;;;-1:-1:-1;171007:3:0;-1:-1:-1;170715:303:0;:::o;164986:172::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;165069:24;:38;;-1:-1:-1;;;;;;165069:38:0;;-1:-1:-1;;;;;165069:38:0;;;;;;165123:27;;;;;;165069:38;;165123:27;;;;;;;;;;164986:172;:::o;171218:305::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;171324:9;;;171320:195;;171342:34;;-1:-1:-1;;;171342:34:0;;:18;;:26;;:34;;171369:6;;171342:34;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;171342:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;171342:34:0;;;;171335:41;;171320:195;171396:4;:9;;171404:1;171396:9;171392:123;;;171443:18;;171414:56;;-1:-1:-1;;;171414:56:0;;:20;;:28;;:56;;171443:18;;;-1:-1:-1;;;;;171443:18:0;;171463:6;;171414:56;;;;171392:123;171486:29;;-1:-1:-1;;;171486:29:0;;;;;;;;182112:229;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;182206:30;;-1:-1:-1;;;182206:30:0;;182184:19;;163687:42;;182206:15;;:30;;182230:4;;182206:30;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;182206:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182206:30:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;182206:30:0;;;;;;;;;182184:52;;182269:1;182255:11;:15;182247:48;;;;-1:-1:-1;;;182247:48:0;;;;;;;;;182306:27;;-1:-1:-1;;;182306:27:0;;163687:42;;182306:14;;:27;;182321:11;;182306:27;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;182306:27:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182306:27:0;;;;166114:1;182112:229::o;171698:148::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;171799:39;;-1:-1:-1;;;171799:39:0;;:23;;:31;;:39;;171831:6;;171799:39;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;171799:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;169297:554:0;169350:7;169374:9;;;169370:473;;169392:18;:29;:31;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;169392:31:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;169392:31:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;169392:31:0;;;;;;;;;169385:38;;;;169370:473;169443:4;:9;;169451:1;169443:9;169439:404;;;169461:22;:33;:35;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;169439:404:0;169516:4;:9;;169524:1;169516:9;169512:331;;;169534:23;:34;:36;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;169512:331:0;169590:4;:9;;169598:1;169590:9;169586:257;;;169608:18;:29;:31;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;169586:257:0;169659:4;:9;;169667:1;169659:9;169655:188;;;169677:19;:30;:32;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;169655:188:0;169729:4;:9;;169737:1;169729:9;169725:118;;;169779:18;;169747:51;;-1:-1:-1;;;169747:51:0;;:20;;:31;;:51;;169779:18;;;-1:-1:-1;;;;;169779:18:0;;169747:51;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;169725:118:0;169297:554;;;:::o;166856:168::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;166916:13;;;;166908:47;;;;-1:-1:-1;;;166908:47:0;;;;;;;;;166966:13;:21;;-1:-1:-1;;166966:21:0;;;167003:13;;;;166982:5;;167003:13;166856:168::o;172165:108::-;172244:21;;;;172220:4;172244:21;;;:15;:21;;;;;;;;172165:108::o;12696:140::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;12779:6;;12758:40;;12795:1;;-1:-1:-1;;;;;12779:6:0;;12758:40;;12795:1;;12758:40;12809:6;:19;;-1:-1:-1;;;;;;12809:19:0;;;12696:140::o;11883:79::-;11948:6;;-1:-1:-1;;;;;11948:6:0;11883:79;:::o;12249:94::-;12329:6;;12289:4;;-1:-1:-1;;;;;12329:6:0;12313:12;:10;:12::i;:::-;-1:-1:-1;;;;;12313:22:0;;12306:29;;12249:94;:::o;179953:295::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;-1:-1:-1;;;;;180068:27:0;;163395:42;180068:27;;:58;;-1:-1:-1;;;;;;180099:27:0;;163535:42;180099:27;180068:58;180060:114;;;;-1:-1:-1;;;180060:114:0;;;;;;;;;180185:55;180218:13;180233:6;180185:32;:55::i;172893:121::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;172974:18;:32;;-1:-1:-1;;;;;172974:32:0;;;;;-1:-1:-1;;;;;;172974:32:0;;;;;;;;;172893:121::o;177874:1621::-;165303:24;;;;;-1:-1:-1;;;;;165303:24:0;165331:10;165303:38;165295:82;;;;-1:-1:-1;;;165295:82:0;;;;;;;;;177995:1;177986:6;:10;177978:64;;;;-1:-1:-1;;;177978:64:0;;;;;;;;;178153:21;178210:24;;;178206:442;;;178251:19;178273:17;178288:1;178273:14;:17::i;:::-;178251:39;-1:-1:-1;178311:15:0;;178307:330;;178347:18;178368:27;:6;178379:15;178368:27;:10;:27;:::i;:::-;178347:48;;178414:18;178448:11;178435:10;:24;:51;;178475:11;178435:51;;;178462:10;178435:51;178414:72;;178505:58;178536:1;178539:10;178551:11;178505:30;:58::i;:::-;178600:21;178582:39;;178307:330;;;178206:442;;178665:9;178660:592;178684:15;:22;178680:26;;178660:592;;;178751:6;178732:15;:25;178728:36;;178759:5;;178728:36;178779:10;178792:15;178808:1;178792:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;178837:1:0;178829:9;;178825:23;;;178840:8;;;178825:23;178863:19;178885:20;178900:4;178885:14;:20::i;:::-;178863:42;;178939:1;178924:11;:16;178920:30;;178942:8;;;;178920:30;178965:18;178986:27;:6;178997:15;178986:27;:10;:27;:::i;:::-;178965:48;;179028:18;179062:11;179049:10;:24;:51;;179089:11;179049:51;;;179076:10;179049:51;179028:72;;179115:61;179146:4;179152:10;179164:11;179115:30;:61::i;:::-;179209:31;:15;179229:10;179209:31;:19;:31;:::i;:::-;179191:49;;178660:592;;;;;178708:3;;178660:592;;;;179297:6;179272:21;:31;;179264:71;;;;-1:-1:-1;;;179264:71:0;;;;;;;;;179367:24;;:47;;179349:12;;179367:24;;;-1:-1:-1;;;;;179367:24:0;;179403:6;;179367:47;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;179348:66:0;;;179433:7;179425:62;;;;-1:-1:-1;;;179425:62:0;;;;;;;;165717:169;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;165794:26;:39;;-1:-1:-1;;;;;;165794:39:0;-1:-1:-1;;;;;165794:39:0;;;;;165849:29;;;;;;165794:39;;165849:29;;168388:559;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;168561:15;168574:1;168561:12;:15::i;:::-;168557:57;;;168591:23;168612:1;168591:20;:23::i;:::-;168683:9;168678:161;168702:15;:22;168698:26;;168678:161;;;168748:32;168761:15;168777:1;168761:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;168748:12;:32::i;:::-;168744:95;;;168799:40;168820:15;168836:1;168820:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;168799:20;:40::i;:::-;168726:3;;168678:161;;;;168904:35;168927:11;168904:22;:35::i;175935:243::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;165303:24;;;;;-1:-1:-1;;;;;165303:24:0;165331:10;165303:38;165295:82;;;;-1:-1:-1;;;165295:82:0;;;;;;;;;176069:31;176087:4;176093:6;176069:17;:31::i;:::-;176125:14;176115:6;:24;176111:59;;;-1:-1:-1;;176141:21:0;;176165:5;176141:21;;;:15;:21;;;;;:29;;-1:-1:-1;;176141:29:0;;;175935:243::o;175327:264::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;175445:1;175436:6;:10;175428:53;;;;-1:-1:-1;;;175428:53:0;;;;;;;;;175492:31;175510:4;175516:6;175492:17;:31::i;:::-;175582:1;175558:21;175574:4;175558:15;:21::i;:::-;175534;;;;;;;;:15;:21;;;;;:49;;-1:-1:-1;;175534:49:0;175558:25;;;;175534:49;;;;-1:-1:-1;175327:264:0:o;11657:145::-;8634:12;;;;;;;;:31;;;8650:15;:13;:15::i;:::-;8634:47;;;-1:-1:-1;8670:11:0;;;;8669:12;8634:47;8626:106;;;;-1:-1:-1;;;8626:106:0;;;;;;;;;8741:19;8764:12;;;;;;8763:13;8783:83;;;;8812:12;:19;;-1:-1:-1;;;;8812:19:0;;;;;8840:18;8827:4;8840:18;;;8783:83;11723:6;:15;;-1:-1:-1;;;;;;11723:15:0;-1:-1:-1;;;;;11723:15:0;;;;;;;;;;;11754:40;;11787:6;;;-1:-1:-1;;11754:40:0;;-1:-1:-1;;11754:40:0;8888:14;8884:57;;;8928:5;8913:20;;-1:-1:-1;;8913:20:0;;;11657:145;;:::o;173542:769::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;173657:1;173648:6;:10;173640:53;;;;-1:-1:-1;;;173640:53:0;;;;;;;;;173708:9;;;173704:470;;173719:34;;-1:-1:-1;;;173719:34:0;;:18;;:26;;:34;;173746:6;;173719:34;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;173719:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;173719:34:0;;;;173704:470;;;173773:4;:9;;173781:1;173773:9;173769:405;;;173784:38;;-1:-1:-1;;;173784:38:0;;:22;;:30;;:38;;173815:6;;173784:38;;;;173769:405;173842:4;:9;;173850:1;173842:9;173838:336;;;173853:39;;-1:-1:-1;;;173853:39:0;;:23;;:31;;:39;;173885:6;;173853:39;;;;173838:336;173912:4;:9;;173920:1;173912:9;173908:266;;;173958:17;;173923:53;;-1:-1:-1;;;173923:53:0;;:18;;:26;;:53;;173950:6;;173958:17;;;;;173923:53;;;;173908:266;173996:4;:9;;174004:1;173996:9;173992:182;;;174007:35;;-1:-1:-1;;;174007:35:0;;:19;;:27;;:35;;174035:6;;174007:35;;;;173992:182;174062:4;:9;;174070:1;174062:9;174058:116;;;174102:18;;174073:56;;-1:-1:-1;;;174073:56:0;;:20;;:28;;:56;;174102:18;;;-1:-1:-1;;;;;174102:18:0;;174122:6;;174073:56;;;;174058:116;174185:21;;;;;;;:15;:21;;;;;:28;;-1:-1:-1;;174185:28:0;174209:4;174185:28;;;174275:19;;;;;;;;174230:73;;;;;;;;174245:28;174230:73;;174296:6;174230:73;;;;;;;;;;;;;;;173542:769;;:::o;182807:500::-;182855:7;182864:14;182880:16;182909:20;182944:15;:22;;;;182932:35;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;182932:35:0;;182909:58;;182978:29;183024:15;:22;;;;183010:37;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;183010:37:0;-1:-1:-1;182978:69:0;-1:-1:-1;183065:9:0;183060:176;183084:15;:22;183080:26;;183060:176;;;183139:15;183155:1;183139:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;183128:5;183134:1;183128:8;;;;;;;;;;;;;:29;;;;;;;;;;;183190:34;183205:15;183221:1;183205:18;;;;;;;183190:34;183172:12;183185:1;183172:15;;;;;;;;;;;;;;;;;:52;183108:3;;183060:176;;;-1:-1:-1;183256:21:0;;183279:5;;-1:-1:-1;183279:5:0;-1:-1:-1;182807:500:0;-1:-1:-1;182807:500:0:o;162593:51::-;162640:4;162593:51;:::o;177625:114::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;12991:109;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;13064:28;13083:8;13064:18;:28::i;166558:171::-;12095:9;:7;:9::i;:::-;12087:54;;;;-1:-1:-1;;;12087:54:0;;;;;;;;;166620:13;;;;166619:14;166611:49;;;;-1:-1:-1;;;166611:49:0;;;;;;;;;166671:13;:20;;-1:-1:-1;;166671:20:0;166687:4;166671:20;;;166707:14;;;;166671:13;;166707:14;166558:171::o;180915:1106::-;167134:13;;;;167133:14;167125:100;;;;-1:-1:-1;;;167125:100:0;;;;;;;;;166029:26;;-1:-1:-1;;;;;166029:26:0;166059:10;166029:40;166021:82;;;;-1:-1:-1;;;166021:82:0;;;;;;;;;181188:21;181220:31;;:::i;:::-;181254:104;181306:6;181314:10;181326:20;181348:9;181254:51;:104::i;:::-;181466:16;;;181484;;;181432:69;;181220:138;;-1:-1:-1;181395:21:0;;181432:69;;;;181446:18;;181432:69;;;;;;;;;;181570:30;;-1:-1:-1;;;181570:30:0;;181548:19;;163687:42;;181570:15;;:30;;181594:4;;181570:30;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;181570:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;181570:30:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;181570:30:0;;;;;;;;;181548:52;;181633:1;181619:11;:15;181611:46;;;;-1:-1:-1;;;181611:46:0;;;;;;;;;181668:27;;-1:-1:-1;;;181668:27:0;;163687:42;;181668:14;;:27;;181683:11;;181668:27;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;181668:27:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;181668:27:0;;;;181760:14;181777:52;181797:31;181818:9;181797:16;:20;;:31;;;;:::i;:::-;181777:15;;:52;:19;:52;:::i;:::-;181760:69;-1:-1:-1;181846:10:0;;181842:172;;181874:12;181892:10;-1:-1:-1;;;;;181892:15:0;181914:6;181892:33;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;181873:52:0;;;181948:7;181940:62;;;;-1:-1:-1;;;181940:62:0;;;;;;;;;181842:172;;166114:1;;;;;180915:1106;;;;:::o;170199:155::-;170276:21;;;;170251:7;170276:21;;;:15;:21;;;;;;170251:7;;170276:21;170271:36;;-1:-1:-1;170306:1:0;170299:8;;170271:36;170325:21;170341:4;170325:15;:21::i;:::-;170318:28;170199:155;-1:-1:-1;;170199:155:0:o;176328:790::-;176394:9;;;176390:592;;176405:18;:30;:32;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176405:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;176405:32:0;;;;176390:592;;;176457:4;:9;;176465:1;176457:9;176453:529;;;176476:22;:34;:36;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176476:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;176476:36:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;176476:36:0;;;;;;;;;176468:86;;;;-1:-1:-1;;;176468:86:0;;;;;;;;;176453:529;;;176574:4;:9;;176582:1;176574:9;176570:412;;;176593:23;:35;:37;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176593:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;176593:37:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;176593:37:0;;;;;;;;;176585:88;;;;-1:-1:-1;;;176585:88:0;;;;;;;;176570:412;176693:4;:9;;176701:1;176693:9;176689:293;;;176704:18;:30;:32;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;176689:293:0;176756:4;:9;;176764:1;176756:9;176752:230;;;176775:19;:31;:33;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176775:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;176775:33:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;176775:33:0;;;;;;;;;176767:87;;;;-1:-1:-1;;;176767:87:0;;;;;;;;176752:230;176874:4;:9;;176882:1;176874:9;176870:112;;;176918:18;;176885:52;;-1:-1:-1;;;176885:52:0;;:20;;:32;;:52;;176918:18;;;-1:-1:-1;;;;;176918:18:0;;176885:52;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;176870:112:0;176993:21;;;177017:5;176993:21;;;:15;:21;;;;;:29;;-1:-1:-1;;176993:29:0;;;177087:19;;;;;;;;177038:72;;;;;;;;177053:32;177038:72;177108:1;177038:72;;;;;;;;;;;;;;;176328:790;:::o;940:181::-;998:7;1030:5;;;1054:6;;;;1046:46;;;;-1:-1:-1;;;1046:46:0;;;;;;;;;1112:1;940:181;-1:-1:-1;;;940:181:0:o;10562:98::-;10642:10;10562:98;:::o;157959:434::-;158118:52;;-1:-1:-1;;;158118:52:0;;158033:4;;158072:13;;158033:4;;-1:-1:-1;;;;;158118:15:0;;;;;:52;;158142:4;;157308:42;;158118:52;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;158118:52:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;158118:52:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;158118:52:0;;;;;;;;;158097:73;;158199:6;158185:10;:20;158181:37;;;158214:4;158207:11;;;;;;158181:37;158242:1;158233:6;:10;:28;;;;;158260:1;158247:10;:14;158233:28;158229:76;;;158263:42;-1:-1:-1;;;;;158263:17:0;;157308:42;158303:1;158263:42;:17;:42;:::i;:::-;158316:47;-1:-1:-1;;;;;158316:17:0;;157308:42;158356:6;158316:47;:17;:47;:::i;:::-;-1:-1:-1;158381:4:0;;157959:434;-1:-1:-1;;;;157959:434:0:o;1396:136::-;1454:7;1481:43;1485:1;1488;1481:43;;;;;;;;;;;;;;;;;:3;:43::i;174514:630::-;174593:9;;;174589:457;;174604:35;;-1:-1:-1;;;174604:35:0;;:18;;:27;;:35;;174632:6;;174604:35;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;174604:35:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;174604:35:0;;;;174589:457;;;174659:4;:9;;174667:1;174659:9;174655:391;;;174670:39;;-1:-1:-1;;;174670:39:0;;:22;;:31;;:39;;174702:6;;174670:39;;;;174655:391;174729:4;:9;;174737:1;174729:9;174725:321;;;174740:40;;-1:-1:-1;;;174740:40:0;;:23;;:32;;:40;;174773:6;;174740:40;;;;174725:321;174800:4;:9;;174808:1;174800:9;174796:250;;;174811:35;;-1:-1:-1;;;174811:35:0;;:18;;:27;;:35;;174839:6;;174811:35;;;;174796:250;174866:4;:9;;174874:1;174866:9;174862:184;;;174877:36;;-1:-1:-1;;;174877:36:0;;:19;;:28;;:36;;174906:6;;174877:36;;;;174862:184;174933:4;:9;;174941:1;174933:9;174929:117;;;174974:18;;174944:57;;-1:-1:-1;;;174944:57:0;;:20;;:29;;:57;;174974:18;;;-1:-1:-1;;;;;174974:18:0;;174994:6;;174944:57;;;;174929:117;175122:4;175108:19;;;;;;;;;;175062:74;;;;;;;;175077:29;175062:74;;9035:508;9452:4;9498:17;9530:7;9035:508;:::o;13206:229::-;-1:-1:-1;;;;;13280:22:0;;13272:73;;;;-1:-1:-1;;;13272:73:0;;;;;;;;;13382:6;;13361:38;;-1:-1:-1;;;;;13361:38:0;;;;13382:6;;13361:38;;13382:6;;13361:38;13410:6;:17;;-1:-1:-1;;;;;;13410:17:0;-1:-1:-1;;;;;13410:17:0;;;;;;;;;;13206:229::o;158911:734::-;159075:17;;:::i;:::-;159129:1;159113:6;:13;:17;159105:84;;;;-1:-1:-1;;;159105:84:0;;;;;;;;;159225:10;:17;159208:6;:13;:34;159200:96;;;;-1:-1:-1;;;159200:96:0;;;;;;;;;159338:1;159315:20;:24;159307:84;;;;-1:-1:-1;;;159307:84:0;;;;;;;;;159402:45;;:::i;:::-;159450:97;;-1:-1:-1;;;159450:97:0;;157137:42;;159450:36;;159493:11;;159450:97;;159506:6;;159514:20;;159536:10;;159450:97;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;159450:97:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;159450:97:0;;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;159450:97:0;;;;;;;;;159402:145;;159558:79;;;;;;;;159566:11;:34;;;159558:79;;;;159602:11;:34;;;159558:79;;;;;;158911:734;;;;;;;:::o;20571:621::-;20941:10;;;20940:62;;-1:-1:-1;20957:39:0;;-1:-1:-1;;;20957:39:0;;-1:-1:-1;;;;;20957:15:0;;;;;:39;;20981:4;;20988:7;;20957:39;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;20957:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;20957:39:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;20957:39:0;;;;;;;;;:44;20940:62;20932:152;;;;-1:-1:-1;;;20932:152:0;;;;;;;;;21121:62;;21095:89;;21114:5;;-1:-1:-1;;;21144:22:0;21121:62;;21168:7;;21177:5;;21121:62;;;;;;;;-1:-1:-1;;26:21;;;22:32;6:49;;21121:62:0;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;;;;21121:62:0;;;179:29:-1;;;;160:49;;;21095:18:0;:89::i;1869:192::-;1955:7;1991:12;1983:6;;;;1975:29;;;;-1:-1:-1;;;1975:29:0;;;;;;;;;;-1:-1:-1;;;2027:5:0;;;1869:192::o;22214:1114::-;22818:27;22826:5;-1:-1:-1;;;;;22818:25:0;;:27::i;:::-;22810:71;;;;-1:-1:-1;;;22810:71:0;;;;;;;;;22955:12;22969:23;23004:5;-1:-1:-1;;;;;22996:19:0;23016:4;22996:25;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;22954:67:0;;;;23040:7;23032:52;;;;-1:-1:-1;;;23032:52:0;;;;;;;;;23101:17;;:21;23097:224;;23243:10;23232:30;;;;;;;;;;;;;;23224:85;;;;-1:-1:-1;;;23224:85:0;;;;;;;;;22214:1114;;;;:::o;17177:619::-;17237:4;17705:20;;17548:66;17745:23;;;;;;:42;;-1:-1:-1;;17772:15:0;;;17737:51;-1:-1:-1;;17177:619:0:o;162360:20950::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;-1:-1;162360:20950:0;;;-1:-1:-1;;162360:20950:0:o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;311:693;;433:3;426:4;418:6;414:17;410:27;400:2;;451:1;448;441:12;400:2;488:6;475:20;510:85;525:69;587:6;525:69;;;510:85;;;623:21;;;667:4;655:17;;;;501:94;;-1:-1;680:14;;655:17;775:1;760:238;785:6;782:1;779:13;760:238;;;868:3;855:17;847:6;843:30;892:42;930:3;918:10;892:42;;;880:55;;-1:-1;958:4;949:14;;;;977;;;;;807:1;800:9;760:238;;;764:14;393:611;;;;;;;;1044:735;;1180:3;1173:4;1165:6;1161:17;1157:27;1147:2;;1198:1;1195;1188:12;1147:2;1235:6;1222:20;1257:99;1272:83;1348:6;1272:83;;1257:99;1384:21;;;1428:4;1416:17;;;;1248:108;;-1:-1;1441:14;;1416:17;1536:1;1521:252;1546:6;1543:1;1540:13;1521:252;;;1629:3;1616:17;1608:6;1604:30;1653:56;1705:3;1693:10;1653:56;;;1641:69;;-1:-1;1733:4;1724:14;;;;1752;;;;;1568:1;1561:9;1521:252;;1787:128;1862:13;;1880:30;1862:13;1880:30;;1923:432;;2020:3;2013:4;2005:6;2001:17;1997:27;1987:2;;2038:1;2035;2028:12;1987:2;2075:6;2062:20;2097:60;2112:44;2149:6;2112:44;;2097:60;2088:69;;2177:6;2170:5;2163:21;2213:4;2205:6;2201:17;2246:4;2239:5;2235:16;2281:3;2272:6;2267:3;2263:16;2260:25;2257:2;;;2298:1;2295;2288:12;2257:2;2308:41;2342:6;2337:3;2332;2308:41;;;1980:375;;;;;;;;2403:1033;;2532:4;2520:9;2515:3;2511:19;2507:30;2504:2;;;2550:1;2547;2540:12;2504:2;2568:20;2583:4;2568:20;;;2559:29;-1:-1;2656:1;2688:60;2744:3;2724:9;2688:60;;;2663:86;;-1:-1;2828:2;2861:60;2917:3;2893:22;;;2861:60;;;2854:4;2847:5;2843:16;2836:86;2770:163;2991:2;3024:60;3080:3;3071:6;3060:9;3056:22;3024:60;;;3017:4;3010:5;3006:16;2999:86;2943:153;3154:2;3187:60;3243:3;3234:6;3223:9;3219:22;3187:60;;;3180:4;3173:5;3169:16;3162:86;3106:153;3320:3;3354:60;3410:3;3401:6;3390:9;3386:22;3354:60;;;3347:4;3340:5;3336:16;3329:86;3269:157;2498:938;;;;;3471:2714;;3579:6;3567:9;3562:3;3558:19;3554:32;3551:2;;;3599:1;3596;3589:12;3551:2;3617:22;3632:6;3617:22;;;3608:31;-1:-1;3697:1;3729:49;3774:3;3754:9;3729:49;;;3704:75;;-1:-1;3848:2;3881:49;3926:3;3902:22;;;3881:49;;;3874:4;3867:5;3863:16;3856:75;3800:142;4007:2;4040:49;4085:3;4076:6;4065:9;4061:22;4040:49;;;4033:4;4026:5;4022:16;4015:75;3952:149;4160:2;4193:49;4238:3;4229:6;4218:9;4214:22;4193:49;;;4186:4;4179:5;4175:16;4168:75;4111:143;4316:3;4350:49;4395:3;4386:6;4375:9;4371:22;4350:49;;;4343:4;4336:5;4332:16;4325:75;4264:147;4473:3;4507:49;4552:3;4543:6;4532:9;4528:22;4507:49;;;4500:4;4493:5;4489:16;4482:75;4421:147;4622:3;4656:49;4701:3;4692:6;4681:9;4677:22;4656:49;;;4649:4;4642:5;4638:16;4631:75;4578:139;4771:3;4805:49;4850:3;4841:6;4830:9;4826:22;4805:49;;;4798:4;4791:5;4787:16;4780:75;4727:139;4933:3;4969:49;5014:3;5005:6;4994:9;4990:22;4969:49;;;4960:6;4953:5;4949:18;4942:77;4876:154;5080:3;5116:49;5161:3;5152:6;5141:9;5137:22;5116:49;;;5107:6;5100:5;5096:18;5089:77;5040:137;5265:3;5254:9;5250:19;5237:33;5290:18;5282:6;5279:30;5276:2;;;5322:1;5319;5312:12;5276:2;5359:54;5409:3;5400:6;5389:9;5385:22;5359:54;;;5350:6;5343:5;5339:18;5332:82;5187:238;5513:3;5502:9;5498:19;5485:33;5538:18;5530:6;5527:30;5524:2;;;5570:1;5567;5560:12;5524:2;5607:54;5657:3;5648:6;5637:9;5633:22;5607:54;;;5598:6;5591:5;5587:18;5580:82;5435:238;5764:3;5753:9;5749:19;5736:33;5789:18;5781:6;5778:30;5775:2;;;5821:1;5818;5811:12;5775:2;5858:54;5908:3;5899:6;5888:9;5884:22;5858:54;;;5849:6;5842:5;5838:18;5831:82;5683:241;6015:3;6004:9;6000:19;5987:33;6040:18;6032:6;6029:30;6026:2;;;6072:1;6069;6062:12;6026:2;6109:54;6159:3;6150:6;6139:9;6135:22;6109:54;;;6100:6;6093:5;6089:18;6082:82;5934:241;3545:2640;;;;;6192:128;6258:20;;6283:32;6258:20;6283:32;;6327:130;6394:20;;6419:33;6394:20;6419:33;;6464:134;6542:13;;6560:33;6542:13;6560:33;;6605:126;6670:20;;6695:31;6670:20;6695:31;;6738:241;;6842:2;6830:9;6821:7;6817:23;6813:32;6810:2;;;6858:1;6855;6848:12;6810:2;6893:1;6910:53;6955:7;6935:9;6910:53;;7250:937;;;;;7479:3;7467:9;7458:7;7454:23;7450:33;7447:2;;;7496:1;7493;7486:12;7447:2;7531:1;7548:53;7593:7;7573:9;7548:53;;;7538:63;;7510:97;7666:2;7655:9;7651:18;7638:32;7690:18;7682:6;7679:30;7676:2;;;7722:1;7719;7712:12;7676:2;7742:97;7831:7;7822:6;7811:9;7807:22;7742:97;;;7732:107;;7617:228;7904:2;7893:9;7889:18;7876:32;7928:18;7920:6;7917:30;7914:2;;;7960:1;7957;7950:12;7914:2;7980:83;8055:7;8046:6;8035:9;8031:22;7980:83;;;7970:93;;7855:214;8100:2;8118:53;8163:7;8154:6;8143:9;8139:22;8118:53;;;8108:63;;8079:98;7441:746;;;;;;;;8194:366;;;8315:2;8303:9;8294:7;8290:23;8286:32;8283:2;;;8331:1;8328;8321:12;8283:2;8366:1;8383:53;8428:7;8408:9;8383:53;;;8373:63;;8345:97;8473:2;8491:53;8536:7;8527:6;8516:9;8512:22;8491:53;;;8481:63;;8452:98;8277:283;;;;;;8567:257;;8679:2;8667:9;8658:7;8654:23;8650:32;8647:2;;;8695:1;8692;8685:12;8647:2;8730:1;8747:61;8800:7;8780:9;8747:61;;8831:322;;8975:3;8963:9;8954:7;8950:23;8946:33;8943:2;;;8992:1;8989;8982:12;8943:2;9027:1;9044:93;9129:7;9109:9;9044:93;;9160:239;;9263:2;9251:9;9242:7;9238:23;9234:32;9231:2;;;9279:1;9276;9269:12;9231:2;9314:1;9331:52;9375:7;9355:9;9331:52;;9406:241;;9510:2;9498:9;9489:7;9485:23;9481:32;9478:2;;;9526:1;9523;9516:12;9478:2;9561:1;9578:53;9623:7;9603:9;9578:53;;9654:263;;9769:2;9757:9;9748:7;9744:23;9740:32;9737:2;;;9785:1;9782;9775:12;9737:2;9820:1;9837:64;9893:7;9873:9;9837:64;;9924:237;;10026:2;10014:9;10005:7;10001:23;9997:32;9994:2;;;10042:1;10039;10032:12;9994:2;10077:1;10094:51;10137:7;10117:9;10094:51;;10168:362;;;10287:2;10275:9;10266:7;10262:23;10258:32;10255:2;;;10303:1;10300;10293:12;10255:2;10338:1;10355:51;10398:7;10378:9;10355:51;;10537:487;;;;10673:2;10661:9;10652:7;10648:23;10644:32;10641:2;;;10689:1;10686;10679:12;10641:2;10724:1;10741:51;10784:7;10764:9;10741:51;;;10731:61;;10703:95;10829:2;10847:53;10892:7;10883:6;10872:9;10868:22;10847:53;;;10837:63;;10808:98;10937:2;10955:53;11000:7;10991:6;10980:9;10976:22;10955:53;;;10945:63;;10916:98;10635:389;;;;;;11032:177;;11143:60;11199:3;11191:6;11143:60;;11218:233;;11357:88;11441:3;11433:6;11357:88;;11460:173;;11547:46;11589:3;11581:6;11547:46;;;-1:-1;;11622:4;11613:14;;11540:93;11642:165;;11725:42;11763:3;11755:6;11725:42;;11815:142;11906:45;11945:5;11906:45;;;11901:3;11894:58;11888:69;;;11964:103;12037:24;12055:5;12037:24;;12349:888;;12504:59;12557:5;12504:59;;;12576:91;12660:6;12655:3;12576:91;;;12569:98;;12690:3;12732:4;12724:6;12720:17;12715:3;12711:27;12759:61;12814:5;12759:61;;;12840:7;12868:1;12853:345;12878:6;12875:1;12872:13;12853:345;;;12940:9;12934:4;12930:20;12925:3;12918:33;12985:6;12979:13;13007:74;13076:4;13061:13;13007:74;;;12999:82;;13098:65;13156:6;13098:65;;;13186:4;13177:14;;;;;13088:75;-1:-1;;12900:1;12893:9;12853:345;;;-1:-1;13211:4;;12483:754;-1:-1;;;;;;;12483:754;13304:1000;;13487:73;13554:5;13487:73;;;13573:105;13671:6;13666:3;13573:105;;;13566:112;;13701:3;13743:4;13735:6;13731:17;13726:3;13722:27;13770:75;13839:5;13770:75;;;13865:7;13893:1;13878:387;13903:6;13900:1;13897:13;13878:387;;;13965:9;13959:4;13955:20;13950:3;13943:33;14010:6;14004:13;14032:102;14129:4;14114:13;14032:102;;;14024:110;;14151:79;14223:6;14151:79;;;14253:4;14244:14;;;;;14141:89;-1:-1;;13925:1;13918:9;13878:387;;14343:690;;14488:54;14536:5;14488:54;;;14555:86;14634:6;14629:3;14555:86;;;14548:93;;14662:56;14712:5;14662:56;;;14738:7;14766:1;14751:260;14776:6;14773:1;14770:13;14751:260;;;14843:6;14837:13;14864:63;14923:3;14908:13;14864:63;;;14857:70;;14944:60;14997:6;14944:60;;;14934:70;-1:-1;;14798:1;14791:9;14751:260;;;-1:-1;15024:3;;14467:566;-1:-1;;;;;14467:566;15068:674;;15209:52;15255:5;15209:52;;;15274:84;15351:6;15346:3;15274:84;;;15267:91;;15379:54;15427:5;15379:54;;;15453:7;15481:1;15466:254;15491:6;15488:1;15485:13;15466:254;;;15558:6;15552:13;15579:59;15634:3;15619:13;15579:59;;;15572:66;;15655:58;15706:6;15655:58;;;15645:68;-1:-1;;15513:1;15506:9;15466:254;;15750:104;15827:21;15842:5;15827:21;;15861:356;;15989:38;16021:5;15989:38;;;16039:88;16120:6;16115:3;16039:88;;;16032:95;;16132:52;16177:6;16172:3;16165:4;16158:5;16154:16;16132:52;;;16196:16;;;;;15969:248;-1:-1;;15969:248;16224:315;;16320:34;16348:5;16320:34;;;16366:60;16419:6;16414:3;16366:60;;;16359:67;;16431:52;16476:6;16471:3;16464:4;16457:5;16453:16;16431:52;;;16504:29;16526:6;16504:29;;;16495:39;;;;16300:239;-1:-1;;;16300:239;16546:142;16637:45;16676:5;16637:45;;17050:329;;17210:67;17274:2;17269:3;17210:67;;;17310:31;17290:52;;17370:2;17361:12;;17196:183;-1:-1;;17196:183;17388:330;;17548:67;17612:2;17607:3;17548:67;;;17648:32;17628:53;;17709:2;17700:12;;17534:184;-1:-1;;17534:184;17727:378;;17887:67;17951:2;17946:3;17887:67;;;17987:34;17967:55;;-1:-1;;;18051:2;18042:12;;18035:33;18096:2;18087:12;;17873:232;-1:-1;;17873:232;18114:447;;18274:67;18338:2;18333:3;18274:67;;;18374:34;18354:55;;18443:34;18438:2;18429:12;;18422:56;-1:-1;;;18507:2;18498:12;;18491:33;18552:2;18543:12;;18260:301;-1:-1;;18260:301;18570:391;;18730:67;18794:2;18789:3;18730:67;;;18830:34;18810:55;;-1:-1;;;18894:2;18885:12;;18878:46;18952:2;18943:12;;18716:245;-1:-1;;18716:245;18970:375;;19130:67;19194:2;19189:3;19130:67;;;19230:34;19210:55;;-1:-1;;;19294:2;19285:12;;19278:30;19336:2;19327:12;;19116:229;-1:-1;;19116:229;19354:323;;19514:67;19578:2;19573:3;19514:67;;;19614:25;19594:46;;19668:2;19659:12;;19500:177;-1:-1;;19500:177;19686:320;;19846:67;19910:2;19905:3;19846:67;;;-1:-1;;;19926:43;;19997:2;19988:12;;19832:174;-1:-1;;19832:174;20015:327;;20175:67;20239:2;20234:3;20175:67;;;20275:29;20255:50;;20333:2;20324:12;;20161:181;-1:-1;;20161:181;20351:321;;20511:67;20575:2;20570:3;20511:67;;;-1:-1;;;20591:44;;20663:2;20654:12;;20497:175;-1:-1;;20497:175;20681:331;;20841:67;20905:2;20900:3;20841:67;;;20941:33;20921:54;;21003:2;20994:12;;20827:185;-1:-1;;20827:185;21021:332;;21181:67;21245:2;21240:3;21181:67;;;21281:34;21261:55;;21344:2;21335:12;;21167:186;-1:-1;;21167:186;21362:380;;21522:67;21586:2;21581:3;21522:67;;;21622:34;21602:55;;-1:-1;;;21686:2;21677:12;;21670:35;21733:2;21724:12;;21508:234;-1:-1;;21508:234;21751:400;;21911:67;21975:2;21970:3;21911:67;;;22011:34;21991:55;;22080:33;22075:2;22066:12;;22059:55;22142:2;22133:12;;21897:254;-1:-1;;21897:254;22160:327;;22320:67;22384:2;22379:3;22320:67;;;22420:29;22400:50;;22478:2;22469:12;;22306:181;-1:-1;;22306:181;22496:374;;22656:67;22720:2;22715:3;22656:67;;;22756:34;22736:55;;-1:-1;;;22820:2;22811:12;;22804:29;22861:2;22852:12;;22642:228;-1:-1;;22642:228;22879:375;;23039:67;23103:2;23098:3;23039:67;;;23139:34;23119:55;;-1:-1;;;23203:2;23194:12;;23187:30;23245:2;23236:12;;23025:229;-1:-1;;23025:229;23263:379;;23423:67;23487:2;23482:3;23423:67;;;23523:34;23503:55;;-1:-1;;;23587:2;23578:12;;23571:34;23633:2;23624:12;;23409:233;-1:-1;;23409:233;23651:332;;23811:67;23875:2;23870:3;23811:67;;;23911:34;23891:55;;23974:2;23965:12;;23797:186;-1:-1;;23797:186;23992:383;;24152:67;24216:2;24211:3;24152:67;;;24252:34;24232:55;;-1:-1;;;24316:2;24307:12;;24300:38;24366:2;24357:12;;24138:237;-1:-1;;24138:237;24384:379;;24544:67;24608:2;24603:3;24544:67;;;24644:34;24624:55;;-1:-1;;;24708:2;24699:12;;24692:34;24754:2;24745:12;;24530:233;-1:-1;;24530:233;24772:386;;24932:67;24996:2;24991:3;24932:67;;;25032:34;25012:55;;-1:-1;;;25096:2;25087:12;;25080:41;25149:2;25140:12;;24918:240;-1:-1;;24918:240;25167:322;;25327:67;25391:2;25386:3;25327:67;;;-1:-1;;;25407:45;;25480:2;25471:12;;25313:176;-1:-1;;25313:176;25498:447;;25658:67;25722:2;25717:3;25658:67;;;25758:34;25738:55;;25827:34;25822:2;25813:12;;25806:56;-1:-1;;;25891:2;25882:12;;25875:33;25936:2;25927:12;;25644:301;-1:-1;;25644:301;25954:318;;26114:67;26178:2;26173:3;26114:67;;;-1:-1;;;26194:41;;26263:2;26254:12;;26100:172;-1:-1;;26100:172;26281:296;;26458:83;26539:1;26534:3;26458:83;;26586:384;;26746:67;26810:2;26805:3;26746:67;;;26846:34;26826:55;;-1:-1;;;26910:2;26901:12;;26894:39;26961:2;26952:12;;26732:238;-1:-1;;26732:238;26979:378;;27139:67;27203:2;27198:3;27139:67;;;27239:34;27219:55;;-1:-1;;;27303:2;27294:12;;27287:33;27348:2;27339:12;;27125:232;-1:-1;;27125:232;27366:379;;27526:67;27590:2;27585:3;27526:67;;;27626:34;27606:55;;-1:-1;;;27690:2;27681:12;;27674:34;27736:2;27727:12;;27512:233;-1:-1;;27512:233;27754:391;;27914:67;27978:2;27973:3;27914:67;;;28014:34;27994:55;;-1:-1;;;28078:2;28069:12;;28062:46;28136:2;28127:12;;27900:245;-1:-1;;27900:245;28154:319;;28314:67;28378:2;28373:3;28314:67;;;-1:-1;;;28394:42;;28464:2;28455:12;;28300:173;-1:-1;;28300:173;28482:331;;28642:67;28706:2;28701:3;28642:67;;;28742:33;28722:54;;28804:2;28795:12;;28628:185;-1:-1;;28628:185;28874:2766;29083:23;;28874:2766;;29007:6;28998:16;;;29112:63;29002:3;29083:23;29112:63;;;29029:152;29262:4;29255:5;29251:16;29245:23;29274:63;29331:4;29326:3;29322:14;29308:12;29274:63;;;29191:152;29431:4;29424:5;29420:16;29414:23;29443:63;29500:4;29495:3;29491:14;29477:12;29443:63;;;29353:159;29594:4;29587:5;29583:16;29577:23;29606:63;29663:4;29658:3;29654:14;29640:12;29606:63;;;29522:153;29760:4;29753:5;29749:16;29743:23;29772:63;29829:4;29824:3;29820:14;29806:12;29772:63;;;29685:156;29926:4;29919:5;29915:16;29909:23;29938:63;29995:4;29990:3;29986:14;29972:12;29938:63;;;29851:156;30084:4;30077:5;30073:16;30067:23;30096:63;30153:4;30148:3;30144:14;30130:12;30096:63;;;30017:148;30242:4;30235:5;30231:16;30225:23;30254:63;30311:4;30306:3;30302:14;30288:12;30254:63;;;30175:148;30413:6;30406:5;30402:18;30396:25;30427:65;30484:6;30479:3;30475:16;30461:12;30427:65;;;30333:165;30571:6;30564:5;30560:18;30554:25;30585:65;30642:6;30637:3;30633:16;30619:12;30585:65;;;30508:148;30739:6;30732:5;30728:18;30722:25;30795:3;30789:4;30785:14;30776:6;30771:3;30767:16;30760:40;30815:67;30877:4;30863:12;30815:67;;;30807:75;;30666:228;30977:6;30970:5;30966:18;30960:25;31033:3;31027:4;31023:14;31014:6;31009:3;31005:16;30998:40;31053:67;31115:4;31101:12;31053:67;;;31045:75;;30904:228;31218:6;31211:5;31207:18;31201:25;31274:3;31268:4;31264:14;31255:6;31250:3;31246:16;31239:40;31294:67;31356:4;31342:12;31294:67;;;31286:75;;31142:231;31459:6;31452:5;31448:18;31442:25;31515:3;31509:4;31505:14;31496:6;31491:3;31487:16;31480:40;31535:67;31597:4;31583:12;31535:67;;;31527:75;28980:2660;-1:-1;;;;;28980:2660;31647:118;31736:23;31753:5;31736:23;;31772:103;31845:24;31863:5;31845:24;;32130:97;32199:22;32215:5;32199:22;;32234:262;;32378:93;32467:3;32458:6;32378:93;;32503:370;;32701:147;32844:3;32701:147;;32880:213;32998:2;32983:18;;33012:71;32987:9;33056:6;33012:71;;33336:229;33462:2;33447:18;;33476:79;33451:9;33528:6;33476:79;;33572:324;33718:2;33703:18;;33732:71;33707:9;33776:6;33732:71;;;33814:72;33882:2;33871:9;33867:18;33858:6;33814:72;;33903:324;34049:2;34034:18;;34063:71;34038:9;34107:6;34063:71;;;34145:72;34213:2;34202:9;34198:18;34189:6;34145:72;;34589:435;34763:2;34748:18;;34777:71;34752:9;34821:6;34777:71;;;34859:72;34927:2;34916:9;34912:18;34903:6;34859:72;;;34942;35010:2;34999:9;34995:18;34986:6;34942:72;;35031:827;35353:2;35367:47;;;35338:18;;35428:146;35338:18;35560:6;35428:146;;;35420:154;;35585:72;35653:2;35642:9;35638:18;35629:6;35585:72;;;35705:9;35699:4;35695:20;35690:2;35679:9;35675:18;35668:48;35730:118;35843:4;35834:6;35730:118;;35865:201;35977:2;35962:18;;35991:65;35966:9;36029:6;35991:65;;36073:229;36199:2;36184:18;;36213:79;36188:9;36265:6;36213:79;;36309:301;36447:2;36461:47;;;36432:18;;36522:78;36432:18;36586:6;36522:78;;36617:407;36808:2;36822:47;;;36793:18;;36883:131;36793:18;36883:131;;37031:407;37222:2;37236:47;;;37207:18;;37297:131;37207:18;37297:131;;37445:407;37636:2;37650:47;;;37621:18;;37711:131;37621:18;37711:131;;37859:407;38050:2;38064:47;;;38035:18;;38125:131;38035:18;38125:131;;38273:407;38464:2;38478:47;;;38449:18;;38539:131;38449:18;38539:131;;38687:407;38878:2;38892:47;;;38863:18;;38953:131;38863:18;38953:131;;39101:407;39292:2;39306:47;;;39277:18;;39367:131;39277:18;39367:131;;39515:407;39706:2;39720:47;;;39691:18;;39781:131;39691:18;39781:131;;39929:407;40120:2;40134:47;;;40105:18;;40195:131;40105:18;40195:131;;40343:407;40534:2;40548:47;;;40519:18;;40609:131;40519:18;40609:131;;40757:407;40948:2;40962:47;;;40933:18;;41023:131;40933:18;41023:131;;41171:407;41362:2;41376:47;;;41347:18;;41437:131;41347:18;41437:131;;41585:407;41776:2;41790:47;;;41761:18;;41851:131;41761:18;41851:131;;41999:407;42190:2;42204:47;;;42175:18;;42265:131;42175:18;42265:131;;42413:407;42604:2;42618:47;;;42589:18;;42679:131;42589:18;42679:131;;42827:407;43018:2;43032:47;;;43003:18;;43093:131;43003:18;43093:131;;43241:407;43432:2;43446:47;;;43417:18;;43507:131;43417:18;43507:131;;43655:407;43846:2;43860:47;;;43831:18;;43921:131;43831:18;43921:131;;44069:407;44260:2;44274:47;;;44245:18;;44335:131;44245:18;44335:131;;44483:407;44674:2;44688:47;;;44659:18;;44749:131;44659:18;44749:131;;44897:407;45088:2;45102:47;;;45073:18;;45163:131;45073:18;45163:131;;45311:407;45502:2;45516:47;;;45487:18;;45577:131;45487:18;45577:131;;45725:407;45916:2;45930:47;;;45901:18;;45991:131;45901:18;45991:131;;46139:407;46330:2;46344:47;;;46315:18;;46405:131;46315:18;46405:131;;46553:407;46744:2;46758:47;;;46729:18;;46819:131;46729:18;46819:131;;46967:407;47158:2;47172:47;;;47143:18;;47233:131;47143:18;47233:131;;47381:407;47572:2;47586:47;;;47557:18;;47647:131;47557:18;47647:131;;47795:407;47986:2;48000:47;;;47971:18;;48061:131;47971:18;48061:131;;48209:407;48400:2;48414:47;;;48385:18;;48475:131;48385:18;48475:131;;48623:407;48814:2;48828:47;;;48799:18;;48889:131;48799:18;48889:131;;49037:407;49228:2;49242:47;;;49213:18;;49303:131;49213:18;49303:131;;49451:213;49569:2;49554:18;;49583:71;49558:9;49627:6;49583:71;;49907:723;50177:2;50162:18;;50191:71;50166:9;50235:6;50191:71;;;50310:9;50304:4;50300:20;50295:2;50284:9;50280:18;50273:48;50335:104;50434:4;50425:6;50335:104;;;50327:112;;50487:9;50481:4;50477:20;50472:2;50461:9;50457:18;50450:48;50512:108;50615:4;50606:6;50512:108;;50637:344;50789:2;50774:18;;50803:79;50778:9;50855:6;50803:79;;;50893:78;50967:2;50956:9;50952:18;50943:6;50893:78;;50988:256;51050:2;51044:9;51076:17;;;51151:18;51136:34;;51172:22;;;51133:62;51130:2;;;51208:1;51205;51198:12;51130:2;51224;51217:22;51028:216;;-1:-1;51028:216;51251:309;;51415:18;51407:6;51404:30;51401:2;;;51447:1;51444;51437:12;51401:2;-1:-1;51482:4;51470:17;;;51535:15;;51338:222;51897:317;;52036:18;52028:6;52025:30;52022:2;;;52068:1;52065;52058:12;52022:2;-1:-1;52199:4;52135;52112:17;;;;-1:-1;;52108:33;52189:15;;51959:255;52221:156;52350:4;52341:14;;52298:79;52875:142;52983:12;;52954:63;54337:183;54460:19;;;54509:4;54500:14;;54453:67;55592:91;;55654:24;55672:5;55654:24;;55796:85;55862:13;55855:21;;55838:43;55888:84;55960:6;55949:18;;55932:40;55979:121;-1:-1;;;;;56041:54;;56024:76;56107:72;56169:5;56152:27;56186:81;56257:4;56246:16;;56229:38;56274:129;;56361:37;56392:5;56361:37;;56410:116;;56497:24;56515:5;56497:24;;56533:121;;56612:37;56643:5;56612:37;;56777:145;56858:6;56853:3;56848;56835:30;-1:-1;56914:1;56896:16;;56889:27;56828:94;56931:268;56996:1;57003:101;57017:6;57014:1;57011:13;57003:101;;;57084:11;;;57078:18;57065:11;;;57058:39;57039:2;57032:10;57003:101;;;57119:6;57116:1;57113:13;57110:2;;;-1:-1;;57184:1;57166:16;;57159:27;56980:219;57207:97;57295:2;57275:14;-1:-1;;57271:28;;57255:49;57312:117;57381:24;57399:5;57381:24;;;57374:5;57371:35;57361:2;;57420:1;57417;57410:12;57576:111;57642:21;57657:5;57642:21;;57694:115;57762:23;57779:5;57762:23;;57816:117;57885:24;57903:5;57885:24;;57940:113;58007:22;58023:5;58007:22;
Swarm Source
bzzr://18c111957dfae0d5b1bbea23cdfb7090bbefb11004f4a52e317da7fe113cba9a
Loading...
Loading
Loading...
Loading
OVERVIEW
RariFundController holds funds supplied to the Rari Ethereum Pool.Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.