Description:
Smart contract deployed on Ethereum.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
contract ForwardWallet {
address payable public treasury;
address public owner;
constructor(address payable _treasury) {
require(_treasury != address(0));
treasury = _treasury;
owner = msg.sender;
}
function deposit() external payable {
require(msg.value > 0);
(bool ok, ) = treasury.call{value: msg.value}("");
require(ok);
}
function changeTreasury(address payable _new) external {
require(msg.sender == owner);
require(_new != address(0));
treasury = _new;
}
function withdraw(uint256 amount, address payable to) external {
require(msg.sender == owner);
require(address(this).balance >= amount);
(bool ok, ) = to.call{value: amount}("");
require(ok);
}
function depositToken(address token, uint256 amount) external {
require(amount > 0);
bool ok = IERC20(token).transferFrom(msg.sender, treasury, amount);
require(ok);
}
function withdrawToken(address token, uint256 amount, address to) external {
require(msg.sender == owner);
require(amount > 0);
bool ok = IERC20(token).transfer(to, amount);
require(ok);
}
}
Submitted on: 2025-10-29 17:53:46
Comments
Log in to comment.
No comments yet.