Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0xd80B347FCe4364f157C7d2b50BA4B1933196D370
Balance 0.000315335 ETH ($0.65)
Nonce 1
Code Size 2862 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2862 bytes
0x60806040526004361061008a5760003560e01c8063b571503111610059578063b57150311461011a578063d93be8f31461013a578063e4fc6b6d14610167578063f2fde38b1461017c578063f8e9273a1461019c57610091565b8063715018a6146100965780638277d2ea146100ad5780638da5cb5b146100cd578063b4cf04ff146100f857610091565b3661009157005b600080fd5b3480156100a257600080fd5b506100ab6101c9565b005b3480156100b957600080fd5b506100ab6100c83660046107cc565b61021d565b3480156100d957600080fd5b506100e261037b565b6040516100ef91906108c6565b60405180910390f35b34801561010457600080fd5b5061010d61038a565b6040516100ef9190610a50565b34801561012657600080fd5b506100ab610135366004610792565b610390565b34801561014657600080fd5b5061015a610155366004610771565b6103fa565b6040516100ef9190610931565b34801561017357600080fd5b506100ab61040f565b34801561018857600080fd5b506100ab610197366004610771565b6105bb565b3480156101a857600080fd5b506101bc6101b736600461089e565b61062c565b6040516100ef9190610a30565b6101d161066a565b6001600160a01b03166101e261037b565b6001600160a01b0316146102115760405162461bcd60e51b8152600401610208906109fb565b60405180910390fd5b61021b600061066e565b565b61022561066a565b6001600160a01b031661023661037b565b6001600160a01b03161461025c5760405162461bcd60e51b8152600401610208906109fb565b6003541561026c5761026c61040f565b6000805b828110156102c15783838281811061029857634e487b7160e01b600052603260045260246000fd5b90506040020160200135826102ad9190610a70565b9150806102b981610ac7565b915050610270565b50806064146102e25760405162461bcd60e51b8152600401610208906109b9565b61033d8383808060200260200160405190810160405280939291908181526020016000905b82821015610333576103246040830286013681900381019061083c565b81526020019060010190610307565b50505050506106be565b7f4f8a6a7dfa6178a813d32a68a4bd3411ecf0cbeb476030701293a386b9ce6dd1838360405161036e9291906108da565b60405180910390a1505050565b6000546001600160a01b031690565b60035481565b61039861066a565b6001600160a01b03166103a961037b565b6001600160a01b0316146103cf5760405162461bcd60e51b8152600401610208906109fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b60016020526000908152604090205460ff1681565b60035461042e5760405162461bcd60e51b81526004016102089061093c565b476104385761021b565b4760005b60035481101561057757600081815260026020526040812080546001909101546001600160a01b0390911691906064906104769086610aa8565b6104809190610a88565b6001600160a01b03831660009081526001602052604090205490915060ff161561050557816001600160a01b0316816040516104bb906108b6565b60006040518083038185875af1925050503d80600081146104f8576040519150601f19603f3d011682016040523d82523d6000602084013e6104fd565b606091505b505050610562565b816001600160a01b03168160405161051c906108c3565b60006040518083038185875af1925050503d8060008114610559576040519150601f19603f3d011682016040523d82523d6000602084013e61055e565b606091505b5050505b5050808061056f90610ac7565b91505061043c565b507f6f0c43eb568796d764f36f0413e491b0b334101cb8b6288756cd9b76a8c00f8a816105a261066a565b6040516105b0929190610a59565b60405180910390a150565b6105c361066a565b6001600160a01b03166105d461037b565b6001600160a01b0316146105fa5760405162461bcd60e51b8152600401610208906109fb565b6001600160a01b0381166106205760405162461bcd60e51b815260040161020890610973565b6106298161066e565b50565b610634610743565b50600081815260026020908152604091829020825180840190935280546001600160a01b0316835260010154908201525b919050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805160035560005b815181101561073f578181815181106106ef57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015160008381526002835260409020815181546001600160a01b0319166001600160a01b039091161781559101516001909101558061073781610ac7565b9150506106c6565b5050565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461066557600080fd5b600060208284031215610782578081fd5b61078b8261075a565b9392505050565b600080604083850312156107a4578081fd5b6107ad8361075a565b9150602083013580151581146107c1578182fd5b809150509250929050565b600080602083850312156107de578182fd5b823567ffffffffffffffff808211156107f5578384fd5b818501915085601f830112610808578384fd5b813581811115610816578485fd5b86602060408302850101111561082a578485fd5b60209290920196919550909350505050565b60006040828403121561084d578081fd5b6040516040810181811067ffffffffffffffff8211171561087c57634e487b7160e01b83526041600452602483fd5b6040526108888361075a565b8152602083013560208201528091505092915050565b6000602082840312156108af578081fd5b5035919050565b606160f81b815260010190565b90565b6001600160a01b0391909116815260200190565b6020808252818101839052600090604080840186845b87811015610924576001600160a01b036109098361075a565b168352818501358584015291830191908301906001016108f0565b5090979650505050505050565b901515815260200190565b6020808252601a908201527f4d757374206861766520646973747269627574696f6e20736574000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f546f74616c2070657263656e74616765206d75737420657175616c20746f2031604082015261030360f41b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b81516001600160a01b031681526020918201519181019190915260400190565b90815260200190565b9182526001600160a01b0316602082015260400190565b60008219821115610a8357610a83610ae2565b500190565b600082610aa357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610ac257610ac2610ae2565b500290565b6000600019821415610adb57610adb610ae2565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204d560d6f30beb83bc058f66787b9d751602878147e14d8c3b3c1b2a9e6b06e0664736f6c63430008000033

