Address Details
contract
0xb37Bf97A42eee6b995732530595E3d16639D9977
- Contract Name
- Payroll
- Creator
- 0x9c95b0–8c1585 at 0x36f00b–9d143a
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 16281889
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Payroll
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2022-12-16T21:06:26.230487Z
contracts/Payroll.sol
//SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./interfaces/IERC20Basic.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IUniswap.sol"; import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol"; import "./BytesLib.sol"; /** * @title Think and Dev Paymentbox * @author Think and Dev Team * @notice Swap and transfer multiple ERC20 pairs to multiple accounts in a single transaction. * Use any router address of any DEX that uses Uniswap protocol v2 or v3 to make swaps. */ contract Payroll is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable { using BytesLib for bytes; /** * Returns the address of the Uniswap protocol router, it could be v2 or v3. */ address public swapRouter; address public feeAddress; uint256 public fee; uint256 public constant MANTISSA = 1e18; uint256 public version; /** * Returns if the contract is working with a v2 Uniswap protocol; * true means v2, false means v3. */ bool public isSwapV2; struct Payment { address token; address[] receivers; uint256[] amountsToTransfer; } struct SwapV2 { uint256 amountOut; uint256 amountInMax; address[] path; } struct SwapV3 { uint256 amountOut; uint256 amountInMax; bytes path; } event SwapRouterChanged(address _swapRouter, bool _isSwapV2); event FeeChanged(uint256 _fee); event UpdatedVersion(uint256 _version); event FeeCharged(address _erc20TokenAddress, address _feeAddress, uint256 _fees); event FeeAddressChanged(address _feeAddress); event BatchPayment(address _erc20TokenAddress, address[] _receivers, uint256[] _amountsToTransfer); event SwapFinished(address _tokenIn, address _tokenOut, uint256 _amountReceived); /** * @param _swapRouter Router address to execute swaps. * @param _isSwapV2 Boolean to specify the version of the router; true means v2, false means v3. */ function initialize( address _swapRouter, bool _isSwapV2, address _feeAddress, uint256 _fee ) public initializer { __ReentrancyGuard_init(); __Ownable_init(); _setSwapRouter(_swapRouter, _isSwapV2); _setFeeAddress(_feeAddress); _setFee(_fee); _setVersion(1); } /** * Set the fee that will be charged, fees are divided by mantissa * @param _fee Percentage that will be charged. */ function setFee(uint256 _fee) external onlyOwner { _setFee(_fee); } function setVersion(uint256 _version) external onlyOwner { _setVersion(_version); } function _setVersion(uint256 _version) internal { require(_version > 0, "Payroll: Version can't be 0"); version = _version; emit UpdatedVersion(_version); } function _setFee(uint256 _fee) internal { require(_fee < 3e16, "Payroll: Fee should be less than 3%"); fee = _fee; emit FeeChanged(_fee); } /** * Set the address that will receive the fees. * @param _feeAddress Address that will receive the fees. */ function setFeeAddress(address _feeAddress) external onlyOwner { _setFeeAddress(_feeAddress); } function _setFeeAddress(address _feeAddress) internal { require(_feeAddress != address(0), "Payroll: Fee address can't be 0"); feeAddress = _feeAddress; emit FeeAddressChanged(_feeAddress); } /** * Set the SwapRouter and the version to be used. * @param _swapRouter Router address to execute swaps. * @param _isSwapV2 Boolean to specify the version of the router; true means v2, false means v3. */ function setSwapRouter(address _swapRouter, bool _isSwapV2) external onlyOwner { _setSwapRouter(_swapRouter, _isSwapV2); } function _setSwapRouter(address _swapRouter, bool _isSwapV2) internal { require(_swapRouter != address(0), "Payroll: Cannot set a 0 address as swapRouter"); isSwapV2 = _isSwapV2; swapRouter = _swapRouter; emit SwapRouterChanged(_swapRouter, _isSwapV2); } /** * Approves the following token to be used on swapRouter * @param _erc20TokenOrigin ERC20 token address to approve. */ function approveTokens(address[] calldata _erc20TokenOrigin) external nonReentrant { for (uint256 i = 0; i < _erc20TokenOrigin.length; i++) { // approves the swapRouter to spend totalAmountToSpend of erc20TokenOrigin TransferHelper.safeApprove(_erc20TokenOrigin[i], address(swapRouter), type(uint256).max); } } /** * Perform the swap with Uniswap V3 and the transfer to the given addresses. * @param _erc20TokenOrigin ERC20 token address to swap for another. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @param _payments The array of the Payment data. * @notice Swap ERC20 to ERC20. * @notice Available to send ETH or ERC20. */ function performSwapV3AndPayment( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps, Payment[] calldata _payments ) external payable nonReentrant { require(!isSwapV2, "Payroll: Not uniswapV3"); if (_swaps.length > 0) { _performSwapV3(_erc20TokenOrigin, _totalAmountToSwap, _deadline, _swaps); } _performMultiPayment(_payments); refundETH(); } /** * Perform the swap with Uniswap V3 and the transfer to the given addresses. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @param _payments The array of the Payment data. * @notice Swap ETH to ERC20. * @notice Available to send ETH or ERC20. */ function performSwapV3AndPaymentETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps, Payment[] calldata _payments ) external payable nonReentrant { require(!isSwapV2, "Payroll: Not uniswapV3"); if (_swaps.length > 0) { _performSwapV3ETH(_totalAmountToSwap, _deadline, _swaps); } _performMultiPayment(_payments); refundETH(); } /** * Perform the swap with Uniswap V3 to the given token addresses and amounts. * @param _erc20TokenOrigin ERC20 token address to swap for another. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @notice Swap ERC20 to ERC20. */ function performSwapV3( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps ) external nonReentrant { require(!isSwapV2, "Payroll: Not uniswapV3"); require(_swaps.length > 0, "Payroll: Empty swaps"); _performSwapV3(_erc20TokenOrigin, _totalAmountToSwap, _deadline, _swaps); refundETH(); } /** * Perform the swap with Uniswap V3 to the given token addresses and amounts. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @notice Swap ETH to ERC20. */ function performSwapV3ETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps ) external payable nonReentrant { require(!isSwapV2, "Payroll: Not uniswapV3"); require(_swaps.length > 0, "Payroll: Empty swaps"); _performSwapV3ETH(_totalAmountToSwap, _deadline, _swaps); refundETH(); } function _performSwapV3( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps ) internal { // transfer the totalAmountToSpend of erc20TokenOrigin from the msg.sender to this contract // msg.sender must approve this contract for erc20TokenOrigin TransferHelper.safeTransferFrom(_erc20TokenOrigin, msg.sender, address(this), _totalAmountToSwap); // Celo does not use V3 address weth = IUniswapV3(swapRouter).WETH9(); uint256 amountIn = 0; for (uint256 i = 0; i < _swaps.length; i++) { require(_swaps[i].path.length > 0, "Payroll: Empty path"); require( _swaps[i].path.toAddress(_swaps[i].path.length - 20) == _erc20TokenOrigin, "Payroll: Swap not token origin" ); // get the token to swap, it is at position 0 of the byte array address tokenTo = _swaps[i].path.toAddress(0); if (tokenTo == weth) { // if tokenTo is WETH, the contract needs to receive it to convert it to ETH and use it in payments (if needed) // then it will be refunded to msg.sender amountIn = IUniswapV3(swapRouter).exactOutput( IUniswapV3.ExactOutputParams({ path: _swaps[i].path, recipient: address(this), deadline: _deadline, amountOut: _swaps[i].amountOut, amountInMaximum: _swaps[i].amountInMax }) ); // receives WETH, so converts it to ETH IWETH(weth).withdraw(_swaps[i].amountOut); } else { // if tokenTo is any ERC20 the recipient is the msg.sender amountIn = IUniswapV3(swapRouter).exactOutput( IUniswapV3.ExactOutputParams({ path: _swaps[i].path, recipient: msg.sender, deadline: _deadline, amountOut: _swaps[i].amountOut, amountInMaximum: _swaps[i].amountInMax }) ); } emit SwapFinished(_erc20TokenOrigin, tokenTo, amountIn); } uint256 leftOver = IERC20Basic(_erc20TokenOrigin).balanceOf(address(this)); if (leftOver > 0) { // return the leftover of _erc20TokenOrigin TransferHelper.safeTransfer(_erc20TokenOrigin, msg.sender, leftOver); } } function _performSwapV3ETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV3[] calldata _swaps ) internal { require(msg.value >= _totalAmountToSwap, "Payroll: Not enough msg.value"); // Celo does not use V3 address weth = IUniswapV3(swapRouter).WETH9(); for (uint256 i = 0; i < _swaps.length; i++) { require(_swaps[i].path.length > 0, "Payroll: Empty path"); require(_swaps[i].path.toAddress(_swaps[i].path.length - 20) == weth, "Payroll: Swap not native token"); uint256 amountIn = IUniswapV3(swapRouter).exactOutput{value: _swaps[i].amountInMax}( IUniswapV3.ExactOutputParams({ path: _swaps[i].path, recipient: msg.sender, deadline: _deadline, amountOut: _swaps[i].amountOut, amountInMaximum: _swaps[i].amountInMax }) ); emit SwapFinished(address(0), _swaps[i].path.toAddress(0), amountIn); } // Explicitly request ETH refound IUniswapV3(swapRouter).refundETH(); } /** * Perform the swap with Uniswap V2 and the transfer to the given addresses. * @param _erc20TokenOrigin ERC20 token address to swap for another. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @param _payments The array of the Payment data. * @notice Swap ERC20 to ERC20. * @notice Available to send ETH or ERC20. */ function performSwapV2AndPayment( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps, Payment[] calldata _payments ) external payable nonReentrant { require(isSwapV2, "Payroll: Not uniswapV2"); if (_swaps.length > 0) { _performSwapV2(_erc20TokenOrigin, _totalAmountToSwap, _deadline, _swaps); } _performMultiPayment(_payments); refundETH(); } /** * Perform the swap with Uniswap V2 and the transfer to the given addresses. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @param _payments The array of the Payment data. * @notice Swap ETH to ERC20. * @notice Available to send ETH or ERC20. */ function performSwapV2AndPaymentETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps, Payment[] calldata _payments ) external payable nonReentrant { require(isSwapV2, "Payroll: Not uniswapV2"); if (_swaps.length > 0) { _performSwapV2ETH(_totalAmountToSwap, _deadline, _swaps); } _performMultiPayment(_payments); refundETH(); } /** * Perform the swap with Uniswap V2 to the given token addresses and amounts. * @param _erc20TokenOrigin ERC20 token address to swap for another. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @notice Swap ERC20 to ERC20. */ function performSwapV2( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps ) external nonReentrant { require(isSwapV2, "Payroll: Not uniswapV2"); require(_swaps.length > 0, "Payroll: Empty swaps"); _performSwapV2(_erc20TokenOrigin, _totalAmountToSwap, _deadline, _swaps); refundETH(); } /** * Perform the swap with Uniswap V2 to the given token addresses and amounts. * @param _totalAmountToSwap Total amount of erc20TokenOrigin to spend in swaps. * @param _deadline The unix timestamp after a swap will fail. * @param _swaps The array of the Swaps data. * @notice Swap ETH to ERC20. */ function performSwapV2ETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps ) external payable nonReentrant { require(isSwapV2, "Payroll: Not uniswapV2"); require(_swaps.length > 0, "Payroll: Empty swaps"); _performSwapV2ETH(_totalAmountToSwap, _deadline, _swaps); refundETH(); } function _swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) internal virtual returns (uint256 amounts) { return IUniswapV2(swapRouter).swapTokensForExactETH(amountOut, amountInMax, path, to, deadline)[0]; } function _swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) internal virtual returns (uint256 amounts) { return IUniswapV2(swapRouter).swapTokensForExactTokens(amountOut, amountInMax, path, to, deadline)[0]; } function _performSwapV2( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps ) internal { // transfer the totalAmountToSpend of erc20TokenOrigin from the msg.sender to this contract // msg.sender must approve this contract for erc20TokenOrigin TransferHelper.safeTransferFrom(_erc20TokenOrigin, msg.sender, address(this), _totalAmountToSwap); uint256 amountIn = 0; address weth = address(0); // Celo Native currency is an ERC20 if (block.chainid != 42220 && block.chainid != 44787) { weth = _weth(); } for (uint256 i = 0; i < _swaps.length; i++) { require(_swaps[i].path.length > 0, "Payroll: Empty path"); require(_swaps[i].path[0] == _erc20TokenOrigin, "Payroll: Swap not token origin"); if (_swaps[i].path[_swaps[i].path.length - 1] == weth) { // if tokenTo is WETH, the contract needs to receive it to use it in payments (if needed) // then it will be refunded to msg.sender amountIn = _swapTokensForExactETH( _swaps[i].amountOut, _swaps[i].amountInMax, _swaps[i].path, address(this), _deadline ); } else { // if tokenTo is any ERC20 the recipient is the msg.sender amountIn = _swapTokensForExactTokens( _swaps[i].amountOut, _swaps[i].amountInMax, _swaps[i].path, msg.sender, _deadline ); } emit SwapFinished(_erc20TokenOrigin, _swaps[i].path[_swaps[i].path.length - 1], amountIn); } uint256 leftOver = IERC20Basic(_erc20TokenOrigin).balanceOf(address(this)); if (leftOver > 0) { // return the leftover of _erc20TokenOrigin TransferHelper.safeTransfer(_erc20TokenOrigin, msg.sender, leftOver); } } function _swapETHForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) internal virtual returns (uint256 amounts) { return IUniswapV2(swapRouter).swapETHForExactTokens{value: amountInMax}(amountOut, path, to, deadline)[0]; } function _weth() internal view virtual returns (address) { return IUniswapV2(swapRouter).WETH(); } function _performSwapV2ETH( uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps ) internal { require(msg.value >= _totalAmountToSwap, "Payroll: Not enough msg.value"); // We should not use this method in Celo, instead use _performSwapV2 address weth = _weth(); for (uint256 i = 0; i < _swaps.length; i++) { require(_swaps[i].path.length > 0, "Payroll: Empty path"); require(_swaps[i].path[0] == weth, "Payroll: Swap not native token"); // return the amount spend of tokenIn uint256 amountIn = _swapETHForExactTokens( _swaps[i].amountOut, _swaps[i].amountInMax, _swaps[i].path, msg.sender, _deadline ); address[] calldata path = _swaps[i].path; emit SwapFinished(address(0), path[path.length - 1], amountIn); } } /** * Perform the payments to the given addresses and amounts, public method. * @param _payments The array of the Payment data. * @notice Available to send ETH or ERC20. */ function performMultiPayment(Payment[] calldata _payments) external payable nonReentrant { _performMultiPayment(_payments); refundETH(); } function _performMultiPayment(Payment[] calldata _payments) internal { for (uint256 i = 0; i < _payments.length; i++) { require(_payments[i].amountsToTransfer.length > 0, "Payroll: No amounts to transfer"); require( _payments[i].amountsToTransfer.length == _payments[i].receivers.length, "Payroll: Arrays must have same length" ); if (_payments[i].token != address(0)) { _performERC20Payment(_payments[i].token, _payments[i].receivers, _payments[i].amountsToTransfer); } else { _performETHPayment(_payments[i].token, _payments[i].receivers, _payments[i].amountsToTransfer); } } } /** * Performs the ERC20 payment to the given addresses. * @param _erc20TokenAddress The address of the ERC20 token to transfer. * @param _receivers The array of payment receivers. * @param _amountsToTransfer The array of payments' amounts to perform. * The amount will be transfered to the address on _receivers with the same index. */ function _performERC20Payment( address _erc20TokenAddress, address[] calldata _receivers, uint256[] calldata _amountsToTransfer ) internal { uint256 acumulatedFee = 0; uint256 totalAmountSent = 0; for (uint256 i = 0; i < _receivers.length; i++) { require(_receivers[i] != address(0), "Payroll: Cannot send to a 0 address"); totalAmountSent = totalAmountSent + _amountsToTransfer[i]; TransferHelper.safeTransferFrom(_erc20TokenAddress, msg.sender, _receivers[i], _amountsToTransfer[i]); } emit BatchPayment(_erc20TokenAddress, _receivers, _amountsToTransfer); acumulatedFee = (totalAmountSent * fee) / MANTISSA; if (acumulatedFee > 0) { TransferHelper.safeTransferFrom(_erc20TokenAddress, msg.sender, feeAddress, acumulatedFee); } emit FeeCharged(_erc20TokenAddress, feeAddress, acumulatedFee); } /** * Performs the ETH payment to the given addresses. * @param _receivers The array of payment receivers. * @param _amountsToTransfer The array of payments' amounts to perform. * The amount will be transfered to the address on _receivers with the same index. */ function _performETHPayment( address _erc20TokenAddress, address[] calldata _receivers, uint256[] calldata _amountsToTransfer ) internal { uint256 acumulatedFee = 0; uint256 totalAmountSent = 0; for (uint256 i = 0; i < _receivers.length; i++) { require(_receivers[i] != address(0), "Payroll: Cannot send to a 0 address"); totalAmountSent = totalAmountSent + _amountsToTransfer[i]; (bool success, ) = payable(_receivers[i]).call{value: _amountsToTransfer[i]}(""); require(success, "Payroll: ETH transfer failed"); } emit BatchPayment(_erc20TokenAddress, _receivers, _amountsToTransfer); acumulatedFee = (totalAmountSent * fee) / MANTISSA; if (acumulatedFee > 0) { totalAmountSent = totalAmountSent + acumulatedFee; (bool success, ) = payable(feeAddress).call{value: acumulatedFee}(""); require(success, "Payroll: ETH fee transfer failed"); } emit FeeCharged(_erc20TokenAddress, feeAddress, acumulatedFee); } /** * Perform the refound of the leftover ETH. */ function refundETH() internal { uint256 leftOver = address(this).balance; if (leftOver > 1) { (bool success, ) = payable(msg.sender).call{value: leftOver}(""); require(success, "Payroll: ETH leftOver transfer failed"); } } receive() external payable {} }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
/_openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
/_uniswap/v3-periphery/contracts/libraries/TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; library TransferHelper { /// @notice Transfers tokens from the targeted address to the given destination /// @notice Errors with 'STF' if transfer fails /// @param token The contract address of the token to be transferred /// @param from The originating address from which the tokens will be transferred /// @param to The destination address of the transfer /// @param value The amount to be transferred function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); } /// @notice Transfers tokens from msg.sender to a recipient /// @dev Errors with ST if transfer fails /// @param token The contract address of the token which will be transferred /// @param to The recipient of the transfer /// @param value The value of the transfer function safeTransfer( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); } /// @notice Approves the stipulated contract to spend the given allowance in the given token /// @dev Errors with 'SA' if transfer fails /// @param token The contract address of the token to be approved /// @param to The target of the approval /// @param value The amount of the given token the target will be allowed to spend function safeApprove( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); } /// @notice Transfers ETH to the recipient address /// @dev Fails with `STE` /// @param to The destination of the transfer /// @param value The value to be transferred function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'STE'); } }
/contracts/BytesLib.sol
//SPDX-License-Identifier: AGPL-3.0-or-later /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity ^0.8.0; library BytesLib { function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_start + _length >= _start, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don"t care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we"re done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin"s length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let"s just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_start + 20 >= _start, "toAddress_overflow"); require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) { require(_start + 3 >= _start, "toUint24_overflow"); require(_bytes.length >= _start + 3, "toUint24_outOfBounds"); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } }
/contracts/interfaces/IERC20Basic.sol
//SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface */ interface IERC20Basic { function transferFrom( address from, address to, uint256 value ) external returns (bool); function balanceOf(address account) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); }
/contracts/interfaces/IUniswap.sol
//SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; /** * @title UniswapV2 * @dev Simpler version of Uniswap v2 and v3 protocol interface */ interface IUniswapV2 { //Uniswap V2 function WETH() external pure returns (address); function factory() external pure returns (address); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); // https://docs.uniswap.org/protocol/V2/reference/smart-contracts/router-02#addliquidity function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); } /** * @title UniswapV2 * @dev Simpler version of Uniswap v2 and v3 protocol interface */ interface IUniswapV3 { //UniswapV3 struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } function WETH9() external pure returns (address); function refundETH() external payable; /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
/contracts/interfaces/IWETH.sol
//SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; /** * @title IWETH * @dev Simpler version of IWETH interface */ interface IWETH { function withdraw(uint256 _amount) external; }
Contract ABI
[{"type":"event","name":"BatchPayment","inputs":[{"type":"address","name":"_erc20TokenAddress","internalType":"address","indexed":false},{"type":"address[]","name":"_receivers","internalType":"address[]","indexed":false},{"type":"uint256[]","name":"_amountsToTransfer","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"FeeAddressChanged","inputs":[{"type":"address","name":"_feeAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"FeeChanged","inputs":[{"type":"uint256","name":"_fee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeeCharged","inputs":[{"type":"address","name":"_erc20TokenAddress","internalType":"address","indexed":false},{"type":"address","name":"_feeAddress","internalType":"address","indexed":false},{"type":"uint256","name":"_fees","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SwapFinished","inputs":[{"type":"address","name":"_tokenIn","internalType":"address","indexed":false},{"type":"address","name":"_tokenOut","internalType":"address","indexed":false},{"type":"uint256","name":"_amountReceived","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SwapRouterChanged","inputs":[{"type":"address","name":"_swapRouter","internalType":"address","indexed":false},{"type":"bool","name":"_isSwapV2","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"UpdatedVersion","inputs":[{"type":"uint256","name":"_version","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MANTISSA","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approveTokens","inputs":[{"type":"address[]","name":"_erc20TokenOrigin","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"fee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_swapRouter","internalType":"address"},{"type":"bool","name":"_isSwapV2","internalType":"bool"},{"type":"address","name":"_feeAddress","internalType":"address"},{"type":"uint256","name":"_fee","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSwapV2","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performMultiPayment","inputs":[{"type":"tuple[]","name":"_payments","internalType":"struct Payroll.Payment[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"address[]","name":"receivers","internalType":"address[]"},{"type":"uint256[]","name":"amountsToTransfer","internalType":"uint256[]"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"performSwapV2","inputs":[{"type":"address","name":"_erc20TokenOrigin","internalType":"address"},{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV2[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV2AndPayment","inputs":[{"type":"address","name":"_erc20TokenOrigin","internalType":"address"},{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV2[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"}]},{"type":"tuple[]","name":"_payments","internalType":"struct Payroll.Payment[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"address[]","name":"receivers","internalType":"address[]"},{"type":"uint256[]","name":"amountsToTransfer","internalType":"uint256[]"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV2AndPaymentETH","inputs":[{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV2[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"}]},{"type":"tuple[]","name":"_payments","internalType":"struct Payroll.Payment[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"address[]","name":"receivers","internalType":"address[]"},{"type":"uint256[]","name":"amountsToTransfer","internalType":"uint256[]"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV2ETH","inputs":[{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV2[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"performSwapV3","inputs":[{"type":"address","name":"_erc20TokenOrigin","internalType":"address"},{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV3[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"bytes","name":"path","internalType":"bytes"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV3AndPayment","inputs":[{"type":"address","name":"_erc20TokenOrigin","internalType":"address"},{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV3[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"bytes","name":"path","internalType":"bytes"}]},{"type":"tuple[]","name":"_payments","internalType":"struct Payroll.Payment[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"address[]","name":"receivers","internalType":"address[]"},{"type":"uint256[]","name":"amountsToTransfer","internalType":"uint256[]"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV3AndPaymentETH","inputs":[{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV3[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"bytes","name":"path","internalType":"bytes"}]},{"type":"tuple[]","name":"_payments","internalType":"struct Payroll.Payment[]","components":[{"type":"address","name":"token","internalType":"address"},{"type":"address[]","name":"receivers","internalType":"address[]"},{"type":"uint256[]","name":"amountsToTransfer","internalType":"uint256[]"}]}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"performSwapV3ETH","inputs":[{"type":"uint256","name":"_totalAmountToSwap","internalType":"uint256"},{"type":"uint32","name":"_deadline","internalType":"uint32"},{"type":"tuple[]","name":"_swaps","internalType":"struct Payroll.SwapV3[]","components":[{"type":"uint256","name":"amountOut","internalType":"uint256"},{"type":"uint256","name":"amountInMax","internalType":"uint256"},{"type":"bytes","name":"path","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFee","inputs":[{"type":"uint256","name":"_fee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeAddress","inputs":[{"type":"address","name":"_feeAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapRouter","inputs":[{"type":"address","name":"_swapRouter","internalType":"address"},{"type":"bool","name":"_isSwapV2","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVersion","inputs":[{"type":"uint256","name":"_version","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"swapRouter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"version","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061378f806100206000396000f3fe60806040526004361061014f5760003560e01c80638da5cb5b116100b6578063db9d03341161006f578063db9d03341461036c578063ddca3f431461037f578063ef6aa26414610395578063f1b01903146103b5578063f2fde38b146103c8578063f65a83cf146103e857600080fd5b80638da5cb5b146102c857806392721482146102e6578063ac43070b146102f9578063bbc5ffb714610319578063c31c9c071461032c578063d8ca72361461034c57600080fd5b80634127535811610108578063412753581461020557806354fd4d501461023d57806369fe0e2d14610253578063715018a6146102735780638705fcd414610288578063887a622a146102a857600080fd5b80630e7ab0c31461015b5780632171dcc9146101705780632703984c1461019057806332b20df8146101bf578063395ae6a3146101d2578063408def1e146101e557600080fd5b3661015657005b600080fd5b61016e610169366004612e15565b610412565b005b34801561017c57600080fd5b5061016e61018b366004612e92565b6104a1565b34801561019c57600080fd5b506101ac670de0b6b3a764000081565b6040519081526020015b60405180910390f35b61016e6101cd366004612ecb565b6104b7565b61016e6101e0366004612f55565b610533565b3480156101f157600080fd5b5061016e610200366004612ff2565b6105b1565b34801561021157600080fd5b50609854610225906001600160a01b031681565b6040516001600160a01b0390911681526020016101b6565b34801561024957600080fd5b506101ac609a5481565b34801561025f57600080fd5b5061016e61026e366004612ff2565b6105c5565b34801561027f57600080fd5b5061016e6105d6565b34801561029457600080fd5b5061016e6102a336600461300b565b6105ea565b3480156102b457600080fd5b5061016e6102c336600461302f565b6105fb565b3480156102d457600080fd5b506033546001600160a01b0316610225565b61016e6102f4366004612f55565b610683565b34801561030557600080fd5b5061016e6103143660046130a0565b6106e0565b61016e610327366004612ecb565b61076d565b34801561033857600080fd5b50609754610225906001600160a01b031681565b34801561035857600080fd5b5061016e61036736600461302f565b6107c9565b61016e61037a3660046130a0565b61083e565b34801561038b57600080fd5b506101ac60995481565b3480156103a157600080fd5b5061016e6103b03660046130e2565b610881565b61016e6103c3366004612e15565b6109c4565b3480156103d457600080fd5b5061016e6103e336600461300b565b610a38565b3480156103f457600080fd5b50609b546104029060ff1681565b60405190151581526020016101b6565b6002606554141561043e5760405162461bcd60e51b815260040161043590613133565b60405180910390fd5b6002606555609b5460ff166104655760405162461bcd60e51b81526004016104359061316a565b806104825760405162461bcd60e51b81526004016104359061319a565b61048e84848484610aae565b610496610d65565b505060016065555050565b6104a9610e15565b6104b38282610e6f565b5050565b600260655414156104da5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff16156105025760405162461bcd60e51b8152600401610435906131c8565b82156105145761051486868686610f48565b61051e82826113d3565b610526610d65565b5050600160655550505050565b600260655414156105565760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff161561057e5760405162461bcd60e51b8152600401610435906131c8565b82156105915761059187878787876116be565b61059b82826113d3565b6105a3610d65565b505060016065555050505050565b6105b9610e15565b6105c281611cb6565b50565b6105cd610e15565b6105c281611d42565b6105de610e15565b6105e86000611dd9565b565b6105f2610e15565b6105c281611e2b565b6002606554141561061e5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166106455760405162461bcd60e51b81526004016104359061316a565b806106625760405162461bcd60e51b81526004016104359061319a565b61066f8585858585611ecf565b610677610d65565b50506001606555505050565b600260655414156106a65760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166106cd5760405162461bcd60e51b81526004016104359061316a565b8215610591576105918787878787611ecf565b600260655414156107035760405162461bcd60e51b815260040161043590613133565b600260655560005b8181101561076357610751838383818110610728576107286131f8565b905060200201602081019061073d919061300b565b6097546001600160a01b03166000196122bd565b8061075b81613224565b91505061070b565b5050600160655550565b600260655414156107905760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166107b75760405162461bcd60e51b81526004016104359061316a565b82156105145761051486868686610aae565b600260655414156107ec5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff16156108145760405162461bcd60e51b8152600401610435906131c8565b806108315760405162461bcd60e51b81526004016104359061319a565b61066f85858585856116be565b600260655414156108615760405162461bcd60e51b815260040161043590613133565b600260655561087082826113d3565b610878610d65565b50506001606555565b600054610100900460ff16158080156108a15750600054600160ff909116105b806108bb5750303b1580156108bb575060005460ff166001145b61091e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610435565b6000805460ff191660011790558015610941576000805461ff0019166101001790555b6109496123b6565b6109516123e5565b61095b8585610e6f565b61096483611e2b565b61096d82611d42565b6109776001611cb6565b80156109bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600260655414156109e75760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff1615610a0f5760405162461bcd60e51b8152600401610435906131c8565b80610a2c5760405162461bcd60e51b81526004016104359061319a565b61048e84848484610f48565b610a40610e15565b6001600160a01b038116610aa55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610435565b6105c281611dd9565b83341015610afe5760405162461bcd60e51b815260206004820152601d60248201527f506179726f6c6c3a204e6f7420656e6f756768206d73672e76616c75650000006044820152606401610435565b6000610b08612414565b905060005b82811015610d5d576000848483818110610b2957610b296131f8565b9050602002810190610b3b919061323f565b610b4990604081019061325f565b905011610b685760405162461bcd60e51b8152600401610435906132a9565b816001600160a01b0316848483818110610b8457610b846131f8565b9050602002810190610b96919061323f565b610ba490604081019061325f565b6000818110610bb557610bb56131f8565b9050602002016020810190610bca919061300b565b6001600160a01b031614610c205760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f74206e617469766520746f6b656e00006044820152606401610435565b6000610cb1858584818110610c3757610c376131f8565b9050602002810190610c49919061323f565b35868685818110610c5c57610c5c6131f8565b9050602002810190610c6e919061323f565b60200135878786818110610c8457610c846131f8565b9050602002810190610c96919061323f565b610ca490604081019061325f565b338b63ffffffff16612496565b9050366000868685818110610cc857610cc86131f8565b9050602002810190610cda919061323f565b610ce890604081019061325f565b909250905060008051602061373a83398151915260008383610d0b6001826132d6565b818110610d1a57610d1a6131f8565b9050602002016020810190610d2f919061300b565b85604051610d3f939291906132ed565b60405180910390a15050508080610d5590613224565b915050610b0d565b505050505050565b4760018111156105c257604051600090339083908381818185875af1925050503d8060008114610db1576040519150601f19603f3d011682016040523d82523d6000602084013e610db6565b606091505b50509050806104b35760405162461bcd60e51b815260206004820152602560248201527f506179726f6c6c3a20455448206c6566744f766572207472616e736665722066604482015264185a5b195960da1b6064820152608401610435565b6033546001600160a01b031633146105e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610435565b6001600160a01b038216610edb5760405162461bcd60e51b815260206004820152602d60248201527f506179726f6c6c3a2043616e6e6f74207365742061203020616464726573732060448201526c30b99039bbb0b82937baba32b960991b6064820152608401610435565b609b805460ff1916821515908117909155609780546001600160a01b0319166001600160a01b0385169081179091556040805191825260208201929092527fa93750f85ffdb877ffb446c32e8a1033c18e7746ffdd0b42d7edee2c98e7db3c910160405180910390a15050565b83341015610f985760405162461bcd60e51b815260206004820152601d60248201527f506179726f6c6c3a204e6f7420656e6f756768206d73672e76616c75650000006044820152606401610435565b609754604080516312a9293f60e21b815290516000926001600160a01b031691634aa4a4fc916004808301926020929190829003018186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110159190613311565b905060005b82811015611363576000848483818110611036576110366131f8565b9050602002810190611048919061323f565b61105690604081019061332e565b9050116110755760405162461bcd60e51b8152600401610435906132a9565b816001600160a01b03166111306014868685818110611096576110966131f8565b90506020028101906110a8919061323f565b6110b690604081019061332e565b6110c19291506132d6565b8686858181106110d3576110d36131f8565b90506020028101906110e5919061323f565b6110f390604081019061332e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061254d9050565b6001600160a01b0316146111865760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f74206e617469766520746f6b656e00006044820152606401610435565b6097546000906001600160a01b031663f28c04988686858181106111ac576111ac6131f8565b90506020028101906111be919061323f565b602001356040518060a001604052808989888181106111df576111df6131f8565b90506020028101906111f1919061323f565b6111ff90604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602082015263ffffffff8b16604082015260600189898881811061125d5761125d6131f8565b905060200281019061126f919061323f565b358152602001898988818110611287576112876131f8565b9050602002810190611299919061323f565b602001358152506040518363ffffffff1660e01b81526004016112bc91906133a5565b6020604051808303818588803b1580156112d557600080fd5b505af11580156112e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061130e9190613414565b905060008051602061373a833981519152600061133860008888878181106110d3576110d36131f8565b83604051611348939291906132ed565b60405180910390a1508061135b81613224565b91505061101a565b50609760009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156113b457600080fd5b505af11580156113c8573d6000803e3d6000fd5b505050505050505050565b60005b818110156116b95760008383838181106113f2576113f26131f8565b9050602002810190611404919061323f565b61141290604081019061325f565b9050116114615760405162461bcd60e51b815260206004820152601f60248201527f506179726f6c6c3a204e6f20616d6f756e747320746f207472616e73666572006044820152606401610435565b828282818110611473576114736131f8565b9050602002810190611485919061323f565b61149390602081019061325f565b90508383838181106114a7576114a76131f8565b90506020028101906114b9919061323f565b6114c790604081019061325f565b9050146115245760405162461bcd60e51b815260206004820152602560248201527f506179726f6c6c3a20417272617973206d75737420686176652073616d65206c6044820152640cadccee8d60db1b6064820152608401610435565b6000838383818110611538576115386131f8565b905060200281019061154a919061323f565b61155890602081019061300b565b6001600160a01b0316146116095761160483838381811061157b5761157b6131f8565b905060200281019061158d919061323f565b61159b90602081019061300b565b8484848181106115ad576115ad6131f8565b90506020028101906115bf919061323f565b6115cd90602081019061325f565b8686868181106115df576115df6131f8565b90506020028101906115f1919061323f565b6115ff90604081019061325f565b612601565b6116a7565b6116a783838381811061161e5761161e6131f8565b9050602002810190611630919061323f565b61163e90602081019061300b565b848484818110611650576116506131f8565b9050602002810190611662919061323f565b61167090602081019061325f565b868686818110611682576116826131f8565b9050602002810190611694919061323f565b6116a290604081019061325f565b6127b4565b806116b181613224565b9150506113d6565b505050565b6116ca85333087612a87565b609754604080516312a9293f60e21b815290516000926001600160a01b031691634aa4a4fc916004808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190613311565b90506000805b83811015611c1e576000858583818110611769576117696131f8565b905060200281019061177b919061323f565b61178990604081019061332e565b9050116117a85760405162461bcd60e51b8152600401610435906132a9565b876001600160a01b031661180660148787858181106117c9576117c96131f8565b90506020028101906117db919061323f565b6117e990604081019061332e565b6117f49291506132d6565b8787858181106110d3576110d36131f8565b6001600160a01b03161461185c5760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f7420746f6b656e206f726967696e00006044820152606401610435565b600061187560008787858181106110d3576110d36131f8565b9050836001600160a01b0316816001600160a01b03161415611a7d576097546040805160a081019091526001600160a01b039091169063f28c049890808989878181106118c4576118c46131f8565b90506020028101906118d6919061323f565b6118e490604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525030602082015263ffffffff8b166040820152606001898987818110611942576119426131f8565b9050602002810190611954919061323f565b35815260200189898781811061196c5761196c6131f8565b905060200281019061197e919061323f565b602001358152506040518263ffffffff1660e01b81526004016119a191906133a5565b602060405180830381600087803b1580156119bb57600080fd5b505af11580156119cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f39190613414565b9250836001600160a01b0316632e1a7d4d878785818110611a1657611a166131f8565b9050602002810190611a28919061323f565b60405160e083901b6001600160e01b031916815290356004820152602401600060405180830381600087803b158015611a6057600080fd5b505af1158015611a74573d6000803e3d6000fd5b50505050611be2565b6097546040805160a081019091526001600160a01b039091169063f28c04989080898987818110611ab057611ab06131f8565b9050602002810190611ac2919061323f565b611ad090604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602082015263ffffffff8b166040820152606001898987818110611b2e57611b2e6131f8565b9050602002810190611b40919061323f565b358152602001898987818110611b5857611b586131f8565b9050602002810190611b6a919061323f565b602001358152506040518263ffffffff1660e01b8152600401611b8d91906133a5565b602060405180830381600087803b158015611ba757600080fd5b505af1158015611bbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bdf9190613414565b92505b60008051602061373a833981519152898285604051611c03939291906132ed565b60405180910390a15080611c1681613224565b91505061174d565b506040516370a0823160e01b81523060048201526000906001600160a01b038916906370a082319060240160206040518083038186803b158015611c6157600080fd5b505afa158015611c75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c999190613414565b90508015611cac57611cac883383612b8d565b5050505050505050565b60008111611d065760405162461bcd60e51b815260206004820152601b60248201527f506179726f6c6c3a2056657273696f6e2063616e2774206265203000000000006044820152606401610435565b609a8190556040518181527fd559f56ba9b2c69da3765a6d0208c7f7f352ade55a3be7fb9589ba50aa4ce5f3906020015b60405180910390a150565b666a94d74f4300008110611da45760405162461bcd60e51b815260206004820152602360248201527f506179726f6c6c3a204665652073686f756c64206265206c657373207468616e60448201526220332560e81b6064820152608401610435565b60998190556040518181527f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c390602001611d37565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116611e815760405162461bcd60e51b815260206004820152601f60248201527f506179726f6c6c3a2046656520616464726573732063616e27742062652030006044820152606401610435565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527fd1e93c69f2847f79bfa4d71704aaa84a581729b4b1706d922ee42ba1848a45c990602001611d37565b611edb85333087612a87565b6000804661a4ec14158015611ef257504661aef314155b15611f0257611eff612414565b90505b60005b83811015611c1e576000858583818110611f2157611f216131f8565b9050602002810190611f33919061323f565b611f4190604081019061325f565b905011611f605760405162461bcd60e51b8152600401610435906132a9565b876001600160a01b0316858583818110611f7c57611f7c6131f8565b9050602002810190611f8e919061323f565b611f9c90604081019061325f565b6000818110611fad57611fad6131f8565b9050602002016020810190611fc2919061300b565b6001600160a01b0316146120185760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f7420746f6b656e206f726967696e00006044820152606401610435565b816001600160a01b0316858583818110612034576120346131f8565b9050602002810190612046919061323f565b61205490604081019061325f565b6001888886818110612068576120686131f8565b905060200281019061207a919061323f565b61208890604081019061325f565b6120939291506132d6565b8181106120a2576120a26131f8565b90506020020160208101906120b7919061300b565b6001600160a01b0316141561215c576121558585838181106120db576120db6131f8565b90506020028101906120ed919061323f565b35868684818110612100576121006131f8565b9050602002810190612112919061323f565b60200135878785818110612128576121286131f8565b905060200281019061213a919061323f565b61214890604081019061325f565b308b63ffffffff16612c86565b92506121ee565b6121eb858583818110612171576121716131f8565b9050602002810190612183919061323f565b35868684818110612196576121966131f8565b90506020028101906121a8919061323f565b602001358787858181106121be576121be6131f8565b90506020028101906121d0919061323f565b6121de90604081019061325f565b338b63ffffffff16612d17565b92505b60008051602061373a83398151915288868684818110612210576122106131f8565b9050602002810190612222919061323f565b61223090604081019061325f565b6001898987818110612244576122446131f8565b9050602002810190612256919061323f565b61226490604081019061325f565b61226f9291506132d6565b81811061227e5761227e6131f8565b9050602002016020810190612293919061300b565b856040516122a3939291906132ed565b60405180910390a1806122b581613224565b915050611f05565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1790529151600092839290871691612319919061342d565b6000604051808303816000865af19150503d8060008114612356576040519150601f19603f3d011682016040523d82523d6000602084013e61235b565b606091505b5091509150818015612385575080511580612385575080806020019051810190612385919061343f565b6109bd5760405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606401610435565b600054610100900460ff166123dd5760405162461bcd60e51b81526004016104359061345c565b6105e8612d52565b600054610100900460ff1661240c5760405162461bcd60e51b81526004016104359061345c565b6105e8612d80565b609754604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c4648916004808301926020929190829003018186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613311565b905090565b60975460405163fb3bdb4160e01b81526000916001600160a01b03169063fb3bdb419088906124d1908b908a908a908a908a906004016134f0565b6000604051808303818588803b1580156124ea57600080fd5b505af11580156124fe573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612527919081019061353d565b600081518110612539576125396131f8565b602002602001015190509695505050505050565b60008161255b8160146135fb565b101561259e5760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b6044820152606401610435565b6125a98260146135fb565b835110156125f15760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610435565b500160200151600160601b900490565b60008060005b858110156126e1576000878783818110612623576126236131f8565b9050602002016020810190612638919061300b565b6001600160a01b0316141561265f5760405162461bcd60e51b815260040161043590613613565b848482818110612671576126716131f8565b905060200201358261268391906135fb565b91506126cf883389898581811061269c5761269c6131f8565b90506020020160208101906126b1919061300b565b8888868181106126c3576126c36131f8565b90506020020135612a87565b806126d981613224565b915050612607565b507f61296616dea919da05ed0d5608a730a6f4f39d0703b9d8819da47e233c9a92d98787878787604051612719959493929190613656565b60405180910390a1670de0b6b3a76400006099548261273891906136ba565b61274291906136d9565b915081156127645760985461276490889033906001600160a01b031685612a87565b6098546040517f945458c62aa39df7a4d87d6c4dbaaab7de5d870c9a1fe40e2b7571d84f158a8d916127a3918a916001600160a01b03169086906132ed565b60405180910390a150505050505050565b60008060005b8581101561292c5760008787838181106127d6576127d66131f8565b90506020020160208101906127eb919061300b565b6001600160a01b031614156128125760405162461bcd60e51b815260040161043590613613565b848482818110612824576128246131f8565b905060200201358261283691906135fb565b9150600087878381811061284c5761284c6131f8565b9050602002016020810190612861919061300b565b6001600160a01b031686868481811061287c5761287c6131f8565b9050602002013560405160006040518083038185875af1925050503d80600081146128c3576040519150601f19603f3d011682016040523d82523d6000602084013e6128c8565b606091505b50509050806129195760405162461bcd60e51b815260206004820152601c60248201527f506179726f6c6c3a20455448207472616e73666572206661696c6564000000006044820152606401610435565b508061292481613224565b9150506127ba565b507f61296616dea919da05ed0d5608a730a6f4f39d0703b9d8819da47e233c9a92d98787878787604051612964959493929190613656565b60405180910390a1670de0b6b3a76400006099548261298391906136ba565b61298d91906136d9565b915081156127645761299f82826135fb565b6098546040519192506000916001600160a01b039091169084908381818185875af1925050503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5050905080612a475760405162461bcd60e51b815260206004820181905260248201527f506179726f6c6c3a2045544820666565207472616e73666572206661696c65646044820152606401610435565b506098546040517f945458c62aa39df7a4d87d6c4dbaaab7de5d870c9a1fe40e2b7571d84f158a8d916127a3918a916001600160a01b03169086906132ed565b600080856001600160a01b03166323b872dd60e01b868686604051602401612ab1939291906132ed565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612aef919061342d565b6000604051808303816000865af19150503d8060008114612b2c576040519150601f19603f3d011682016040523d82523d6000602084013e612b31565b606091505b5091509150818015612b5b575080511580612b5b575080806020019051810190612b5b919061343f565b610d5d5760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b6044820152606401610435565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691612be9919061342d565b6000604051808303816000865af19150503d8060008114612c26576040519150601f19603f3d011682016040523d82523d6000602084013e612c2b565b606091505b5091509150818015612c55575080511580612c55575080806020019051810190612c55919061343f565b6109bd5760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610435565b609754604051632512eca560e11b81526000916001600160a01b031690634a25d94a90612cc1908a908a908a908a908a908a906004016136fb565b600060405180830381600087803b158015612cdb57600080fd5b505af1158015612cef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612527919081019061353d565b609754604051634401edf760e11b81526000916001600160a01b031690638803dbee90612cc1908a908a908a908a908a908a906004016136fb565b600054610100900460ff16612d795760405162461bcd60e51b81526004016104359061345c565b6001606555565b600054610100900460ff16612da75760405162461bcd60e51b81526004016104359061345c565b6105e833611dd9565b803563ffffffff81168114612dc457600080fd5b919050565b60008083601f840112612ddb57600080fd5b50813567ffffffffffffffff811115612df357600080fd5b6020830191508360208260051b8501011115612e0e57600080fd5b9250929050565b60008060008060608587031215612e2b57600080fd5b84359350612e3b60208601612db0565b9250604085013567ffffffffffffffff811115612e5757600080fd5b612e6387828801612dc9565b95989497509550505050565b6001600160a01b03811681146105c257600080fd5b80151581146105c257600080fd5b60008060408385031215612ea557600080fd5b8235612eb081612e6f565b91506020830135612ec081612e84565b809150509250929050565b60008060008060008060808789031215612ee457600080fd5b86359550612ef460208801612db0565b9450604087013567ffffffffffffffff80821115612f1157600080fd5b612f1d8a838b01612dc9565b90965094506060890135915080821115612f3657600080fd5b50612f4389828a01612dc9565b979a9699509497509295939492505050565b600080600080600080600060a0888a031215612f7057600080fd5b8735612f7b81612e6f565b965060208801359550612f9060408901612db0565b9450606088013567ffffffffffffffff80821115612fad57600080fd5b612fb98b838c01612dc9565b909650945060808a0135915080821115612fd257600080fd5b50612fdf8a828b01612dc9565b989b979a50959850939692959293505050565b60006020828403121561300457600080fd5b5035919050565b60006020828403121561301d57600080fd5b813561302881612e6f565b9392505050565b60008060008060006080868803121561304757600080fd5b853561305281612e6f565b94506020860135935061306760408701612db0565b9250606086013567ffffffffffffffff81111561308357600080fd5b61308f88828901612dc9565b969995985093965092949392505050565b600080602083850312156130b357600080fd5b823567ffffffffffffffff8111156130ca57600080fd5b6130d685828601612dc9565b90969095509350505050565b600080600080608085870312156130f857600080fd5b843561310381612e6f565b9350602085013561311381612e84565b9250604085013561312381612e6f565b9396929550929360600135925050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601690820152752830bcb937b6361d102737ba103ab734b9bbb0b82b1960511b604082015260600190565b602080825260149082015273506179726f6c6c3a20456d70747920737761707360601b604082015260600190565b602080825260169082015275506179726f6c6c3a204e6f7420756e6973776170563360501b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156132385761323861320e565b5060010190565b60008235605e1983360301811261325557600080fd5b9190910192915050565b6000808335601e1984360301811261327657600080fd5b83018035915067ffffffffffffffff82111561329157600080fd5b6020019150600581901b3603821315612e0e57600080fd5b6020808252601390820152720a0c2f2e4ded8d874408adae0e8f240e0c2e8d606b1b604082015260600190565b6000828210156132e8576132e861320e565b500390565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561332357600080fd5b815161302881612e6f565b6000808335601e1984360301811261334557600080fd5b83018035915067ffffffffffffffff82111561336057600080fd5b602001915036819003821315612e0e57600080fd5b60005b83811015613390578181015183820152602001613378565b8381111561339f576000848401525b50505050565b602081526000825160a0602084015280518060c08501526133cd8160e0860160208501613375565b60018060a01b0360208601511660408501526040850151606085015260608501516080850152608085015160a085015260e0601f19601f8301168501019250505092915050565b60006020828403121561342657600080fd5b5051919050565b60008251613255818460208701613375565b60006020828403121561345157600080fd5b815161302881612e84565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8183526000602080850194508260005b858110156134e55781356134ca81612e6f565b6001600160a01b0316875295820195908201906001016134b7565b509495945050505050565b85815260806020820152600061350a6080830186886134a7565b6001600160a01b0394909416604083015250606001529392505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561355057600080fd5b825167ffffffffffffffff8082111561356857600080fd5b818501915085601f83011261357c57600080fd5b81518181111561358e5761358e613527565b8060051b604051601f19603f830116810181811085821117156135b3576135b3613527565b6040529182528482019250838101850191888311156135d157600080fd5b938501935b828510156135ef578451845293850193928501926135d6565b98975050505050505050565b6000821982111561360e5761360e61320e565b500190565b60208082526023908201527f506179726f6c6c3a2043616e6e6f742073656e6420746f20612030206164647260408201526265737360e81b606082015260800190565b6001600160a01b038616815260606020820181905260009061367b90830186886134a7565b82810360408401528381526001600160fb1b0384111561369a57600080fd5b8360051b8086602084013760009101602001908152979650505050505050565b60008160001904831182151516156136d4576136d461320e565b500290565b6000826136f657634e487b7160e01b600052601260045260246000fd5b500490565b86815285602082015260a06040820152600061371b60a0830186886134a7565b6001600160a01b03949094166060830152506080015294935050505056fe2d8d9d7f49599a20c9e475f932138bdf56ab8ddbcd627a642030d3d788012b56a2646970667358221220032d899ddc611c3037928262a6badf9cde05f436e4e55c56bcc5cb723183f98864736f6c63430008090033
Deployed ByteCode
0x60806040526004361061014f5760003560e01c80638da5cb5b116100b6578063db9d03341161006f578063db9d03341461036c578063ddca3f431461037f578063ef6aa26414610395578063f1b01903146103b5578063f2fde38b146103c8578063f65a83cf146103e857600080fd5b80638da5cb5b146102c857806392721482146102e6578063ac43070b146102f9578063bbc5ffb714610319578063c31c9c071461032c578063d8ca72361461034c57600080fd5b80634127535811610108578063412753581461020557806354fd4d501461023d57806369fe0e2d14610253578063715018a6146102735780638705fcd414610288578063887a622a146102a857600080fd5b80630e7ab0c31461015b5780632171dcc9146101705780632703984c1461019057806332b20df8146101bf578063395ae6a3146101d2578063408def1e146101e557600080fd5b3661015657005b600080fd5b61016e610169366004612e15565b610412565b005b34801561017c57600080fd5b5061016e61018b366004612e92565b6104a1565b34801561019c57600080fd5b506101ac670de0b6b3a764000081565b6040519081526020015b60405180910390f35b61016e6101cd366004612ecb565b6104b7565b61016e6101e0366004612f55565b610533565b3480156101f157600080fd5b5061016e610200366004612ff2565b6105b1565b34801561021157600080fd5b50609854610225906001600160a01b031681565b6040516001600160a01b0390911681526020016101b6565b34801561024957600080fd5b506101ac609a5481565b34801561025f57600080fd5b5061016e61026e366004612ff2565b6105c5565b34801561027f57600080fd5b5061016e6105d6565b34801561029457600080fd5b5061016e6102a336600461300b565b6105ea565b3480156102b457600080fd5b5061016e6102c336600461302f565b6105fb565b3480156102d457600080fd5b506033546001600160a01b0316610225565b61016e6102f4366004612f55565b610683565b34801561030557600080fd5b5061016e6103143660046130a0565b6106e0565b61016e610327366004612ecb565b61076d565b34801561033857600080fd5b50609754610225906001600160a01b031681565b34801561035857600080fd5b5061016e61036736600461302f565b6107c9565b61016e61037a3660046130a0565b61083e565b34801561038b57600080fd5b506101ac60995481565b3480156103a157600080fd5b5061016e6103b03660046130e2565b610881565b61016e6103c3366004612e15565b6109c4565b3480156103d457600080fd5b5061016e6103e336600461300b565b610a38565b3480156103f457600080fd5b50609b546104029060ff1681565b60405190151581526020016101b6565b6002606554141561043e5760405162461bcd60e51b815260040161043590613133565b60405180910390fd5b6002606555609b5460ff166104655760405162461bcd60e51b81526004016104359061316a565b806104825760405162461bcd60e51b81526004016104359061319a565b61048e84848484610aae565b610496610d65565b505060016065555050565b6104a9610e15565b6104b38282610e6f565b5050565b600260655414156104da5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff16156105025760405162461bcd60e51b8152600401610435906131c8565b82156105145761051486868686610f48565b61051e82826113d3565b610526610d65565b5050600160655550505050565b600260655414156105565760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff161561057e5760405162461bcd60e51b8152600401610435906131c8565b82156105915761059187878787876116be565b61059b82826113d3565b6105a3610d65565b505060016065555050505050565b6105b9610e15565b6105c281611cb6565b50565b6105cd610e15565b6105c281611d42565b6105de610e15565b6105e86000611dd9565b565b6105f2610e15565b6105c281611e2b565b6002606554141561061e5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166106455760405162461bcd60e51b81526004016104359061316a565b806106625760405162461bcd60e51b81526004016104359061319a565b61066f8585858585611ecf565b610677610d65565b50506001606555505050565b600260655414156106a65760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166106cd5760405162461bcd60e51b81526004016104359061316a565b8215610591576105918787878787611ecf565b600260655414156107035760405162461bcd60e51b815260040161043590613133565b600260655560005b8181101561076357610751838383818110610728576107286131f8565b905060200201602081019061073d919061300b565b6097546001600160a01b03166000196122bd565b8061075b81613224565b91505061070b565b5050600160655550565b600260655414156107905760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff166107b75760405162461bcd60e51b81526004016104359061316a565b82156105145761051486868686610aae565b600260655414156107ec5760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff16156108145760405162461bcd60e51b8152600401610435906131c8565b806108315760405162461bcd60e51b81526004016104359061319a565b61066f85858585856116be565b600260655414156108615760405162461bcd60e51b815260040161043590613133565b600260655561087082826113d3565b610878610d65565b50506001606555565b600054610100900460ff16158080156108a15750600054600160ff909116105b806108bb5750303b1580156108bb575060005460ff166001145b61091e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610435565b6000805460ff191660011790558015610941576000805461ff0019166101001790555b6109496123b6565b6109516123e5565b61095b8585610e6f565b61096483611e2b565b61096d82611d42565b6109776001611cb6565b80156109bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600260655414156109e75760405162461bcd60e51b815260040161043590613133565b6002606555609b5460ff1615610a0f5760405162461bcd60e51b8152600401610435906131c8565b80610a2c5760405162461bcd60e51b81526004016104359061319a565b61048e84848484610f48565b610a40610e15565b6001600160a01b038116610aa55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610435565b6105c281611dd9565b83341015610afe5760405162461bcd60e51b815260206004820152601d60248201527f506179726f6c6c3a204e6f7420656e6f756768206d73672e76616c75650000006044820152606401610435565b6000610b08612414565b905060005b82811015610d5d576000848483818110610b2957610b296131f8565b9050602002810190610b3b919061323f565b610b4990604081019061325f565b905011610b685760405162461bcd60e51b8152600401610435906132a9565b816001600160a01b0316848483818110610b8457610b846131f8565b9050602002810190610b96919061323f565b610ba490604081019061325f565b6000818110610bb557610bb56131f8565b9050602002016020810190610bca919061300b565b6001600160a01b031614610c205760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f74206e617469766520746f6b656e00006044820152606401610435565b6000610cb1858584818110610c3757610c376131f8565b9050602002810190610c49919061323f565b35868685818110610c5c57610c5c6131f8565b9050602002810190610c6e919061323f565b60200135878786818110610c8457610c846131f8565b9050602002810190610c96919061323f565b610ca490604081019061325f565b338b63ffffffff16612496565b9050366000868685818110610cc857610cc86131f8565b9050602002810190610cda919061323f565b610ce890604081019061325f565b909250905060008051602061373a83398151915260008383610d0b6001826132d6565b818110610d1a57610d1a6131f8565b9050602002016020810190610d2f919061300b565b85604051610d3f939291906132ed565b60405180910390a15050508080610d5590613224565b915050610b0d565b505050505050565b4760018111156105c257604051600090339083908381818185875af1925050503d8060008114610db1576040519150601f19603f3d011682016040523d82523d6000602084013e610db6565b606091505b50509050806104b35760405162461bcd60e51b815260206004820152602560248201527f506179726f6c6c3a20455448206c6566744f766572207472616e736665722066604482015264185a5b195960da1b6064820152608401610435565b6033546001600160a01b031633146105e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610435565b6001600160a01b038216610edb5760405162461bcd60e51b815260206004820152602d60248201527f506179726f6c6c3a2043616e6e6f74207365742061203020616464726573732060448201526c30b99039bbb0b82937baba32b960991b6064820152608401610435565b609b805460ff1916821515908117909155609780546001600160a01b0319166001600160a01b0385169081179091556040805191825260208201929092527fa93750f85ffdb877ffb446c32e8a1033c18e7746ffdd0b42d7edee2c98e7db3c910160405180910390a15050565b83341015610f985760405162461bcd60e51b815260206004820152601d60248201527f506179726f6c6c3a204e6f7420656e6f756768206d73672e76616c75650000006044820152606401610435565b609754604080516312a9293f60e21b815290516000926001600160a01b031691634aa4a4fc916004808301926020929190829003018186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110159190613311565b905060005b82811015611363576000848483818110611036576110366131f8565b9050602002810190611048919061323f565b61105690604081019061332e565b9050116110755760405162461bcd60e51b8152600401610435906132a9565b816001600160a01b03166111306014868685818110611096576110966131f8565b90506020028101906110a8919061323f565b6110b690604081019061332e565b6110c19291506132d6565b8686858181106110d3576110d36131f8565b90506020028101906110e5919061323f565b6110f390604081019061332e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061254d9050565b6001600160a01b0316146111865760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f74206e617469766520746f6b656e00006044820152606401610435565b6097546000906001600160a01b031663f28c04988686858181106111ac576111ac6131f8565b90506020028101906111be919061323f565b602001356040518060a001604052808989888181106111df576111df6131f8565b90506020028101906111f1919061323f565b6111ff90604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602082015263ffffffff8b16604082015260600189898881811061125d5761125d6131f8565b905060200281019061126f919061323f565b358152602001898988818110611287576112876131f8565b9050602002810190611299919061323f565b602001358152506040518363ffffffff1660e01b81526004016112bc91906133a5565b6020604051808303818588803b1580156112d557600080fd5b505af11580156112e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061130e9190613414565b905060008051602061373a833981519152600061133860008888878181106110d3576110d36131f8565b83604051611348939291906132ed565b60405180910390a1508061135b81613224565b91505061101a565b50609760009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156113b457600080fd5b505af11580156113c8573d6000803e3d6000fd5b505050505050505050565b60005b818110156116b95760008383838181106113f2576113f26131f8565b9050602002810190611404919061323f565b61141290604081019061325f565b9050116114615760405162461bcd60e51b815260206004820152601f60248201527f506179726f6c6c3a204e6f20616d6f756e747320746f207472616e73666572006044820152606401610435565b828282818110611473576114736131f8565b9050602002810190611485919061323f565b61149390602081019061325f565b90508383838181106114a7576114a76131f8565b90506020028101906114b9919061323f565b6114c790604081019061325f565b9050146115245760405162461bcd60e51b815260206004820152602560248201527f506179726f6c6c3a20417272617973206d75737420686176652073616d65206c6044820152640cadccee8d60db1b6064820152608401610435565b6000838383818110611538576115386131f8565b905060200281019061154a919061323f565b61155890602081019061300b565b6001600160a01b0316146116095761160483838381811061157b5761157b6131f8565b905060200281019061158d919061323f565b61159b90602081019061300b565b8484848181106115ad576115ad6131f8565b90506020028101906115bf919061323f565b6115cd90602081019061325f565b8686868181106115df576115df6131f8565b90506020028101906115f1919061323f565b6115ff90604081019061325f565b612601565b6116a7565b6116a783838381811061161e5761161e6131f8565b9050602002810190611630919061323f565b61163e90602081019061300b565b848484818110611650576116506131f8565b9050602002810190611662919061323f565b61167090602081019061325f565b868686818110611682576116826131f8565b9050602002810190611694919061323f565b6116a290604081019061325f565b6127b4565b806116b181613224565b9150506113d6565b505050565b6116ca85333087612a87565b609754604080516312a9293f60e21b815290516000926001600160a01b031691634aa4a4fc916004808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190613311565b90506000805b83811015611c1e576000858583818110611769576117696131f8565b905060200281019061177b919061323f565b61178990604081019061332e565b9050116117a85760405162461bcd60e51b8152600401610435906132a9565b876001600160a01b031661180660148787858181106117c9576117c96131f8565b90506020028101906117db919061323f565b6117e990604081019061332e565b6117f49291506132d6565b8787858181106110d3576110d36131f8565b6001600160a01b03161461185c5760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f7420746f6b656e206f726967696e00006044820152606401610435565b600061187560008787858181106110d3576110d36131f8565b9050836001600160a01b0316816001600160a01b03161415611a7d576097546040805160a081019091526001600160a01b039091169063f28c049890808989878181106118c4576118c46131f8565b90506020028101906118d6919061323f565b6118e490604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525030602082015263ffffffff8b166040820152606001898987818110611942576119426131f8565b9050602002810190611954919061323f565b35815260200189898781811061196c5761196c6131f8565b905060200281019061197e919061323f565b602001358152506040518263ffffffff1660e01b81526004016119a191906133a5565b602060405180830381600087803b1580156119bb57600080fd5b505af11580156119cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f39190613414565b9250836001600160a01b0316632e1a7d4d878785818110611a1657611a166131f8565b9050602002810190611a28919061323f565b60405160e083901b6001600160e01b031916815290356004820152602401600060405180830381600087803b158015611a6057600080fd5b505af1158015611a74573d6000803e3d6000fd5b50505050611be2565b6097546040805160a081019091526001600160a01b039091169063f28c04989080898987818110611ab057611ab06131f8565b9050602002810190611ac2919061323f565b611ad090604081019061332e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602082015263ffffffff8b166040820152606001898987818110611b2e57611b2e6131f8565b9050602002810190611b40919061323f565b358152602001898987818110611b5857611b586131f8565b9050602002810190611b6a919061323f565b602001358152506040518263ffffffff1660e01b8152600401611b8d91906133a5565b602060405180830381600087803b158015611ba757600080fd5b505af1158015611bbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bdf9190613414565b92505b60008051602061373a833981519152898285604051611c03939291906132ed565b60405180910390a15080611c1681613224565b91505061174d565b506040516370a0823160e01b81523060048201526000906001600160a01b038916906370a082319060240160206040518083038186803b158015611c6157600080fd5b505afa158015611c75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c999190613414565b90508015611cac57611cac883383612b8d565b5050505050505050565b60008111611d065760405162461bcd60e51b815260206004820152601b60248201527f506179726f6c6c3a2056657273696f6e2063616e2774206265203000000000006044820152606401610435565b609a8190556040518181527fd559f56ba9b2c69da3765a6d0208c7f7f352ade55a3be7fb9589ba50aa4ce5f3906020015b60405180910390a150565b666a94d74f4300008110611da45760405162461bcd60e51b815260206004820152602360248201527f506179726f6c6c3a204665652073686f756c64206265206c657373207468616e60448201526220332560e81b6064820152608401610435565b60998190556040518181527f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c390602001611d37565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116611e815760405162461bcd60e51b815260206004820152601f60248201527f506179726f6c6c3a2046656520616464726573732063616e27742062652030006044820152606401610435565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527fd1e93c69f2847f79bfa4d71704aaa84a581729b4b1706d922ee42ba1848a45c990602001611d37565b611edb85333087612a87565b6000804661a4ec14158015611ef257504661aef314155b15611f0257611eff612414565b90505b60005b83811015611c1e576000858583818110611f2157611f216131f8565b9050602002810190611f33919061323f565b611f4190604081019061325f565b905011611f605760405162461bcd60e51b8152600401610435906132a9565b876001600160a01b0316858583818110611f7c57611f7c6131f8565b9050602002810190611f8e919061323f565b611f9c90604081019061325f565b6000818110611fad57611fad6131f8565b9050602002016020810190611fc2919061300b565b6001600160a01b0316146120185760405162461bcd60e51b815260206004820152601e60248201527f506179726f6c6c3a2053776170206e6f7420746f6b656e206f726967696e00006044820152606401610435565b816001600160a01b0316858583818110612034576120346131f8565b9050602002810190612046919061323f565b61205490604081019061325f565b6001888886818110612068576120686131f8565b905060200281019061207a919061323f565b61208890604081019061325f565b6120939291506132d6565b8181106120a2576120a26131f8565b90506020020160208101906120b7919061300b565b6001600160a01b0316141561215c576121558585838181106120db576120db6131f8565b90506020028101906120ed919061323f565b35868684818110612100576121006131f8565b9050602002810190612112919061323f565b60200135878785818110612128576121286131f8565b905060200281019061213a919061323f565b61214890604081019061325f565b308b63ffffffff16612c86565b92506121ee565b6121eb858583818110612171576121716131f8565b9050602002810190612183919061323f565b35868684818110612196576121966131f8565b90506020028101906121a8919061323f565b602001358787858181106121be576121be6131f8565b90506020028101906121d0919061323f565b6121de90604081019061325f565b338b63ffffffff16612d17565b92505b60008051602061373a83398151915288868684818110612210576122106131f8565b9050602002810190612222919061323f565b61223090604081019061325f565b6001898987818110612244576122446131f8565b9050602002810190612256919061323f565b61226490604081019061325f565b61226f9291506132d6565b81811061227e5761227e6131f8565b9050602002016020810190612293919061300b565b856040516122a3939291906132ed565b60405180910390a1806122b581613224565b915050611f05565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1790529151600092839290871691612319919061342d565b6000604051808303816000865af19150503d8060008114612356576040519150601f19603f3d011682016040523d82523d6000602084013e61235b565b606091505b5091509150818015612385575080511580612385575080806020019051810190612385919061343f565b6109bd5760405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606401610435565b600054610100900460ff166123dd5760405162461bcd60e51b81526004016104359061345c565b6105e8612d52565b600054610100900460ff1661240c5760405162461bcd60e51b81526004016104359061345c565b6105e8612d80565b609754604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c4648916004808301926020929190829003018186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613311565b905090565b60975460405163fb3bdb4160e01b81526000916001600160a01b03169063fb3bdb419088906124d1908b908a908a908a908a906004016134f0565b6000604051808303818588803b1580156124ea57600080fd5b505af11580156124fe573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612527919081019061353d565b600081518110612539576125396131f8565b602002602001015190509695505050505050565b60008161255b8160146135fb565b101561259e5760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b6044820152606401610435565b6125a98260146135fb565b835110156125f15760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610435565b500160200151600160601b900490565b60008060005b858110156126e1576000878783818110612623576126236131f8565b9050602002016020810190612638919061300b565b6001600160a01b0316141561265f5760405162461bcd60e51b815260040161043590613613565b848482818110612671576126716131f8565b905060200201358261268391906135fb565b91506126cf883389898581811061269c5761269c6131f8565b90506020020160208101906126b1919061300b565b8888868181106126c3576126c36131f8565b90506020020135612a87565b806126d981613224565b915050612607565b507f61296616dea919da05ed0d5608a730a6f4f39d0703b9d8819da47e233c9a92d98787878787604051612719959493929190613656565b60405180910390a1670de0b6b3a76400006099548261273891906136ba565b61274291906136d9565b915081156127645760985461276490889033906001600160a01b031685612a87565b6098546040517f945458c62aa39df7a4d87d6c4dbaaab7de5d870c9a1fe40e2b7571d84f158a8d916127a3918a916001600160a01b03169086906132ed565b60405180910390a150505050505050565b60008060005b8581101561292c5760008787838181106127d6576127d66131f8565b90506020020160208101906127eb919061300b565b6001600160a01b031614156128125760405162461bcd60e51b815260040161043590613613565b848482818110612824576128246131f8565b905060200201358261283691906135fb565b9150600087878381811061284c5761284c6131f8565b9050602002016020810190612861919061300b565b6001600160a01b031686868481811061287c5761287c6131f8565b9050602002013560405160006040518083038185875af1925050503d80600081146128c3576040519150601f19603f3d011682016040523d82523d6000602084013e6128c8565b606091505b50509050806129195760405162461bcd60e51b815260206004820152601c60248201527f506179726f6c6c3a20455448207472616e73666572206661696c6564000000006044820152606401610435565b508061292481613224565b9150506127ba565b507f61296616dea919da05ed0d5608a730a6f4f39d0703b9d8819da47e233c9a92d98787878787604051612964959493929190613656565b60405180910390a1670de0b6b3a76400006099548261298391906136ba565b61298d91906136d9565b915081156127645761299f82826135fb565b6098546040519192506000916001600160a01b039091169084908381818185875af1925050503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5050905080612a475760405162461bcd60e51b815260206004820181905260248201527f506179726f6c6c3a2045544820666565207472616e73666572206661696c65646044820152606401610435565b506098546040517f945458c62aa39df7a4d87d6c4dbaaab7de5d870c9a1fe40e2b7571d84f158a8d916127a3918a916001600160a01b03169086906132ed565b600080856001600160a01b03166323b872dd60e01b868686604051602401612ab1939291906132ed565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612aef919061342d565b6000604051808303816000865af19150503d8060008114612b2c576040519150601f19603f3d011682016040523d82523d6000602084013e612b31565b606091505b5091509150818015612b5b575080511580612b5b575080806020019051810190612b5b919061343f565b610d5d5760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b6044820152606401610435565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691612be9919061342d565b6000604051808303816000865af19150503d8060008114612c26576040519150601f19603f3d011682016040523d82523d6000602084013e612c2b565b606091505b5091509150818015612c55575080511580612c55575080806020019051810190612c55919061343f565b6109bd5760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610435565b609754604051632512eca560e11b81526000916001600160a01b031690634a25d94a90612cc1908a908a908a908a908a908a906004016136fb565b600060405180830381600087803b158015612cdb57600080fd5b505af1158015612cef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612527919081019061353d565b609754604051634401edf760e11b81526000916001600160a01b031690638803dbee90612cc1908a908a908a908a908a908a906004016136fb565b600054610100900460ff16612d795760405162461bcd60e51b81526004016104359061345c565b6001606555565b600054610100900460ff16612da75760405162461bcd60e51b81526004016104359061345c565b6105e833611dd9565b803563ffffffff81168114612dc457600080fd5b919050565b60008083601f840112612ddb57600080fd5b50813567ffffffffffffffff811115612df357600080fd5b6020830191508360208260051b8501011115612e0e57600080fd5b9250929050565b60008060008060608587031215612e2b57600080fd5b84359350612e3b60208601612db0565b9250604085013567ffffffffffffffff811115612e5757600080fd5b612e6387828801612dc9565b95989497509550505050565b6001600160a01b03811681146105c257600080fd5b80151581146105c257600080fd5b60008060408385031215612ea557600080fd5b8235612eb081612e6f565b91506020830135612ec081612e84565b809150509250929050565b60008060008060008060808789031215612ee457600080fd5b86359550612ef460208801612db0565b9450604087013567ffffffffffffffff80821115612f1157600080fd5b612f1d8a838b01612dc9565b90965094506060890135915080821115612f3657600080fd5b50612f4389828a01612dc9565b979a9699509497509295939492505050565b600080600080600080600060a0888a031215612f7057600080fd5b8735612f7b81612e6f565b965060208801359550612f9060408901612db0565b9450606088013567ffffffffffffffff80821115612fad57600080fd5b612fb98b838c01612dc9565b909650945060808a0135915080821115612fd257600080fd5b50612fdf8a828b01612dc9565b989b979a50959850939692959293505050565b60006020828403121561300457600080fd5b5035919050565b60006020828403121561301d57600080fd5b813561302881612e6f565b9392505050565b60008060008060006080868803121561304757600080fd5b853561305281612e6f565b94506020860135935061306760408701612db0565b9250606086013567ffffffffffffffff81111561308357600080fd5b61308f88828901612dc9565b969995985093965092949392505050565b600080602083850312156130b357600080fd5b823567ffffffffffffffff8111156130ca57600080fd5b6130d685828601612dc9565b90969095509350505050565b600080600080608085870312156130f857600080fd5b843561310381612e6f565b9350602085013561311381612e84565b9250604085013561312381612e6f565b9396929550929360600135925050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601690820152752830bcb937b6361d102737ba103ab734b9bbb0b82b1960511b604082015260600190565b602080825260149082015273506179726f6c6c3a20456d70747920737761707360601b604082015260600190565b602080825260169082015275506179726f6c6c3a204e6f7420756e6973776170563360501b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156132385761323861320e565b5060010190565b60008235605e1983360301811261325557600080fd5b9190910192915050565b6000808335601e1984360301811261327657600080fd5b83018035915067ffffffffffffffff82111561329157600080fd5b6020019150600581901b3603821315612e0e57600080fd5b6020808252601390820152720a0c2f2e4ded8d874408adae0e8f240e0c2e8d606b1b604082015260600190565b6000828210156132e8576132e861320e565b500390565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561332357600080fd5b815161302881612e6f565b6000808335601e1984360301811261334557600080fd5b83018035915067ffffffffffffffff82111561336057600080fd5b602001915036819003821315612e0e57600080fd5b60005b83811015613390578181015183820152602001613378565b8381111561339f576000848401525b50505050565b602081526000825160a0602084015280518060c08501526133cd8160e0860160208501613375565b60018060a01b0360208601511660408501526040850151606085015260608501516080850152608085015160a085015260e0601f19601f8301168501019250505092915050565b60006020828403121561342657600080fd5b5051919050565b60008251613255818460208701613375565b60006020828403121561345157600080fd5b815161302881612e84565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8183526000602080850194508260005b858110156134e55781356134ca81612e6f565b6001600160a01b0316875295820195908201906001016134b7565b509495945050505050565b85815260806020820152600061350a6080830186886134a7565b6001600160a01b0394909416604083015250606001529392505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561355057600080fd5b825167ffffffffffffffff8082111561356857600080fd5b818501915085601f83011261357c57600080fd5b81518181111561358e5761358e613527565b8060051b604051601f19603f830116810181811085821117156135b3576135b3613527565b6040529182528482019250838101850191888311156135d157600080fd5b938501935b828510156135ef578451845293850193928501926135d6565b98975050505050505050565b6000821982111561360e5761360e61320e565b500190565b60208082526023908201527f506179726f6c6c3a2043616e6e6f742073656e6420746f20612030206164647260408201526265737360e81b606082015260800190565b6001600160a01b038616815260606020820181905260009061367b90830186886134a7565b82810360408401528381526001600160fb1b0384111561369a57600080fd5b8360051b8086602084013760009101602001908152979650505050505050565b60008160001904831182151516156136d4576136d461320e565b500290565b6000826136f657634e487b7160e01b600052601260045260246000fd5b500490565b86815285602082015260a06040820152600061371b60a0830186886134a7565b6001600160a01b03949094166060830152506080015294935050505056fe2d8d9d7f49599a20c9e475f932138bdf56ab8ddbcd627a642030d3d788012b56a2646970667358221220032d899ddc611c3037928262a6badf9cde05f436e4e55c56bcc5cb723183f98864736f6c63430008090033