BERA Price: $3.62 (-1.73%)

Contract

0xaAA55490721b72A3112323FC274e9798796CcE85

Overview

BERA Balance

Berachain LogoBerachain LogoBerachain Logo0 BERA

BERA Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...3761642025-01-28 19:15:2484 days ago1738091724IN
0xaAA55490...8796CcE85
0 BERA0.000000050.002
Set Token2290762025-01-25 14:30:5488 days ago1737815454IN
0xaAA55490...8796CcE85
0 BERA0.000000090.002

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RateLimiter

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
File 1 of 6 : RateLimiter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IRateLimiter} from "./interfaces/IRateLimiter.sol";
import {Constants} from "./libraries/Constants.sol";
import {Errors} from "./libraries/Errors.sol";

/**
 * @title RateLimiter
 * @notice A contract for rate limiting the amount of tokens that can be withdrawn to L1
 * @author dinero.xyz
 */
contract RateLimiter is Ownable, IRateLimiter {
    /**
     * @notice Withdraw limit, used to limit the amount of tokens that can be withdrawn to L1
     * @dev This value increases on deposit messages received from L1 or when the sync pool is synced
     */
    uint256 public withdrawLimit;
    /**
     * @notice The Mode ETH contract address
     */
    address public l2Token;

    constructor() Ownable(msg.sender) {}

    modifier onlyL2Token() {
        if (msg.sender != l2Token) revert Errors.NotAllowed();
        _;
    }

    /**
     * @notice Update the rate limit
     * @param token The token address
     * @param amountIn The amount in
     * @param amountOut The amount out
     */
    function updateRateLimit(
        address,
        address token,
        uint256 amountIn,
        uint256 amountOut
    ) external override onlyL2Token {
        if (token == l2Token) {
            if (amountIn > 0) {
                withdrawLimit += amountIn;
            } else {
                if (withdrawLimit < amountOut) {
                    revert Errors.WithdrawLimitExceeded();
                }
                withdrawLimit -= amountOut;
            }
        } else if (token == Constants.ETH_ADDRESS && amountIn > 0) {
            withdrawLimit += amountIn;
        }
    }

    /**
     * @notice Set the Mode ETH contract address
     * @param _l2Token The Mode ETH contract address
     */
    function setToken(address _l2Token) external onlyOwner {
        l2Token = _l2Token;
    }
}

File 2 of 6 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}

File 3 of 6 : IRateLimiter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IRateLimiter {
    function updateRateLimit(
        address sender,
        address tokenIn,
        uint256 amountIn,
        uint256 amountOut
    ) external;
}

File 4 of 6 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**
 * @title  Constants
 * @notice Library containing various constants for the L2LiquidStakingToken system.
 * @author redactedcartel.finance
 */
library Constants {
    /**
     * @notice Message type constant for deposit.
     * @dev This constant defines the message type for deposit operations.
     */
    uint8 constant MESSAGE_TYPE_DEPOSIT = 1;

    /**
     * @notice Message type constant for deposit.
     * @dev This constant defines the message type for deposit operations.
     */
    uint8 constant MESSAGE_TYPE_DEPOSIT_WRAP = 2;

    /**
     * @notice Message type constant for withdrawal.
     * @dev This constant defines the message type for withdrawal operations.
     */
    uint8 constant MESSAGE_TYPE_WITHDRAW = 3;

    /**
     * @notice Message type constant for rebase.
     * @dev This constant defines the message type for rebase operations.
     */
    uint8 constant MESSAGE_TYPE_REBASE = 4;

    /**
     * @notice Message type constant for sync.
     * @dev This constant defines the message type for sync operations.
     */
    uint8 constant MESSAGE_TYPE_SYNC = 5;

    /**
     * @notice The destination endpoint ID for Mainnet.
     * @dev This constant holds the destination endpoint ID for Mainnet.
     */
    uint32 constant MAINNET_EID = 30101;

    /**
     * @notice Fee denominator for precise fee calculations.
     * @dev This constant holds the fee denominator for precise fee calculations.
     */
    uint256 constant FEE_DENOMINATOR = 1_000_000;

    /**
     * @notice Max rebase fee.
     * @dev This constant holds the maximum rebase fee that can be set.
     */
    uint256 constant MAX_REBASE_FEE = 200_000;

    /**
     * @notice Max deposit fee.
     * @dev This constant holds the maximum sync deposit fee that can be set.
     */
    uint256 constant MAX_DEPOSIT_FEE = 200_000;

    /**
     * @dev The address of the ETH token.
     */
    address constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
}

File 5 of 6 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

