Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0x5Dbd12dEE6c028398ad3f282a9ED2F0b29aEc9d5
Balance 0 ETH
Nonce 1
Code Size 2906 bytes
Indexed Transactions 0 (1 on-chain, 1.0% indexed)
External Etherscan · Sourcify

Contract Bytecode

2906 bytes
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063913e77ad11610071578063913e77ad1461018357806395366fcb146101c25780639ae697bf146101e9578063a0821be3146101fc578063b5609be41461020f578063bbe4fd501461021757600080fd5b806334354068146100ae578063442e6551146100ca5780635e192de6146100df57806361dcd7ab146101355780636379821f1461015c575b600080fd5b6100b760005481565b6040519081526020015b60405180910390f35b6100dd6100d83660046109c8565b61021d565b005b6101156100ed366004610a01565b6001602081905260009182526040909120805491810154600282015460039092015490919084565b6040805194855260208501939093529183015260608201526080016100c1565b6100b77f000000000000000000000000000000000000000000000000000000006441ba1781565b6100b77f0000000000000000000000000000000000000000000000000000000002c7ea0081565b6101aa7f0000000000000000000000004a24c1989e5dff0de40f5804b47623b6b4300b0481565b6040516001600160a01b0390911681526020016100c1565b6101aa7f00000000000000000000000087a567060769348c7ff1836e4497b84f844ba99b81565b6100b76101f7366004610a01565b6102c0565b6100b761020a366004610a01565b610344565b6100dd610425565b426100b7565b336001600160a01b037f0000000000000000000000004a24c1989e5dff0de40f5804b47623b6b4300b0416146102a55760405162461bcd60e51b815260206004820152602260248201527f436c61696d6572436f6e74726163743a20494e56414c49445f434f4c4c45435460448201526127a960f11b60648201526084015b60405180910390fd5b6102b184848484610430565b6102ba846104ba565b50505050565b6001600160a01b0381166000908152600160208190526040822001544290829082106102ed576000610315565b6001600160a01b03841660009081526001602081905260409091200154610315908390610a39565b6001600160a01b03851660009081526001602052604090205490915061033c908290610a52565b949350505050565b6001600160a01b0381166000908152600160208190526040822001544290808303610373575060009392505050565b60008183116103ab576103a67f000000000000000000000000000000000000000000000000000000006441ba1784610a39565b6103d5565b6103d57f000000000000000000000000000000000000000000000000000000006441ba1783610a39565b6001600160a01b038616600090815260016020526040902060038101546002820154915492935091610408908490610a52565b6104129190610a69565b61041c9190610a39565b95945050505050565b61042e336104ba565b565b6001600160a01b03841660009081526001602081905260409091200154156104ae5760405162461bcd60e51b815260206004820152602b60248201527f436c61696d6572436f6e74726163743a20524543495049454e545f414c52454160448201526a111657d1539493d313115160aa1b606482015260840161029c565b6102ba8484848461054b565b60006104c582610344565b6001600160a01b0383166000908152600160205260408120600301805492935083929091906104f5908490610a69565b90915550610505905082826106dd565b6040805182815242602082015281516001600160a01b038516927ff4c6297f72d4e746c679dde16c732ea9af03893c22fe2ca98037465dd6a3bb2b928290030190a25050565b7f0000000000000000000000000000000000000000000000000000000002c7ea008110156105c75760405162461bcd60e51b815260206004820152602360248201527f436c61696d6572436f6e74726163743a20494e56414c49445f54494d455f4652604482015262414d4560e81b606482015260840161029c565b82826000546105d69190610a69565b6105e09190610a69565b60005561060d817f000000000000000000000000000000000000000000000000000000006441ba17610a69565b6001600160a01b038516600090815260016020819052604090912001556106348184610a92565b6001600160a01b038516600090815260016020526040902055816106588285610aa6565b6106629190610a69565b6001600160a01b0385166000908152600160205260408120600201919091555461068b9061084e565b60408051828152602081018590529081018390526001600160a01b038516907f8ceefb1ee30c963bc99d8216add67b76190bb2d0403a4e8f0e321ae3e41d7fbe9060600160405180910390a250505050565b806000808282546106ee9190610a39565b9091555050604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b179052915160009283927f00000000000000000000000087a567060769348c7ff1836e4497b84f844ba99b169161079f9190610aba565b6000604051808303816000865af19150503d80600081146107dc576040519150601f19603f3d011682016040523d82523d6000602084013e6107e1565b606091505b50915091508180156108025750808060200190518101906108029190610ae9565b6102ba5760405162461bcd60e51b815260206004820152601e60248201527f436c61696d657248656c7065723a205452414e534645525f4641494c45440000604482015260640161029c565b604080518082018252601281527162616c616e63654f6628616464726573732960701b602091820152815130602480830191909152835180830390910181526044909101835290810180516001600160e01b03166370a0823160e01b179052905160009182917f00000000000000000000000087a567060769348c7ff1836e4497b84f844ba99b6001600160a01b0316916108e891610aba565b6000604051808303816000865af19150503d8060008114610925576040519150601f19603f3d011682016040523d82523d6000602084013e61092a565b606091505b509150915081801561094f5750828180602001905181019061094c9190610b0b565b10155b6109a75760405162461bcd60e51b815260206004820152602360248201527f436c61696d657248656c7065723a2042414c414e43455f434845434b5f46414960448201526213115160ea1b606482015260840161029c565b505050565b80356001600160a01b03811681146109c357600080fd5b919050565b600080600080608085870312156109de57600080fd5b6109e7856109ac565b966020860135965060408601359560600135945092505050565b600060208284031215610a1357600080fd5b610a1c826109ac565b9392505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610a4c57610a4c610a23565b92915050565b8082028115828204841417610a4c57610a4c610a23565b80820180821115610a4c57610a4c610a23565b634e487b7160e01b600052601260045260246000fd5b600082610aa157610aa1610a7c565b500490565b600082610ab557610ab5610a7c565b500690565b6000825160005b81811015610adb5760208186018101518583015201610ac1565b506000920191825250919050565b600060208284031215610afb57600080fd5b81518015158114610a1c57600080fd5b600060208284031215610b1d57600080fd5b505191905056fea26469706673582212205c7c774fa8832d9b01b4c101bd277dbc0d760c002316bfa557eb3a7ec4beedd664736f6c63430008120033

