Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xAfe06479...2C476C9FD The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MiningFee
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.19;
import {BasicAccessControl} from "../shared/BasicAccessControl.sol";
contract MiningFee is BasicAccessControl {
event Fee(address owner, uint256 amount, uint256 createAt);
struct UserFee {
FEE_STATUS status;
uint256 createdAt;
uint256 updatedAt;
}
enum FEE_STATUS {
NONE,
NO_FEE,
FEE
}
mapping(address => UserFee) public userFeeStatus;
uint256 public fee = 1 ether;
uint256 public resetTime = 24 hours;
function mineWithFee() external payable {
require(msg.value == fee, "Fee provided is insufficient");
UserFee storage userFee = userFeeStatus[msg.sender];
uint256 currentTime = block.timestamp;
uint256 resetTimeExpirey = userFee.updatedAt + resetTime;
require(
currentTime > resetTimeExpirey ||
userFee.status == FEE_STATUS.NO_FEE ||
userFee.status == FEE_STATUS.NONE,
"User already paid the fee"
);
uint256 createdAt = userFee.createdAt;
if (createdAt == 0) userFee.createdAt = currentTime;
userFee.updatedAt = currentTime;
userFee.status = FEE_STATUS.FEE;
emit Fee(msg.sender, msg.value, block.timestamp);
}
function mineWithNoFee() external payable {
require(msg.value == 0, "No fee required");
UserFee storage userFee = userFeeStatus[msg.sender];
uint256 currentTime = block.timestamp;
uint256 resetTimeExpirey = userFee.updatedAt + resetTime;
require(
currentTime > resetTimeExpirey ||
userFeeStatus[msg.sender].status == FEE_STATUS.NONE,
"User already paid the fee"
);
uint256 createdAt = userFee.createdAt;
if (createdAt == 0) userFee.createdAt = currentTime;
userFee.updatedAt = currentTime;
userFee.status = FEE_STATUS.NO_FEE;
emit Fee(msg.sender, 0, block.timestamp);
}
function updateFee(uint256 _fee) external onlyModerators {
fee = _fee;
}
function updateResetTime(uint256 _resetTime) external onlyModerators {
resetTime = _resetTime;
}
function withdraw() external onlyOwner {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success, "transfer failed");
}
}// 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 (last updated v4.9.4) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.2;
import "@openzeppelin/contracts/access/Ownable.sol";
contract BasicAccessControl is Ownable {
uint16 public totalModerators = 0;
mapping(address => bool) public moderators;
bool public isMaintaining = false;
modifier onlyModerators() {
require(
_msgSender() == owner() || moderators[_msgSender()] == true,
"Restricted Access!"
);
_;
}
modifier isActive() {
require(!isMaintaining);
_;
}
function addModerator(address _newModerator) public onlyOwner {
if (moderators[_newModerator] == false) {
moderators[_newModerator] = true;
totalModerators += 1;
} else {
delete moderators[_newModerator];
totalModerators -= 1;
}
}
function updateMaintaining(bool _isMaintaining) public onlyOwner {
isMaintaining = _isMaintaining;
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"createAt","type":"uint256"}],"name":"Fee","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"},{"inputs":[{"internalType":"address","name":"_newModerator","type":"address"}],"name":"addModerator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMaintaining","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mineWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mineWithNoFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"moderators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalModerators","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"updateFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isMaintaining","type":"bool"}],"name":"updateMaintaining","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_resetTime","type":"uint256"}],"name":"updateResetTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userFeeStatus","outputs":[{"internalType":"enum MiningFee.FEE_STATUS","name":"status","type":"uint8"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
0x60806040526000805461ffff60a01b191690556002805460ff19169055670de0b6b3a76400006004556201518060055534801561003b57600080fd5b506100453361004a565b61009a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610ac9806100a96000396000f3fe6080604052600436106100f35760003560e01c80639012c4a81161008a578063d32ca9d211610059578063d32ca9d2146102a9578063ddca3f43146102c9578063ee4e4416146102df578063f2fde38b146102f957600080fd5b80639012c4a814610212578063b532e4cb14610232578063b9cd1a3b14610252578063ba4a7fba1461025a57600080fd5b806365a114f1116100c657806365a114f1146101915780636d9b2c56146101b5578063715018a6146101d55780638da5cb5b146101ea57600080fd5b8063090f0baf146100f857806314d0f1ba146101025780633ccfd60b146101475780634efb023e1461015c575b600080fd5b610100610319565b005b34801561010e57600080fd5b5061013261011d366004610970565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561015357600080fd5b50610100610492565b34801561016857600080fd5b5060005461017e90600160a01b900461ffff1681565b60405161ffff909116815260200161013e565b34801561019d57600080fd5b506101a760055481565b60405190815260200161013e565b3480156101c157600080fd5b506101006101d03660046109a0565b610527565b3480156101e157600080fd5b5061010061059b565b3480156101f657600080fd5b506000546040516001600160a01b03909116815260200161013e565b34801561021e57600080fd5b5061010061022d3660046109a0565b6105af565b34801561023e57600080fd5b5061010061024d366004610970565b610623565b6101006106ee565b34801561026657600080fd5b5061029a610275366004610970565b60036020526000908152604090208054600182015460029092015460ff909116919083565b60405161013e939291906109cf565b3480156102b557600080fd5b506101006102c4366004610a05565b610835565b3480156102d557600080fd5b506101a760045481565b3480156102eb57600080fd5b506002546101329060ff1681565b34801561030557600080fd5b50610100610314366004610970565b610850565b600454341461036f5760405162461bcd60e51b815260206004820152601c60248201527f4665652070726f766964656420697320696e73756666696369656e740000000060448201526064015b60405180910390fd5b336000908152600360205260408120600554600282015491924292909161039591610a3d565b9050808211806103ba57506001835460ff1660028111156103b8576103b86109b9565b145b806103da57506000835460ff1660028111156103d8576103d86109b9565b145b6104225760405162461bcd60e51b81526020600482015260196024820152785573657220616c72656164792070616964207468652066656560381b6044820152606401610366565b6001830154600081900361043857600184018390555b6002848101849055845460ff19161784556040805133815234602082015242918101919091527fc1e1261fb62788fd4036ae7b01d7139f3523dac26e0c98f808154bfa20289fb1906060015b60405180910390a150505050565b61049a6108c6565b604051600090339047908381818185875af1925050503d80600081146104dc576040519150601f19603f3d011682016040523d82523d6000602084013e6104e1565b606091505b50509050806105245760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610366565b50565b6000546001600160a01b031633148061055557503360009081526001602081905260409091205460ff161515145b6105965760405162461bcd60e51b815260206004820152601260248201527152657374726963746564204163636573732160701b6044820152606401610366565b600555565b6105a36108c6565b6105ad6000610920565b565b6000546001600160a01b03163314806105dd57503360009081526001602081905260409091205460ff161515145b61061e5760405162461bcd60e51b815260206004820152601260248201527152657374726963746564204163636573732160701b6044820152606401610366565b600455565b61062b6108c6565b6001600160a01b03811660009081526001602052604081205460ff16151590036106ae576001600160a01b03811660009081526001602081905260408220805460ff1916821790558154909190601490610691908490600160a01b900461ffff16610a56565b92506101000a81548161ffff021916908361ffff16021790555050565b6001600160a01b03811660009081526001602081905260408220805460ff191690558154909190601490610691908490600160a01b900461ffff16610a78565b341561072e5760405162461bcd60e51b815260206004820152600f60248201526e139bc8199959481c995c5d5a5c9959608a1b6044820152606401610366565b336000908152600360205260408120600554600282015491924292909161075491610a3d565b90508082118061078557503360009081526003602052604081205460ff166002811115610783576107836109b9565b145b6107cd5760405162461bcd60e51b81526020600482015260196024820152785573657220616c72656164792070616964207468652066656560381b6044820152606401610366565b600183015460008190036107e357600184018390555b60028401839055835460ff19166001178455604080513381526000602082015242918101919091527fc1e1261fb62788fd4036ae7b01d7139f3523dac26e0c98f808154bfa20289fb190606001610484565b61083d6108c6565b6002805460ff1916911515919091179055565b6108586108c6565b6001600160a01b0381166108bd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610366565b61052481610920565b6000546001600160a01b031633146105ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561098257600080fd5b81356001600160a01b038116811461099957600080fd5b9392505050565b6000602082840312156109b257600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60608101600385106109f157634e487b7160e01b600052602160045260246000fd5b938152602081019290925260409091015290565b600060208284031215610a1757600080fd5b8135801515811461099957600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610a5057610a50610a27565b92915050565b61ffff818116838216019080821115610a7157610a71610a27565b5092915050565b61ffff828116828216039080821115610a7157610a71610a2756fea2646970667358221220189118c9810ba0b5bacb9b5397ad18181be4049b89fee670a9256f84c65ac00264736f6c63430008160033
Deployed Bytecode
0x6080604052600436106100f35760003560e01c80639012c4a81161008a578063d32ca9d211610059578063d32ca9d2146102a9578063ddca3f43146102c9578063ee4e4416146102df578063f2fde38b146102f957600080fd5b80639012c4a814610212578063b532e4cb14610232578063b9cd1a3b14610252578063ba4a7fba1461025a57600080fd5b806365a114f1116100c657806365a114f1146101915780636d9b2c56146101b5578063715018a6146101d55780638da5cb5b146101ea57600080fd5b8063090f0baf146100f857806314d0f1ba146101025780633ccfd60b146101475780634efb023e1461015c575b600080fd5b610100610319565b005b34801561010e57600080fd5b5061013261011d366004610970565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561015357600080fd5b50610100610492565b34801561016857600080fd5b5060005461017e90600160a01b900461ffff1681565b60405161ffff909116815260200161013e565b34801561019d57600080fd5b506101a760055481565b60405190815260200161013e565b3480156101c157600080fd5b506101006101d03660046109a0565b610527565b3480156101e157600080fd5b5061010061059b565b3480156101f657600080fd5b506000546040516001600160a01b03909116815260200161013e565b34801561021e57600080fd5b5061010061022d3660046109a0565b6105af565b34801561023e57600080fd5b5061010061024d366004610970565b610623565b6101006106ee565b34801561026657600080fd5b5061029a610275366004610970565b60036020526000908152604090208054600182015460029092015460ff909116919083565b60405161013e939291906109cf565b3480156102b557600080fd5b506101006102c4366004610a05565b610835565b3480156102d557600080fd5b506101a760045481565b3480156102eb57600080fd5b506002546101329060ff1681565b34801561030557600080fd5b50610100610314366004610970565b610850565b600454341461036f5760405162461bcd60e51b815260206004820152601c60248201527f4665652070726f766964656420697320696e73756666696369656e740000000060448201526064015b60405180910390fd5b336000908152600360205260408120600554600282015491924292909161039591610a3d565b9050808211806103ba57506001835460ff1660028111156103b8576103b86109b9565b145b806103da57506000835460ff1660028111156103d8576103d86109b9565b145b6104225760405162461bcd60e51b81526020600482015260196024820152785573657220616c72656164792070616964207468652066656560381b6044820152606401610366565b6001830154600081900361043857600184018390555b6002848101849055845460ff19161784556040805133815234602082015242918101919091527fc1e1261fb62788fd4036ae7b01d7139f3523dac26e0c98f808154bfa20289fb1906060015b60405180910390a150505050565b61049a6108c6565b604051600090339047908381818185875af1925050503d80600081146104dc576040519150601f19603f3d011682016040523d82523d6000602084013e6104e1565b606091505b50509050806105245760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610366565b50565b6000546001600160a01b031633148061055557503360009081526001602081905260409091205460ff161515145b6105965760405162461bcd60e51b815260206004820152601260248201527152657374726963746564204163636573732160701b6044820152606401610366565b600555565b6105a36108c6565b6105ad6000610920565b565b6000546001600160a01b03163314806105dd57503360009081526001602081905260409091205460ff161515145b61061e5760405162461bcd60e51b815260206004820152601260248201527152657374726963746564204163636573732160701b6044820152606401610366565b600455565b61062b6108c6565b6001600160a01b03811660009081526001602052604081205460ff16151590036106ae576001600160a01b03811660009081526001602081905260408220805460ff1916821790558154909190601490610691908490600160a01b900461ffff16610a56565b92506101000a81548161ffff021916908361ffff16021790555050565b6001600160a01b03811660009081526001602081905260408220805460ff191690558154909190601490610691908490600160a01b900461ffff16610a78565b341561072e5760405162461bcd60e51b815260206004820152600f60248201526e139bc8199959481c995c5d5a5c9959608a1b6044820152606401610366565b336000908152600360205260408120600554600282015491924292909161075491610a3d565b90508082118061078557503360009081526003602052604081205460ff166002811115610783576107836109b9565b145b6107cd5760405162461bcd60e51b81526020600482015260196024820152785573657220616c72656164792070616964207468652066656560381b6044820152606401610366565b600183015460008190036107e357600184018390555b60028401839055835460ff19166001178455604080513381526000602082015242918101919091527fc1e1261fb62788fd4036ae7b01d7139f3523dac26e0c98f808154bfa20289fb190606001610484565b61083d6108c6565b6002805460ff1916911515919091179055565b6108586108c6565b6001600160a01b0381166108bd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610366565b61052481610920565b6000546001600160a01b031633146105ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561098257600080fd5b81356001600160a01b038116811461099957600080fd5b9392505050565b6000602082840312156109b257600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60608101600385106109f157634e487b7160e01b600052602160045260246000fd5b938152602081019290925260409091015290565b600060208284031215610a1757600080fd5b8135801515811461099957600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610a5057610a50610a27565b92915050565b61ffff818116838216019080821115610a7157610a71610a27565b5092915050565b61ffff828116828216039080821115610a7157610a71610a2756fea2646970667358221220189118c9810ba0b5bacb9b5397ad18181be4049b89fee670a9256f84c65ac00264736f6c63430008160033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.