Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CurvePlainPoolAdapter
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IBeefyStrategyAdapter} from "./IBeefyStrategyAdapter.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
interface ICurvePlainPool {
// solhint-disable-next-line func-name-mixedcase
function add_liquidity(
uint256[2] calldata amounts,
uint256 minAmountOut
) external returns (uint256);
// solhint-disable-next-line func-name-mixedcase
function remove_liquidity(
uint256 amount,
uint256[2] calldata amounts
) external returns (uint256[2] memory);
// solhint-disable-next-line func-name-mixedcase
function calc_token_amount(
uint256[2] calldata amounts,
bool isDeposit
) external view returns (uint256);
// solhint-disable-next-line func-name-mixedcase
function calc_withdraw_one_coin(
uint256 tokenAmount,
int128 tokenIndex
) external view returns (uint256);
// solhint-disable-next-line func-name-mixedcase
function remove_liquidity_one_coin(
uint256 lpTokenAmount,
int128 index,
uint256 minAmount
) external returns (uint256);
// solhint-disable-next-line func-name-mixedcase
function get_virtual_price() external view returns (uint256);
}
/// @title CurveAdapter
/// @notice Supports adding liquidity to and removing liquidity from a Curve
/// @dev Explain to a developer any extra details
contract CurvePlainPoolAdapter is IBeefyStrategyAdapter {
error UnsupportedToken(address token);
error MinAmountNotMet(uint256 minAmount, uint256 amountOut);
event LiquidityAdded(
address indexed token,
address indexed by,
uint256 amount
);
event LiquidityRemoved(
address indexed token,
address indexed by,
uint256 amount
);
using SafeERC20 for IERC20;
using SafeCast for uint256;
using SafeCast for int256;
uint256 internal immutable _poolTokensLength;
address internal _pool;
address[] internal _poolTokens;
/// @notice Constructor
/// @param pool the pool address.
/// @param poolTokens the tokens that can be deposited into this pool.
constructor(address pool, address[] memory poolTokens) {
_pool = pool;
_poolTokens = poolTokens;
_poolTokensLength = poolTokens.length;
for (uint256 i = 0; i < _poolTokensLength; i++) {
_poolTokens.push(poolTokens[i]);
}
}
/// @notice Adds liquidity to a curve pool
/// @param token the token to deposit
/// @param amount the amount to deposit
/// @param minAmountOut the minimum amount of LP token to receive for this deposit. Transaction will revert if receives less than this number.
/// @return amountOut The amount of LP tokens received.
function addLiquidity(
address token,
uint256 amount,
uint256 minAmountOut
) external returns (uint256) {
uint256 tokenIndex = _getTokenIndex(token);
if (tokenIndex == type(uint256).max) {
revert UnsupportedToken(token);
}
uint256[2] memory amounts;
amounts[tokenIndex] = amount;
address caller = msg.sender;
IERC20(token).safeTransferFrom(caller, address(this), amount);
IERC20(token).safeIncreaseAllowance(_pool, amount);
uint256 amountOut = ICurvePlainPool(_pool).add_liquidity(
amounts,
minAmountOut
);
if (amountOut < minAmountOut) {
revert MinAmountNotMet(minAmountOut, amountOut);
}
IERC20(_pool).safeTransfer(msg.sender, amountOut);
return amountOut;
}
/// @notice Remove liquidity
/// @dev Removes liquidity from curve pool. The tokens received will depend on the makeup of assets
/// in the pool.
/// @param token This is used to specify the min amount of this token you want to recieve
/// @param lpTokenAmount The amount of LP token to burn in this withdrawal
/// @param minAmountOut The min amount of `token` to receive.
/// @return amountsReceived array containing the amounts of each token received.
function removeLiquidity(
address token,
uint256 lpTokenAmount,
uint256 minAmountOut
) external returns (uint256[2] memory) {
uint256 tokenIndex = _getTokenIndex(token);
if (tokenIndex == type(uint256).max) {
revert UnsupportedToken(token);
}
uint256[2] memory minAmounts;
minAmounts[tokenIndex] = minAmountOut;
IERC20(_pool).safeTransferFrom(
msg.sender,
address(this),
lpTokenAmount
);
IERC20(_pool).safeIncreaseAllowance(_pool, lpTokenAmount);
uint256[2] memory amountsReceived = ICurvePlainPool(_pool)
.remove_liquidity(lpTokenAmount, minAmounts);
for (uint256 i = 0; i < _poolTokensLength; i++) {
if (amountsReceived[i] != 0) {
IERC20(_poolTokens[i]).safeTransfer(
msg.sender,
amountsReceived[i]
);
}
}
return amountsReceived;
}
/// @notice Remove liquidity and receive only one token
/// @dev Removes liquidity from curve pool and receive only one token in return.
/// @param token This is used to specify the min amount of this token you want to recieve
/// @param lpTokenAmount The amount of LP token to burn in this withdrawal
/// @param minAmountOut The min amount of `token` to receive.
/// @return amountReceived The amount of `token` received.
function removeLiquidityOneCoin(
address token,
uint256 lpTokenAmount,
uint256 minAmountOut
) public returns (uint256) {
uint256 tokenIndex = _getTokenIndex(token);
if (tokenIndex == type(uint256).max) {
revert UnsupportedToken(token);
}
IERC20(_pool).safeTransferFrom(
msg.sender,
address(this),
lpTokenAmount
);
IERC20(_pool).safeIncreaseAllowance(_pool, lpTokenAmount);
uint256 amountReceived = ICurvePlainPool(_pool)
.remove_liquidity_one_coin(
lpTokenAmount,
tokenIndex.toInt256().toInt128(),
minAmountOut
);
IERC20(token).safeTransfer(msg.sender, amountReceived);
return amountReceived;
}
function removeLiquidityOneCoinByCoinAmount(
address token,
uint256 coinAmount,
uint256 minAmountOut
) external returns (uint256) {
uint256 lpTokenAmount = calculateLpTokenAmount(
token,
coinAmount,
false // isDeposit
);
return removeLiquidityOneCoin(token, lpTokenAmount, minAmountOut);
}
function calculateLpTokenAmount(
address token,
uint256 tokenAmount,
bool isDeposit
) public view returns (uint256) {
uint256 tokenIndex = _getTokenIndex(token);
if (tokenIndex == type(uint256).max) {
revert UnsupportedToken(token);
}
uint256[2] memory amounts;
amounts[tokenIndex] = tokenAmount;
return ICurvePlainPool(_pool).calc_token_amount(amounts, isDeposit);
}
function calculateLpTokenAmountOneCoin(
address token,
uint256 lpTokenAmount
) external view returns (uint256) {
uint256 tokenIndex = _getTokenIndex(token);
if (tokenIndex == type(uint256).max) {
revert UnsupportedToken(token);
}
return
ICurvePlainPool(_pool).calc_withdraw_one_coin(
lpTokenAmount,
tokenIndex.toInt256().toInt128()
);
}
function getLpTokenPrice() external view returns (uint256) {
return ICurvePlainPool(_pool).get_virtual_price();
}
function getPool() external view returns (address) {
return _pool;
}
function _getTokenIndex(address token) private view returns (uint256) {
uint256 tokenLength = _poolTokens.length;
for (uint256 i = 0; i < tokenLength; i++) {
if (token == _poolTokens[i]) {
return i;
}
}
return type(uint256).max;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
interface IBeefyStrategyAdapter {
function addLiquidity(
address token,
uint256 amount,
uint256 minMintAmount
) external returns (uint256);
function removeLiquidity(
address token,
uint256 lpAmount,
uint256 minAmountOut
) external returns (uint256[2] memory);
function removeLiquidityOneCoin(
address token,
uint256 lpTokenAmount,
uint256 minAmountOut
) external returns (uint256);
function calculateLpTokenAmount(
address token,
uint256 tokenAmount,
bool isDeposit
) external view returns (uint256);
function calculateLpTokenAmountOneCoin(
address token,
uint256 lpTokenAmount
) external view returns (uint256);
function getLpTokenPrice() external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
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));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
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 (last updated v4.7.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 uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @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
*
* _Available since v4.2._
*/
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 uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(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
*
* _Available since v2.5._
*/
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 uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(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
*
* _Available since v4.2._
*/
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 uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(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
*
* _Available since v2.5._
*/
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 uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(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
*
* _Available since v2.5._
*/
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 uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(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
*
* _Available since v2.5._
*/
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
*
* _Available since v2.5._
*/
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.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248) {
require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits");
return int248(value);
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240) {
require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits");
return int240(value);
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232) {
require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits");
return int232(value);
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224) {
require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits");
return int224(value);
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216) {
require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits");
return int216(value);
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208) {
require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits");
return int208(value);
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200) {
require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits");
return int200(value);
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192) {
require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits");
return int192(value);
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184) {
require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits");
return int184(value);
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176) {
require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits");
return int176(value);
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168) {
require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits");
return int168(value);
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160) {
require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits");
return int160(value);
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152) {
require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits");
return int152(value);
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144) {
require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits");
return int144(value);
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136) {
require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits");
return int136(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 int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120) {
require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits");
return int120(value);
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112) {
require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits");
return int112(value);
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104) {
require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits");
return int104(value);
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96) {
require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits");
return int96(value);
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88) {
require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits");
return int88(value);
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80) {
require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits");
return int80(value);
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72) {
require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits");
return int72(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 int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56) {
require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits");
return int56(value);
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48) {
require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits");
return int48(value);
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40) {
require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits");
return int40(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 int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24) {
require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits");
return int24(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.
*
* _Available since v3.0._
*/
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.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}{
"optimizer": {
"enabled": true,
"runs": 2000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address[]","name":"poolTokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"MinAmountNotMet","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"UnsupportedToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"bool","name":"isDeposit","type":"bool"}],"name":"calculateLpTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"lpTokenAmount","type":"uint256"}],"name":"calculateLpTokenAmountOneCoin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLpTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"lpTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256[2]","name":"","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"lpTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"removeLiquidityOneCoin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"coinAmount","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"removeLiquidityOneCoinByCoinAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b50604051620014533803806200145383398101604081905262000034916200019c565b600080546001600160a01b0319166001600160a01b038416179055805162000064906001906020840190620000e8565b50805160805260005b608051811015620000df5760018282815181106200008f576200008f62000285565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580620000d6816200029b565b9150506200006d565b505050620002c3565b82805482825590600052602060002090810192821562000140579160200282015b828111156200014057825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000109565b506200014e92915062000152565b5090565b5b808211156200014e576000815560010162000153565b80516001600160a01b03811681146200018157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215620001b057600080fd5b620001bb8362000169565b602084810151919350906001600160401b0380821115620001db57600080fd5b818601915086601f830112620001f057600080fd5b81518181111562000205576200020562000186565b8060051b604051601f19603f830116810181811085821117156200022d576200022d62000186565b6040529182528482019250838101850191898311156200024c57600080fd5b938501935b828510156200027557620002658562000169565b8452938501939285019262000251565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b600060018201620002bc57634e487b7160e01b600052601160045260246000fd5b5060010190565b608051611174620002df600039600061077801526111746000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063607fd6581161005b578063607fd658146100f45780636f5cdb6c14610107578063e38192e31461010f578063faa0b6dc1461012f57600080fd5b8063026b1d5f1461008d5780630e9d3866146100ad5780634e41e4f1146100ce57806355776b77146100e1575b600080fd5b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100c06100bb366004610e83565b610142565b6040519081526020016100a4565b6100c06100dc366004610ead565b61022f565b6100c06100ef366004610ead565b610362565b6100c0610102366004610ef1565b6104e4565b6100c06105d5565b61012261011d366004610ead565b610652565b6040516100a49190610f54565b6100c061013d366004610ead565b610821565b60008061014e8461083d565b9050600019810361018257604051635f8b555b60e11b81526001600160a01b03851660048201526024015b60405180910390fd5b6000546001600160a01b031663cc2b27d7846101a56101a0856108a3565b61093f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526004810192909252600f0b6024820152604401602060405180830381865afa158015610201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102259190610f62565b9150505b92915050565b60008061023b8561083d565b9050600019810361026a57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b600054610282906001600160a01b03163330876109f3565b600054610299906001600160a01b03168086610aaa565b600080546001600160a01b0316631a4d01d2866102b86101a0866108a3565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526004810192909252600f0b6024820152604481018790526064016020604051808303816000875af115801561031d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103419190610f62565b90506103576001600160a01b0387163383610b8e565b9150505b9392505050565b60008061036e8561083d565b9050600019810361039d57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b6103a5610e49565b848183600281106103b8576103b8610f7b565b6020020152336103d36001600160a01b0388168230896109f3565b6000546103ed906001600160a01b03898116911688610aaa565b600080546040517f0b4c7e4d0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690630b4c7e4d906104399086908a90600401610f91565b6020604051808303816000875af1158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c9190610f62565b9050858110156104c2576040517fb112c3950000000000000000000000000000000000000000000000000000000081526004810187905260248101829052604401610179565b6000546104d9906001600160a01b03163383610b8e565b979650505050505050565b6000806104f08561083d565b9050600019810361051f57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b610527610e49565b8481836002811061053a5761053a610f7b565b60200201526000546040517fed8e84f30000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ed8e84f39061058a9084908890600401610fac565b602060405180830381865afa1580156105a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cb9190610f62565b9695505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d9190610f62565b905090565b61065a610e49565b60006106658561083d565b9050600019810361069457604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b61069c610e49565b838183600281106106af576106af610f7b565b60200201526000546106cc906001600160a01b03163330886109f3565b6000546106e3906001600160a01b03168087610aaa565b600080546040517f5b36389c0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690635b36389c9061072f9089908690600401610fc9565b60408051808303816000875af115801561074d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107719190610fdd565b905060005b7f0000000000000000000000000000000000000000000000000000000000000000811015610816578181600281106107b0576107b0610f7b565b60200201511561080457610804338383600281106107d0576107d0610f7b565b6020020151600184815481106107e8576107e8610f7b565b6000918252602090912001546001600160a01b03169190610b8e565b8061080e81611081565b915050610776565b509695505050505050565b600080610830858560006104e4565b905061035785828561022f565b600154600090815b81811015610898576001818154811061086057610860610f7b565b6000918252602090912001546001600160a01b0390811690851603610886579392505050565b8061089081611081565b915050610845565b506000199392505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561093b5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610179565b5090565b60007fffffffffffffffffffffffffffffffff80000000000000000000000000000000821280159061098157506f7fffffffffffffffffffffffffffffff8213155b61093b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401610179565b6040516001600160a01b0380851660248301528316604482015260648101829052610aa49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610bdc565b50505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b389190610f62565b610b42919061109b565b6040516001600160a01b038516602482015260448101829052909150610aa49085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610a40565b6040516001600160a01b038316602482015260448101829052610bd79084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610a40565b505050565b6000610c31826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610cc19092919063ffffffff16565b805190915015610bd75780806020019051810190610c4f91906110ae565b610bd75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610179565b6060610cd08484600085610cd8565b949350505050565b606082471015610d505760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610179565b6001600160a01b0385163b610da75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610179565b600080866001600160a01b03168587604051610dc391906110ef565b60006040518083038185875af1925050503d8060008114610e00576040519150601f19603f3d011682016040523d82523d6000602084013e610e05565b606091505b50915091506104d982828660608315610e1f57508161035b565b825115610e2f5782518084602001fd5b8160405162461bcd60e51b8152600401610179919061110b565b60405180604001604052806002906020820280368337509192915050565b80356001600160a01b0381168114610e7e57600080fd5b919050565b60008060408385031215610e9657600080fd5b610e9f83610e67565b946020939093013593505050565b600080600060608486031215610ec257600080fd5b610ecb84610e67565b95602085013595506040909401359392505050565b8015158114610eee57600080fd5b50565b600080600060608486031215610f0657600080fd5b610f0f84610e67565b9250602084013591506040840135610f2681610ee0565b809150509250925092565b8060005b6002811015610aa4578151845260209384019390910190600101610f35565b604081016102298284610f31565b600060208284031215610f7457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60608101610f9f8285610f31565b8260408301529392505050565b60608101610fba8285610f31565b82151560408301529392505050565b8281526060810161035b6020830184610f31565b600060408284031215610fef57600080fd5b82601f830112610ffe57600080fd5b6040516040810181811067ffffffffffffffff8211171561102f57634e487b7160e01b600052604160045260246000fd5b806040525080604084018581111561104657600080fd5b845b81811015611060578051835260209283019201611048565b509195945050505050565b634e487b7160e01b600052601160045260246000fd5b600060001982036110945761109461106b565b5060010190565b808201808211156102295761022961106b565b6000602082840312156110c057600080fd5b815161035b81610ee0565b60005b838110156110e65781810151838201526020016110ce565b50506000910152565b600082516111018184602087016110cb565b9190910192915050565b602081526000825180602084015261112a8160408501602087016110cb565b601f01601f1916919091016040019291505056fea2646970667358221220209e0f3a728fc61d9c3a312c22f1822adffff656eff176fd6f8e56bfab34b94a64736f6c634300081100330000000000000000000000007f90122bf0700f9e7e1f688fe926940e8839f35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063607fd6581161005b578063607fd658146100f45780636f5cdb6c14610107578063e38192e31461010f578063faa0b6dc1461012f57600080fd5b8063026b1d5f1461008d5780630e9d3866146100ad5780634e41e4f1146100ce57806355776b77146100e1575b600080fd5b6000546040516001600160a01b0390911681526020015b60405180910390f35b6100c06100bb366004610e83565b610142565b6040519081526020016100a4565b6100c06100dc366004610ead565b61022f565b6100c06100ef366004610ead565b610362565b6100c0610102366004610ef1565b6104e4565b6100c06105d5565b61012261011d366004610ead565b610652565b6040516100a49190610f54565b6100c061013d366004610ead565b610821565b60008061014e8461083d565b9050600019810361018257604051635f8b555b60e11b81526001600160a01b03851660048201526024015b60405180910390fd5b6000546001600160a01b031663cc2b27d7846101a56101a0856108a3565b61093f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526004810192909252600f0b6024820152604401602060405180830381865afa158015610201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102259190610f62565b9150505b92915050565b60008061023b8561083d565b9050600019810361026a57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b600054610282906001600160a01b03163330876109f3565b600054610299906001600160a01b03168086610aaa565b600080546001600160a01b0316631a4d01d2866102b86101a0866108a3565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526004810192909252600f0b6024820152604481018790526064016020604051808303816000875af115801561031d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103419190610f62565b90506103576001600160a01b0387163383610b8e565b9150505b9392505050565b60008061036e8561083d565b9050600019810361039d57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b6103a5610e49565b848183600281106103b8576103b8610f7b565b6020020152336103d36001600160a01b0388168230896109f3565b6000546103ed906001600160a01b03898116911688610aaa565b600080546040517f0b4c7e4d0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690630b4c7e4d906104399086908a90600401610f91565b6020604051808303816000875af1158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c9190610f62565b9050858110156104c2576040517fb112c3950000000000000000000000000000000000000000000000000000000081526004810187905260248101829052604401610179565b6000546104d9906001600160a01b03163383610b8e565b979650505050505050565b6000806104f08561083d565b9050600019810361051f57604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b610527610e49565b8481836002811061053a5761053a610f7b565b60200201526000546040517fed8e84f30000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ed8e84f39061058a9084908890600401610fac565b602060405180830381865afa1580156105a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cb9190610f62565b9695505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d9190610f62565b905090565b61065a610e49565b60006106658561083d565b9050600019810361069457604051635f8b555b60e11b81526001600160a01b0386166004820152602401610179565b61069c610e49565b838183600281106106af576106af610f7b565b60200201526000546106cc906001600160a01b03163330886109f3565b6000546106e3906001600160a01b03168087610aaa565b600080546040517f5b36389c0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690635b36389c9061072f9089908690600401610fc9565b60408051808303816000875af115801561074d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107719190610fdd565b905060005b7f0000000000000000000000000000000000000000000000000000000000000002811015610816578181600281106107b0576107b0610f7b565b60200201511561080457610804338383600281106107d0576107d0610f7b565b6020020151600184815481106107e8576107e8610f7b565b6000918252602090912001546001600160a01b03169190610b8e565b8061080e81611081565b915050610776565b509695505050505050565b600080610830858560006104e4565b905061035785828561022f565b600154600090815b81811015610898576001818154811061086057610860610f7b565b6000918252602090912001546001600160a01b0390811690851603610886579392505050565b8061089081611081565b915050610845565b506000199392505050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561093b5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610179565b5090565b60007fffffffffffffffffffffffffffffffff80000000000000000000000000000000821280159061098157506f7fffffffffffffffffffffffffffffff8213155b61093b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401610179565b6040516001600160a01b0380851660248301528316604482015260648101829052610aa49085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610bdc565b50505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b389190610f62565b610b42919061109b565b6040516001600160a01b038516602482015260448101829052909150610aa49085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610a40565b6040516001600160a01b038316602482015260448101829052610bd79084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610a40565b505050565b6000610c31826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610cc19092919063ffffffff16565b805190915015610bd75780806020019051810190610c4f91906110ae565b610bd75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610179565b6060610cd08484600085610cd8565b949350505050565b606082471015610d505760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610179565b6001600160a01b0385163b610da75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610179565b600080866001600160a01b03168587604051610dc391906110ef565b60006040518083038185875af1925050503d8060008114610e00576040519150601f19603f3d011682016040523d82523d6000602084013e610e05565b606091505b50915091506104d982828660608315610e1f57508161035b565b825115610e2f5782518084602001fd5b8160405162461bcd60e51b8152600401610179919061110b565b60405180604001604052806002906020820280368337509192915050565b80356001600160a01b0381168114610e7e57600080fd5b919050565b60008060408385031215610e9657600080fd5b610e9f83610e67565b946020939093013593505050565b600080600060608486031215610ec257600080fd5b610ecb84610e67565b95602085013595506040909401359392505050565b8015158114610eee57600080fd5b50565b600080600060608486031215610f0657600080fd5b610f0f84610e67565b9250602084013591506040840135610f2681610ee0565b809150509250925092565b8060005b6002811015610aa4578151845260209384019390910190600101610f35565b604081016102298284610f31565b600060208284031215610f7457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60608101610f9f8285610f31565b8260408301529392505050565b60608101610fba8285610f31565b82151560408301529392505050565b8281526060810161035b6020830184610f31565b600060408284031215610fef57600080fd5b82601f830112610ffe57600080fd5b6040516040810181811067ffffffffffffffff8211171561102f57634e487b7160e01b600052604160045260246000fd5b806040525080604084018581111561104657600080fd5b845b81811015611060578051835260209283019201611048565b509195945050505050565b634e487b7160e01b600052601160045260246000fd5b600060001982036110945761109461106b565b5060010190565b808201808211156102295761022961106b565b6000602082840312156110c057600080fd5b815161035b81610ee0565b60005b838110156110e65781810151838201526020016110ce565b50506000910152565b600082516111018184602087016110cb565b9190910192915050565b602081526000825180602084015261112a8160408501602087016110cb565b601f01601f1916919091016040019291505056fea2646970667358221220209e0f3a728fc61d9c3a312c22f1822adffff656eff176fd6f8e56bfab34b94a64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007f90122bf0700f9e7e1f688fe926940e8839f35300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9
-----Decoded View---------------
Arg [0] : pool (address): 0x7f90122BF0700F9E7e1F688fe926940E8839F353
Arg [1] : poolTokens (address[]): 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8,0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000007f90122bf0700f9e7e1f688fe926940e8839f353
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8
Arg [4] : 000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.