Source Code
Latest 25 from a total of 760 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Add Round Data S... | 18007199 | 309 days ago | IN | 0 FRAX | 0.00000728 | ||||
| Add Round Data S... | 17402550 | 323 days ago | IN | 0 FRAX | 0.00001578 | ||||
| Add Round Data S... | 16797601 | 337 days ago | IN | 0 FRAX | 0.0000071 | ||||
| Add Round Data S... | 16192799 | 351 days ago | IN | 0 FRAX | 0.00001345 | ||||
| Add Round Data S... | 15631649 | 364 days ago | IN | 0 FRAX | 0.00003717 | ||||
| Add Round Data S... | 13965004 | 403 days ago | IN | 0 FRAX | 0.00004797 | ||||
| Add Round Data S... | 13441358 | 415 days ago | IN | 0 FRAX | 0.00009254 | ||||
| Add Round Data S... | 13083609 | 423 days ago | IN | 0 FRAX | 0.00008596 | ||||
| Add Round Data S... | 12564007 | 435 days ago | IN | 0 FRAX | 0.0001164 | ||||
| Add Round Data S... | 10749759 | 477 days ago | IN | 0 FRAX | 0.00034059 | ||||
| Add Round Data S... | 10556407 | 482 days ago | IN | 0 FRAX | 0.00003702 | ||||
| Add Round Data S... | 8458952 | 530 days ago | IN | 0 FRAX | 0.00003759 | ||||
| Transfer Timeloc... | 7213036 | 559 days ago | IN | 0 FRAX | 0.00000149 | ||||
| Add Round Data S... | 7165652 | 560 days ago | IN | 0 FRAX | 0.00006436 | ||||
| Add Round Data S... | 6616502 | 573 days ago | IN | 0 FRAX | 0.00003794 | ||||
| Add Round Data S... | 6065486 | 586 days ago | IN | 0 FRAX | 0.00002306 | ||||
| Add Round Data S... | 4745252 | 616 days ago | IN | 0 FRAX | 0.00016115 | ||||
| Add Round Data S... | 4744054 | 616 days ago | IN | 0 FRAX | 0.00012634 | ||||
| Add Round Data S... | 4626002 | 619 days ago | IN | 0 FRAX | 0.00002487 | ||||
| Add Round Data S... | 4584304 | 620 days ago | IN | 0 FRAX | 0.00002502 | ||||
| Add Round Data S... | 4508403 | 622 days ago | IN | 0 FRAX | 0.00003559 | ||||
| Add Round Data S... | 4507803 | 622 days ago | IN | 0 FRAX | 0.00002785 | ||||
| Add Round Data S... | 4507502 | 622 days ago | IN | 0 FRAX | 0.00002442 | ||||
| Add Round Data S... | 4309352 | 626 days ago | IN | 0 FRAX | 0.00003814 | ||||
| Add Round Data S... | 4230002 | 628 days ago | IN | 0 FRAX | 0.00006788 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MerkleProofPriceSourceSdai
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
// | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
// | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
// | |
// ====================================================================
// ========================= MerkleProofSdai ==========================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance
// ====================================================================
import { ERC165Storage } from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import { Timelock2Step } from "frax-std/access-control/v1/Timelock2Step.sol";
import { ITimelock2Step } from "frax-std/access-control/v1/interfaces/ITimelock2Step.sol";
import { MerkleTreeProver } from "./lib/MerkleTreeProver.sol";
import { StateProofVerifier as Verifier } from "./lib/StateProofVerifier.sol";
import { IERC4626Receiver } from "src/contracts/interfaces/IERC4626Receiver.sol";
import { IStateRootOracle } from "./interfaces/IStateRootOracle.sol";
import { FixedPointMathLib } from "@solmate/utils/FixedPointMathLib.sol";
/// @title MerkleProofPriceSource
/// @notice Proves price round data from an L1 Frax Oracle and pushes the price data to an L2 Frax Oracle
contract MerkleProofPriceSourceSdai is ERC165Storage, Timelock2Step {
/// @notice The address of the StateRootOracle on Layer 2
IStateRootOracle public immutable STATE_ROOT_ORACLE;
using FixedPointMathLib for uint256;
struct OracleConfig {
address layer1Oracle;
uint96 lastBlockProofed;
}
/// @notice Configuration linking Frax Oracles for the same asset on L1 / L2
mapping(address layer2FraxOracle => OracleConfig layer1Config) public oracleLookup;
/// @notice The ```constructor``` function
/// @param _stateRootOracle Address of the L2 StateRootOracle
/// @param _timelockAddress Address of Timelock contract on L2
constructor(address _stateRootOracle, address _timelockAddress) Timelock2Step() {
_setTimelock({ _newTimelock: _timelockAddress });
_registerInterface({ interfaceId: type(ITimelock2Step).interfaceId });
STATE_ROOT_ORACLE = IStateRootOracle(_stateRootOracle);
}
// ====================================================================
// Events
// ====================================================================
/// @notice The ```OraclePairAdded``` event is emitted when a new Frax Oracle pair is added
/// @param fraxOracleLayer1 The address of the layer 1 Frax Oracle
/// @param fraxOracleLayer2 The address of the layer 2 Frax Oracle
event OraclePairAdded(address indexed fraxOracleLayer1, address indexed fraxOracleLayer2);
// ====================================================================
// Configuration Setters
// ====================================================================
/// @dev A pair of addresses that are the Frax Oracles for the same asset on layer 1 and layer 2
struct OraclePair {
address layer1FraxOracle;
address layer2FraxOracle;
}
/// @notice The ```addOraclePairs``` function sets an L1/L2 pair if they haven't been set already
/// @param _oraclePairs List of OraclePairs representing the same oracle on L1 and L2
function addOraclePairs(OraclePair[] calldata _oraclePairs) external {
_requireTimelock();
for (uint256 i = 0; i < _oraclePairs.length; ++i) {
OraclePair memory _oraclePair = _oraclePairs[i];
if (oracleLookup[_oraclePair.layer2FraxOracle].layer1Oracle != address(0)) {
revert OraclePairAlreadySet({
fraxOracleLayer1: oracleLookup[_oraclePair.layer2FraxOracle].layer1Oracle,
fraxOracleLayer2: _oraclePair.layer2FraxOracle
});
}
oracleLookup[_oraclePair.layer2FraxOracle].layer1Oracle = _oraclePair.layer1FraxOracle;
emit OraclePairAdded({
fraxOracleLayer1: _oraclePair.layer1FraxOracle,
fraxOracleLayer2: _oraclePair.layer2FraxOracle
});
}
}
// ====================================================================
// Proof / Add Price Function
// ====================================================================
function _fetchAndProofSdai(
address _sDaiPotAddress,
uint96 _blockNumber,
bytes[] memory _accountProofPot,
bytes[] memory _storageProofDsr,
bytes[] memory _storageProofRho,
bytes[] memory _storageProofChi
) internal view returns (uint256 dsr, uint256 rho, uint256 chi) {
IStateRootOracle.BlockInfo memory _blockInfo = STATE_ROOT_ORACLE.getBlockInfo(_blockNumber);
Verifier.Account memory _accountProofPot = MerkleTreeProver.proveStorageRoot({
stateRootHash: _blockInfo.stateRootHash,
proofAddress: _sDaiPotAddress,
accountProof: _accountProofPot
});
dsr = uint256(
MerkleTreeProver
.proveStorageSlotValue({
storageRootHash: _accountProofPot.storageRoot,
slot: bytes32(uint256(3)),
storageProof: _storageProofDsr
})
.value
);
rho = uint256(
MerkleTreeProver
.proveStorageSlotValue({
storageRootHash: _accountProofPot.storageRoot,
slot: bytes32(uint256(7)),
storageProof: _storageProofRho
})
.value
);
chi = uint256(
MerkleTreeProver
.proveStorageSlotValue({
storageRootHash: _accountProofPot.storageRoot,
slot: bytes32(uint256(4)),
storageProof: _storageProofChi
})
.value
);
if (dsr == 0) revert MustBeGtZero();
if (rho == 0) revert MustBeGtZero();
if (chi == 0) revert MustBeGtZero();
}
function addRoundDataSdai(
IERC4626Receiver _sDaiAddress,
uint96 _blockNumber,
bytes[] memory _accountProofPot,
bytes[] memory _storageProofDsr,
bytes[] memory _storageProofRho,
bytes[] memory _storageProofChi
) external {
uint96 lastBlockProofed = oracleLookup[address(_sDaiAddress)].lastBlockProofed;
if (lastBlockProofed != 0) {
if (_blockNumber < lastBlockProofed) revert StalePush();
}
// Address of the L1 oracle
address _proofAddress = oracleLookup[address(_sDaiAddress)].layer1Oracle;
if (_proofAddress == address(0)) revert WrongOracleAddress();
(uint256 dst, uint256 rho, uint256 chi) = _fetchAndProofSdai(
_proofAddress,
_blockNumber,
_accountProofPot,
_storageProofDsr,
_storageProofRho,
_storageProofChi
);
_sDaiAddress.updateDaiVaultData(_blockNumber, dst, rho, chi);
oracleLookup[address(_sDaiAddress)].lastBlockProofed = _blockNumber;
}
// ====================================================================
// Errors
// ====================================================================
error OraclePairAlreadySet(address fraxOracleLayer1, address fraxOracleLayer2);
error WrongOracleAddress();
error StalePush();
error MustBeGtZero();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)
pragma solidity ^0.8.0;
import "./ERC165.sol";
/**
* @dev Storage based implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
abstract contract ERC165Storage is ERC165 {
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}// SPDX-License-Identifier: ISC
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
// | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
// | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
// | |
// ====================================================================
// ========================== Timelock2Step ===========================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance
// Primary Author
// Drake Evans: https://github.com/DrakeEvans
// Reviewers
// Dennis: https://github.com/denett
// ====================================================================
/// @title Timelock2Step
/// @author Drake Evans (Frax Finance) https://github.com/drakeevans
/// @dev Inspired by the OpenZeppelin's Ownable2Step contract
/// @notice An abstract contract which contains 2-step transfer and renounce logic for a timelock address
abstract contract Timelock2Step {
/// @notice The pending timelock address
address public pendingTimelockAddress;
/// @notice The current timelock address
address public timelockAddress;
constructor() {
timelockAddress = msg.sender;
}
/// @notice Emitted when timelock is transferred
error OnlyTimelock();
/// @notice Emitted when pending timelock is transferred
error OnlyPendingTimelock();
/// @notice The ```TimelockTransferStarted``` event is emitted when the timelock transfer is initiated
/// @param previousTimelock The address of the previous timelock
/// @param newTimelock The address of the new timelock
event TimelockTransferStarted(address indexed previousTimelock, address indexed newTimelock);
/// @notice The ```TimelockTransferred``` event is emitted when the timelock transfer is completed
/// @param previousTimelock The address of the previous timelock
/// @param newTimelock The address of the new timelock
event TimelockTransferred(address indexed previousTimelock, address indexed newTimelock);
/// @notice The ```_isSenderTimelock``` function checks if msg.sender is current timelock address
/// @return Whether or not msg.sender is current timelock address
function _isSenderTimelock() internal view returns (bool) {
return msg.sender == timelockAddress;
}
/// @notice The ```_requireTimelock``` function reverts if msg.sender is not current timelock address
function _requireTimelock() internal view {
if (msg.sender != timelockAddress) revert OnlyTimelock();
}
/// @notice The ```_isSenderPendingTimelock``` function checks if msg.sender is pending timelock address
/// @return Whether or not msg.sender is pending timelock address
function _isSenderPendingTimelock() internal view returns (bool) {
return msg.sender == pendingTimelockAddress;
}
/// @notice The ```_requirePendingTimelock``` function reverts if msg.sender is not pending timelock address
function _requirePendingTimelock() internal view {
if (msg.sender != pendingTimelockAddress) revert OnlyPendingTimelock();
}
/// @notice The ```_transferTimelock``` function initiates the timelock transfer
/// @dev This function is to be implemented by a public function
/// @param _newTimelock The address of the nominated (pending) timelock
function _transferTimelock(address _newTimelock) internal {
pendingTimelockAddress = _newTimelock;
emit TimelockTransferStarted(timelockAddress, _newTimelock);
}
/// @notice The ```_acceptTransferTimelock``` function completes the timelock transfer
/// @dev This function is to be implemented by a public function
function _acceptTransferTimelock() internal {
pendingTimelockAddress = address(0);
_setTimelock(msg.sender);
}
/// @notice The ```_setTimelock``` function sets the timelock address
/// @dev This function is to be implemented by a public function
/// @param _newTimelock The address of the new timelock
function _setTimelock(address _newTimelock) internal {
emit TimelockTransferred(timelockAddress, _newTimelock);
timelockAddress = _newTimelock;
}
/// @notice The ```transferTimelock``` function initiates the timelock transfer
/// @dev Must be called by the current timelock
/// @param _newTimelock The address of the nominated (pending) timelock
function transferTimelock(address _newTimelock) external virtual {
_requireTimelock();
_transferTimelock(_newTimelock);
}
/// @notice The ```acceptTransferTimelock``` function completes the timelock transfer
/// @dev Must be called by the pending timelock
function acceptTransferTimelock() external virtual {
_requirePendingTimelock();
_acceptTransferTimelock();
}
/// @notice The ```renounceTimelock``` function renounces the timelock after setting pending timelock to current timelock
/// @dev Pending timelock must be set to current timelock before renouncing, creating a 2-step renounce process
function renounceTimelock() external virtual {
_requireTimelock();
_requirePendingTimelock();
_transferTimelock(address(0));
_setTimelock(address(0));
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
interface ITimelock2Step {
event TimelockTransferStarted(address indexed previousTimelock, address indexed newTimelock);
event TimelockTransferred(address indexed previousTimelock, address indexed newTimelock);
function acceptTransferTimelock() external;
function pendingTimelockAddress() external view returns (address);
function renounceTimelock() external;
function timelockAddress() external view returns (address);
function transferTimelock(address _newTimelock) external;
}//SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
// | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
// | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
// | |
// ====================================================================
// ========================= MerkleTreeProver =========================
// ====================================================================
// Frax Finance: https://github.com/FraxFinance
// Authors
// Jon Walch: https://github.com/jonwalch
// Dennis: https://github.com/denett
// Reviewers
// Drake Evans: https://github.com/DrakeEvans
// ====================================================================
import { RLPReader } from "rlp/RLPReader.sol";
import { StateProofVerifier as Verifier } from "./StateProofVerifier.sol";
/// @title MerkleTreeProver
/// @author Jon Walch (Frax Finance) https://github.com/jonwalch
/// @notice Helper function library for interacting with StateProofVerifier and RLPReader
library MerkleTreeProver {
using RLPReader for bytes;
using RLPReader for RLPReader.RLPItem;
/// @notice The ```proveStorageRoot``` function is a helper function for StateProofVerifier.extractAccountFromProof()
/// @param stateRootHash The hash of the state root
/// @param proofAddress The address of the contract we're proving
/// @param accountProof The accountProof retrieved from eth_getProof
function proveStorageRoot(
bytes32 stateRootHash,
address proofAddress,
bytes[] memory accountProof
) internal view returns (Verifier.Account memory accountPool) {
RLPReader.RLPItem[] memory accountProofRlp = new RLPReader.RLPItem[](accountProof.length);
for (uint256 i = 0; i < accountProof.length; ++i) {
accountProofRlp[i] = accountProof[i].toRlpItem();
}
accountPool = Verifier.extractAccountFromProof({
_addressHash: keccak256(abi.encodePacked(proofAddress)),
_stateRootHash: stateRootHash,
_proof: accountProofRlp
});
}
/// @notice The ```proveStorageSlotValue``` function is a helper function for StateProofVerifier.extractSlotValueFromProof()
/// @param storageRootHash The hash of the storage root
/// @param slot The slot we want to prove for the contract
/// @param storageProof The storageProof.proof retrieved from eth_getProof
function proveStorageSlotValue(
bytes32 storageRootHash,
bytes32 slot,
bytes[] memory storageProof
) internal view returns (Verifier.SlotValue memory slotValue) {
RLPReader.RLPItem[] memory storageProofRlp = new RLPReader.RLPItem[](storageProof.length);
for (uint256 i = 0; i < storageProof.length; ++i) {
storageProofRlp[i] = storageProof[i].toRlpItem();
}
slotValue = Verifier.extractSlotValueFromProof({
_slotHash: keccak256(abi.encodePacked(slot)),
_storageRootHash: storageRootHash,
_proof: storageProofRlp
});
}
}// SPDX-License-Identifier: MIT
// Copied from https://github.com/lidofinance/curve-merkle-oracle/blob/1033b3e84142317ffd8f366b52e489d5eb49c73f/contracts/StateProofVerifier.sol
pragma solidity ^0.8.19;
import { RLPReader } from "rlp/RLPReader.sol";
import { MerklePatriciaProofVerifier } from "./MerklePatriciaProofVerifier.sol";
/**
* @title A helper library for verification of Merkle Patricia account and state proofs.
*/
library StateProofVerifier {
using RLPReader for RLPReader.RLPItem;
using RLPReader for bytes;
uint256 constant HEADER_STATE_ROOT_INDEX = 3;
uint256 constant HEADER_NUMBER_INDEX = 8;
uint256 constant HEADER_TIMESTAMP_INDEX = 11;
struct BlockHeader {
bytes32 hash;
bytes32 stateRootHash;
uint256 number;
uint256 timestamp;
}
struct Account {
bool exists;
uint256 nonce;
uint256 balance;
bytes32 storageRoot;
bytes32 codeHash;
}
struct SlotValue {
bool exists;
uint256 value;
}
/**
* @notice Parses block header and verifies its presence onchain within the latest 256 blocks.
* @param _headerRlpBytes RLP-encoded block header.
*/
function verifyBlockHeader(bytes memory _headerRlpBytes) internal view returns (BlockHeader memory) {
BlockHeader memory header = parseBlockHeader(_headerRlpBytes);
// ensure that the block is actually in the blockchain
require(header.hash == blockhash(header.number), "blockhash mismatch");
return header;
}
/**
* @notice Parses RLP-encoded block header.
* @param _headerRlpBytes RLP-encoded block header.
*/
function parseBlockHeader(bytes memory _headerRlpBytes) internal pure returns (BlockHeader memory) {
BlockHeader memory result;
RLPReader.RLPItem[] memory headerFields = _headerRlpBytes.toRlpItem().toList();
require(headerFields.length > HEADER_TIMESTAMP_INDEX);
result.stateRootHash = bytes32(headerFields[HEADER_STATE_ROOT_INDEX].toUint());
result.number = headerFields[HEADER_NUMBER_INDEX].toUint();
result.timestamp = headerFields[HEADER_TIMESTAMP_INDEX].toUint();
result.hash = keccak256(_headerRlpBytes);
return result;
}
/**
* @notice Verifies Merkle Patricia proof of an account and extracts the account fields.
*
* @param _addressHash Keccak256 hash of the address corresponding to the account.
* @param _stateRootHash MPT root hash of the Ethereum state trie.
*/
function extractAccountFromProof(
bytes32 _addressHash, // keccak256(abi.encodePacked(address))
bytes32 _stateRootHash,
RLPReader.RLPItem[] memory _proof
) internal pure returns (Account memory) {
bytes memory acctRlpBytes = MerklePatriciaProofVerifier.extractProofValue(
_stateRootHash,
abi.encodePacked(_addressHash),
_proof
);
Account memory account;
if (acctRlpBytes.length == 0) {
return account;
}
RLPReader.RLPItem[] memory acctFields = acctRlpBytes.toRlpItem().toList();
require(acctFields.length == 4);
account.exists = true;
account.nonce = acctFields[0].toUint();
account.balance = acctFields[1].toUint();
account.storageRoot = bytes32(acctFields[2].toUint());
account.codeHash = bytes32(acctFields[3].toUint());
return account;
}
/**
* @notice Verifies Merkle Patricia proof of a slot and extracts the slot's value.
*
* @param _slotHash Keccak256 hash of the slot position.
* @param _storageRootHash MPT root hash of the account's storage trie.
*/
function extractSlotValueFromProof(
bytes32 _slotHash,
bytes32 _storageRootHash,
RLPReader.RLPItem[] memory _proof
) internal pure returns (SlotValue memory) {
bytes memory valueRlpBytes = MerklePatriciaProofVerifier.extractProofValue(
_storageRootHash,
abi.encodePacked(_slotHash),
_proof
);
SlotValue memory value;
if (valueRlpBytes.length != 0) {
value.exists = true;
value.value = valueRlpBytes.toRlpItem().toUint();
}
return value;
}
}// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;
interface IERC4626Receiver {
function updateErc4262VaultData(
uint96 _l1BlockNumber,
uint256 _totalSupply,
uint256 _totalAssets,
uint192 _lastRewardsAmount,
uint32 _lastSync,
uint32 _rewardsCycleEnd
) external;
function updateDaiVaultData(uint96 _l1BlockNumber, uint256 _dsr, uint256 _rho, uint256 _chi) external;
function getPrices() external view returns (bool, uint256, uint256);
function dsr() external view returns (uint256);
function chi() external view returns (uint256);
function rho() external view returns (uint256);
}// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;
interface IStateRootOracle {
struct BlockInfo {
bytes32 stateRootHash;
uint40 timestamp;
}
function getBlockInfo(uint256 blockNumber) external view returns (BlockInfo memory _blockInfo);
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib {
/*//////////////////////////////////////////////////////////////
SIMPLIFIED FIXED POINT OPERATIONS
//////////////////////////////////////////////////////////////*/
uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.
function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.
}
function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.
}
function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.
}
function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.
}
/*//////////////////////////////////////////////////////////////
LOW LEVEL FIXED POINT OPERATIONS
//////////////////////////////////////////////////////////////*/
function mulDivDown(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 z) {
assembly {
// Store x * y in z for now.
z := mul(x, y)
// Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))
if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
revert(0, 0)
}
// Divide z by the denominator.
z := div(z, denominator)
}
}
function mulDivUp(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 z) {
assembly {
// Store x * y in z for now.
z := mul(x, y)
// Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))
if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
revert(0, 0)
}
// First, divide z - 1 by the denominator and add 1.
// We allow z - 1 to underflow if z is 0, because we multiply the
// end result by 0 if z is zero, ensuring we return 0 if z is zero.
z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))
}
}
function rpow(
uint256 x,
uint256 n,
uint256 scalar
) internal pure returns (uint256 z) {
assembly {
switch x
case 0 {
switch n
case 0 {
// 0 ** 0 = 1
z := scalar
}
default {
// 0 ** n = 0
z := 0
}
}
default {
switch mod(n, 2)
case 0 {
// If n is even, store scalar in z for now.
z := scalar
}
default {
// If n is odd, store x in z for now.
z := x
}
// Shifting right by 1 is like dividing by 2.
let half := shr(1, scalar)
for {
// Shift n right by 1 before looping to halve it.
n := shr(1, n)
} n {
// Shift n right by 1 each iteration to halve it.
n := shr(1, n)
} {
// Revert immediately if x ** 2 would overflow.
// Equivalent to iszero(eq(div(xx, x), x)) here.
if shr(128, x) {
revert(0, 0)
}
// Store x squared.
let xx := mul(x, x)
// Round to the nearest number.
let xxRound := add(xx, half)
// Revert if xx + half overflowed.
if lt(xxRound, xx) {
revert(0, 0)
}
// Set x to scaled xxRound.
x := div(xxRound, scalar)
// If n is even:
if mod(n, 2) {
// Compute z * x.
let zx := mul(z, x)
// If z * x overflowed:
if iszero(eq(div(zx, x), z)) {
// Revert if x is non-zero.
if iszero(iszero(x)) {
revert(0, 0)
}
}
// Round to the nearest number.
let zxRound := add(zx, half)
// Revert if zx + half overflowed.
if lt(zxRound, zx) {
revert(0, 0)
}
// Return properly scaled zxRound.
z := div(zxRound, scalar)
}
}
}
}
}
/*//////////////////////////////////////////////////////////////
GENERAL NUMBER UTILITIES
//////////////////////////////////////////////////////////////*/
function sqrt(uint256 x) internal pure returns (uint256 z) {
assembly {
// Start off with z at 1.
z := 1
// Used below to help find a nearby power of 2.
let y := x
// Find the lowest power of 2 that is at least sqrt(x).
if iszero(lt(y, 0x100000000000000000000000000000000)) {
y := shr(128, y) // Like dividing by 2 ** 128.
z := shl(64, z) // Like multiplying by 2 ** 64.
}
if iszero(lt(y, 0x10000000000000000)) {
y := shr(64, y) // Like dividing by 2 ** 64.
z := shl(32, z) // Like multiplying by 2 ** 32.
}
if iszero(lt(y, 0x100000000)) {
y := shr(32, y) // Like dividing by 2 ** 32.
z := shl(16, z) // Like multiplying by 2 ** 16.
}
if iszero(lt(y, 0x10000)) {
y := shr(16, y) // Like dividing by 2 ** 16.
z := shl(8, z) // Like multiplying by 2 ** 8.
}
if iszero(lt(y, 0x100)) {
y := shr(8, y) // Like dividing by 2 ** 8.
z := shl(4, z) // Like multiplying by 2 ** 4.
}
if iszero(lt(y, 0x10)) {
y := shr(4, y) // Like dividing by 2 ** 4.
z := shl(2, z) // Like multiplying by 2 ** 2.
}
if iszero(lt(y, 0x8)) {
// Equivalent to 2 ** z.
z := shl(1, z)
}
// Shifting right by 1 is like dividing by 2.
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
// Compute a rounded down version of z.
let zRoundDown := div(x, z)
// If zRoundDown is smaller, use it.
if lt(zRoundDown, z) {
z := zRoundDown
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: Apache-2.0 /* * @author Hamdi Allam [email protected] * Please reach out with any questions or concerns */ pragma solidity >=0.5.10 <0.9.0; library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } struct Iterator { RLPItem item; // Item that's being iterated over. uint256 nextPtr; // Position of the next item in the list. } /* * @dev Returns the next element in the iteration. Reverts if it has not next element. * @param self The iterator. * @return The next element in the iteration. */ function next(Iterator memory self) internal pure returns (RLPItem memory) { require(hasNext(self)); uint256 ptr = self.nextPtr; uint256 itemLength = _itemLength(ptr); self.nextPtr = ptr + itemLength; return RLPItem(itemLength, ptr); } /* * @dev Returns true if the iteration has more elements. * @param self The iterator. * @return true if the iteration has more elements. */ function hasNext(Iterator memory self) internal pure returns (bool) { RLPItem memory item = self.item; return self.nextPtr < item.memPtr + item.len; } /* * @param item RLP encoded bytes */ function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) { uint256 memPtr; assembly { memPtr := add(item, 0x20) } return RLPItem(item.length, memPtr); } /* * @dev Create an iterator. Reverts if item is not a list. * @param self The RLP item. * @return An 'Iterator' over the item. */ function iterator(RLPItem memory self) internal pure returns (Iterator memory) { require(isList(self)); uint256 ptr = self.memPtr + _payloadOffset(self.memPtr); return Iterator(self, ptr); } /* * @param the RLP item. */ function rlpLen(RLPItem memory item) internal pure returns (uint256) { return item.len; } /* * @param the RLP item. * @return (memPtr, len) pair: location of the item's payload in memory. */ function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) { uint256 offset = _payloadOffset(item.memPtr); uint256 memPtr = item.memPtr + offset; uint256 len = item.len - offset; // data length return (memPtr, len); } /* * @param the RLP item. */ function payloadLen(RLPItem memory item) internal pure returns (uint256) { (, uint256 len) = payloadLocation(item); return len; } /* * @param the RLP item containing the encoded list. */ function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item)); uint256 items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 dataLen; for (uint256 i = 0; i < items; i++) { dataLen = _itemLength(memPtr); result[i] = RLPItem(dataLen, memPtr); memPtr = memPtr + dataLen; } return result; } // @return indicator whether encoded payload is a list. negate this function call for isData. function isList(RLPItem memory item) internal pure returns (bool) { if (item.len == 0) return false; uint8 byte0; uint256 memPtr = item.memPtr; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < LIST_SHORT_START) return false; return true; } /* * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory. * @return keccak256 hash of RLP encoded bytes. */ function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) { uint256 ptr = item.memPtr; uint256 len = item.len; bytes32 result; assembly { result := keccak256(ptr, len) } return result; } /* * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory. * @return keccak256 hash of the item payload. */ function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) { (uint256 memPtr, uint256 len) = payloadLocation(item); bytes32 result; assembly { result := keccak256(memPtr, len) } return result; } /** RLPItem conversions into data types **/ // @returns raw rlp encoding in bytes function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) { bytes memory result = new bytes(item.len); if (result.length == 0) return result; uint256 ptr; assembly { ptr := add(0x20, result) } copy(item.memPtr, ptr, item.len); return result; } // any non-zero byte except "0x80" is considered true function toBoolean(RLPItem memory item) internal pure returns (bool) { require(item.len == 1); uint256 result; uint256 memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) } // SEE Github Issue #5. // Summary: Most commonly used RLP libraries (i.e Geth) will encode // "0" as "0x80" instead of as "0". We handle this edge case explicitly // here. if (result == 0 || result == STRING_SHORT_START) { return false; } else { return true; } } function toAddress(RLPItem memory item) internal pure returns (address) { // 1 byte for the length prefix require(item.len == 21); return address(uint160(toUint(item))); } function toUint(RLPItem memory item) internal pure returns (uint256) { require(item.len > 0 && item.len <= 33); (uint256 memPtr, uint256 len) = payloadLocation(item); uint256 result; assembly { result := mload(memPtr) // shift to the correct location if neccesary if lt(len, 32) { result := div(result, exp(256, sub(32, len))) } } return result; } // enforces 32 byte length function toUintStrict(RLPItem memory item) internal pure returns (uint256) { // one byte prefix require(item.len == 33); uint256 result; uint256 memPtr = item.memPtr + 1; assembly { result := mload(memPtr) } return result; } function toBytes(RLPItem memory item) internal pure returns (bytes memory) { require(item.len > 0); (uint256 memPtr, uint256 len) = payloadLocation(item); bytes memory result = new bytes(len); uint256 destPtr; assembly { destPtr := add(0x20, result) } copy(memPtr, destPtr, len); return result; } /* * Private Helpers */ // @return number of payload items inside an encoded list. function numItems(RLPItem memory item) private pure returns (uint256) { if (item.len == 0) return 0; uint256 count = 0; uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 endPtr = item.memPtr + item.len; while (currPtr < endPtr) { currPtr = currPtr + _itemLength(currPtr); // skip over an item count++; } return count; } // @return entire rlp item byte length function _itemLength(uint256 memPtr) private pure returns (uint256) { uint256 itemLen; uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) { itemLen = 1; } else if (byte0 < STRING_LONG_START) { itemLen = byte0 - STRING_SHORT_START + 1; } else if (byte0 < LIST_SHORT_START) { assembly { let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is memPtr := add(memPtr, 1) // skip over the first byte /* 32 byte word size */ let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len itemLen := add(dataLen, add(byteLen, 1)) } } else if (byte0 < LIST_LONG_START) { itemLen = byte0 - LIST_SHORT_START + 1; } else { assembly { let byteLen := sub(byte0, 0xf7) memPtr := add(memPtr, 1) let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length itemLen := add(dataLen, add(byteLen, 1)) } } return itemLen; } // @return number of bytes until the data function _payloadOffset(uint256 memPtr) private pure returns (uint256) { uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) { return 0; } else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) { return 1; } else if (byte0 < LIST_SHORT_START) { // being explicit return byte0 - (STRING_LONG_START - 1) + 1; } else { return byte0 - (LIST_LONG_START - 1) + 1; } } /* * @param src Pointer to source * @param dest Pointer to destination * @param len Amount of memory to copy from the source */ function copy(uint256 src, uint256 dest, uint256 len) private pure { if (len == 0) return; // copy as many word sizes as possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } src += WORD_SIZE; dest += WORD_SIZE; } if (len > 0) { // left over bytes. Mask is used to remove unwanted bytes from the word uint256 mask = 256**(WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) } } } }
// SPDX-License-Identifier: MIT
// Copied from https://github.com/lidofinance/curve-merkle-oracle/blob/1033b3e84142317ffd8f366b52e489d5eb49c73f/contracts/MerklePatriciaProofVerifier.sol
/**
* Copied from https://github.com/lorenzb/proveth/blob/c74b20e/onchain/ProvethVerifier.sol
* with minor performance and code style-related modifications.
*/
pragma solidity ^0.8.19;
import { RLPReader } from "rlp/RLPReader.sol";
library MerklePatriciaProofVerifier {
using RLPReader for RLPReader.RLPItem;
using RLPReader for bytes;
/// @dev Validates a Merkle-Patricia-Trie proof.
/// If the proof proves the inclusion of some key-value pair in the
/// trie, the value is returned. Otherwise, i.e. if the proof proves
/// the exclusion of a key from the trie, an empty byte array is
/// returned.
/// @param rootHash is the Keccak-256 hash of the root node of the MPT.
/// @param path is the key of the node whose inclusion/exclusion we are
/// proving.
/// @param stack is the stack of MPT nodes (starting with the root) that
/// need to be traversed during verification.
/// @return value whose inclusion is proved or an empty byte array for
/// a proof of exclusion
function extractProofValue(
bytes32 rootHash,
bytes memory path,
RLPReader.RLPItem[] memory stack
) internal pure returns (bytes memory value) {
bytes memory mptKey = _decodeNibbles(path, 0);
uint256 mptKeyOffset = 0;
bytes32 nodeHashHash;
RLPReader.RLPItem[] memory node;
RLPReader.RLPItem memory rlpValue;
if (stack.length == 0) {
// Root hash of empty Merkle-Patricia-Trie
require(rootHash == 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421);
return new bytes(0);
}
// Traverse stack of nodes starting at root.
for (uint256 i = 0; i < stack.length; i++) {
// We use the fact that an rlp encoded list consists of some
// encoding of its length plus the concatenation of its
// *rlp-encoded* items.
// The root node is hashed with Keccak-256 ...
if (i == 0 && rootHash != stack[i].rlpBytesKeccak256()) {
revert();
}
// ... whereas all other nodes are hashed with the MPT
// hash function.
if (i != 0 && nodeHashHash != _mptHashHash(stack[i])) {
revert();
}
// We verified that stack[i] has the correct hash, so we
// may safely decode it.
node = stack[i].toList();
if (node.length == 2) {
// Extension or Leaf node
bool isLeaf;
bytes memory nodeKey;
(isLeaf, nodeKey) = _merklePatriciaCompactDecode(node[0].toBytes());
uint256 prefixLength = _sharedPrefixLength(mptKeyOffset, mptKey, nodeKey);
mptKeyOffset += prefixLength;
if (prefixLength < nodeKey.length) {
// Proof claims divergent extension or leaf. (Only
// relevant for proofs of exclusion.)
// An Extension/Leaf node is divergent iff it "skips" over
// the point at which a Branch node should have been had the
// excluded key been included in the trie.
// Example: Imagine a proof of exclusion for path [1, 4],
// where the current node is a Leaf node with
// path [1, 3, 3, 7]. For [1, 4] to be included, there
// should have been a Branch node at [1] with a child
// at 3 and a child at 4.
// Sanity check
if (i < stack.length - 1) {
// divergent node must come last in proof
revert();
}
return new bytes(0);
}
if (isLeaf) {
// Sanity check
if (i < stack.length - 1) {
// leaf node must come last in proof
revert();
}
if (mptKeyOffset < mptKey.length) {
return new bytes(0);
}
rlpValue = node[1];
return rlpValue.toBytes();
} else {
// extension
// Sanity check
if (i == stack.length - 1) {
// shouldn't be at last level
revert();
}
if (!node[1].isList()) {
// rlp(child) was at least 32 bytes. node[1] contains
// Keccak256(rlp(child)).
nodeHashHash = node[1].payloadKeccak256();
} else {
// rlp(child) was less than 32 bytes. node[1] contains
// rlp(child).
nodeHashHash = node[1].rlpBytesKeccak256();
}
}
} else if (node.length == 17) {
// Branch node
if (mptKeyOffset != mptKey.length) {
// we haven't consumed the entire path, so we need to look at a child
uint8 nibble = uint8(mptKey[mptKeyOffset]);
mptKeyOffset += 1;
if (nibble >= 16) {
// each element of the path has to be a nibble
revert();
}
if (_isEmptyBytesequence(node[nibble])) {
// Sanity
if (i != stack.length - 1) {
// leaf node should be at last level
revert();
}
return new bytes(0);
} else if (!node[nibble].isList()) {
nodeHashHash = node[nibble].payloadKeccak256();
} else {
nodeHashHash = node[nibble].rlpBytesKeccak256();
}
} else {
// we have consumed the entire mptKey, so we need to look at what's contained in this node.
// Sanity
if (i != stack.length - 1) {
// should be at last level
revert();
}
return node[16].toBytes();
}
}
}
}
/// @dev Computes the hash of the Merkle-Patricia-Trie hash of the RLP item.
/// Merkle-Patricia-Tries use a weird "hash function" that outputs
/// *variable-length* hashes: If the item is shorter than 32 bytes,
/// the MPT hash is the item. Otherwise, the MPT hash is the
/// Keccak-256 hash of the item.
/// The easiest way to compare variable-length byte sequences is
/// to compare their Keccak-256 hashes.
/// @param item The RLP item to be hashed.
/// @return Keccak-256(MPT-hash(item))
function _mptHashHash(RLPReader.RLPItem memory item) private pure returns (bytes32) {
if (item.len < 32) {
return item.rlpBytesKeccak256();
} else {
return keccak256(abi.encodePacked(item.rlpBytesKeccak256()));
}
}
function _isEmptyBytesequence(RLPReader.RLPItem memory item) private pure returns (bool) {
if (item.len != 1) {
return false;
}
uint8 b;
uint256 memPtr = item.memPtr;
assembly {
b := byte(0, mload(memPtr))
}
return b == 0x80; /* empty byte string */
}
function _merklePatriciaCompactDecode(
bytes memory compact
) private pure returns (bool isLeaf, bytes memory nibbles) {
require(compact.length > 0);
uint256 first_nibble = (uint8(compact[0]) >> 4) & 0xF;
uint256 skipNibbles;
if (first_nibble == 0) {
skipNibbles = 2;
isLeaf = false;
} else if (first_nibble == 1) {
skipNibbles = 1;
isLeaf = false;
} else if (first_nibble == 2) {
skipNibbles = 2;
isLeaf = true;
} else if (first_nibble == 3) {
skipNibbles = 1;
isLeaf = true;
} else {
// Not supposed to happen!
revert();
}
return (isLeaf, _decodeNibbles(compact, skipNibbles));
}
function _decodeNibbles(bytes memory compact, uint256 skipNibbles) private pure returns (bytes memory nibbles) {
require(compact.length > 0);
uint256 length = compact.length * 2;
require(skipNibbles <= length);
length -= skipNibbles;
nibbles = new bytes(length);
uint256 nibblesLength = 0;
for (uint256 i = skipNibbles; i < skipNibbles + length; i += 1) {
if (i % 2 == 0) {
nibbles[nibblesLength] = bytes1((uint8(compact[i / 2]) >> 4) & 0xF);
} else {
nibbles[nibblesLength] = bytes1((uint8(compact[i / 2]) >> 0) & 0xF);
}
nibblesLength += 1;
}
assert(nibblesLength == nibbles.length);
}
function _sharedPrefixLength(uint256 xsOffset, bytes memory xs, bytes memory ys) private pure returns (uint256) {
uint256 i;
for (i = 0; i + xsOffset < xs.length && i < ys.length; i++) {
if (xs[i + xsOffset] != ys[i]) {
return i;
}
}
return i;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"ds-test/=node_modules/ds-test/src/",
"forge-std/=node_modules/forge-std/src/",
"frax-std/=node_modules/frax-standard-solidity/src/",
"script/=src/script/",
"src/=src/",
"test/=src/test/",
"interfaces/=src/contracts/interfaces/",
"arbitrum/=node_modules/@arbitrum/",
"rlp/=node_modules/solidity-rlp/contracts/",
"@solmate/=node_modules/@rari-capital/solmate/src/",
"@arbitrum/=node_modules/@arbitrum/",
"@chainlink/=node_modules/@chainlink/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@mean-finance/=node_modules/@mean-finance/",
"@offchainlabs/=node_modules/@offchainlabs/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@rari-capital/=node_modules/@rari-capital/",
"@uniswap/=node_modules/@uniswap/",
"base64-sol/=node_modules/base64-sol/",
"frax-standard-solidity/=node_modules/frax-standard-solidity/",
"hardhat/=node_modules/hardhat/",
"prb-math/=node_modules/prb-math/",
"solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
"solidity-rlp/=node_modules/solidity-rlp/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_stateRootOracle","type":"address"},{"internalType":"address","name":"_timelockAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"MustBeGtZero","type":"error"},{"inputs":[],"name":"OnlyPendingTimelock","type":"error"},{"inputs":[],"name":"OnlyTimelock","type":"error"},{"inputs":[{"internalType":"address","name":"fraxOracleLayer1","type":"address"},{"internalType":"address","name":"fraxOracleLayer2","type":"address"}],"name":"OraclePairAlreadySet","type":"error"},{"inputs":[],"name":"StalePush","type":"error"},{"inputs":[],"name":"WrongOracleAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fraxOracleLayer1","type":"address"},{"indexed":true,"internalType":"address","name":"fraxOracleLayer2","type":"address"}],"name":"OraclePairAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTimelock","type":"address"},{"indexed":true,"internalType":"address","name":"newTimelock","type":"address"}],"name":"TimelockTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTimelock","type":"address"},{"indexed":true,"internalType":"address","name":"newTimelock","type":"address"}],"name":"TimelockTransferred","type":"event"},{"inputs":[],"name":"STATE_ROOT_ORACLE","outputs":[{"internalType":"contract IStateRootOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptTransferTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"layer1FraxOracle","type":"address"},{"internalType":"address","name":"layer2FraxOracle","type":"address"}],"internalType":"struct MerkleProofPriceSourceSdai.OraclePair[]","name":"_oraclePairs","type":"tuple[]"}],"name":"addOraclePairs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC4626Receiver","name":"_sDaiAddress","type":"address"},{"internalType":"uint96","name":"_blockNumber","type":"uint96"},{"internalType":"bytes[]","name":"_accountProofPot","type":"bytes[]"},{"internalType":"bytes[]","name":"_storageProofDsr","type":"bytes[]"},{"internalType":"bytes[]","name":"_storageProofRho","type":"bytes[]"},{"internalType":"bytes[]","name":"_storageProofChi","type":"bytes[]"}],"name":"addRoundDataSdai","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"layer2FraxOracle","type":"address"}],"name":"oracleLookup","outputs":[{"internalType":"address","name":"layer1Oracle","type":"address"},{"internalType":"uint96","name":"lastBlockProofed","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingTimelockAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelockAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newTimelock","type":"address"}],"name":"transferTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b506040516200242638038062002426833981016040819052620000349162000173565b600280546001600160a01b03191633179055620000518162000076565b62000063632fa3fc3160e21b620000d2565b506001600160a01b0316608052620001ab565b6002546040516001600160a01b038084169216907f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc690600090a3600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160e01b03198082169003620001315760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640160405180910390fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b80516001600160a01b03811681146200016e57600080fd5b919050565b600080604083850312156200018757600080fd5b620001928362000156565b9150620001a26020840162000156565b90509250929050565b608051612258620001ce6000396000818161017201526108e001526122586000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80639378ca5611610076578063b42db5051161005b578063b42db505146101a7578063edb219c0146101ba578063f6ccaad41461025157600080fd5b80639378ca561461016d578063a6d7fdf21461019457600080fd5b806345014095116100a757806345014095146101305780634bc66f32146101455780634f8b4ae71461016557600080fd5b806301ffc9a7146100c3578063090f3f50146100eb575b600080fd5b6100d66100d1366004611b92565b610259565b60405190151581526020015b60405180910390f35b60015461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b61014361013e366004611bf6565b6102e2565b005b60025461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b6101436102f6565b61010b7f000000000000000000000000000000000000000000000000000000000000000081565b6101436101a2366004611c13565b61031c565b6101436101b5366004611e69565b6104a6565b6102186101c8366004611bf6565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff8116907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1682565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526bffffffffffffffffffffffff9091166020830152016100e2565b6101436106cf565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806102dc57507fffffffff00000000000000000000000000000000000000000000000000000000821660009081526020819052604090205460ff165b92915050565b6102ea6106df565b6102f381610730565b50565b6102fe6106df565b6103066107a7565b6103106000610730565b61031a60006107f8565b565b6103246106df565b60005b818110156104a157600083838381811061034357610343611f36565b9050604002018036038101906103599190611f65565b60208082015173ffffffffffffffffffffffffffffffffffffffff908116600090815260039092526040909120549192501615610401576020818101805173ffffffffffffffffffffffffffffffffffffffff9081166000908152600390935260409283902054915183517f729d6d9c000000000000000000000000000000000000000000000000000000008152928216600484015216602482015290519081900360440190fd5b80516020808301805173ffffffffffffffffffffffffffffffffffffffff90811660009081526003909352604080842080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169583169590951790945590518451935190821693909116917fc662d74d8469d456352095edb1ed6a69f64c66ace9fa3598de77edfccfad12a291a35061049a81611fd5565b9050610327565b505050565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600360205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff16801561054e57806bffffffffffffffffffffffff16866bffffffffffffffffffffffff16101561054e576040517f011d308100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff80881660009081526003602052604090205416806105ad576040517f17e740e800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060006105c0848b8b8b8b8b610886565b6040517fb44cd0c40000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff8e166004820152602481018490526044810183905260648101829052929550909350915073ffffffffffffffffffffffffffffffffffffffff8c169063b44cd0c490608401600060405180830381600087803b15801561065257600080fd5b505af1158015610666573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff9b8c16600090815260036020526040902080546bffffffffffffffffffffffff909c1674010000000000000000000000000000000000000000029b909c169a909a17909a5550505050505050505050565b6106d76107a7565b61031a610a66565b60025473ffffffffffffffffffffffffffffffffffffffff16331461031a576040517f1c0be90a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604051919216907f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a90600090a350565b60015473ffffffffffffffffffffffffffffffffffffffff16331461031a576040517ff5c49e6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc690600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040517fbb141cf40000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff8616600482015260009081908190819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063bb141cf4906024016040805180830381865afa158015610926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094a919061200d565b9050600061095d82600001518c8b610a97565b90506109728160600151600360001b8a610c07565b60200151945061098b8160600151600760001b89610c07565b6020015193506109a48160600151600460001b88610c07565b602001519250846000036109e4576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83600003610a1e576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82600003610a58576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505096509650969350505050565b600180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561031a336107f8565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526000825167ffffffffffffffff811115610ade57610ade611caf565b604051908082528060200260200182016040528015610b2357816020015b6040805180820190915260008082526020820152815260200190600190039081610afc5790505b50905060005b8351811015610baa57610b7c848281518110610b4757610b47611f36565b602002602001015160408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b828281518110610b8e57610b8e611f36565b602002602001018190525080610ba390611fd5565b9050610b29565b506040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606086901b166020820152610bfe90603401604051602081830303815290604052805190602001208683610d02565b95945050505050565b60408051808201909152600080825260208201526000825167ffffffffffffffff811115610c3757610c37611caf565b604051908082528060200260200182016040528015610c7c57816020015b6040805180820190915260008082526020820152815260200190600190039081610c555790505b50905060005b8351811015610cce57610ca0848281518110610b4757610b47611f36565b828281518110610cb257610cb2611f36565b602002602001018190525080610cc790611fd5565b9050610c82565b50610bfe84604051602001610ce591815260200190565b604051602081830303815290604052805190602001208683610e79565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526000610d5b8486604051602001610d4691815260200190565b60405160208183030381529060405285610f06565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529091508151600003610d9b579150610e729050565b6000610dd6610dd18460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b611342565b90508051600414610de657600080fd5b600182528051610e0e908290600090610e0157610e01611f36565b6020026020010151611458565b60208301528051610e2c9082906001908110610e0157610e01611f36565b60408301528051610e4a9082906002908110610e0157610e01611f36565b60608301528051610e689082906003908110610e0157610e01611f36565b6080830152509150505b9392505050565b60408051808201909152600080825260208201526000610ea68486604051602001610d4691815260200190565b6040805180820190915260008082526020820152909150815115610bfe5760018152604080518082018252600080825260209182015281518083019092528351825280840190820152610ef890611458565b602082015295945050505050565b60606000610f158460006114a6565b90506000806060610f39604051806040016040528060008152602001600081525090565b8651600003610f8a577f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218914610f6e57600080fd5b50506040805160008152602081019091529350610e7292505050565b60005b87518110156113355780158015610fcc5750610fc8888281518110610fb457610fb4611f36565b602002602001015160208101519051902090565b8a14155b15610fd657600080fd5b80158015906110065750611002888281518110610ff557610ff5611f36565b602002602001015161167c565b8414155b1561101057600080fd5b61103288828151811061102557611025611f36565b6020026020010151611342565b925082516002036111de576000606061106c6110678660008151811061105a5761105a611f36565b60200260200101516116d6565b611754565b9092509050600061107e888a846117ef565b905061108a8189612043565b975081518110156110ed5760018b516110a39190612056565b8410156110af57600080fd5b60005b6040519080825280601f01601f1916602001820160405280156110dc576020820181803683370190505b509950505050505050505050610e72565b82156111535760018b516111019190612056565b84101561110d57600080fd5b885188101561111d5760006110b2565b8560018151811061113057611130611f36565b60200260200101519450611143856116d6565b9950505050505050505050610e72565b60018b516111619190612056565b840361116c57600080fd5b61118f8660018151811061118257611182611f36565b60200260200101516118aa565b6111bd576111b6866001815181106111a9576111a9611f36565b60200260200101516118e5565b96506111d6565b6111d386600181518110610fb457610fb4611f36565b96505b505050611323565b825160110361132357855185146112e757600086868151811061120357611203611f36565b016020015160f81c9050611218600187612043565b955060108160ff161061122a57600080fd5b61124f848260ff168151811061124257611242611f36565b60200260200101516118fd565b1561128b57600189516112629190612056565b821461126d57600080fd5b50506040805160008152602081019091529550610e72945050505050565b6112a3848260ff168151811061118257611182611f36565b6112c6576112bf848260ff16815181106111a9576111a9611f36565b94506112e1565b6112de848260ff1681518110610fb457610fb4611f36565b94505b50611323565b600188516112f59190612056565b811461130057600080fd5b6113168360108151811061105a5761105a611f36565b9650505050505050610e72565b8061132d81611fd5565b915050610f8d565b5050505050509392505050565b606061134d826118aa565b61135657600080fd5b600061136183611920565b905060008167ffffffffffffffff81111561137e5761137e611caf565b6040519080825280602002602001820160405280156113c357816020015b604080518082019091526000808252602082015281526020019060019003908161139c5790505b50905060006113d585602001516119a5565b85602001516113e49190612043565b90506000805b8481101561144d576113fb83611a20565b915060405180604001604052808381526020018481525084828151811061142457611424611f36565b60209081029190910101526114398284612043565b92508061144581611fd5565b9150506113ea565b509195945050505050565b80516000901580159061146d57508151602110155b61147657600080fd5b60008061148284611ac9565b81519193509150602082101561149e5760208290036101000a90045b949350505050565b606060008351116114b657600080fd5b6000835160026114c69190612069565b9050808311156114d557600080fd5b6114df8382612056565b90508067ffffffffffffffff8111156114fa576114fa611caf565b6040519080825280601f01601f191660200182016040528015611524576020820181803683370190505b5091506000835b6115358386612043565b811015611663576115476002826120af565b6000036115cb5760048661155c6002846120c3565b8151811061156c5761156c611f36565b602001015160f81c60f81b60f81c60ff16901c600f1660f81b84838151811061159757611597611f36565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611644565b6000866115d96002846120c3565b815181106115e9576115e9611f36565b602001015160f81c60f81b60f81c60ff16901c600f1660f81b84838151811061161457611614611f36565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b61164f600183612043565b915061165c600182612043565b905061152b565b5082518114611674576116746120d7565b505092915050565b6000602082600001511015611699576020820151825190206102dc565b6020820151825190206040516020016116b491815260200190565b604051602081830303815290604052805190602001209050919050565b919050565b80516060906116e457600080fd5b6000806116f084611ac9565b9150915060008167ffffffffffffffff81111561170f5761170f611caf565b6040519080825280601f01601f191660200182016040528015611739576020820181803683370190505b5090506020810161174b848285611b10565b50949350505050565b60006060600083511161176657600080fd5b600060048460008151811061177d5761177d611f36565b60209101015160f81c901c600f16905060008181036117a257506000925060026117d9565b816001036117b657506000925060016117d9565b816002036117ca57506001925060026117d9565b816003036100be575060019250825b836117e486836114a6565b935093505050915091565b6000805b83516117ff8683612043565b10801561180c5750825181105b1561149e5782818151811061182357611823611f36565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016846118558784612043565b8151811061186557611865611f36565b01602001517fff000000000000000000000000000000000000000000000000000000000000001614611898579050610e72565b806118a281611fd5565b9150506117f3565b805160009081036118bd57506000919050565b6020820151805160001a9060c08210156118db575060009392505050565b5060019392505050565b60008060006118f384611ac9565b9020949350505050565b805160009060011461191157506000919050565b50602001515160001a60801490565b8051600090810361193357506000919050565b60008061194384602001516119a5565b84602001516119529190612043565b905060008460000151856020015161196a9190612043565b90505b8082101561199c5761197e82611a20565b6119889083612043565b91508261199481611fd5565b93505061196d565b50909392505050565b8051600090811a60808110156119be5750600092915050565b60b88110806119d9575060c081108015906119d9575060f881105b156119e75750600192915050565b60c0811015611a14576119fc600160b8612106565b611a099060ff1682612056565b610e72906001612043565b6119fc600160f8612106565b80516000908190811a6080811015611a3b5760019150611ac2565b60b8811015611a6157611a4f608082612056565b611a5a906001612043565b9150611ac2565b60c0811015611a8e5760b78103600185019450806020036101000a85510460018201810193505050611ac2565b60f8811015611aa257611a4f60c082612056565b60f78103600185019450806020036101000a855104600182018101935050505b5092915050565b6000806000611adb84602001516119a5565b90506000818560200151611aef9190612043565b90506000828660000151611b039190612056565b9196919550909350505050565b80600003611b1d57505050565b60208110611b555782518252611b34602084612043565b9250611b41602083612043565b9150611b4e602082612056565b9050611b1d565b80156104a15760006001611b6a836020612056565b611b769061010061223f565b611b809190612056565b84518451821691191617835250505050565b600060208284031215611ba457600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e7257600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146102f357600080fd5b600060208284031215611c0857600080fd5b8135610e7281611bd4565b60008060208385031215611c2657600080fd5b823567ffffffffffffffff80821115611c3e57600080fd5b818501915085601f830112611c5257600080fd5b813581811115611c6157600080fd5b8660208260061b8501011115611c7657600080fd5b60209290920196919550909350505050565b80356116d181611bd4565b80356bffffffffffffffffffffffff811681146116d157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611d0157611d01611caf565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611d4e57611d4e611caf565b604052919050565b6000601f8381840112611d6857600080fd5b8235602067ffffffffffffffff80831115611d8557611d85611caf565b8260051b611d94838201611d07565b9384528681018301938381019089861115611dae57600080fd5b84890192505b85831015611e5c57823584811115611dcc5760008081fd5b8901603f81018b13611dde5760008081fd5b85810135604086821115611df457611df4611caf565b611e23887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08c85011601611d07565b8281528d82848601011115611e385760008081fd5b828285018a8301376000928101890192909252508352509184019190840190611db4565b9998505050505050505050565b60008060008060008060c08789031215611e8257600080fd5b611e8b87611c88565b9550611e9960208801611c93565b9450604087013567ffffffffffffffff80821115611eb657600080fd5b611ec28a838b01611d56565b95506060890135915080821115611ed857600080fd5b611ee48a838b01611d56565b94506080890135915080821115611efa57600080fd5b611f068a838b01611d56565b935060a0890135915080821115611f1c57600080fd5b50611f2989828a01611d56565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060408284031215611f7757600080fd5b611f7f611cde565b8235611f8a81611bd4565b81526020830135611f9a81611bd4565b60208201529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361200657612006611fa6565b5060010190565b60006040828403121561201f57600080fd5b612027611cde565b82518152602083015164ffffffffff81168114611f9a57600080fd5b808201808211156102dc576102dc611fa6565b818103818111156102dc576102dc611fa6565b80820281158282048414176102dc576102dc611fa6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826120be576120be612080565b500690565b6000826120d2576120d2612080565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60ff82811682821603908111156102dc576102dc611fa6565b600181815b8085111561217857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561215e5761215e611fa6565b8085161561216b57918102915b93841c9390800290612124565b509250929050565b60008261218f575060016102dc565b8161219c575060006102dc565b81600181146121b257600281146121bc576121d8565b60019150506102dc565b60ff8411156121cd576121cd611fa6565b50506001821b6102dc565b5060208310610133831016604e8410600b84101617156121fb575081810a6102dc565b612205838361211f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561223757612237611fa6565b029392505050565b6000610e72838361218056fea164736f6c6343000813000a000000000000000000000000ed403d48e2bc946438b5686aa1ad65056ccf951200000000000000000000000031562ae726afebe25417df01bedc72ef489f45b3
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80639378ca5611610076578063b42db5051161005b578063b42db505146101a7578063edb219c0146101ba578063f6ccaad41461025157600080fd5b80639378ca561461016d578063a6d7fdf21461019457600080fd5b806345014095116100a757806345014095146101305780634bc66f32146101455780634f8b4ae71461016557600080fd5b806301ffc9a7146100c3578063090f3f50146100eb575b600080fd5b6100d66100d1366004611b92565b610259565b60405190151581526020015b60405180910390f35b60015461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b61014361013e366004611bf6565b6102e2565b005b60025461010b9073ffffffffffffffffffffffffffffffffffffffff1681565b6101436102f6565b61010b7f000000000000000000000000ed403d48e2bc946438b5686aa1ad65056ccf951281565b6101436101a2366004611c13565b61031c565b6101436101b5366004611e69565b6104a6565b6102186101c8366004611bf6565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff8116907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1682565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526bffffffffffffffffffffffff9091166020830152016100e2565b6101436106cf565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806102dc57507fffffffff00000000000000000000000000000000000000000000000000000000821660009081526020819052604090205460ff165b92915050565b6102ea6106df565b6102f381610730565b50565b6102fe6106df565b6103066107a7565b6103106000610730565b61031a60006107f8565b565b6103246106df565b60005b818110156104a157600083838381811061034357610343611f36565b9050604002018036038101906103599190611f65565b60208082015173ffffffffffffffffffffffffffffffffffffffff908116600090815260039092526040909120549192501615610401576020818101805173ffffffffffffffffffffffffffffffffffffffff9081166000908152600390935260409283902054915183517f729d6d9c000000000000000000000000000000000000000000000000000000008152928216600484015216602482015290519081900360440190fd5b80516020808301805173ffffffffffffffffffffffffffffffffffffffff90811660009081526003909352604080842080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169583169590951790945590518451935190821693909116917fc662d74d8469d456352095edb1ed6a69f64c66ace9fa3598de77edfccfad12a291a35061049a81611fd5565b9050610327565b505050565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600360205260409020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff16801561054e57806bffffffffffffffffffffffff16866bffffffffffffffffffffffff16101561054e576040517f011d308100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff80881660009081526003602052604090205416806105ad576040517f17e740e800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060006105c0848b8b8b8b8b610886565b6040517fb44cd0c40000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff8e166004820152602481018490526044810183905260648101829052929550909350915073ffffffffffffffffffffffffffffffffffffffff8c169063b44cd0c490608401600060405180830381600087803b15801561065257600080fd5b505af1158015610666573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff9b8c16600090815260036020526040902080546bffffffffffffffffffffffff909c1674010000000000000000000000000000000000000000029b909c169a909a17909a5550505050505050505050565b6106d76107a7565b61031a610a66565b60025473ffffffffffffffffffffffffffffffffffffffff16331461031a576040517f1c0be90a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604051919216907f162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a90600090a350565b60015473ffffffffffffffffffffffffffffffffffffffff16331461031a576040517ff5c49e6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc690600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040517fbb141cf40000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff8616600482015260009081908190819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ed403d48e2bc946438b5686aa1ad65056ccf9512169063bb141cf4906024016040805180830381865afa158015610926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094a919061200d565b9050600061095d82600001518c8b610a97565b90506109728160600151600360001b8a610c07565b60200151945061098b8160600151600760001b89610c07565b6020015193506109a48160600151600460001b88610c07565b602001519250846000036109e4576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83600003610a1e576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82600003610a58576040517fac34915700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505096509650969350505050565b600180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561031a336107f8565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526000825167ffffffffffffffff811115610ade57610ade611caf565b604051908082528060200260200182016040528015610b2357816020015b6040805180820190915260008082526020820152815260200190600190039081610afc5790505b50905060005b8351811015610baa57610b7c848281518110610b4757610b47611f36565b602002602001015160408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b828281518110610b8e57610b8e611f36565b602002602001018190525080610ba390611fd5565b9050610b29565b506040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606086901b166020820152610bfe90603401604051602081830303815290604052805190602001208683610d02565b95945050505050565b60408051808201909152600080825260208201526000825167ffffffffffffffff811115610c3757610c37611caf565b604051908082528060200260200182016040528015610c7c57816020015b6040805180820190915260008082526020820152815260200190600190039081610c555790505b50905060005b8351811015610cce57610ca0848281518110610b4757610b47611f36565b828281518110610cb257610cb2611f36565b602002602001018190525080610cc790611fd5565b9050610c82565b50610bfe84604051602001610ce591815260200190565b604051602081830303815290604052805190602001208683610e79565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526000610d5b8486604051602001610d4691815260200190565b60405160208183030381529060405285610f06565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529091508151600003610d9b579150610e729050565b6000610dd6610dd18460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b611342565b90508051600414610de657600080fd5b600182528051610e0e908290600090610e0157610e01611f36565b6020026020010151611458565b60208301528051610e2c9082906001908110610e0157610e01611f36565b60408301528051610e4a9082906002908110610e0157610e01611f36565b60608301528051610e689082906003908110610e0157610e01611f36565b6080830152509150505b9392505050565b60408051808201909152600080825260208201526000610ea68486604051602001610d4691815260200190565b6040805180820190915260008082526020820152909150815115610bfe5760018152604080518082018252600080825260209182015281518083019092528351825280840190820152610ef890611458565b602082015295945050505050565b60606000610f158460006114a6565b90506000806060610f39604051806040016040528060008152602001600081525090565b8651600003610f8a577f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218914610f6e57600080fd5b50506040805160008152602081019091529350610e7292505050565b60005b87518110156113355780158015610fcc5750610fc8888281518110610fb457610fb4611f36565b602002602001015160208101519051902090565b8a14155b15610fd657600080fd5b80158015906110065750611002888281518110610ff557610ff5611f36565b602002602001015161167c565b8414155b1561101057600080fd5b61103288828151811061102557611025611f36565b6020026020010151611342565b925082516002036111de576000606061106c6110678660008151811061105a5761105a611f36565b60200260200101516116d6565b611754565b9092509050600061107e888a846117ef565b905061108a8189612043565b975081518110156110ed5760018b516110a39190612056565b8410156110af57600080fd5b60005b6040519080825280601f01601f1916602001820160405280156110dc576020820181803683370190505b509950505050505050505050610e72565b82156111535760018b516111019190612056565b84101561110d57600080fd5b885188101561111d5760006110b2565b8560018151811061113057611130611f36565b60200260200101519450611143856116d6565b9950505050505050505050610e72565b60018b516111619190612056565b840361116c57600080fd5b61118f8660018151811061118257611182611f36565b60200260200101516118aa565b6111bd576111b6866001815181106111a9576111a9611f36565b60200260200101516118e5565b96506111d6565b6111d386600181518110610fb457610fb4611f36565b96505b505050611323565b825160110361132357855185146112e757600086868151811061120357611203611f36565b016020015160f81c9050611218600187612043565b955060108160ff161061122a57600080fd5b61124f848260ff168151811061124257611242611f36565b60200260200101516118fd565b1561128b57600189516112629190612056565b821461126d57600080fd5b50506040805160008152602081019091529550610e72945050505050565b6112a3848260ff168151811061118257611182611f36565b6112c6576112bf848260ff16815181106111a9576111a9611f36565b94506112e1565b6112de848260ff1681518110610fb457610fb4611f36565b94505b50611323565b600188516112f59190612056565b811461130057600080fd5b6113168360108151811061105a5761105a611f36565b9650505050505050610e72565b8061132d81611fd5565b915050610f8d565b5050505050509392505050565b606061134d826118aa565b61135657600080fd5b600061136183611920565b905060008167ffffffffffffffff81111561137e5761137e611caf565b6040519080825280602002602001820160405280156113c357816020015b604080518082019091526000808252602082015281526020019060019003908161139c5790505b50905060006113d585602001516119a5565b85602001516113e49190612043565b90506000805b8481101561144d576113fb83611a20565b915060405180604001604052808381526020018481525084828151811061142457611424611f36565b60209081029190910101526114398284612043565b92508061144581611fd5565b9150506113ea565b509195945050505050565b80516000901580159061146d57508151602110155b61147657600080fd5b60008061148284611ac9565b81519193509150602082101561149e5760208290036101000a90045b949350505050565b606060008351116114b657600080fd5b6000835160026114c69190612069565b9050808311156114d557600080fd5b6114df8382612056565b90508067ffffffffffffffff8111156114fa576114fa611caf565b6040519080825280601f01601f191660200182016040528015611524576020820181803683370190505b5091506000835b6115358386612043565b811015611663576115476002826120af565b6000036115cb5760048661155c6002846120c3565b8151811061156c5761156c611f36565b602001015160f81c60f81b60f81c60ff16901c600f1660f81b84838151811061159757611597611f36565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611644565b6000866115d96002846120c3565b815181106115e9576115e9611f36565b602001015160f81c60f81b60f81c60ff16901c600f1660f81b84838151811061161457611614611f36565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b61164f600183612043565b915061165c600182612043565b905061152b565b5082518114611674576116746120d7565b505092915050565b6000602082600001511015611699576020820151825190206102dc565b6020820151825190206040516020016116b491815260200190565b604051602081830303815290604052805190602001209050919050565b919050565b80516060906116e457600080fd5b6000806116f084611ac9565b9150915060008167ffffffffffffffff81111561170f5761170f611caf565b6040519080825280601f01601f191660200182016040528015611739576020820181803683370190505b5090506020810161174b848285611b10565b50949350505050565b60006060600083511161176657600080fd5b600060048460008151811061177d5761177d611f36565b60209101015160f81c901c600f16905060008181036117a257506000925060026117d9565b816001036117b657506000925060016117d9565b816002036117ca57506001925060026117d9565b816003036100be575060019250825b836117e486836114a6565b935093505050915091565b6000805b83516117ff8683612043565b10801561180c5750825181105b1561149e5782818151811061182357611823611f36565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016846118558784612043565b8151811061186557611865611f36565b01602001517fff000000000000000000000000000000000000000000000000000000000000001614611898579050610e72565b806118a281611fd5565b9150506117f3565b805160009081036118bd57506000919050565b6020820151805160001a9060c08210156118db575060009392505050565b5060019392505050565b60008060006118f384611ac9565b9020949350505050565b805160009060011461191157506000919050565b50602001515160001a60801490565b8051600090810361193357506000919050565b60008061194384602001516119a5565b84602001516119529190612043565b905060008460000151856020015161196a9190612043565b90505b8082101561199c5761197e82611a20565b6119889083612043565b91508261199481611fd5565b93505061196d565b50909392505050565b8051600090811a60808110156119be5750600092915050565b60b88110806119d9575060c081108015906119d9575060f881105b156119e75750600192915050565b60c0811015611a14576119fc600160b8612106565b611a099060ff1682612056565b610e72906001612043565b6119fc600160f8612106565b80516000908190811a6080811015611a3b5760019150611ac2565b60b8811015611a6157611a4f608082612056565b611a5a906001612043565b9150611ac2565b60c0811015611a8e5760b78103600185019450806020036101000a85510460018201810193505050611ac2565b60f8811015611aa257611a4f60c082612056565b60f78103600185019450806020036101000a855104600182018101935050505b5092915050565b6000806000611adb84602001516119a5565b90506000818560200151611aef9190612043565b90506000828660000151611b039190612056565b9196919550909350505050565b80600003611b1d57505050565b60208110611b555782518252611b34602084612043565b9250611b41602083612043565b9150611b4e602082612056565b9050611b1d565b80156104a15760006001611b6a836020612056565b611b769061010061223f565b611b809190612056565b84518451821691191617835250505050565b600060208284031215611ba457600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e7257600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146102f357600080fd5b600060208284031215611c0857600080fd5b8135610e7281611bd4565b60008060208385031215611c2657600080fd5b823567ffffffffffffffff80821115611c3e57600080fd5b818501915085601f830112611c5257600080fd5b813581811115611c6157600080fd5b8660208260061b8501011115611c7657600080fd5b60209290920196919550909350505050565b80356116d181611bd4565b80356bffffffffffffffffffffffff811681146116d157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611d0157611d01611caf565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611d4e57611d4e611caf565b604052919050565b6000601f8381840112611d6857600080fd5b8235602067ffffffffffffffff80831115611d8557611d85611caf565b8260051b611d94838201611d07565b9384528681018301938381019089861115611dae57600080fd5b84890192505b85831015611e5c57823584811115611dcc5760008081fd5b8901603f81018b13611dde5760008081fd5b85810135604086821115611df457611df4611caf565b611e23887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08c85011601611d07565b8281528d82848601011115611e385760008081fd5b828285018a8301376000928101890192909252508352509184019190840190611db4565b9998505050505050505050565b60008060008060008060c08789031215611e8257600080fd5b611e8b87611c88565b9550611e9960208801611c93565b9450604087013567ffffffffffffffff80821115611eb657600080fd5b611ec28a838b01611d56565b95506060890135915080821115611ed857600080fd5b611ee48a838b01611d56565b94506080890135915080821115611efa57600080fd5b611f068a838b01611d56565b935060a0890135915080821115611f1c57600080fd5b50611f2989828a01611d56565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060408284031215611f7757600080fd5b611f7f611cde565b8235611f8a81611bd4565b81526020830135611f9a81611bd4565b60208201529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361200657612006611fa6565b5060010190565b60006040828403121561201f57600080fd5b612027611cde565b82518152602083015164ffffffffff81168114611f9a57600080fd5b808201808211156102dc576102dc611fa6565b818103818111156102dc576102dc611fa6565b80820281158282048414176102dc576102dc611fa6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826120be576120be612080565b500690565b6000826120d2576120d2612080565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60ff82811682821603908111156102dc576102dc611fa6565b600181815b8085111561217857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561215e5761215e611fa6565b8085161561216b57918102915b93841c9390800290612124565b509250929050565b60008261218f575060016102dc565b8161219c575060006102dc565b81600181146121b257600281146121bc576121d8565b60019150506102dc565b60ff8411156121cd576121cd611fa6565b50506001821b6102dc565b5060208310610133831016604e8410600b84101617156121fb575081810a6102dc565b612205838361211f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561223757612237611fa6565b029392505050565b6000610e72838361218056fea164736f6c6343000813000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ed403d48e2bc946438b5686aa1ad65056ccf951200000000000000000000000031562ae726afebe25417df01bedc72ef489f45b3
-----Decoded View---------------
Arg [0] : _stateRootOracle (address): 0xeD403d48e2bC946438B5686AA1AD65056Ccf9512
Arg [1] : _timelockAddress (address): 0x31562ae726AFEBe25417df01bEdC72EF489F45b3
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ed403d48e2bc946438b5686aa1ad65056ccf9512
Arg [1] : 00000000000000000000000031562ae726afebe25417df01bedc72ef489f45b3
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.