Verified contractExactMIT
InstantPaymentSplitter2
Address0xe2abcae9ff70cace6447c25d2faa52bbe863b516
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.20
- Same code
Only this contract
Details
- Compiler
- solc 0.8.20+commit.a1b79de6
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- paris
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,323,343
- Creation transaction
- 0xc279d9199f…11859bd2c5
Remix/pak putu/instantpaymentspliter2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// ============================================================
// InstantPaymentSplitter2.sol
// Instant Multi-Asset Payment Splitter for 2.00% Pool Allocation
//
// Every incoming deposit (ETH / USDT) is split and forwarded immediately
// to the 4 recipient wallets. Zero funds remain locked in the contract.
//
// Controller / Owner: 0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5
//
// Allocation Breakdown (Total 2.00000% = 20,000,000 units):
// 1. 0xb2378F5EbfB859d5c1BCBfBa8d0f894664941073 : 0.99998% ( 9,999,800 / 20,000,000) -> 49.999%
// 2. 0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5 : 0.50000% ( 5,000,000 / 20,000,000) -> 25.000% [Owner / Controller]
// 3. 0xeE4135f55d91452F136CA0a0978173ad237A4aB1 : 0.50000% ( 5,000,000 / 20,000,000) -> 25.000%
// 4. 0xAD0A8419e21bcccAc33809880e0f7c22Dac40265 : 0.00002% ( 200 / 20,000,000) -> 0.001%
// Total: 2.00000% (20,000,000 units = Exact 100% of received funds)
// ============================================================
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
contract InstantPaymentSplitter2 {
address public owner;
IERC20 public usdt;
// Total units: 20,000,000 representing exact 2.00000% (1 unit = 0.0000001%)
uint256 public constant TOTAL_SHARES = 20000000;
struct Recipient {
address wallet;
uint256 shares;
}
Recipient[4] public recipients;
// --------------------------------------------------------
// EVENTS
// --------------------------------------------------------
event NativeSplit(address indexed sender, uint256 totalAmount, uint256 timestamp);
event USDTSplit(address indexed sender, uint256 totalAmount, uint256 timestamp);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// --------------------------------------------------------
// MODIFIER
// --------------------------------------------------------
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this");
_;
}
// --------------------------------------------------------
// CONSTRUCTOR
// Controller / Owner: 0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5
// --------------------------------------------------------
constructor(address _usdtAddress) {
// Controller set to 0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5
owner = 0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5;
usdt = IERC20(_usdtAddress);
// 1. 1% minus 0.00002% = 0.99998% -> 9,999,800 / 20,000,000
recipients[0] = Recipient(0xb2378F5EbfB859d5c1BCBfBa8d0f894664941073, 9999800);
// 2. Full 0.50% (Owner / Controller) -> 5,000,000 / 20,000,000
recipients[1] = Recipient(0xD6725D8DD4820778e4B9Bf835b8b889A2DA0d1A5, 5000000);
// 3. Full 0.50% -> 5,000,000 / 20,000,000
recipients[2] = Recipient(0xeE4135f55d91452F136CA0a0978173ad237A4aB1, 5000000);
// 4. Exact 0.00002% -> 200 / 20,000,000
recipients[3] = Recipient(0xAD0A8419e21bcccAc33809880e0f7c22Dac40265, 200);
// Total: 9,999,800 + 5,000,000 + 5,000,000 + 200 = 20,000,000 (Exact 2.00000%)
}
// --------------------------------------------------------
// INSTANT ETH SPLIT (Automatic via receive)
// --------------------------------------------------------
receive() external payable {
_splitETH(msg.value);
}
function splitETH() external payable {
_splitETH(msg.value);
}
function _splitETH(uint256 totalAmount) internal {
require(totalAmount > 0, "No ETH sent");
for (uint256 i = 0; i < 4; i++) {
uint256 shareAmount = (totalAmount * recipients[i].shares) / TOTAL_SHARES;
if (shareAmount > 0) {
(bool success, ) = payable(recipients[i].wallet).call{value: shareAmount}("");
require(success, "ETH transfer failed");
}
}
emit NativeSplit(msg.sender, totalAmount, block.timestamp);
}
// --------------------------------------------------------
// INSTANT USDT SPLIT
// --------------------------------------------------------
function splitUSDT(uint256 _amount) external {
require(_amount > 0, "Amount must be greater than 0");
require(usdt.transferFrom(msg.sender, address(this), _amount), "USDT transferFrom failed");
for (uint256 i = 0; i < 4; i++) {
uint256 shareAmount = (_amount * recipients[i].shares) / TOTAL_SHARES;
if (shareAmount > 0) {
require(usdt.transfer(recipients[i].wallet, shareAmount), "USDT transfer failed");
}
}
emit USDTSplit(msg.sender, _amount, block.timestamp);
}
// --------------------------------------------------------
// SWEEP (Fallback for direct ERC20 transfers)
// --------------------------------------------------------
function sweepAndSplitUSDT() external {
uint256 balance = usdt.balanceOf(address(this));
require(balance > 0, "No USDT balance to split");
for (uint256 i = 0; i < 4; i++) {
uint256 shareAmount = (balance * recipients[i].shares) / TOTAL_SHARES;
if (shareAmount > 0) {
require(usdt.transfer(recipients[i].wallet, shareAmount), "USDT transfer failed");
}
}
emit USDTSplit(msg.sender, balance, block.timestamp);
}
// --------------------------------------------------------
// VIEW: Get all recipients and shares
// --------------------------------------------------------
function getAllRecipients() external view returns (
address[4] memory wallets,
uint256[4] memory shares
) {
for (uint256 i = 0; i < 4; i++) {
wallets[i] = recipients[i].wallet;
shares[i] = recipients[i].shares;
}
}
// --------------------------------------------------------
// TRANSFER OWNERSHIP (Owner only)
// --------------------------------------------------------
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "Invalid new owner");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
// --------------------------------------------------------
// EMERGENCY WITHDRAW (Owner only)
// --------------------------------------------------------
function emergencyWithdraw() external onlyOwner {
uint256 usdtBalance = usdt.balanceOf(address(this));
if (usdtBalance > 0) {
usdt.transfer(owner, usdtBalance);
}
if (address(this).balance > 0) {
(bool success, ) = payable(owner).call{value: address(this).balance}("");
require(success, "ETH withdrawal failed");
}
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.