ETH Price: $3,216.25 (+0.68%)

Contract

0x643279f04cc0AaC0645879BFF4F304f07AA82884
 

Overview

ETH Balance

0.002521366500000001 ETH

Eth Value

$8.11 (@ $3,216.25/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim185902482023-11-17 7:55:35362 days ago1700207735IN
0x643279f0...07AA82884
0 ETH0.0011867721
Claim185892972023-11-17 4:43:47362 days ago1700196227IN
0x643279f0...07AA82884
0 ETH0.0007747821.02487096
Claim182682712023-10-03 6:38:23407 days ago1696315103IN
0x643279f0...07AA82884
0 ETH0.000362166.40852718
Claim182636442023-10-02 15:08:23408 days ago1696259303IN
0x643279f0...07AA82884
0 ETH0.0006856817.39738648
Claim182419262023-09-29 14:20:35411 days ago1695997235IN
0x643279f0...07AA82884
0 ETH0.0023346341.31151276
0x60806040181399492023-09-15 6:50:11425 days ago1694760611IN
 Create: FeeCollector
0 ETH0.005350419.74964002

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
186422922023-11-24 14:54:59355 days ago1700837699
0x643279f0...07AA82884
0.00002818 ETH
186188812023-11-21 8:14:35358 days ago1700554475
0x643279f0...07AA82884
0.00003723 ETH
186188012023-11-21 7:57:59358 days ago1700553479
0x643279f0...07AA82884
0.00007395 ETH
186187762023-11-21 7:52:59358 days ago1700553179
0x643279f0...07AA82884
0.00021373 ETH
185902482023-11-17 7:55:35362 days ago1700207735
0x643279f0...07AA82884
0.00124396 ETH
185892972023-11-17 4:43:47362 days ago1700196227
0x643279f0...07AA82884
0.00964305 ETH
185338832023-11-09 10:46:59370 days ago1699526819
0x643279f0...07AA82884
0.00088483 ETH
185338572023-11-09 10:41:47370 days ago1699526507
0x643279f0...07AA82884
0.00005128 ETH
184618122023-10-30 8:34:11380 days ago1698654851
0x643279f0...07AA82884
0.00001254 ETH
184399062023-10-27 6:58:47383 days ago1698389927
0x643279f0...07AA82884
0.00001254 ETH
184258262023-10-25 7:40:11385 days ago1698219611
0x643279f0...07AA82884
0.00001254 ETH
183741512023-10-18 2:05:35393 days ago1697594735
0x643279f0...07AA82884
0.00090127 ETH
183259012023-10-11 8:06:23399 days ago1697011583
0x643279f0...07AA82884
0.00075734 ETH
182695392023-10-03 10:53:11407 days ago1696330391
0x643279f0...07AA82884
0.00023083 ETH
182695202023-10-03 10:49:23407 days ago1696330163
0x643279f0...07AA82884
0.00035367 ETH
182694302023-10-03 10:31:11407 days ago1696329071
0x643279f0...07AA82884
0.00013418 ETH
182694112023-10-03 10:27:23407 days ago1696328843
0x643279f0...07AA82884
0.00032157 ETH
182694062023-10-03 10:26:11407 days ago1696328771
0x643279f0...07AA82884
0.00024001 ETH
182682712023-10-03 6:38:23407 days ago1696315103
0x643279f0...07AA82884
0.00127641 ETH
182682452023-10-03 6:33:11407 days ago1696314791
0x643279f0...07AA82884
0.0008527 ETH
182682192023-10-03 6:27:59407 days ago1696314479
0x643279f0...07AA82884
0.00084918 ETH
182677982023-10-03 5:03:35407 days ago1696309415
0x643279f0...07AA82884
0.00029621 ETH
182672492023-10-03 3:12:23408 days ago1696302743
0x643279f0...07AA82884
0.00023107 ETH
182637262023-10-02 15:24:47408 days ago1696260287
0x643279f0...07AA82884
0.00036819 ETH
182636442023-10-02 15:08:23408 days ago1696259303
0x643279f0...07AA82884
0.00160694 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeeCollector

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 3 : FeeCollector.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts/access/Ownable.sol";

contract FeeCollector is Ownable {
    // Variables
    uint public ownerFees;
    mapping(address => uint) public totalFees;
    mapping(address => uint) public totalClaimed;

    // Errors
    error CollectFail();
    error TransferFail();
    error ZeroTransfer();

    // Events
    event ReferrerCollect(address user, uint amount, uint id);
    event Collect(address user, uint amount);
    event Claim(address user, uint amount);

    /**
        @notice Collect protocol fees specifying referral address
        @param referrer the referrer address
        @param referrerAmount the amount that goes to referrer
        @return status
     */
    function collectWithReferral(
        address referrer,
        uint referrerAmount,
        uint id
    ) external payable returns (bool) {
        if (msg.value < referrerAmount) revert CollectFail();
        totalFees[referrer] = totalFees[referrer] + referrerAmount;
        emit ReferrerCollect(referrer, referrerAmount, id);
        ownerFees = ownerFees + msg.value - referrerAmount;
        emit Collect(owner(), msg.value - referrerAmount);
        return true;
    }

    /**
        @notice Collect protocol fees
        @return status
   */
    function collect() public payable returns (bool) {
        ownerFees = ownerFees + msg.value;
        emit Collect(owner(), msg.value);
        return true;
    }

    /**
        @notice Claim fees for msg.sender
   */
    function claim() public {
        claim(msg.sender);
    }

    /**
        @notice Claim fees for the specified user
        @param user the user address
   */
    function claim(address user) public {
        uint trfAmt;
        if (user == owner()) {
            trfAmt = ownerFees - 1;
            /// @dev it is cheaper to not zero balance
            ownerFees = 1;
        } else {
            trfAmt = totalFees[user] - totalClaimed[user];
            totalClaimed[user] = totalClaimed[user] + trfAmt;
        }
        _transfer(user, trfAmt);
        emit Claim(user, trfAmt);
    }

    /**
        @notice Internal function to transfer fees
        @param user the user address
        @param amt the amount of fees to transfer
   */
    function _transfer(address user, uint amt) internal {
        if (amt == 0) revert ZeroTransfer();
        (bool success, ) = payable(user).call{value: amt}("");
        if (!success) revert TransferFail();
    }

    /**
        @notice Transfer ownership of the contract
        @param newOwner the new owner address
   */
    function transferOwnership(address newOwner) public override onlyOwner {
        /// @dev only owner can transferOwnership so claim will claim owner's funds
        claim();
        _transferOwnership(newOwner);
    }

    // Fallback function
    fallback() external payable {
        collect();
    }

    // Receive function
    receive() external payable {
        collect();
    }
}

File 2 of 3 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

File 3 of 3 : 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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"CollectFail","type":"error"},{"inputs":[],"name":"TransferFail","type":"error"},{"inputs":[],"name":"ZeroTransfer","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ReferrerCollect","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"referrer","type":"address"},{"internalType":"uint256","name":"referrerAmount","type":"uint256"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"collectWithReferral","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61088a8061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b11610069578063e52253811161004e578063e5225381146101c4578063ef5d9ae8146101cc578063f2fde38b146101f9576100c4565b80638da5cb5b1461016c5780639ee53efb146101a1576100c4565b80634a793f2d1161009a5780634a793f2d146101155780634e71d92d14610142578063715018a614610157576100c4565b80631e83409a146100cc578063386cd8f1146100ec576100c4565b366100c4576100c2610219565b005b6100c2610219565b3480156100d857600080fd5b506100c26100e73660046107a4565b61029f565b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026101303660046107a4565b60026020526000908152604090205481565b34801561014e57600080fd5b506100c26103f8565b34801561016357600080fd5b506100c2610403565b34801561017857600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b6101b46101af3660046107c6565b610415565b604051901515815260200161010c565b6101b4610219565b3480156101d857600080fd5b506101026101e73660046107a4565b60036020526000908152604090205481565b34801561020557600080fd5b506100c26102143660046107a4565b61058c565b6000346001546102299190610828565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961026c60005473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff90921682523460208301520160405180910390a150600190565b6000805473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361030457600180546102f99190610841565b60018055905061039b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360209081526040808320546002909252909120546103409190610841565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054909150610374908290610828565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020555b6103a582826105a8565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a15050565b6104013361029f565b565b61040b610681565b6104016000610706565b600082341015610451576040517ff693587400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610482908490610828565b73ffffffffffffffffffffffffffffffffffffffff85166000818152600260209081526040918290209390935580519182529181018590529081018390527f0bb0438ba87c52009b3d6b41f5b89254d82fc234d83a4e395461eba3707df0d89060600160405180910390a182346001546104fc9190610828565b6105069190610841565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961054960005473ffffffffffffffffffffffffffffffffffffffff1690565b6105538534610841565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520160405180910390a15060019392505050565b610594610681565b61059c6103f8565b6105a581610706565b50565b806000036105e2576040517f10cadee300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461063c576040519150601f19603f3d011682016040523d82523d6000602084013e610641565b606091505b505090508061067c576040517f9c9e641c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461079f57600080fd5b919050565b6000602082840312156107b657600080fd5b6107bf8261077b565b9392505050565b6000806000606084860312156107db57600080fd5b6107e48461077b565b95602085013595506040909401359392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561083b5761083b6107f9565b92915050565b8181038181111561083b5761083b6107f956fea2646970667358221220a53898497ee5a89a5a44cda680bcdfdd66f3fe47d17b0ce658ca5cd7136d646264736f6c63430008130033

Deployed Bytecode

0x6080604052600436106100b55760003560e01c80638da5cb5b11610069578063e52253811161004e578063e5225381146101c4578063ef5d9ae8146101cc578063f2fde38b146101f9576100c4565b80638da5cb5b1461016c5780639ee53efb146101a1576100c4565b80634a793f2d1161009a5780634a793f2d146101155780634e71d92d14610142578063715018a614610157576100c4565b80631e83409a146100cc578063386cd8f1146100ec576100c4565b366100c4576100c2610219565b005b6100c2610219565b3480156100d857600080fd5b506100c26100e73660046107a4565b61029f565b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026101303660046107a4565b60026020526000908152604090205481565b34801561014e57600080fd5b506100c26103f8565b34801561016357600080fd5b506100c2610403565b34801561017857600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b6101b46101af3660046107c6565b610415565b604051901515815260200161010c565b6101b4610219565b3480156101d857600080fd5b506101026101e73660046107a4565b60036020526000908152604090205481565b34801561020557600080fd5b506100c26102143660046107a4565b61058c565b6000346001546102299190610828565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961026c60005473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff90921682523460208301520160405180910390a150600190565b6000805473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361030457600180546102f99190610841565b60018055905061039b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360209081526040808320546002909252909120546103409190610841565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054909150610374908290610828565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020555b6103a582826105a8565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a15050565b6104013361029f565b565b61040b610681565b6104016000610706565b600082341015610451576040517ff693587400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610482908490610828565b73ffffffffffffffffffffffffffffffffffffffff85166000818152600260209081526040918290209390935580519182529181018590529081018390527f0bb0438ba87c52009b3d6b41f5b89254d82fc234d83a4e395461eba3707df0d89060600160405180910390a182346001546104fc9190610828565b6105069190610841565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961054960005473ffffffffffffffffffffffffffffffffffffffff1690565b6105538534610841565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520160405180910390a15060019392505050565b610594610681565b61059c6103f8565b6105a581610706565b50565b806000036105e2576040517f10cadee300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461063c576040519150601f19603f3d011682016040523d82523d6000602084013e610641565b606091505b505090508061067c576040517f9c9e641c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461079f57600080fd5b919050565b6000602082840312156107b657600080fd5b6107bf8261077b565b9392505050565b6000806000606084860312156107db57600080fd5b6107e48461077b565b95602085013595506040909401359392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561083b5761083b6107f9565b92915050565b8181038181111561083b5761083b6107f956fea2646970667358221220a53898497ee5a89a5a44cda680bcdfdd66f3fe47d17b0ce658ca5cd7136d646264736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.