Verified Source Code Full Match

Compiler: v0.8.18+commit.87f61d96 EVM: paris Optimization: Yes (200 runs)
ClaimerHelper.sol 102 lines
// SPDX-License-Identifier: --BCOM--

pragma solidity =0.8.18;

contract ClaimerHelper {

    uint256 public totalRequired;
    address public immutable wiserToken;

    event recipientEnrolled(
        address indexed recipient,
        uint256 timeFrame,
        uint256 tokensLocked,
        uint256 tokensOpened
    );

    event tokensScraped(
        address indexed scraper,
        uint256 scrapedAmount,
        uint256 timestamp
    );

    constructor(
        address _wiserTokenAddress
    ) {
        if (_wiserTokenAddress == address(0x0)) {
            revert("ClaimerHelper: INVALID_TOKEN");
        }

        wiserToken = _wiserTokenAddress;
    }

    bytes4 private constant TRANSFER = bytes4(
        keccak256(
            bytes(
                "transfer(address,uint256)"
            )
        )
    );

    bytes4 private constant BALANCEOF = bytes4(
        keccak256(
            bytes(
                "balanceOf(address)"
            )
        )
    );

    function _safeScrape(
        address _to,
        uint256 _scrapeAmount
    )
        internal
    {
        totalRequired -= _scrapeAmount;

        (bool success, bytes memory data) = wiserToken.call(
            abi.encodeWithSelector(
                TRANSFER,
                _to,
                _scrapeAmount
            )
        );

        require(
            success && (
                abi.decode(
                    data, (bool)
                )
            ),
            "ClaimerHelper: TRANSFER_FAILED"
        );
    }

    function _checkBalance(
        uint256 _required
    )
        internal
    {
        (bool success, bytes memory data) = wiserToken.call(
            abi.encodeWithSelector(
                BALANCEOF,
                address(this)
            )
        );

        require(
            success && abi.decode(
                data, (uint256)
            ) >= _required,
            "ClaimerHelper: BALANCE_CHECK_FAILED"
        );
    }

    function getNow()
        public
        view
        returns (uint256 time)
    {
        time = block.timestamp;
    }
}
ClaimerContract.sol 198 lines
// SPDX-License-Identifier: --WISE--

pragma solidity =0.8.18;

import "./ClaimerHelper.sol";

