1// SPDX-License-Identifier: MIT2 3pragma solidity ^0.8.0;4 5/**6 * @dev Provides information about the current execution context, including the7 * sender of the transaction and its data. While these are generally available8 * via msg.sender and msg.data, they should not be accessed in such a direct9 * manner, since when dealing with meta-transactions the account sending and10 * paying for execution may not be the actual sender (as far as an application11 * is concerned).12 *13 * This contract is only required for intermediate, library-like contracts.14 */15abstract contract Context {16 function _msgSender() internal view virtual returns (address) {17 return msg.sender;18 }19 20 function _msgData() internal view virtual returns (bytes calldata) {21 return msg.data;22 }23}24 25/**26 * @dev Contract module which provides a basic access control mechanism, where27 * there is an account (an owner) that can be granted exclusive access to28 * specific functions.29 *30 * By default, the owner account will be the one that deploys the contract. This31 * can later be changed with {transferOwnership}.32 *33 * This module is used through inheritance. It will make available the modifier34 * `onlyOwner`, which can be applied to your functions to restrict their use to35 * the owner.36 */37abstract contract Ownable is Context {38 address private _owner;39 40 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);41 42 /**43 * @dev Initializes the contract setting the deployer as the initial owner.44 */45 constructor() {46 _setOwner(_msgSender());47 }48 49 /**50 * @dev Returns the address of the current owner.51 */52 function owner() public view virtual returns (address) {53 return _owner;54 }55 56 /**57 * @dev Throws if called by any account other than the owner.58 */59 modifier onlyOwner() {60 require(owner() == _msgSender(), "Ownable: caller is not the owner");61 _;62 }63 64 /**65 * @dev Leaves the contract without owner. It will not be possible to call66 * `onlyOwner` functions anymore. Can only be called by the current owner.67 *68 * NOTE: Renouncing ownership will leave the contract without an owner,69 * thereby removing any functionality that is only available to the owner.70 */71 function renounceOwnership() public virtual onlyOwner {72 _setOwner(address(0));73 }74 75 /**76 * @dev Transfers ownership of the contract to a new account (`newOwner`).77 * Can only be called by the current owner.78 */79 function transferOwnership(address newOwner) public virtual onlyOwner {80 require(newOwner != address(0), "Ownable: new owner is the zero address");81 _setOwner(newOwner);82 }83 84 function _setOwner(address newOwner) private {85 address oldOwner = _owner;86 _owner = newOwner;87 emit OwnershipTransferred(oldOwner, newOwner);88 }89}90 91contract FeeContract is Ownable {92 93 // System fee.94 uint public initialFee;95 96 // Activated accounts.97 mapping(address => bool) public paidFee;98 mapping(address => uint) public paidFeeBlock;99 100 event AccountActivated(address indexed account);101 event ActivationFeeChanged(uint indexed previousFee, uint indexed newFee);102 103 /**104 * Setter of the fee value.105 */106 function changeFee(uint newFee) external onlyOwner {107 uint previousFee = initialFee;108 initialFee = newFee;109 emit ActivationFeeChanged(previousFee, newFee);110 }111 112 /**113 * Function that allows you to activate account.114 */115 function pay() external payable {116 117 address sender = msg.sender;118 uint value = msg.value;119 120 require(paidFee[sender] != true, "G000");121 require(value >= initialFee, "G001");122 123 paidFee[sender] = true;124 paidFeeBlock[sender] = block.number;125 126 if (value > initialFee) {127 payable(sender).transfer(value - initialFee);128 }129 emit AccountActivated(sender);130 }131}
[ { "name": "AccountActivated", "type": "event", "inputs": [ { "name": "account", "type": "address", "indexed": true, "internalType": "address" } ], "anonymous": false }, { "name": "ActivationFeeChanged", "type": "event", "inputs": [ { "name": "previousFee", "type": "uint256", "indexed": true, "internalType": "uint256" }, { "name": "newFee", "type": "uint256", "indexed": true, "internalType": "uint256" } ], "anonymous": false }, { "name": "OwnershipTransferred", "type": "event", "inputs": [ { "name": "previousOwner", "type": "address", "indexed": true, "internalType": "address" }, { "name": "newOwner", "type": "address", "indexed": true, "internalType": "address" } ], "anonymous": false }, { "name": "changeFee", "type": "function", "inputs": [ { "name": "newFee", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" }, { "name": "initialFee", "type": "function", "inputs": [], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "name": "owner", "type": "function", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "name": "paidFee", "type": "function", "inputs": [ { "name": "", "type": "address", "internalType": "address" } ], "outputs": [ { "name": "", "type": "bool", "internalType": "bool" } ], "stateMutability": "view" }, { "name": "paidFeeBlock", "type": "function", "inputs": [ { "name": "", "type": "address", "internalType": "address" } ], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "name": "pay", "type": "function", "inputs": [], "outputs": [], "stateMutability": "payable" }, { "name": "renounceOwnership", "type": "function", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "name": "transferOwnership", "type": "function", "inputs": [ { "name": "newOwner", "type": "address", "internalType": "address" } ], "outputs": [], "stateMutability": "nonpayable" }]
0x60806040526004361061007b5760003560e01c806385cb04651161004e57806385cb0465146101045780638da5cb5b1461013f5780639c00316e14610167578063f2fde38b1461017d57600080fd5b80631b9265b814610080578063591a726f1461008a5780636a1db1bf146100cf578063715018a6146100ef575b600080fd5b61008861019d565b005b34801561009657600080fd5b506100ba6100a536600461046d565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156100db57600080fd5b506100886100ea36600461049d565b6102e9565b3480156100fb57600080fd5b5061008861034c565b34801561011057600080fd5b5061013161011f36600461046d565b60036020526000908152604090205481565b6040519081526020016100c6565b34801561014b57600080fd5b506000546040516001600160a01b0390911681526020016100c6565b34801561017357600080fd5b5061013160015481565b34801561018957600080fd5b5061008861019836600461046d565b610382565b33600081815260026020526040902054349060ff1615156001036101f55760405162461bcd60e51b81526004016101ec906020808252600490820152630473030360e41b604082015260600190565b60405180910390fd5b6001548110156102305760405162461bcd60e51b81526004016101ec906020808252600490820152634730303160e01b604082015260600190565b6001600160a01b0382166000908152600260209081526040808320805460ff191660019081179091556003909252909120439055548111156102b157816001600160a01b03166108fc6001548361028791906104b6565b6040518115909202916000818181858888f193505050501580156102af573d6000803e3d6000fd5b505b6040516001600160a01b038316907fcfacdcf9289f1b69c533dda67fc14bae036114cd912d8f9fa9676e95d4ec028490600090a25050565b6000546001600160a01b031633146103135760405162461bcd60e51b81526004016101ec906104dd565b6001805490829055604051829082907f423ebc668569f7b038607398feb70f9248fe8722178a1f31cb670fff7835570790600090a35050565b6000546001600160a01b031633146103765760405162461bcd60e51b81526004016101ec906104dd565b610380600061041d565b565b6000546001600160a01b031633146103ac5760405162461bcd60e51b81526004016101ec906104dd565b6001600160a01b0381166104115760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101ec565b61041a8161041d565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561047f57600080fd5b81356001600160a01b038116811461049657600080fd5b9392505050565b6000602082840312156104af57600080fd5b5035919050565b818103818111156104d757634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea264697066735822122040fd68993625ed1c6bd6b2761068d322127fc345c467ac61118876207ca37ce364736f6c63430008130033