false
false
0

Contract Address Details

0xA38D1D7F217A52A27b0e6BF50E0a9ddAD05798C0

Contract Name
StorageGasOracle
Creator
0xa7eccd–44d9ba at 0x449e6e–82b20b
Balance
0 FLR
Tokens
Fetching tokens...
Transactions
4 Transactions
Transfers
0 Transfers
Gas Used
1,700,800
Last Balance Update
30743151
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
StorageGasOracle




Optimization enabled
true
Compiler version
v0.8.19+commit.7dd6d404




Optimization runs
999999
EVM Version
default




Verified at
2024-08-27T14:39:18.598452Z

contracts/hooks/igp/StorageGasOracle.sol

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;

// ============ Internal Imports ============
import {IGasOracle} from "../../interfaces/IGasOracle.sol";

// ============ External Imports ============
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @notice A gas oracle that uses data stored within the contract.
 * @dev This contract is intended to be owned by an address that will
 * update the stored remote gas data.
 */
contract StorageGasOracle is IGasOracle, Ownable {
    // ============ Public Storage ============

    /// @notice Keyed by remote domain, gas data on that remote domain.
    mapping(uint32 => IGasOracle.RemoteGasData) public remoteGasData;

    // ============ Events ============

    /**
     * @notice Emitted when an entry in `remoteGasData` is set.
     * @param remoteDomain The remote domain in which the gas data was set for.
     * @param tokenExchangeRate The exchange rate of the remote native token quoted in the local native token.
     * @param gasPrice The gas price on the remote chain.
     */
    event RemoteGasDataSet(
        uint32 indexed remoteDomain,
        uint128 tokenExchangeRate,
        uint128 gasPrice
    );

    struct RemoteGasDataConfig {
        uint32 remoteDomain;
        uint128 tokenExchangeRate;
        uint128 gasPrice;
    }

    // ============ External Functions ============

    /**
     * @notice Returns the stored `remoteGasData` for the `_destinationDomain`.
     * @param _destinationDomain The destination domain.
     * @return tokenExchangeRate The exchange rate of the remote native token quoted in the local native token.
     * @return gasPrice The gas price on the remote chain.
     */
    function getExchangeRateAndGasPrice(
        uint32 _destinationDomain
    )
        external
        view
        override
        returns (uint128 tokenExchangeRate, uint128 gasPrice)
    {
        // Intentionally allow unset / zero values
        IGasOracle.RemoteGasData memory _data = remoteGasData[
            _destinationDomain
        ];
        return (_data.tokenExchangeRate, _data.gasPrice);
    }

    /**
     * @notice Sets the remote gas data for many remotes at a time.
     * @param _configs The configs to use when setting the remote gas data.
     */
    function setRemoteGasDataConfigs(
        RemoteGasDataConfig[] calldata _configs
    ) external onlyOwner {
        uint256 _len = _configs.length;
        for (uint256 i = 0; i < _len; i++) {
            _setRemoteGasData(_configs[i]);
        }
    }

    /**
     * @notice Sets the remote gas data using the values in `_config`.
     * @param _config The config to use when setting the remote gas data.
     */
    function setRemoteGasData(
        RemoteGasDataConfig calldata _config
    ) external onlyOwner {
        _setRemoteGasData(_config);
    }

    // ============ Internal functions ============

    /**
     * @notice Sets the remote gas data using the values in `_config`.
     * @param _config The config to use when setting the remote gas data.
     */
    function _setRemoteGasData(RemoteGasDataConfig calldata _config) internal {
        remoteGasData[_config.remoteDomain] = IGasOracle.RemoteGasData({
            tokenExchangeRate: _config.tokenExchangeRate,
            gasPrice: _config.gasPrice
        });

        emit RemoteGasDataSet(
            _config.remoteDomain,
            _config.tokenExchangeRate,
            _config.gasPrice
        );
    }
}
        

@openzeppelin/contracts/access/Ownable.sol

// 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);
    }
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
    }
}
          

contracts/interfaces/IGasOracle.sol

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;

interface IGasOracle {
    struct RemoteGasData {
        // The exchange rate of the remote native token quoted in the local native token.
        // Scaled with 10 decimals, i.e. 1e10 is "one".
        uint128 tokenExchangeRate;
        uint128 gasPrice;
    }