library Errors {
    /**
     * @dev Zero address specified
     */
    error ZeroAddress();

    /**
     * @dev Zero amount specified
     */
    error ZeroAmount();

    /**
     * @dev Invalid fee specified
     */
    error InvalidFee();

    /**
     * @dev not same as deposit size
     */
    error InvalidAmount();

    /**
     * @dev Invalid nonce
     */
    error InvalidNonce();

    /**
     * @dev not allowed
     */
    error NotAllowed();

    /**
     * @dev Only ETH allowed
     */
    error OnlyETH();

    /**
     * @dev Invalid rate
     */
    error InvalidRate();

    /**
     * @dev Withdraw limit exceeded
     */
    error WithdrawLimitExceeded();

    /**
     * @dev Unauthorized caller on SyncPool
     */
    error UnauthorizedCaller();

    /**
     * @dev Native transfer failed on SyncPool
     */
    error NativeTransferFailed();

    /**
     * @dev Insufficient amount out
     */
    error InsufficientAmountOut();
    
    /**
     * @dev Insufficient amount to sync
     */
    error InsufficientAmountToSync();
    
    /**
     * @dev Unauthorized token
     */
    error UnauthorizedToken();

    /**
     * @dev Invalid amount in
     */
    error InvalidAmountIn();

    /**
     * @dev Max sync amount exceeded, to prevent going over the bridge limit
     */
    error MaxSyncAmountExceeded();

    /**
     * @dev Unsupported destination chain
     */
    error UnsupportedEid();

    /**
     * @dev Multichain eposits can't be wrapped
     */
    error MultichainDepositsCannotBeWrapped();

    /**
     * @dev OFT lockbox not set for multichain deposit
     */
    error OFTLockboxNotSet();

    /**
     * @dev Invalid receiver address
     */
    error InvalidReceiver();
}

File 6 of 6 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/",
    "aave-v3-core/=lib/aave-v3-core/contracts/",
    "eigenlayer/=lib/eigenlayer-contracts/src/contracts/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"WithdrawLimitExceeded","type":"error"},{"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":"l2Token","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"_l2Token","type":"address"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"updateRateLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6080604052348015600e575f80fd5b503380603357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b603a81603f565b50608e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6103e68061009b5f395ff3fe608060405234801561000f575f80fd5b506004361061007a575f3560e01c80637c134b5c116100585780637c134b5c146100cb5780638da5cb5b146100de578063f2fde38b146100ee578063f848d54114610101575f80fd5b8063144fa6d71461007e57806356eff26714610093578063715018a6146100c3575b5f80fd5b61009161008c366004610311565b610118565b005b6002546100a6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610091610142565b6100916100d9366004610331565b610155565b5f546001600160a01b03166100a6565b6100916100fc366004610311565b610239565b61010a60015481565b6040519081526020016100ba565b61012061027b565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61014a61027b565b6101535f6102a7565b565b6002546001600160a01b0316331461018057604051631eb49d6d60e11b815260040160405180910390fd5b6002546001600160a01b03908116908416036101ec5781156101b8578160015f8282546101ad9190610384565b909155506102339050565b8060015410156101db576040516314f310c960e01b815260040160405180910390fd5b8060015f8282546101ad919061039d565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561021757505f82115b15610233578160015f82825461022d9190610384565b90915550505b50505050565b61024161027b565b6001600160a01b03811661026f57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610278816102a7565b50565b5f546001600160a01b031633146101535760405163118cdaa760e01b8152336004820152602401610266565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461030c575f80fd5b919050565b5f60208284031215610321575f80fd5b61032a826102f6565b9392505050565b5f805f8060808587031215610344575f80fd5b61034d856102f6565b935061035b602086016102f6565b93969395505050506040820135916060013590565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561039757610397610370565b92915050565b818103818111156103975761039761037056fea2646970667358221220ee3cb377b46459df7e8a94fe1fd7f5f5d0a4bd7b160be16f649228d3672f8d6664736f6c63430008190033

Deployed Bytecode

0x608060405234801561000f575f80fd5b506004361061007a575f3560e01c80637c134b5c116100585780637c134b5c146100cb5780638da5cb5b146100de578063f2fde38b146100ee578063f848d54114610101575f80fd5b8063144fa6d71461007e57806356eff26714610093578063715018a6146100c3575b5f80fd5b61009161008c366004610311565b610118565b005b6002546100a6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610091610142565b6100916100d9366004610331565b610155565b5f546001600160a01b03166100a6565b6100916100fc366004610311565b610239565b61010a60015481565b6040519081526020016100ba565b61012061027b565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61014a61027b565b6101535f6102a7565b565b6002546001600160a01b0316331461018057604051631eb49d6d60e11b815260040160405180910390fd5b6002546001600160a01b03908116908416036101ec5781156101b8578160015f8282546101ad9190610384565b909155506102339050565b8060015410156101db576040516314f310c960e01b815260040160405180910390fd5b8060015f8282546101ad919061039d565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561021757505f82115b15610233578160015f82825461022d9190610384565b90915550505b50505050565b61024161027b565b6001600160a01b03811661026f57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610278816102a7565b50565b5f546001600160a01b031633146101535760405163118cdaa760e01b8152336004820152602401610266565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461030c575f80fd5b919050565b5f60208284031215610321575f80fd5b61032a826102f6565b9392505050565b5f805f8060808587031215610344575f80fd5b61034d856102f6565b935061035b602086016102f6565b93969395505050506040820135916060013590565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561039757610397610370565b92915050565b818103818111156103975761039761037056fea2646970667358221220ee3cb377b46459df7e8a94fe1fd7f5f5d0a4bd7b160be16f649228d3672f8d6664736f6c63430008190033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.