Contract Overview
Balance:
0 CLV
CLV Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x2a3f09c35c55caa53051e70346ccf2af42ba87b8ec0463134575dba324d9aab1 | Transfer Ownersh... | 1368097 | 196 days 11 hrs ago | 0x000001ed3ff88bc1990e73c1b6dbced7d0b4e93f | IN | 0xefb2337d64665a92060184eddd81dc0258009c2e | 0 CLV | 0.0013343 | |
0xda482b7a22cc724b22d0a2fc64298ec39d2ad9c4f34a109ab62272777b76eb8d | 0x60806040 | 1367730 | 196 days 12 hrs ago | 0x000001ed3ff88bc1990e73c1b6dbced7d0b4e93f | IN | Create: LimiterDaily | 0 CLV | 0.0210486 |
[ Download CSV Export ]
Contract Name:
LimiterDaily
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "./@openzeppelin/contracts/access/Ownable.sol"; import "./ILimiter.sol"; contract LimiterDaily is ILimiter, Ownable { // IBridge address => timestamp (day) => usage mapping (address => mapping (uint256 => uint256)) private _usages; mapping (address => uint256) private _limiter; uint256 constant private TIME_BLOCK = 86400; // limit = 0 is unlimited function setLimit(address bridge, uint256 limit) external onlyOwner { _limiter[bridge] = limit; } function getLimit(address bridge) override public view returns (uint256) { return _limiter[bridge]; } function getUsage(address bridge) override public view returns (uint256) { uint256 ts = block.timestamp / TIME_BLOCK; uint256 usage = _usages[bridge][ts]; return usage; } function isLimited(address bridge, uint256 amount) override public view returns (bool) { if (_limiter[bridge] == 0) { return false; } return getUsage(bridge) + amount > getLimit(bridge); } function increaseUsage(uint256 amount) override external { address bridge = _msgSender(); // this prevent unknown contract to change usage value if (_limiter[bridge] == 0) { return; } uint256 ts = block.timestamp / TIME_BLOCK; _usages[bridge][ts] += amount; require(_usages[bridge][ts] <= _limiter[bridge], "LimiterDaily: limit exceeded"); } }
// 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 () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = 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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ILimiter { function getLimit(address bridge) external view returns (uint256); function getUsage(address bridge) external view returns (uint256); function isLimited(address bridge, uint256 amount) external view returns (bool); function increaseUsage(uint256 amount) external; }
// 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) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"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":"bridge","type":"address"}],"name":"getLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bridge","type":"address"}],"name":"getUsage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseUsage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"isLimited","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":[{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061063c806100616000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063715018a61161005b578063715018a6146101145780638da5cb5b1461011c578063c0dd9e5214610137578063f2fde38b1461014a57600080fd5b80631ce28e721461008d57806336db43b5146100c957806347618cb2146100de57806359b9b15e14610101575b600080fd5b6100b661009b366004610560565b6001600160a01b031660009081526002602052604090205490565b6040519081526020015b60405180910390f35b6100dc6100d7366004610581565b61015d565b005b6100f16100ec366004610581565b6101d8565b60405190151581526020016100c0565b6100b661010f366004610560565b610234565b6100dc610271565b6000546040516001600160a01b0390911681526020016100c0565b6100dc6101453660046105aa565b610322565b6100dc610158366004610560565b610406565b6000546001600160a01b031633146101bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03909116600090815260026020526040902055565b6001600160a01b0382166000908152600260205260408120546101fd5750600061022e565b6001600160a01b0383166000908152600260205260409020548261022085610234565b61022a91906105c2565b1190505b92915050565b60008061024462015180426105e6565b6001600160a01b039093166000908152600160209081526040808320958352949052929092205492915050565b6000546001600160a01b031633146102cb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101b3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b3360008181526002602052604090205461033a575050565b600061034962015180426105e6565b6001600160a01b03831660009081526001602090815260408083208484529091528120805492935085929091906103819084906105c2565b90915550506001600160a01b038216600090815260026020908152604080832054600183528184208585529092529091205411156104015760405162461bcd60e51b815260206004820152601c60248201527f4c696d697465724461696c793a206c696d69742065786365656465640000000060448201526064016101b3565b505050565b6000546001600160a01b031633146104605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101b3565b6001600160a01b0381166104dc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101b3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b80356001600160a01b038116811461055b57600080fd5b919050565b600060208284031215610571578081fd5b61057a82610544565b9392505050565b60008060408385031215610593578081fd5b61059c83610544565b946020939093013593505050565b6000602082840312156105bb578081fd5b5035919050565b600082198211156105e157634e487b7160e01b81526011600452602481fd5b500190565b60008261060157634e487b7160e01b81526012600452602481fd5b50049056fea2646970667358221220202efa7484f1e684b441a039e4762822b300027b5d7e61fc09142445fe3d3a2e64736f6c63430008040033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.