// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
contract GasZip {
event Deposit(address from, uint256 chains, uint256 amount, address to);
address public owner;
constructor(address _owner) {
owner = _owner;
}
function deposit(uint256 chains, address to) payable external {
require(msg.value != 0);
emit Deposit(msg.sender, chains, msg.value, to);
}
function withdraw(address token) external {
require(msg.sender == owner);
if (token == address(0)) {
owner.call{value: address(this).balance}("");
} else {
IERC20(token).transfer(owner, IERC20(token).balanceOf(address(this)));
}
}
function newOwner(address _owner) external {
require(msg.sender == owner);
owner = _owner;
}
}
interface IERC20 {
function balanceOf(address) external view returns (uint256);
function transfer(address, uint256) external returns (bool);
}
{
"compilationTarget": {
"src/GasZip.sol": "GasZip"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":ds-test/=lib/forge-std/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/",
":solady/=lib/solady/src/",
":solmate/=lib/solady/lib/solmate/src/"
]
}
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"chains","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"Deposit","type":"event"},{"inputs":[{"internalType":"uint256","name":"chains","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"newOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]