S Price: $0.573499 (+1.62%)

Contract

0x8f205d484Df2B38FBd501648a1f53Ef82813C6dC

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
18665302024-12-29 0:37:1522 days ago1735432635  Contract Creation0 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, GNU GPLv3 license
File 1 of 1 : Vault.sol
// SPDX-License-Identifier: UNKNOWN
pragma solidity ^0.8.18;

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
	function transfer(address to, uint256 value) external returns (bool);
}

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

interface Manager {
	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;
}

contract Vault is IERC721Receiver {

	address public owner;
	address public owner2;
	uint256 public tokenId;
	Manager public nfpm = Manager(0xf807Aca27B1550Fe778fD4E7013BB57480b17fAc);

	constructor() {
	}

    function setup(address _owner, address _owner2) external {
        require(owner == address(0));
        owner = _owner;
		owner2 = _owner2;
    }

	function setNewOwner2(address newOwner) external {
		require(msg.sender == owner2 || msg.sender == owner);
		owner2 = newOwner;
	}

	function collectAndWithdraw(address token0, address token1) external {
		collectFees();
		withdraw(token0, token1);
	}

	function collectFees() public {
		nfpm.collect(
			Manager.CollectParams({
				tokenId: tokenId,
				recipient: address(this),
				amount0Max: type(uint128).max,
				amount1Max: type(uint128).max
			})
		);
	}

	function withdraw(address token0, address token1) public {
		uint amount0 = IERC20(token0).balanceOf(address(this)) / 2;
		uint amount1 = IERC20(token1).balanceOf(address(this)) / 2;

		IERC20(token0).transfer(owner, amount0);
		IERC20(token1).transfer(owner, amount1);

		IERC20(token0).transfer(owner2, IERC20(token0).balanceOf(address(this)));
		IERC20(token1).transfer(owner2, IERC20(token1).balanceOf(address(this)));
	}

	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;
	}
	
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "ds-test/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"collectAndWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nfpm","outputs":[{"internalType":"contract Manager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setNewOwner2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_owner2","type":"address"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080806040523461003c57600380546001600160a01b03191673f807aca27b1550fe778fd4e7013bb57480b17fac1790556107e790816100428239f35b600080fdfe60806040818152600436101561001457600080fd5b600091823560e01c908163150b7a02146102635750806317d70f7c146102455780632d34ba79146101e55780634a41823b146101b4578063527097251461018c5780637303e913146101645780638da5cb5b1461013d578063c879657214610124578063f5af5f95146100c25763f940e3851461009057600080fd5b346100be573660031901126100bb576100b86100aa610313565b6100b261032e565b90610460565b80f35b80fd5b5080fd5b82346100bb5760203660031901126100bb576100dc610313565b600154906001600160a01b039033828416148015610118575b156101145716906bffffffffffffffffffffffff60a01b161760015580f35b8380fd5b508184541633146100f5565b82346100bb57806003193601126100bb576100b861037c565b50346100be57816003193601126100be57905490516001600160a01b039091168152602090f35b50346100be57816003193601126100be5760035490516001600160a01b039091168152602090f35b50346100be57816003193601126100be5760015490516001600160a01b039091168152602090f35b50346100be573660031901126100bb576100b86101cf610313565b6101d761032e565b906101e061037c565b610460565b50346100be573660031901126100bb576101fd610313565b61020561032e565b82546001600160a01b039291908381166102415783926bffffffffffffffffffffffff60a01b9485911691161784551690600154161760015580f35b8480fd5b50346100be57816003193601126100be576020906002549051908152f35b905082346100bb5760803660031901126100bb5761027f610313565b5061028861032e565b5060643567ffffffffffffffff80821161030f573660238301121561030f57816004013590811161030f57369101602401116100bb57506002546102dd576044356002558151630a85bd0160e11b8152602090f35b62461bcd60e51b815260206004820152600d60248201526c15985d5b1d0e881313d0d2d151609a1b6044820152606490fd5b8280fd5b600435906001600160a01b038216820361032957565b600080fd5b602435906001600160a01b038216820361032957565b90601f8019910116810190811067ffffffffffffffff82111761036657604052565b634e487b7160e01b600052604160045260246000fd5b60018060a01b038060035416906002546040928351608081019080821067ffffffffffffffff83111761036657859360849285528152600060208201933085528583016fffffffffffffffffffffffffffffffff9081815281606086019181835289519a8b998a9863fc6f786560e01b8a525160048a01525116602488015251166044860152511660648401525af1801561043d57610419575050565b813d8311610436575b61042c8183610344565b8101031261032957565b503d610422565b82513d6000823e3d90fd5b90816020910312610329575180151581036103295790565b604080516370a0823160e01b8082523060048084019190915260209591946001600160a01b03908116928785602481875afa9485156106c857600095610782575b50811692855187815230848201528881602481885afa90811561072d57600091610755575b50600054875163a9059cbb60e01b8082529185166001600160a01b031686820190815260019890981c602089015290968a908290819060400103816000875af1801561070557918a9161054b93610738575b5060005489518981529086166001600160a01b031687820190815260019290921c60208301529283918291604090910190565b03816000895af1801561072d57610710575b5081600154169086519088825230858301528982602481845afa91821561070557908a92916000926106d3575b5088518881526001600160a01b0390941686850190815260208101929092528391829060009082906040015b03925af180156106c8576106ab575b506001541692845195865230828701528686602481865afa9586156106a057908794939291600097610667575b506000906106208751988996879586948552840160209093929193604081019460018060a01b031681520152565b03925af190811561065d5750610634575050565b8161065392903d10610656575b61064b8183610344565b810190610448565b50565b503d610641565b513d6000823e3d90fd5b9192939482819892983d8311610699575b6106828183610344565b810103126100bb57505194869392919060006105f2565b503d610678565b85513d6000823e3d90fd5b6106c190883d8a116106565761064b8183610344565b50386105c5565b86513d6000823e3d90fd5b91909282813d83116106fe575b6106ea8183610344565b810103126100bb57505189916105b661058a565b503d6106e0565b88513d6000823e3d90fd5b61072690893d8b116106565761064b8183610344565b503861055d565b87513d6000823e3d90fd5b61074e90833d85116106565761064b8183610344565b5038610518565b908982813d831161077b575b61076b8183610344565b810103126100bb575051386104c6565b503d610761565b90948882813d83116107aa575b6107998183610344565b810103126100bb57505193816104a1565b503d61078f56fea26469706673582212204b026722dc6a44c4a452788a40c8b3737d39c4cc2f6a2a9c7c96e2bdbdd2027664736f6c63430008120033

