Address Contract Verified
Address
0x12759f8Df234f8f2cDdb3d2Ed5604adF9ACCfc9F
Balance
0 ETH
Nonce
1
Code Size
2094 bytes
Creator
0x27e80dB1...603D at tx 0x71eac173...6a3667
Indexed Transactions
Index loading...
Contract Bytecode
2094 bytes
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063bc2c4c641161005b578063bc2c4c64146100b4578063ce21d3dd146100d2578063ee0eb4a1146100f0578063f4bd7de11461010e5761007d565b80632c4e722e146100825780639c14b3a8146100a0578063af14052c146100aa575b600080fd5b61008a61012c565b604051610097919061051e565b60405180910390f35b6100a86101c2565b005b6100b26102e1565b005b6100bc6103ff565b6040516100c9919061057a565b60405180910390f35b6100da610423565b6040516100e791906105f4565b60405180910390f35b6100f8610447565b604051610105919061062a565b60405180910390f35b6101166104e1565b6040516101239190610666565b60405180910390f35b60007f000000000000000000000000dddcf2c25d50ec22e67218e873d46938650d03a773ffffffffffffffffffffffffffffffffffffffff16632c4e722e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610199573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101bd91906106b2565b905090565b7f000000000000000000000000dddcf2c25d50ec22e67218e873d46938650d03a773ffffffffffffffffffffffffffffffffffffffff16632c4e722e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561022d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025191906106b2565b6000819055507f000000000000000000000000dddcf2c25d50ec22e67218e873d46938650d03a773ffffffffffffffffffffffffffffffffffffffff16639c14b3a86040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156102bf57600080fd5b505af11580156102d3573d6000803e3d6000fd5b505050506102df6102e1565b565b7f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa173ffffffffffffffffffffffffffffffffffffffff16633dbb202b7f0000000000000000000000007eccbbd05830edf593d30005b8f69e965af4d59f63af14052c60e01b604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506207a1206040518463ffffffff1660e01b81526004016103cb939291906107ba565b600060405180830381600087803b1580156103e557600080fd5b505af11580156103f9573d6000803e3d6000fd5b50505050565b7f0000000000000000000000007eccbbd05830edf593d30005b8f69e965af4d59f81565b7f000000000000000000000000dddcf2c25d50ec22e67218e873d46938650d03a781565b600080547f000000000000000000000000dddcf2c25d50ec22e67218e873d46938650d03a773ffffffffffffffffffffffffffffffffffffffff16632c4e722e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104da91906106b2565b1415905090565b7f00000000000000000000000025ace71c97b33cc4729cf772ae268934f7ab5fa181565b6000819050919050565b61051881610505565b82525050565b6000602082019050610533600083018461050f565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061056482610539565b9050919050565b61057481610559565b82525050565b600060208201905061058f600083018461056b565b92915050565b6000819050919050565b60006105ba6105b56105b084610539565b610595565b610539565b9050919050565b60006105cc8261059f565b9050919050565b60006105de826105c1565b9050919050565b6105ee816105d3565b82525050565b600060208201905061060960008301846105e5565b92915050565b60008115159050919050565b6106248161060f565b82525050565b600060208201905061063f600083018461061b565b92915050565b6000610650826105c1565b9050919050565b61066081610645565b82525050565b600060208201905061067b6000830184610657565b92915050565b600080fd5b61068f81610505565b811461069a57600080fd5b50565b6000815190506106ac81610686565b92915050565b6000602082840312156106c8576106c7610681565b5b60006106d68482850161069d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107195780820151818401526020810190506106fe565b60008484015250505050565b6000601f19601f8301169050919050565b6000610741826106df565b61074b81856106ea565b935061075b8185602086016106fb565b61076481610725565b840191505092915050565b6000819050919050565b600063ffffffff82169050919050565b60006107a461079f61079a8461076f565b610595565b610779565b9050919050565b6107b481610789565b82525050565b60006060820190506107cf600083018661056b565b81810360208301526107e18185610736565b90506107f060408301846107ab565b94935050505056fea2646970667358221220c70d55d1644b862df4870d5178b122f16a02e0d8b5a1141ae34bb0601463907564736f6c63430008120033
Verified Source Code Full Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: No
IWRETH.sol 7 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
///@dev Partial interface for WRETH exposing the rebase function
interface IWRETH {
function rebase() external;
}
RocketOvmPriceOracle.sol 49 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
import "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol";
/// @author Kane Wallmann (Rocket Pool)
/// @notice Receives updates from L1 on the canonical rETH exchange rate
contract RocketOvmPriceOracle {
// Events
event RateUpdated(uint256 rate);
// Immutables
ICrossDomainMessenger immutable ovmL2CrossDomainMessenger;
/// @notice The rETH exchange rate in the form of how much ETH 1 rETH is worth
uint256 public rate;
/// @notice The timestamp of the block in which the rate was last updated
uint256 public lastUpdated;
/// @notice Set to the contract on L1 that has permission to update the rate
address public owner;
constructor(address _l2CrossDomainMessenger) {
ovmL2CrossDomainMessenger = ICrossDomainMessenger(_l2CrossDomainMessenger);
owner = msg.sender;
}
/// @notice Hands ownership to the L1 price messenger contract
function setOwner(address _newOwner) external {
require(msg.sender == owner, "Only owner");
owner = _newOwner;
}
/// @notice Called by the messenger contract on L1 to update the exchange rate
function updateRate(uint256 _newRate) external {
// Only calls originating from L1 owner can update the rate
require(
msg.sender == address(ovmL2CrossDomainMessenger)
&& ovmL2CrossDomainMessenger.xDomainMessageSender() == owner,
"Only owner"
);
// Set rate and last updated timestamp
rate = _newRate;
lastUpdated = block.timestamp;
// Emit event
emit RateUpdated(_newRate);
}
}
RocketOvmPriceMessenger.sol 59 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
import "@rocketpool/interface/RocketStorageInterface.sol";
import "@rocketpool/interface/network/RocketNetworkBalancesInterface.sol";
import "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol";
import "./RocketOvmPriceOracle.sol";
/// @author Kane Wallmann (Rocket Pool)
/// @notice Retrieves the rETH exchange rate from Rocket Pool and submits it to the oracle contract on OVM
contract RocketOvmPriceMessenger {
// Immutables
ICrossDomainMessenger immutable ovmL1CrossDomainMessenger;
RocketStorageInterface immutable rocketStorage;
RocketOvmPriceOracle immutable rocketL2OvmPriceOracle;
bytes32 immutable rocketNetworkBalancesKey;
/// @notice The most recently submitted rate
uint256 lastRate;
constructor(RocketStorageInterface _rocketStorage, RocketOvmPriceOracle _rocketL2OvmPriceOracle, ICrossDomainMessenger _ovmL1CrossDomainMessenger) {
rocketStorage = _rocketStorage;
rocketL2OvmPriceOracle = _rocketL2OvmPriceOracle;
ovmL1CrossDomainMessenger = _ovmL1CrossDomainMessenger;
// Precompute storage key for RocketNetworkBalances address
rocketNetworkBalancesKey = keccak256(abi.encodePacked("contract.address", "rocketNetworkBalances"));
}
/// @notice Returns whether the rate has changed since it was last submitted
function rateStale() external view returns (bool) {
return rate() != lastRate;
}
/// @notice Returns the calculated rETH exchange rate
function rate() public view returns (uint256) {
// Retrieve the inputs from RocketNetworkBalances and calculate the rate
RocketNetworkBalancesInterface rocketNetworkBalances = RocketNetworkBalancesInterface(rocketStorage.getAddress(rocketNetworkBalancesKey));
uint256 supply = rocketNetworkBalances.getTotalRETHSupply();
if (supply == 0) {
return 0;
}
return 1 ether * rocketNetworkBalances.getTotalETHBalance() / supply;
}
/// @notice Submits the current rETH exchange rate to the OVM cross domain messenger contract
function submitRate() external {
lastRate = rate();
// Send the cross chain message
ovmL1CrossDomainMessenger.sendMessage(
address(rocketL2OvmPriceOracle),
abi.encodeWithSelector(
rocketL2OvmPriceOracle.updateRate.selector,
lastRate
),
500000
);
}
}
RocketOvmRebasingPriceMessenger.sol 54 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
import "@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol";
import "./interfaces/IWRETH.sol";
import "./RocketOvmPriceOracle.sol";
import "./RocketOvmPriceMessenger.sol";
/// @author Kane Wallmann (Rocket Pool)
/// @notice A wrapper around the price messenger which also executes a rebase on the WRETH token on the OVM L2
contract RocketOvmRebasingPriceMessenger {
// Immutables
ICrossDomainMessenger public immutable ovmL1CrossDomainMessenger;
RocketOvmPriceMessenger public immutable priceMessenger;
address public immutable wrethL2;
/// @notice The most recently submitted rate
uint256 lastRate;
constructor(RocketOvmPriceMessenger _priceMessenger, address _wrethL2, ICrossDomainMessenger _ovmL1CrossDomainMessenger) {
priceMessenger = _priceMessenger;
wrethL2 = _wrethL2;
ovmL1CrossDomainMessenger = _ovmL1CrossDomainMessenger;
}
/// @notice Returns whether the rate has changed since it was last submitted
function rateStale() external view returns (bool) {
return priceMessenger.rate() != lastRate;
}
/// @notice Returns the calculated rETH exchange rate
function rate() public view returns (uint256) {
return priceMessenger.rate();
}
/// @notice Submits the rETH exchange rate and executes a rebase
/// @dev The name `submitRate` is used to make the interface consistent with RocketOvmPriceMessenger
function submitRate() external {
lastRate = priceMessenger.rate();
priceMessenger.submitRate();
rebase();
}
/// @notice Calls rebase on the WRETH token on the OVM L2 via cross domain messenger
function rebase() public {
// Send the cross chain message
ovmL1CrossDomainMessenger.sendMessage(
wrethL2,
abi.encodeWithSelector(IWRETH.rebase.selector),
500000
);
}
}
RocketStorageInterface.sol 51 lines
pragma solidity >0.5.0 <0.9.0;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketStorageInterface {
// Deploy status
function getDeployedStatus() external view returns (bool);
// Guardian
function getGuardian() external view returns(address);
function setGuardian(address _newAddress) external;
function confirmGuardian() external;
// Getters
function getAddress(bytes32 _key) external view returns (address);
function getUint(bytes32 _key) external view returns (uint);
function getString(bytes32 _key) external view returns (string memory);
function getBytes(bytes32 _key) external view returns (bytes memory);
function getBool(bytes32 _key) external view returns (bool);
function getInt(bytes32 _key) external view returns (int);
function getBytes32(bytes32 _key) external view returns (bytes32);
// Setters
function setAddress(bytes32 _key, address _value) external;
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string calldata _value) external;
function setBytes(bytes32 _key, bytes calldata _value) external;
function setBool(bytes32 _key, bool _value) external;
function setInt(bytes32 _key, int _value) external;
function setBytes32(bytes32 _key, bytes32 _value) external;
// Deleters
function deleteAddress(bytes32 _key) external;
function deleteUint(bytes32 _key) external;
function deleteString(bytes32 _key) external;
function deleteBytes(bytes32 _key) external;
function deleteBool(bytes32 _key) external;
function deleteInt(bytes32 _key) external;
function deleteBytes32(bytes32 _key) external;
// Arithmetic
function addUint(bytes32 _key, uint256 _amount) external;
function subUint(bytes32 _key, uint256 _amount) external;
// Protected storage
function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address);
function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address);
function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external;
function confirmWithdrawalAddress(address _nodeAddress) external;
}
RocketNetworkBalancesInterface.sol 14 lines
pragma solidity >0.5.0 <0.9.0;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketNetworkBalancesInterface {
function getBalancesBlock() external view returns (uint256);
function getLatestReportableBlock() external view returns (uint256);
function getTotalETHBalance() external view returns (uint256);
function getStakingETHBalance() external view returns (uint256);
function getTotalRETHSupply() external view returns (uint256);
function getETHUtilizationRate() external view returns (uint256);
function submitBalances(uint256 _block, uint256 _total, uint256 _staking, uint256 _rethSupply) external;
function executeUpdateBalances(uint256 _block, uint256 _totalEth, uint256 _stakingEth, uint256 _rethSupply) external;
}
ICrossDomainMessenger.sol 43 lines
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.9.0;
/**
* @title ICrossDomainMessenger
*/
interface ICrossDomainMessenger {
/**********
* Events *
**********/
event SentMessage(
address indexed target,
address sender,
bytes message,
uint256 messageNonce,
uint256 gasLimit
);
event RelayedMessage(bytes32 indexed msgHash);
event FailedRelayedMessage(bytes32 indexed msgHash);
/*************
* Variables *
*************/
function xDomainMessageSender() external view returns (address);
/********************
* Public Functions *
********************/
/**
* Sends a cross domain message to the target messenger.
* @param _target Target contract address.
* @param _message Message to send to the target.
* @param _gasLimit Gas limit for the provided message.
*/
function sendMessage(
address _target,
bytes calldata _message,
uint32 _gasLimit
) external;
}
Read Contract
ovmL1CrossDomainMessenger 0xf4bd7de1 → address
priceMessenger 0xce21d3dd → address
rate 0x2c4e722e → uint256
rateStale 0xee0eb4a1 → bool
wrethL2 0xbc2c4c64 → address
Write Contract 2 functions
These functions modify contract state and require a wallet transaction to execute.
rebase 0xaf14052c
No parameters
submitRate 0x9c14b3a8
No parameters
Recent Transactions
Transaction index is loading. Only unfinalized transactions are shown while the index starts up.