Skip to content
Verified contractPartial

Multiplexer

Address0x7b138cc83ecccd6331cd7651c75ee3eb2ec6682e
Balance

0 ETH

 

Transactions

143

 

Compiler

solc 0.4.16

 

Same code

Only this contract

 

Details

Compiler
solc 0.4.16+commit.d7661dd9
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
8,998,458
Creation transaction
0xce64473202…e941bfbd8b

Multiplexer.sol

pragma solidity ^0.4.15;
contract Ownable {
    address public owner;
    function Ownable() public {
        owner = msg.sender;
    }
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
}
contract Feeable is Ownable {
    uint8 public feePercent;
    function Feeable() public {
        feePercent = 50;
    }
    function setFeePercent(uint8 _feePercent) public onlyOwner {
        feePercent = _feePercent;
    }
    function minFee() public view returns(uint256) {
        return tx.gasprice * msg.gas * feePercent / 100;
    }
}
contract ERC20 {
    function balanceOf(address who) public view returns (uint256);
    function transfer(address to, uint256 value) public returns (bool);
    function transferFrom( address from, address to, uint value) returns (bool ok);
}
contract Multiplexer is Feeable {
    function sendEth(address[] _to, uint256[] _value) payable returns (bool _success) {
        assert(_to.length == _value.length);
        assert(_to.length <= 255);
        require(msg.value >= minFee());
        for (uint8 i = 0; i < _to.length; i++) {
            _to[i].transfer(_value[i]);
        }
        return true;
    }
    function sendErc20(address _tokenAddress, address[] _to, uint256[] _value) payable returns (bool _success) {
        assert(_to.length == _value.length);
        assert(_to.length <= 255);
        require(msg.value >= minFee());
        ERC20 token = ERC20(_tokenAddress);
        for (uint8 i = 0; i < _to.length; i++) {
            assert(token.transferFrom(msg.sender, _to[i], _value[i]) == true);
        }
        return true;
    }
    function claim(address _token) public onlyOwner {
        if (_token == 0x0) {
            owner.transfer(this.balance);
            return;
        }
        ERC20 erc20token = ERC20(_token);
        uint256 balance = erc20token.balanceOf(this);
        erc20token.transfer(owner, balance);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.