Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
Latest 25 from a total of 166 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 15440530 | 764 days ago | IN | 0 ETH | 0.00301327 | ||||
Withdraw | 15355230 | 778 days ago | IN | 0 ETH | 0.00127601 | ||||
Withdraw | 15173323 | 806 days ago | IN | 0 ETH | 0.00653159 | ||||
Withdraw | 15154807 | 809 days ago | IN | 0 ETH | 0.01373409 | ||||
Withdraw | 15100961 | 817 days ago | IN | 0 ETH | 0.002619 | ||||
Withdraw With Ra... | 15007128 | 833 days ago | IN | 0 ETH | 0.00146433 | ||||
Withdraw With Ra... | 14933198 | 846 days ago | IN | 0 ETH | 0.00427811 | ||||
Withdraw With Ra... | 14933190 | 846 days ago | IN | 0 ETH | 0.00423825 | ||||
Withdraw With Ra... | 14931507 | 846 days ago | IN | 0 ETH | 0.00334391 | ||||
Deposit | 14926146 | 847 days ago | IN | 0 ETH | 0.005726 | ||||
Deposit | 14925462 | 847 days ago | IN | 0 ETH | 0.00638617 | ||||
Withdraw | 14871531 | 856 days ago | IN | 0 ETH | 0.00208483 | ||||
Deposit | 14871525 | 856 days ago | IN | 0 ETH | 0.00296511 | ||||
Deposit | 14854141 | 859 days ago | IN | 0 ETH | 0.00301332 | ||||
Deposit | 14854105 | 859 days ago | IN | 0 ETH | 0.00415643 | ||||
Withdraw | 14791232 | 869 days ago | IN | 0 ETH | 0.0031848 | ||||
Deposit | 14791230 | 869 days ago | IN | 0 ETH | 0.00418623 | ||||
Withdraw | 14786160 | 870 days ago | IN | 0 ETH | 0.00254075 | ||||
Deposit | 14781979 | 871 days ago | IN | 0 ETH | 0.00460739 | ||||
Deposit | 14742833 | 877 days ago | IN | 0 ETH | 0.00764272 | ||||
Withdraw | 14741985 | 877 days ago | IN | 0 ETH | 0.00599574 | ||||
Deposit | 14741983 | 877 days ago | IN | 0 ETH | 0.00357201 | ||||
Deposit | 14741737 | 877 days ago | IN | 0 ETH | 0.00176412 | ||||
Deposit | 14741732 | 877 days ago | IN | 0 ETH | 0.00272927 | ||||
Withdraw | 14711596 | 882 days ago | IN | 0 ETH | 0.00558556 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
FixedRateSwap
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @dev AMM that is designed for assets with stable price to each other e.g. USDC and USDT. * It utilizes constant sum price curve x + y = const but fee is variable depending on the token balances. * In most cases fee is equal to 1 bip. But when balances are at extreme ends it either lowers to 0 * or increases to 20 bip. * Fee calculations are explained in more details in `getReturn` method. * Note that AMM does not support token with fees. * Note that tokens decimals are required to be the same. */ contract FixedRateSwap is ERC20 { using SafeERC20 for IERC20; using SafeCast for uint256; event Swap( address indexed trader, int256 token0Amount, int256 token1Amount ); event Deposit( address indexed user, uint256 token0Amount, uint256 token1Amount, uint256 share ); event Withdrawal( address indexed user, uint256 token0Amount, uint256 token1Amount, uint256 share ); IERC20 immutable public token0; IERC20 immutable public token1; uint8 immutable private _decimals; uint256 constant private _ONE = 1e18; uint256 constant private _C1 = 0.9999e18; uint256 constant private _C2 = 3.382712334998325432e18; uint256 constant private _C3 = 0.456807350974663119e18; uint256 constant private _THRESHOLD = 1; uint256 constant private _LOWER_BOUND_NUMERATOR = 998; uint256 constant private _UPPER_BOUND_NUMERATOR = 1002; uint256 constant private _DENOMINATOR = 1000; constructor( IERC20 _token0, IERC20 _token1, string memory name, string memory symbol, uint8 decimals_ ) ERC20(name, symbol) { token0 = _token0; token1 = _token1; _decimals = decimals_; require(IERC20Metadata(address(_token0)).decimals() == decimals_, "token0 decimals mismatch"); require(IERC20Metadata(address(_token1)).decimals() == decimals_, "token1 decimals mismatch"); } function decimals() public view override returns(uint8) { return _decimals; } /** * @notice estimates return value of the swap * @param tokenFrom token that user wants to sell * @param tokenTo token that user wants to buy * @param inputAmount amount of `tokenFrom` that user wants to sell * @return outputAmount amount of `tokenTo` that user will receive after the trade * * @dev * `getReturn` at point `x = inputBalance / (inputBalance + outputBalance)`: * `getReturn(x) = 0.9999 + (0.5817091329374359 - x * 1.2734233188154198)^17` * When balance is changed from `inputBalance` to `inputBalance + amount` we should take * integral of getReturn to calculate proper amount: * `getReturn(x0, x1) = (integral (0.9999 + (0.5817091329374359 - x * 1.2734233188154198)^17) dx from x=x0 to x=x1) / (x1 - x0)` * `getReturn(x0, x1) = (0.9999 * x - 3.3827123349983306 * (x - 0.4568073509746632) ** 18 from x=x0 to x=x1) / (x1 - x0)` * `getReturn(x0, x1) = (0.9999 * (x1 - x0) + 3.3827123349983306 * ((x0 - 0.4568073509746632) ** 18 - (x1 - 0.4568073509746632) ** 18)) / (x1 - x0)` * C0 = 0.9999 * C2 = 3.3827123349983306 * C3 = 0.4568073509746632 * `getReturn(x0, x1) = (C0 * (x1 - x0) + C2 * ((x0 - C3) ** 18 - (x1 - C3) ** 18)) / (x1 - x0)` */ function getReturn(IERC20 tokenFrom, IERC20 tokenTo, uint256 inputAmount) public view returns(uint256 outputAmount) { require(inputAmount > 0, "Input amount should be > 0"); uint256 fromBalance = tokenFrom.balanceOf(address(this)); uint256 toBalance = tokenTo.balanceOf(address(this)); // require is needed to be sure that _getReturn math won't overflow require(inputAmount <= toBalance, "Input amount is too big"); outputAmount = _getReturn(fromBalance, toBalance, inputAmount); } /** * @notice makes a deposit of both tokens to the AMM * @param token0Amount amount of token0 to deposit * @param token1Amount amount of token1 to deposit * @param minShare minimal required amount of LP tokens received * @return share amount of LP tokens received */ function deposit(uint256 token0Amount, uint256 token1Amount, uint256 minShare) external returns(uint256 share) { share = depositFor(token0Amount, token1Amount, msg.sender, minShare); } /** * @notice makes a deposit of both tokens to the AMM and transfers LP tokens to the specified address * @param token0Amount amount of token0 to deposit * @param token1Amount amount of token1 to deposit * @param to address that will receive tokens * @param minShare minimal required amount of LP tokens received * @return share amount of LP tokens received * * @dev fully balanced deposit happens when ratio of amounts of deposit matches ratio of balances. * To make a fair deposit when ratios do not match the contract finds the amount that is needed to swap to * equalize ratios and makes that swap virtually to capture the swap fees. Then final share is calculated from * fair deposit of virtual amounts. */ function depositFor(uint256 token0Amount, uint256 token1Amount, address to, uint256 minShare) public returns(uint256 share) { uint256 token0Balance = token0.balanceOf(address(this)); uint256 token1Balance = token1.balanceOf(address(this)); (uint256 token0VirtualAmount, uint256 token1VirtualAmount) = _getVirtualAmountsForDeposit(token0Amount, token1Amount, token0Balance, token1Balance); uint256 inputAmount = token0VirtualAmount + token1VirtualAmount; require(inputAmount > 0, "Empty deposit is not allowed"); require(to != address(this), "Deposit to this is forbidden"); // _mint also checks require(to != address(0)) uint256 _totalSupply = totalSupply(); if (_totalSupply > 0) { uint256 totalBalance = token0Balance + token1Balance + token0Amount + token1Amount - inputAmount; share = inputAmount * _totalSupply / totalBalance; } else { share = inputAmount; } require(share >= minShare, "Share is not enough"); _mint(to, share); emit Deposit(to, token0Amount, token1Amount, share); if (token0Amount > 0) { token0.safeTransferFrom(msg.sender, address(this), token0Amount); } if (token1Amount > 0) { token1.safeTransferFrom(msg.sender, address(this), token1Amount); } } /** * @notice makes a proportional withdrawal of both tokens * @param amount amount of LP tokens to burn * @param minToken0Amount minimal required amount of token0 * @param minToken1Amount minimal required amount of token1 * @return token0Amount amount of token0 received * @return token1Amount amount of token1 received */ function withdraw(uint256 amount, uint256 minToken0Amount, uint256 minToken1Amount) external returns(uint256 token0Amount, uint256 token1Amount) { (token0Amount, token1Amount) = withdrawFor(amount, msg.sender, minToken0Amount, minToken1Amount); } /** * @notice makes a proportional withdrawal of both tokens and transfers them to the specified address * @param amount amount of LP tokens to burn * @param to address that will receive tokens * @param minToken0Amount minimal required amount of token0 * @param minToken1Amount minimal required amount of token1 * @return token0Amount amount of token0 received * @return token1Amount amount of token1 received */ function withdrawFor(uint256 amount, address to, uint256 minToken0Amount, uint256 minToken1Amount) public returns(uint256 token0Amount, uint256 token1Amount) { require(amount > 0, "Empty withdrawal is not allowed"); require(to != address(this), "Withdrawal to this is forbidden"); require(to != address(0), "Withdrawal to zero is forbidden"); uint256 _totalSupply = totalSupply(); _burn(msg.sender, amount); token0Amount = token0.balanceOf(address(this)) * amount / _totalSupply; token1Amount = token1.balanceOf(address(this)) * amount / _totalSupply; _handleWithdraw(to, amount, token0Amount, token1Amount, minToken0Amount, minToken1Amount); } /** * @notice makes a withdrawal with custom ratio * @param amount amount of LP tokens to burn * @param token0Share percentage of token0 to receive with 100% equals to 1e18 * @param minToken0Amount minimal required amount of token0 * @param minToken1Amount minimal required amount of token1 * @return token0Amount amount of token0 received * @return token1Amount amount of token1 received */ function withdrawWithRatio(uint256 amount, uint256 token0Share, uint256 minToken0Amount, uint256 minToken1Amount) external returns(uint256 token0Amount, uint256 token1Amount) { return withdrawForWithRatio(amount, msg.sender, token0Share, minToken0Amount, minToken1Amount); } /** * @notice makes a withdrawal with custom ratio and transfers tokens to the specified address * @param amount amount of LP tokens to burn * @param to address that will receive tokens * @param token0Share percentage of token0 to receive with 100% equals to 1e18 * @param minToken0Amount minimal required amount of token0 * @param minToken1Amount minimal required amount of token1 * @return token0Amount amount of token0 received * @return token1Amount amount of token1 received * * @dev withdrawal with custom ratio is semantically equal to proportional withdrawal with extra swap afterwards to * get to the specified ratio. The contract does exactly this by making virtual proportional withdrawal and then * finds the amount needed for an extra virtual swap to achieve specified ratio. */ function withdrawForWithRatio(uint256 amount, address to, uint256 token0Share, uint256 minToken0Amount, uint256 minToken1Amount) public returns(uint256 token0Amount, uint256 token1Amount) { require(amount > 0, "Empty withdrawal is not allowed"); require(to != address(this), "Withdrawal to this is forbidden"); require(to != address(0), "Withdrawal to zero is forbidden"); require(token0Share <= _ONE, "Ratio should be in [0, 1]"); uint256 _totalSupply = totalSupply(); // burn happens before amounts calculations intentionally — to validate amount _burn(msg.sender, amount); (token0Amount, token1Amount) = _getRealAmountsForWithdraw(amount, token0Share, _totalSupply); _handleWithdraw(to, amount, token0Amount, token1Amount, minToken0Amount, minToken1Amount); } /** * @notice swaps token0 for token1 * @param inputAmount amount of token0 to sell * @param minReturnAmount minimal required amount of token1 to buy * @return outputAmount amount of token1 bought */ function swap0To1(uint256 inputAmount, uint256 minReturnAmount) external returns(uint256 outputAmount) { outputAmount = _swap(token0, token1, inputAmount, msg.sender, minReturnAmount); emit Swap(msg.sender, inputAmount.toInt256(), -outputAmount.toInt256()); } /** * @notice swaps token1 for token0 * @param inputAmount amount of token1 to sell * @param minReturnAmount minimal required amount of token0 to buy * @return outputAmount amount of token0 bought */ function swap1To0(uint256 inputAmount, uint256 minReturnAmount) external returns(uint256 outputAmount) { outputAmount = _swap(token1, token0, inputAmount, msg.sender, minReturnAmount); emit Swap(msg.sender, -outputAmount.toInt256(), inputAmount.toInt256()); } /** * @notice swaps token0 for token1 and transfers them to specified receiver address * @param inputAmount amount of token0 to sell * @param to address that will receive tokens * @param minReturnAmount minimal required amount of token1 to buy * @return outputAmount amount of token1 bought */ function swap0To1For(uint256 inputAmount, address to, uint256 minReturnAmount) external returns(uint256 outputAmount) { require(to != address(this), "Swap to this is forbidden"); require(to != address(0), "Swap to zero is forbidden"); outputAmount = _swap(token0, token1, inputAmount, to, minReturnAmount); emit Swap(msg.sender, inputAmount.toInt256(), -outputAmount.toInt256()); } /** * @notice swaps token1 for token0 and transfers them to specified receiver address * @param inputAmount amount of token1 to sell * @param to address that will receive tokens * @param minReturnAmount minimal required amount of token0 to buy * @return outputAmount amount of token0 bought */ function swap1To0For(uint256 inputAmount, address to, uint256 minReturnAmount) external returns(uint256 outputAmount) { require(to != address(this), "Swap to this is forbidden"); require(to != address(0), "Swap to zero is forbidden"); outputAmount = _swap(token1, token0, inputAmount, to, minReturnAmount); emit Swap(msg.sender, -outputAmount.toInt256(), inputAmount.toInt256()); } function _getVirtualAmountsForDeposit(uint256 token0Amount, uint256 token1Amount, uint256 token0Balance, uint256 token1Balance) private pure returns(uint256 token0VirtualAmount, uint256 token1VirtualAmount) { int256 shift = _checkVirtualAmountsFormula(token0Amount, token1Amount, token0Balance, token1Balance); if (shift > 0) { (token0VirtualAmount, token1VirtualAmount) = _getVirtualAmountsForDepositImpl(token0Amount, token1Amount, token0Balance, token1Balance); } else if (shift < 0) { (token1VirtualAmount, token0VirtualAmount) = _getVirtualAmountsForDepositImpl(token1Amount, token0Amount, token1Balance, token0Balance); } else { (token0VirtualAmount, token1VirtualAmount) = (token0Amount, token1Amount); } } function _getRealAmountsForWithdraw(uint256 amount, uint256 token0Share, uint256 _totalSupply) private view returns(uint256 token0RealAmount, uint256 token1RealAmount) { uint256 token0Balance = token0.balanceOf(address(this)); uint256 token1Balance = token1.balanceOf(address(this)); uint256 token0VirtualAmount = token0Balance * amount / _totalSupply; uint256 token1VirtualAmount = token1Balance * amount / _totalSupply; uint256 currentToken0Share = token0VirtualAmount * _ONE / (token0VirtualAmount + token1VirtualAmount); if (token0Share < currentToken0Share) { (token0RealAmount, token1RealAmount) = _getRealAmountsForWithdrawImpl(token0VirtualAmount, token1VirtualAmount, token0Balance - token0VirtualAmount, token1Balance - token1VirtualAmount, token0Share); } else if (token0Share > currentToken0Share) { (token1RealAmount, token0RealAmount) = _getRealAmountsForWithdrawImpl(token1VirtualAmount, token0VirtualAmount, token1Balance - token1VirtualAmount, token0Balance - token0VirtualAmount, _ONE - token0Share); } else { (token0RealAmount, token1RealAmount) = (token0VirtualAmount, token1VirtualAmount); } } function _getReturn(uint256 fromBalance, uint256 toBalance, uint256 inputAmount) private pure returns(uint256 outputAmount) { unchecked { uint256 totalBalance = fromBalance + toBalance; uint256 x0 = _ONE * fromBalance / totalBalance; uint256 x1 = _ONE * (fromBalance + inputAmount) / totalBalance; uint256 scaledInputAmount = _ONE * inputAmount; uint256 amountMultiplier = ( _C1 * scaledInputAmount / totalBalance + _C2 * _powerHelper(x0) - _C2 * _powerHelper(x1) ) * totalBalance / scaledInputAmount; outputAmount = inputAmount * Math.min(amountMultiplier, _ONE) / _ONE; } } function _handleWithdraw(address to, uint256 amount, uint256 token0Amount, uint256 token1Amount, uint256 minToken0Amount, uint256 minToken1Amount) private { require(token0Amount >= minToken0Amount, "Min token0Amount is not reached"); require(token1Amount >= minToken1Amount, "Min token1Amount is not reached"); emit Withdrawal(msg.sender, token0Amount, token1Amount, amount); if (token0Amount > 0) { token0.safeTransfer(to, token0Amount); } if (token1Amount > 0) { token1.safeTransfer(to, token1Amount); } } function _swap(IERC20 tokenFrom, IERC20 tokenTo, uint256 inputAmount, address to, uint256 minReturnAmount) private returns(uint256 outputAmount) { outputAmount = getReturn(tokenFrom, tokenTo, inputAmount); require(outputAmount > 0, "Empty swap is not allowed"); require(outputAmount >= minReturnAmount, "Min return not reached"); tokenFrom.safeTransferFrom(msg.sender, address(this), inputAmount); tokenTo.safeTransfer(to, outputAmount); } /** * @dev We utilize binary search to find proper to swap * * Inital approximation of dx is taken from the same equation by assuming dx ~ dy * * x - dx xBalance + dx * ------ = ------------ * y + dx yBalance - dx * * dx = (x * yBalance - xBalance * y) / (xBalance + yBalance + x + y) */ function _getVirtualAmountsForDepositImpl(uint256 x, uint256 y, uint256 xBalance, uint256 yBalance) private pure returns(uint256, uint256) { uint256 dx = (x * yBalance - y * xBalance) / (xBalance + yBalance + x + y); if (dx == 0) { return (x, y); } uint256 dy; uint256 left = dx * _LOWER_BOUND_NUMERATOR / _DENOMINATOR; uint256 right = Math.min(Math.min(dx * _UPPER_BOUND_NUMERATOR / _DENOMINATOR, yBalance), x); while (left + _THRESHOLD < right) { dy = _getReturn(xBalance, yBalance, dx); int256 shift = _checkVirtualAmountsFormula(x - dx, y + dy, xBalance + dx, yBalance - dy); if (shift > 0) { left = dx; dx = (dx + right) / 2; } else if (shift < 0) { right = dx; dx = (left + dx) / 2; } else { break; } } return (x - dx, y + dy); } /** * @dev We utilize binary search to find proper amount to swap * * Inital approximation of dx is taken from the same equation by assuming dx ~ dy * * x - dx firstTokenShare * ------ = ---------------------- * y + dx _ONE - firstTokenShare * * dx = (x * (_ONE - firstTokenShare) - y * firstTokenShare) / _ONE */ function _getRealAmountsForWithdrawImpl(uint256 virtualX, uint256 virtualY, uint256 balanceX, uint256 balanceY, uint256 firstTokenShare) private pure returns(uint256, uint256) { require(balanceX != 0 || balanceY != 0, "Amount exceeds total balance"); if (firstTokenShare == 0) { return (0, virtualY + _getReturn(balanceX, balanceY, virtualX)); } uint256 secondTokenShare = _ONE - firstTokenShare; uint256 dx = (virtualX * secondTokenShare - virtualY * firstTokenShare) / _ONE; uint256 dy; uint256 left = dx * _LOWER_BOUND_NUMERATOR / _DENOMINATOR; uint256 right = Math.min(dx * _UPPER_BOUND_NUMERATOR / _DENOMINATOR, virtualX); while (left + _THRESHOLD < right) { dy = _getReturn(balanceX, balanceY, dx); int256 shift = _checkVirtualAmountsFormula(virtualX - dx, virtualY + dy, firstTokenShare, secondTokenShare); if (shift > 0) { left = dx; dx = (dx + right) / 2; } else if (shift < 0) { right = dx; dx = (left + dx) / 2; } else { break; } } return (virtualX - dx, virtualY + dy); } /** * @dev * * Equilibrium is when ratio of amounts equals to ratio of balances * * x xBalance * --- == ---------- * y yBalance * */ function _checkVirtualAmountsFormula(uint256 x, uint256 y, uint256 xBalance, uint256 yBalance) private pure returns(int256) { unchecked { return int256(x * yBalance - y * xBalance); } } function _powerHelper(uint256 x) private pure returns(uint256 p) { unchecked { if (x > _C3) { p = x - _C3; } else { p = _C3 - x; } p = p * p / _ONE; // p ^ 2 uint256 pp = p * p / _ONE; // p ^ 4 pp = pp * pp / _ONE; // p ^ 8 pp = pp * pp / _ONE; // p ^ 16 p = p * pp / _ONE; // p ^ 18 } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * 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}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 value {ERC20} uses, unless this function is * 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: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - 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) { _approve(_msgSender(), spender, _allowances[_msgSender()][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) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `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; _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; } _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 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 v4.4.0 (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 v4.4.0 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_token0","type":"address"},{"internalType":"contract IERC20","name":"_token1","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"int256","name":"token0Amount","type":"int256"},{"indexed":false,"internalType":"int256","name":"token1Amount","type":"int256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Withdrawal","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"},{"internalType":"uint256","name":"minShare","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"minShare","type":"uint256"}],"name":"depositFor","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenFrom","type":"address"},{"internalType":"contract IERC20","name":"tokenTo","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"}],"name":"getReturn","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"}],"name":"swap0To1","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"}],"name":"swap0To1For","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"}],"name":"swap1To0","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"}],"name":"swap1To0For","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minToken0Amount","type":"uint256"},{"internalType":"uint256","name":"minToken1Amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"minToken0Amount","type":"uint256"},{"internalType":"uint256","name":"minToken1Amount","type":"uint256"}],"name":"withdrawFor","outputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"token0Share","type":"uint256"},{"internalType":"uint256","name":"minToken0Amount","type":"uint256"},{"internalType":"uint256","name":"minToken1Amount","type":"uint256"}],"name":"withdrawForWithRatio","outputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"token0Share","type":"uint256"},{"internalType":"uint256","name":"minToken0Amount","type":"uint256"},{"internalType":"uint256","name":"minToken1Amount","type":"uint256"}],"name":"withdrawWithRatio","outputs":[{"internalType":"uint256","name":"token0Amount","type":"uint256"},{"internalType":"uint256","name":"token1Amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b50604051620037a6380380620037a68339810160408190526200003491620003a8565b8251839083906200004d90600390602085019062000206565b5080516200006390600490602084019062000206565b5050506001600160a01b03808616608081905290851660a05260ff821660c08190526040805163313ce56760e01b8152905191929163313ce567916004808201926020929091908290030181865afa158015620000c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ea91906200044b565b60ff1614620001405760405162461bcd60e51b815260206004820152601860248201527f746f6b656e3020646563696d616c73206d69736d61746368000000000000000060448201526064015b60405180910390fd5b8060ff16846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000183573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001a991906200044b565b60ff1614620001fb5760405162461bcd60e51b815260206004820152601860248201527f746f6b656e3120646563696d616c73206d69736d617463680000000000000000604482015260640162000137565b5050505050620004ad565b828054620002149062000470565b90600052602060002090601f01602090048101928262000238576000855562000283565b82601f106200025357805160ff191683800117855562000283565b8280016001018555821562000283579182015b828111156200028357825182559160200191906001019062000266565b506200029192915062000295565b5090565b5b8082111562000291576000815560010162000296565b80516001600160a01b0381168114620002c457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002f157600080fd5b81516001600160401b03808211156200030e576200030e620002c9565b604051601f8301601f19908116603f01168101908282118183101715620003395762000339620002c9565b816040528381526020925086838588010111156200035657600080fd5b600091505b838210156200037a57858201830151818301840152908201906200035b565b838211156200038c5760008385830101525b9695505050505050565b805160ff81168114620002c457600080fd5b600080600080600060a08688031215620003c157600080fd5b620003cc86620002ac565b9450620003dc60208701620002ac565b60408701519094506001600160401b0380821115620003fa57600080fd5b6200040889838a01620002df565b945060608801519150808211156200041f57600080fd5b506200042e88828901620002df565b9250506200043f6080870162000396565b90509295509295909350565b6000602082840312156200045e57600080fd5b620004698262000396565b9392505050565b600181811c908216806200048557607f821691505b60208210811415620004a757634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05161324b6200055b600039600061027b0152600081816103bb0152818161095201528181610a2001528181610ba001528181610eb101528181610ffd015281816111a9015281816116da015281816123d201526126a20152600081816101ff01528181610973015281816109ff01528181610aec01528181610e690152818161101e01528181611188015281816116110152818161231e015261265b015261324b6000f3fe608060405234801561001057600080fd5b50600436106101975760003560e01c80638882eb62116100e3578063c755836b1161008c578063db5dadbf11610066578063db5dadbf146103dd578063dd62ed3e146103f0578063eac38e0c1461043657600080fd5b8063c755836b14610390578063cdc4e51d146103a3578063d21220a7146103b657600080fd5b8063a457c2d7116100bd578063a457c2d714610357578063a9059cbb1461036a578063c0a535111461037d57600080fd5b80638882eb621461031457806395d89b4114610327578063a41fe49f1461032f57600080fd5b806323b872dd116101455780635a7e9a5f1161011f5780635a7e9a5f146102b857806360336508146102cb57806370a08231146102de57600080fd5b806323b872dd14610261578063313ce5671461027457806339509351146102a557600080fd5b80630dfe1681116101765780630dfe1681146101fa57806318160ddd146102465780631e1401f81461024e57600080fd5b8062aeef8a1461019c57806306fdde03146101c2578063095ea7b3146101d7575b600080fd5b6101af6101aa366004612d5c565b610449565b6040519081526020015b60405180910390f35b6101ca61045f565b6040516101b99190612db4565b6101ea6101e5366004612e2a565b6104f1565b60405190151581526020016101b9565b6102217f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b9565b6002546101af565b6101af61025c366004612e56565b610507565b6101ea61026f366004612e56565b61071d565b60405160ff7f00000000000000000000000000000000000000000000000000000000000000001681526020016101b9565b6101ea6102b3366004612e2a565b610805565b6101af6102c6366004612e97565b61084e565b6101af6102d9366004612ebe565b6109f8565b6101af6102ec366004612ee0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101af610322366004612efd565b610aa4565b6101ca610ee7565b61034261033d366004612d5c565b610ef6565b604080519283526020830191909152016101b9565b6101ea610365366004612e2a565b610f11565b6101ea610378366004612e2a565b610fe9565b6101af61038b366004612ebe565b610ff6565b6101af61039e366004612e97565b611084565b6103426103b1366004612f3c565b61120f565b6102217f000000000000000000000000000000000000000000000000000000000000000081565b6103426103eb366004612f84565b61142b565b6101af6103fe366004612fb6565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b610342610444366004612fef565b611449565b600061045784843385610aa4565b949350505050565b60606003805461046e9061302c565b80601f016020809104026020016040519081016040528092919081815260200182805461049a9061302c565b80156104e75780601f106104bc576101008083540402835291602001916104e7565b820191906000526020600020905b8154815290600101906020018083116104ca57829003601f168201915b5050505050905090565b60006104fe338484611773565b50600192915050565b6000808211610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e70757420616d6f756e742073686f756c64206265203e203000000000000060448201526064015b60405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106089190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190613080565b905080841115610708576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e70757420616d6f756e7420697320746f6f20626967000000000000000000604482015260640161056e565b610713828286611927565b9695505050505050565b600061072a848484611a03565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600160209081526040808320338452909152902054828110156107eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161056e565b6107f88533858403611773565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104fe9185906108499086906130c8565b611773565b600073ffffffffffffffffffffffffffffffffffffffff83163014156108d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207468697320697320666f7262696464656e00000000000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff831661094d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207a65726f20697320666f7262696464656e00000000000000604482015260640161056e565b61099a7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000868686611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e896109c783611de7565b6109d0906130e0565b6109d987611de7565b6040805192835260208301919091520160405180910390a29392505050565b6000610a477f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000853386611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e89610a7485611de7565b610a7d84611de7565b610a86906130e0565b6040805192835260208301919091520160405180910390a292915050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190613080565b9050600080610c1c89898686611e9d565b90925090506000610c2d82846130c8565b905060008111610c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f456d707479206465706f736974206973206e6f7420616c6c6f77656400000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8816301415610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4465706f73697420746f207468697320697320666f7262696464656e00000000604482015260640161056e565b6000610d2460025490565b90508015610d78576000828b8d610d3b898b6130c8565b610d4591906130c8565b610d4f91906130c8565b610d599190613119565b905080610d668385613130565b610d70919061319c565b975050610d7c565b8196505b87871015610de6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5368617265206973206e6f7420656e6f75676800000000000000000000000000604482015260640161056e565b610df08988611eee565b604080518c8152602081018c905290810188905273ffffffffffffffffffffffffffffffffffffffff8a16907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a28a15610e9157610e9173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633308e61200e565b8915610ed957610ed973ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633308d61200e565b505050505050949350505050565b60606004805461046e9061302c565b600080610f0585338686611449565b90969095509350505050565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610fd2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161056e565b610fdf3385858403611773565b5060019392505050565b60006104fe338484611a03565b60006110457f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000853386611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e8961107283611de7565b61107b906130e0565b610a8686611de7565b600073ffffffffffffffffffffffffffffffffffffffff8316301415611106576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207468697320697320666f7262696464656e00000000000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8316611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207a65726f20697320666f7262696464656e00000000000000604482015260640161056e565b6111d07f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000868686611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e896111fd86611de7565b61120684611de7565b6109d9906130e0565b6000806000871161127c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f456d707479207769746864726177616c206973206e6f7420616c6c6f77656400604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff86163014156112fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207468697320697320666f7262696464656e00604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8616611379576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207a65726f20697320666f7262696464656e00604482015260640161056e565b670de0b6b3a76400008511156113eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f526174696f2073686f756c6420626520696e205b302c20315d00000000000000604482015260640161056e565b60006113f660025490565b905061140233896120ea565b61140d8887836122d4565b9093509150611420878985858989612524565b509550959350505050565b60008061143b863387878761120f565b915091505b94509492505050565b600080600086116114b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f456d707479207769746864726177616c206973206e6f7420616c6c6f77656400604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8516301415611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207468697320697320666f7262696464656e00604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff85166115b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207a65726f20697320666f7262696464656e00604482015260640161056e565b60006115be60025490565b90506115ca33886120ea565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528190889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611658573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167c9190613080565b6116869190613130565b611690919061319c565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529093508190889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117459190613080565b61174f9190613130565b611759919061319c565b9150611769868885858989612524565b5094509492505050565b73ffffffffffffffffffffffffffffffffffffffff8316611815576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff82166118b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60008383018181670de0b6b3a76400008702816119465761194661316d565b049050600082858801670de0b6b3a764000002816119665761196661316d565b049050670de0b6b3a7640000850260008185611981856126d1565b672ef1cef240e848b802611994876126d1565b672ef1cef240e848b8028886670de05bc096e9c00002816119b7576119b761316d565b04010302816119c8576119c861316d565b049050670de0b6b3a76400006119e682670de0b6b3a7640000612740565b8802816119f5576119f561316d565b049998505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316611aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff8216611b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015611bff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290611c439084906130c8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611ca991815260200190565b60405180910390a35b50505050565b6000611cc5868686610507565b905060008111611d31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f456d7074792073776170206973206e6f7420616c6c6f77656400000000000000604482015260640161056e565b81811015611d9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d696e2072657475726e206e6f74207265616368656400000000000000000000604482015260640161056e565b611dbd73ffffffffffffffffffffffffffffffffffffffff871633308761200e565b611dde73ffffffffffffffffffffffffffffffffffffffff86168483612756565b95945050505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821115611e99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e74323536000000000000000000000000000000000000000000000000606482015260840161056e565b5090565b6000808484028684020381811315611ec557611ebb878787876127ac565b9093509150611769565b6000811215611ee357611eda868886886127ac565b93509150611769565b509495939450505050565b73ffffffffffffffffffffffffffffffffffffffff8216611f6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161056e565b8060026000828254611f7d91906130c8565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611fb79084906130c8565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cb29085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612921565b73ffffffffffffffffffffffffffffffffffffffff821661218d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015612243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040812083830390556002805484929061227f908490613119565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161191a565b505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000908190819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123899190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243d9190613080565b905060008561244c8985613130565b612456919061319c565b90506000866124658a85613130565b61246f919061319c565b9050600061247d82846130c8565b61248f670de0b6b3a764000085613130565b612499919061319c565b9050808910156124cc576124c283836124b28289613119565b6124bc8689613119565b8d612a2d565b9097509550612517565b8089111561250d5761250482846124e38288613119565b6124ed878a613119565b6124ff8e670de0b6b3a7640000613119565b612a2d565b97509550612517565b9195509350849084905b5050505050935093915050565b8184101561258e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e20746f6b656e30416d6f756e74206973206e6f74207265616368656400604482015260640161056e565b808310156125f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e20746f6b656e31416d6f756e74206973206e6f74207265616368656400604482015260640161056e565b604080518581526020810185905290810186905233907f650fdf669e93aa6c8ff3defe2da9c12b64f1548e5e1e54e803f4c1beb6466c8e9060600160405180910390a283156126825761268273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168786612756565b82156126c9576126c973ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168785612756565b505050505050565b6000670656e7dd8da1c9cf82111561270c57507ffffffffffffffffffffffffffffffffffffffffffffffffff9a91822725e3631810161271a565b81670656e7dd8da1c9cf0390505b670de0b6b3a7640000908002819004808002829004800282900480028290040204919050565b600081831061274f57816107fe565b5090919050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526122cf9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612068565b6000808085876127bc86886130c8565b6127c691906130c8565b6127d091906130c8565b6127da8688613130565b6127e4868a613130565b6127ee9190613119565b6127f8919061319c565b90508061280b5786869250925050611440565b6000806103e861281d6103e685613130565b612827919061319c565b905060006128566128506103e86128406103ea88613130565b61284a919061319c565b89612740565b8b612740565b90505b806128656001846130c8565b10156128fc57612876888886611927565b925060006128ad612887868d613119565b612891868d6130c8565b61289b888d6130c8565b6128a5888d613119565b910291020390565b905060008113156128d85784925060026128c783856130c8565b6128d1919061319c565b94506128f6565b60008112156128f05784915060026128c783856130c8565b506128fc565b50612859565b612906848b613119565b612910848b6130c8565b955095505050505094509492505050565b6000612983826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c109092919063ffffffff16565b8051909150156122cf57808060200190518101906129a191906131d7565b6122cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161056e565b60008084151580612a3d57508315155b612aa3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f416d6f756e74206578636565647320746f74616c2062616c616e636500000000604482015260640161056e565b82612ac8576000612ab586868a611927565b612abf90886130c8565b91509150612c06565b6000612adc84670de0b6b3a7640000613119565b90506000670de0b6b3a7640000612af3868a613130565b612afd848c613130565b612b079190613119565b612b11919061319c565b90506000806103e8612b256103e685613130565b612b2f919061319c565b90506000612b556103e8612b456103ea87613130565b612b4f919061319c565b8d612740565b90505b80612b646001846130c8565b1015612be857612b758a8a86611927565b92506000612b99612b86868f613119565b612b90868f6130c8565b8b029088020390565b90506000811315612bc4578492506002612bb383856130c8565b612bbd919061319c565b9450612be2565b6000811215612bdc578491506002612bb383856130c8565b50612be8565b50612b58565b612bf2848d613119565b612bfc848d6130c8565b9650965050505050505b9550959350505050565b6060610457848460008585843b612c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612cac91906131f9565b60006040518083038185875af1925050503d8060008114612ce9576040519150601f19603f3d011682016040523d82523d6000602084013e612cee565b606091505b5091509150612cfe828286612d09565b979650505050505050565b60608315612d185750816107fe565b825115612d285782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e9190612db4565b600080600060608486031215612d7157600080fd5b505081359360208301359350604090920135919050565b60005b83811015612da3578181015183820152602001612d8b565b83811115611cb25750506000910152565b6020815260008251806020840152612dd3816040850160208701612d88565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff81168114612e2757600080fd5b50565b60008060408385031215612e3d57600080fd5b8235612e4881612e05565b946020939093013593505050565b600080600060608486031215612e6b57600080fd5b8335612e7681612e05565b92506020840135612e8681612e05565b929592945050506040919091013590565b600080600060608486031215612eac57600080fd5b833592506020840135612e8681612e05565b60008060408385031215612ed157600080fd5b50508035926020909101359150565b600060208284031215612ef257600080fd5b81356107fe81612e05565b60008060008060808587031215612f1357600080fd5b84359350602085013592506040850135612f2c81612e05565b9396929550929360600135925050565b600080600080600060a08688031215612f5457600080fd5b853594506020860135612f6681612e05565b94979496505050506040830135926060810135926080909101359150565b60008060008060808587031215612f9a57600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215612fc957600080fd5b8235612fd481612e05565b91506020830135612fe481612e05565b809150509250929050565b6000806000806080858703121561300557600080fd5b84359350602085013561301781612e05565b93969395505050506040820135916060013590565b600181811c9082168061304057607f821691505b6020821081141561307a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561309257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156130db576130db613099565b500190565b60007f800000000000000000000000000000000000000000000000000000000000000082141561311257613112613099565b5060000390565b60008282101561312b5761312b613099565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316857613168613099565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826131d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156131e957600080fd5b815180151581146107fe57600080fd5b6000825161320b818460208701612d88565b919091019291505056fea264697066735822122086221e39f307408e9dd6b3ce95278b2cef177599a09d35c1cc582c2d10fb611464736f6c634300080a0033000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000d466978656452617465537761700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034652530000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101975760003560e01c80638882eb62116100e3578063c755836b1161008c578063db5dadbf11610066578063db5dadbf146103dd578063dd62ed3e146103f0578063eac38e0c1461043657600080fd5b8063c755836b14610390578063cdc4e51d146103a3578063d21220a7146103b657600080fd5b8063a457c2d7116100bd578063a457c2d714610357578063a9059cbb1461036a578063c0a535111461037d57600080fd5b80638882eb621461031457806395d89b4114610327578063a41fe49f1461032f57600080fd5b806323b872dd116101455780635a7e9a5f1161011f5780635a7e9a5f146102b857806360336508146102cb57806370a08231146102de57600080fd5b806323b872dd14610261578063313ce5671461027457806339509351146102a557600080fd5b80630dfe1681116101765780630dfe1681146101fa57806318160ddd146102465780631e1401f81461024e57600080fd5b8062aeef8a1461019c57806306fdde03146101c2578063095ea7b3146101d7575b600080fd5b6101af6101aa366004612d5c565b610449565b6040519081526020015b60405180910390f35b6101ca61045f565b6040516101b99190612db4565b6101ea6101e5366004612e2a565b6104f1565b60405190151581526020016101b9565b6102217f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b9565b6002546101af565b6101af61025c366004612e56565b610507565b6101ea61026f366004612e56565b61071d565b60405160ff7f00000000000000000000000000000000000000000000000000000000000000061681526020016101b9565b6101ea6102b3366004612e2a565b610805565b6101af6102c6366004612e97565b61084e565b6101af6102d9366004612ebe565b6109f8565b6101af6102ec366004612ee0565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101af610322366004612efd565b610aa4565b6101ca610ee7565b61034261033d366004612d5c565b610ef6565b604080519283526020830191909152016101b9565b6101ea610365366004612e2a565b610f11565b6101ea610378366004612e2a565b610fe9565b6101af61038b366004612ebe565b610ff6565b6101af61039e366004612e97565b611084565b6103426103b1366004612f3c565b61120f565b6102217f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6103426103eb366004612f84565b61142b565b6101af6103fe366004612fb6565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b610342610444366004612fef565b611449565b600061045784843385610aa4565b949350505050565b60606003805461046e9061302c565b80601f016020809104026020016040519081016040528092919081815260200182805461049a9061302c565b80156104e75780601f106104bc576101008083540402835291602001916104e7565b820191906000526020600020905b8154815290600101906020018083116104ca57829003601f168201915b5050505050905090565b60006104fe338484611773565b50600192915050565b6000808211610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e70757420616d6f756e742073686f756c64206265203e203000000000000060448201526064015b60405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156105e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106089190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190613080565b905080841115610708576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e70757420616d6f756e7420697320746f6f20626967000000000000000000604482015260640161056e565b610713828286611927565b9695505050505050565b600061072a848484611a03565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600160209081526040808320338452909152902054828110156107eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161056e565b6107f88533858403611773565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916104fe9185906108499086906130c8565b611773565b600073ffffffffffffffffffffffffffffffffffffffff83163014156108d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207468697320697320666f7262696464656e00000000000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff831661094d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207a65726f20697320666f7262696464656e00000000000000604482015260640161056e565b61099a7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec77f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48868686611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e896109c783611de7565b6109d0906130e0565b6109d987611de7565b6040805192835260208301919091520160405180910390a29392505050565b6000610a477f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7853386611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e89610a7485611de7565b610a7d84611de7565b610a86906130e0565b6040805192835260208301919091520160405180910390a292915050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190602401602060405180830381865afa158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b579190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716906370a0823190602401602060405180830381865afa158015610be7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0b9190613080565b9050600080610c1c89898686611e9d565b90925090506000610c2d82846130c8565b905060008111610c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f456d707479206465706f736974206973206e6f7420616c6c6f77656400000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8816301415610d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4465706f73697420746f207468697320697320666f7262696464656e00000000604482015260640161056e565b6000610d2460025490565b90508015610d78576000828b8d610d3b898b6130c8565b610d4591906130c8565b610d4f91906130c8565b610d599190613119565b905080610d668385613130565b610d70919061319c565b975050610d7c565b8196505b87871015610de6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5368617265206973206e6f7420656e6f75676800000000000000000000000000604482015260640161056e565b610df08988611eee565b604080518c8152602081018c905290810188905273ffffffffffffffffffffffffffffffffffffffff8a16907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a28a15610e9157610e9173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481633308e61200e565b8915610ed957610ed973ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71633308d61200e565b505050505050949350505050565b60606004805461046e9061302c565b600080610f0585338686611449565b90969095509350505050565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610fd2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161056e565b610fdf3385858403611773565b5060019392505050565b60006104fe338484611a03565b60006110457f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec77f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48853386611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e8961107283611de7565b61107b906130e0565b610a8686611de7565b600073ffffffffffffffffffffffffffffffffffffffff8316301415611106576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207468697320697320666f7262696464656e00000000000000604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8316611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5377617020746f207a65726f20697320666f7262696464656e00000000000000604482015260640161056e565b6111d07f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7868686611cb8565b9050337f803540962ed9acbf87226c32486d71e1c86c2bdb208e771bab2fd8a626f61e896111fd86611de7565b61120684611de7565b6109d9906130e0565b6000806000871161127c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f456d707479207769746864726177616c206973206e6f7420616c6c6f77656400604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff86163014156112fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207468697320697320666f7262696464656e00604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8616611379576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207a65726f20697320666f7262696464656e00604482015260640161056e565b670de0b6b3a76400008511156113eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f526174696f2073686f756c6420626520696e205b302c20315d00000000000000604482015260640161056e565b60006113f660025490565b905061140233896120ea565b61140d8887836122d4565b9093509150611420878985858989612524565b509550959350505050565b60008061143b863387878761120f565b915091505b94509492505050565b600080600086116114b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f456d707479207769746864726177616c206973206e6f7420616c6c6f77656400604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff8516301415611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207468697320697320666f7262696464656e00604482015260640161056e565b73ffffffffffffffffffffffffffffffffffffffff85166115b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5769746864726177616c20746f207a65726f20697320666f7262696464656e00604482015260640161056e565b60006115be60025490565b90506115ca33886120ea565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528190889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190602401602060405180830381865afa158015611658573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167c9190613080565b6116869190613130565b611690919061319c565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529093508190889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716906370a0823190602401602060405180830381865afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117459190613080565b61174f9190613130565b611759919061319c565b9150611769868885858989612524565b5094509492505050565b73ffffffffffffffffffffffffffffffffffffffff8316611815576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff82166118b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60008383018181670de0b6b3a76400008702816119465761194661316d565b049050600082858801670de0b6b3a764000002816119665761196661316d565b049050670de0b6b3a7640000850260008185611981856126d1565b672ef1cef240e848b802611994876126d1565b672ef1cef240e848b8028886670de05bc096e9c00002816119b7576119b761316d565b04010302816119c8576119c861316d565b049050670de0b6b3a76400006119e682670de0b6b3a7640000612740565b8802816119f5576119f561316d565b049998505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316611aa6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff8216611b49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015611bff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290611c439084906130c8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611ca991815260200190565b60405180910390a35b50505050565b6000611cc5868686610507565b905060008111611d31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f456d7074792073776170206973206e6f7420616c6c6f77656400000000000000604482015260640161056e565b81811015611d9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d696e2072657475726e206e6f74207265616368656400000000000000000000604482015260640161056e565b611dbd73ffffffffffffffffffffffffffffffffffffffff871633308761200e565b611dde73ffffffffffffffffffffffffffffffffffffffff86168483612756565b95945050505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821115611e99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e74323536000000000000000000000000000000000000000000000000606482015260840161056e565b5090565b6000808484028684020381811315611ec557611ebb878787876127ac565b9093509150611769565b6000811215611ee357611eda868886886127ac565b93509150611769565b509495939450505050565b73ffffffffffffffffffffffffffffffffffffffff8216611f6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161056e565b8060026000828254611f7d91906130c8565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054839290611fb79084906130c8565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611cb29085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612921565b73ffffffffffffffffffffffffffffffffffffffff821661218d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015612243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161056e565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040812083830390556002805484929061227f908490613119565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161191a565b505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000908190819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190602401602060405180830381865afa158015612365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123899190613080565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716906370a0823190602401602060405180830381865afa158015612419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243d9190613080565b905060008561244c8985613130565b612456919061319c565b90506000866124658a85613130565b61246f919061319c565b9050600061247d82846130c8565b61248f670de0b6b3a764000085613130565b612499919061319c565b9050808910156124cc576124c283836124b28289613119565b6124bc8689613119565b8d612a2d565b9097509550612517565b8089111561250d5761250482846124e38288613119565b6124ed878a613119565b6124ff8e670de0b6b3a7640000613119565b612a2d565b97509550612517565b9195509350849084905b5050505050935093915050565b8184101561258e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e20746f6b656e30416d6f756e74206973206e6f74207265616368656400604482015260640161056e565b808310156125f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e20746f6b656e31416d6f756e74206973206e6f74207265616368656400604482015260640161056e565b604080518581526020810185905290810186905233907f650fdf669e93aa6c8ff3defe2da9c12b64f1548e5e1e54e803f4c1beb6466c8e9060600160405180910390a283156126825761268273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48168786612756565b82156126c9576126c973ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7168785612756565b505050505050565b6000670656e7dd8da1c9cf82111561270c57507ffffffffffffffffffffffffffffffffffffffffffffffffff9a91822725e3631810161271a565b81670656e7dd8da1c9cf0390505b670de0b6b3a7640000908002819004808002829004800282900480028290040204919050565b600081831061274f57816107fe565b5090919050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526122cf9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612068565b6000808085876127bc86886130c8565b6127c691906130c8565b6127d091906130c8565b6127da8688613130565b6127e4868a613130565b6127ee9190613119565b6127f8919061319c565b90508061280b5786869250925050611440565b6000806103e861281d6103e685613130565b612827919061319c565b905060006128566128506103e86128406103ea88613130565b61284a919061319c565b89612740565b8b612740565b90505b806128656001846130c8565b10156128fc57612876888886611927565b925060006128ad612887868d613119565b612891868d6130c8565b61289b888d6130c8565b6128a5888d613119565b910291020390565b905060008113156128d85784925060026128c783856130c8565b6128d1919061319c565b94506128f6565b60008112156128f05784915060026128c783856130c8565b506128fc565b50612859565b612906848b613119565b612910848b6130c8565b955095505050505094509492505050565b6000612983826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c109092919063ffffffff16565b8051909150156122cf57808060200190518101906129a191906131d7565b6122cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161056e565b60008084151580612a3d57508315155b612aa3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f416d6f756e74206578636565647320746f74616c2062616c616e636500000000604482015260640161056e565b82612ac8576000612ab586868a611927565b612abf90886130c8565b91509150612c06565b6000612adc84670de0b6b3a7640000613119565b90506000670de0b6b3a7640000612af3868a613130565b612afd848c613130565b612b079190613119565b612b11919061319c565b90506000806103e8612b256103e685613130565b612b2f919061319c565b90506000612b556103e8612b456103ea87613130565b612b4f919061319c565b8d612740565b90505b80612b646001846130c8565b1015612be857612b758a8a86611927565b92506000612b99612b86868f613119565b612b90868f6130c8565b8b029088020390565b90506000811315612bc4578492506002612bb383856130c8565b612bbd919061319c565b9450612be2565b6000811215612bdc578491506002612bb383856130c8565b50612be8565b50612b58565b612bf2848d613119565b612bfc848d6130c8565b9650965050505050505b9550959350505050565b6060610457848460008585843b612c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161056e565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612cac91906131f9565b60006040518083038185875af1925050503d8060008114612ce9576040519150601f19603f3d011682016040523d82523d6000602084013e612cee565b606091505b5091509150612cfe828286612d09565b979650505050505050565b60608315612d185750816107fe565b825115612d285782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e9190612db4565b600080600060608486031215612d7157600080fd5b505081359360208301359350604090920135919050565b60005b83811015612da3578181015183820152602001612d8b565b83811115611cb25750506000910152565b6020815260008251806020840152612dd3816040850160208701612d88565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff81168114612e2757600080fd5b50565b60008060408385031215612e3d57600080fd5b8235612e4881612e05565b946020939093013593505050565b600080600060608486031215612e6b57600080fd5b8335612e7681612e05565b92506020840135612e8681612e05565b929592945050506040919091013590565b600080600060608486031215612eac57600080fd5b833592506020840135612e8681612e05565b60008060408385031215612ed157600080fd5b50508035926020909101359150565b600060208284031215612ef257600080fd5b81356107fe81612e05565b60008060008060808587031215612f1357600080fd5b84359350602085013592506040850135612f2c81612e05565b9396929550929360600135925050565b600080600080600060a08688031215612f5457600080fd5b853594506020860135612f6681612e05565b94979496505050506040830135926060810135926080909101359150565b60008060008060808587031215612f9a57600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215612fc957600080fd5b8235612fd481612e05565b91506020830135612fe481612e05565b809150509250929050565b6000806000806080858703121561300557600080fd5b84359350602085013561301781612e05565b93969395505050506040820135916060013590565b600181811c9082168061304057607f821691505b6020821081141561307a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561309257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156130db576130db613099565b500190565b60007f800000000000000000000000000000000000000000000000000000000000000082141561311257613112613099565b5060000390565b60008282101561312b5761312b613099565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316857613168613099565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826131d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156131e957600080fd5b815180151581146107fe57600080fd5b6000825161320b818460208701612d88565b919091019291505056fea264697066735822122086221e39f307408e9dd6b3ce95278b2cef177599a09d35c1cc582c2d10fb611464736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000d466978656452617465537761700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034652530000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _token0 (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [1] : _token1 (address): 0xdAC17F958D2ee523a2206206994597C13D831ec7
Arg [2] : name (string): FixedRateSwap
Arg [3] : symbol (string): FRS
Arg [4] : decimals_ (uint8): 6
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [1] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [6] : 4669786564526174655377617000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 4652530000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.