    function getExchangeRateAndGasPrice(
        uint32 _destinationDomain
    ) external view returns (uint128 tokenExchangeRate, uint128 gasPrice);
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":999999,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RemoteGasDataSet","inputs":[{"type":"uint32","name":"remoteDomain","internalType":"uint32","indexed":true},{"type":"uint128","name":"tokenExchangeRate","internalType":"uint128","indexed":false},{"type":"uint128","name":"gasPrice","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"tokenExchangeRate","internalType":"uint128"},{"type":"uint128","name":"gasPrice","internalType":"uint128"}],"name":"getExchangeRateAndGasPrice","inputs":[{"type":"uint32","name":"_destinationDomain","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"tokenExchangeRate","internalType":"uint128"},{"type":"uint128","name":"gasPrice","internalType":"uint128"}],"name":"remoteGasData","inputs":[{"type":"uint32","name":"","internalType":"uint32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRemoteGasData","inputs":[{"type":"tuple","name":"_config","internalType":"struct StorageGasOracle.RemoteGasDataConfig","components":[{"type":"uint32","name":"remoteDomain","internalType":"uint32"},{"type":"uint128","name":"tokenExchangeRate","internalType":"uint128"},{"type":"uint128","name":"gasPrice","internalType":"uint128"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRemoteGasDataConfigs","inputs":[{"type":"tuple[]","name":"_configs","internalType":"struct StorageGasOracle.RemoteGasDataConfig[]","components":[{"type":"uint32","name":"remoteDomain","internalType":"uint32"},{"type":"uint128","name":"tokenExchangeRate","internalType":"uint128"},{"type":"uint128","name":"gasPrice","internalType":"uint128"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61070d8061007e6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b14610133578063b08e56d01461015b578063f2fde38b146101a5578063f3a1495f146101b857600080fd5b806360fcef7c14610082578063698faffc14610116578063715018a61461012b575b600080fd5b6100e8610090366004610527565b63ffffffff166000908152600160209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff808216808552700100000000000000000000000000000000909204169290910182905291565b604080516fffffffffffffffffffffffffffffffff9384168152929091166020830152015b60405180910390f35b610129610124366004610554565b6101cb565b005b610129610217565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010d565b6100e8610169366004610527565b6001602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b6101296101b33660046105c9565b61022b565b6101296101c63660046105ff565b6102e7565b6101d36102f8565b8060005b81811015610211576101ff8484838181106101f4576101f4610617565b905060600201610379565b8061020981610646565b9150506101d7565b50505050565b61021f6102f8565b61022960006104b2565b565b6102336102f8565b73ffffffffffffffffffffffffffffffffffffffff81166102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102e4816104b2565b50565b6102ef6102f8565b6102e481610379565b60005473ffffffffffffffffffffffffffffffffffffffff163314610229576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b604051806040016040528082602001602081019061039791906106a5565b6fffffffffffffffffffffffffffffffff1681526020016103be60608401604085016106a5565b6fffffffffffffffffffffffffffffffff169052600160006103e36020850185610527565b63ffffffff1681526020808201929092526040016000208251928201516fffffffffffffffffffffffffffffffff9081167001000000000000000000000000000000000293169290921790915561043c90820182610527565b63ffffffff167fb48c1cb713397fc0c0649596c221270fec0b3de3f85ccf6a734411a2fe57a69461047360408401602085016106a5565b61048360608501604086016106a5565b604080516fffffffffffffffffffffffffffffffff93841681529290911660208301520160405180910390a250565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561053957600080fd5b813563ffffffff8116811461054d57600080fd5b9392505050565b6000806020838503121561056757600080fd5b823567ffffffffffffffff8082111561057f57600080fd5b818501915085601f83011261059357600080fd5b8135818111156105a257600080fd5b8660206060830285010111156105b757600080fd5b60209290920196919550909350505050565b6000602082840312156105db57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461054d57600080fd5b60006060828403121561061157600080fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b6000602082840312156106b757600080fd5b81356fffffffffffffffffffffffffffffffff8116811461054d57600080fdfea26469706673582212207afdbb0434a0f41b17a29e52a39fef73abebcc3574d59c152ca473ba2ff6220264736f6c63430008130033

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b14610133578063b08e56d01461015b578063f2fde38b146101a5578063f3a1495f146101b857600080fd5b806360fcef7c14610082578063698faffc14610116578063715018a61461012b575b600080fd5b6100e8610090366004610527565b63ffffffff166000908152600160209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff808216808552700100000000000000000000000000000000909204169290910182905291565b604080516fffffffffffffffffffffffffffffffff9384168152929091166020830152015b60405180910390f35b610129610124366004610554565b6101cb565b005b610129610217565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010d565b6100e8610169366004610527565b6001602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b6101296101b33660046105c9565b61022b565b6101296101c63660046105ff565b6102e7565b6101d36102f8565b8060005b81811015610211576101ff8484838181106101f4576101f4610617565b905060600201610379565b8061020981610646565b9150506101d7565b50505050565b61021f6102f8565b61022960006104b2565b565b6102336102f8565b73ffffffffffffffffffffffffffffffffffffffff81166102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102e4816104b2565b50565b6102ef6102f8565b6102e481610379565b60005473ffffffffffffffffffffffffffffffffffffffff163314610229576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b604051806040016040528082602001602081019061039791906106a5565b6fffffffffffffffffffffffffffffffff1681526020016103be60608401604085016106a5565b6fffffffffffffffffffffffffffffffff169052600160006103e36020850185610527565b63ffffffff1681526020808201929092526040016000208251928201516fffffffffffffffffffffffffffffffff9081167001000000000000000000000000000000000293169290921790915561043c90820182610527565b63ffffffff167fb48c1cb713397fc0c0649596c221270fec0b3de3f85ccf6a734411a2fe57a69461047360408401602085016106a5565b61048360608501604086016106a5565b604080516fffffffffffffffffffffffffffffffff93841681529290911660208301520160405180910390a250565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561053957600080fd5b813563ffffffff8116811461054d57600080fd5b9392505050565b6000806020838503121561056757600080fd5b823567ffffffffffffffff8082111561057f57600080fd5b818501915085601f83011261059357600080fd5b8135818111156105a257600080fd5b8660206060830285010111156105b757600080fd5b60209290920196919550909350505050565b6000602082840312156105db57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461054d57600080fd5b60006060828403121561061157600080fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b6000602082840312156106b757600080fd5b81356fffffffffffffffffffffffffffffffff8116811461054d57600080fdfea26469706673582212207afdbb0434a0f41b17a29e52a39fef73abebcc3574d59c152ca473ba2ff6220264736f6c63430008130033