Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 124 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Gas Out | 20363837 | 156 days ago | IN | 0 ETH | 0.000862 | ||||
Transfer Gas Out | 20363836 | 156 days ago | IN | 0 ETH | 0.00081181 | ||||
Transfer Gas Out | 20363831 | 156 days ago | IN | 0 ETH | 0.00080515 | ||||
Withdraw | 20169707 | 183 days ago | IN | 0 ETH | 0.00058192 | ||||
Relay And Transf... | 20147105 | 186 days ago | IN | 0 ETH | 0.00054348 | ||||
Transfer Gas Out | 20140933 | 187 days ago | IN | 0 ETH | 0.00160347 | ||||
Swap Gas | 20134026 | 188 days ago | IN | 0.00285299 ETH | 0.00239808 | ||||
Swap Gas | 20130695 | 189 days ago | IN | 0.0112151 ETH | 0.0007245 | ||||
Swap Gas | 20123367 | 190 days ago | IN | 0.01399784 ETH | 0.00070971 | ||||
Swap Gas | 20115909 | 191 days ago | IN | 0.0029202 ETH | 0.00129101 | ||||
Transfer Gas Out | 20113745 | 191 days ago | IN | 0 ETH | 0.00202409 | ||||
Transfer Gas Out | 20095706 | 194 days ago | IN | 0 ETH | 0.00071329 | ||||
Relay Token In | 20085808 | 195 days ago | IN | 0 ETH | 0.00071204 | ||||
Relay Token In | 20083517 | 195 days ago | IN | 0 ETH | 0.00231295 | ||||
Transfer Gas Out | 20070107 | 197 days ago | IN | 0 ETH | 0.0033429 | ||||
Relay Token In | 20068885 | 197 days ago | IN | 0 ETH | 0.00155506 | ||||
Transfer Gas Out | 20063628 | 198 days ago | IN | 0 ETH | 0.00303833 | ||||
Transfer Gas Out | 20057477 | 199 days ago | IN | 0 ETH | 0.00075095 | ||||
Transfer Gas Out | 20050849 | 200 days ago | IN | 0 ETH | 0.00082025 | ||||
Relay Token In | 20023208 | 204 days ago | IN | 0 ETH | 0.00061396 | ||||
Relay And Transf... | 20022782 | 204 days ago | IN | 0 ETH | 0.00190749 | ||||
Swap Gas | 20017128 | 205 days ago | IN | 0.00264928 ETH | 0.00110179 | ||||
Relay And Transf... | 20004840 | 206 days ago | IN | 0 ETH | 0.00300808 | ||||
Swap Gas | 19997964 | 207 days ago | IN | 0.02628428 ETH | 0.0013396 | ||||
Transfer Gas Out | 19997625 | 207 days ago | IN | 0 ETH | 0.00146176 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
20363837 | 156 days ago | 0.05462961 ETH | ||||
20363837 | 156 days ago | 0.05462961 ETH | ||||
20363836 | 156 days ago | 0.01156145 ETH | ||||
20363836 | 156 days ago | 0.01156145 ETH | ||||
20363831 | 156 days ago | 0.00815884 ETH | ||||
20363831 | 156 days ago | 0.00815884 ETH | ||||
20147105 | 186 days ago | 0.01060069 ETH | ||||
20147105 | 186 days ago | 0.01060069 ETH | ||||
20140933 | 187 days ago | 0.0037214 ETH | ||||
20140933 | 187 days ago | 0.0037214 ETH | ||||
20134026 | 188 days ago | 0.00285299 ETH | ||||
20130695 | 189 days ago | 0.0112151 ETH | ||||
20123367 | 190 days ago | 0.01399784 ETH | ||||
20115909 | 191 days ago | 0.0029202 ETH | ||||
20113745 | 191 days ago | 0.05242114 ETH | ||||
20113745 | 191 days ago | 0.05242114 ETH | ||||
20095706 | 194 days ago | 0.00182924 ETH | ||||
20095706 | 194 days ago | 0.00182924 ETH | ||||
20070107 | 197 days ago | 0.05214962 ETH | ||||
20070107 | 197 days ago | 0.05214962 ETH | ||||
20063628 | 198 days ago | 0.0240493 ETH | ||||
20063628 | 198 days ago | 0.0240493 ETH | ||||
20057477 | 199 days ago | 0.00035742 ETH | ||||
20057477 | 199 days ago | 0.00035742 ETH | ||||
20050849 | 200 days ago | 0.00686044 ETH |
Loading...
Loading
Contract Name:
GasbotV2
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity =0.8.19; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./Interface.sol"; /// @title GasbotV2 /// @author 0xDjango /// @notice This contract is used to relay gas across chains. The contract holds a single "homeToken" to use as liquidity. /// @dev This contract may hold other tokens as a result of calling relayAndTransfer() with a token other than the home token. contract GasbotV2 { using SafeERC20 for IERC20; struct PermitParams { address owner; address spender; uint256 amount; uint256 deadline; uint8 v; bytes32 r; bytes32 s; } address private immutable owner; mapping(address => bool) private isRelayer; mapping(uint256 => bool) private isOutboundIdUsed; IWETH private immutable WETH; address private defaultRouter; bool private isV3Router; // true if router is Uniswap V3 router, false if Uniswap V2 router address private homeToken; // token held by this contract to be used as liquidity uint24 private defaultPoolFee = 500; // 0.05% uint256 private maxValue; // max value of homeToken that can be accepted via swapGas() uint256 private minValue; // min value of homeToken that can be accepted via swapGas() event GasSwap( address indexed sender, uint256 nativeAmount, uint256 usdAmount, uint256 indexed fromChainId, uint256 indexed toChainId ); constructor( address _owner, address _relayer, address _defaultRouter, bool _isV3Router, address _weth, address _homeToken, uint256 _maxValue ) { require(_owner != address(0)); require(_defaultRouter != address(0)); require(_weth != address(0)); require(_homeToken != address(0)); require(_homeToken != _weth); owner = _owner; isRelayer[_relayer] = true; defaultRouter = _defaultRouter; isV3Router = _isV3Router; WETH = IWETH(_weth); homeToken = _homeToken; maxValue = _maxValue * 10 ** IERC20Metadata(_homeToken).decimals(); minValue = 2 * 10 ** IERC20Metadata(_homeToken).decimals(); } modifier onlyOwner() { require(msg.sender == owner, "Unauthorized"); _; } modifier onlyRelayer() { require(isRelayer[msg.sender], "Unauthorized"); _; } /////// Protected External Functions /////// /// @notice This function pulls in accepted tokens from the user's wallet. /// @param _token The token to pull in. /// @param _permitData The permit data to use for tokens supporting a permit() function. /// @param _customRouter The router to use for swapping. /// @param _uniV3Path The Uniswap V3 path to use for swapping. /// @param _uniV2Path The Uniswap V2 path to use for swapping. /// @param _minAmountOut The minimum amount of tokens to receive from the swap. /// @dev If the token does not support permit, the user must approve this contract to spend the token. /// In this case, the passed permit signature will be ignored. /// @dev If the token is the home token, no swap will be performed. function relayTokenIn( address _token, PermitParams calldata _permitData, address _customRouter, bytes calldata _uniV3Path, address[] calldata _uniV2Path, uint256 _minAmountOut, uint256 _deadline ) external onlyRelayer { _permitAndTransferIn(_token, _permitData); if (_token == homeToken) { return; // no need to swap } _swap( _customRouter, _token, _uniV3Path, _uniV2Path, _permitData.amount, _minAmountOut, _deadline ); } /// @notice This function transfers out accepted tokens to the user's wallet. /// @param _swapAmount The amount of homeToken to swap. /// @param _recipient The address to transfer the swapped tokens to. /// @param _minAmountOut The minimum amount of wrapped native (eg WETH) to receive from the swap. /// @param outbound_id The ID of the outbound transaction. Must be unique to prevent accidental replay. function transferGasOut( uint256 _swapAmount, address _recipient, uint256 _minAmountOut, uint256 outbound_id, uint256 _gasLimit, uint256 _deadline ) external onlyRelayer { require(!isOutboundIdUsed[outbound_id], "Expired outbound ID"); isOutboundIdUsed[outbound_id] = true; ( bytes memory uniV3Path, address[] memory uniV2Path ) = getDefaultSwapPaths(true); _swap( defaultRouter, homeToken, uniV3Path, uniV2Path, _swapAmount, _minAmountOut, _deadline ); _unwrap(); _transferAtLeast(_recipient, _minAmountOut, _gasLimit); } /// @notice This function pulls in accepted tokens from the user's wallet and transfers out native to the user's wallet. /// @param _token The token to pull in. /// @param _permitData The permit data to use for tokens supporting a permit() function. /// @param _customRouter The router to use for swapping. /// @param _uniV3Path The Uniswap V3 path to use for swapping. /// @param _uniV2Path The Uniswap V2 path to use for swapping. /// @param _swapAmount The amount of _token to swap. This will be lower than the permit amount as a result of Gasbot fees and relay txn fees. /// @param _minAmountOut The minimum amount of wrapped native (eg WETH) to receive from the swap. /// @dev This function is used for same-chain swaps. function relayAndTransfer( address _token, PermitParams calldata _permitData, address _customRouter, bytes calldata _uniV3Path, address[] calldata _uniV2Path, uint256 _swapAmount, uint256 _minAmountOut, uint256 _gasLimit, uint256 _deadline ) external onlyRelayer { require(_swapAmount < _permitData.amount, "Invalid swap amount"); _permitAndTransferIn(_token, _permitData); _swap( _customRouter, _token, _uniV3Path, _uniV2Path, _swapAmount, _minAmountOut, _deadline ); _unwrap(); _transferAtLeast(_permitData.owner, _minAmountOut, _gasLimit); } /////// Public Functions /////// /// @notice This function is used to swap native to the home token. It can be called by anyone and emits an event that broadcasts /// the amount of native swapped and the amount of homeToken received as a result of the swap. /// @notice This function should be called from a verified Gasbot UI to ensure its completion on the destination chain. /// If this function is called from an unverified UI, the user should verify the transaction /// by submitting the transaction hash to the Gasbot UI at https://gasbot.xyz/verify-txn /// If the user-supplied _toChainId is not supported, gas will be transferred back to the caller with Gasbot fee deducted. /// @notice Gasbot transfers native using .transfer(), /// therefore it is crucial that the caller of this function either be an EOA or a contract that will not revert with .tranfer() gas stipend. /// @param _toChainId The chain ID of the destination chain. /// @param _minAmountOut The minimum amount of homeToken to receive from the swap. /// @param _deadline The deadline for the swap. function swapGas( uint256 _toChainId, uint256 _minAmountOut, uint256 _deadline ) external payable { require(msg.value > 0, "Invalid amount"); require( (_toChainId != block.chainid) && (_toChainId != 0), "Invalid chain ID" ); address homeToken_ = homeToken; uint256 initialBalance = IERC20(homeToken_).balanceOf(address(this)); WETH.deposit{ value: msg.value }(); ( bytes memory uniV3Path, address[] memory uniV2Path ) = getDefaultSwapPaths(false); _swap( defaultRouter, address(WETH), uniV3Path, uniV2Path, msg.value, _minAmountOut, _deadline ); uint256 addedValue = IERC20(homeToken_).balanceOf(address(this)) - initialBalance; require(addedValue <= maxValue, "Exceeded max value"); require(addedValue >= minValue, "Below min value"); emit GasSwap( msg.sender, msg.value, addedValue, block.chainid, _toChainId ); } /////// Internal/Private Functions /////// function _permitAndTransferIn( address _token, PermitParams calldata _permitData ) private { if ( IERC20(_token).allowance(_permitData.owner, address(this)) < _permitData.amount ) { IERC20Permit(_token).permit( _permitData.owner, _permitData.spender, _permitData.amount, _permitData.deadline, _permitData.v, _permitData.r, _permitData.s ); } IERC20(_token).safeTransferFrom( _permitData.owner, address(this), _permitData.amount ); } function _swap( address _router, address _tokenIn, bytes memory _uniV3Path, address[] memory _uniV2Path, uint256 _amount, uint256 _minAmountOut, uint256 _deadline ) private { uint256 allowance = IERC20(_tokenIn).allowance(address(this), _router); if (allowance > 0) { IERC20(_tokenIn).safeDecreaseAllowance(_router, allowance); } IERC20(_tokenIn).safeIncreaseAllowance(_router, _amount); if (_uniV3Path.length > 0) { IUniswapRouterV3(_router).exactInput( IUniswapRouterV3.ExactInputParams({ path: _uniV3Path, recipient: address(this), deadline: _deadline, amountIn: _amount, amountOutMinimum: _minAmountOut }) ); } else { IUniswapRouterV2(_router).swapExactTokensForTokens( _amount, _minAmountOut, _uniV2Path, address(this), _deadline ); } } function _unwrap() private { uint256 wethBalance = WETH.balanceOf(address(this)); if (wethBalance == 0) return; WETH.withdraw(wethBalance); } function _transferAtLeast( address _recipient, uint256 _minAmount, uint256 _gasLimit ) private { require(address(this).balance >= _minAmount, "Native balance too low"); (bool success, ) = payable(_recipient).call{ value: address(this).balance, gas: _gasLimit }(""); require(success, "Transfer failed"); } /////// Admin-Only Functions /////// /// @notice This function is used to set the default router used for swapping in the swapGas() and transferGasOut() functions. /// @param _defaultRouter The address of the default router. /// @param _isV3Router True if the router is a Uniswap V3 router, false if it is a Uniswap V2 router. function setDefaultRouter( address _defaultRouter, bool _isV3Router ) external onlyOwner { require(_defaultRouter != address(0)); defaultRouter = _defaultRouter; isV3Router = _isV3Router; } /// @notice This function is used to set the default pool fee used for swapping in the swapGas() and transferGasOut() functions. /// @param _defaultPoolFee The default pool fee. function setDefaultPoolFee(uint24 _defaultPoolFee) external onlyOwner { require(_defaultPoolFee > 0); defaultPoolFee = _defaultPoolFee; } /// @notice This function is used to set the home token for the contract. /// It will likely only be changed as a result of a stablecoin depeg or decline in liquidity. /// This will also update the maxValue and minValue to the new token's decimals. /// @param _homeToken The address of the new home token. function setHomeToken(address _homeToken) external onlyOwner { require(_homeToken != address(0)); require(_homeToken != address(WETH)); uint256 _prevDecimals = IERC20Metadata(homeToken).decimals(); homeToken = _homeToken; maxValue = (maxValue * 10 ** IERC20Metadata(_homeToken).decimals()) / (10 ** _prevDecimals); minValue = (minValue * 10 ** IERC20Metadata(_homeToken).decimals()) / (10 ** _prevDecimals); } /// @notice This function is used to set the maximum amount of homeToken that can be accepted using the swapGas() function. /// @param _maxValue The new maximum value. /// @dev The value is stored as a uint256, so it must be passed in as the value multiplied by 10^decimals. /// @dev Setting the max value to 0 will disable use of the swapGas() function. function setMaxValue(uint256 _maxValue) external onlyOwner { maxValue = _maxValue * 10 ** IERC20Metadata(homeToken).decimals(); } /// @notice This function is used to set the minimum amount of homeToken that can be accepted using the swapGas() function. /// @param _minValue The new minimum value. /// @dev The value is stored as a uint256, so it must be passed in as the value multiplied by 10^decimals. function setMinValue(uint256 _minValue) external onlyOwner { minValue = _minValue * 10 ** IERC20Metadata(homeToken).decimals(); } /// @notice This function is used to add or remove relayers. /// @param _relayer The address of the relayer. function setRelayer(address _relayer, bool _status) external onlyOwner { isRelayer[_relayer] = _status; } /** * This function can be used to execute any arbitrary set of instructions. * Example use cases: * 1. Call a function on another contract * 2. Transfer out ETH or ERC20 tokens * 3. Swap ERC20 tokens to ETH and transfer to relayer * NOTE: Since this contract will never hold funds belonging to users, this function is not a security risk. */ function execute( address _target, bytes calldata _data, uint256 _value, address _recipient ) external onlyOwner { (bool success, ) = payable(_target).call{ value: _value }(_data); require(success); if (_recipient != address(0)) { (success, ) = payable(_recipient).call{ value: address(this).balance }(""); require(success, "Transfer failed"); } } /// @notice This function will swap the home token for native and send it to the relayers. /// @param _relayers The addresses of the relayers. /// @param _amounts The amounts of gas to send to each relayer. /// @param _swapAmount The amount of homeToken to swap. /// @param _minAmountOut The minimum amount of wrapped native (eg WETH) to receive from the swap. /// @dev All passed relayers must be valid relayers. function replenishRelayers( address[] calldata _relayers, uint256[] calldata _amounts, uint256 _swapAmount, uint256 _minAmountOut, uint256 _gasLimit, uint256 _deadline ) external payable onlyOwner { ( bytes memory uniV3Path, address[] memory uniV2Path ) = getDefaultSwapPaths(true); _swap( defaultRouter, homeToken, uniV3Path, uniV2Path, _swapAmount, _minAmountOut, _deadline ); _unwrap(); for (uint256 i = 0; i < _relayers.length; ) { require(isRelayer[_relayers[i]], "Invalid relayer"); if (i == _relayers.length - 1) { _transferAtLeast(_relayers[i], _amounts[i], _gasLimit); // Any extra goes to the last relayer } else { (bool success, ) = payable(_relayers[i]).call{ value: _amounts[i] }(""); require(success, "Transfer failed"); } unchecked { ++i; } } } /// @notice This function will swap any extra tokens in this contract to home token to be used as liquidity. /// Non-home tokens can be retained by this contract as a result of relayAndTransfer() when using non-home tokens. /// @param _token The address of the token to swap. /// @param _customRouter The router to use for swapping. /// @param _uniV3Path The Uniswap V3 path to use for swapping. /// @param _uniV2Path The Uniswap V2 path to use for swapping. /// @param _swapAmount The amount of _token to swap. /// @param _minAmountOut The minimum amount of homeToken to receive from the swap. /// @param _deadline The deadline for the swap. function swapTokenToHomeToken( address _token, address _customRouter, bytes calldata _uniV3Path, address[] calldata _uniV2Path, uint256 _swapAmount, uint256 _minAmountOut, uint256 _deadline ) external onlyOwner { address homeToken_ = homeToken; require(_token != homeToken_, "Invalid token"); uint256 initialBalance = IERC20(homeToken_).balanceOf(address(this)); _swap( _customRouter, _token, _uniV3Path, _uniV2Path, _swapAmount, _minAmountOut, _deadline ); // This check also protects against incorrect uniV3Paths and uniV2Paths uint256 addedValue = IERC20(homeToken_).balanceOf(address(this)) - initialBalance; require(addedValue >= _minAmountOut, "Invalid amount out"); } /// @notice This function will withdraw any ERC20 tokens held by the contract. /// @param _token The address of the token to withdraw. function withdraw(address _token, uint256 _amount) external onlyOwner { uint256 balance = IERC20(_token).balanceOf(address(this)); if (_amount > balance) _amount = balance; IERC20(_token).safeTransfer(msg.sender, _amount); } /////// View Functions /////// /// @notice This function returns home token address. function getHomeToken() external view returns (address) { return homeToken; } /// @notice This function returns the maximum amount of homeToken that can be accepted using the swapGas() function. function getMaxValue() external view returns (uint256) { return maxValue; } /// @notice This function is used by the Gasbot UI to scan user wallets for native and token balances. /// @param _user The address of the user. /// @param _tokens The addresses of the tokens to query. function getTokenBalances( address _user, address[] calldata _tokens ) public view returns (address[] memory, uint256[] memory) { uint256 length = _tokens.length + 1; address[] memory tokens_ = new address[](length); uint256[] memory balances_ = new uint256[](length); // Query user's native balance tokens_[0] = address(0); balances_[0] = _user.balance; // Query user's token balances for (uint256 i = 1; i < length; ++i) { balances_[i] = IERC20(_tokens[i - 1]).balanceOf(_user); tokens_[i] = _tokens[i - 1]; } return (tokens_, balances_); } function getRelayerBalances( address[] calldata _relayers ) external view returns (uint256[] memory) { uint256 length = _relayers.length; uint256[] memory balances_ = new uint256[](length); for (uint256 i = 0; i < length; i++) { require(isRelayer[_relayers[i]], "Invalid relayer"); // @audit maybe continue if not valid relayer? balances_[i] = _relayers[i].balance; } return balances_; } function getDefaultSwapPaths( bool _toWeth ) private view returns (bytes memory uniV3Path, address[] memory uniV2Path) { if (isV3Router) { if (_toWeth) { uniV3Path = abi.encodePacked( homeToken, defaultPoolFee, address(WETH) ); } else { uniV3Path = abi.encodePacked( address(WETH), defaultPoolFee, homeToken ); } } else { uniV2Path = new address[](2); if (_toWeth) { uniV2Path[0] = homeToken; uniV2Path[1] = address(WETH); } else { uniV2Path[0] = address(WETH); uniV2Path[1] = homeToken; } } } receive() external payable { require(msg.sender == address(WETH), "Invalid sender"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
//SPDX-License-Identifier: MIT pragma solidity =0.8.19; interface IWETH { function deposit() external payable; function withdraw(uint wad) external; function balanceOf(address account) external view returns (uint); } interface IUniswapRouterV2 { function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); } interface IUniswapRouterV3 { struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } function exactInput( ExactInputParams calldata params ) external payable returns (uint256 amountOut); }
{ "evmVersion": "paris", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_relayer","type":"address"},{"internalType":"address","name":"_defaultRouter","type":"address"},{"internalType":"bool","name":"_isV3Router","type":"bool"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_homeToken","type":"address"},{"internalType":"uint256","name":"_maxValue","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"fromChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toChainId","type":"uint256"}],"name":"GasSwap","type":"event"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getHomeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_relayers","type":"address[]"}],"name":"getRelayerBalances","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getTokenBalances","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct GasbotV2.PermitParams","name":"_permitData","type":"tuple"},{"internalType":"address","name":"_customRouter","type":"address"},{"internalType":"bytes","name":"_uniV3Path","type":"bytes"},{"internalType":"address[]","name":"_uniV2Path","type":"address[]"},{"internalType":"uint256","name":"_swapAmount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"relayAndTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct GasbotV2.PermitParams","name":"_permitData","type":"tuple"},{"internalType":"address","name":"_customRouter","type":"address"},{"internalType":"bytes","name":"_uniV3Path","type":"bytes"},{"internalType":"address[]","name":"_uniV2Path","type":"address[]"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"relayTokenIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_relayers","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"uint256","name":"_swapAmount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"replenishRelayers","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint24","name":"_defaultPoolFee","type":"uint24"}],"name":"setDefaultPoolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultRouter","type":"address"},{"internalType":"bool","name":"_isV3Router","type":"bool"}],"name":"setDefaultRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_homeToken","type":"address"}],"name":"setHomeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxValue","type":"uint256"}],"name":"setMaxValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minValue","type":"uint256"}],"name":"setMinValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_relayer","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_toChainId","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"swapGas","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_customRouter","type":"address"},{"internalType":"bytes","name":"_uniV3Path","type":"bytes"},{"internalType":"address[]","name":"_uniV2Path","type":"address[]"},{"internalType":"uint256","name":"_swapAmount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"swapTokenToHomeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_swapAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"uint256","name":"outbound_id","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"transferGasOut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040526003805462ffffff60a01b1916607d60a21b1790553480156200002657600080fd5b50604051620035663803806200356683398101604081905262000049916200024a565b6001600160a01b0387166200005d57600080fd5b6001600160a01b0385166200007157600080fd5b6001600160a01b0383166200008557600080fd5b6001600160a01b0382166200009957600080fd5b826001600160a01b0316826001600160a01b031603620000b857600080fd5b6001600160a01b0380881660805286811660009081526020818152604091829020805460ff1916600117905560028054881515600160a01b026001600160a81b03199091168a86161717905585831660a052600380549386166001600160a01b03199490941684179055815163313ce56760e01b8152915163313ce5679260048082019392918290030181865afa15801562000158573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200017e9190620002dc565b6200018b90600a6200041d565b6200019790826200042e565b600481905550816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002029190620002dc565b6200020f90600a6200041d565b6200021c9060026200042e565b600555506200044895505050505050565b80516001600160a01b03811681146200024557600080fd5b919050565b600080600080600080600060e0888a0312156200026657600080fd5b62000271886200022d565b965062000281602089016200022d565b955062000291604089016200022d565b945060608801518015158114620002a757600080fd5b9350620002b7608089016200022d565b9250620002c760a089016200022d565b915060c0880151905092959891949750929550565b600060208284031215620002ef57600080fd5b815160ff811681146200030157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200035f57816000190482111562000343576200034362000308565b808516156200035157918102915b93841c939080029062000323565b509250929050565b600082620003785750600162000417565b81620003875750600062000417565b8160018114620003a05760028114620003ab57620003cb565b600191505062000417565b60ff841115620003bf57620003bf62000308565b50506001821b62000417565b5060208310610133831016604e8410600b8410161715620003f0575081810a62000417565b620003fc83836200031e565b806000190482111562000413576200041362000308565b0290505b92915050565b60006200030160ff84168362000367565b808202811582820484141762000417576200041762000308565b60805160a05161307a620004ec6000396000818161011d01528181610d1f01528181610db5015281816113e001528181611cb601528181611d4c01528181611eba01528181611f0401528181611fad0152612006015260008181610503015281816109090152818161099101528181610a0f01528181610b4c015281816112b40152818161138e015281816115dd01528181611650015261187e015261307a6000f3fe60806040526004361061010d5760003560e01c80639984f30d11610095578063db91774c11610064578063db91774c14610340578063e887051214610360578063ecd8dc3a14610380578063ede29487146103a0578063f3fef3a3146103b357600080fd5b80639984f30d146102b2578063b2cd87f7146102d2578063b8b4ca0f146102e5578063d802178e1461031257600080fd5b80634c9eb4d4116100dc5780634c9eb4d41461021457806350fc5f74146102325780635227767c1461025257806356bc3d4c1461027257806370ec9d081461029257600080fd5b806318993c961461018757806320f5590c146101b4578063389a36d2146101d45780633eb8f396146101f457600080fd5b3661018257336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101805760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b73232b960911b60448201526064015b60405180910390fd5b005b600080fd5b34801561019357600080fd5b506003546040516001600160a01b0390911681526020015b60405180910390f35b3480156101c057600080fd5b506101806101cf3660046125df565b6103d3565b3480156101e057600080fd5b506101806101ef3660046126b1565b6104f8565b34801561020057600080fd5b5061018061020f366004612759565b610740565b34801561022057600080fd5b506004546040519081526020016101ab565b34801561023e57600080fd5b5061018061024d366004612813565b610811565b34801561025e57600080fd5b5061018061026d366004612872565b6108fe565b34801561027e57600080fd5b5061018061028d3660046128a9565b610986565b34801561029e57600080fd5b506101806102ad3660046128d5565b610a04565b3480156102be57600080fd5b506101806102cd366004612942565b610b41565b6101806102e036600461295b565b610c1b565b3480156102f157600080fd5b50610305610300366004612987565b610f2b565b6040516101ab9190612a03565b34801561031e57600080fd5b5061033261032d366004612a16565b61106f565b6040516101ab929190612aa1565b34801561034c57600080fd5b5061018061035b366004612942565b6112a9565b34801561036c57600080fd5b5061018061037b366004612acf565b611383565b34801561038c57600080fd5b5061018061039b366004612872565b6115d2565b6101806103ae366004612aea565b611645565b3480156103bf57600080fd5b506101806103ce366004612b78565b611873565b3360009081526020819052604090205460ff166104025760405162461bcd60e51b815260040161017790612ba2565b8960400135841061044b5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081cddd85c08185b5bdd5b9d606a1b6044820152606401610177565b6104558b8b61194d565b6104cc898c8a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c9182918501908490808284376000920191909152508b92508a9150889050611ade565b6104d4611c9e565b6104eb6104e460208c018c612acf565b8484611db3565b5050505050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105405760405162461bcd60e51b815260040161017790612ba2565b6003546001600160a01b03908116908a168190036105905760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610177565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156105d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fb9190612bc8565b90506106748a8c8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808f0282810182019093528e82529093508e92508d9182918501908490808284376000920191909152508c92508b91508a9050611ade565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a0823190602401602060405180830381865afa1580156106bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e19190612bc8565b6106eb9190612bf7565b9050848110156107325760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908185b5bdd5b9d081bdd5d60721b6044820152606401610177565b505050505050505050505050565b3360009081526020819052604090205460ff1661076f5760405162461bcd60e51b815260040161017790612ba2565b610779898961194d565b6003546001600160a01b038a811691161461080657610806878a88888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a91829185019084908082843760009201919091525050505060408d01358787611ade565b505050505050505050565b3360009081526020819052604090205460ff166108405760405162461bcd60e51b815260040161017790612ba2565b60008381526001602052604090205460ff16156108955760405162461bcd60e51b8152602060048201526013602482015272115e1c1a5c9959081bdd5d189bdd5b99081251606a1b6044820152606401610177565b60008381526001602081905260408220805460ff19168217905581906108ba90611e78565b6002546003549294509092506108e1916001600160a01b03918216911684848c8b89611ade565b6108e9611c9e565b6108f4878786611db3565b5050505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109465760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b03821661095957600080fd5b60028054911515600160a01b026001600160a81b03199092166001600160a01b0390931692909217179055565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109ce5760405162461bcd60e51b815260040161017790612ba2565b60008162ffffff16116109e057600080fd5b6003805462ffffff909216600160a01b0262ffffff60a01b19909216919091179055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a4c5760405162461bcd60e51b815260040161017790612ba2565b6000856001600160a01b0316838686604051610a69929190612c0a565b60006040518083038185875af1925050503d8060008114610aa6576040519150601f19603f3d011682016040523d82523d6000602084013e610aab565b606091505b5050905080610ab957600080fd5b6001600160a01b03821615610b39576040516001600160a01b038316904790600081818185875af1925050503d8060008114610b11576040519150601f19603f3d011682016040523d82523d6000602084013e610b16565b606091505b50508091505080610b395760405162461bcd60e51b815260040161017790612c1a565b505050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b895760405162461bcd60e51b815260040161017790612ba2565b600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190612c52565b610c0b90600a612d53565b610c159082612d62565b60045550565b60003411610c5c5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610177565b468314158015610c6b57508215155b610caa5760405162461bcd60e51b815260206004820152601060248201526f125b9d985b1a590818da185a5b88125160821b6044820152606401610177565b6003546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612bc8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d7857600080fd5b505af1158015610d8c573d6000803e3d6000fd5b5050505050600080610d9e6000611e78565b6002549193509150610dde906001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000008484348b8b611ade565b6040516370a0823160e01b815230600482015260009084906001600160a01b038716906370a0823190602401602060405180830381865afa158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612bc8565b610e559190612bf7565b9050600454811115610e9e5760405162461bcd60e51b81526020600482015260126024820152714578636565646564206d61782076616c756560701b6044820152606401610177565b600554811015610ee25760405162461bcd60e51b815260206004820152600f60248201526e42656c6f77206d696e2076616c756560881b6044820152606401610177565b60408051348152602081018390528991469133917ff755c7bd8e08bc9995b8fa20e1b423b79cf46c754de658c7ef3caafe2b940671910160405180910390a45050505050505050565b6060816000816001600160401b03811115610f4857610f48612d79565b604051908082528060200260200182016040528015610f71578160200160208202803683370190505b50905060005b8281101561106457600080878784818110610f9457610f94612d8f565b9050602002016020810190610fa99190612acf565b6001600160a01b0316815260208101919091526040016000205460ff166110045760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b2103932b630bcb2b960891b6044820152606401610177565b85858281811061101657611016612d8f565b905060200201602081019061102b9190612acf565b6001600160a01b03163182828151811061104757611047612d8f565b60209081029190910101528061105c81612da5565b915050610f77565b509150505b92915050565b606080600061107f846001612dbe565b90506000816001600160401b0381111561109b5761109b612d79565b6040519080825280602002602001820160405280156110c4578160200160208202803683370190505b5090506000826001600160401b038111156110e1576110e1612d79565b60405190808252806020026020018201604052801561110a578160200160208202803683370190505b50905060008260008151811061112257611122612d8f565b60200260200101906001600160a01b031690816001600160a01b031681525050876001600160a01b0316318160008151811061116057611160612d8f565b602090810291909101015260015b8381101561129b578787611183600184612bf7565b81811061119257611192612d8f565b90506020020160208101906111a79190612acf565b6040516370a0823160e01b81526001600160a01b038b8116600483015291909116906370a0823190602401602060405180830381865afa1580156111ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112139190612bc8565b82828151811061122557611225612d8f565b6020908102919091010152878761123d600184612bf7565b81811061124c5761124c612d8f565b90506020020160208101906112619190612acf565b83828151811061127357611273612d8f565b6001600160a01b039092166020928302919091019091015261129481612da5565b905061116e565b509097909650945050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112f15760405162461bcd60e51b815260040161017790612ba2565b600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113689190612c52565b61137390600a612d53565b61137d9082612d62565b60055550565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113cb5760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b0381166113de57600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361141c57600080fd5b6003546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015611466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148a9190612c52565b600380546001600160a01b0319166001600160a01b03851617905560ff1690506114b581600a612dd1565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115179190612c52565b61152290600a612d53565b60045461152f9190612d62565b6115399190612ddd565b60045561154781600a612dd1565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190612c52565b6115b490600a612d53565b6005546115c19190612d62565b6115cb9190612ddd565b6005555050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461161a5760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461168d5760405162461bcd60e51b815260040161017790612ba2565b60008061169a6001611e78565b6002546003549294509092506116c1916001600160a01b03918216911684848a8a89611ade565b6116c9611c9e565b60005b898110156104eb576000808c8c848181106116e9576116e9612d8f565b90506020020160208101906116fe9190612acf565b6001600160a01b0316815260208101919091526040016000205460ff166117595760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b2103932b630bcb2b960891b6044820152606401610177565b61176460018b612bf7565b81036117b8576117b38b8b8381811061177f5761177f612d8f565b90506020020160208101906117949190612acf565b8a8a848181106117a6576117a6612d8f565b9050602002013587611db3565b61186b565b60008b8b838181106117cc576117cc612d8f565b90506020020160208101906117e19190612acf565b6001600160a01b03168a8a848181106117fc576117fc612d8f565b9050602002013560405160006040518083038185875af1925050503d8060008114611843576040519150601f19603f3d011682016040523d82523d6000602084013e611848565b606091505b50509050806118695760405162461bcd60e51b815260040161017790612c1a565b505b6001016116cc565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118bb5760405162461bcd60e51b815260040161017790612ba2565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611902573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119269190612bc8565b905080821115611934578091505b6119486001600160a01b0384163384612069565b505050565b60408101356001600160a01b03831663dd62ed3e61196e6020850185612acf565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa1580156119b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119dc9190612bc8565b1015611ab4576001600160a01b03821663d505accf6119fe6020840184612acf565b611a0e6040850160208601612acf565b60408501356060860135611a2860a0880160808901612dff565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff16608482015260a084013560a482015260c084013560c482015260e401600060405180830381600087803b158015611a9b57600080fd5b505af1158015611aaf573d6000803e3d6000fd5b505050505b611ada611ac46020830183612acf565b6001600160a01b038416903060408501356120cc565b5050565b604051636eb1769f60e11b81523060048201526001600160a01b0388811660248301526000919088169063dd62ed3e90604401602060405180830381865afa158015611b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b529190612bc8565b90508015611b6e57611b6e6001600160a01b0388168983612104565b611b826001600160a01b038816898661220d565b855115611c23576040805160a0810182528781523060208201528082018490526060810186905260808101859052905163c04b8d5960e01b81526001600160a01b038a169163c04b8d5991611bda9190600401612e6c565b6020604051808303816000875af1158015611bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1d9190612bc8565b506108f4565b6040516338ed173960e01b81526001600160a01b038916906338ed173990611c5790879087908a9030908990600401612ec4565b6000604051808303816000875af1158015611c76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108069190810190612f00565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190612bc8565b905080600003611d365750565b604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611d9857600080fd5b505af1158015611dac573d6000803e3d6000fd5b5050505050565b81471015611dfc5760405162461bcd60e51b81526020600482015260166024820152754e61746976652062616c616e636520746f6f206c6f7760501b6044820152606401610177565b6000836001600160a01b0316478390604051600060405180830381858888f193505050503d8060008114611e4c576040519150601f19603f3d011682016040523d82523d6000602084013e611e51565b606091505b5050905080611e725760405162461bcd60e51b815260040161017790612c1a565b50505050565b6002546060908190600160a01b900460ff1615611f43578215611ef857600354604051611ee2916001600160a01b03811691600160a01b90910462ffffff16907f000000000000000000000000000000000000000000000000000000000000000090602001612fbd565b6040516020818303038152906040529150915091565b600354604051611ee2917f00000000000000000000000000000000000000000000000000000000000000009162ffffff600160a01b830416916001600160a01b031690602001612fbd565b604080516002808252606082018352909160208301908036833701905050905082156120045760035481516001600160a01b03909116908290600090611f8b57611f8b612d8f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110611fdf57611fdf612d8f565b60200260200101906001600160a01b031690816001600160a01b031681525050915091565b7f00000000000000000000000000000000000000000000000000000000000000008160008151811061203857612038612d8f565b6001600160a01b039283166020918202929092010152600354825191169082906001908110611fdf57611fdf612d8f565b6040516001600160a01b03831660248201526044810182905261194890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122ba565b6040516001600160a01b0380851660248301528316604482015260648101829052611e729085906323b872dd60e01b90608401612095565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121789190612bc8565b9050818110156121dc5760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610177565b6040516001600160a01b03841660248201528282036044820152611e7290859063095ea7b360e01b90606401612095565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122819190612bc8565b9050611e728463095ea7b360e01b8561229a8686612dbe565b6040516001600160a01b0390921660248301526044820152606401612095565b600061230f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661238f9092919063ffffffff16565b90508051600014806123305750808060200190518101906123309190612ff8565b6119485760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610177565b606061239e84846000856123a6565b949350505050565b6060824710156124075760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610177565b600080866001600160a01b031685876040516124239190613015565b60006040518083038185875af1925050503d8060008114612460576040519150601f19603f3d011682016040523d82523d6000602084013e612465565b606091505b509150915061247687838387612481565b979650505050505050565b606083156124f05782516000036124e9576001600160a01b0385163b6124e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610177565b508161239e565b61239e83838151156125055781518083602001fd5b8060405162461bcd60e51b81526004016101779190613031565b80356001600160a01b038116811461253657600080fd5b919050565b600060e0828403121561254d57600080fd5b50919050565b60008083601f84011261256557600080fd5b5081356001600160401b0381111561257c57600080fd5b60208301915083602082850101111561259457600080fd5b9250929050565b60008083601f8401126125ad57600080fd5b5081356001600160401b038111156125c457600080fd5b6020830191508360208260051b850101111561259457600080fd5b60008060008060008060008060008060006101e08c8e03121561260157600080fd5b61260a8c61251f565b9a506126198d60208e0161253b565b99506126286101008d0161251f565b98506001600160401b03806101208e0135111561264457600080fd5b6126558e6101208f01358f01612553565b90995097506101408d013581101561266c57600080fd5b5061267e8d6101408e01358e0161259b565b9b9e9a9d50989b979a969996976101608101359761018082013597506101a082013596506101c090910135945092505050565b600080600080600080600080600060e08a8c0312156126cf57600080fd5b6126d88a61251f565b98506126e660208b0161251f565b975060408a01356001600160401b038082111561270257600080fd5b61270e8d838e01612553565b909950975060608c013591508082111561272757600080fd5b506127348c828d0161259b565b9a9d999c50979a9699979860808801359760a0810135975060c0013595509350505050565b60008060008060008060008060006101a08a8c03121561277857600080fd5b6127818a61251f565b98506127908b60208c0161253b565b975061279f6101008b0161251f565b96506101208a01356001600160401b03808211156127bc57600080fd5b6127c88d838e01612553565b90985096506101408c01359150808211156127e257600080fd5b506127ef8c828d0161259b565b9a9d999c50979a969995989596610160810135966101809091013595509350505050565b60008060008060008060c0878903121561282c57600080fd5b8635955061283c6020880161251f565b95989597505050506040840135936060810135936080820135935060a0909101359150565b801515811461286f57600080fd5b50565b6000806040838503121561288557600080fd5b61288e8361251f565b9150602083013561289e81612861565b809150509250929050565b6000602082840312156128bb57600080fd5b813562ffffff811681146128ce57600080fd5b9392505050565b6000806000806000608086880312156128ed57600080fd5b6128f68661251f565b945060208601356001600160401b0381111561291157600080fd5b61291d88828901612553565b909550935050604086013591506129366060870161251f565b90509295509295909350565b60006020828403121561295457600080fd5b5035919050565b60008060006060848603121561297057600080fd5b505081359360208301359350604090920135919050565b6000806020838503121561299a57600080fd5b82356001600160401b038111156129b057600080fd5b6129bc8582860161259b565b90969095509350505050565b600081518084526020808501945080840160005b838110156129f8578151875295820195908201906001016129dc565b509495945050505050565b6020815260006128ce60208301846129c8565b600080600060408486031215612a2b57600080fd5b612a348461251f565b925060208401356001600160401b03811115612a4f57600080fd5b612a5b8682870161259b565b9497909650939450505050565b600081518084526020808501945080840160005b838110156129f85781516001600160a01b031687529582019590820190600101612a7c565b604081526000612ab46040830185612a68565b8281036020840152612ac681856129c8565b95945050505050565b600060208284031215612ae157600080fd5b6128ce8261251f565b60008060008060008060008060c0898b031215612b0657600080fd5b88356001600160401b0380821115612b1d57600080fd5b612b298c838d0161259b565b909a50985060208b0135915080821115612b4257600080fd5b50612b4f8b828c0161259b565b999c989b5099604081013598606082013598506080820135975060a09091013595509350505050565b60008060408385031215612b8b57600080fd5b612b948361251f565b946020939093013593505050565b6020808252600c908201526b155b985d5d1a1bdc9a5e995960a21b604082015260600190565b600060208284031215612bda57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561106957611069612be1565b8183823760009101908152919050565b6020808252600f908201526e151c985b9cd9995c8819985a5b1959608a1b604082015260600190565b60ff8116811461286f57600080fd5b600060208284031215612c6457600080fd5b81516128ce81612c43565b600181815b80851115612caa578160001904821115612c9057612c90612be1565b80851615612c9d57918102915b93841c9390800290612c74565b509250929050565b600082612cc157506001611069565b81612cce57506000611069565b8160018114612ce45760028114612cee57612d0a565b6001915050611069565b60ff841115612cff57612cff612be1565b50506001821b611069565b5060208310610133831016604e8410600b8410161715612d2d575081810a611069565b612d378383612c6f565b8060001904821115612d4b57612d4b612be1565b029392505050565b60006128ce60ff841683612cb2565b808202811582820484141761106957611069612be1565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201612db757612db7612be1565b5060010190565b8082018082111561106957611069612be1565b60006128ce8383612cb2565b600082612dfa57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612e1157600080fd5b81356128ce81612c43565b60005b83811015612e37578181015183820152602001612e1f565b50506000910152565b60008151808452612e58816020860160208601612e1c565b601f01601f19169290920160200192915050565b602081526000825160a06020840152612e8860c0840182612e40565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b85815284602082015260a060408201526000612ee360a0830186612a68565b6001600160a01b0394909416606083015250608001529392505050565b60006020808385031215612f1357600080fd5b82516001600160401b0380821115612f2a57600080fd5b818501915085601f830112612f3e57600080fd5b815181811115612f5057612f50612d79565b8060051b604051601f19603f83011681018181108582111715612f7557612f75612d79565b604052918252848201925083810185019188831115612f9357600080fd5b938501935b82851015612fb157845184529385019392850192612f98565b98975050505050505050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b60006020828403121561300a57600080fd5b81516128ce81612861565b60008251613027818460208701612e1c565b9190910192915050565b6020815260006128ce6020830184612e4056fea26469706673582212203fc8db58cd08126d2a940e14eb23dcabbb8b50941f5e846f542cf1071d65c33964736f6c634300081300330000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d000000000000000000000000757eeb3e60d0d3f9a8a34a8540ab6c88eb058e49000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000050
Deployed Bytecode
0x60806040526004361061010d5760003560e01c80639984f30d11610095578063db91774c11610064578063db91774c14610340578063e887051214610360578063ecd8dc3a14610380578063ede29487146103a0578063f3fef3a3146103b357600080fd5b80639984f30d146102b2578063b2cd87f7146102d2578063b8b4ca0f146102e5578063d802178e1461031257600080fd5b80634c9eb4d4116100dc5780634c9eb4d41461021457806350fc5f74146102325780635227767c1461025257806356bc3d4c1461027257806370ec9d081461029257600080fd5b806318993c961461018757806320f5590c146101b4578063389a36d2146101d45780633eb8f396146101f457600080fd5b3661018257336001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216146101805760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b73232b960911b60448201526064015b60405180910390fd5b005b600080fd5b34801561019357600080fd5b506003546040516001600160a01b0390911681526020015b60405180910390f35b3480156101c057600080fd5b506101806101cf3660046125df565b6103d3565b3480156101e057600080fd5b506101806101ef3660046126b1565b6104f8565b34801561020057600080fd5b5061018061020f366004612759565b610740565b34801561022057600080fd5b506004546040519081526020016101ab565b34801561023e57600080fd5b5061018061024d366004612813565b610811565b34801561025e57600080fd5b5061018061026d366004612872565b6108fe565b34801561027e57600080fd5b5061018061028d3660046128a9565b610986565b34801561029e57600080fd5b506101806102ad3660046128d5565b610a04565b3480156102be57600080fd5b506101806102cd366004612942565b610b41565b6101806102e036600461295b565b610c1b565b3480156102f157600080fd5b50610305610300366004612987565b610f2b565b6040516101ab9190612a03565b34801561031e57600080fd5b5061033261032d366004612a16565b61106f565b6040516101ab929190612aa1565b34801561034c57600080fd5b5061018061035b366004612942565b6112a9565b34801561036c57600080fd5b5061018061037b366004612acf565b611383565b34801561038c57600080fd5b5061018061039b366004612872565b6115d2565b6101806103ae366004612aea565b611645565b3480156103bf57600080fd5b506101806103ce366004612b78565b611873565b3360009081526020819052604090205460ff166104025760405162461bcd60e51b815260040161017790612ba2565b8960400135841061044b5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081cddd85c08185b5bdd5b9d606a1b6044820152606401610177565b6104558b8b61194d565b6104cc898c8a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c9182918501908490808284376000920191909152508b92508a9150889050611ade565b6104d4611c9e565b6104eb6104e460208c018c612acf565b8484611db3565b5050505050505050505050565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146105405760405162461bcd60e51b815260040161017790612ba2565b6003546001600160a01b03908116908a168190036105905760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610177565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156105d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fb9190612bc8565b90506106748a8c8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808f0282810182019093528e82529093508e92508d9182918501908490808284376000920191909152508c92508b91508a9050611ade565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a0823190602401602060405180830381865afa1580156106bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e19190612bc8565b6106eb9190612bf7565b9050848110156107325760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908185b5bdd5b9d081bdd5d60721b6044820152606401610177565b505050505050505050505050565b3360009081526020819052604090205460ff1661076f5760405162461bcd60e51b815260040161017790612ba2565b610779898961194d565b6003546001600160a01b038a811691161461080657610806878a88888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a91829185019084908082843760009201919091525050505060408d01358787611ade565b505050505050505050565b3360009081526020819052604090205460ff166108405760405162461bcd60e51b815260040161017790612ba2565b60008381526001602052604090205460ff16156108955760405162461bcd60e51b8152602060048201526013602482015272115e1c1a5c9959081bdd5d189bdd5b99081251606a1b6044820152606401610177565b60008381526001602081905260408220805460ff19168217905581906108ba90611e78565b6002546003549294509092506108e1916001600160a01b03918216911684848c8b89611ade565b6108e9611c9e565b6108f4878786611db3565b5050505050505050565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146109465760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b03821661095957600080fd5b60028054911515600160a01b026001600160a81b03199092166001600160a01b0390931692909217179055565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146109ce5760405162461bcd60e51b815260040161017790612ba2565b60008162ffffff16116109e057600080fd5b6003805462ffffff909216600160a01b0262ffffff60a01b19909216919091179055565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d1614610a4c5760405162461bcd60e51b815260040161017790612ba2565b6000856001600160a01b0316838686604051610a69929190612c0a565b60006040518083038185875af1925050503d8060008114610aa6576040519150601f19603f3d011682016040523d82523d6000602084013e610aab565b606091505b5050905080610ab957600080fd5b6001600160a01b03821615610b39576040516001600160a01b038316904790600081818185875af1925050503d8060008114610b11576040519150601f19603f3d011682016040523d82523d6000602084013e610b16565b606091505b50508091505080610b395760405162461bcd60e51b815260040161017790612c1a565b505050505050565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d1614610b895760405162461bcd60e51b815260040161017790612ba2565b600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190612c52565b610c0b90600a612d53565b610c159082612d62565b60045550565b60003411610c5c5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610177565b468314158015610c6b57508215155b610caa5760405162461bcd60e51b815260206004820152601060248201526f125b9d985b1a590818da185a5b88125160821b6044820152606401610177565b6003546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612bc8565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610d7857600080fd5b505af1158015610d8c573d6000803e3d6000fd5b5050505050600080610d9e6000611e78565b6002549193509150610dde906001600160a01b03167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28484348b8b611ade565b6040516370a0823160e01b815230600482015260009084906001600160a01b038716906370a0823190602401602060405180830381865afa158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612bc8565b610e559190612bf7565b9050600454811115610e9e5760405162461bcd60e51b81526020600482015260126024820152714578636565646564206d61782076616c756560701b6044820152606401610177565b600554811015610ee25760405162461bcd60e51b815260206004820152600f60248201526e42656c6f77206d696e2076616c756560881b6044820152606401610177565b60408051348152602081018390528991469133917ff755c7bd8e08bc9995b8fa20e1b423b79cf46c754de658c7ef3caafe2b940671910160405180910390a45050505050505050565b6060816000816001600160401b03811115610f4857610f48612d79565b604051908082528060200260200182016040528015610f71578160200160208202803683370190505b50905060005b8281101561106457600080878784818110610f9457610f94612d8f565b9050602002016020810190610fa99190612acf565b6001600160a01b0316815260208101919091526040016000205460ff166110045760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b2103932b630bcb2b960891b6044820152606401610177565b85858281811061101657611016612d8f565b905060200201602081019061102b9190612acf565b6001600160a01b03163182828151811061104757611047612d8f565b60209081029190910101528061105c81612da5565b915050610f77565b509150505b92915050565b606080600061107f846001612dbe565b90506000816001600160401b0381111561109b5761109b612d79565b6040519080825280602002602001820160405280156110c4578160200160208202803683370190505b5090506000826001600160401b038111156110e1576110e1612d79565b60405190808252806020026020018201604052801561110a578160200160208202803683370190505b50905060008260008151811061112257611122612d8f565b60200260200101906001600160a01b031690816001600160a01b031681525050876001600160a01b0316318160008151811061116057611160612d8f565b602090810291909101015260015b8381101561129b578787611183600184612bf7565b81811061119257611192612d8f565b90506020020160208101906111a79190612acf565b6040516370a0823160e01b81526001600160a01b038b8116600483015291909116906370a0823190602401602060405180830381865afa1580156111ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112139190612bc8565b82828151811061122557611225612d8f565b6020908102919091010152878761123d600184612bf7565b81811061124c5761124c612d8f565b90506020020160208101906112619190612acf565b83828151811061127357611273612d8f565b6001600160a01b039092166020928302919091019091015261129481612da5565b905061116e565b509097909650945050505050565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146112f15760405162461bcd60e51b815260040161017790612ba2565b600360009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113689190612c52565b61137390600a612d53565b61137d9082612d62565b60055550565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146113cb5760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b0381166113de57600080fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316816001600160a01b03160361141c57600080fd5b6003546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015611466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148a9190612c52565b600380546001600160a01b0319166001600160a01b03851617905560ff1690506114b581600a612dd1565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115179190612c52565b61152290600a612d53565b60045461152f9190612d62565b6115399190612ddd565b60045561154781600a612dd1565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190612c52565b6115b490600a612d53565b6005546115c19190612d62565b6115cb9190612ddd565b6005555050565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d161461161a5760405162461bcd60e51b815260040161017790612ba2565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d161461168d5760405162461bcd60e51b815260040161017790612ba2565b60008061169a6001611e78565b6002546003549294509092506116c1916001600160a01b03918216911684848a8a89611ade565b6116c9611c9e565b60005b898110156104eb576000808c8c848181106116e9576116e9612d8f565b90506020020160208101906116fe9190612acf565b6001600160a01b0316815260208101919091526040016000205460ff166117595760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b2103932b630bcb2b960891b6044820152606401610177565b61176460018b612bf7565b81036117b8576117b38b8b8381811061177f5761177f612d8f565b90506020020160208101906117949190612acf565b8a8a848181106117a6576117a6612d8f565b9050602002013587611db3565b61186b565b60008b8b838181106117cc576117cc612d8f565b90506020020160208101906117e19190612acf565b6001600160a01b03168a8a848181106117fc576117fc612d8f565b9050602002013560405160006040518083038185875af1925050503d8060008114611843576040519150601f19603f3d011682016040523d82523d6000602084013e611848565b606091505b50509050806118695760405162461bcd60e51b815260040161017790612c1a565b505b6001016116cc565b336001600160a01b037f0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d16146118bb5760405162461bcd60e51b815260040161017790612ba2565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611902573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119269190612bc8565b905080821115611934578091505b6119486001600160a01b0384163384612069565b505050565b60408101356001600160a01b03831663dd62ed3e61196e6020850185612acf565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa1580156119b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119dc9190612bc8565b1015611ab4576001600160a01b03821663d505accf6119fe6020840184612acf565b611a0e6040850160208601612acf565b60408501356060860135611a2860a0880160808901612dff565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff16608482015260a084013560a482015260c084013560c482015260e401600060405180830381600087803b158015611a9b57600080fd5b505af1158015611aaf573d6000803e3d6000fd5b505050505b611ada611ac46020830183612acf565b6001600160a01b038416903060408501356120cc565b5050565b604051636eb1769f60e11b81523060048201526001600160a01b0388811660248301526000919088169063dd62ed3e90604401602060405180830381865afa158015611b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b529190612bc8565b90508015611b6e57611b6e6001600160a01b0388168983612104565b611b826001600160a01b038816898661220d565b855115611c23576040805160a0810182528781523060208201528082018490526060810186905260808101859052905163c04b8d5960e01b81526001600160a01b038a169163c04b8d5991611bda9190600401612e6c565b6020604051808303816000875af1158015611bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1d9190612bc8565b506108f4565b6040516338ed173960e01b81526001600160a01b038916906338ed173990611c5790879087908a9030908990600401612ec4565b6000604051808303816000875af1158015611c76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108069190810190612f00565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a0823190602401602060405180830381865afa158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d299190612bc8565b905080600003611d365750565b604051632e1a7d4d60e01b8152600481018290527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015611d9857600080fd5b505af1158015611dac573d6000803e3d6000fd5b5050505050565b81471015611dfc5760405162461bcd60e51b81526020600482015260166024820152754e61746976652062616c616e636520746f6f206c6f7760501b6044820152606401610177565b6000836001600160a01b0316478390604051600060405180830381858888f193505050503d8060008114611e4c576040519150601f19603f3d011682016040523d82523d6000602084013e611e51565b606091505b5050905080611e725760405162461bcd60e51b815260040161017790612c1a565b50505050565b6002546060908190600160a01b900460ff1615611f43578215611ef857600354604051611ee2916001600160a01b03811691600160a01b90910462ffffff16907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290602001612fbd565b6040516020818303038152906040529150915091565b600354604051611ee2917f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29162ffffff600160a01b830416916001600160a01b031690602001612fbd565b604080516002808252606082018352909160208301908036833701905050905082156120045760035481516001600160a01b03909116908290600090611f8b57611f8b612d8f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110611fdf57611fdf612d8f565b60200260200101906001600160a01b031690816001600160a01b031681525050915091565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160008151811061203857612038612d8f565b6001600160a01b039283166020918202929092010152600354825191169082906001908110611fdf57611fdf612d8f565b6040516001600160a01b03831660248201526044810182905261194890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122ba565b6040516001600160a01b0380851660248301528316604482015260648101829052611e729085906323b872dd60e01b90608401612095565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121789190612bc8565b9050818110156121dc5760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610177565b6040516001600160a01b03841660248201528282036044820152611e7290859063095ea7b360e01b90606401612095565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122819190612bc8565b9050611e728463095ea7b360e01b8561229a8686612dbe565b6040516001600160a01b0390921660248301526044820152606401612095565b600061230f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661238f9092919063ffffffff16565b90508051600014806123305750808060200190518101906123309190612ff8565b6119485760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610177565b606061239e84846000856123a6565b949350505050565b6060824710156124075760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610177565b600080866001600160a01b031685876040516124239190613015565b60006040518083038185875af1925050503d8060008114612460576040519150601f19603f3d011682016040523d82523d6000602084013e612465565b606091505b509150915061247687838387612481565b979650505050505050565b606083156124f05782516000036124e9576001600160a01b0385163b6124e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610177565b508161239e565b61239e83838151156125055781518083602001fd5b8060405162461bcd60e51b81526004016101779190613031565b80356001600160a01b038116811461253657600080fd5b919050565b600060e0828403121561254d57600080fd5b50919050565b60008083601f84011261256557600080fd5b5081356001600160401b0381111561257c57600080fd5b60208301915083602082850101111561259457600080fd5b9250929050565b60008083601f8401126125ad57600080fd5b5081356001600160401b038111156125c457600080fd5b6020830191508360208260051b850101111561259457600080fd5b60008060008060008060008060008060006101e08c8e03121561260157600080fd5b61260a8c61251f565b9a506126198d60208e0161253b565b99506126286101008d0161251f565b98506001600160401b03806101208e0135111561264457600080fd5b6126558e6101208f01358f01612553565b90995097506101408d013581101561266c57600080fd5b5061267e8d6101408e01358e0161259b565b9b9e9a9d50989b979a969996976101608101359761018082013597506101a082013596506101c090910135945092505050565b600080600080600080600080600060e08a8c0312156126cf57600080fd5b6126d88a61251f565b98506126e660208b0161251f565b975060408a01356001600160401b038082111561270257600080fd5b61270e8d838e01612553565b909950975060608c013591508082111561272757600080fd5b506127348c828d0161259b565b9a9d999c50979a9699979860808801359760a0810135975060c0013595509350505050565b60008060008060008060008060006101a08a8c03121561277857600080fd5b6127818a61251f565b98506127908b60208c0161253b565b975061279f6101008b0161251f565b96506101208a01356001600160401b03808211156127bc57600080fd5b6127c88d838e01612553565b90985096506101408c01359150808211156127e257600080fd5b506127ef8c828d0161259b565b9a9d999c50979a969995989596610160810135966101809091013595509350505050565b60008060008060008060c0878903121561282c57600080fd5b8635955061283c6020880161251f565b95989597505050506040840135936060810135936080820135935060a0909101359150565b801515811461286f57600080fd5b50565b6000806040838503121561288557600080fd5b61288e8361251f565b9150602083013561289e81612861565b809150509250929050565b6000602082840312156128bb57600080fd5b813562ffffff811681146128ce57600080fd5b9392505050565b6000806000806000608086880312156128ed57600080fd5b6128f68661251f565b945060208601356001600160401b0381111561291157600080fd5b61291d88828901612553565b909550935050604086013591506129366060870161251f565b90509295509295909350565b60006020828403121561295457600080fd5b5035919050565b60008060006060848603121561297057600080fd5b505081359360208301359350604090920135919050565b6000806020838503121561299a57600080fd5b82356001600160401b038111156129b057600080fd5b6129bc8582860161259b565b90969095509350505050565b600081518084526020808501945080840160005b838110156129f8578151875295820195908201906001016129dc565b509495945050505050565b6020815260006128ce60208301846129c8565b600080600060408486031215612a2b57600080fd5b612a348461251f565b925060208401356001600160401b03811115612a4f57600080fd5b612a5b8682870161259b565b9497909650939450505050565b600081518084526020808501945080840160005b838110156129f85781516001600160a01b031687529582019590820190600101612a7c565b604081526000612ab46040830185612a68565b8281036020840152612ac681856129c8565b95945050505050565b600060208284031215612ae157600080fd5b6128ce8261251f565b60008060008060008060008060c0898b031215612b0657600080fd5b88356001600160401b0380821115612b1d57600080fd5b612b298c838d0161259b565b909a50985060208b0135915080821115612b4257600080fd5b50612b4f8b828c0161259b565b999c989b5099604081013598606082013598506080820135975060a09091013595509350505050565b60008060408385031215612b8b57600080fd5b612b948361251f565b946020939093013593505050565b6020808252600c908201526b155b985d5d1a1bdc9a5e995960a21b604082015260600190565b600060208284031215612bda57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561106957611069612be1565b8183823760009101908152919050565b6020808252600f908201526e151c985b9cd9995c8819985a5b1959608a1b604082015260600190565b60ff8116811461286f57600080fd5b600060208284031215612c6457600080fd5b81516128ce81612c43565b600181815b80851115612caa578160001904821115612c9057612c90612be1565b80851615612c9d57918102915b93841c9390800290612c74565b509250929050565b600082612cc157506001611069565b81612cce57506000611069565b8160018114612ce45760028114612cee57612d0a565b6001915050611069565b60ff841115612cff57612cff612be1565b50506001821b611069565b5060208310610133831016604e8410600b8410161715612d2d575081810a611069565b612d378383612c6f565b8060001904821115612d4b57612d4b612be1565b029392505050565b60006128ce60ff841683612cb2565b808202811582820484141761106957611069612be1565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060018201612db757612db7612be1565b5060010190565b8082018082111561106957611069612be1565b60006128ce8383612cb2565b600082612dfa57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612e1157600080fd5b81356128ce81612c43565b60005b83811015612e37578181015183820152602001612e1f565b50506000910152565b60008151808452612e58816020860160208601612e1c565b601f01601f19169290920160200192915050565b602081526000825160a06020840152612e8860c0840182612e40565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b85815284602082015260a060408201526000612ee360a0830186612a68565b6001600160a01b0394909416606083015250608001529392505050565b60006020808385031215612f1357600080fd5b82516001600160401b0380821115612f2a57600080fd5b818501915085601f830112612f3e57600080fd5b815181811115612f5057612f50612d79565b8060051b604051601f19603f83011681018181108582111715612f7557612f75612d79565b604052918252848201925083810185019188831115612f9357600080fd5b938501935b82851015612fb157845184529385019392850192612f98565b98975050505050505050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b60006020828403121561300a57600080fd5b81516128ce81612861565b60008251613027818460208701612e1c565b9190910192915050565b6020815260006128ce6020830184612e4056fea26469706673582212203fc8db58cd08126d2a940e14eb23dcabbb8b50941f5e846f542cf1071d65c33964736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d000000000000000000000000757eeb3e60d0d3f9a8a34a8540ab6c88eb058e49000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000050
-----Decoded View---------------
Arg [0] : _owner (address): 0x9d5232b79b8BfB040942Df198cbba775268FB83D
Arg [1] : _relayer (address): 0x757EEB3E60d0D3f9a8a34A8540AB6c88eB058e49
Arg [2] : _defaultRouter (address): 0xE592427A0AEce92De3Edee1F18E0157C05861564
Arg [3] : _isV3Router (bool): True
Arg [4] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [5] : _homeToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [6] : _maxValue (uint256): 80
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000009d5232b79b8bfb040942df198cbba775268fb83d
Arg [1] : 000000000000000000000000757eeb3e60d0d3f9a8a34a8540ab6c88eb058e49
Arg [2] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [5] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000050
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
CRONOS | 24.66% | $0.997102 | 488.18 | $486.77 | |
POL | 12.27% | $0.997983 | 242.6083 | $242.12 | |
POL | 0.87% | $0.997983 | 17.14 | $17.11 | |
POL | 0.48% | $0.998966 | 9.4 | $9.39 | |
POL | <0.01% | $0.001645 | 68.1811 | $0.1121 | |
BASE | 11.58% | $0.997102 | 229.1593 | $228.5 | |
OP | 8.46% | $0.997102 | 167.5101 | $167.02 | |
OP | 0.02% | $1.81 | 0.1881 | $0.3412 | |
BSC | 7.73% | $0.998966 | 152.6824 | $152.52 | |
BSC | 0.02% | $0.402347 | 0.7816 | $0.3144 | |
SCROLL | 7.12% | $0.999794 | 140.5101 | $140.48 | |
BLAST | 6.91% | $1.01 | 134.4891 | $136.37 | |
ARB | 5.99% | $1 | 118.3362 | $118.34 | |
ARB | 0.41% | $0.999646 | 8.13 | $8.13 | |
ARB | 0.36% | $1 | 7.19 | $7.19 | |
ARB | 0.02% | $22.89 | 0.0187 | $0.428 | |
ARB | 0.02% | $0.75165 | 0.4624 | $0.3475 | |
ARB | 0.02% | $17.46 | 0.0185 | $0.3232 | |
LINEA | 6.05% | $0.999794 | 119.4378 | $119.41 | |
AVAX | 5.62% | $1 | 110.892 | $110.9 | |
ETH | 1.12% | $0.99918 | 22.12 | $22.1 | |
ETH | 0.28% | $1 | 5.5005 | $5.5 | |
FTM | 0.01% | $0.932556 | 0.2323 | $0.2166 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.