Verified Source Code Full Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: Yes (200 runs)
taxDistributor.sol 187 lines
// SPDX-License-Identifier: Unlicensed

pragma solidity ^0.8.0;

interface ITaxDistributor {
    struct DistributeTo {
        address addr;
        uint256 percentage;
    }
    event DistributeToChanged(DistributeTo[] _distributeTo);

    function distributeTo(uint256 index)
        external
        view
        returns (DistributeTo memory);

    function distributeToCount() external view returns (uint256);

    event Distributed(uint256 amount, address sender);

    function distribute() external;
}



pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

pragma solidity ^0.8.0;


/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

pragma solidity ^0.8.0;

contract TaxDistributor is ITaxDistributor, Ownable {
    mapping(address => bool) public isCallData;
    mapping(uint256 => DistributeTo) private distributeTo_;
    
    function distributeTo(uint256 index)
        external
        view
        override
        returns (DistributeTo memory)
    {
        return distributeTo_[index];
    }

    uint256 public override distributeToCount;

    function addArrayToMapping(DistributeTo[] memory array) private {
        distributeToCount = array.length;
        for (uint256 i; i < array.length; i++) {
            distributeTo_[i] = array[i];
        }
    }

    function setDistributeTo(DistributeTo[] calldata toDistributeTo)
        external
        onlyOwner
    {
        if (distributeToCount != 0) distribute();
        uint256 totalPercentage;
        for (uint256 i; i < toDistributeTo.length; i++) {
            totalPercentage += toDistributeTo[i].percentage;
        }
        require(totalPercentage == 100, "Total percentage must equal to 100");

        addArrayToMapping(toDistributeTo);
        emit DistributeToChanged(toDistributeTo);
    }

    function setisCallData(address _address, bool onoff) external onlyOwner {
        isCallData[_address] = onoff;
    }

    function distribute() public override {
        require(distributeToCount != 0, "Must have distribution set");
        if (address(this).balance == 0) return;
        uint256 totalBalance = address(this).balance;

        for (uint256 i; i < distributeToCount; i++) {
            address to = distributeTo_[i].addr;
            uint256 amount = totalBalance * distributeTo_[i].percentage / 100;
            if (isCallData[to]) {
            // Calls with non empty calldata to trigger fallback()
                payable(to).call{value: amount} ("a"); 
            }
            else {
                payable(to).call{value: amount} ("");
            }
        }
        emit Distributed(totalBalance, _msgSender());
    }

    // solhint-disable-next-line
    receive() external payable {}
}

Read Contract

distributeTo 0xf8e9273a → tuple
distributeToCount 0xb4cf04ff → uint256
isCallData 0xd93be8f3 → bool
owner 0x8da5cb5b → address

Write Contract 5 functions

These functions modify contract state and require a wallet transaction to execute.

distribute 0xe4fc6b6d
No parameters
renounceOwnership 0x715018a6
No parameters
setDistributeTo 0xeec34e13
tuple[] toDistributeTo
setisCallData 0xb5715031
address _address
bool onoff
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address