UltraFrequentDustScheduler

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.20;

/// @title UltraFrequentDustScheduler - clean error-free version

interface IDustCollector {
    function executeAutoCollection() external returns (uint256);
    function lastCollectionTime() external view returns (uint256);
    function collectionInterval() external view returns (uint256);
}

contract UltraFrequentDustScheduler {
    address public owner;
    IDustCollector public dustCollector;

    uint256 public totalExecutions;
    uint256 public successfulExecutions;
    uint256 public lastCollectionAmount;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event CollectionExecuted(uint256 timestamp, uint256 collected);

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

    constructor(address _dustCollector) {
        require(_dustCollector != address(0), "Invalid dust collector");
        owner = msg.sender;
        dustCollector = IDustCollector(_dustCollector);
        emit OwnershipTransferred(address(0), msg.sender);
    }

    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Invalid new owner");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    function executeCollection() external onlyOwner returns (uint256) {
        require(
            block.timestamp >=
                dustCollector.lastCollectionTime() + dustCollector.collectionInterval(),
            "Cooldown active"
        );

        uint256 collected = dustCollector.executeAutoCollection();
        totalExecutions++;

        if (collected > 0) {
            successfulExecutions++;
            lastCollectionAmount = collected;
        }

        emit CollectionExecuted(block.timestamp, collected);
        return collected;
    }

    function forceExecute() external onlyOwner returns (uint256) {
        uint256 collected = dustCollector.executeAutoCollection();
        totalExecutions++;
        if (collected > 0) {
            successfulExecutions++;
            lastCollectionAmount = collected;
        }
        emit CollectionExecuted(block.timestamp, collected);
        return collected;
    }

    function canExecute() external view returns (bool) {
        return
            block.timestamp >=
            dustCollector.lastCollectionTime() + dustCollector.collectionInterval();
    }
}

Tags:
addr:0x7c5a749d3f68daa78eb8578a7d5bd629c5e2c42b|verified:true|block:23614531|tx:0x39c7616aa3381a62772192fe87db52d63fcd93763a48e47ca23f7ca9a06db101|first_check:1760956814

Submitted on: 2025-10-20 12:40:14

Comments

Log in to comment.

No comments yet.