Address Contract Verified
Address
0x9b720eefcCFFf4C70E3158BEe7550BA55e8a6350
Balance
0 ETH
Nonce
1
Code Size
2691 bytes
Creator
0x68C2a3F0...75D9 at tx 0x4d1de497...0fafe6
Indexed Transactions
0
Contract Bytecode
2691 bytes
0x6080604052600436106100c65760003560e01c8063b44a27221161007f578063ddca3f4311610059578063ddca3f431461027f578063e5225381146102c7578063e78a432f146102dc578063f2fde38b146102fc57600080fd5b8063b44a2722146101e3578063c31c9c0714610217578063d5f394881461024b57600080fd5b806317d70f7c146100d25780631fbe1979146101195780635739637314610130578063715018a61461017c5780638da5cb5b14610191578063ad5c4648146101af57600080fd5b366100cd57005b600080fd5b3480156100de57600080fd5b506101067f00000000000000000000000000000000000000000000000000000000000cd96e81565b6040519081526020015b60405180910390f35b34801561012557600080fd5b5061012e61031c565b005b34801561013c57600080fd5b506101647f00000000000000000000000035c8941c294e9d60e0742cb9f3d58c0d1ba2dec481565b6040516001600160a01b039091168152602001610110565b34801561018857600080fd5b5061012e6103e0565b34801561019d57600080fd5b506000546001600160a01b0316610164565b3480156101bb57600080fd5b506101647f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156101ef57600080fd5b506101647f000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe8881565b34801561022357600080fd5b506101647f000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156481565b34801561025757600080fd5b506101647f00000000000000000000000068c2a3f04a4e5f84f90e2879ce1f385e64b775d981565b34801561028b57600080fd5b506102b37f000000000000000000000000000000000000000000000000000000000000271081565b60405162ffffff9091168152602001610110565b3480156102d357600080fd5b5061012e6103f4565b3480156102e857600080fd5b5061012e6102f7366004610944565b610478565b34801561030857600080fd5b5061012e610317366004610976565b61088c565b336001600160a01b037f00000000000000000000000068c2a3f04a4e5f84f90e2879ce1f385e64b775d916146103885760405162461bcd60e51b815260206004820152600c60248201526b1d5b985d5d1a1bdc9a5e995960a21b60448201526064015b60405180910390fd5b6040516001600160a01b037f00000000000000000000000068c2a3f04a4e5f84f90e2879ce1f385e64b775d916904780156108fc02916000818181858888f193505050501580156103dd573d6000803e3d6000fd5b50565b6103e86108c7565b6103f260006108f4565b565b6103fc6108c7565b60405163ce3f865f60e01b81527f00000000000000000000000035c8941c294e9d60e0742cb9f3d58c0d1ba2dec46001600160a01b0316803160048301529063ce3f865f90602401600060405180830381600087803b15801561045e57600080fd5b505af1158015610472573d6000803e3d6000fd5b50505050565b6104806108c7565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000035c8941c294e9d60e0742cb9f3d58c0d1ba2dec46001600160a01b0316906370a0823190602401602060405180830381865afa1580156104e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050b91906109a6565b9050818111156105185750805b60408051610100810182527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0390811682527f00000000000000000000000035c8941c294e9d60e0742cb9f3d58c0d1ba2dec481166020830190815262ffffff7f000000000000000000000000000000000000000000000000000000000000271081168486019081523060608601908152426080870190815260a087018d815260c088018d8152600060e08a018181529a5163414bf38960e01b81529951891660048b01529651881660248a015293519094166044880152905185166064870152516084860152905160a48501525160c48401529251811660e48301527f000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564169063414bf3899088906101040160206040518083038185885af1158015610669573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061068e91906109a6565b905047600061069d84846109d5565b90506000806106ac88866109ee565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03167f00000000000000000000000035c8941c294e9d60e0742cb9f3d58c0d1ba2dec46001600160a01b0316101561070d57919291905b6040805160c0810182527f00000000000000000000000000000000000000000000000000000000000cd96e81526020810186815281830186815260608301868152608084018681524260a08601908152955163219f5d1760e01b8152945160048601529251602485015290516044840152516064830152516084820152905160a48201526001600160a01b037f000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88169063219f5d1790479060c40160606040518083038185885af11580156107e5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061080a9190610a01565b5050507f000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561086857600080fd5b505af115801561087c573d6000803e3d6000fd5b5050505050505050505050505050565b6108946108c7565b6001600160a01b0381166108be57604051631e4fbdf760e01b81526000600482015260240161037f565b6103dd816108f4565b6000546001600160a01b031633146103f25760405163118cdaa760e01b815233600482015260240161037f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000806080858703121561095a57600080fd5b5050823594602084013594506040840135936060013592509050565b60006020828403121561098857600080fd5b81356001600160a01b038116811461099f57600080fd5b9392505050565b6000602082840312156109b857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156109e8576109e86109bf565b92915050565b818103818111156109e8576109e86109bf565b600080600060608486031215610a1657600080fd5b83516fffffffffffffffffffffffffffffffff81168114610a3657600080fd5b60208501516040909501519096949550939250505056fea2646970667358221220ac92ee57e28fa22d7a6e11dc35f34db3bdd495610d7ff2b76055f1a42d94401f64736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Optimization: Yes (200 runs)
FeeCollector.sol 114 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/interfaces/IERC20.sol";
import "./interfaces/IEthCoin.sol";
import "./interfaces/uniswap-v3-periphery/INonfungiblePositionManager.sol";
import "./interfaces/uniswap-v3-periphery/ISwapRouter.sol";
contract FeeCollector is Ownable {
/// @notice Uniswap v3 swapRouter
ISwapRouter public immutable swapRouter;
/// @notice Uniswap v3 nonfungiblePositionManager contract
INonfungiblePositionManager public immutable nonfungiblePositionManager;
/// @notice The deployer addrress
address public immutable deployer;
/// @notice The address of Ethcoin
address public immutable ETHC;
/// @notice The address of WETH
address public immutable WETH;
/// @notice The token id of uniswap v3 ETHC/WETH position that this contract would add liquidity to
uint256 public immutable tokenId;
/// @notice The fee tier of the ETHC/WETH uniswap v3 pool
uint24 public immutable fee;
constructor(
address _ETHC,
address _WETH,
address _swapRouter,
address _nonfungiblePositionManager,
uint256 _tokenId
) Ownable(msg.sender) {
deployer = msg.sender;
ETHC = _ETHC;
WETH = _WETH;
swapRouter = ISwapRouter(_swapRouter);
nonfungiblePositionManager = INonfungiblePositionManager(_nonfungiblePositionManager);
tokenId = _tokenId;
(,,,, fee,,,,,,,) = nonfungiblePositionManager.positions(tokenId);
IERC20(ETHC).approve(address(nonfungiblePositionManager), type(uint256).max);
}
receive() external payable {}
/// @notice Collect all fee (ETH) in Ethcoin
function collect() external onlyOwner {
IEthCoin(ETHC).collect(ETHC.balance);
}
/**
* @notice Increase liquidity by using ETH that collected from Ethcoin
* @param amountIn the amount of ETH that we want to swap for ETHC
* @param amountOutMinimum the minimum amount of ETHC that we want to received
*/
function increaseLiquidity(uint256 amountIn, uint256 amountOutMinimum, uint256 dustTolerance, uint256 allowedExtra) external onlyOwner {
uint256 extra = IERC20(ETHC).balanceOf(address(this));
if (extra > allowedExtra) {
extra = allowedExtra;
}
// Buy ETHC
uint256 amountOut = swapRouter.exactInputSingle{value: amountIn}(
ISwapRouter.ExactInputSingleParams({
tokenIn: WETH,
tokenOut: ETHC,
fee: fee,
recipient: address(this),
deadline: block.timestamp,
amountIn: amountIn,
amountOutMinimum: amountOutMinimum,
sqrtPriceLimitX96: 0
})
);
uint256 amount0Desired = address(this).balance;
uint256 amount1Desired = amountOut + extra;
uint256 amount0Min = 0;
uint256 amount1Min = amountOut - dustTolerance;
if (ETHC < WETH) {
(amount0Desired, amount1Desired) = (amount1Desired, amount0Desired);
(amount0Min, amount1Min) = (amount1Min, amount0Min);
}
// increase liquidity
nonfungiblePositionManager.increaseLiquidity{value: address(this).balance}(
INonfungiblePositionManager.IncreaseLiquidityParams({
tokenId: tokenId,
amount0Desired: amount0Desired,
amount1Desired: amount1Desired,
amount0Min: amount0Min,
amount1Min: amount1Min,
deadline: block.timestamp
})
);
nonfungiblePositionManager.refundETH();
}
/**
* @notice deployer can rescue ETH
*/
function rescue() external {
require(msg.sender == deployer, "unauthorized");
payable(deployer).transfer(address(this).balance);
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
IEthCoin.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IEthCoin {
function collect(uint256 amount) external;
}
INonfungiblePositionManager.sol 68 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface INonfungiblePositionManager {
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 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
);
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,
uint256 tokensOwed0,
uint256 tokensOwed1
);
function refundETH() external;
}
ISwapRouter.sol 17 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface ISwapRouter {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
Read Contract
ETHC 0x57396373 → address
WETH 0xad5c4648 → address
deployer 0xd5f39488 → address
fee 0xddca3f43 → uint24
nonfungiblePositionManager 0xb44a2722 → address
owner 0x8da5cb5b → address
swapRouter 0xc31c9c07 → address
tokenId 0x17d70f7c → uint256
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
collect 0xe5225381
No parameters
increaseLiquidity 0xe78a432f
uint256 amountIn
uint256 amountOutMinimum
uint256 dustTolerance
uint256 allowedExtra
renounceOwnership 0x715018a6
No parameters
rescue 0x1fbe1979
No parameters
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address