Contract Diff Checker

Contract Name:
Vault

Contract Source Code:

File 1 of 1 : Vault

// SPDX-License-Identifier: UNKNOWN
pragma solidity ^0.8.18;

interface INonfungiblePositionManager {
	function WETH9() external view returns (address);

	struct MintParams {
		address token0;
		address token1;
		uint24 fee;
		int24 tickLower;
		int24 tickUpper;
		uint256 amount0Desired;
		uint256 amount1Desired;
		uint256 amount0Min;
		uint256 amount1Min;
		address recipient;
		uint256 deadline;
	}

	struct CollectParams {
		uint256 tokenId;
		address recipient;
		uint128 amount0Max;
		uint128 amount1Max;
	}

	function mint(MintParams memory params) external returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
	function collect(CollectParams calldata params) external returns (uint256 amount0, uint256 amount1);
	function safeTransferFrom(address from, address to, uint256 tokenId) external;
}

interface IERC721Receiver {
	function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

contract Vault is IERC721Receiver {

	address public owner;
	uint256 public tokenId;
	INonfungiblePositionManager public nfpm = INonfungiblePositionManager(0xf807Aca27B1550Fe778fD4E7013BB57480b17fAc);
    uint256 withdrawTime;

	constructor() {
		owner = msg.sender;
        withdrawTime = block.timestamp + 60 days;
	}

	function collectFees() external {
		require(msg.sender == owner, "Vault: FORBIDDEN");

		nfpm.collect(
			INonfungiblePositionManager.CollectParams({
				tokenId: tokenId,
				recipient: owner,
				amount0Max: type(uint128).max,
				amount1Max: type(uint128).max
			})
		);
	}

    function withdraw() external {
        require(msg.sender == owner);
        require(block.timestamp >= withdrawTime);

        nfpm.safeTransferFrom(address(this), msg.sender, tokenId);
    }

	function onERC721Received(
		address operator,
		address from,
		uint256 id,
		bytes calldata data
	) external override returns (bytes4) {
		require(tokenId == 0, "Vault: LOCKED");

		tokenId = id;

		return IERC721Receiver.onERC721Received.selector;
	}
	
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):