Deployed Bytecode

0x60806040818152600436101561001457600080fd5b600091823560e01c908163150b7a02146102635750806317d70f7c146102455780632d34ba79146101e55780634a41823b146101b4578063527097251461018c5780637303e913146101645780638da5cb5b1461013d578063c879657214610124578063f5af5f95146100c25763f940e3851461009057600080fd5b346100be573660031901126100bb576100b86100aa610313565b6100b261032e565b90610460565b80f35b80fd5b5080fd5b82346100bb5760203660031901126100bb576100dc610313565b600154906001600160a01b039033828416148015610118575b156101145716906bffffffffffffffffffffffff60a01b161760015580f35b8380fd5b508184541633146100f5565b82346100bb57806003193601126100bb576100b861037c565b50346100be57816003193601126100be57905490516001600160a01b039091168152602090f35b50346100be57816003193601126100be5760035490516001600160a01b039091168152602090f35b50346100be57816003193601126100be5760015490516001600160a01b039091168152602090f35b50346100be573660031901126100bb576100b86101cf610313565b6101d761032e565b906101e061037c565b610460565b50346100be573660031901126100bb576101fd610313565b61020561032e565b82546001600160a01b039291908381166102415783926bffffffffffffffffffffffff60a01b9485911691161784551690600154161760015580f35b8480fd5b50346100be57816003193601126100be576020906002549051908152f35b905082346100bb5760803660031901126100bb5761027f610313565b5061028861032e565b5060643567ffffffffffffffff80821161030f573660238301121561030f57816004013590811161030f57369101602401116100bb57506002546102dd576044356002558151630a85bd0160e11b8152602090f35b62461bcd60e51b815260206004820152600d60248201526c15985d5b1d0e881313d0d2d151609a1b6044820152606490fd5b8280fd5b600435906001600160a01b038216820361032957565b600080fd5b602435906001600160a01b038216820361032957565b90601f8019910116810190811067ffffffffffffffff82111761036657604052565b634e487b7160e01b600052604160045260246000fd5b60018060a01b038060035416906002546040928351608081019080821067ffffffffffffffff83111761036657859360849285528152600060208201933085528583016fffffffffffffffffffffffffffffffff9081815281606086019181835289519a8b998a9863fc6f786560e01b8a525160048a01525116602488015251166044860152511660648401525af1801561043d57610419575050565b813d8311610436575b61042c8183610344565b8101031261032957565b503d610422565b82513d6000823e3d90fd5b90816020910312610329575180151581036103295790565b604080516370a0823160e01b8082523060048084019190915260209591946001600160a01b03908116928785602481875afa9485156106c857600095610782575b50811692855187815230848201528881602481885afa90811561072d57600091610755575b50600054875163a9059cbb60e01b8082529185166001600160a01b031686820190815260019890981c602089015290968a908290819060400103816000875af1801561070557918a9161054b93610738575b5060005489518981529086166001600160a01b031687820190815260019290921c60208301529283918291604090910190565b03816000895af1801561072d57610710575b5081600154169086519088825230858301528982602481845afa91821561070557908a92916000926106d3575b5088518881526001600160a01b0390941686850190815260208101929092528391829060009082906040015b03925af180156106c8576106ab575b506001541692845195865230828701528686602481865afa9586156106a057908794939291600097610667575b506000906106208751988996879586948552840160209093929193604081019460018060a01b031681520152565b03925af190811561065d5750610634575050565b8161065392903d10610656575b61064b8183610344565b810190610448565b50565b503d610641565b513d6000823e3d90fd5b9192939482819892983d8311610699575b6106828183610344565b810103126100bb57505194869392919060006105f2565b503d610678565b85513d6000823e3d90fd5b6106c190883d8a116106565761064b8183610344565b50386105c5565b86513d6000823e3d90fd5b91909282813d83116106fe575b6106ea8183610344565b810103126100bb57505189916105b661058a565b503d6106e0565b88513d6000823e3d90fd5b61072690893d8b116106565761064b8183610344565b503861055d565b87513d6000823e3d90fd5b61074e90833d85116106565761064b8183610344565b5038610518565b908982813d831161077b575b61076b8183610344565b810103126100bb575051386104c6565b503d610761565b90948882813d83116107aa575b6107998183610344565b810103126100bb57505193816104a1565b503d61078f56fea26469706673582212204b026722dc6a44c4a452788a40c8b3737d39c4cc2f6a2a9c7c96e2bdbdd2027664736f6c63430008120033

