编译器
0.8.19+commit.7dd6d404
文件 1 的 25:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 2 的 25:EnumerableSet.sol
pragma solidity ^0.8.0;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping(bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
set._values[toDeleteIndex] = lastValue;
set._indexes[lastValue] = valueIndex;
}
set._values.pop();
delete set._indexes[value];
return true;
} else {
return false;
}
}
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
struct Bytes32Set {
Set _inner;
}
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly {
result := store
}
return result;
}
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
文件 3 的 25:FixedPoint96.sol
pragma solidity >=0.4.0;
library FixedPoint96 {
uint8 internal constant RESOLUTION = 96;
uint256 internal constant Q96 = 0x1000000000000000000000000;
}
文件 4 的 25:FullMath.sol
pragma solidity ^0.8.0;
library FullMath {
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
require(denominator > prod1, "Math: mulDiv overflow");
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (~denominator + 1);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
}
文件 5 的 25:ICountryList.sol
pragma solidity 0.8.19;
interface ICountryList {
function countryIsValid (uint16 _countryCode) external view returns (bool);
}
文件 6 的 25:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
文件 7 的 25:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 8 的 25:IMigrateV3NFT.sol
pragma solidity 0.8.19;
import "./uniswap-updated/INonfungiblePositionManager.sol";
interface IMigrateV3NFT {
function migrate (uint256 lockId, INonfungiblePositionManager nftPositionManager, uint256 tokenId) external returns (bool);
}
文件 9 的 25:INonfungiblePositionManager.sol
pragma solidity ^0.8.9;
interface INonfungiblePositionManager {
function approve(address to, uint256 tokenId) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
struct MintParams {
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
address recipient;
uint256 deadline;
}
function mint(
MintParams calldata params
)
external
payable
returns (
uint256 tokenId,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
struct Position {
uint96 nonce;
address operator;
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint128 liquidity;
uint256 feeGrowthInside0LastX128;
uint256 feeGrowthInside1LastX128;
uint128 tokensOwed0;
uint128 tokensOwed1;
}
function positions(
uint256 tokenId
)
external
view
returns (
uint96 nonce,
address operator,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint128 liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
struct IncreaseLiquidityParams {
uint256 tokenId;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
struct DecreaseLiquidityParams {
uint256 tokenId;
uint128 liquidity;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
function decreaseLiquidity(DecreaseLiquidityParams calldata params)
external
payable
returns (uint256 amount0, uint256 amount1);
struct CollectParams {
uint256 tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}
function collect(
CollectParams calldata params
) external payable returns (uint256 amount0, uint256 amount1);
function factory() external view returns (address);
function burn(uint256 tokenId) external payable;
}
文件 10 的 25:IUNCX_ProofOfReservesUniV3.sol
pragma solidity 0.8.19;
import "./uniswap-updated/INonfungiblePositionManager.sol";
interface IUNCX_ProofOfReservesUniV3 {
struct FeeStruct {
string name;
uint256 lpFee;
uint256 collectFee;
uint256 flatFee;
address flatFeeToken;
}
struct Lock {
uint256 lock_id;
INonfungiblePositionManager nftPositionManager;
address pool;
uint256 nft_id;
address owner;
address pendingOwner;
address additionalCollector;
address collectAddress;
uint256 unlockDate;
uint16 countryCode;
uint256 ucf;
}
struct LockParams {
INonfungiblePositionManager nftPositionManager;
uint256 nft_id;
address dustRecipient;
address owner;
address additionalCollector;
address collectAddress;
uint256 unlockDate;
uint16 countryCode;
string feeName;
bytes[] r;
}
function lock (LockParams calldata params) external payable returns (uint256 lockId);
function collect (uint256 lockId, address recipient, uint128 amount0Max, uint128 amount1Max) external returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1);
function withdraw (uint256 lockId, address receiver) external;
function migrate (uint256 lockId) external;
function relock(uint256 lockId, uint256 unlockDate) external;
function setAdditionalCollector (uint256 lockId, address additionalCollector) external;
function setCollectAddress (uint256 lockId, address collectAddress) external;
function transferLockOwnership (uint256 lockId, address newOwner) external;
function acceptLockOwnership (uint256 lockId) external;
function decreaseLiquidity(uint256 lockId, INonfungiblePositionManager.DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
function increaseLiquidity(uint256 lockId, INonfungiblePositionManager.IncreaseLiquidityParams calldata params) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1);
function setMigrator(address migrator) external;
function setUCF(uint256 lockId, uint256 ucf) external;
function getLocksLength() external view returns (uint256);
function getLock(uint256 lockId) external view returns (Lock memory lock);
function getNumUserLocks(address user) external view returns (uint256 numLocks);
function getUserLockAtIndex(address user, uint256 index) external view returns (Lock memory lock);
function getFee (string memory name) external view returns (FeeStruct memory);
function getAmountsForLiquidity (int24 currentTick, int24 tickLower, int24 tickHigher, uint128 liquidity) external pure returns (uint256 amount0, uint256 amount1);
event onLock(
uint256 lock_id,
address nftPositionManager,
uint256 nft_id,
address owner,
address additionalCollector,
address collectAddress,
uint256 unlockDate,
uint16 countryCode,
uint256 collectFee,
address poolAddress,
INonfungiblePositionManager.Position position
);
event onWithdraw(uint256 lock_id, address owner, address receiver);
event onLockOwnershipTransferStarted(uint256 lockId, address currentOwner, address pendingOwner);
event onTransferLockOwnership(uint256 lockId, address oldOwner, address newOwner);
event onMigrate(uint256 lockId);
event onSetAdditionalCollector(uint256 lockId, address additionalCollector);
event onSetCollectAddress(uint256 lockId, address collectAddress);
event onSetMigrator(address migrator);
event onRelock(uint256 lockId, uint256 unlockDate);
event onIncreaseLiquidity(uint256 lockId);
event onDecreaseLiquidity(uint256 lockId);
event onRemoveFee(bytes32 nameHash);
event onAddFee(bytes32 nameHash, string name, uint256 lpFee, uint256 collectFee, uint256 flatFee, address flatFeeToken);
event onEditFee(bytes32 nameHash, string name, uint256 lpFee, uint256 collectFee, uint256 flatFee, address flatFeeToken);
event onSetUCF(uint256 lockId, uint256 ucf);
}
文件 11 的 25:IUniswapV3Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV3Factory {
event OwnerChanged(address indexed oldOwner, address indexed newOwner);
event PoolCreated(
address indexed token0,
address indexed token1,
uint24 indexed fee,
int24 tickSpacing,
address pool
);
event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);
function owner() external view returns (address);
function feeAmountTickSpacing(uint24 fee) external view returns (int24);
function getPool(
address tokenA,
address tokenB,
uint24 fee
) external view returns (address pool);
function createPool(
address tokenA,
address tokenB,
uint24 fee
) external returns (address pool);
function setOwner(address _owner) external;
function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}
文件 12 的 25:IUniswapV3Pool.sol
pragma solidity >=0.5.0;
import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';
interface IUniswapV3Pool is
IUniswapV3PoolImmutables,
IUniswapV3PoolState,
IUniswapV3PoolDerivedState,
IUniswapV3PoolActions,
IUniswapV3PoolOwnerActions,
IUniswapV3PoolEvents
{
}
文件 13 的 25:IUniswapV3PoolActions.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolActions {
function initialize(uint160 sqrtPriceX96) external;
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
function collect(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
function burn(
int24 tickLower,
int24 tickUpper,
uint128 amount
) external returns (uint256 amount0, uint256 amount1);
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
function flash(
address recipient,
uint256 amount0,
uint256 amount1,
bytes calldata data
) external;
function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}
文件 14 的 25:IUniswapV3PoolDerivedState.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolDerivedState {
function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external
view
returns (
int56 tickCumulativeInside,
uint160 secondsPerLiquidityInsideX128,
uint32 secondsInside
);
}
文件 15 的 25:IUniswapV3PoolEvents.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolEvents {
event Initialize(uint160 sqrtPriceX96, int24 tick);
event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
event Collect(
address indexed owner,
address recipient,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount0,
uint128 amount1
);
event Burn(
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
event Swap(
address indexed sender,
address indexed recipient,
int256 amount0,
int256 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick
);
event Flash(
address indexed sender,
address indexed recipient,
uint256 amount0,
uint256 amount1,
uint256 paid0,
uint256 paid1
);
event IncreaseObservationCardinalityNext(
uint16 observationCardinalityNextOld,
uint16 observationCardinalityNextNew
);
event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}
文件 16 的 25:IUniswapV3PoolImmutables.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolImmutables {
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function fee() external view returns (uint24);
function tickSpacing() external view returns (int24);
function maxLiquidityPerTick() external view returns (uint128);
}
文件 17 的 25:IUniswapV3PoolOwnerActions.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolOwnerActions {
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;
function collectProtocol(
address recipient,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
}
文件 18 的 25:IUniswapV3PoolState.sol
pragma solidity >=0.5.0;
interface IUniswapV3PoolState {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
function feeGrowthGlobal0X128() external view returns (uint256);
function feeGrowthGlobal1X128() external view returns (uint256);
function protocolFees() external view returns (uint128 token0, uint128 token1);
function liquidity() external view returns (uint128);
function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside0X128,
uint256 feeGrowthOutside1X128,
int56 tickCumulativeOutside,
uint160 secondsPerLiquidityOutsideX128,
uint32 secondsOutside,
bool initialized
);
function tickBitmap(int16 wordPosition) external view returns (uint256);
function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
function observations(uint256 index)
external
view
returns (
uint32 blockTimestamp,
int56 tickCumulative,
uint160 secondsPerLiquidityCumulativeX128,
bool initialized
);
}
文件 19 的 25:LiquidityAmounts.sol
pragma solidity >=0.5.0;
import {FullMath} from "./FullMath.sol";
import '@uniswap/v3-core/contracts/libraries/FixedPoint96.sol';
library LiquidityAmounts {
function toUint128(uint256 x) private pure returns (uint128 y) {
require((y = uint128(x)) == x);
}
function getLiquidityForAmount0(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint256 amount0
) internal pure returns (uint128 liquidity) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);
return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));
}
function getLiquidityForAmount1(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint256 amount1
) internal pure returns (uint128 liquidity) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));
}
function getLiquidityForAmounts(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint256 amount0,
uint256 amount1
) internal pure returns (uint128 liquidity) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
if (sqrtRatioX96 <= sqrtRatioAX96) {
liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);
} else if (sqrtRatioX96 < sqrtRatioBX96) {
uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);
uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);
liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;
} else {
liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);
}
}
function getAmount0ForLiquidity(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity
) internal pure returns (uint256 amount0) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
return
FullMath.mulDiv(
uint256(liquidity) << FixedPoint96.RESOLUTION,
sqrtRatioBX96 - sqrtRatioAX96,
sqrtRatioBX96
) / sqrtRatioAX96;
}
function getAmount1ForLiquidity(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity
) internal pure returns (uint256 amount1) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);
}
function getAmountsForLiquidity(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity
) internal pure returns (uint256 amount0, uint256 amount1) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
if (sqrtRatioX96 <= sqrtRatioAX96) {
amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);
} else if (sqrtRatioX96 < sqrtRatioBX96) {
amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);
amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);
} else {
amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);
}
}
}
文件 20 的 25:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 21 的 25:Ownable2Step.sol
pragma solidity ^0.8.0;
import "./Ownable.sol";
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
function acceptOwnership() external {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}
文件 22 的 25:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
}
文件 23 的 25:TickMath.sol
pragma solidity ^0.8.9;
library TickMath {
int24 internal constant MIN_TICK = -887272;
int24 internal constant MAX_TICK = -MIN_TICK;
uint160 internal constant MIN_SQRT_RATIO = 4295128739;
uint160 internal constant MAX_SQRT_RATIO =
1461446703485210103287273052203988822378723970342;
function getSqrtRatioAtTick(int24 tick)
internal
pure
returns (uint160 sqrtPriceX96)
{
uint256 absTick =
tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
require(absTick <= uint256(int256(MAX_TICK)), "T");
uint256 ratio =
absTick & 0x1 != 0
? 0xfffcb933bd6fad37aa2d162d1a594001
: 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0)
ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0)
ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
if (absTick & 0x8 != 0)
ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
if (absTick & 0x10 != 0)
ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
if (absTick & 0x20 != 0)
ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
if (absTick & 0x40 != 0)
ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
if (absTick & 0x80 != 0)
ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
if (absTick & 0x100 != 0)
ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
if (absTick & 0x200 != 0)
ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
if (absTick & 0x400 != 0)
ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
if (absTick & 0x800 != 0)
ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
if (absTick & 0x1000 != 0)
ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
if (absTick & 0x2000 != 0)
ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
if (absTick & 0x4000 != 0)
ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
if (absTick & 0x8000 != 0)
ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
if (absTick & 0x10000 != 0)
ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
if (absTick & 0x20000 != 0)
ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
if (absTick & 0x40000 != 0)
ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
if (absTick & 0x80000 != 0)
ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;
if (tick > 0) ratio = type(uint256).max / ratio;
sqrtPriceX96 = uint160(
(ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)
);
}
function getTickAtSqrtRatio(uint160 sqrtPriceX96)
internal
pure
returns (int24 tick)
{
require(
sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO,
"R"
);
uint256 ratio = uint256(sqrtPriceX96) << 32;
uint256 r = ratio;
uint256 msb = 0;
assembly {
let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(5, gt(r, 0xFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(4, gt(r, 0xFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(3, gt(r, 0xFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(2, gt(r, 0xF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(1, gt(r, 0x3))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := gt(r, 0x1)
msb := or(msb, f)
}
if (msb >= 128) r = ratio >> (msb - 127);
else r = ratio << (127 - msb);
int256 log_2 = (int256(msb) - 128) << 64;
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(63, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(62, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(61, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(60, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(59, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(58, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(57, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(56, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(55, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(54, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(53, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(52, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(51, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(50, f))
}
int256 log_sqrt10001 = log_2 * 255738958999603826347141;
int24 tickLow =
int24(
(log_sqrt10001 - 3402992956809132418596140100660247210) >> 128
);
int24 tickHi =
int24(
(log_sqrt10001 + 291339464771989622907027621153398088495) >> 128
);
tick = tickLow == tickHi
? tickLow
: getSqrtRatioAtTick(tickHi) <= sqrtPriceX96
? tickHi
: tickLow;
}
}
文件 24 的 25:TransferHelper.sol
pragma solidity >=0.6.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
library TransferHelper {
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
}
function safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'STE');
}
}
文件 25 的 25:UNCX_ProofOfReservesUniV3.sol
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import './uniswap-updated/TickMath.sol';
import './uniswap-updated/LiquidityAmounts.sol';
import "./uniswap-updated/INonfungiblePositionManager.sol";
import "./ICountryList.sol";
import "./IMigrateV3NFT.sol";
import "./IUNCX_ProofOfReservesUniV3.sol";
interface IFeeResolver {
function useFee(bytes[] memory r, address sender) external returns (IUNCX_ProofOfReservesUniV3.FeeStruct memory fee);
}
contract UNCX_ProofOfReservesUniV3 is IUNCX_ProofOfReservesUniV3, Ownable2Step, IERC721Receiver, ReentrancyGuard {
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableSet for EnumerableSet.Bytes32Set;
mapping(bytes32 => FeeStruct) private FEES;
EnumerableSet.Bytes32Set private FEE_LOOKUP;
IFeeResolver public FEE_RESOLVER;
address public AUTO_COLLECT_ACCOUNT;
address payable public FEE_ADDR_LP;
address payable public FEE_ADDR_COLLECT;
uint256 public constant FEE_DENOMINATOR = 10000;
ICountryList public COUNTRY_LIST;
IMigrateV3NFT public MIGRATOR;
uint256 public NONCE = 0;
uint256 public ETERNAL_LOCK = type(uint256).max;
mapping(uint256 => Lock) public LOCKS;
mapping(address => EnumerableSet.UintSet) USER_LOCKS;
constructor(ICountryList _countryList, address payable _autoCollectAddress, address payable _lpFeeReceiver, address payable _collectFeeReceiver) {
COUNTRY_LIST = _countryList;
AUTO_COLLECT_ACCOUNT = _autoCollectAddress;
FEE_ADDR_LP = _lpFeeReceiver;
FEE_ADDR_COLLECT = _collectFeeReceiver;
addOrEditFee("DEFAULT", 50, 200, 0, address(0));
addOrEditFee("LVP", 80, 100, 0, address(0));
addOrEditFee("LLP", 30, 350, 0, address(0));
}
function setFeeResolver (IFeeResolver _resolver) external onlyOwner {
FEE_RESOLVER = _resolver;
}
function setFeeParams (address _autoCollectAccount, address payable _lpFeeReceiver, address payable _collectFeeReceiver) external onlyOwner {
AUTO_COLLECT_ACCOUNT = _autoCollectAccount;
FEE_ADDR_LP = _lpFeeReceiver;
FEE_ADDR_COLLECT = _collectFeeReceiver;
}
function addOrEditFee(string memory _name, uint256 _lpFee, uint256 _collectFee, uint256 _flatFee, address _flatFeeToken) public onlyOwner {
bytes32 nameHash = keccak256(abi.encodePacked(_name));
FeeStruct memory newFee = FeeStruct(_name, _lpFee, _collectFee, _flatFee, _flatFeeToken);
FEES[nameHash] = newFee;
if (!FEE_LOOKUP.contains(nameHash)) {
FEE_LOOKUP.add(nameHash);
emit onAddFee(nameHash, newFee.name, newFee.lpFee, newFee.collectFee, newFee.flatFee, newFee.flatFeeToken);
} else {
emit onEditFee(nameHash, newFee.name, newFee.lpFee, newFee.collectFee, newFee.flatFee, newFee.flatFeeToken);
}
}
function removeFee (string memory _name) external onlyOwner {
bytes32 nameHash = keccak256(abi.encodePacked(_name));
require(nameHash != keccak256(abi.encodePacked("DEFAULT")), "DEFAULT");
require(FEE_LOOKUP.contains(nameHash));
FEE_LOOKUP.remove(nameHash);
emit onRemoveFee(nameHash);
}
function getFee (string memory _name) public override view returns (FeeStruct memory) {
bytes32 feeHash = keccak256(abi.encodePacked(_name));
require(FEE_LOOKUP.contains(feeHash), "NOT FOUND");
return FEES[feeHash];
}
function getFeeOptionAtIndex (uint256 _index) external view returns (FeeStruct memory) {
return FEES[FEE_LOOKUP.at(_index)];
}
function getFeeOptionLength () external view returns (uint256) {
return FEE_LOOKUP.length();
}
function deductFlatFee (FeeStruct memory fee) private {
if (fee.flatFeeToken == address(0)) {
require(msg.value == fee.flatFee, 'FLAT FEE');
FEE_ADDR_LP.transfer(fee.flatFee);
} else {
TransferHelper.safeTransferFrom(fee.flatFeeToken, msg.sender, FEE_ADDR_LP, fee.flatFee);
}
}
function lock (LockParams calldata params) external payable override nonReentrant returns (uint256) {
require(params.owner != address(0));
require(params.collectAddress != address(0), 'COLLECT_ADDR');
require(params.unlockDate < 1e10 || params.unlockDate == ETERNAL_LOCK, 'MILLISECONDS');
require(params.unlockDate > block.timestamp, 'DATE PASSED');
require(COUNTRY_LIST.countryIsValid(params.countryCode), 'COUNTRY');
FeeStruct memory fee;
if (params.r.length > 0) {
fee = FEE_RESOLVER.useFee(params.r, msg.sender);
} else {
fee = getFee(params.feeName);
}
if (fee.flatFee > 0) {
deductFlatFee(fee);
}
params.nftPositionManager.safeTransferFrom(msg.sender, address(this), params.nft_id);
INonfungiblePositionManager.Position memory position;
(,,position.token0,position.token1,position.fee,position.tickLower,position.tickUpper,position.liquidity,,,,) = params.nftPositionManager.positions(params.nft_id);
IUniswapV3Factory factory = IUniswapV3Factory(params.nftPositionManager.factory());
address pool = factory.getPool(position.token0, position.token1, position.fee);
int24 maxTick = tickSpacingToMaxTick(factory.feeAmountTickSpacing(position.fee));
uint256 nftId;
if (position.tickLower != -maxTick && position.tickUpper != maxTick) {
nftId = _convertPositionToFullRange(params.nftPositionManager, params.nft_id, position, maxTick, params.dustRecipient);
} else {
nftId = params.nft_id;
params.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(nftId, params.dustRecipient, type(uint128).max, type(uint128).max));
}
if (fee.lpFee > 0) {
uint128 liquidity = _getLiquidity(params.nftPositionManager, nftId);
params.nftPositionManager.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams(nftId, uint128(liquidity * fee.lpFee / FEE_DENOMINATOR), 0, 0, block.timestamp));
params.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(nftId, FEE_ADDR_LP, type(uint128).max, type(uint128).max));
}
Lock memory newLock;
newLock.lock_id = NONCE;
newLock.nftPositionManager = params.nftPositionManager;
newLock.pool = pool;
newLock.nft_id = nftId;
newLock.owner = params.owner;
newLock.additionalCollector = params.additionalCollector;
newLock.collectAddress = params.collectAddress;
newLock.unlockDate = params.unlockDate;
newLock.countryCode = params.countryCode;
newLock.ucf = fee.collectFee;
LOCKS[NONCE] = newLock;
USER_LOCKS[params.owner].add(NONCE);
NONCE++;
emitLockEvent(newLock.lock_id);
return newLock.lock_id;
}
function emitLockEvent (uint256 _lockId) private {
Lock memory newLock = LOCKS[_lockId];
INonfungiblePositionManager.Position memory position;
(,,position.token0,position.token1,position.fee,position.tickLower,position.tickUpper,position.liquidity,,,,) = newLock.nftPositionManager.positions(newLock.nft_id);
emit onLock(
newLock.lock_id,
address(newLock.nftPositionManager),
newLock.nft_id,
newLock.owner,
newLock.additionalCollector,
newLock.collectAddress,
newLock.unlockDate,
newLock.countryCode,
newLock.ucf,
newLock.pool,
position
);
}
function _convertPositionToFullRange (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId, INonfungiblePositionManager.Position memory _position, int24 _maxTick, address _dustRecipient) private returns (uint256) {
_nftPositionManager.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams(_tokenId, _position.liquidity, 0, 0, block.timestamp));
_nftPositionManager.collect(INonfungiblePositionManager.CollectParams(_tokenId, address(this), type(uint128).max, type(uint128).max));
INonfungiblePositionManager.MintParams memory mintParams = _setPartialMintParamsFromPosition(_nftPositionManager, _tokenId);
mintParams.deadline = block.timestamp;
mintParams.recipient = address(this);
mintParams.tickLower = -_maxTick;
mintParams.tickUpper = _maxTick;
mintParams.amount0Desired = IERC20(mintParams.token0).balanceOf(address(this));
mintParams.amount1Desired = IERC20(mintParams.token1).balanceOf(address(this));
mintParams.amount0Min = 0;
mintParams.amount1Min = 0;
TransferHelper.safeApprove(mintParams.token0, address(_nftPositionManager), mintParams.amount0Desired);
TransferHelper.safeApprove(mintParams.token1, address(_nftPositionManager), mintParams.amount1Desired);
(uint256 newNftId,,,) = _nftPositionManager.mint(mintParams);
_nftPositionManager.burn(_tokenId);
uint256 balance0 = IERC20(mintParams.token0).balanceOf(address(this));
uint256 balance1 = IERC20(mintParams.token1).balanceOf(address(this));
if (balance0 > 0) {
TransferHelper.safeTransfer(mintParams.token0, _dustRecipient, balance0);
}
if (balance1 > 0) {
TransferHelper.safeTransfer(mintParams.token1, _dustRecipient, balance1);
}
return newNftId;
}
function collect (uint256 _lockId, address _recipient, uint128 _amount0Max, uint128 _amount1Max) external override nonReentrant returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) {
(amount0, amount1, fee0, fee1) = _collect(_lockId, _recipient, _amount0Max, _amount1Max);
}
function _collect (uint256 _lockId, address _recipient, uint128 _amount0Max, uint128 _amount1Max) private returns(uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) {
Lock memory userLock = LOCKS[_lockId];
bool collectorIsBot = AUTO_COLLECT_ACCOUNT == msg.sender;
require(userLock.owner == msg.sender || userLock.additionalCollector == msg.sender || collectorIsBot, "OWNER");
if (userLock.ucf == 0) {
(amount0, amount1) = userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, _recipient, _amount0Max, _amount1Max));
} else {
(,,address _token0,address _token1,,,,,,,,) = userLock.nftPositionManager.positions(userLock.nft_id);
userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, address(this), _amount0Max, _amount1Max));
uint256 balance0 = IERC20(_token0).balanceOf(address(this));
uint256 balance1 = IERC20(_token1).balanceOf(address(this));
address feeTo = collectorIsBot ? _recipient : FEE_ADDR_COLLECT;
address remainderTo = collectorIsBot ? userLock.collectAddress : _recipient;
if (balance0 > 0) {
fee0 = balance0 * userLock.ucf / FEE_DENOMINATOR;
TransferHelper.safeTransfer(_token0, feeTo, fee0);
amount0 = balance0 - fee0;
TransferHelper.safeTransfer(_token0, remainderTo, amount0);
}
if (balance1 > 0) {
fee1 = balance1 * userLock.ucf / FEE_DENOMINATOR;
TransferHelper.safeTransfer(_token1, feeTo, fee1);
amount1 = balance1 - fee1;
TransferHelper.safeTransfer(_token1, remainderTo, amount1);
}
}
}
function increaseLiquidity(uint256 _lockId, INonfungiblePositionManager.IncreaseLiquidityParams calldata params) external payable override nonReentrant returns (uint128 liquidity, uint256 amount0, uint256 amount1) {
Lock memory userLock = LOCKS[_lockId];
require(userLock.nft_id == params.tokenId, "NFT ID");
(,,address token0,address token1,,,,,,,,) = userLock.nftPositionManager.positions(userLock.nft_id);
TransferHelper.safeTransferFrom(token0, msg.sender, address(this), params.amount0Desired);
TransferHelper.safeTransferFrom(token1, msg.sender, address(this), params.amount1Desired);
TransferHelper.safeApprove(token0, address(userLock.nftPositionManager), params.amount0Desired);
TransferHelper.safeApprove(token1, address(userLock.nftPositionManager), params.amount1Desired);
(liquidity, amount0, amount1) = userLock.nftPositionManager.increaseLiquidity(params);
emit onIncreaseLiquidity(_lockId);
}
function decreaseLiquidity(uint256 _lockId, INonfungiblePositionManager.DecreaseLiquidityParams calldata params) external payable override nonReentrant returns (uint256 amount0, uint256 amount1) {
isLockAdmin(_lockId);
Lock memory userLock = LOCKS[_lockId];
if (userLock.unlockDate == ETERNAL_LOCK) {
revert('ETERNAL_LOCK');
} else {
require(userLock.unlockDate < block.timestamp, 'NOT YET');
}
(amount0, amount1) = userLock.nftPositionManager.decreaseLiquidity(params);
userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, msg.sender, type(uint128).max, type(uint128).max));
emit onDecreaseLiquidity(_lockId);
}
function relock(uint256 _lockId, uint256 _unlockDate) external override nonReentrant {
isLockAdmin(_lockId);
Lock storage userLock = LOCKS[_lockId];
require(_unlockDate > userLock.unlockDate, 'DATE');
require(_unlockDate > block.timestamp, 'DATE PASSED');
require(_unlockDate < 1e10 || _unlockDate == ETERNAL_LOCK, 'MILLISECONDS');
userLock.unlockDate = _unlockDate;
emit onRelock(_lockId, userLock.unlockDate);
}
function withdraw (uint256 _lockId, address _receiver) external override nonReentrant {
isLockAdmin(_lockId);
Lock memory userLock = LOCKS[_lockId];
if (userLock.unlockDate == ETERNAL_LOCK) {
revert('ETERNAL_LOCK');
} else {
require(userLock.unlockDate < block.timestamp, 'NOT YET');
}
if (userLock.ucf > 0) {
_collect(_lockId, _receiver, type(uint128).max, type(uint128).max);
}
userLock.nftPositionManager.safeTransferFrom(address(this), _receiver, userLock.nft_id);
USER_LOCKS[userLock.owner].remove(_lockId);
emit onWithdraw(_lockId, userLock.owner, _receiver);
delete LOCKS[_lockId];
}
function migrate (uint256 _lockId) external override nonReentrant {
require(address(MIGRATOR) != address(0), "NOT SET");
isLockAdmin(_lockId);
Lock memory userLock = LOCKS[_lockId];
userLock.nftPositionManager.approve(address(MIGRATOR), userLock.nft_id);
MIGRATOR.migrate(_lockId, userLock.nftPositionManager, userLock.nft_id);
USER_LOCKS[userLock.owner].remove(_lockId);
delete LOCKS[_lockId];
emit onMigrate(_lockId);
}
function setAdditionalCollector (uint256 _lockId, address _additionalCollector) external override nonReentrant {
isLockAdmin(_lockId);
Lock storage userLock = LOCKS[_lockId];
userLock.additionalCollector = _additionalCollector;
emit onSetAdditionalCollector(_lockId, _additionalCollector);
}
function setCollectAddress (uint256 _lockId, address _collectAddress) external override nonReentrant {
isLockAdmin(_lockId);
require(_collectAddress != address(0), 'COLLECT_ADDR');
Lock storage userLock = LOCKS[_lockId];
userLock.collectAddress = _collectAddress;
emit onSetCollectAddress(_lockId, _collectAddress);
}
function transferLockOwnership (uint256 _lockId, address _newOwner) external override nonReentrant {
isLockAdmin(_lockId);
require(msg.sender != _newOwner, "SAME OWNER");
Lock storage userLock = LOCKS[_lockId];
userLock.pendingOwner = _newOwner;
emit onLockOwnershipTransferStarted(_lockId, msg.sender, _newOwner);
}
function acceptLockOwnership (uint256 _lockId) external override nonReentrant {
Lock storage userLock = LOCKS[_lockId];
require(userLock.pendingOwner == msg.sender, "OWNER");
address oldOwner = userLock.owner;
USER_LOCKS[userLock.owner].remove(_lockId);
userLock.owner = msg.sender;
userLock.pendingOwner = address(0);
USER_LOCKS[msg.sender].add(_lockId);
emit onTransferLockOwnership(_lockId, oldOwner, msg.sender);
}
function setMigrator(address _migrator) external override onlyOwner {
MIGRATOR = IMigrateV3NFT(_migrator);
emit onSetMigrator(_migrator);
}
function setUCF(uint256 _lockId, uint256 _ucf) external override onlyOwner {
Lock storage l = LOCKS[_lockId];
require(_ucf < l.ucf, "L");
l.ucf = _ucf;
emit onSetUCF(_lockId, _ucf);
}
function isLockAdmin (uint256 _lockId) private view {
Lock memory userLock = LOCKS[_lockId];
require(userLock.owner == msg.sender, "OWNER");
}
function getLock(uint256 _lockId) external view override returns (Lock memory _lock) {
_lock = LOCKS[_lockId];
}
function getLocksLength() external view override returns (uint256) {
return NONCE;
}
function getNumUserLocks(address _user) external view override returns (uint256) {
return USER_LOCKS[_user].length();
}
function getUserLockAtIndex(address _user, uint256 _index) external view override returns (Lock memory) {
return LOCKS[USER_LOCKS[_user].at(_index)];
}
function tickSpacingToMaxTick(int24 tickSpacing) public pure returns (int24 maxTick) {
maxTick = (887272 / tickSpacing) * tickSpacing;
}
function _setPartialMintParamsFromPosition (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId) private view returns (INonfungiblePositionManager.MintParams memory) {
INonfungiblePositionManager.MintParams memory m;
(,,m.token0,m.token1,m.fee,,,,,,,) = _nftPositionManager.positions(_tokenId);
return m;
}
function getAmountsForLiquidity (int24 currentTick, int24 tickLower, int24 tickHigher, uint128 liquidity) public pure override returns (uint256 amount0, uint256 amount1) {
return LiquidityAmounts.getAmountsForLiquidity(
TickMath.getSqrtRatioAtTick(currentTick),
TickMath.getSqrtRatioAtTick(tickLower),
TickMath.getSqrtRatioAtTick(tickHigher),
liquidity
);
}
function _getLiquidity (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId) private view returns (uint128) {
(,,,,,,,uint128 liquidity,,,,) = _nftPositionManager.positions(_tokenId);
return liquidity;
}
function adminRefundEth (uint256 _amount, address payable _receiver) external onlyOwner nonReentrant {
_receiver.transfer(_amount);
}
function adminRefundERC20 (address _token, address _receiver, uint256 _amount) external onlyOwner nonReentrant {
TransferHelper.safeTransfer(_token, _receiver, _amount);
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) public pure override returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
}
{
"compilationTarget": {
"contracts/UNCX_ProofOfReservesUniV3.sol": "UNCX_ProofOfReservesUniV3"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": []
}
[{"inputs":[{"internalType":"contract ICountryList","name":"_countryList","type":"address"},{"internalType":"address payable","name":"_autoCollectAddress","type":"address"},{"internalType":"address payable","name":"_lpFeeReceiver","type":"address"},{"internalType":"address payable","name":"_collectFeeReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"lpFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"flatFeeToken","type":"address"}],"name":"onAddFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onDecreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"lpFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"flatFeeToken","type":"address"}],"name":"onEditFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onIncreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lock_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"nftPositionManager","type":"address"},{"indexed":false,"internalType":"uint256","name":"nft_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"additionalCollector","type":"address"},{"indexed":false,"internalType":"address","name":"collectAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"unlockDate","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"countryCode","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"poolAddress","type":"address"},{"components":[{"internalType":"uint96","name":"nonce","type":"uint96"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"indexed":false,"internalType":"struct INonfungiblePositionManager.Position","name":"position","type":"tuple"}],"name":"onLock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"currentOwner","type":"address"},{"indexed":false,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"onLockOwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onMigrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockDate","type":"uint256"}],"name":"onRelock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"}],"name":"onRemoveFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"additionalCollector","type":"address"}],"name":"onSetAdditionalCollector","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collectAddress","type":"address"}],"name":"onSetCollectAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"migrator","type":"address"}],"name":"onSetMigrator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ucf","type":"uint256"}],"name":"onSetUCF","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"onTransferLockOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lock_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"onWithdraw","type":"event"},{"inputs":[],"name":"AUTO_COLLECT_ACCOUNT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COUNTRY_LIST","outputs":[{"internalType":"contract ICountryList","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETERNAL_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_ADDR_COLLECT","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_ADDR_LP","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RESOLVER","outputs":[{"internalType":"contract IFeeResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"LOCKS","outputs":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIGRATOR","outputs":[{"internalType":"contract IMigrateV3NFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NONCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"acceptLockOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_lpFee","type":"uint256"},{"internalType":"uint256","name":"_collectFee","type":"uint256"},{"internalType":"uint256","name":"_flatFee","type":"uint256"},{"internalType":"address","name":"_flatFeeToken","type":"address"}],"name":"addOrEditFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"adminRefundERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"adminRefundEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint128","name":"_amount0Max","type":"uint128"},{"internalType":"uint128","name":"_amount1Max","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"fee0","type":"uint256"},{"internalType":"uint256","name":"fee1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.DecreaseLiquidityParams","name":"params","type":"tuple"}],"name":"decreaseLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int24","name":"currentTick","type":"int24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickHigher","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"getAmountsForLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"getFee","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"collectFee","type":"uint256"},{"internalType":"uint256","name":"flatFee","type":"uint256"},{"internalType":"address","name":"flatFeeToken","type":"address"}],"internalType":"struct IUNCX_ProofOfReservesUniV3.FeeStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getFeeOptionAtIndex","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"collectFee","type":"uint256"},{"internalType":"uint256","name":"flatFee","type":"uint256"},{"internalType":"address","name":"flatFeeToken","type":"address"}],"internalType":"struct IUNCX_ProofOfReservesUniV3.FeeStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeOptionLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"getLock","outputs":[{"components":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"internalType":"struct IUNCX_ProofOfReservesUniV3.Lock","name":"_lock","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocksLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getNumUserLocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getUserLockAtIndex","outputs":[{"components":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"internalType":"struct IUNCX_ProofOfReservesUniV3.Lock","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"dustRecipient","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"string","name":"feeName","type":"string"},{"internalType":"bytes[]","name":"r","type":"bytes[]"}],"internalType":"struct IUNCX_ProofOfReservesUniV3.LockParams","name":"params","type":"tuple"}],"name":"lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_unlockDate","type":"uint256"}],"name":"relock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"removeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_additionalCollector","type":"address"}],"name":"setAdditionalCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_collectAddress","type":"address"}],"name":"setCollectAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_autoCollectAccount","type":"address"},{"internalType":"address payable","name":"_lpFeeReceiver","type":"address"},{"internalType":"address payable","name":"_collectFeeReceiver","type":"address"}],"name":"setFeeParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFeeResolver","name":"_resolver","type":"address"}],"name":"setFeeResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_migrator","type":"address"}],"name":"setMigrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_ucf","type":"uint256"}],"name":"setUCF","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"tickSpacingToMaxTick","outputs":[{"internalType":"int24","name":"maxTick","type":"int24"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferLockOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]