contract ClaimerContract is ClaimerHelper {

    address public immutable collector;
    uint256 public immutable createTime;
    uint256 public immutable minimumTime;

    struct KeeperInfo {
        uint256 keeperRate;
        uint256 keeperTill;
        uint256 keeperInstant;
        uint256 keeperPayouts;
    }

    mapping(address => KeeperInfo) public keeperList;

    modifier onlyCollector() {
        require(
            msg.sender == collector,
            "ClaimerContract: INVALID_COLLECTOR"
        );
        _;
    }

    constructor(
        address _collector,
        uint256 _timeFrame,
        address _tokenAddress
    )
        ClaimerHelper(
            _tokenAddress
        )
    {
        if (_timeFrame == 0) {
            revert("ClaimerContract: INVALID_TIMEFRAME");
        }

        collector = _collector;
        createTime = getNow();
        minimumTime = _timeFrame;
    }

    function enrollAndScrape(
        address _recipient,
        uint256 _tokensLocked,
        uint256 _tokensOpened,
        uint256 _timeFrame
    )
        external
        onlyCollector
    {
        _enrollRecipient(
            _recipient,
            _tokensLocked,
            _tokensOpened,
            _timeFrame
        );

        _scrapeTokens(
            _recipient
        );
    }

    function _enrollRecipient(
        address _recipient,
        uint256 _tokensLocked,
        uint256 _tokensOpened,
        uint256 _timeFrame
    )
        private
    {
        require(
            keeperList[_recipient].keeperTill == 0,
            "ClaimerContract: RECIPIENT_ALREADY_ENROLLED"
        );

        _allocateTokens(
            _recipient,
            _tokensLocked,
            _tokensOpened,
            _timeFrame
        );
    }

    function _allocateTokens(
        address _recipient,
        uint256 _tokensLocked,
        uint256 _tokensOpened,
        uint256 _timeFrame
    )
        private
    {
        require(
            _timeFrame >= minimumTime,
            "ClaimerContract: INVALID_TIME_FRAME"
        );

        totalRequired = totalRequired
            + _tokensOpened
            + _tokensLocked;

        keeperList[_recipient].keeperTill = createTime
            + _timeFrame;

        keeperList[_recipient].keeperRate = _tokensLocked
            / _timeFrame;

        keeperList[_recipient].keeperInstant = _tokensLocked
            % _timeFrame
            + _tokensOpened;

        _checkBalance(
            totalRequired
        );

        emit recipientEnrolled(
            _recipient,
            _timeFrame,
            _tokensLocked,
            _tokensOpened
        );
    }

    function scrapeMyTokens()
        external
    {
        _scrapeTokens(
            msg.sender
        );
    }

    function _scrapeTokens(
        address _recipient
    )
        private
    {
        uint256 scrapeAmount = availableBalance(
            _recipient
        );

        keeperList[_recipient].keeperPayouts += scrapeAmount;

        _safeScrape(
            _recipient,
            scrapeAmount
        );

        emit tokensScraped(
            _recipient,
            scrapeAmount,
            getNow()
        );
    }

    function availableBalance(
        address _recipient
    )
        public
        view
        returns (uint256 balance)
    {
        uint256 timeNow = getNow();
        uint256 timeMax = keeperList[_recipient].keeperTill;

        if (timeMax == 0) return 0;

        uint256 timePassed = timeNow > timeMax
            ? timeMax - createTime
            : timeNow - createTime;

        balance = keeperList[_recipient].keeperRate
            * timePassed
            + keeperList[_recipient].keeperInstant
            - keeperList[_recipient].keeperPayouts;
    }

    function lockedBalance(
        address _recipient
    )
        external
        view
        returns (uint256 balance)
    {
        uint256 timeNow = getNow();

        uint256 timeRemaining =
            keeperList[_recipient].keeperTill > timeNow ?
            keeperList[_recipient].keeperTill - timeNow : 0;

        balance = keeperList[_recipient].keeperRate
            * timeRemaining;
    }
}

Read Contract

availableBalance 0xa0821be3 → uint256
collector 0x913e77ad → address
createTime 0x61dcd7ab → uint256
getNow 0xbbe4fd50 → uint256
keeperList 0x5e192de6 → uint256, uint256, uint256, uint256
lockedBalance 0x9ae697bf → uint256
minimumTime 0x6379821f → uint256
totalRequired 0x34354068 → uint256
wiserToken 0x95366fcb → address

Write Contract 2 functions

These functions modify contract state and require a wallet transaction to execute.

enrollAndScrape 0x442e6551
address _recipient
uint256 _tokensLocked
uint256 _tokensOpened
uint256 _timeFrame
scrapeMyTokens 0xb5609be4
No parameters

Recent Transactions

This address has 1 on-chain transactions, but only 1.0% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →