FixedSplit95_5

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

interface IERC20 {
    function balanceOf(address) external view returns (uint256);
    function transfer(address,uint256) external returns (bool);
}

contract FixedSplit95_5 {
    address public constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;

    address public constant PAYEE_A = 0x9051F67F2F958469812CB86AeB58dD4878a88094; // 95%
    address public constant PAYEE_B = 0x29d362CcaE77075E83A5cfb09DF2ef4300B02bDd; // 5%

    uint256 public constant SHARE_A = 95;
    uint256 public constant SHARE_B = 5;
    uint256 public constant TOTAL_SHARES = 100;

    mapping(address => uint256) public released;

    function _totalReceived() internal view returns (uint256) {
        return IERC20(USDT).balanceOf(address(this)) + released[PAYEE_A] + released[PAYEE_B];
    }

    function pending(address account) public view returns (uint256) {
        require(account == PAYEE_A || account == PAYEE_B, "not a payee");
        uint256 share = (account == PAYEE_A) ? SHARE_A : SHARE_B;
        uint256 due = (_totalReceived() * share) / TOTAL_SHARES;
        uint256 already = released[account];
        return due > already ? (due - already) : 0;
    }

    function release() external {
        require(msg.sender == PAYEE_A || msg.sender == PAYEE_B, "not a payee");
        uint256 amount = pending(msg.sender);
        require(amount > 0, "nothing to release");
        released[msg.sender] += amount;
        require(IERC20(USDT).transfer(msg.sender, amount), "transfer failed");
    }
}

Tags:
addr:0xfbcb6b7bc18d0a900252cfecbbcf1bd69e73ca58|verified:true|block:23485576|tx:0x042af2e466a03954ead0ff641d38724e99895a3143a034bb579f4fc2f826f04e|first_check:1759388189

Submitted on: 2025-10-02 08:56:29

Comments

Log in to comment.

No comments yet.