Verified contractExactMIT
InstantPaymentSplitter30
Address0x8327e77ac476b130d30b180d946dbbf674943354
- 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
- shanghai
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,482,250
- Creation transaction
- 0xbd04e142ce…a270ac170d
Remix/InstantPaymentSplitter30.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// ============================================================
// InstantPaymentSplitter30.sol
// Instant Multi-Asset Payment Splitter for 30.00% Pool Allocation (PGL)
//
// Every incoming deposit (ETH / USDT) is split and forwarded immediately
// to the recipient wallets. Zero funds remain locked in the contract.
//
// Controller / Owner / Sumber: 0x5381b2E2a66aa1E64872C99cEe6BB7272E29D7F6
//
// Allocation Breakdown (Total 30.00% / 3,000 units):
// 1. 0x3a90D61646bF21AB2796Aa99fFe59BdB444baaeA : 15.00% (1,500 / 3,000) -> 50.000% of pool
// 2. 0xb2378F5EbfB859d5c1BCBfBa8d0f894664941073 : 1.00% ( 100 / 3,000) -> 3.333% of pool
// 3. 0x5381b2E2a66aa1E64872C99cEe6BB7272E29D7F6 : 14.00% (1,400 / 3,000) -> 46.667% of pool [Owner / Sumber Pengendali]
// Total: 30.00% (3,000 units = 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 InstantPaymentSplitter30 {
address public owner;
IERC20 public usdt;
// Total units: 3,000 representing exact 30.00% (1 unit = 0.01%)
uint256 public constant TOTAL_SHARES = 3000;
struct Recipient {
address wallet;
uint256 shares; // 1500, 100, 1400
}
Recipient[3] 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);
event USDTAddressUpdated(address indexed previousAddress, address indexed newAddress);
// --------------------------------------------------------
// MODIFIER
// --------------------------------------------------------
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this");
_;
}
// --------------------------------------------------------
// CONSTRUCTOR
// Controller / Owner / Sumber: 0x5381b2E2a66aa1E64872C99cEe6BB7272E29D7F6
// --------------------------------------------------------
constructor(address _usdtAddress) {
owner = 0x5381b2E2a66aa1E64872C99cEe6BB7272E29D7F6;
usdt = IERC20(_usdtAddress);
// 1. 15.00% -> 1,500 / 3,000
recipients[0] = Recipient(0x3a90D61646bF21AB2796Aa99fFe59BdB444baaeA, 1500);
// 2. 1.00% -> 100 / 3,000
recipients[1] = Recipient(0xb2378F5EbfB859d5c1BCBfBa8d0f894664941073, 100);
// 3. Sisa 14.00% -> 1,400 / 3,000 (Wallet Sumber & Pengendali / Owner)
recipients[2] = Recipient(0x5381b2E2a66aa1E64872C99cEe6BB7272E29D7F6, 1400);
// Total: 1,500 + 100 + 1,400 = 3,000 (Exact 30.00%)
}
// --------------------------------------------------------
// INSTANT ETH SPLIT (Automatic via receive)
// Sending ETH to this contract address splits it immediately
// --------------------------------------------------------
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 < 3; 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
// Caller approves USDT first, then calls this function
// Funds are pulled and forwarded to recipients immediately
// --------------------------------------------------------
function splitUSDT(uint256 _amount) external {
require(_amount > 0, "Amount must be greater than 0");
// Pull USDT from sender into this contract first
require(usdt.transferFrom(msg.sender, address(this), _amount), "USDT transferFrom failed");
// Immediately distribute to all 3 recipients
for (uint256 i = 0; i < 3; 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)
// In case USDT was sent via direct transfer() instead of splitUSDT()
// --------------------------------------------------------
function sweepAndSplitUSDT() external {
uint256 balance = usdt.balanceOf(address(this));
require(balance > 0, "No USDT balance to split");
for (uint256 i = 0; i < 3; 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[3] memory wallets,
uint256[3] memory shares
) {
for (uint256 i = 0; i < 3; i++) {
wallets[i] = recipients[i].wallet;
shares[i] = recipients[i].shares;
}
}
// --------------------------------------------------------
// UPDATE USDT ADDRESS (Owner only)
// --------------------------------------------------------
function setUSDT(address _usdtAddress) external onlyOwner {
require(_usdtAddress != address(0), "Invalid USDT address");
emit USDTAddressUpdated(address(usdt), _usdtAddress);
usdt = IERC20(_usdtAddress);
}
// --------------------------------------------------------
// 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, for unexpected tokens/funds)
// --------------------------------------------------------
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": "shanghai",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.