Accounts
0x4e...405e
0x4e...405e

0x4e...405e

$500
This contract's source code is verified!
Contract Metadata
Compiler
0.8.17+commit.8df45f5f
Language
Solidity
Contract Source Code
File 1 of 2: DistributeWrapper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {ISplitMain} from "./interfaces/ISplitMain.sol";

/// @title Wrapper for Distributing Splits
/// @notice This contract is a wrapper for split main.
///         It distributes splits only when the specified
///         amount of the token is present in the wallet.
/// @author Splits
contract DistributeWrapper {
    /* -------------------------------------------------------------------------- */
    /*                                   ERRORS                                   */
    /* -------------------------------------------------------------------------- */

    error AmountNotPresent();

    /* -------------------------------------------------------------------------- */
    /*                           CONSTANTS & IMMUTABLES                           */
    /* -------------------------------------------------------------------------- */

    ISplitMain public immutable SPLIT_MAIN;

    /* -------------------------------------------------------------------------- */
    /*                                 CONSTRUCTOR                                */
    /* -------------------------------------------------------------------------- */

    constructor(address _splitMain) {
        SPLIT_MAIN = ISplitMain(_splitMain);
    }

    /* -------------------------------------------------------------------------- */
    /*                                  FUNCTIONS                                 */
    /* -------------------------------------------------------------------------- */

    function distributeETH(
        address _split,
        address[] calldata _accounts,
        uint32[] calldata _percentAllocations,
        uint32 _distributorFee,
        address _distributorAddress,
        uint256 _amount
    ) external {
        if (SPLIT_MAIN.getETHBalance(_split) < _amount) revert AmountNotPresent();

        SPLIT_MAIN.distributeETH(_split, _accounts, _percentAllocations, _distributorFee, _distributorAddress);
    }

    function distributeERC20(
        address _split,
        address _token,
        address[] calldata _accounts,
        uint32[] calldata _percentAllocations,
        uint32 _distributorFee,
        address _distributorAddress,
        uint256 _amount
    ) external {
        if (SPLIT_MAIN.getERC20Balance(_split, _token) < _amount) revert AmountNotPresent();

        SPLIT_MAIN.distributeERC20(_split, _token, _accounts, _percentAllocations, _distributorFee, _distributorAddress);
    }
}
Contract Source Code
File 2 of 2: ISplitMain.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

interface ISplitMain {
    /// -----------------------------------------------------------------------
    /// events
    /// -----------------------------------------------------------------------

    event CreateSplit(
        address indexed split,
        address[] accounts,
        uint32[] percentAllocations,
        uint32 distributorFee,
        address controller
    );

    event UpdateSplit(address indexed split, address[] accounts, uint32[] percentAllocations, uint32 distributorFee);

    event InitiateControlTransfer(address indexed split, address indexed newPotentialController);

    event CancelControlTransfer(address indexed split);

    event ControlTransfer(address indexed split, address indexed previousController, address indexed newController);

    event DistributeETH(address indexed split, uint256 amount, address indexed distributorAddress);

    event DistributeERC20(
        address indexed split, address indexed token, uint256 amount, address indexed distributorAddress
    );

    event Withdrawal(address indexed account, uint256 ethAmount, address[] tokens, uint256[] tokenAmounts);

    /// -----------------------------------------------------------------------
    /// functions
    /// -----------------------------------------------------------------------

    function walletImplementation() external returns (address);

    function createSplit(
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee,
        address controller
    ) external returns (address);

    function predictImmutableSplitAddress(
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee
    ) external view returns (address);

    function updateSplit(
        address split,
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee
    ) external;

    function transferControl(address split, address newController) external;

    function cancelControlTransfer(address split) external;

    function acceptControl(address split) external;

    function makeSplitImmutable(address split) external;

    function distributeETH(
        address split,
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee,
        address distributorAddress
    ) external;

    function updateAndDistributeETH(
        address split,
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee,
        address distributorAddress
    ) external;

    function distributeERC20(
        address split,
        address token,
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee,
        address distributorAddress
    ) external;

    function updateAndDistributeERC20(
        address split,
        address token,
        address[] calldata accounts,
        uint32[] calldata percentAllocations,
        uint32 distributorFee,
        address distributorAddress
    ) external;

    function withdraw(address account, uint256 withdrawETH, address[] calldata tokens) external;

    function getHash(address split) external view returns (bytes32);

    function getController(address split) external view returns (address);

    function getERC20Balance(address account, address token) external view returns (uint256);

    function getETHBalance(address account) external view returns (uint256);
}
Settings
{
  "compilationTarget": {
    "src/DistributeWrapper.sol": "DistributeWrapper"
  },
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [
    ":ds-test/=lib/forge-std/lib/ds-test/src/",
    ":forge-std/=lib/forge-std/src/",
    ":solady/=lib/solady/src/",
    ":solmate/=lib/solmate/src/"
  ]
}
ABI
[{"inputs":[{"internalType":"address","name":"_splitMain","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountNotPresent","type":"error"},{"inputs":[],"name":"SPLIT_MAIN","outputs":[{"internalType":"contract ISplitMain","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_split","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint32[]","name":"_percentAllocations","type":"uint32[]"},{"internalType":"uint32","name":"_distributorFee","type":"uint32"},{"internalType":"address","name":"_distributorAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"distributeERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_split","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint32[]","name":"_percentAllocations","type":"uint32[]"},{"internalType":"uint32","name":"_distributorFee","type":"uint32"},{"internalType":"address","name":"_distributorAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"distributeETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]