Overview
ETH Balance
0.002521366500000001 ETH
Eth Value
$8.11 (@ $3,216.25/ETH)More Info
Private Name Tags
ContractCreator
Latest 6 from a total of 6 transactions
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
18642292 | 355 days ago | 0.00002818 ETH | ||||
18618881 | 358 days ago | 0.00003723 ETH | ||||
18618801 | 358 days ago | 0.00007395 ETH | ||||
18618776 | 358 days ago | 0.00021373 ETH | ||||
18590248 | 362 days ago | 0.00124396 ETH | ||||
18589297 | 362 days ago | 0.00964305 ETH | ||||
18533883 | 370 days ago | 0.00088483 ETH | ||||
18533857 | 370 days ago | 0.00005128 ETH | ||||
18461812 | 380 days ago | 0.00001254 ETH | ||||
18439906 | 383 days ago | 0.00001254 ETH | ||||
18425826 | 385 days ago | 0.00001254 ETH | ||||
18374151 | 393 days ago | 0.00090127 ETH | ||||
18325901 | 399 days ago | 0.00075734 ETH | ||||
18269539 | 407 days ago | 0.00023083 ETH | ||||
18269520 | 407 days ago | 0.00035367 ETH | ||||
18269430 | 407 days ago | 0.00013418 ETH | ||||
18269411 | 407 days ago | 0.00032157 ETH | ||||
18269406 | 407 days ago | 0.00024001 ETH | ||||
18268271 | 407 days ago | 0.00127641 ETH | ||||
18268245 | 407 days ago | 0.0008527 ETH | ||||
18268219 | 407 days ago | 0.00084918 ETH | ||||
18267798 | 407 days ago | 0.00029621 ETH | ||||
18267249 | 408 days ago | 0.00023107 ETH | ||||
18263726 | 408 days ago | 0.00036819 ETH | ||||
18263644 | 408 days ago | 0.00160694 ETH |
Loading...
Loading
Contract Name:
FeeCollector
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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(); } }
// 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); } }
// 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; } }
{ "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61088a8061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b11610069578063e52253811161004e578063e5225381146101c4578063ef5d9ae8146101cc578063f2fde38b146101f9576100c4565b80638da5cb5b1461016c5780639ee53efb146101a1576100c4565b80634a793f2d1161009a5780634a793f2d146101155780634e71d92d14610142578063715018a614610157576100c4565b80631e83409a146100cc578063386cd8f1146100ec576100c4565b366100c4576100c2610219565b005b6100c2610219565b3480156100d857600080fd5b506100c26100e73660046107a4565b61029f565b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026101303660046107a4565b60026020526000908152604090205481565b34801561014e57600080fd5b506100c26103f8565b34801561016357600080fd5b506100c2610403565b34801561017857600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b6101b46101af3660046107c6565b610415565b604051901515815260200161010c565b6101b4610219565b3480156101d857600080fd5b506101026101e73660046107a4565b60036020526000908152604090205481565b34801561020557600080fd5b506100c26102143660046107a4565b61058c565b6000346001546102299190610828565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961026c60005473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff90921682523460208301520160405180910390a150600190565b6000805473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361030457600180546102f99190610841565b60018055905061039b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360209081526040808320546002909252909120546103409190610841565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054909150610374908290610828565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020555b6103a582826105a8565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a15050565b6104013361029f565b565b61040b610681565b6104016000610706565b600082341015610451576040517ff693587400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610482908490610828565b73ffffffffffffffffffffffffffffffffffffffff85166000818152600260209081526040918290209390935580519182529181018590529081018390527f0bb0438ba87c52009b3d6b41f5b89254d82fc234d83a4e395461eba3707df0d89060600160405180910390a182346001546104fc9190610828565b6105069190610841565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961054960005473ffffffffffffffffffffffffffffffffffffffff1690565b6105538534610841565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520160405180910390a15060019392505050565b610594610681565b61059c6103f8565b6105a581610706565b50565b806000036105e2576040517f10cadee300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461063c576040519150601f19603f3d011682016040523d82523d6000602084013e610641565b606091505b505090508061067c576040517f9c9e641c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461079f57600080fd5b919050565b6000602082840312156107b657600080fd5b6107bf8261077b565b9392505050565b6000806000606084860312156107db57600080fd5b6107e48461077b565b95602085013595506040909401359392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561083b5761083b6107f9565b92915050565b8181038181111561083b5761083b6107f956fea2646970667358221220a53898497ee5a89a5a44cda680bcdfdd66f3fe47d17b0ce658ca5cd7136d646264736f6c63430008130033
Deployed Bytecode
0x6080604052600436106100b55760003560e01c80638da5cb5b11610069578063e52253811161004e578063e5225381146101c4578063ef5d9ae8146101cc578063f2fde38b146101f9576100c4565b80638da5cb5b1461016c5780639ee53efb146101a1576100c4565b80634a793f2d1161009a5780634a793f2d146101155780634e71d92d14610142578063715018a614610157576100c4565b80631e83409a146100cc578063386cd8f1146100ec576100c4565b366100c4576100c2610219565b005b6100c2610219565b3480156100d857600080fd5b506100c26100e73660046107a4565b61029f565b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026101303660046107a4565b60026020526000908152604090205481565b34801561014e57600080fd5b506100c26103f8565b34801561016357600080fd5b506100c2610403565b34801561017857600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b6101b46101af3660046107c6565b610415565b604051901515815260200161010c565b6101b4610219565b3480156101d857600080fd5b506101026101e73660046107a4565b60036020526000908152604090205481565b34801561020557600080fd5b506100c26102143660046107a4565b61058c565b6000346001546102299190610828565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961026c60005473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff90921682523460208301520160405180910390a150600190565b6000805473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361030457600180546102f99190610841565b60018055905061039b565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360209081526040808320546002909252909120546103409190610841565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902054909150610374908290610828565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020555b6103a582826105a8565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a15050565b6104013361029f565b565b61040b610681565b6104016000610706565b600082341015610451576040517ff693587400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610482908490610828565b73ffffffffffffffffffffffffffffffffffffffff85166000818152600260209081526040918290209390935580519182529181018590529081018390527f0bb0438ba87c52009b3d6b41f5b89254d82fc234d83a4e395461eba3707df0d89060600160405180910390a182346001546104fc9190610828565b6105069190610841565b6001557f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc84999961054960005473ffffffffffffffffffffffffffffffffffffffff1690565b6105538534610841565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520160405180910390a15060019392505050565b610594610681565b61059c6103f8565b6105a581610706565b50565b806000036105e2576040517f10cadee300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461063c576040519150601f19603f3d011682016040523d82523d6000602084013e610641565b606091505b505090508061067c576040517f9c9e641c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461079f57600080fd5b919050565b6000602082840312156107b657600080fd5b6107bf8261077b565b9392505050565b6000806000606084860312156107db57600080fd5b6107e48461077b565b95602085013595506040909401359392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561083b5761083b6107f9565b92915050565b8181038181111561083b5761083b6107f956fea2646970667358221220a53898497ee5a89a5a44cda680bcdfdd66f3fe47d17b0ce658ca5cd7136d646264736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 100.00% | $3,216.25 | 0.00252137 | $8.11 |
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.