contract PaymentSplitter is Ownable { 
    using SafeMath for uint256;
    event PaymentReleased(address[] to, uint256[] amount);
    event PaymentReceived(address from, uint256 amount);

    

   

    //mapping(IERC20 => uint256) private _erc20TotalReleased;
    //mapping(IERC20 => mapping(address => uint256)) private _erc20Released;

    /**
     * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
     * the matching position in the `shares` array.
     *
     * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
     * duplicates in `payees`.
     */
    constructor() payable {
        address  msgSender = _msgSender();
        _owner = payable(msgSender);
    }

    /**
     * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
     * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
     * reliability of the events, and not the actual splitting of Ether.
     *
     * To learn more about this see the Solidity documentation for
     * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
     * functions].
     */
    receive() external payable virtual {
        emit PaymentReceived(_msgSender(), msg.value);
    }
    
    
    function balanceof() public view{
         address(this).balance;
    }  
    
     function withdraw() public onlyOwner{
          address payable msgSender = payable(msg.sender);
            return payable(msgSender).transfer(address(this).balance);
    }


   
    
    function multisendEther(address payable[] memory _contributors, uint256[] memory _balances) public payable {
        uint256 total = msg.value;
        uint256 i = 0;
        for (i; i < _contributors.length; i++) {
            require(total >= _balances[i]);
            total = total.sub(_balances[i]);
            _contributors[i].transfer(_balances[i]);
            
        }
        if(total > 0){
            payable(msg.sender).transfer(total);
        }
            
        
        
    }
   
}
/**
 * @title PaymentSplitter
 * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
 * that the Ether will be split in this way, since it is handled transparently by the contract.
 *
 * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
 * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
 * an amount proportional to the percentage of total shares they were assigned.
 *
 * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
 * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
 * function.
 *
 * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
 * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
 * to run tests before sending real value to this contract.
 */
/**
 * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
 * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
 * reliability of the events, and not the actual splitting of Ether.
 *
 * To learn more about this see the Solidity documentation for
 * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
 * functions].
 */