Deployed Bytecode Sourcemap

1132:1511:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1132:1511:0;;;;;;;:::i;:::-;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;-1:-1:-1;;1132:1511:0;;;;;;:::i;:::-;1567:6;1132:1511;;-1:-1:-1;;;;;1132:1511:0;1553:10;1132:1511;;;1553:20;:43;;;;1132:1511;;;;;;;;;;;1567:6;1132:1511;;;;;;;1553:43;1132:1511;;;;;1553:10;1577:19;1553:43;;1132:1511;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1132:1511:0;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1132:1511:0;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1132:1511:0;;;;;;;;;;;;;;-1:-1:-1;;1132:1511:0;;;;1732:6;1132:1511;;:::i;:::-;;;:::i;:::-;1625:118;;;:::i;:::-;1732:6;:::i;1132:1511::-;;;;;;-1:-1:-1;;1132:1511:0;;;;;;:::i;:::-;;;:::i;:::-;;;-1:-1:-1;;;;;1132:1511:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1217:22;1132:1511;;;;;;;;;;;;;;;;-1:-1:-1;;1132:1511:0;;;;;;:::i;:::-;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2535:7;1132:1511;;;;;2535:7;1132:1511;;;-1:-1:-1;;;1132:1511:0;;;;;;-1:-1:-1;;;1132:1511:0;;;;;;;;;;;;-1:-1:-1;;;1132:1511:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;1132:1511:0;;;;;;:::o;:::-;;;;;;;;-1:-1:-1;;;;;1132:1511:0;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;1746:209;1132:1511;;;;;;1780:4;1132:1511;;;1834:7;1132:1511;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1797:150:0;;;1866:4;;1132:1511;;1797:150;;;1889:17;1132:1511;;;;1797:150;;;;1132:1511;;;;;;;;;;;;;;1780:171;;1132:1511;1780:171;;;1132:1511;;;;;;;;;;;;;;;;;;;1780:171;;;;;;;;1746:209;;:::o;1780:171::-;;;;;;;;;;;;:::i;:::-;;;1132:1511;;;;1746:209::o;1780:171::-;;;;;;1132:1511;;;-1:-1:-1;1132:1511:0;;;;;;;;;;;;;;;;;;;;;;;:::o;1958:425::-;1132:1511;;;-1:-1:-1;;;2034:39:0;;;2067:4;2034:39;;;;1132:1511;;;;2034:39;;1132:1511;;-1:-1:-1;;;;;1132:1511:0;;;;2034:39;1132:1511;;;;2034:39;;;;;;;-1:-1:-1;2034:39:0;;;1958:425;1132:1511;;;;;;2096:39;;;2067:4;2096:39;;;1132:1511;2096:39;;1132:1511;2096:39;;;;;;;;;-1:-1:-1;2096:39:0;;;1958:425;-1:-1:-1;;1132:1511:0;;;-1:-1:-1;;;2144:39:0;;;1132:1511;;;-1:-1:-1;;;;;1132:1511:0;2144:39;;;1132:1511;;;;;;;;;;;;;;;;;;;;;;2144:39;;-1:-1:-1;2144:39:0;;;;;;;;;;2187;2144;;;1958:425;-1:-1:-1;;1132:1511:0;;;2187:39;;;1132:1511;;;-1:-1:-1;;;;;1132:1511:0;2187:39;;;1132:1511;;;;;;;;;;;;;;;;;;;;;;;2187:39;;;-1:-1:-1;2187:39:0;;;;;;;;;1958:425;1132:1511;;;;;;;;2263:39;;;;2067:4;2263:39;;;1132:1511;2263:39;;1132:1511;2263:39;;;;;;;;;;;;;-1:-1:-1;2263:39:0;;;1958:425;-1:-1:-1;1132:1511:0;;2231:72;;;-1:-1:-1;;;;;1132:1511:0;;;2231:72;;;1132:1511;;;;;;;;;;;;;;-1:-1:-1;;1132:1511:0;;;;2231:72;;;;;;;;;;;1958:425;1132:1511;;;;;;;2339:39;;;2067:4;2339:39;;;1132:1511;2339:39;;1132:1511;2339:39;;;;;;;;;;;;;;;-1:-1:-1;2339:39:0;;;1958:425;1132:1511;-1:-1:-1;1132:1511:0;2307:72;1132:1511;;2307:72;;;;;;;;;;;1132:1511;;;;;;;;;;;;;;;;;;;;;2307:72;;;;;;;;;;;;;1958:425;;:::o;2307:72::-;;;;;;-1:-1:-1;2307:72:0;;;;;;;:::i;:::-;;;;;:::i;:::-;;1958:425::o;2307:72::-;;;;;;1132:1511;;-1:-1:-1;1132:1511:0;;;;;2339:39;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;1132:1511;;;;-1:-1:-1;1132:1511:0;;;;;;;-1:-1:-1;2339:39:0;;;;;;;;1132:1511;;;-1:-1:-1;1132:1511:0;;;;;2231:72;;;;;;;;;;;;;:::i;:::-;;;;;;1132:1511;;;-1:-1:-1;1132:1511:0;;;;;2263:39;;;;;;;;;;;;;;;;:::i;:::-;;;1132:1511;;;;-1:-1:-1;1132:1511:0;;;2231:72;2263:39;;;;;;;;1132:1511;;;-1:-1:-1;1132:1511:0;;;;;2187:39;;;;;;;;;;;;;:::i;:::-;;;;;;1132:1511;;;-1:-1:-1;1132:1511:0;;;;;2144:39;;;;;;;;;;;;;:::i;:::-;;;;;2096;;;;;;;;;;;;;;;:::i;:::-;;;1132:1511;;;;;;2096:39;;;;;;;;2034;;;;;;;;;;;;;;;;:::i;:::-;;;1132:1511;;;;-1:-1:-1;1132:1511:0;;;2034:39;;;;;;

Swarm Source

ipfs://4b026722dc6a44c4a452788a40c8b3737d39c4cc2f6a2a9c7c96e2bdbdd20276

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.