Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Rate | 17193998 | 613 days ago | IN | 0 ETH | 0.00241869 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
15739588 | 817 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x0677044c...6eC811193 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
FlatRateCommission
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. /// @title Interface staking contract pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/Fee.sol"; contract FlatRateCommission is Fee, Ownable { uint256 public immutable feeRaiseTimeout; uint256 public immutable maxRaise; // 500 = 5% uint256 public constant BASE = 1E4; uint256 public rate; uint256 public timeoutTimestamp; /// @notice Event emmited when a contract is created /// @param commission commission charged by the pool event FlatRateCommissionCreated(uint256 commission); /// @notice event fired when setRate function is called and successful /// @param newRate commission charged by the pool effective immediatly /// @param timeout timestamp for a new change if raising the fee event FlatRateChanged(uint256 newRate, uint256 timeout); constructor( uint256 _rate, uint256 _feeRaiseTimeout, uint256 _maxRaise ) { rate = _rate; feeRaiseTimeout = _feeRaiseTimeout; maxRaise = _maxRaise; emit FlatRateChanged(_rate, timeoutTimestamp); } /// @notice calculates the total amount of the reward that will be directed to the PoolManager /// @return commissionTotal is the amount subtracted from the rewardAmount function getCommission(uint256, uint256 rewardAmount) external view override returns (uint256) { uint256 commission = (rewardAmount * rate) / BASE; // cap commission to 100% return commission > rewardAmount ? rewardAmount : commission; } /// @notice allows for the poolManager to reduce how much they want to charge for the block production tx function setRate(uint256 newRate) external onlyOwner { if (newRate > rate) { require( timeoutTimestamp <= block.timestamp, "FlatRateCommission: the fee raise timeout is not expired yet" ); require( (newRate - rate) <= maxRaise, "FlatRateCommission: the fee raise is over the maximum allowed percentage value" ); timeoutTimestamp = block.timestamp + feeRaiseTimeout; } rate = newRate; emit FlatRateChanged(newRate, timeoutTimestamp); } }
// SPDX-License-Identifier: MIT 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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. pragma solidity >=0.7.0 <0.9.0; /// @title Calculator of pool owner commission for each block reward /// @author Danilo Tuler /// @notice This provides flexibility for different commission models interface Fee { /// @notice calculates the total amount of the reward that will be directed to the pool owner /// @return amount of tokens taken by the pool owner as commission function getCommission(uint256 posIndex, uint256 rewardAmount) external view returns (uint256); }
// SPDX-License-Identifier: MIT 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": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"},{"internalType":"uint256","name":"_feeRaiseTimeout","type":"uint256"},{"internalType":"uint256","name":"_maxRaise","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeout","type":"uint256"}],"name":"FlatRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"commission","type":"uint256"}],"name":"FlatRateCommissionCreated","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":[],"name":"BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRaiseTimeout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"getCommission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRaise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"setRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeoutTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b1461012a578063b1fc8ad414610145578063c2ce5e8614610158578063ec342ad014610161578063f2fde38b1461016a57600080fd5b8063112cde6a146100a35780632c4e722e146100dd57806334fcf437146100e6578063715018a6146100fb578063719ec6b114610103575b600080fd5b6100ca7f0000000000000000000000000000000000000000000000000000000000093a8081565b6040519081526020015b60405180910390f35b6100ca60015481565b6100f96100f43660046104e7565b61017d565b005b6100f961035f565b6100ca7f00000000000000000000000000000000000000000000000000000000000001f481565b6000546040516001600160a01b0390911681526020016100d4565b6100ca610153366004610500565b610395565b6100ca60025481565b6100ca61271081565b6100f96101783660046104b7565b6103cc565b6000546001600160a01b031633146101b05760405162461bcd60e51b81526004016101a790610522565b60405180910390fd5b60015481111561031a574260025411156102325760405162461bcd60e51b815260206004820152603c60248201527f466c617452617465436f6d6d697373696f6e3a2074686520666565207261697360448201527f652074696d656f7574206973206e6f742065787069726564207965740000000060648201526084016101a7565b7f00000000000000000000000000000000000000000000000000000000000001f46001548261026191906105b0565b11156102ec5760405162461bcd60e51b815260206004820152604e60248201527f466c617452617465436f6d6d697373696f6e3a2074686520666565207261697360448201527f65206973206f76657220746865206d6178696d756d20616c6c6f77656420706560648201526d7263656e746167652076616c756560901b608482015260a4016101a7565b6103167f0000000000000000000000000000000000000000000000000000000000093a8042610557565b6002555b60018190556002546040805183815260208101929092527f8a36c5a730a168f010484976acd9da00019dde58dcdaa557ec1035ade3805c92910160405180910390a150565b6000546001600160a01b031633146103895760405162461bcd60e51b81526004016101a790610522565b6103936000610467565b565b600080612710600154846103a99190610591565b6103b3919061056f565b90508281116103c257806103c4565b825b949350505050565b6000546001600160a01b031633146103f65760405162461bcd60e51b81526004016101a790610522565b6001600160a01b03811661045b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101a7565b61046481610467565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156104c957600080fd5b81356001600160a01b03811681146104e057600080fd5b9392505050565b6000602082840312156104f957600080fd5b5035919050565b6000806040838503121561051357600080fd5b50508035926020909101359150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561056a5761056a6105c7565b500190565b60008261058c57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156105ab576105ab6105c7565b500290565b6000828210156105c2576105c26105c7565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122085d5e30b0c1c3dd32e67b134dcbea33c284a9d2d18b3b24dc7185d78620b356664736f6c63430008070033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.