Source Code
Overview
S Balance
S Value
$0.00Latest 1 from a total of 1 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer Ownersh... | 19283405 | 291 days ago | IN | 0 S | 0.00147765 |
Latest 2 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 24453280 | 266 days ago | Contract Creation | 0 S | |||
| 19560115 | 290 days ago | Contract Creation | 0 S |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ZFStableSwapThreePoolDeployer
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin-v4/contracts/access/Ownable.sol";
import "./ZFStableSwapThreePool.sol";
contract ZFStableSwapThreePoolDeployer is Ownable {
uint256 public constant N_COINS = 3;
/**
* @notice constructor
*/
constructor() {}
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(
address tokenA,
address tokenB,
address tokenC
)
internal
pure
returns (
address,
address,
address
)
{
require(tokenA != tokenB && tokenA != tokenC && tokenB != tokenC, "IDENTICAL_ADDRESSES");
address tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
if (tokenB > tokenC) {
tmp = tokenB;
tokenB = tokenC;
tokenC = tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
}
return (tokenA, tokenB, tokenC);
}
/**
* @notice createSwapPair
* @param _tokenA: Addresses of ERC20 conracts .
* @param _tokenB: Addresses of ERC20 conracts .
* @param _tokenC: Addresses of ERC20 conracts .
* @param _A: Amplification coefficient multiplied by n * (n - 1)
* @param _fee: Fee to charge for exchanges
* @param _protocol_fee: Protocol fee
* @param _admin: Admin
* @param _LP: LP
*/
function createSwapPair(
address _tokenA,
address _tokenB,
address _tokenC,
uint256 _A,
uint256 _fee,
uint256 _protocol_fee,
address _admin,
address _LP
) external onlyOwner returns (address) {
require(_tokenA != address(0) && _tokenB != address(0) && _tokenA != _tokenB, "Illegal token");
(address t0, address t1, address t2) = sortTokens(_tokenA, _tokenB, _tokenC);
address[N_COINS] memory coins = [t0, t1, t2];
// create swap contract
bytes memory bytecode = type(ZFStableSwapThreePool).creationCode;
bytes32 salt = keccak256(abi.encodePacked(t0, t1, t2, msg.sender, block.timestamp, block.chainid));
address swapContract;
assembly {
swapContract := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
ZFStableSwapThreePool(swapContract).initialize(coins, _A, _fee, _protocol_fee, _admin, _LP);
return swapContract;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin-v4/contracts/access/Ownable.sol";
import "@openzeppelin-v4/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin-v4/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin-v4/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IZFStableSwapLP.sol";
contract ZFStableSwapThreePool is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
uint256 public constant N_COINS = 3;
uint256 public constant MAX_DECIMAL = 18;
uint256 public constant FEE_DENOMINATOR = 1e10;
uint256 public constant PRECISION = 1e18;
uint256[N_COINS] public PRECISION_MUL;
uint256[N_COINS] public RATES;
uint256 public constant MAX_PROTOCOL_FEE = 1e10;
uint256 public constant MAX_FEE = 1e9;
uint256 public constant MAX_A = 1e6;
uint256 public constant MAX_A_CHANGE = 1000;
uint256 public constant ADMIN_ACTIONS_DELAY = 3 days;
uint256 public constant MIN_RAMP_TIME = 1 days;
address[N_COINS] public coins;
uint256[N_COINS] public balances;
uint256 public fee;
uint256 public protocol_fee;
IZFStableSwapLP public token;
uint256 public initial_A;
uint256 public future_A;
uint256 public initial_A_time;
uint256 public future_A_time;
uint256 public admin_actions_deadline;
uint256 public future_fee;
uint256 public future_protocol_fee;
bool public isPaused;
address public immutable STABLESWAP_FACTORY;
bool public isInitialized;
event TokenExchange(
address indexed buyer,
uint256 sold_id,
uint256 tokens_sold,
uint256 bought_id,
uint256 tokens_bought
);
event AddLiquidity(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 invariant,
uint256 token_supply
);
event RemoveLiquidity(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 token_supply
);
event RemoveLiquidityOne(address indexed provider, uint256 index, uint256 token_amount, uint256 coin_amount);
event RemoveLiquidityImbalance(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 invariant,
uint256 token_supply
);
event CommitNewFee(uint256 indexed deadline, uint256 fee, uint256 protocol_fee);
event NewFee(uint256 fee, uint256 protocol_fee);
event RampA(uint256 old_A, uint256 new_A, uint256 initial_time, uint256 future_time);
event StopRampA(uint256 A, uint256 t);
event RevertParameters();
event DonateProtocolFees();
event Pause();
event Unpause();
/**
* @notice constructor
*/
constructor() {
STABLESWAP_FACTORY = msg.sender;
}
/**
* @notice initialize
* @param _coins: Addresses of ERC20 conracts of coins (c-tokens) involved
* @param _A: Amplification coefficient multiplied by n * (n - 1)
* @param _fee: Fee to charge for exchanges
* @param _protocol_fee: Protocol fee
* @param _owner: Owner
* @param _LP: LP address
*/
function initialize(
address[N_COINS] memory _coins,
uint256 _A,
uint256 _fee,
uint256 _protocol_fee,
address _owner,
address _LP
) external {
require(!isInitialized, "Operations: Already initialized");
require(msg.sender == STABLESWAP_FACTORY, "Operations: Not factory");
require(_A <= MAX_A, "_A exceeds maximum");
require(_fee <= MAX_FEE, "_fee exceeds maximum");
require(_protocol_fee <= MAX_PROTOCOL_FEE, "_protocol_fee exceeds maximum");
isInitialized = true;
for (uint256 i = 0; i < N_COINS; i++) {
require(_coins[i] != address(0), "ZERO Address");
uint256 coinDecimal = IERC20Metadata(_coins[i]).decimals();
require(coinDecimal <= MAX_DECIMAL, "The maximum decimal cannot exceed 18");
//set PRECISION_MUL and RATES
PRECISION_MUL[i] = 10**(MAX_DECIMAL - coinDecimal);
RATES[i] = PRECISION * PRECISION_MUL[i];
}
coins = _coins;
initial_A = _A;
future_A = _A;
fee = _fee;
protocol_fee = _protocol_fee;
token = IZFStableSwapLP(_LP);
transferOwnership(_owner);
}
function get_A() internal view returns (uint256) {
//Handle ramping A up or down
uint256 t1 = future_A_time;
uint256 A1 = future_A;
if (block.timestamp < t1) {
uint256 A0 = initial_A;
uint256 t0 = initial_A_time;
// Expressions in uint256 cannot have negative numbers, thus "if"
if (A1 > A0) {
return A0 + ((A1 - A0) * (block.timestamp - t0)) / (t1 - t0);
} else {
return A0 - ((A0 - A1) * (block.timestamp - t0)) / (t1 - t0);
}
} else {
// when t1 == 0 or block.timestamp >= t1
return A1;
}
}
function A() external view returns (uint256) {
return get_A();
}
function _xp() internal view returns (uint256[N_COINS] memory result) {
result = RATES;
for (uint256 i = 0; i < N_COINS; i++) {
result[i] = (result[i] * balances[i]) / PRECISION;
}
}
function _xp_mem(uint256[N_COINS] memory _balances) internal view returns (uint256[N_COINS] memory result) {
result = RATES;
for (uint256 i = 0; i < N_COINS; i++) {
result[i] = (result[i] * _balances[i]) / PRECISION;
}
}
function get_D(uint256[N_COINS] memory xp, uint256 amp) internal pure returns (uint256) {
uint256 S;
for (uint256 i = 0; i < N_COINS; i++) {
S += xp[i];
}
if (S == 0) {
return 0;
}
uint256 Dprev;
uint256 D = S;
uint256 Ann = amp * N_COINS;
for (uint256 j = 0; j < 255; j++) {
uint256 D_P = D;
for (uint256 k = 0; k < N_COINS; k++) {
D_P = (D_P * D) / (xp[k] * N_COINS); // If division by 0, this will be borked: only withdrawal will work. And that is good
}
Dprev = D;
D = ((Ann * S + D_P * N_COINS) * D) / ((Ann - 1) * D + (N_COINS + 1) * D_P);
// Equality with the precision of 1
if (D > Dprev) {
if (D - Dprev <= 1) {
break;
}
} else {
if (Dprev - D <= 1) {
break;
}
}
}
return D;
}
function get_D_mem(uint256[N_COINS] memory _balances, uint256 amp) internal view returns (uint256) {
return get_D(_xp_mem(_balances), amp);
}
function get_virtual_price() external view returns (uint256) {
/**
Returns portfolio virtual price (for calculating profit)
scaled up by 1e18
*/
uint256 D = get_D(_xp(), get_A());
/**
D is in the units similar to DAI (e.g. converted to precision 1e18)
When balanced, D = n * x_u - total virtual value of the portfolio
*/
uint256 token_supply = token.totalSupply();
return (D * PRECISION) / token_supply;
}
function calc_token_amount(uint256[N_COINS] memory amounts, bool deposit) external view returns (uint256) {
/**
Simplified method to calculate addition or reduction in token supply at
deposit or withdrawal without taking fees into account (but looking at
slippage).
Needed to prevent front-running, not for precise calculations!
*/
uint256[N_COINS] memory _balances = balances;
uint256 amp = get_A();
uint256 D0 = get_D_mem(_balances, amp);
for (uint256 i = 0; i < N_COINS; i++) {
if (deposit) {
_balances[i] += amounts[i];
} else {
_balances[i] -= amounts[i];
}
}
uint256 D1 = get_D_mem(_balances, amp);
uint256 token_amount = token.totalSupply();
uint256 difference;
if (deposit) {
difference = D1 - D0;
} else {
difference = D0 - D1;
}
return (difference * token_amount) / D0;
}
function add_liquidity(uint256[N_COINS] memory amounts, uint256 min_mint_amount) external nonReentrant {
//Amounts is amounts of c-tokens
require(!isPaused, "Paused");
uint256[N_COINS] memory fees;
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256 _protocol_fee = protocol_fee;
uint256 amp = get_A();
uint256 token_supply = token.totalSupply();
//Initial invariant
uint256 D0 = 0;
uint256[N_COINS] memory old_balances = balances;
if (token_supply > 0) {
D0 = get_D_mem(old_balances, amp);
}
uint256[N_COINS] memory new_balances = [old_balances[0], old_balances[1], old_balances[2]];
for (uint256 i = 0; i < N_COINS; i++) {
if (token_supply == 0) {
require(amounts[i] > 0, "Initial deposit requires all coins");
}
// balances store amounts of c-tokens
new_balances[i] = old_balances[i] + amounts[i];
}
// Invariant after change
uint256 D1 = get_D_mem(new_balances, amp);
require(D1 > D0, "D1 must be greater than D0");
// We need to recalculate the invariant accounting for fees
// to calculate fair user's share
uint256 D2 = D1;
if (token_supply > 0) {
// Only account for fees if we are not the first to deposit
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _protocol_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
D2 = get_D_mem(new_balances, amp);
} else {
balances = new_balances;
}
// Calculate, how much pool tokens to mint
uint256 mint_amount;
if (token_supply == 0) {
mint_amount = D1; // Take the dust if there was any
} else {
mint_amount = (token_supply * (D2 - D0)) / D0;
}
require(mint_amount >= min_mint_amount, "Slippage screwed you");
// Take coins from the sender
for (uint256 i = 0; i < N_COINS; i++) {
if (amounts[i] > 0) IERC20(coins[i]).safeTransferFrom(msg.sender, address(this), amounts[i]);
}
// Mint pool tokens
token.mint(msg.sender, mint_amount);
emit AddLiquidity(msg.sender, amounts, fees, D1, token_supply + mint_amount);
}
function get_y(
uint256 i,
uint256 j,
uint256 x,
uint256[N_COINS] memory xp_
) internal view returns (uint256) {
// x in the input is converted to the same price/precision
require((i != j) && (i < N_COINS) && (j < N_COINS), "Illegal parameter");
uint256 amp = get_A();
uint256 D = get_D(xp_, amp);
uint256 c = D;
uint256 S_;
uint256 Ann = amp * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k == i) {
_x = x;
} else if (k != j) {
_x = xp_[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann; // - D
uint256 y_prev;
uint256 y = D;
for (uint256 m = 0; m < 255; m++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function get_dy(
uint256 i,
uint256 j,
uint256 dx
) external view returns (uint256) {
// dx and dy in c-units
uint256[N_COINS] memory rates = RATES;
uint256[N_COINS] memory xp = _xp();
uint256 x = xp[i] + ((dx * rates[i]) / PRECISION);
uint256 y = get_y(i, j, x, xp);
uint256 dy = ((xp[j] - y - 1) * PRECISION) / rates[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function get_dy_underlying(
uint256 i,
uint256 j,
uint256 dx
) external view returns (uint256) {
// dx and dy in underlying units
uint256[N_COINS] memory xp = _xp();
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 x = xp[i] + dx * precisions[i];
uint256 y = get_y(i, j, x, xp);
uint256 dy = (xp[j] - y - 1) / precisions[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function exchange(
uint256 i,
uint256 j,
uint256 dx,
uint256 min_dy
) external nonReentrant {
require(!isPaused, "Paused");
uint256[N_COINS] memory old_balances = balances;
uint256[N_COINS] memory xp = _xp_mem(old_balances);
uint256 x = xp[i] + (dx * RATES[i]) / PRECISION;
uint256 y = get_y(i, j, x, xp);
uint256 dy = xp[j] - y - 1; // -1 just in case there were some rounding errors
uint256 dy_fee = (dy * fee) / FEE_DENOMINATOR;
// Convert all to real units
dy = ((dy - dy_fee) * PRECISION) / RATES[j];
require(dy >= min_dy, "Exchange resulted in fewer coins than expected");
uint256 dy_protocol_fee = (dy_fee * protocol_fee) / FEE_DENOMINATOR;
dy_protocol_fee = (dy_protocol_fee * PRECISION) / RATES[j];
// Change balances exactly in same way as we change actual ERC20 coin amounts
balances[i] = old_balances[i] + dx;
// When rounding errors happen, we undercharge protocol fee in favor of LP
balances[j] = old_balances[j] - dy - dy_protocol_fee;
IERC20(coins[i]).safeTransferFrom(msg.sender, address(this), dx);
IERC20(coins[j]).safeTransfer(msg.sender, dy);
emit TokenExchange(msg.sender, i, dx, j, dy);
}
function remove_liquidity(uint256 _amount, uint256[N_COINS] memory min_amounts) external nonReentrant {
uint256 total_supply = token.totalSupply();
uint256[N_COINS] memory amounts;
uint256[N_COINS] memory fees; //Fees are unused but we've got them historically in event
for (uint256 i = 0; i < N_COINS; i++) {
uint256 value = (balances[i] * _amount) / total_supply;
require(value >= min_amounts[i], "Withdrawal resulted in fewer coins than expected");
balances[i] -= value;
amounts[i] = value;
IERC20(coins[i]).safeTransfer(msg.sender, value);
}
token.burnFrom(msg.sender, _amount); // dev: insufficient funds
emit RemoveLiquidity(msg.sender, amounts, fees, total_supply - _amount);
}
function remove_liquidity_imbalance(uint256[N_COINS] memory amounts, uint256 max_burn_amount)
external
nonReentrant
{
require(!isPaused, "Paused");
uint256 token_supply = token.totalSupply();
require(token_supply > 0, "dev: zero total supply");
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256 _protocol_fee = protocol_fee;
uint256 amp = get_A();
uint256[N_COINS] memory old_balances = balances;
uint256[N_COINS] memory new_balances = [old_balances[0], old_balances[1], old_balances[2]];
uint256 D0 = get_D_mem(old_balances, amp);
for (uint256 i = 0; i < N_COINS; i++) {
new_balances[i] -= amounts[i];
}
uint256 D1 = get_D_mem(new_balances, amp);
uint256[N_COINS] memory fees;
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _protocol_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
uint256 D2 = get_D_mem(new_balances, amp);
uint256 token_amount = ((D0 - D2) * token_supply) / D0;
require(token_amount > 0, "token_amount must be greater than 0");
token_amount += 1; // In case of rounding errors - make it unfavorable for the "attacker"
require(token_amount <= max_burn_amount, "Slippage screwed you");
token.burnFrom(msg.sender, token_amount); // dev: insufficient funds
for (uint256 i = 0; i < N_COINS; i++) {
if (amounts[i] > 0) {
IERC20(coins[i]).safeTransfer(msg.sender, amounts[i]);
}
}
token_supply -= token_amount;
emit RemoveLiquidityImbalance(msg.sender, amounts, fees, D1, token_supply);
}
function get_y_D(
uint256 A_,
uint256 i,
uint256[N_COINS] memory xp,
uint256 D
) internal pure returns (uint256) {
/**
Calculate x[i] if one reduces D from being calculated for xp to D
Done by solving quadratic equation iteratively.
x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
*/
// x in the input is converted to the same price/precision
require(i < N_COINS, "dev: i above N_COINS");
uint256 c = D;
uint256 S_;
uint256 Ann = A_ * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k != i) {
_x = xp[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann;
uint256 y_prev;
uint256 y = D;
for (uint256 k = 0; k < 255; k++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function _calc_withdraw_one_coin(uint256 _token_amount, uint256 i) internal view returns (uint256, uint256) {
// First, need to calculate
// * Get current D
// * Solve Eqn against y_i for D - _token_amount
uint256 amp = get_A();
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 total_supply = token.totalSupply();
uint256[N_COINS] memory xp = _xp();
uint256 D0 = get_D(xp, amp);
uint256 D1 = D0 - (_token_amount * D0) / total_supply;
uint256[N_COINS] memory xp_reduced = xp;
uint256 new_y = get_y_D(amp, i, xp, D1);
uint256 dy_0 = (xp[i] - new_y) / precisions[i]; // w/o fees
for (uint256 k = 0; k < N_COINS; k++) {
uint256 dx_expected;
if (k == i) {
dx_expected = (xp[k] * D1) / D0 - new_y;
} else {
dx_expected = xp[k] - (xp[k] * D1) / D0;
}
xp_reduced[k] -= (_fee * dx_expected) / FEE_DENOMINATOR;
}
uint256 dy = xp_reduced[i] - get_y_D(amp, i, xp_reduced, D1);
dy = (dy - 1) / precisions[i]; // Withdraw less to account for rounding errors
return (dy, dy_0 - dy);
}
function calc_withdraw_one_coin(uint256 _token_amount, uint256 i) external view returns (uint256) {
(uint256 dy, ) = _calc_withdraw_one_coin(_token_amount, i);
return dy;
}
function remove_liquidity_one_coin(
uint256 _token_amount,
uint256 i,
uint256 min_amount
) external nonReentrant {
// Remove _amount of liquidity all in a form of coin i
require(!isPaused, "Paused");
(uint256 dy, uint256 dy_fee) = _calc_withdraw_one_coin(_token_amount, i);
require(dy >= min_amount, "Not enough coins removed");
balances[i] -= (dy + (dy_fee * protocol_fee) / FEE_DENOMINATOR);
token.burnFrom(msg.sender, _token_amount); // dev: insufficient funds
IERC20(coins[i]).safeTransfer(msg.sender, dy);
emit RemoveLiquidityOne(msg.sender, i, _token_amount, dy);
}
// Admin functions
function ramp_A(uint256 _future_A, uint256 _future_time) external onlyOwner {
require(block.timestamp >= initial_A_time + MIN_RAMP_TIME, "dev : too early");
require(_future_time >= block.timestamp + MIN_RAMP_TIME, "dev: insufficient time");
uint256 _initial_A = get_A();
require(_future_A > 0 && _future_A < MAX_A, "_future_A must be between 0 and MAX_A");
require(
(_future_A >= _initial_A && _future_A <= _initial_A * MAX_A_CHANGE) ||
(_future_A < _initial_A && _future_A * MAX_A_CHANGE >= _initial_A),
"Illegal parameter _future_A"
);
initial_A = _initial_A;
future_A = _future_A;
initial_A_time = block.timestamp;
future_A_time = _future_time;
emit RampA(_initial_A, _future_A, block.timestamp, _future_time);
}
function stop_ramp_A() external onlyOwner {
uint256 current_A = get_A();
initial_A = current_A;
future_A = current_A;
initial_A_time = block.timestamp;
future_A_time = block.timestamp;
// now (block.timestamp < t1) is always False, so we return saved A
emit StopRampA(current_A, block.timestamp);
}
function commit_new_fee(uint256 new_fee, uint256 new_protocol_fee) external onlyOwner {
require(admin_actions_deadline == 0, "admin_actions_deadline must be 0"); // dev: active action
require(new_fee <= MAX_FEE, "dev: fee exceeds maximum");
require(new_protocol_fee <= MAX_PROTOCOL_FEE, "dev: protocol fee exceeds maximum");
admin_actions_deadline = block.timestamp + ADMIN_ACTIONS_DELAY;
future_fee = new_fee;
future_protocol_fee = new_protocol_fee;
emit CommitNewFee(admin_actions_deadline, new_fee, new_protocol_fee);
}
function apply_new_fee() external onlyOwner {
require(block.timestamp >= admin_actions_deadline, "dev: insufficient time");
require(admin_actions_deadline != 0, "admin_actions_deadline should not be 0");
admin_actions_deadline = 0;
fee = future_fee;
protocol_fee = future_protocol_fee;
emit NewFee(fee, protocol_fee);
}
function revert_new_parameters() external onlyOwner {
admin_actions_deadline = 0;
emit RevertParameters();
}
function protocol_balances(uint256 i) external view returns (uint256) {
return IERC20(coins[i]).balanceOf(address(this)) - balances[i];
}
function withdraw_protocol_fees() external onlyOwner {
for (uint256 i = 0; i < N_COINS; i++) {
uint256 value = IERC20(coins[i]).balanceOf(address(this)) - balances[i];
if (value > 0) {
IERC20(coins[i]).safeTransfer(msg.sender, value);
}
}
}
function donate_protocol_fees() external onlyOwner {
for (uint256 i = 0; i < N_COINS; i++) {
balances[i] = IERC20(coins[i]).balanceOf(address(this));
}
emit DonateProtocolFees();
}
function pause() external onlyOwner {
isPaused = true;
emit Pause();
}
function unpause() external onlyOwner {
isPaused = false;
emit Unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
interface IZFStableSwapLP {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function mint(address _to, uint256 _amount) external;
function burnFrom(address _to, uint256 _amount) external;
function setMinter(address _newMinter) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}{
"remappings": [
"@zf/=lib/@zf/",
"base64-sol/=lib/base64/",
"forge-std/=lib/forge-std/src/",
"@openzeppelin-v4/=lib/openzeppelin-contracts-4.9.3/",
"@openzeppelin-v5/=lib/openzeppelin-contracts-5.2.0/",
"#@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@uniswap/lib/contracts/=lib/solidity-lib.git/contracts/",
"solmate/src/=lib/solmate/src/",
"solidity-bytes-utils/contracts/=lib/solidity-bytes-utils/contracts/",
"base64/=lib/base64/",
"devtools/=lib/devtools/packages/toolbox-foundry/src/",
"ds-test/=lib/solmate/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"layerzero-v2/=lib/layerzero-v2/",
"openzeppelin-contracts-4.9.3/=lib/openzeppelin-contracts-4.9.3/",
"openzeppelin-contracts-5.2.0/=lib/openzeppelin-contracts-5.2.0/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"solidity-lib.git/=lib/solidity-lib.git/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"N_COINS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenA","type":"address"},{"internalType":"address","name":"_tokenB","type":"address"},{"internalType":"address","name":"_tokenC","type":"address"},{"internalType":"uint256","name":"_A","type":"uint256"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"uint256","name":"_protocol_fee","type":"uint256"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_LP","type":"address"}],"name":"createSwapPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080806040523461005a575f8054336001600160a01b0319821681178355916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3613af2908161005f8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c806329357750146102355780634cedbfc71461005f578063715018a61461005a5780638da5cb5b146100555763f2fde38b14610050575f80fd5b610346565b61031f565b6102c8565b34610218576101003660031901126102185761007961025a565b610081610270565b9061008a610286565b916100d261009661029c565b9361009f6102b2565b926100a861053a565b6001600160a01b03946100cd8187168015159081610229575b8161021c575b5061040c565b610591565b6100dd939293610497565b6001600160a01b0385168152936001600160a01b03831660208601526001600160a01b03821660408601526134799161018561011b602085016104b7565b94848652602086019461064486396040516bffffffffffffffffffffffff19606095861b81166020830190815292861b8116603483015293851b841660488201523390941b909216605c84015242607084015246609080850191909152835290919060b082610475565b5190209151905ff5928316803b15610218576101c7945f809460405197889586948593634eac483560e01b855260a435906084359060643590600488016104c7565b03925af1918215610213576101f6926101fa575b506040516001600160a01b0390911681529081906020820190565b0390f35b8061020761020d9261045c565b80610250565b826101db565b61052f565b5f80fd5b90508784161415896100c7565b848916151591506100c1565b34610218575f36600319011261021857600360805260206080f35b5f91031261021857565b600435906001600160a01b038216820361021857565b602435906001600160a01b038216820361021857565b604435906001600160a01b038216820361021857565b60c435906001600160a01b038216820361021857565b60e435906001600160a01b038216820361021857565b34610218575f366003190112610218576102e061053a565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610218575f366003190112610218575f546040516001600160a01b039091168152602090f35b346102185760203660031901126102185761035f61025a565b61036761053a565b6001600160a01b039081169081156103b8575f54826bffffffffffffffffffffffff60a01b8216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b1561041357565b60405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b6044820152606490fd5b634e487b7160e01b5f52604160045260245ffd5b67ffffffffffffffff811161047057604052565b610448565b90601f8019910116810190811067ffffffffffffffff82111761047057604052565b604051906060820182811067ffffffffffffffff82111761047057604052565b906104c56040519283610475565b565b939096949295919561010085019685985f995b60038b1061050f5750506060860152608085015260a08401526001600160a01b0391821660c08401521660e090910152909150565b81516001600160a01b0316815260019a909a0199602091820191016104da565b6040513d5f823e3d90fd5b5f546001600160a01b0316330361054d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9092906001600160a01b038085168183168082141580610637575b8061062b575b156105f057116105e8575b808416818616116105cf575b50929190565b9280949380821690831611156105c9579350925f6105c9565b9390936105bd565b60405162461bcd60e51b81526020600482015260136024820152724944454e544943414c5f41444452455353455360681b6044820152606490fd5b508286168214156105b2565b508286168114156105ac56fe60a08060405234610072575f8054336001600160a01b0319821681178355916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3600180553360805261340290816100778239608051818181610961015261180b0152f35b5f80fdfe6080806040526004361015610012575f80fd5b5f905f3560e01c90816306e9481c1461258357508063140522881461256657806316552732146125495780632081066c1461252c578063226840fb146124ea578063291f6cd21461242457806329357750146124095780633883e119146122c8578063392e53cd146122a357806339698415146122865780633c157e641461208c5780633f4ba83a14612044578063405e28f8146120275780634515cef314611c0f5780634903b0d114611be25780634eac4835146117955780634f12fe97146116d15780634fb08c5e146116ae57806353a8ed11146116905780635409491a14611672578063551a65881461160f578063556d6e9f1461156657806358680d0b146115485780635b41b908146112c85780635b5a1467146111595780635cb2bb081461108557806362203d74146110585780636491ac0014610f9c5780636d4366b714610f80578063715018a614610f275780637dafa36414610efa5780638456cb5914610ead57806385f11d1e14610e155780638da5cb5b14610dee5780639fdaea0c14610990578063a6b0a7181461094b578063aaf5eb6814610928578063ab5ac0611461090b578063b187bd26146108e8578063b4b577ad146108ca578063b8ca3b831461079e578063bb7b8b80146107f9578063bc063e1a146107da578063c6610657146107a3578063d73792a91461079e578063ddca3f4314610780578063e5d9e90314610762578063ecb586a5146104d2578063f1dc3cc91461033f578063f2fde38b146102a8578063f446c1d0146102855763fc0c546a1461025a575f80fd5b346102825780600319360112610282576010546040516001600160a01b039091168152602090f35b80fd5b503461028257806003193601126102825760206102a06128fd565b604051908152f35b5034610282576020366003190112610282576004356001600160a01b03811680820361033b576102d66128a6565b156102e7576102e490612eb5565b80f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b5f80fd5b50346102825761034e3661265c565b9091610358612976565b61036760ff60185416156127e5565b6103718382612a25565b9092831061048d576402540be40061038f61039692600f549061276f565b0483612762565b6003841015610479576103ae84600b01918254612755565b90556010546001600160a01b03908116803b156104755760405163079cc67960e41b81523360048201526024810184905290869081908390604490829084905af191821561046857859261044d575b5050610410913390866008015416612e74565b604051928352602083015260408201527f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a060603392a26001805580f35b6104589192506125ce565b6104645782855f6103fd565b8480fd5b50604051903d90823e3d90fd5b8580fd5b634e487b7160e01b85526032600452602485fd5b60405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606490fd5b503461028257608036600319011261028257600435366043121561033b576040516104fc8161259e565b6084918136841161033b576024906024905b85821061075257505061051f612976565b6010546040516318160ddd60e01b815260209490926001600160a01b039286908590600490829087165afa938415610747578894610713575b50908792916040519761056a8961259e565b6060368a376040519761057c8961259e565b6060368a37855b6003811061064a57505050505060105416803b156106465760405163079cc67960e41b8152336004820152602481018590529082908290604490829084905af1801561063b57610627575b50506105f5916105dd91612755565b916105eb604051809561285d565b606084019061285d565b60c08201527fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d60e03392a26001805580f35b610630906125ce565b61046457845f6105ce565b6040513d84823e3d90fd5b5080fd5b8091929394959650600b0180549061066b896106668c8561276f565b612782565b916106768489612730565b5183106106b757918061069c858f6106aa956106958560019a99612755565b9055612730565b523389846008015416612e74565b01908a9594939291610583565b60405162461bcd60e51b8152600481018690526030818901527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b60648201528690fd5b9093506020813d60201161073f575b8161072f602093836125e2565b8101031261033b5751925f610558565b3d9150610722565b6040513d8a823e3d90fd5b813581526020918201910161050e565b503461028257806003193601126102825760206040516203f4808152f35b50346102825780600319360112610282576020600e54604051908152f35b612676565b503461028257602036600319011261028257600435600381101561064657600801546040516001600160a01b039091168152602090f35b50346102825780600319360112610282576020604051633b9aca008152f35b5034610282578060031936011261028257600490610826610818612bd7565b6108206128fd565b90612efb565b6010546040516318160ddd60e01b81529391929160209185919082906001600160a01b03165afa928315610468578193610896575b50670de0b6b3a7640000918281029281840414901517156108825760206102a08484612782565b634e487b7160e01b81526011600452602490fd5b9092506020813d6020116108c2575b816108b2602093836125e2565b8101031261033b5751915f61085b565b3d91506108a5565b50346102825780600319360112610282576020601254604051908152f35b5034610282578060031936011261028257602060ff601854166040519015158152f35b503461028257806003193601126102825760206040516103e88152f35b50346102825780600319360112610282576020604051670de0b6b3a76400008152f35b50346102825780600319360112610282576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102825760803660031901126102825760046109ad36612604565b916109b6612976565b6109c560ff60185416156127e5565b6010546040516318160ddd60e01b81529260209184919082906001600160a01b03165afa918215610468578192610dba575b508115610d7c57600e54600381029080820460031490151715610d6857600f5490610a206128fd565b610a28612695565b90604051610a358161259e565b825181526020830151602082015260408301516040820152610a5f82610a5a85612e15565b612efb565b92865b60038110610d3c5750908291610a7f899a989994610a5a84612e15565b9660405196610a8d8861259e565b60603689378a5b888c8b60038410610c51575050505050505091610ac4610abe61066693610a5a610ac99796612e15565b84612755565b61276f565b948515610c00576001808701809711610bec57610aea60643588111561281a565b6010546001600160a01b0316803b15610be85760405163079cc67960e41b8152336004820152602481018990529087908290604490829084905af18015610bdd57908791610bc9575b505b60038110610b87575050610b6f7f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c2949596610b7d92612755565b604051938493339785612884565b0390a26001805580f35b80610b93839288612730565b51610b9f575b01610b35565b6008810154610bc4906001600160a01b0316610bbb838a612730565b51903390612e74565b610b99565b610bd2906125ce565b61047557855f610b33565b6040513d89823e3d90fd5b8680fd5b634e487b7160e01b86526011600452602486fd5b60405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b6064820152608490fd5b8798995096610ce686610ce086610cd98f610ced9897610c888e9f9260019d9e9f8694610c818661066693612730565b519061276f565b9050610c948289612730565b51811115610d2857610cb190610caa838a612730565b5190612755565b965b8c610cc86402540be400998a9260031c61276f565b04610cd3838b612730565b52612730565b5195612730565b5161276f565b0490612755565b81600b0155610d10610cff828b612730565b51610d0a8389612730565b51612755565b610d1a8288612730565b5201908b9594939291610a94565b610d3690610d0a838a612730565b96610cb3565b80610d57610d4c6001938d612730565b51610d0a8387612730565b610d618286612730565b5201610a62565b634e487b7160e01b82526011600452602482fd5b60405162461bcd60e51b81526020600482015260166024820152756465763a207a65726f20746f74616c20737570706c7960501b6044820152606490fd5b9091506020813d602011610de6575b81610dd6602093836125e2565b8101031261033b5751905f6109f7565b3d9150610dc9565b5034610282578060031936011261028257546040516001600160a01b039091168152602090f35b503461028257610e6f610e63610e75610e69610d0a610e333661265c565b8197919283610e40612bd7565b968793610e4b6126fd565b9a8b91610c8186610e5c818a612730565b5194612730565b90612762565b91612c35565b92612730565b5f198101939084116108825760206102a0610e9b86610e948787612730565b5190612782565b6402540be400610ce682600e5461276f565b5034610282578060031936011261028257610ec66128a6565b600160ff1960185416176018557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6258180a180f35b50346102825760203660031901126102825760043560038110156106465760209060020154604051908152f35b5034610282578060031936011261028257610f406128a6565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610282578060031936011261028257602060405160128152f35b503461028257602090816003193601126102825760043560038110156110445760088101546040516370a0823160e01b81523060048201529291908490849060249082906001600160a01b03165afa9182156110385791611007575b6102a09250600b015490612755565b90508282813d8311611031575b61101e81836125e2565b8101031261033b576102a0915190610ff8565b503d611014565b604051903d90823e3d90fd5b634e487b7160e01b82526032600452602482fd5b50346102825760203660031901126102825760043560038110156106465760209060050154604051908152f35b503461028257806003193601126102825761109e6128a6565b805b600381106110ac575080f35b60088101546040516370a0823160e01b8152306004820152602092916001600160a01b0316908381602481855afa93841561114e57859461111b575b50506110fb60019383600b015490612755565b80611109575b5050016110a0565b611114913390612e74565b5f80611101565b90809450813d8311611147575b61113281836125e2565b8101031261033b576110fb60019351936110e8565b503d611128565b6040513d87823e3d90fd5b50346102825761116836612646565b906111716128a6565b60155461128457633b9aca00811161123f576402540be40082116111f0576203f4804201918242116111dc577f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe09160409184601555816016558060175582519182526020820152a280f35b634e487b7160e01b84526011600452602484fd5b60405162461bcd60e51b815260206004820152602160248201527f6465763a2070726f746f636f6c206665652065786365656473206d6178696d756044820152606d60f81b6064820152608490fd5b60405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152fd5b50346102825760803660031901126102825760249060043582356044356112ed612976565b6112fc60ff60185416156127e5565b611304612695565b9461130e86612e15565b6113188582612730565b5160038610156115355781610d0a86610e6f61134d969561135461135b968c670de0b6b3a76400009a8b91600501548d61276f565b0490612762565b838c612c35565b5f19810192908311611522576402540be400916113868361137e600e548761276f565b048095612755565b928284029380850484149015171561150f5760038710156114fc576113b087600501548095612782565b9460643586106114a157600f546113c69161276f565b0482810292818404149015171561148f57508561143484610d0a887fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989a9b9c61142a8a61142461141d610b7d9c9b6114399b612782565b9884612730565b51612762565b8d600b0155612730565b612755565b84600b015561146a8160018060a01b0361145d86828b6008015416309033906129cc565b3390876008015416612e74565b6040519384933397859094939260609260808301968352602083015260408201520152565b634e487b7160e01b8852601160045287fd5b60405162461bcd60e51b815260206004820152602e818501527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b6064820152608490fd5b50634e487b7160e01b8852603260045287fd5b50634e487b7160e01b8852601160045287fd5b50634e487b7160e01b8652601160045285fd5b634e487b7160e01b875260326004528287fd5b50346102825780600319360112610282576020601654604051908152f35b5034610282576115753661265c565b92816115829392936126ca565b9261158b612bd7565b9081836115988383612730565b51670de0b6b3a7640000809a6115ae868b612730565b516115b89161276f565b046115c291612762565b906115cc93612c35565b916115d691612730565b51906115e191612755565b5f198101908111610d68578481029481860414901517156108825760206102a0610e9b86610e948787612730565b50346102825780600319360112610282576116286128a6565b7f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860406116536128fd565b806011558060125542601355426014558151908152426020820152a180f35b50346102825780600319360112610282576020601154604051908152f35b50346102825780600319360112610282576020601754604051908152f35b50346102825760206116c86116c236612646565b90612a25565b50604051908152f35b50346102825780600319360112610282576116ea6128a6565b6015546116f9814210156127a0565b1561174157806015557fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d1604060165480600e5560175480600f5582519182526020820152a180f35b60405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b6064820152608490fd5b503461028257610100366003190112610282573660231215610282576040516117bd8161259e565b8036606411611bde576004905b60648210611bbe57505060c4356001600160a01b038116900361033b5760e435906001600160a01b038216820361033b5760185460ff8160081c16611b79577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303611b3457620f424060643511611afa57633b9aca0060843511611abe576402540be40060a43511611a795761ff00191661010017601855825b600381106118fd5750825b600381106118df575050606435601155606435601255608435600e5560a435600f5560018060a01b03166bffffffffffffffffffffffff60a01b60105416176010556118c36128a6565b60c4356001600160a01b0316156102e7576102e460c435612eb5565b81516001600160a01b03166008820155602090910190600101611879565b6001600160a01b0361190f8284612730565b511615611a45576001600160a01b036119288284612730565b5116604051809163313ce56760e01b825281600460209485935afa8015611a3a578690611a02575b60ff9150166012918282116119b05750810390811161199c57604d811161199c57600a0a808260020155670de0b6b3a7640000908082029182040361199c57600582015560010161186e565b634e487b7160e01b85526011600452602485fd5b60405162461bcd60e51b815260048101919091526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b6064820152608490fd5b508181813d8311611a33575b611a1881836125e2565b81010312610475575160ff811681036104755760ff90611950565b503d611a0e565b6040513d88823e3d90fd5b60405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b6044820152606490fd5b60405162461bcd60e51b815260206004820152601d60248201527f5f70726f746f636f6c5f6665652065786365656473206d6178696d756d0000006044820152606490fd5b60405162461bcd60e51b81526020600482015260146024820152735f6665652065786365656473206d6178696d756d60601b6044820152606490fd5b60405162461bcd60e51b81526020600482015260126024820152715f412065786365656473206d6178696d756d60701b6044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606490fd5b81356001600160a01b038116810361033b578152602091820191016117ca565b8280fd5b503461028257602036600319011261028257600435600381101561064657602090600b0154604051908152f35b503461033b57608036600319011261033b57611c2a36612604565b90611c33612976565b611c4260ff60185416156127e5565b60405191611c4f8361259e565b6060368437600e5460038102908082046003149015171561201357600493600f54611c786128fd565b6010546040516318160ddd60e01b81529760209189919082906001600160a01b03165afa968715611e04575f97611fdf575b505f91611cb5612695565b88611fca575b60405191611cc88361259e565b8151835260208201516020840152604082015160408401525f5b60038110611f315750611cf884610a5a85612e15565b9685881115611eec57878b15611ec057505f5b87878a60038410611e6c575050505050505090610a5a611d2a92612e15565b905b86611e51575050815b611d4360643582101561281a565b5f5b60038110611e0f57506010546001600160a01b0316803b1561033b576040516340c10f1960e01b815233600482015260248101839052905f908290604490829084905af18015611e0457611dc5575b50610b6f610b7d917f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d959697612762565b7f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d949550610b7d91611df9610b6f926125ce565b5f9695509150611d94565b6040513d5f823e3d90fd5b80611e1c60019287612730565b51611e28575b01611d45565b611e4c828060a01b03826008015416611e418389612730565b5190309033906129cc565b611e22565b610666611e6182611e6794612755565b8861276f565b611d35565b9187610ce687610ce087610cd981611e93611e9d998f839c610c8160019f61066693612730565b610c948289612730565b81600b0155611eaf610cff828b612730565b611eb98288612730565b5201611d0b565b9594505050505f5b60038110611ed7575050611d2c565b6001906020835193019281600b015501611ec8565b60405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606490fd5b8a15611f6b575b80611f5a611f4860019386612730565b51611f53838d612730565b5190612762565b611f648287612730565b5201611ce2565b611f75818a612730565b51611f385760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b6064820152608490fd5b9250611fd982610a5a85612e15565b92611cbb565b9096506020813d60201161200b575b81611ffb602093836125e2565b8101031261033b5751955f611caa565b3d9150611fee565b634e487b7160e01b5f52601160045260245ffd5b3461033b575f36600319011261033b576020601554604051908152f35b3461033b575f36600319011261033b5761205c6128a6565b60ff19601854166018557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b335f80a1005b3461033b5761209a36612646565b906120a36128a6565b601354620151809081810180911161201357421061224f574201804211612013576120d0908310156127a0565b6120d86128fd565b908015801580612243575b156121f057828210801591826121d2575b82156121a6575b5050156121615761215c7fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25493836011558260125542601355806014556040519384934291859094939260609260808301968352602083015260408201520152565b0390a1005b60405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606490fd5b909150816121b7575b5084806120fb565b6103e8838102925083830414171561201357821115846121af565b91506103e880850290858204148515171561201357831115916120f4565b60405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b6064820152608490fd5b50620f424082106120e3565b60405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b6044820152606490fd5b3461033b575f36600319011261033b576020604051620f42408152f35b3461033b575f36600319011261033b57602060ff60185460081c166040519015158152f35b3461033b57608036600319011261033b576122e236612604565b60643590811515820361033b576122f7612695565b6122ff6128fd565b9061230d82610a5a83612e15565b925f5b600381106123b9575050600491610a5a61232992612e15565b6010546040516318160ddd60e01b81529260209184919082906001600160a01b03165afa918215611e04575f92612382575b508291610666916102a0946020965f1461237857610ac491612755565b90610ac491612755565b909291506020813d6020116123b1575b8161239f602093836125e2565b8101031261033b57519091602061235b565b3d9150612392565b60019086156123ec576123da6123cf8285612730565b516114248387612730565b6123e48286612730565b525b01612310565b6123f9610d4c8285612730565b6124038286612730565b526123e6565b3461033b575f36600319011261033b57602060405160038152f35b3461033b575f36600319011261033b5761243c6128a6565b5f5b6003811061246c577fd04006881e5c4375ab3b8790e4a90e02de703ea619075d90fd37e50f290581805f80a1005b60088101546040516370a0823160e01b815230600482015291906020908190849060249082906001600160a01b03165afa908115611e04575f916124bb575b506001925081600b01550161243e565b905082813d83116124e3575b6124d181836125e2565b8101031261033b5760019151836124ab565b503d6124c7565b3461033b575f36600319011261033b576125026128a6565b5f6015557f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a15f80a1005b3461033b575f36600319011261033b576020601354604051908152f35b3461033b575f36600319011261033b576020600f54604051908152f35b3461033b575f36600319011261033b576020601454604051908152f35b3461033b575f36600319011261033b57806201518060209252f35b6060810190811067ffffffffffffffff8211176125ba57604052565b634e487b7160e01b5f52604160045260245ffd5b67ffffffffffffffff81116125ba57604052565b90601f8019910116810190811067ffffffffffffffff8211176125ba57604052565b806023121561033b576040519061261a8261259e565b8160649160641161033b576004905b8282106126365750505090565b8135815260209182019101612629565b604090600319011261033b576004359060243590565b606090600319011261033b57600435906024359060443590565b3461033b575f36600319011261033b5760206040516402540be4008152f35b60405190600b5f835b600382106126b4575050506126b28261259e565b565b600160208192855481520193019101909161269e565b6040519060055f835b600382106126e7575050506126b28261259e565b60016020819285548152019301910190916126d3565b6040519060025f835b6003821061271a575050506126b28261259e565b6001602081928554815201930191019091612706565b9060038110156127415760051b0190565b634e487b7160e01b5f52603260045260245ffd5b9190820391821161201357565b9190820180921161201357565b8181029291811591840414171561201357565b811561278c570490565b634e487b7160e01b5f52601260045260245ffd5b156127a757565b60405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606490fd5b156127ec57565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b1561282157565b60405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606490fd5b5f915b6003831061286d57505050565b600190825181526020809101920192019190612860565b9094939261289d60e0936105eb8461010081019961285d565b60c08201520152565b5f546001600160a01b031633036128b957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6014546012548142105f1461297157601154601354909182811115612953579261294a610e63926129446129348661295098612755565b61293e8342612755565b9061276f565b92612755565b90612782565b90565b9261294a61296b926129446129346129509787612755565b90612755565b905090565b600260015414612987576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a081019181831067ffffffffffffffff8411176125ba576126b292604052613057565b9190612a2f6128fd565b90600e54916003926003810290808204600314901517156120135760031c6004612a576126fd565b6010546040516318160ddd60e01b81529196919260209184919082906001600160a01b03165afa918215611e04575f92612ba3575b50612ab6612ab0612a9b612bd7565b93610666612aa98887612efb565b809c61276f565b89612755565b92612ac384848888613187565b98612adf612ad58b610d0a8a88612730565b610e94898b612730565b995f5b88858210612b2e5792505050612b0c95949250839150612b058161296b95612730565b5194613187565b5f19810190811161201357610e94612b279261295094612730565b8093612755565b90612b6b6402540be400612b6086868c868d60019982145f14612b7c5761143492610ce0611e61969361066693612730565b04610d0a838a612730565b612b758289612730565b5201612ae2565b92509261066661296b92610ce086612b97612b9e9888612730565b5196612730565b611e61565b9091506020813d602011612bcf575b81612bbf602093836125e2565b8101031261033b5751905f612a8c565b3d9150612bb2565b6060604051612be58161259e565b369037612bf06126ca565b905f5b60038110612bfe5750565b80670de0b6b3a7640000612c23612c1760019487612730565b5183600b01549061276f565b04612c2e8286612730565b5201612bf3565b9290918284141580612e0b575b80612e01575b15612dc857612c556128fd565b91612c608382612efb565b80955f93600393848702978789048614881517156120135791899493915f935b878510612d4d575050505050600991612c989161276f565b930290848204148415171561201357612cb7610e6391612cbe94612782565b9385612782565b90825f5b60ff8110612cd2575b5050505090565b84612ce684612ce1838061276f565b612762565b600191906001600160ff1b03821682036120135761294a8561143489612d0d95871b612762565b958681811115612d365790612d2191612755565b1115612d31576001905b01612cc2565b612ccb565b612d3f91612755565b1115612d3157600190612d2b565b919395509193968486145f14612d9e57612d728b612d6c868094612762565b9961276f565b8782029180830489149015171561201357600191612d8f91612782565b955b019290918a959492612c80565b858214612dbe57612d728b612d6c612db68987612730565b518094612762565b9694600190612d91565b60405162461bcd60e51b815260206004820152601160248201527024b63632b3b0b6103830b930b6b2ba32b960791b6044820152606490fd5b5060038310612c48565b5060038410612c42565b906060604051612e248161259e565b369037612e2f6126ca565b915f5b60038110612e3e575050565b80670de0b6b3a7640000612e62612e5760019488612730565b51610c818487612730565b04612e6d8287612730565b5201612e32565b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526126b291612eb06064836125e2565b613057565b5f80546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3565b905f905f5b6003811061303f575081156130385781926003928383029280840485149015171561201357925f198301838111915f5b60ff8110612f43575b5050505050505090565b875f5b838110612fed575088612f59898961276f565b90848302918383048614841517156120135781610ac48994612f7a93612762565b9161201357612f89908661276f565b906001600160fe1b03831683036120135761294a612fad9260019460021b90612762565b988981811115612fd65790612fc191612755565b1115612fd1576001905b01612f30565b612f39565b612fdf91612755565b1115612fd157600190612fcb565b969791989394959084612fff9161276f565b6130098883612730565b5190848202918083048614901517156120135760019161302891612782565b9701989197969095949398612f46565b5050505f90565b91613050600191611f538587612730565b9201612f00565b60018060a01b03166040516040810167ffffffffffffffff90828110828211176125ba576040525f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182875af13d1561317a573d9182116125ba576130ea93604051926130dd87601f19601f84011601856125e2565b83523d5f8785013e6132fa565b805182811591821561315a575b50509050156131035750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b838092935001031261033b57810151801515810361033b5780825f6130f7565b6130ea93606092506132fa565b906003808210156132be57845f9282850295858704841486151715612013578792915f915b858310613265575050506009916131c29161276f565b930290848204148415171561201357612cb7610e63916131e194612782565b90825f5b60ff81106131f4575050505090565b8461320384612ce1838061276f565b600191906001600160ff1b03821682036120135761294a856114348961322a95871b612762565b95868181111561324e579061323e91612755565b1115612d31576001905b016131e5565b61325791612755565b1115612d3157600190613248565b929591935091908284146132b45761328a89613284612db68786612730565b9761276f565b85820291808304871490151715612013576001916132a791612782565b935b0190918893926131ac565b94926001906132a9565b60405162461bcd60e51b81526020600482015260146024820152736465763a20692061626f7665204e5f434f494e5360601b6044820152606490fd5b9192901561335c575081511561330e575090565b3b156133175790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561336f5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401525f935b8285106133b3575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061339156fea2646970667358221220ff079f77ffc647c7c95c65c294f8bd760030244aa1f70807d1b7de9f9792929b64736f6c63430008170033a26469706673582212207b258ed5079620eb7a699516c8205daa06183ba4775ba0e31980e58b3a932b5f64736f6c63430008170033
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c806329357750146102355780634cedbfc71461005f578063715018a61461005a5780638da5cb5b146100555763f2fde38b14610050575f80fd5b610346565b61031f565b6102c8565b34610218576101003660031901126102185761007961025a565b610081610270565b9061008a610286565b916100d261009661029c565b9361009f6102b2565b926100a861053a565b6001600160a01b03946100cd8187168015159081610229575b8161021c575b5061040c565b610591565b6100dd939293610497565b6001600160a01b0385168152936001600160a01b03831660208601526001600160a01b03821660408601526134799161018561011b602085016104b7565b94848652602086019461064486396040516bffffffffffffffffffffffff19606095861b81166020830190815292861b8116603483015293851b841660488201523390941b909216605c84015242607084015246609080850191909152835290919060b082610475565b5190209151905ff5928316803b15610218576101c7945f809460405197889586948593634eac483560e01b855260a435906084359060643590600488016104c7565b03925af1918215610213576101f6926101fa575b506040516001600160a01b0390911681529081906020820190565b0390f35b8061020761020d9261045c565b80610250565b826101db565b61052f565b5f80fd5b90508784161415896100c7565b848916151591506100c1565b34610218575f36600319011261021857600360805260206080f35b5f91031261021857565b600435906001600160a01b038216820361021857565b602435906001600160a01b038216820361021857565b604435906001600160a01b038216820361021857565b60c435906001600160a01b038216820361021857565b60e435906001600160a01b038216820361021857565b34610218575f366003190112610218576102e061053a565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610218575f366003190112610218575f546040516001600160a01b039091168152602090f35b346102185760203660031901126102185761035f61025a565b61036761053a565b6001600160a01b039081169081156103b8575f54826bffffffffffffffffffffffff60a01b8216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b1561041357565b60405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b6044820152606490fd5b634e487b7160e01b5f52604160045260245ffd5b67ffffffffffffffff811161047057604052565b610448565b90601f8019910116810190811067ffffffffffffffff82111761047057604052565b604051906060820182811067ffffffffffffffff82111761047057604052565b906104c56040519283610475565b565b939096949295919561010085019685985f995b60038b1061050f5750506060860152608085015260a08401526001600160a01b0391821660c08401521660e090910152909150565b81516001600160a01b0316815260019a909a0199602091820191016104da565b6040513d5f823e3d90fd5b5f546001600160a01b0316330361054d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9092906001600160a01b038085168183168082141580610637575b8061062b575b156105f057116105e8575b808416818616116105cf575b50929190565b9280949380821690831611156105c9579350925f6105c9565b9390936105bd565b60405162461bcd60e51b81526020600482015260136024820152724944454e544943414c5f41444452455353455360681b6044820152606490fd5b508286168214156105b2565b508286168114156105ac56fe60a08060405234610072575f8054336001600160a01b0319821681178355916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3600180553360805261340290816100778239608051818181610961015261180b0152f35b5f80fdfe6080806040526004361015610012575f80fd5b5f905f3560e01c90816306e9481c1461258357508063140522881461256657806316552732146125495780632081066c1461252c578063226840fb146124ea578063291f6cd21461242457806329357750146124095780633883e119146122c8578063392e53cd146122a357806339698415146122865780633c157e641461208c5780633f4ba83a14612044578063405e28f8146120275780634515cef314611c0f5780634903b0d114611be25780634eac4835146117955780634f12fe97146116d15780634fb08c5e146116ae57806353a8ed11146116905780635409491a14611672578063551a65881461160f578063556d6e9f1461156657806358680d0b146115485780635b41b908146112c85780635b5a1467146111595780635cb2bb081461108557806362203d74146110585780636491ac0014610f9c5780636d4366b714610f80578063715018a614610f275780637dafa36414610efa5780638456cb5914610ead57806385f11d1e14610e155780638da5cb5b14610dee5780639fdaea0c14610990578063a6b0a7181461094b578063aaf5eb6814610928578063ab5ac0611461090b578063b187bd26146108e8578063b4b577ad146108ca578063b8ca3b831461079e578063bb7b8b80146107f9578063bc063e1a146107da578063c6610657146107a3578063d73792a91461079e578063ddca3f4314610780578063e5d9e90314610762578063ecb586a5146104d2578063f1dc3cc91461033f578063f2fde38b146102a8578063f446c1d0146102855763fc0c546a1461025a575f80fd5b346102825780600319360112610282576010546040516001600160a01b039091168152602090f35b80fd5b503461028257806003193601126102825760206102a06128fd565b604051908152f35b5034610282576020366003190112610282576004356001600160a01b03811680820361033b576102d66128a6565b156102e7576102e490612eb5565b80f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b5f80fd5b50346102825761034e3661265c565b9091610358612976565b61036760ff60185416156127e5565b6103718382612a25565b9092831061048d576402540be40061038f61039692600f549061276f565b0483612762565b6003841015610479576103ae84600b01918254612755565b90556010546001600160a01b03908116803b156104755760405163079cc67960e41b81523360048201526024810184905290869081908390604490829084905af191821561046857859261044d575b5050610410913390866008015416612e74565b604051928352602083015260408201527f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a060603392a26001805580f35b6104589192506125ce565b6104645782855f6103fd565b8480fd5b50604051903d90823e3d90fd5b8580fd5b634e487b7160e01b85526032600452602485fd5b60405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606490fd5b503461028257608036600319011261028257600435366043121561033b576040516104fc8161259e565b6084918136841161033b576024906024905b85821061075257505061051f612976565b6010546040516318160ddd60e01b815260209490926001600160a01b039286908590600490829087165afa938415610747578894610713575b50908792916040519761056a8961259e565b6060368a376040519761057c8961259e565b6060368a37855b6003811061064a57505050505060105416803b156106465760405163079cc67960e41b8152336004820152602481018590529082908290604490829084905af1801561063b57610627575b50506105f5916105dd91612755565b916105eb604051809561285d565b606084019061285d565b60c08201527fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d60e03392a26001805580f35b610630906125ce565b61046457845f6105ce565b6040513d84823e3d90fd5b5080fd5b8091929394959650600b0180549061066b896106668c8561276f565b612782565b916106768489612730565b5183106106b757918061069c858f6106aa956106958560019a99612755565b9055612730565b523389846008015416612e74565b01908a9594939291610583565b60405162461bcd60e51b8152600481018690526030818901527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b60648201528690fd5b9093506020813d60201161073f575b8161072f602093836125e2565b8101031261033b5751925f610558565b3d9150610722565b6040513d8a823e3d90fd5b813581526020918201910161050e565b503461028257806003193601126102825760206040516203f4808152f35b50346102825780600319360112610282576020600e54604051908152f35b612676565b503461028257602036600319011261028257600435600381101561064657600801546040516001600160a01b039091168152602090f35b50346102825780600319360112610282576020604051633b9aca008152f35b5034610282578060031936011261028257600490610826610818612bd7565b6108206128fd565b90612efb565b6010546040516318160ddd60e01b81529391929160209185919082906001600160a01b03165afa928315610468578193610896575b50670de0b6b3a7640000918281029281840414901517156108825760206102a08484612782565b634e487b7160e01b81526011600452602490fd5b9092506020813d6020116108c2575b816108b2602093836125e2565b8101031261033b5751915f61085b565b3d91506108a5565b50346102825780600319360112610282576020601254604051908152f35b5034610282578060031936011261028257602060ff601854166040519015158152f35b503461028257806003193601126102825760206040516103e88152f35b50346102825780600319360112610282576020604051670de0b6b3a76400008152f35b50346102825780600319360112610282576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102825760803660031901126102825760046109ad36612604565b916109b6612976565b6109c560ff60185416156127e5565b6010546040516318160ddd60e01b81529260209184919082906001600160a01b03165afa918215610468578192610dba575b508115610d7c57600e54600381029080820460031490151715610d6857600f5490610a206128fd565b610a28612695565b90604051610a358161259e565b825181526020830151602082015260408301516040820152610a5f82610a5a85612e15565b612efb565b92865b60038110610d3c5750908291610a7f899a989994610a5a84612e15565b9660405196610a8d8861259e565b60603689378a5b888c8b60038410610c51575050505050505091610ac4610abe61066693610a5a610ac99796612e15565b84612755565b61276f565b948515610c00576001808701809711610bec57610aea60643588111561281a565b6010546001600160a01b0316803b15610be85760405163079cc67960e41b8152336004820152602481018990529087908290604490829084905af18015610bdd57908791610bc9575b505b60038110610b87575050610b6f7f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c2949596610b7d92612755565b604051938493339785612884565b0390a26001805580f35b80610b93839288612730565b51610b9f575b01610b35565b6008810154610bc4906001600160a01b0316610bbb838a612730565b51903390612e74565b610b99565b610bd2906125ce565b61047557855f610b33565b6040513d89823e3d90fd5b8680fd5b634e487b7160e01b86526011600452602486fd5b60405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b6064820152608490fd5b8798995096610ce686610ce086610cd98f610ced9897610c888e9f9260019d9e9f8694610c818661066693612730565b519061276f565b9050610c948289612730565b51811115610d2857610cb190610caa838a612730565b5190612755565b965b8c610cc86402540be400998a9260031c61276f565b04610cd3838b612730565b52612730565b5195612730565b5161276f565b0490612755565b81600b0155610d10610cff828b612730565b51610d0a8389612730565b51612755565b610d1a8288612730565b5201908b9594939291610a94565b610d3690610d0a838a612730565b96610cb3565b80610d57610d4c6001938d612730565b51610d0a8387612730565b610d618286612730565b5201610a62565b634e487b7160e01b82526011600452602482fd5b60405162461bcd60e51b81526020600482015260166024820152756465763a207a65726f20746f74616c20737570706c7960501b6044820152606490fd5b9091506020813d602011610de6575b81610dd6602093836125e2565b8101031261033b5751905f6109f7565b3d9150610dc9565b5034610282578060031936011261028257546040516001600160a01b039091168152602090f35b503461028257610e6f610e63610e75610e69610d0a610e333661265c565b8197919283610e40612bd7565b968793610e4b6126fd565b9a8b91610c8186610e5c818a612730565b5194612730565b90612762565b91612c35565b92612730565b5f198101939084116108825760206102a0610e9b86610e948787612730565b5190612782565b6402540be400610ce682600e5461276f565b5034610282578060031936011261028257610ec66128a6565b600160ff1960185416176018557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6258180a180f35b50346102825760203660031901126102825760043560038110156106465760209060020154604051908152f35b5034610282578060031936011261028257610f406128a6565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610282578060031936011261028257602060405160128152f35b503461028257602090816003193601126102825760043560038110156110445760088101546040516370a0823160e01b81523060048201529291908490849060249082906001600160a01b03165afa9182156110385791611007575b6102a09250600b015490612755565b90508282813d8311611031575b61101e81836125e2565b8101031261033b576102a0915190610ff8565b503d611014565b604051903d90823e3d90fd5b634e487b7160e01b82526032600452602482fd5b50346102825760203660031901126102825760043560038110156106465760209060050154604051908152f35b503461028257806003193601126102825761109e6128a6565b805b600381106110ac575080f35b60088101546040516370a0823160e01b8152306004820152602092916001600160a01b0316908381602481855afa93841561114e57859461111b575b50506110fb60019383600b015490612755565b80611109575b5050016110a0565b611114913390612e74565b5f80611101565b90809450813d8311611147575b61113281836125e2565b8101031261033b576110fb60019351936110e8565b503d611128565b6040513d87823e3d90fd5b50346102825761116836612646565b906111716128a6565b60155461128457633b9aca00811161123f576402540be40082116111f0576203f4804201918242116111dc577f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe09160409184601555816016558060175582519182526020820152a280f35b634e487b7160e01b84526011600452602484fd5b60405162461bcd60e51b815260206004820152602160248201527f6465763a2070726f746f636f6c206665652065786365656473206d6178696d756044820152606d60f81b6064820152608490fd5b60405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152fd5b50346102825760803660031901126102825760249060043582356044356112ed612976565b6112fc60ff60185416156127e5565b611304612695565b9461130e86612e15565b6113188582612730565b5160038610156115355781610d0a86610e6f61134d969561135461135b968c670de0b6b3a76400009a8b91600501548d61276f565b0490612762565b838c612c35565b5f19810192908311611522576402540be400916113868361137e600e548761276f565b048095612755565b928284029380850484149015171561150f5760038710156114fc576113b087600501548095612782565b9460643586106114a157600f546113c69161276f565b0482810292818404149015171561148f57508561143484610d0a887fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989a9b9c61142a8a61142461141d610b7d9c9b6114399b612782565b9884612730565b51612762565b8d600b0155612730565b612755565b84600b015561146a8160018060a01b0361145d86828b6008015416309033906129cc565b3390876008015416612e74565b6040519384933397859094939260609260808301968352602083015260408201520152565b634e487b7160e01b8852601160045287fd5b60405162461bcd60e51b815260206004820152602e818501527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b6064820152608490fd5b50634e487b7160e01b8852603260045287fd5b50634e487b7160e01b8852601160045287fd5b50634e487b7160e01b8652601160045285fd5b634e487b7160e01b875260326004528287fd5b50346102825780600319360112610282576020601654604051908152f35b5034610282576115753661265c565b92816115829392936126ca565b9261158b612bd7565b9081836115988383612730565b51670de0b6b3a7640000809a6115ae868b612730565b516115b89161276f565b046115c291612762565b906115cc93612c35565b916115d691612730565b51906115e191612755565b5f198101908111610d68578481029481860414901517156108825760206102a0610e9b86610e948787612730565b50346102825780600319360112610282576116286128a6565b7f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860406116536128fd565b806011558060125542601355426014558151908152426020820152a180f35b50346102825780600319360112610282576020601154604051908152f35b50346102825780600319360112610282576020601754604051908152f35b50346102825760206116c86116c236612646565b90612a25565b50604051908152f35b50346102825780600319360112610282576116ea6128a6565b6015546116f9814210156127a0565b1561174157806015557fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d1604060165480600e5560175480600f5582519182526020820152a180f35b60405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b6064820152608490fd5b503461028257610100366003190112610282573660231215610282576040516117bd8161259e565b8036606411611bde576004905b60648210611bbe57505060c4356001600160a01b038116900361033b5760e435906001600160a01b038216820361033b5760185460ff8160081c16611b79577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303611b3457620f424060643511611afa57633b9aca0060843511611abe576402540be40060a43511611a795761ff00191661010017601855825b600381106118fd5750825b600381106118df575050606435601155606435601255608435600e5560a435600f5560018060a01b03166bffffffffffffffffffffffff60a01b60105416176010556118c36128a6565b60c4356001600160a01b0316156102e7576102e460c435612eb5565b81516001600160a01b03166008820155602090910190600101611879565b6001600160a01b0361190f8284612730565b511615611a45576001600160a01b036119288284612730565b5116604051809163313ce56760e01b825281600460209485935afa8015611a3a578690611a02575b60ff9150166012918282116119b05750810390811161199c57604d811161199c57600a0a808260020155670de0b6b3a7640000908082029182040361199c57600582015560010161186e565b634e487b7160e01b85526011600452602485fd5b60405162461bcd60e51b815260048101919091526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b6064820152608490fd5b508181813d8311611a33575b611a1881836125e2565b81010312610475575160ff811681036104755760ff90611950565b503d611a0e565b6040513d88823e3d90fd5b60405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b6044820152606490fd5b60405162461bcd60e51b815260206004820152601d60248201527f5f70726f746f636f6c5f6665652065786365656473206d6178696d756d0000006044820152606490fd5b60405162461bcd60e51b81526020600482015260146024820152735f6665652065786365656473206d6178696d756d60601b6044820152606490fd5b60405162461bcd60e51b81526020600482015260126024820152715f412065786365656473206d6178696d756d60701b6044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606490fd5b81356001600160a01b038116810361033b578152602091820191016117ca565b8280fd5b503461028257602036600319011261028257600435600381101561064657602090600b0154604051908152f35b503461033b57608036600319011261033b57611c2a36612604565b90611c33612976565b611c4260ff60185416156127e5565b60405191611c4f8361259e565b6060368437600e5460038102908082046003149015171561201357600493600f54611c786128fd565b6010546040516318160ddd60e01b81529760209189919082906001600160a01b03165afa968715611e04575f97611fdf575b505f91611cb5612695565b88611fca575b60405191611cc88361259e565b8151835260208201516020840152604082015160408401525f5b60038110611f315750611cf884610a5a85612e15565b9685881115611eec57878b15611ec057505f5b87878a60038410611e6c575050505050505090610a5a611d2a92612e15565b905b86611e51575050815b611d4360643582101561281a565b5f5b60038110611e0f57506010546001600160a01b0316803b1561033b576040516340c10f1960e01b815233600482015260248101839052905f908290604490829084905af18015611e0457611dc5575b50610b6f610b7d917f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d959697612762565b7f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d949550610b7d91611df9610b6f926125ce565b5f9695509150611d94565b6040513d5f823e3d90fd5b80611e1c60019287612730565b51611e28575b01611d45565b611e4c828060a01b03826008015416611e418389612730565b5190309033906129cc565b611e22565b610666611e6182611e6794612755565b8861276f565b611d35565b9187610ce687610ce087610cd981611e93611e9d998f839c610c8160019f61066693612730565b610c948289612730565b81600b0155611eaf610cff828b612730565b611eb98288612730565b5201611d0b565b9594505050505f5b60038110611ed7575050611d2c565b6001906020835193019281600b015501611ec8565b60405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606490fd5b8a15611f6b575b80611f5a611f4860019386612730565b51611f53838d612730565b5190612762565b611f648287612730565b5201611ce2565b611f75818a612730565b51611f385760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b6064820152608490fd5b9250611fd982610a5a85612e15565b92611cbb565b9096506020813d60201161200b575b81611ffb602093836125e2565b8101031261033b5751955f611caa565b3d9150611fee565b634e487b7160e01b5f52601160045260245ffd5b3461033b575f36600319011261033b576020601554604051908152f35b3461033b575f36600319011261033b5761205c6128a6565b60ff19601854166018557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b335f80a1005b3461033b5761209a36612646565b906120a36128a6565b601354620151809081810180911161201357421061224f574201804211612013576120d0908310156127a0565b6120d86128fd565b908015801580612243575b156121f057828210801591826121d2575b82156121a6575b5050156121615761215c7fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25493836011558260125542601355806014556040519384934291859094939260609260808301968352602083015260408201520152565b0390a1005b60405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606490fd5b909150816121b7575b5084806120fb565b6103e8838102925083830414171561201357821115846121af565b91506103e880850290858204148515171561201357831115916120f4565b60405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b6064820152608490fd5b50620f424082106120e3565b60405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b6044820152606490fd5b3461033b575f36600319011261033b576020604051620f42408152f35b3461033b575f36600319011261033b57602060ff60185460081c166040519015158152f35b3461033b57608036600319011261033b576122e236612604565b60643590811515820361033b576122f7612695565b6122ff6128fd565b9061230d82610a5a83612e15565b925f5b600381106123b9575050600491610a5a61232992612e15565b6010546040516318160ddd60e01b81529260209184919082906001600160a01b03165afa918215611e04575f92612382575b508291610666916102a0946020965f1461237857610ac491612755565b90610ac491612755565b909291506020813d6020116123b1575b8161239f602093836125e2565b8101031261033b57519091602061235b565b3d9150612392565b60019086156123ec576123da6123cf8285612730565b516114248387612730565b6123e48286612730565b525b01612310565b6123f9610d4c8285612730565b6124038286612730565b526123e6565b3461033b575f36600319011261033b57602060405160038152f35b3461033b575f36600319011261033b5761243c6128a6565b5f5b6003811061246c577fd04006881e5c4375ab3b8790e4a90e02de703ea619075d90fd37e50f290581805f80a1005b60088101546040516370a0823160e01b815230600482015291906020908190849060249082906001600160a01b03165afa908115611e04575f916124bb575b506001925081600b01550161243e565b905082813d83116124e3575b6124d181836125e2565b8101031261033b5760019151836124ab565b503d6124c7565b3461033b575f36600319011261033b576125026128a6565b5f6015557f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a15f80a1005b3461033b575f36600319011261033b576020601354604051908152f35b3461033b575f36600319011261033b576020600f54604051908152f35b3461033b575f36600319011261033b576020601454604051908152f35b3461033b575f36600319011261033b57806201518060209252f35b6060810190811067ffffffffffffffff8211176125ba57604052565b634e487b7160e01b5f52604160045260245ffd5b67ffffffffffffffff81116125ba57604052565b90601f8019910116810190811067ffffffffffffffff8211176125ba57604052565b806023121561033b576040519061261a8261259e565b8160649160641161033b576004905b8282106126365750505090565b8135815260209182019101612629565b604090600319011261033b576004359060243590565b606090600319011261033b57600435906024359060443590565b3461033b575f36600319011261033b5760206040516402540be4008152f35b60405190600b5f835b600382106126b4575050506126b28261259e565b565b600160208192855481520193019101909161269e565b6040519060055f835b600382106126e7575050506126b28261259e565b60016020819285548152019301910190916126d3565b6040519060025f835b6003821061271a575050506126b28261259e565b6001602081928554815201930191019091612706565b9060038110156127415760051b0190565b634e487b7160e01b5f52603260045260245ffd5b9190820391821161201357565b9190820180921161201357565b8181029291811591840414171561201357565b811561278c570490565b634e487b7160e01b5f52601260045260245ffd5b156127a757565b60405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606490fd5b156127ec57565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b1561282157565b60405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606490fd5b5f915b6003831061286d57505050565b600190825181526020809101920192019190612860565b9094939261289d60e0936105eb8461010081019961285d565b60c08201520152565b5f546001600160a01b031633036128b957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6014546012548142105f1461297157601154601354909182811115612953579261294a610e63926129446129348661295098612755565b61293e8342612755565b9061276f565b92612755565b90612782565b90565b9261294a61296b926129446129346129509787612755565b90612755565b905090565b600260015414612987576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a081019181831067ffffffffffffffff8411176125ba576126b292604052613057565b9190612a2f6128fd565b90600e54916003926003810290808204600314901517156120135760031c6004612a576126fd565b6010546040516318160ddd60e01b81529196919260209184919082906001600160a01b03165afa918215611e04575f92612ba3575b50612ab6612ab0612a9b612bd7565b93610666612aa98887612efb565b809c61276f565b89612755565b92612ac384848888613187565b98612adf612ad58b610d0a8a88612730565b610e94898b612730565b995f5b88858210612b2e5792505050612b0c95949250839150612b058161296b95612730565b5194613187565b5f19810190811161201357610e94612b279261295094612730565b8093612755565b90612b6b6402540be400612b6086868c868d60019982145f14612b7c5761143492610ce0611e61969361066693612730565b04610d0a838a612730565b612b758289612730565b5201612ae2565b92509261066661296b92610ce086612b97612b9e9888612730565b5196612730565b611e61565b9091506020813d602011612bcf575b81612bbf602093836125e2565b8101031261033b5751905f612a8c565b3d9150612bb2565b6060604051612be58161259e565b369037612bf06126ca565b905f5b60038110612bfe5750565b80670de0b6b3a7640000612c23612c1760019487612730565b5183600b01549061276f565b04612c2e8286612730565b5201612bf3565b9290918284141580612e0b575b80612e01575b15612dc857612c556128fd565b91612c608382612efb565b80955f93600393848702978789048614881517156120135791899493915f935b878510612d4d575050505050600991612c989161276f565b930290848204148415171561201357612cb7610e6391612cbe94612782565b9385612782565b90825f5b60ff8110612cd2575b5050505090565b84612ce684612ce1838061276f565b612762565b600191906001600160ff1b03821682036120135761294a8561143489612d0d95871b612762565b958681811115612d365790612d2191612755565b1115612d31576001905b01612cc2565b612ccb565b612d3f91612755565b1115612d3157600190612d2b565b919395509193968486145f14612d9e57612d728b612d6c868094612762565b9961276f565b8782029180830489149015171561201357600191612d8f91612782565b955b019290918a959492612c80565b858214612dbe57612d728b612d6c612db68987612730565b518094612762565b9694600190612d91565b60405162461bcd60e51b815260206004820152601160248201527024b63632b3b0b6103830b930b6b2ba32b960791b6044820152606490fd5b5060038310612c48565b5060038410612c42565b906060604051612e248161259e565b369037612e2f6126ca565b915f5b60038110612e3e575050565b80670de0b6b3a7640000612e62612e5760019488612730565b51610c818487612730565b04612e6d8287612730565b5201612e32565b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526126b291612eb06064836125e2565b613057565b5f80546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3565b905f905f5b6003811061303f575081156130385781926003928383029280840485149015171561201357925f198301838111915f5b60ff8110612f43575b5050505050505090565b875f5b838110612fed575088612f59898961276f565b90848302918383048614841517156120135781610ac48994612f7a93612762565b9161201357612f89908661276f565b906001600160fe1b03831683036120135761294a612fad9260019460021b90612762565b988981811115612fd65790612fc191612755565b1115612fd1576001905b01612f30565b612f39565b612fdf91612755565b1115612fd157600190612fcb565b969791989394959084612fff9161276f565b6130098883612730565b5190848202918083048614901517156120135760019161302891612782565b9701989197969095949398612f46565b5050505f90565b91613050600191611f538587612730565b9201612f00565b60018060a01b03166040516040810167ffffffffffffffff90828110828211176125ba576040525f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182875af13d1561317a573d9182116125ba576130ea93604051926130dd87601f19601f84011601856125e2565b83523d5f8785013e6132fa565b805182811591821561315a575b50509050156131035750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b838092935001031261033b57810151801515810361033b5780825f6130f7565b6130ea93606092506132fa565b906003808210156132be57845f9282850295858704841486151715612013578792915f915b858310613265575050506009916131c29161276f565b930290848204148415171561201357612cb7610e63916131e194612782565b90825f5b60ff81106131f4575050505090565b8461320384612ce1838061276f565b600191906001600160ff1b03821682036120135761294a856114348961322a95871b612762565b95868181111561324e579061323e91612755565b1115612d31576001905b016131e5565b61325791612755565b1115612d3157600190613248565b929591935091908284146132b45761328a89613284612db68786612730565b9761276f565b85820291808304871490151715612013576001916132a791612782565b935b0190918893926131ac565b94926001906132a9565b60405162461bcd60e51b81526020600482015260146024820152736465763a20692061626f7665204e5f434f494e5360601b6044820152606490fd5b9192901561335c575081511561330e575090565b3b156133175790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561336f5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401525f935b8285106133b3575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061339156fea2646970667358221220ff079f77ffc647c7c95c65c294f8bd760030244aa1f70807d1b7de9f9792929b64736f6c63430008170033a26469706673582212207b258ed5079620eb7a699516c8205daa06183ba4775ba0e31980e58b3a932b5f64736f6c63430008170033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.