Contract Address Details

0x5Ef2588408e71cBDBf79d209ACa3F5dAB3bC5462

Contract Name
Distributor
Creator
0x3dd69e–c1be18 at 0x6fc374–ee8c6c
Balance
0 REI
Tokens
Fetching tokens...
Transactions
1,012 Transactions
Transfers
1,038 Transfers
Gas Used
71,243,273
Last Balance Update
306058
Contract name:
Distributor




Optimization enabled
false
Compiler version
v0.8.14+commit.80d49f37




Verified at
2022-05-26T01:36:09.964079Z

Constructor Arguments

000000000000000000000000afa6ee9ed18323c9c92c40b82c8c8e451807c911

Arg [0] (address) : 0xafa6ee9ed18323c9c92c40b82c8c8e451807c911

              

contracts/Distributor.sol

//SPDX-License-Identifier: MIT
pragma solidity 0.8.14;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract Distributor is Ownable {
    event SetSender(address sender);
    event Distribute(uint256 tx, address indexed token, address indexed to, uint256 amount);
    event AdminWithdraw(address admin, address token, uint256 amount);

    mapping (uint256 => bool) public okTx;
    address public sender;

    constructor(address sender_) {
        setSender(sender_);
    }

    function setSender(address sender_) public onlyOwner {
        sender = sender_;
        emit SetSender(sender_);
    }

    modifier onlySender {
        require(msg.sender == sender, "!sender");
        _;
    }

    function distribute(uint256 txId, address token, address to, uint256 amount) external onlySender {
        require(!okTx[txId], "tx ok");
        okTx[txId] = true;

        IERC20(token).transfer(to, amount);
        emit Distribute(txId, token, to, amount);
    }

    function availableToken(address token) external view returns (uint256) {
        return IERC20(token).balanceOf(address(this));
    }

    function adminWithdraw(address token, uint256 amount) external onlyOwner {
        IERC20(token).transfer(msg.sender, amount);
        emit AdminWithdraw(msg.sender, token, amount);
    }
}
        

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @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() {
        _transferOwnership(_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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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;
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"sender_","internalType":"address"}]},{"type":"event","name":"AdminWithdraw","inputs":[{"type":"address","name":"admin","internalType":"address","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Distribute","inputs":[{"type":"uint256","name":"tx","internalType":"uint256","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetSender","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"adminWithdraw","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"availableToken","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"distribute","inputs":[{"type":"uint256","name":"txId","internalType":"uint256"},{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"okTx","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"sender","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSender","inputs":[{"type":"address","name":"sender_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c806367e404ce1161006657806367e404ce14610130578063715018a61461014e5780638da5cb5b14610158578063ced32b0c14610176578063f2fde38b1461019257610093565b8063257d78f81461009857806326711f2b146100c8578063401d4482146100f85780635a634c3f14610114575b600080fd5b6100b260048036038101906100ad9190610987565b6101ae565b6040516100bf91906109cd565b60405180910390f35b6100e260048036038101906100dd9190610a14565b610231565b6040516100ef9190610a5c565b60405180910390f35b610112600480360381019061010d9190610a77565b610251565b005b61012e60048036038101906101299190610ab7565b61038b565b005b610138610593565b6040516101459190610b2d565b60405180910390f35b6101566105b9565b005b610160610641565b60405161016d9190610b2d565b60405180910390f35b610190600480360381019061018b9190610987565b61066a565b005b6101ac60048036038101906101a79190610987565b610761565b005b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101e99190610b2d565b602060405180830381865afa158015610206573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022a9190610b5d565b9050919050565b60016020528060005260406000206000915054906101000a900460ff1681565b610259610858565b73ffffffffffffffffffffffffffffffffffffffff16610277610641565b73ffffffffffffffffffffffffffffffffffffffff16146102cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c490610be7565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610308929190610c07565b6020604051808303816000875af1158015610327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034b9190610c5c565b507f161606060226919b11c1d9bfb2faed8a1e87797913553dbdd2e992a468ce711a33838360405161037f93929190610c89565b60405180910390a15050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461041b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041290610d0c565b60405180910390fd5b6001600085815260200190815260200160002060009054906101000a900460ff161561047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610d78565b60405180910390fd5b600180600086815260200190815260200160002060006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016104e2929190610c07565b6020604051808303816000875af1158015610501573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105259190610c5c565b508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f5d0e904318df6c404b1843c9d2d33261ba4bb63cd11449a8d14ab6b6334a38ba8684604051610585929190610d98565b60405180910390a350505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6105c1610858565b73ffffffffffffffffffffffffffffffffffffffff166105df610641565b73ffffffffffffffffffffffffffffffffffffffff1614610635576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062c90610be7565b60405180910390fd5b61063f6000610860565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610672610858565b73ffffffffffffffffffffffffffffffffffffffff16610690610641565b73ffffffffffffffffffffffffffffffffffffffff16146106e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106dd90610be7565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f3f61e183128e8b0775a132afd07eb6b4d74e1e66d7de3c5fbb7a6349b1207b66816040516107569190610b2d565b60405180910390a150565b610769610858565b73ffffffffffffffffffffffffffffffffffffffff16610787610641565b73ffffffffffffffffffffffffffffffffffffffff16146107dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d490610be7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390610e33565b60405180910390fd5b61085581610860565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061095482610929565b9050919050565b61096481610949565b811461096f57600080fd5b50565b6000813590506109818161095b565b92915050565b60006020828403121561099d5761099c610924565b5b60006109ab84828501610972565b91505092915050565b6000819050919050565b6109c7816109b4565b82525050565b60006020820190506109e260008301846109be565b92915050565b6109f1816109b4565b81146109fc57600080fd5b50565b600081359050610a0e816109e8565b92915050565b600060208284031215610a2a57610a29610924565b5b6000610a38848285016109ff565b91505092915050565b60008115159050919050565b610a5681610a41565b82525050565b6000602082019050610a716000830184610a4d565b92915050565b60008060408385031215610a8e57610a8d610924565b5b6000610a9c85828601610972565b9250506020610aad858286016109ff565b9150509250929050565b60008060008060808587031215610ad157610ad0610924565b5b6000610adf878288016109ff565b9450506020610af087828801610972565b9350506040610b0187828801610972565b9250506060610b12878288016109ff565b91505092959194509250565b610b2781610949565b82525050565b6000602082019050610b426000830184610b1e565b92915050565b600081519050610b57816109e8565b92915050565b600060208284031215610b7357610b72610924565b5b6000610b8184828501610b48565b91505092915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610bd1602083610b8a565b9150610bdc82610b9b565b602082019050919050565b60006020820190508181036000830152610c0081610bc4565b9050919050565b6000604082019050610c1c6000830185610b1e565b610c2960208301846109be565b9392505050565b610c3981610a41565b8114610c4457600080fd5b50565b600081519050610c5681610c30565b92915050565b600060208284031215610c7257610c71610924565b5b6000610c8084828501610c47565b91505092915050565b6000606082019050610c9e6000830186610b1e565b610cab6020830185610b1e565b610cb860408301846109be565b949350505050565b7f2173656e64657200000000000000000000000000000000000000000000000000600082015250565b6000610cf6600783610b8a565b9150610d0182610cc0565b602082019050919050565b60006020820190508181036000830152610d2581610ce9565b9050919050565b7f7478206f6b000000000000000000000000000000000000000000000000000000600082015250565b6000610d62600583610b8a565b9150610d6d82610d2c565b602082019050919050565b60006020820190508181036000830152610d9181610d55565b9050919050565b6000604082019050610dad60008301856109be565b610dba60208301846109be565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610e1d602683610b8a565b9150610e2882610dc1565b604082019050919050565b60006020820190508181036000830152610e4c81610e10565b905091905056fea2646970667358221220dc94a5f5e20b240c9871ca00b576b664b98d042f927617c271079e950ca4478b64736f6c634300080e0033