Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
TradeFactory
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@yearn/contract-utils/contracts/utils/CollectableDust.sol'; import './TradeFactoryPositionsHandler.sol'; import './TradeFactoryExecutor.sol'; interface ITradeFactory is ITradeFactoryExecutor, ITradeFactoryPositionsHandler {} contract TradeFactory is TradeFactoryExecutor, CollectableDust, ITradeFactory { constructor( address _masterAdmin, address _swapperAdder, address _swapperSetter, address _strategyModifier, address _mechanicsRegistry ) TradeFactoryAccessManager(_masterAdmin) TradeFactoryPositionsHandler(_strategyModifier) TradeFactorySwapperHandler(_swapperAdder, _swapperSetter) TradeFactoryExecutor(_mechanicsRegistry) {} // Collectable Dust function sendDust( address _to, address _token, uint256 _amount ) external virtual override onlyRole(MASTER_ADMIN) { _sendDust(_to, _token, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '../interfaces/utils/ICollectableDust.sol'; abstract contract CollectableDust is ICollectableDust { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; EnumerableSet.AddressSet internal protocolTokens; constructor() {} function _addProtocolToken(address _token) internal { require(!protocolTokens.contains(_token), 'collectable-dust/token-is-part-of-the-protocol'); protocolTokens.add(_token); } function _removeProtocolToken(address _token) internal { require(protocolTokens.contains(_token), 'collectable-dust/token-not-part-of-the-protocol'); protocolTokens.remove(_token); } function _sendDust( address _to, address _token, uint256 _amount ) internal { require(_to != address(0), 'collectable-dust/cant-send-dust-to-zero-address'); require(!protocolTokens.contains(_token), 'collectable-dust/token-is-part-of-the-protocol'); if (_token == ETH_ADDRESS) { payable(_to).transfer(_amount); } else { IERC20(_token).safeTransfer(_to, _amount); } emit DustSent(_to, _token, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import './TradeFactorySwapperHandler.sol'; import {ISwapperEnabled} from '../utils/ISwapperEnabled.sol'; interface ITradeFactoryPositionsHandler { struct EnabledTrade { address _strategy; address _tokenIn; address _tokenOut; } error InvalidTrade(); error AllowanceShouldBeZero(); function enabledTrades() external view returns (EnabledTrade[] memory _enabledTrades); function enable(address _tokenIn, address _tokenOut) external; function disable(address _tokenIn, address _tokenOut) external; function disableByAdmin( address _strategy, address _tokenIn, address _tokenOut ) external; } abstract contract TradeFactoryPositionsHandler is ITradeFactoryPositionsHandler, TradeFactorySwapperHandler { using EnumerableSet for EnumerableSet.AddressSet; bytes32 public constant STRATEGY = keccak256('STRATEGY'); bytes32 public constant STRATEGY_MANAGER = keccak256('STRATEGY_MANAGER'); EnumerableSet.AddressSet internal _strategies; // strategy -> tokenIn[] mapping(address => EnumerableSet.AddressSet) internal _tokensInByStrategy; // strategy -> tokenIn -> tokenOut[] mapping(address => mapping(address => EnumerableSet.AddressSet)) internal _tokensOutByStrategyAndTokenIn; constructor(address _strategyModifier) { if (_strategyModifier == address(0)) revert CommonErrors.ZeroAddress(); _setRoleAdmin(STRATEGY, STRATEGY_MANAGER); _setRoleAdmin(STRATEGY_MANAGER, MASTER_ADMIN); _setupRole(STRATEGY_MANAGER, _strategyModifier); } function enabledTrades() external view override returns (EnabledTrade[] memory _enabledTrades) { uint256 _totalEnabledTrades; for (uint256 i; i < _strategies.values().length; i++) { address _strategy = _strategies.at(i); address[] memory _tokensIn = _tokensInByStrategy[_strategy].values(); for (uint256 j; j < _tokensIn.length; j++) { address _tokenIn = _tokensIn[j]; _totalEnabledTrades += _tokensOutByStrategyAndTokenIn[_strategy][_tokenIn].length(); } } _enabledTrades = new EnabledTrade[](_totalEnabledTrades); uint256 _enabledTradesIndex; for (uint256 i; i < _strategies.values().length; i++) { address _strategy = _strategies.at(i); address[] memory _tokensIn = _tokensInByStrategy[_strategy].values(); for (uint256 j; j < _tokensIn.length; j++) { address _tokenIn = _tokensIn[j]; address[] memory _tokensOut = _tokensOutByStrategyAndTokenIn[_strategy][_tokenIn].values(); for (uint256 k; k < _tokensOut.length; k++) { _enabledTrades[_enabledTradesIndex] = EnabledTrade(_strategy, _tokenIn, _tokensOut[k]); _enabledTradesIndex++; } } } } function enable(address _tokenIn, address _tokenOut) external override onlyRole(STRATEGY) { if (_tokenIn == address(0) || _tokenOut == address(0)) revert CommonErrors.ZeroAddress(); _strategies.add(msg.sender); _tokensInByStrategy[msg.sender].add(_tokenIn); if (!_tokensOutByStrategyAndTokenIn[msg.sender][_tokenIn].add(_tokenOut)) revert InvalidTrade(); } function disable(address _tokenIn, address _tokenOut) external override onlyRole(STRATEGY) { _disable(msg.sender, _tokenIn, _tokenOut); } function disableByAdmin( address _strategy, address _tokenIn, address _tokenOut ) external override onlyRole(STRATEGY_MANAGER) { // strategy.disableTradeCallback() -> tradeFactory.disable() ISwapperEnabled(_strategy).disableTradeCallback(_tokenIn, _tokenOut); } function _disable( address _strategy, address _tokenIn, address _tokenOut ) internal { if (_tokenIn == address(0) || _tokenOut == address(0)) revert CommonErrors.ZeroAddress(); if (IERC20(_tokenIn).allowance(msg.sender, address(this)) != 0) revert AllowanceShouldBeZero(); if (!_tokensOutByStrategyAndTokenIn[_strategy][_tokenIn].remove(_tokenOut)) revert InvalidTrade(); if (_tokensOutByStrategyAndTokenIn[_strategy][_tokenIn].length() == 0) { _tokensInByStrategy[_strategy].remove(_tokenIn); if (_tokensInByStrategy[_strategy].length() == 0) { _strategies.remove(_strategy); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/utils/math/Math.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol'; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '@yearn/contract-utils/contracts/utils/Machinery.sol'; import '../swappers/async/AsyncSwapper.sol'; import '../swappers/async/MultipleAsyncSwapper.sol'; import '../swappers/sync/SyncSwapper.sol'; import './TradeFactoryPositionsHandler.sol'; interface ITradeFactoryExecutor { event SyncTradeExecuted(address indexed _strategy, uint256 _receivedAmount, address indexed _swapper); event AsyncTradeExecuted(uint256 _receivedAmount, address _swapper); event MultipleAsyncTradeExecuted(uint256[] _receivedAmount, address _swapper); error InvalidAmountOut(); struct SyncTradeExecutionDetails { address _tokenIn; address _tokenOut; uint256 _amountIn; uint256 _maxSlippage; } struct AsyncTradeExecutionDetails { address _strategy; address _tokenIn; address _tokenOut; uint256 _amount; uint256 _minAmountOut; } // Sync execution function execute(SyncTradeExecutionDetails calldata _tradeExecutionDetails, bytes calldata _data) external returns (uint256 _receivedAmount); // Async execution function execute( AsyncTradeExecutionDetails calldata _tradeExecutionDetails, address _swapper, bytes calldata _data ) external returns (uint256 _receivedAmount); // Multiple async execution function execute( AsyncTradeExecutionDetails[] calldata _tradesExecutionDetails, address _swapper, bytes calldata _data ) external; } abstract contract TradeFactoryExecutor is ITradeFactoryExecutor, TradeFactoryPositionsHandler, Machinery { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.AddressSet; constructor(address _mechanicsRegistry) Machinery(_mechanicsRegistry) {} // Machinery function setMechanicsRegistry(address __mechanicsRegistry) external virtual override onlyRole(MASTER_ADMIN) { _setMechanicsRegistry(__mechanicsRegistry); } // Execute via sync swapper function execute(SyncTradeExecutionDetails calldata _tradeExecutionDetails, bytes calldata _data) external override onlyRole(STRATEGY) returns (uint256 _receivedAmount) { address _swapper = strategySyncSwapper[msg.sender]; if (_tradeExecutionDetails._tokenIn == address(0) || _tradeExecutionDetails._tokenOut == address(0)) revert CommonErrors.ZeroAddress(); if (_tradeExecutionDetails._amountIn == 0) revert CommonErrors.ZeroAmount(); if (_tradeExecutionDetails._maxSlippage == 0) revert CommonErrors.ZeroSlippage(); IERC20(_tradeExecutionDetails._tokenIn).safeTransferFrom(msg.sender, _swapper, _tradeExecutionDetails._amountIn); uint256 _preSwapBalanceOut = IERC20(_tradeExecutionDetails._tokenOut).balanceOf(msg.sender); ISyncSwapper(_swapper).swap( msg.sender, _tradeExecutionDetails._tokenIn, _tradeExecutionDetails._tokenOut, _tradeExecutionDetails._amountIn, _tradeExecutionDetails._maxSlippage, _data ); _receivedAmount = IERC20(_tradeExecutionDetails._tokenOut).balanceOf(msg.sender) - _preSwapBalanceOut; emit SyncTradeExecuted(msg.sender, _receivedAmount, _swapper); } // Execute via async swapper function execute( AsyncTradeExecutionDetails calldata _tradeExecutionDetails, address _swapper, bytes calldata _data ) external override onlyMechanic returns (uint256 _receivedAmount) { if ( !_tokensOutByStrategyAndTokenIn[_tradeExecutionDetails._strategy][_tradeExecutionDetails._tokenIn].contains( _tradeExecutionDetails._tokenOut ) ) revert InvalidTrade(); if (!_swappers.contains(_swapper)) revert InvalidSwapper(); uint256 _amount = _tradeExecutionDetails._amount != 0 ? _tradeExecutionDetails._amount : IERC20(_tradeExecutionDetails._tokenIn).balanceOf(_tradeExecutionDetails._strategy); IERC20(_tradeExecutionDetails._tokenIn).safeTransferFrom(_tradeExecutionDetails._strategy, _swapper, _amount); uint256 _preSwapBalanceOut = IERC20(_tradeExecutionDetails._tokenOut).balanceOf(_tradeExecutionDetails._strategy); IAsyncSwapper(_swapper).swap( _tradeExecutionDetails._strategy, _tradeExecutionDetails._tokenIn, _tradeExecutionDetails._tokenOut, _amount, _tradeExecutionDetails._minAmountOut, _data ); _receivedAmount = IERC20(_tradeExecutionDetails._tokenOut).balanceOf(_tradeExecutionDetails._strategy) - _preSwapBalanceOut; if (_receivedAmount < _tradeExecutionDetails._minAmountOut) revert InvalidAmountOut(); emit AsyncTradeExecuted(_receivedAmount, _swapper); } function execute( AsyncTradeExecutionDetails[] calldata _tradesExecutionDetails, address _swapper, bytes calldata _data ) external override onlyMechanic { // Balance out holder will firstly have the pre swap balance out of each strategy uint256[] memory _balanceOutHolder = new uint256[](_tradesExecutionDetails.length); if (!_swappers.contains(_swapper)) revert InvalidSwapper(); for (uint256 i; i < _tradesExecutionDetails.length; i++) { if ( !_tokensOutByStrategyAndTokenIn[_tradesExecutionDetails[i]._strategy][_tradesExecutionDetails[i]._tokenIn].contains( _tradesExecutionDetails[i]._tokenOut ) ) revert InvalidTrade(); uint256 _amount = _tradesExecutionDetails[i]._amount != 0 ? _tradesExecutionDetails[i]._amount : IERC20(_tradesExecutionDetails[i]._tokenIn).balanceOf(_tradesExecutionDetails[i]._strategy); IERC20(_tradesExecutionDetails[i]._tokenIn).safeTransferFrom(_tradesExecutionDetails[i]._strategy, _swapper, _amount); _balanceOutHolder[i] = IERC20(_tradesExecutionDetails[i]._tokenOut).balanceOf(_tradesExecutionDetails[i]._strategy); } IMultipleAsyncSwapper(_swapper).swapMultiple(_data); for (uint256 i; i < _tradesExecutionDetails.length; i++) { // Balance out holder will now store the total received amount of token out per strat _balanceOutHolder[i] = IERC20(_tradesExecutionDetails[i]._tokenOut).balanceOf(_tradesExecutionDetails[i]._strategy) - _balanceOutHolder[i]; if (_balanceOutHolder[i] < _tradesExecutionDetails[i]._minAmountOut) revert InvalidAmountOut(); } emit MultipleAsyncTradeExecuted(_balanceOutHolder, _swapper); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; interface ICollectableDust { event DustSent(address _to, address token, uint256 amount); function sendDust( address _to, address _token, uint256 _amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '../swappers/Swapper.sol'; import './TradeFactoryAccessManager.sol'; interface ITradeFactorySwapperHandler { error NotAsyncSwapper(); error NotSyncSwapper(); error InvalidSwapper(); error SwapperInUse(); function strategySyncSwapper(address _strategy) external view returns (address _swapper); function swappers() external view returns (address[] memory _swappersList); function isSwapper(address _swapper) external view returns (bool _isSwapper); function swapperStrategies(address _swapper) external view returns (address[] memory _strategies); function setStrategySyncSwapper(address _strategy, address _swapper) external; function addSwappers(address[] memory __swappers) external; function removeSwappers(address[] memory __swappers) external; } abstract contract TradeFactorySwapperHandler is ITradeFactorySwapperHandler, TradeFactoryAccessManager { using EnumerableSet for EnumerableSet.AddressSet; bytes32 public constant SWAPPER_ADDER = keccak256('SWAPPER_ADDER'); bytes32 public constant SWAPPER_SETTER = keccak256('SWAPPER_SETTER'); // swappers list EnumerableSet.AddressSet internal _swappers; // swapper -> strategy list (useful to know if we can safely deprecate a swapper) mapping(address => EnumerableSet.AddressSet) internal _swapperStrategies; // strategy -> sync swapper mapping(address => address) public override strategySyncSwapper; constructor(address _swapperAdder, address _swapperSetter) { if (_swapperAdder == address(0) || _swapperSetter == address(0)) revert CommonErrors.ZeroAddress(); _setRoleAdmin(SWAPPER_ADDER, MASTER_ADMIN); _setRoleAdmin(SWAPPER_SETTER, MASTER_ADMIN); _setupRole(SWAPPER_ADDER, _swapperAdder); _setupRole(SWAPPER_SETTER, _swapperSetter); } function isSwapper(address _swapper) external view override returns (bool _isSwapper) { _isSwapper = _swappers.contains(_swapper); } function swappers() external view override returns (address[] memory _swappersList) { _swappersList = _swappers.values(); } function swapperStrategies(address _swapper) external view override returns (address[] memory _strategies) { _strategies = _swapperStrategies[_swapper].values(); } function setStrategySyncSwapper(address _strategy, address _swapper) external override onlyRole(SWAPPER_SETTER) { if (_strategy == address(0) || _swapper == address(0)) revert CommonErrors.ZeroAddress(); // we check that swapper being added is async if (ISwapper(_swapper).SWAPPER_TYPE() != ISwapper.SwapperType.SYNC) revert NotSyncSwapper(); // we check that swapper is not already added if (!_swappers.contains(_swapper)) revert InvalidSwapper(); // remove strategy from previous swapper if any if (strategySyncSwapper[_strategy] != address(0)) _swapperStrategies[strategySyncSwapper[_strategy]].remove(_strategy); // set new strategy's sync swapper strategySyncSwapper[_strategy] = _swapper; // add strategy into new swapper _swapperStrategies[_swapper].add(_strategy); } function addSwappers(address[] memory __swappers) external override onlyRole(SWAPPER_ADDER) { for (uint256 i; i < __swappers.length; i++) { if (__swappers[i] == address(0)) revert CommonErrors.ZeroAddress(); _swappers.add(__swappers[i]); } } function removeSwappers(address[] memory __swappers) external override onlyRole(SWAPPER_ADDER) { for (uint256 i; i < __swappers.length; i++) { if (_swapperStrategies[__swappers[i]].length() > 0) revert SwapperInUse(); _swappers.remove(__swappers[i]); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; interface ISwapperEnabled { error NotTradeFactory(); function tradeFactory() external returns (address _tradeFactory); function swapper() external returns (string memory _swapper); function setSwapper(string calldata _swapper, bool _migrateSwaps) external; function setTradeFactory(address _tradeFactory) external; function enableTrade(address _tokenIn, address _tokenOut) external; function disableTrade(address _tokenIn, address _tokenOut) external; function disableTradeCallback(address _tokenIn, address _tokenOut) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@yearn/contract-utils/contracts/utils/Governable.sol'; import '@yearn/contract-utils/contracts/utils/CollectableDust.sol'; import '../libraries/CommonErrors.sol'; interface ISwapper { event TradeFactorySet(address _tradeFactory); enum SwapperType { ASYNC, SYNC } // solhint-disable-next-line func-name-mixedcase function SWAPPER_TYPE() external view returns (SwapperType); function tradeFactory() external view returns (address); function setTradeFactory(address _tradeFactory) external; } abstract contract Swapper is ISwapper, Governable, CollectableDust { using SafeERC20 for IERC20; // solhint-disable-next-line var-name-mixedcase address public override tradeFactory; constructor(address _tradeFactory) { if (_tradeFactory == address(0)) revert CommonErrors.ZeroAddress(); tradeFactory = _tradeFactory; } function setTradeFactory(address _tradeFactory) external override onlyGovernor { if (_tradeFactory == address(0)) revert CommonErrors.ZeroAddress(); tradeFactory = _tradeFactory; emit TradeFactorySet(_tradeFactory); } modifier onlyTradeFactory() { if (msg.sender != tradeFactory) revert CommonErrors.NotAuthorized(); _; } function sendDust( address _to, address _token, uint256 _amount ) external virtual override onlyGovernor { _sendDust(_to, _token, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/access/AccessControl.sol'; import '../libraries/CommonErrors.sol'; abstract contract TradeFactoryAccessManager is AccessControl { bytes32 public constant MASTER_ADMIN = keccak256('MASTER_ADMIN'); constructor(address _masterAdmin) { if (_masterAdmin == address(0)) revert CommonErrors.ZeroAddress(); _setRoleAdmin(MASTER_ADMIN, MASTER_ADMIN); _setupRole(MASTER_ADMIN, _masterAdmin); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '../interfaces/utils/IGovernable.sol'; contract Governable is IGovernable { address public override governor; address public override pendingGovernor; constructor(address _governor) { require(_governor != address(0), 'governable/governor-should-not-be-zero-address'); governor = _governor; } function setPendingGovernor(address _pendingGovernor) external virtual override onlyGovernor { _setPendingGovernor(_pendingGovernor); } function acceptGovernor() external virtual override onlyPendingGovernor { _acceptGovernor(); } function _setPendingGovernor(address _pendingGovernor) internal { require(_pendingGovernor != address(0), 'governable/pending-governor-should-not-be-zero-addres'); pendingGovernor = _pendingGovernor; emit PendingGovernorSet(_pendingGovernor); } function _acceptGovernor() internal { governor = pendingGovernor; pendingGovernor = address(0); emit GovernorAccepted(); } function isGovernor(address _account) public view override returns (bool _isGovernor) { return _account == governor; } modifier onlyGovernor() { require(isGovernor(msg.sender), 'governable/only-governor'); _; } modifier onlyPendingGovernor() { require(msg.sender == pendingGovernor, 'governable/only-pending-governor'); _; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; library CommonErrors { error ZeroAddress(); error NotAuthorized(); error ZeroAmount(); error ZeroSlippage(); error IncorrectSwapInformation(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; interface IGovernable { event PendingGovernorSet(address pendingGovernor); event GovernorAccepted(); function setPendingGovernor(address _pendingGovernor) external; function acceptGovernor() external; function governor() external view returns (address _governor); function pendingGovernor() external view returns (address _pendingGovernor); function isGovernor(address _account) external view returns (bool _isGovernor); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '../interfaces/utils/IMachinery.sol'; import '../interfaces/mechanics/IMechanicsRegistry.sol'; contract Machinery is IMachinery { using EnumerableSet for EnumerableSet.AddressSet; IMechanicsRegistry internal _mechanicsRegistry; constructor(address __mechanicsRegistry) { _setMechanicsRegistry(__mechanicsRegistry); } modifier onlyMechanic() { require(_mechanicsRegistry.isMechanic(msg.sender), 'Machinery: not mechanic'); _; } function setMechanicsRegistry(address __mechanicsRegistry) external virtual override { _setMechanicsRegistry(__mechanicsRegistry); } function _setMechanicsRegistry(address __mechanicsRegistry) internal { _mechanicsRegistry = IMechanicsRegistry(__mechanicsRegistry); } // View helpers function mechanicsRegistry() external view override returns (address _mechanicRegistry) { return address(_mechanicsRegistry); } function isMechanic(address _mechanic) public view override returns (bool _isMechanic) { return _mechanicsRegistry.isMechanic(_mechanic); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '../Swapper.sol'; interface IAsyncSwapper is ISwapper { function swap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _minAmountOut, bytes calldata _data ) external; } abstract contract AsyncSwapper is IAsyncSwapper, Swapper { // solhint-disable-next-line var-name-mixedcase SwapperType public constant override SWAPPER_TYPE = SwapperType.ASYNC; constructor(address _governor, address _tradeFactory) Governable(_governor) Swapper(_tradeFactory) {} function _assertPreSwap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _minAmountOut ) internal pure { if (_receiver == address(0) || _tokenIn == address(0) || _tokenOut == address(0)) revert CommonErrors.ZeroAddress(); if (_amountIn == 0) revert CommonErrors.ZeroAmount(); if (_minAmountOut == 0) revert CommonErrors.ZeroAmount(); } function _executeSwap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, bytes calldata _data ) internal virtual; function swap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _minAmountOut, bytes calldata _data ) external virtual override onlyTradeFactory { _assertPreSwap(_receiver, _tokenIn, _tokenOut, _amountIn, _minAmountOut); _executeSwap(_receiver, _tokenIn, _tokenOut, _amountIn, _data); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import './AsyncSwapper.sol'; interface IMultipleAsyncSwapper is IAsyncSwapper { function swapMultiple(bytes calldata _data) external; } abstract contract MultipleAsyncSwapper is IMultipleAsyncSwapper, AsyncSwapper { constructor(address _governor, address _tradeFactory) AsyncSwapper(_governor, _tradeFactory) {} }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import '../Swapper.sol'; interface ISyncSwapper is ISwapper { // solhint-disable-next-line func-name-mixedcase function SLIPPAGE_PRECISION() external view returns (uint256); function swap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _maxSlippage, bytes calldata _data ) external; } abstract contract SyncSwapper is ISyncSwapper, Swapper { // solhint-disable-next-line var-name-mixedcase uint256 public immutable override SLIPPAGE_PRECISION = 10000; // 1 is 0.0001%, 1_000 is 0.1% // solhint-disable-next-line var-name-mixedcase SwapperType public constant override SWAPPER_TYPE = SwapperType.SYNC; constructor(address _governor, address _tradeFactory) Governable(_governor) Swapper(_tradeFactory) {} function _assertPreSwap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 ) internal pure { if (_receiver == address(0) || _tokenIn == address(0) || _tokenOut == address(0)) revert CommonErrors.ZeroAddress(); if (_amountIn == 0) revert CommonErrors.ZeroAmount(); } function _executeSwap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _maxSlippage, bytes calldata _data ) internal virtual; function swap( address _receiver, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _maxSlippage, bytes calldata _data ) external virtual override onlyTradeFactory { _assertPreSwap(_receiver, _tokenIn, _tokenOut, _amountIn, _maxSlippage); _executeSwap(_receiver, _tokenIn, _tokenOut, _amountIn, _maxSlippage, _data); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; interface IMachinery { // View helpers function mechanicsRegistry() external view returns (address _mechanicsRegistry); function isMechanic(address mechanic) external view returns (bool _isMechanic); // Setters function setMechanicsRegistry(address _mechanicsRegistry) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; interface IMechanicsRegistry { event MechanicAdded(address _mechanic); event MechanicRemoved(address _mechanic); function addMechanic(address _mechanic) external; function removeMechanic(address _mechanic) external; function mechanics() external view returns (address[] memory _mechanicsList); function isMechanic(address mechanic) external view returns (bool _isMechanic); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_masterAdmin","type":"address"},{"internalType":"address","name":"_swapperAdder","type":"address"},{"internalType":"address","name":"_swapperSetter","type":"address"},{"internalType":"address","name":"_strategyModifier","type":"address"},{"internalType":"address","name":"_mechanicsRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllowanceShouldBeZero","type":"error"},{"inputs":[],"name":"InvalidAmountOut","type":"error"},{"inputs":[],"name":"InvalidSwapper","type":"error"},{"inputs":[],"name":"InvalidTrade","type":"error"},{"inputs":[],"name":"NotAsyncSwapper","type":"error"},{"inputs":[],"name":"NotSyncSwapper","type":"error"},{"inputs":[],"name":"SwapperInUse","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroSlippage","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_receivedAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_swapper","type":"address"}],"name":"AsyncTradeExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DustSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_receivedAmount","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"_swapper","type":"address"}],"name":"MultipleAsyncTradeExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"_receivedAmount","type":"uint256"},{"indexed":true,"internalType":"address","name":"_swapper","type":"address"}],"name":"SyncTradeExecuted","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MASTER_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRATEGY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRATEGY_MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWAPPER_ADDER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWAPPER_SETTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"__swappers","type":"address[]"}],"name":"addSwappers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"name":"disable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"name":"disableByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"name":"enable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enabledTrades","outputs":[{"components":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"internalType":"struct ITradeFactoryPositionsHandler.EnabledTrade[]","name":"_enabledTrades","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"internalType":"struct ITradeFactoryExecutor.AsyncTradeExecutionDetails","name":"_tradeExecutionDetails","type":"tuple"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"uint256","name":"_receivedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_maxSlippage","type":"uint256"}],"internalType":"struct ITradeFactoryExecutor.SyncTradeExecutionDetails","name":"_tradeExecutionDetails","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"uint256","name":"_receivedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"internalType":"struct ITradeFactoryExecutor.AsyncTradeExecutionDetails[]","name":"_tradesExecutionDetails","type":"tuple[]"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_mechanic","type":"address"}],"name":"isMechanic","outputs":[{"internalType":"bool","name":"_isMechanic","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapper","type":"address"}],"name":"isSwapper","outputs":[{"internalType":"bool","name":"_isSwapper","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mechanicsRegistry","outputs":[{"internalType":"address","name":"_mechanicRegistry","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"__swappers","type":"address[]"}],"name":"removeSwappers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sendDust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__mechanicsRegistry","type":"address"}],"name":"setMechanicsRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_swapper","type":"address"}],"name":"setStrategySyncSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategySyncSwapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapper","type":"address"}],"name":"swapperStrategies","outputs":[{"internalType":"address[]","name":"_strategies","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swappers","outputs":[{"internalType":"address[]","name":"_swappersList","type":"address[]"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620034fc380380620034fc83398101604081905262000034916200036d565b8080838686896001600160a01b038116620000625760405163d92e233d60e01b815260040160405180910390fd5b6200007d600080516020620034dc8339815191528062000255565b62000098600080516020620034dc83398151915282620002a0565b506001600160a01b0382161580620000b757506001600160a01b038116155b15620000d65760405163d92e233d60e01b815260040160405180910390fd5b620001006000805160206200349c833981519152600080516020620034dc83398151915262000255565b6200013b7fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b911600080516020620034dc83398151915262000255565b620001566000805160206200349c83398151915283620002a0565b620001827fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b91182620002a0565b50506001600160a01b038116620001ac5760405163d92e233d60e01b815260040160405180910390fd5b620001e77f49e347583a7b9e7f325e8963ee1f94127eba81e401796874b5a22f7c8f9d45f7600080516020620034bc83398151915262000255565b62000211600080516020620034bc833981519152600080516020620034dc83398151915262000255565b6200022c600080516020620034bc83398151915282620002a0565b50600980546001600160a01b0319166001600160a01b03831617905550505050505050620003dd565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b620002ac8282620002b0565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620002ac576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200030c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b03811681146200036857600080fd5b919050565b600080600080600060a086880312156200038657600080fd5b620003918662000350565b9450620003a16020870162000350565b9350620003b16040870162000350565b9250620003c16060870162000350565b9150620003d16080870162000350565b90509295509295909350565b6130af80620003ed6000396000f3fe608060405234801561001057600080fd5b50600436106101e45760003560e01c806365834acc1161010f578063b64230ba116100a2578063d547741f11610071578063d547741f14610486578063e454a5ed14610499578063ef47da6d146104c0578063f7bd381f146104d357600080fd5b8063b64230ba1461042f578063bbeee59114610442578063cbf8e6c414610455578063ccf61a411461045d57600080fd5b80639cd38be5116100de5780639cd38be5146103d25780639fc2c476146103e5578063a217fddf1461040c578063a734f06e1461041457600080fd5b806365834acc14610372578063687020d814610385578063907ab008146103ac57806391d14854146103bf57600080fd5b80632db8c129116101875780634c854126116101565780634c854126146103035780634d1dd98f14610316578063504254911461033d5780635163b4771461035d57600080fd5b80632db8c129146102b75780632f2ff15d146102ca57806336568abe146102dd5780634a2c1bab146102f057600080fd5b806311eff09c116101c357806311eff09c1461024b578063185025ef1461026c57806319b44cd914610281578063248a9ca31461029457600080fd5b8062b8ff92146101e957806301ffc9a7146101fe5780631078f38814610226575b600080fd5b6101fc6101f73660046128d2565b6104e6565b005b61021161020c366004612915565b61057a565b60405190151581526020015b60405180910390f35b6009546001600160a01b03165b6040516001600160a01b03909116815260200161021d565b61025e610259366004612988565b6105b1565b60405190815260200161021d565b61025e60008051602061305a83398151915281565b61025e61028f3660046129f1565b610a81565b61025e6102a2366004612a4c565b60009081526020819052604090206001015490565b6101fc6102c5366004612a65565b610d74565b6101fc6102d8366004612aa1565b610db0565b6101fc6102eb366004612aa1565b610ddb565b6101fc6102fe366004612ae3565b610e59565b6101fc610311366004612ba8565b610f1d565b61025e7fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b91181565b61035061034b366004612bd2565b610fe1565b60405161021d9190612bed565b610365611005565b60405161021d9190612c3a565b610211610380366004612bd2565b6112bf565b61025e7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd981565b6101fc6103ba366004612ae3565b61133d565b6102116103cd366004612aa1565b61141b565b6101fc6103e0366004612ba8565b611444565b61025e7f1893e1a169e79f2fe8aa327b1bceb2fede7a1b76a54824f95ea0e737720954ae81565b61025e600081565b61023373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61021161043d366004612bd2565b611468565b6101fc610450366004612ca2565b611475565b610350611b1f565b61023361046b366004612bd2565b6004602052600090815260409020546001600160a01b031681565b6101fc610494366004612aa1565b611b30565b61025e7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d381565b6101fc6104ce366004612bd2565b611b56565b6101fc6104e1366004612ba8565b611ba0565b7f1893e1a169e79f2fe8aa327b1bceb2fede7a1b76a54824f95ea0e737720954ae6105118133611d65565b60405163abb347a960e01b81526001600160a01b038481166004830152838116602483015285169063abb347a990604401600060405180830381600087803b15801561055c57600080fd5b505af1158015610570573d6000803e3d6000fd5b5050505050505050565b60006001600160e01b03198216637965db0b60e01b14806105ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600954604051631960d2b360e21b81523360048201526000916001600160a01b0316906365834acc9060240160206040518083038186803b1580156105f557600080fd5b505afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d9190612d54565b6106785760405162461bcd60e51b81526020600482015260176024820152764d616368696e6572793a206e6f74206d656368616e696360481b60448201526064015b60405180910390fd5b6106f061068b6060870160408801612bd2565b6008600061069c60208a018a612bd2565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008860200160208101906106d19190612bd2565b6001600160a01b03168152602081019190915260400160002090611dc9565b61070d5760405163d69b537960e01b815260040160405180910390fd5b610718600185611dc9565b610735576040516364a7bd4d60e11b815260040160405180910390fd5b600060608601356107e7576107506040870160208801612bd2565b6001600160a01b03166370a0823161076b6020890189612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156107aa57600080fd5b505afa1580156107be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e29190612d76565b6107ed565b85606001355b90506108226107ff6020880188612bd2565b868361081160408b0160208c01612bd2565b6001600160a01b0316929190611dee565b60006108346060880160408901612bd2565b6001600160a01b03166370a0823161084f60208a018a612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190612d76565b90506001600160a01b03861663a5d4096b6108e460208a018a612bd2565b6108f460408b0160208c01612bd2565b61090460608c0160408d01612bd2565b868c608001358b8b6040518863ffffffff1660e01b815260040161092e9796959493929190612db8565b600060405180830381600087803b15801561094857600080fd5b505af115801561095c573d6000803e3d6000fd5b508392506109739150506060890160408a01612bd2565b6001600160a01b03166370a0823161098e60208b018b612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156109cd57600080fd5b505afa1580156109e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a059190612d76565b610a0f9190612e1e565b92508660800135831015610a36576040516309d2d38b60e31b815260040160405180910390fd5b604080518481526001600160a01b03881660208201527feb6edbd932a6290d7ca794a21b27f2da7d46b0f9aa0cde6135ce1d0469ad144e910160405180910390a15050949350505050565b600060008051602061305a833981519152610a9c8133611d65565b3360009081526004602090815260408220546001600160a01b03169190610ac590880188612bd2565b6001600160a01b03161480610af257506000610ae76040880160208901612bd2565b6001600160a01b0316145b15610b105760405163d92e233d60e01b815260040160405180910390fd5b6040860135610b3257604051631f2a200560e01b815260040160405180910390fd5b6060860135610b5457604051635380c59d60e01b815260040160405180910390fd5b610b6b3382604089013561081160208b018b612bd2565b6000610b7d6040880160208901612bd2565b6040516370a0823160e01b81523360048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015610bbe57600080fd5b505afa158015610bd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf69190612d76565b90506001600160a01b03821663a5d4096b33610c1560208b018b612bd2565b610c2560408c0160208d01612bd2565b8b604001358c606001358c8c6040518863ffffffff1660e01b8152600401610c539796959493929190612db8565b600060405180830381600087803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b50839250610c989150506040890160208a01612bd2565b6040516370a0823160e01b81523360048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015610cd957600080fd5b505afa158015610ced573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d119190612d76565b610d1b9190612e1e565b9350816001600160a01b0316336001600160a01b03167f77afa6671ccb5a39d59afc769ee32cdfdc0e4d7b9bbc32a0092a27843a74e64486604051610d6291815260200190565b60405180910390a35050509392505050565b7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d3610d9f8133611d65565b610daa848484611e59565b50505050565b600082815260208190526040902060010154610dcc8133611d65565b610dd68383611ffb565b505050565b6001600160a01b0381163314610e4b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161066f565b610e55828261207f565b5050565b7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd9610e848133611d65565b60005b8251811015610dd65760006001600160a01b0316838281518110610ead57610ead612e35565b60200260200101516001600160a01b03161415610edd5760405163d92e233d60e01b815260040160405180910390fd5b610f0a838281518110610ef257610ef2612e35565b602002602001015160016120e490919063ffffffff16565b5080610f1581612e4b565b915050610e87565b60008051602061305a833981519152610f368133611d65565b6001600160a01b0383161580610f5357506001600160a01b038216155b15610f715760405163d92e233d60e01b815260040160405180910390fd5b610f7c6005336120e4565b50336000908152600760205260409020610f9690846120e4565b503360009081526008602090815260408083206001600160a01b03871684529091529020610fc490836120e4565b610dd65760405163d69b537960e01b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090206060906105ab906120f9565b60606000805b61101560056120f9565b518110156110e457600061102a600583612106565b6001600160a01b03811660009081526007602052604081209192509061104f906120f9565b905060005b81518110156110ce57600082828151811061107157611071612e35565b6020908102919091018101516001600160a01b0380871660009081526008845260408082209284168252919093529091209091506110ae90612112565b6110b89087612e66565b95505080806110c690612e4b565b915050611054565b50505080806110dc90612e4b565b91505061100b565b508067ffffffffffffffff8111156110fe576110fe612acd565b60405190808252806020026020018201604052801561114957816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161111c5790505b5091506000805b61115a60056120f9565b518110156112b957600061116f600583612106565b6001600160a01b038116600090815260076020526040812091925090611194906120f9565b905060005b81518110156112a35760008282815181106111b6576111b6612e35565b6020908102919091018101516001600160a01b03808716600090815260088452604080822092841682529190935282209092506111f2906120f9565b905060005b815181101561128d576040518060600160405280876001600160a01b03168152602001846001600160a01b0316815260200183838151811061123b5761123b612e35565b60200260200101516001600160a01b03168152508a898151811061126157611261612e35565b6020026020010181905250878061127790612e4b565b985050808061128590612e4b565b9150506111f7565b505050808061129b90612e4b565b915050611199565b50505080806112b190612e4b565b915050611150565b50505090565b600954604051631960d2b360e21b81526001600160a01b03838116600483015260009216906365834acc9060240160206040518083038186803b15801561130557600080fd5b505afa158015611319573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ab9190612d54565b7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd96113688133611d65565b60005b8251811015610dd65760006113bc6003600086858151811061138f5761138f612e35565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020612112565b11156113db576040516361c45a0f60e01b815260040160405180910390fd5b6114088382815181106113f0576113f0612e35565b6020026020010151600161211c90919063ffffffff16565b508061141381612e4b565b91505061136b565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061305a83398151915261145d8133611d65565b610dd6338484612131565b60006105ab600183611dc9565b600954604051631960d2b360e21b81523360048201526001600160a01b03909116906365834acc9060240160206040518083038186803b1580156114b857600080fd5b505afa1580156114cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f09190612d54565b6115365760405162461bcd60e51b81526020600482015260176024820152764d616368696e6572793a206e6f74206d656368616e696360481b604482015260640161066f565b60008467ffffffffffffffff81111561155157611551612acd565b60405190808252806020026020018201604052801561157a578160200160208202803683370190505b509050611588600185611dc9565b6115a5576040516364a7bd4d60e11b815260040160405180910390fd5b60005b858110156118f1576116558787838181106115c5576115c5612e35565b905060a0020160400160208101906115dd9190612bd2565b600860008a8a868181106115f3576115f3612e35565b61160992602060a0909202019081019150612bd2565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008a8a8681811061163d5761163d612e35565b905060a0020160200160208101906106d19190612bd2565b6116725760405163d69b537960e01b815260040160405180910390fd5b600087878381811061168657611686612e35565b905060a002016060013560001415611774578787838181106116aa576116aa612e35565b905060a0020160200160208101906116c29190612bd2565b6001600160a01b03166370a082318989858181106116e2576116e2612e35565b6116f892602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561173757600080fd5b505afa15801561174b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176f9190612d76565b611791565b87878381811061178657611786612e35565b905060a00201606001355b90506117ea8888848181106117a8576117a8612e35565b6117be92602060a0909202019081019150612bd2565b87838b8b878181106117d2576117d2612e35565b905060a0020160200160208101906108119190612bd2565b8787838181106117fc576117fc612e35565b905060a0020160400160208101906118149190612bd2565b6001600160a01b03166370a0823189898581811061183457611834612e35565b61184a92602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561188957600080fd5b505afa15801561189d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c19190612d76565b8383815181106118d3576118d3612e35565b602090810291909101015250806118e981612e4b565b9150506115a8565b506040516364c3d39f60e01b81526001600160a01b038516906364c3d39f906119209086908690600401612e7e565b600060405180830381600087803b15801561193a57600080fd5b505af115801561194e573d6000803e3d6000fd5b5050505060005b85811015611add5781818151811061196f5761196f612e35565b602002602001015187878381811061198957611989612e35565b905060a0020160400160208101906119a19190612bd2565b6001600160a01b03166370a082318989858181106119c1576119c1612e35565b6119d792602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015611a1657600080fd5b505afa158015611a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4e9190612d76565b611a589190612e1e565b828281518110611a6a57611a6a612e35565b602002602001018181525050868682818110611a8857611a88612e35565b905060a0020160800135828281518110611aa457611aa4612e35565b60200260200101511015611acb576040516309d2d38b60e31b815260040160405180910390fd5b80611ad581612e4b565b915050611955565b507f4a8b10eb58b24f8872a8364002b92c533c3a143d3588739819be8eb6b38679658185604051611b0f929190612e92565b60405180910390a1505050505050565b6060611b2b60016120f9565b905090565b600082815260208190526040902060010154611b4c8133611d65565b610dd6838361207f565b7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d3611b818133611d65565b600980546001600160a01b0319166001600160a01b0384161790555050565b7fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b911611bcb8133611d65565b6001600160a01b0383161580611be857506001600160a01b038216155b15611c065760405163d92e233d60e01b815260040160405180910390fd5b6001826001600160a01b031663cd985af06040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4157600080fd5b505afa158015611c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c799190612efc565b6001811115611c8a57611c8a612ee6565b14611ca857604051634b3d6f3360e11b815260040160405180910390fd5b611cb3600183611dc9565b611cd0576040516364a7bd4d60e11b815260040160405180910390fd5b6001600160a01b038381166000908152600460205260409020541615611d23576001600160a01b0380841660009081526004602090815260408083205490931682526003905220611d21908461211c565b505b6001600160a01b03838116600090815260046020908152604080832080546001600160a01b03191694871694851790559282526003905220610daa90846120e4565b611d6f828261141b565b610e5557611d87816001600160a01b031660146122d8565b611d928360206122d8565b604051602001611da3929190612f49565b60408051601f198184030181529082905262461bcd60e51b825261066f91600401612fbe565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610daa9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612474565b6001600160a01b038316611ec75760405162461bcd60e51b815260206004820152602f60248201527f636f6c6c65637461626c652d647573742f63616e742d73656e642d647573742d60448201526e746f2d7a65726f2d6164647265737360881b606482015260840161066f565b611ed2600a83611dc9565b15611f365760405162461bcd60e51b815260206004820152602e60248201527f636f6c6c65637461626c652d647573742f746f6b656e2d69732d706172742d6f60448201526d198b5d1a194b5c1c9bdd1bd8dbdb60921b606482015260840161066f565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611f97576040516001600160a01b0384169082156108fc029083906000818181858888f19350505050158015611f91573d6000803e3d6000fd5b50611fab565b611fab6001600160a01b0383168483612546565b604080516001600160a01b038086168252841660208201529081018290527f1e34c1aee8e83c2dcc14c21bb4bfeea7f46c0c998cb797ac7cc4d7a18f5c656b9060600160405180910390a1505050565b612005828261141b565b610e55576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561203b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612089828261141b565b15610e55576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611de7836001600160a01b038416612576565b60606000611de7836125c5565b6000611de78383612621565b60006105ab825490565b6000611de7836001600160a01b03841661264b565b6001600160a01b038216158061214e57506001600160a01b038116155b1561216c5760405163d92e233d60e01b815260040160405180910390fd5b604051636eb1769f60e11b81523360048201523060248201526001600160a01b0383169063dd62ed3e9060440160206040518083038186803b1580156121b157600080fd5b505afa1580156121c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e99190612d76565b1561220757604051633c553c4360e11b815260040160405180910390fd5b6001600160a01b038084166000908152600860209081526040808320938616835292905220612236908261211c565b6122535760405163d69b537960e01b815260040160405180910390fd5b6001600160a01b03808416600090815260086020908152604080832093861683529290522061228190612112565b610dd6576001600160a01b03831660009081526007602052604090206122a7908361211c565b506001600160a01b03831660009081526007602052604090206122c990612112565b610dd657610daa60058461211c565b606060006122e7836002612ff1565b6122f2906002612e66565b67ffffffffffffffff81111561230a5761230a612acd565b6040519080825280601f01601f191660200182016040528015612334576020820181803683370190505b509050600360fc1b8160008151811061234f5761234f612e35565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061237e5761237e612e35565b60200101906001600160f81b031916908160001a90535060006123a2846002612ff1565b6123ad906001612e66565b90505b6001811115612425576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106123e1576123e1612e35565b1a60f81b8282815181106123f7576123f7612e35565b60200101906001600160f81b031916908160001a90535060049490941c9361241e81613010565b90506123b0565b508315611de75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161066f565b60006124c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661273e9092919063ffffffff16565b805190915015610dd657808060200190518101906124e79190612d54565b610dd65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161066f565b6040516001600160a01b038316602482015260448101829052610dd690849063a9059cbb60e01b90606401611e22565b60008181526001830160205260408120546125bd575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105ab565b5060006105ab565b60608160000180548060200260200160405190810160405280929190818152602001828054801561261557602002820191906000526020600020905b815481526020019060010190808311612601575b50505050509050919050565b600082600001828154811061263857612638612e35565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561273457600061266f600183612e1e565b855490915060009061268390600190612e1e565b90508181146126e85760008660000182815481106126a3576126a3612e35565b90600052602060002001549050808760000184815481106126c6576126c6612e35565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126f9576126f9613027565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105ab565b60009150506105ab565b606061274d8484600085612755565b949350505050565b6060824710156127b65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161066f565b843b6128045760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161066f565b600080866001600160a01b03168587604051612820919061303d565b60006040518083038185875af1925050503d806000811461285d576040519150601f19603f3d011682016040523d82523d6000602084013e612862565b606091505b509150915061287282828661287d565b979650505050505050565b6060831561288c575081611de7565b82511561289c5782518084602001fd5b8160405162461bcd60e51b815260040161066f9190612fbe565b80356001600160a01b03811681146128cd57600080fd5b919050565b6000806000606084860312156128e757600080fd5b6128f0846128b6565b92506128fe602085016128b6565b915061290c604085016128b6565b90509250925092565b60006020828403121561292757600080fd5b81356001600160e01b031981168114611de757600080fd5b60008083601f84011261295157600080fd5b50813567ffffffffffffffff81111561296957600080fd5b60208301915083602082850101111561298157600080fd5b9250929050565b60008060008084860360e081121561299f57600080fd5b60a08112156129ad57600080fd5b508493506129bd60a086016128b6565b925060c085013567ffffffffffffffff8111156129d957600080fd5b6129e58782880161293f565b95989497509550505050565b600080600083850360a0811215612a0757600080fd5b6080811215612a1557600080fd5b50839250608084013567ffffffffffffffff811115612a3357600080fd5b612a3f8682870161293f565b9497909650939450505050565b600060208284031215612a5e57600080fd5b5035919050565b600080600060608486031215612a7a57600080fd5b612a83846128b6565b9250612a91602085016128b6565b9150604084013590509250925092565b60008060408385031215612ab457600080fd5b82359150612ac4602084016128b6565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215612af657600080fd5b823567ffffffffffffffff80821115612b0e57600080fd5b818501915085601f830112612b2257600080fd5b813581811115612b3457612b34612acd565b8060051b604051601f19603f83011681018181108582111715612b5957612b59612acd565b604052918252848201925083810185019188831115612b7757600080fd5b938501935b82851015612b9c57612b8d856128b6565b84529385019392850192612b7c565b98975050505050505050565b60008060408385031215612bbb57600080fd5b612bc4836128b6565b9150612ac4602084016128b6565b600060208284031215612be457600080fd5b611de7826128b6565b6020808252825182820181905260009190848201906040850190845b81811015612c2e5783516001600160a01b031683529284019291840191600101612c09565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612c9557815180516001600160a01b0390811686528782015181168887015290860151168585015260609093019290850190600101612c57565b5091979650505050505050565b600080600080600060608688031215612cba57600080fd5b853567ffffffffffffffff80821115612cd257600080fd5b818801915088601f830112612ce657600080fd5b813581811115612cf557600080fd5b89602060a083028501011115612d0a57600080fd5b60208301975080965050612d20602089016128b6565b94506040880135915080821115612d3657600080fd5b50612d438882890161293f565b969995985093965092949392505050565b600060208284031215612d6657600080fd5b81518015158114611de757600080fd5b600060208284031215612d8857600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038881168252878116602083015286166040820152606081018590526080810184905260c060a08201819052600090612dfb9083018486612d8f565b9998505050505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015612e3057612e30612e08565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612e5f57612e5f612e08565b5060010190565b60008219821115612e7957612e79612e08565b500190565b60208152600061274d602083018486612d8f565b604080825283519082018190526000906020906060840190828701845b82811015612ecb57815184529284019290840190600101612eaf565b5050506001600160a01b039490941692019190915250919050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215612f0e57600080fd5b815160028110611de757600080fd5b60005b83811015612f38578181015183820152602001612f20565b83811115610daa5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f81816017850160208801612f1d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612fb2816028840160208801612f1d565b01602801949350505050565b6020815260008251806020840152612fdd816040850160208701612f1d565b601f01601f19169190910160400192915050565b600081600019048311821515161561300b5761300b612e08565b500290565b60008161301f5761301f612e08565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000825161304f818460208701612f1d565b919091019291505056fe49e347583a7b9e7f325e8963ee1f94127eba81e401796874b5a22f7c8f9d45f7a264697066735822122063a1f61bfccbfd51694c951db1855c9e54265bbea5d0d2f3e62ab1f1c43b2f1f64736f6c63430008090033038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd91893e1a169e79f2fe8aa327b1bceb2fede7a1b76a54824f95ea0e737720954ae0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d30000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6000000000000000000000000e8d5a85758fe98f7dce251cad552691d49b499bb
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101e45760003560e01c806365834acc1161010f578063b64230ba116100a2578063d547741f11610071578063d547741f14610486578063e454a5ed14610499578063ef47da6d146104c0578063f7bd381f146104d357600080fd5b8063b64230ba1461042f578063bbeee59114610442578063cbf8e6c414610455578063ccf61a411461045d57600080fd5b80639cd38be5116100de5780639cd38be5146103d25780639fc2c476146103e5578063a217fddf1461040c578063a734f06e1461041457600080fd5b806365834acc14610372578063687020d814610385578063907ab008146103ac57806391d14854146103bf57600080fd5b80632db8c129116101875780634c854126116101565780634c854126146103035780634d1dd98f14610316578063504254911461033d5780635163b4771461035d57600080fd5b80632db8c129146102b75780632f2ff15d146102ca57806336568abe146102dd5780634a2c1bab146102f057600080fd5b806311eff09c116101c357806311eff09c1461024b578063185025ef1461026c57806319b44cd914610281578063248a9ca31461029457600080fd5b8062b8ff92146101e957806301ffc9a7146101fe5780631078f38814610226575b600080fd5b6101fc6101f73660046128d2565b6104e6565b005b61021161020c366004612915565b61057a565b60405190151581526020015b60405180910390f35b6009546001600160a01b03165b6040516001600160a01b03909116815260200161021d565b61025e610259366004612988565b6105b1565b60405190815260200161021d565b61025e60008051602061305a83398151915281565b61025e61028f3660046129f1565b610a81565b61025e6102a2366004612a4c565b60009081526020819052604090206001015490565b6101fc6102c5366004612a65565b610d74565b6101fc6102d8366004612aa1565b610db0565b6101fc6102eb366004612aa1565b610ddb565b6101fc6102fe366004612ae3565b610e59565b6101fc610311366004612ba8565b610f1d565b61025e7fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b91181565b61035061034b366004612bd2565b610fe1565b60405161021d9190612bed565b610365611005565b60405161021d9190612c3a565b610211610380366004612bd2565b6112bf565b61025e7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd981565b6101fc6103ba366004612ae3565b61133d565b6102116103cd366004612aa1565b61141b565b6101fc6103e0366004612ba8565b611444565b61025e7f1893e1a169e79f2fe8aa327b1bceb2fede7a1b76a54824f95ea0e737720954ae81565b61025e600081565b61023373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b61021161043d366004612bd2565b611468565b6101fc610450366004612ca2565b611475565b610350611b1f565b61023361046b366004612bd2565b6004602052600090815260409020546001600160a01b031681565b6101fc610494366004612aa1565b611b30565b61025e7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d381565b6101fc6104ce366004612bd2565b611b56565b6101fc6104e1366004612ba8565b611ba0565b7f1893e1a169e79f2fe8aa327b1bceb2fede7a1b76a54824f95ea0e737720954ae6105118133611d65565b60405163abb347a960e01b81526001600160a01b038481166004830152838116602483015285169063abb347a990604401600060405180830381600087803b15801561055c57600080fd5b505af1158015610570573d6000803e3d6000fd5b5050505050505050565b60006001600160e01b03198216637965db0b60e01b14806105ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600954604051631960d2b360e21b81523360048201526000916001600160a01b0316906365834acc9060240160206040518083038186803b1580156105f557600080fd5b505afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d9190612d54565b6106785760405162461bcd60e51b81526020600482015260176024820152764d616368696e6572793a206e6f74206d656368616e696360481b60448201526064015b60405180910390fd5b6106f061068b6060870160408801612bd2565b6008600061069c60208a018a612bd2565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008860200160208101906106d19190612bd2565b6001600160a01b03168152602081019190915260400160002090611dc9565b61070d5760405163d69b537960e01b815260040160405180910390fd5b610718600185611dc9565b610735576040516364a7bd4d60e11b815260040160405180910390fd5b600060608601356107e7576107506040870160208801612bd2565b6001600160a01b03166370a0823161076b6020890189612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156107aa57600080fd5b505afa1580156107be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e29190612d76565b6107ed565b85606001355b90506108226107ff6020880188612bd2565b868361081160408b0160208c01612bd2565b6001600160a01b0316929190611dee565b60006108346060880160408901612bd2565b6001600160a01b03166370a0823161084f60208a018a612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190612d76565b90506001600160a01b03861663a5d4096b6108e460208a018a612bd2565b6108f460408b0160208c01612bd2565b61090460608c0160408d01612bd2565b868c608001358b8b6040518863ffffffff1660e01b815260040161092e9796959493929190612db8565b600060405180830381600087803b15801561094857600080fd5b505af115801561095c573d6000803e3d6000fd5b508392506109739150506060890160408a01612bd2565b6001600160a01b03166370a0823161098e60208b018b612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156109cd57600080fd5b505afa1580156109e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a059190612d76565b610a0f9190612e1e565b92508660800135831015610a36576040516309d2d38b60e31b815260040160405180910390fd5b604080518481526001600160a01b03881660208201527feb6edbd932a6290d7ca794a21b27f2da7d46b0f9aa0cde6135ce1d0469ad144e910160405180910390a15050949350505050565b600060008051602061305a833981519152610a9c8133611d65565b3360009081526004602090815260408220546001600160a01b03169190610ac590880188612bd2565b6001600160a01b03161480610af257506000610ae76040880160208901612bd2565b6001600160a01b0316145b15610b105760405163d92e233d60e01b815260040160405180910390fd5b6040860135610b3257604051631f2a200560e01b815260040160405180910390fd5b6060860135610b5457604051635380c59d60e01b815260040160405180910390fd5b610b6b3382604089013561081160208b018b612bd2565b6000610b7d6040880160208901612bd2565b6040516370a0823160e01b81523360048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015610bbe57600080fd5b505afa158015610bd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf69190612d76565b90506001600160a01b03821663a5d4096b33610c1560208b018b612bd2565b610c2560408c0160208d01612bd2565b8b604001358c606001358c8c6040518863ffffffff1660e01b8152600401610c539796959493929190612db8565b600060405180830381600087803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b50839250610c989150506040890160208a01612bd2565b6040516370a0823160e01b81523360048201526001600160a01b0391909116906370a082319060240160206040518083038186803b158015610cd957600080fd5b505afa158015610ced573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d119190612d76565b610d1b9190612e1e565b9350816001600160a01b0316336001600160a01b03167f77afa6671ccb5a39d59afc769ee32cdfdc0e4d7b9bbc32a0092a27843a74e64486604051610d6291815260200190565b60405180910390a35050509392505050565b7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d3610d9f8133611d65565b610daa848484611e59565b50505050565b600082815260208190526040902060010154610dcc8133611d65565b610dd68383611ffb565b505050565b6001600160a01b0381163314610e4b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161066f565b610e55828261207f565b5050565b7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd9610e848133611d65565b60005b8251811015610dd65760006001600160a01b0316838281518110610ead57610ead612e35565b60200260200101516001600160a01b03161415610edd5760405163d92e233d60e01b815260040160405180910390fd5b610f0a838281518110610ef257610ef2612e35565b602002602001015160016120e490919063ffffffff16565b5080610f1581612e4b565b915050610e87565b60008051602061305a833981519152610f368133611d65565b6001600160a01b0383161580610f5357506001600160a01b038216155b15610f715760405163d92e233d60e01b815260040160405180910390fd5b610f7c6005336120e4565b50336000908152600760205260409020610f9690846120e4565b503360009081526008602090815260408083206001600160a01b03871684529091529020610fc490836120e4565b610dd65760405163d69b537960e01b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090206060906105ab906120f9565b60606000805b61101560056120f9565b518110156110e457600061102a600583612106565b6001600160a01b03811660009081526007602052604081209192509061104f906120f9565b905060005b81518110156110ce57600082828151811061107157611071612e35565b6020908102919091018101516001600160a01b0380871660009081526008845260408082209284168252919093529091209091506110ae90612112565b6110b89087612e66565b95505080806110c690612e4b565b915050611054565b50505080806110dc90612e4b565b91505061100b565b508067ffffffffffffffff8111156110fe576110fe612acd565b60405190808252806020026020018201604052801561114957816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161111c5790505b5091506000805b61115a60056120f9565b518110156112b957600061116f600583612106565b6001600160a01b038116600090815260076020526040812091925090611194906120f9565b905060005b81518110156112a35760008282815181106111b6576111b6612e35565b6020908102919091018101516001600160a01b03808716600090815260088452604080822092841682529190935282209092506111f2906120f9565b905060005b815181101561128d576040518060600160405280876001600160a01b03168152602001846001600160a01b0316815260200183838151811061123b5761123b612e35565b60200260200101516001600160a01b03168152508a898151811061126157611261612e35565b6020026020010181905250878061127790612e4b565b985050808061128590612e4b565b9150506111f7565b505050808061129b90612e4b565b915050611199565b50505080806112b190612e4b565b915050611150565b50505090565b600954604051631960d2b360e21b81526001600160a01b03838116600483015260009216906365834acc9060240160206040518083038186803b15801561130557600080fd5b505afa158015611319573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ab9190612d54565b7f038c8d5a0695aa8e4bf7e2d14cb85443db816cf8bdf8985d9f1a65519aeb6cd96113688133611d65565b60005b8251811015610dd65760006113bc6003600086858151811061138f5761138f612e35565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020612112565b11156113db576040516361c45a0f60e01b815260040160405180910390fd5b6114088382815181106113f0576113f0612e35565b6020026020010151600161211c90919063ffffffff16565b508061141381612e4b565b91505061136b565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061305a83398151915261145d8133611d65565b610dd6338484612131565b60006105ab600183611dc9565b600954604051631960d2b360e21b81523360048201526001600160a01b03909116906365834acc9060240160206040518083038186803b1580156114b857600080fd5b505afa1580156114cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f09190612d54565b6115365760405162461bcd60e51b81526020600482015260176024820152764d616368696e6572793a206e6f74206d656368616e696360481b604482015260640161066f565b60008467ffffffffffffffff81111561155157611551612acd565b60405190808252806020026020018201604052801561157a578160200160208202803683370190505b509050611588600185611dc9565b6115a5576040516364a7bd4d60e11b815260040160405180910390fd5b60005b858110156118f1576116558787838181106115c5576115c5612e35565b905060a0020160400160208101906115dd9190612bd2565b600860008a8a868181106115f3576115f3612e35565b61160992602060a0909202019081019150612bd2565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008a8a8681811061163d5761163d612e35565b905060a0020160200160208101906106d19190612bd2565b6116725760405163d69b537960e01b815260040160405180910390fd5b600087878381811061168657611686612e35565b905060a002016060013560001415611774578787838181106116aa576116aa612e35565b905060a0020160200160208101906116c29190612bd2565b6001600160a01b03166370a082318989858181106116e2576116e2612e35565b6116f892602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561173757600080fd5b505afa15801561174b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176f9190612d76565b611791565b87878381811061178657611786612e35565b905060a00201606001355b90506117ea8888848181106117a8576117a8612e35565b6117be92602060a0909202019081019150612bd2565b87838b8b878181106117d2576117d2612e35565b905060a0020160200160208101906108119190612bd2565b8787838181106117fc576117fc612e35565b905060a0020160400160208101906118149190612bd2565b6001600160a01b03166370a0823189898581811061183457611834612e35565b61184a92602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561188957600080fd5b505afa15801561189d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c19190612d76565b8383815181106118d3576118d3612e35565b602090810291909101015250806118e981612e4b565b9150506115a8565b506040516364c3d39f60e01b81526001600160a01b038516906364c3d39f906119209086908690600401612e7e565b600060405180830381600087803b15801561193a57600080fd5b505af115801561194e573d6000803e3d6000fd5b5050505060005b85811015611add5781818151811061196f5761196f612e35565b602002602001015187878381811061198957611989612e35565b905060a0020160400160208101906119a19190612bd2565b6001600160a01b03166370a082318989858181106119c1576119c1612e35565b6119d792602060a0909202019081019150612bd2565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015611a1657600080fd5b505afa158015611a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4e9190612d76565b611a589190612e1e565b828281518110611a6a57611a6a612e35565b602002602001018181525050868682818110611a8857611a88612e35565b905060a0020160800135828281518110611aa457611aa4612e35565b60200260200101511015611acb576040516309d2d38b60e31b815260040160405180910390fd5b80611ad581612e4b565b915050611955565b507f4a8b10eb58b24f8872a8364002b92c533c3a143d3588739819be8eb6b38679658185604051611b0f929190612e92565b60405180910390a1505050505050565b6060611b2b60016120f9565b905090565b600082815260208190526040902060010154611b4c8133611d65565b610dd6838361207f565b7f0b43cb2c88b4e8fc5d4ac1352ba889b22584df0c58c4b5b589731a1c9f6f29d3611b818133611d65565b600980546001600160a01b0319166001600160a01b0384161790555050565b7fe39dc63caee7a15eb0ffb77a826d10c23d40b5f7182b000737ab5c078838b911611bcb8133611d65565b6001600160a01b0383161580611be857506001600160a01b038216155b15611c065760405163d92e233d60e01b815260040160405180910390fd5b6001826001600160a01b031663cd985af06040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4157600080fd5b505afa158015611c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c799190612efc565b6001811115611c8a57611c8a612ee6565b14611ca857604051634b3d6f3360e11b815260040160405180910390fd5b611cb3600183611dc9565b611cd0576040516364a7bd4d60e11b815260040160405180910390fd5b6001600160a01b038381166000908152600460205260409020541615611d23576001600160a01b0380841660009081526004602090815260408083205490931682526003905220611d21908461211c565b505b6001600160a01b03838116600090815260046020908152604080832080546001600160a01b03191694871694851790559282526003905220610daa90846120e4565b611d6f828261141b565b610e5557611d87816001600160a01b031660146122d8565b611d928360206122d8565b604051602001611da3929190612f49565b60408051601f198184030181529082905262461bcd60e51b825261066f91600401612fbe565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610daa9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612474565b6001600160a01b038316611ec75760405162461bcd60e51b815260206004820152602f60248201527f636f6c6c65637461626c652d647573742f63616e742d73656e642d647573742d60448201526e746f2d7a65726f2d6164647265737360881b606482015260840161066f565b611ed2600a83611dc9565b15611f365760405162461bcd60e51b815260206004820152602e60248201527f636f6c6c65637461626c652d647573742f746f6b656e2d69732d706172742d6f60448201526d198b5d1a194b5c1c9bdd1bd8dbdb60921b606482015260840161066f565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611f97576040516001600160a01b0384169082156108fc029083906000818181858888f19350505050158015611f91573d6000803e3d6000fd5b50611fab565b611fab6001600160a01b0383168483612546565b604080516001600160a01b038086168252841660208201529081018290527f1e34c1aee8e83c2dcc14c21bb4bfeea7f46c0c998cb797ac7cc4d7a18f5c656b9060600160405180910390a1505050565b612005828261141b565b610e55576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561203b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612089828261141b565b15610e55576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611de7836001600160a01b038416612576565b60606000611de7836125c5565b6000611de78383612621565b60006105ab825490565b6000611de7836001600160a01b03841661264b565b6001600160a01b038216158061214e57506001600160a01b038116155b1561216c5760405163d92e233d60e01b815260040160405180910390fd5b604051636eb1769f60e11b81523360048201523060248201526001600160a01b0383169063dd62ed3e9060440160206040518083038186803b1580156121b157600080fd5b505afa1580156121c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e99190612d76565b1561220757604051633c553c4360e11b815260040160405180910390fd5b6001600160a01b038084166000908152600860209081526040808320938616835292905220612236908261211c565b6122535760405163d69b537960e01b815260040160405180910390fd5b6001600160a01b03808416600090815260086020908152604080832093861683529290522061228190612112565b610dd6576001600160a01b03831660009081526007602052604090206122a7908361211c565b506001600160a01b03831660009081526007602052604090206122c990612112565b610dd657610daa60058461211c565b606060006122e7836002612ff1565b6122f2906002612e66565b67ffffffffffffffff81111561230a5761230a612acd565b6040519080825280601f01601f191660200182016040528015612334576020820181803683370190505b509050600360fc1b8160008151811061234f5761234f612e35565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061237e5761237e612e35565b60200101906001600160f81b031916908160001a90535060006123a2846002612ff1565b6123ad906001612e66565b90505b6001811115612425576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106123e1576123e1612e35565b1a60f81b8282815181106123f7576123f7612e35565b60200101906001600160f81b031916908160001a90535060049490941c9361241e81613010565b90506123b0565b508315611de75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161066f565b60006124c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661273e9092919063ffffffff16565b805190915015610dd657808060200190518101906124e79190612d54565b610dd65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161066f565b6040516001600160a01b038316602482015260448101829052610dd690849063a9059cbb60e01b90606401611e22565b60008181526001830160205260408120546125bd575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105ab565b5060006105ab565b60608160000180548060200260200160405190810160405280929190818152602001828054801561261557602002820191906000526020600020905b815481526020019060010190808311612601575b50505050509050919050565b600082600001828154811061263857612638612e35565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561273457600061266f600183612e1e565b855490915060009061268390600190612e1e565b90508181146126e85760008660000182815481106126a3576126a3612e35565b90600052602060002001549050808760000184815481106126c6576126c6612e35565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126f9576126f9613027565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105ab565b60009150506105ab565b606061274d8484600085612755565b949350505050565b6060824710156127b65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161066f565b843b6128045760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161066f565b600080866001600160a01b03168587604051612820919061303d565b60006040518083038185875af1925050503d806000811461285d576040519150601f19603f3d011682016040523d82523d6000602084013e612862565b606091505b509150915061287282828661287d565b979650505050505050565b6060831561288c575081611de7565b82511561289c5782518084602001fd5b8160405162461bcd60e51b815260040161066f9190612fbe565b80356001600160a01b03811681146128cd57600080fd5b919050565b6000806000606084860312156128e757600080fd5b6128f0846128b6565b92506128fe602085016128b6565b915061290c604085016128b6565b90509250925092565b60006020828403121561292757600080fd5b81356001600160e01b031981168114611de757600080fd5b60008083601f84011261295157600080fd5b50813567ffffffffffffffff81111561296957600080fd5b60208301915083602082850101111561298157600080fd5b9250929050565b60008060008084860360e081121561299f57600080fd5b60a08112156129ad57600080fd5b508493506129bd60a086016128b6565b925060c085013567ffffffffffffffff8111156129d957600080fd5b6129e58782880161293f565b95989497509550505050565b600080600083850360a0811215612a0757600080fd5b6080811215612a1557600080fd5b50839250608084013567ffffffffffffffff811115612a3357600080fd5b612a3f8682870161293f565b9497909650939450505050565b600060208284031215612a5e57600080fd5b5035919050565b600080600060608486031215612a7a57600080fd5b612a83846128b6565b9250612a91602085016128b6565b9150604084013590509250925092565b60008060408385031215612ab457600080fd5b82359150612ac4602084016128b6565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215612af657600080fd5b823567ffffffffffffffff80821115612b0e57600080fd5b818501915085601f830112612b2257600080fd5b813581811115612b3457612b34612acd565b8060051b604051601f19603f83011681018181108582111715612b5957612b59612acd565b604052918252848201925083810185019188831115612b7757600080fd5b938501935b82851015612b9c57612b8d856128b6565b84529385019392850192612b7c565b98975050505050505050565b60008060408385031215612bbb57600080fd5b612bc4836128b6565b9150612ac4602084016128b6565b600060208284031215612be457600080fd5b611de7826128b6565b6020808252825182820181905260009190848201906040850190845b81811015612c2e5783516001600160a01b031683529284019291840191600101612c09565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612c9557815180516001600160a01b0390811686528782015181168887015290860151168585015260609093019290850190600101612c57565b5091979650505050505050565b600080600080600060608688031215612cba57600080fd5b853567ffffffffffffffff80821115612cd257600080fd5b818801915088601f830112612ce657600080fd5b813581811115612cf557600080fd5b89602060a083028501011115612d0a57600080fd5b60208301975080965050612d20602089016128b6565b94506040880135915080821115612d3657600080fd5b50612d438882890161293f565b969995985093965092949392505050565b600060208284031215612d6657600080fd5b81518015158114611de757600080fd5b600060208284031215612d8857600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038881168252878116602083015286166040820152606081018590526080810184905260c060a08201819052600090612dfb9083018486612d8f565b9998505050505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015612e3057612e30612e08565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612e5f57612e5f612e08565b5060010190565b60008219821115612e7957612e79612e08565b500190565b60208152600061274d602083018486612d8f565b604080825283519082018190526000906020906060840190828701845b82811015612ecb57815184529284019290840190600101612eaf565b5050506001600160a01b039490941692019190915250919050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215612f0e57600080fd5b815160028110611de757600080fd5b60005b83811015612f38578181015183820152602001612f20565b83811115610daa5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612f81816017850160208801612f1d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612fb2816028840160208801612f1d565b01602801949350505050565b6020815260008251806020840152612fdd816040850160208701612f1d565b601f01601f19169190910160400192915050565b600081600019048311821515161561300b5761300b612e08565b500290565b60008161301f5761301f612e08565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000825161304f818460208701612f1d565b919091019291505056fe49e347583a7b9e7f325e8963ee1f94127eba81e401796874b5a22f7c8f9d45f7a264697066735822122063a1f61bfccbfd51694c951db1855c9e54265bbea5d0d2f3e62ab1f1c43b2f1f64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b60000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6000000000000000000000000e8d5a85758fe98f7dce251cad552691d49b499bb
-----Decoded View---------------
Arg [0] : _masterAdmin (address): 0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6
Arg [1] : _swapperAdder (address): 0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6
Arg [2] : _swapperSetter (address): 0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6
Arg [3] : _strategyModifier (address): 0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6
Arg [4] : _mechanicsRegistry (address): 0xE8d5A85758FE98F7Dce251CAd552691D49b499Bb
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6
Arg [1] : 0000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6
Arg [2] : 0000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6
Arg [3] : 0000000000000000000000002c01b4ad51a67e2d8f02208f54df9ac4c0b778b6
Arg [4] : 000000000000000000000000e8d5a85758fe98f7dce251cad552691d49b499bb
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.