Skip to content
Chain 4441 · LiteForge TestnetHead#0
LitVM·Scan
Hard Money Web3 Explorer
Verified Contract
0x02520681Ebb1D88f942e08aC33e1e10AABdb099B
Pin to watchlist
scan to copy
zkLTC Balance
0
hard money native
Transactions
0
Token transfers
0
Validations
0
blocks produced
Hard Money Score
0
/100
NO ACTIVITY
share of activity in native zkLTC vs. tokens
native
0
tokens
0
Contract name
RewardsProtocol
Compiler
v0.8.28+commit.7893614a
Optimization
disabled
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "../interfaces/IRewardsProtocol.sol";

contract RewardsProtocol is IRewardsProtocol {
    mapping(address => uint256) public balanceOf;

    function deposit(address to) external payable {
        if (to == address(0)) {
            revert ADDRESS_ZERO();
        }

        balanceOf[to] += msg.value;
        emit Deposit(msg.sender, to, msg.value);
    }

    function depositRewards(
        address creator,
        uint256 creatorReward,
        address referral,
        uint256 referralReward,
        address omniHub,
        uint256 omniHubReward
    ) external payable {
        if (msg.value != (creatorReward + referralReward + omniHubReward)) {
            revert INVALID_DEPOSIT();
        }

        if (creator != address(0)) {
            balanceOf[creator] += creatorReward;
        }
        if (referral != address(0)) {
            balanceOf[referral] += referralReward;
        }
        if (omniHub != address(0)) {
            balanceOf[omniHub] += omniHubReward;
        }

        emit RewardsDeposit(
            creator,
            creatorReward,
            referral,
            referralReward,
            omniHub,
            omniHubReward,
            msg.sender
        );
    }

    function withdraw(address to, uint256 amount) external {
        if (to == address(0)) {
            revert ADDRESS_ZERO();
        }

        address owner = msg.sender;

        if (amount > balanceOf[owner]) {
            revert INVALID_WITHDRAW();
        }

        if (amount == 0) {
            amount = balanceOf[owner];
        }

        balanceOf[owner] -= amount;

        emit Withdraw(owner, to, amount);

        (bool success,) = to.call{value: amount}("");

        if (!success) {
            revert TRANSFER_FAILED();
        }
    }
}