Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x7660Ae09...455BF9528 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ChainOracle
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22; // TODO: use single version
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interfaces/IRLPReader.sol";
import "blobstream-contracts/src/lib/verifier/DAVerifier.sol";
import "blobstream-contracts/src/IDAOracle.sol";
import "./interfaces/ICanonicalStateChain.sol";
import "./lib/Lib_RLPEncode.sol";
/// @custom:proxied
/// @title ChainOracle
/// @author LightLink Hummingbird
/// @custom:version v1.1.0-beta
/// @notice This contract enables any user to directly upload valid Layer 2 blocks, from
/// the data availability layer, on to Layer 1. Once loaded, the headers and
/// transactions can be fetched from the ChainOracle by their respective hashes.
/// This mechanism is crucial for the other challenges listed below.
///
/// Data is loaded in two parts:
/// 1. Celestia shares are loaded, along with the required merkle proofs and
/// validator attestations.
/// 2. Stored shares can then be decoded into Layer 2 headers and transactions.
contract ChainOracle is UUPSUpgradeable, OwnableUpgradeable {
/// @notice The Canonical State Chain contract.
ICanonicalStateChain public canonicalStateChain;
/// @notice The Data Availability Oracle contract.
IDAOracle public daOracle;
/// @notice The RLP Reader contract.
IRLPReader public rlpReader;
/// @notice The SharesProof struct.
/// @param start - The start index of the shares in the block.
/// @param end - The end index of the shares in the block.
struct ShareRange {
uint256 start;
uint256 end;
}
/// @notice An L2 Header.
/// @param parentHash - The hash of the parent block.
/// @param uncleHash - The hash of the uncle block.
/// @param beneficiary - The address of the beneficiary.
/// @param stateRoot - The state root hash.
/// @param transactionsRoot - The transactions root hash.
/// @param receiptsRoot - The receipts root hash.
/// @param logsBloom - The logs bloom filter.
/// @param difficulty - The difficulty of the block.
/// @param number - The block number.
/// @param gasLimit - The gas limit of the block.
/// @param gasUsed - The gas used in the block.
/// @param timestamp - The timestamp of the block.
/// @param extraData - The extra data of the block.
/// @param mixHash - The mix hash of the block.
/// @param nonce - The nonce of the block.
struct L2Header {
bytes32 parentHash;
bytes32 uncleHash;
address beneficiary;
bytes32 stateRoot;
bytes32 transactionsRoot;
bytes32 receiptsRoot;
bytes logsBloom;
uint256 difficulty;
uint256 number;
uint256 gasLimit;
uint256 gasUsed;
uint256 timestamp;
bytes extraData;
bytes32 mixHash;
uint256 nonce;
}
/// @notice A Legacy Transaction.
/// @param nonce - The nonce of the transaction.
/// @param gasPrice - The gas price of the transaction.
/// @param gas - The gas limit of the transaction.
/// @param to - The address of the recipient.
/// @param value - The value of the transaction.
/// @param data - The data of the transaction.
/// @param r - The r value of the signature.
/// @param s - The s value of the signature.
/// @param v - The v value of the signature.
struct LegacyTx {
uint64 nonce;
uint256 gasPrice;
uint64 gas;
address to;
uint256 value;
bytes data;
uint256 r;
uint256 s;
uint256 v;
}
/// @notice A Deposit Transaction.
/// @param chainId - The chain ID of the transaction.
/// @param nonce - The nonce of the transaction.
/// @param gasPrice - The gas price of the transaction.
/// @param gas - The gas limit of the transaction.
/// @param to - The address of the recipient.
/// @param value - The value of the transaction.
/// @param data - The data of the transaction.
/// @param r - The r value of the signature.
/// @param s - The s value of the signature.
/// @param v - The v value of the signature.
struct DepositTx {
uint256 chainId;
uint64 nonce;
uint256 gasPrice;
uint64 gas;
address to;
uint256 value;
bytes data;
uint256 r;
uint256 s;
uint256 v;
}
/// @notice Stores shares that are provided to the contract.
mapping(bytes32 => bytes[]) public shares;
/// @notice Stores headers that are provided to the contract.
mapping(bytes32 => L2Header) public headers;
/// @notice Stores transactions that are provided to the contract.
mapping(bytes32 => DepositTx) public transactions;
/// @notice Stores the sharekey to rblock mapping.
/// @dev a special mapping of sharekey to rblock
mapping(bytes32 => bytes32) private _sharekeyToRblock;
/// @notice Stores the header to rblock mapping.
mapping(bytes32 => bytes32) public headerToRblock;
/// @notice This function is a special internal function that's part of
/// the UUPS upgradeable contract's lifecycle. When you want to
/// upgrade the contract to a new version, _authorizeUpgrade is
/// called to check whether the upgrade is authorized, thus
/// preventing anyone from just upgrading the contract.
/// @dev Only the owner can call this function.
function _authorizeUpgrade(address) internal override onlyOwner {}
/// @notice Initializes the contract with the canonical state chain, the data
/// availability oracle, and the RLP reader.
/// @param _canonicalStateChain - The address of the canonical state chain.
/// @param _daOracle - The address of the data availability oracle.
/// @param _rlpReader - The address of the RLP reader.
function initialize(
address _canonicalStateChain,
address _daOracle,
address _rlpReader
) public initializer {
__Ownable_init(msg.sender);
canonicalStateChain = ICanonicalStateChain(_canonicalStateChain);
daOracle = IDAOracle(_daOracle);
rlpReader = IRLPReader(_rlpReader);
}
/// @notice Loads some shares that were uploaded to the Data
/// Availability layer. It verifies the shares are included in a
/// given rblock (bundle) and stores them in the contract.
/// @param _rblock - The rblock (bundle) that the shares are related to.
/// @param _pointer - The pointer to the shares in the rblock.
/// @param _proof - The proof that the shares are available and part of the
/// rblocks dataroot commitment.
/// @return The share key that the shares are stored under.
function provideShares(
bytes32 _rblock,
uint8 _pointer,
SharesProof memory _proof
) public returns (bytes32) {
// 1. Load the rblock (bundle) from the canonical state chain.
ICanonicalStateChain.Header memory rHead = canonicalStateChain
.getHeaderByHash(_rblock);
require(rHead.epoch > 0, "rblock not found");
require(
rHead.celestiaPointers[_pointer].height ==
_proof.attestationProof.tuple.height,
"rblock height mismatch"
);
// 2. verify shares are valid
(bool verified, ) = DAVerifier.verifySharesToDataRootTupleRoot(
daOracle,
_proof,
_proof.attestationProof.tuple.dataRoot
);
require(verified, "shares not verified");
(uint256 squaresize, ) = DAVerifier.computeSquareSizeFromRowProof(
_proof.rowProofs[0]
);
// check that the share index is within the celestia pointer range.
uint64 shareStart = rHead.celestiaPointers[_pointer].shareStart;
uint64 shareEnd = shareStart +
rHead.celestiaPointers[_pointer].shareLen;
uint256 shareIndexInRow = _proof.shareProofs[0].beginKey;
uint256 shareIndexInRowMajorOrder = shareIndexInRow +
squaresize *
_proof.rowProofs[0].key;
require(
shareIndexInRowMajorOrder >= shareStart &&
shareIndexInRowMajorOrder < shareEnd,
"provided share must be within the celestia pointer range"
);
// 3. create a share by hashing the rblock and shares
bytes32 shareKey = ShareKey(_rblock, _proof.data);
// 4. store the shares
shares[shareKey] = _proof.data;
// 5. store the sharekey to rblock
_sharekeyToRblock[shareKey] = _rblock;
return shareKey;
}
/// @notice Decodes the shares into an L2 header and stores it
/// in the contract.
/// @param _shareKey - The share key that the header is related to.
/// @param _range - The range of the shares that contain the header.
/// @return The hash of the header.
function provideHeader(
bytes32 _shareKey,
ShareRange[] calldata _range
) public returns (bytes32) {
bytes[] storage shareData = shares[_shareKey];
require(shareData.length > 0, "share not found");
// 1. Decode the RLP header.
L2Header memory header = decodeRLPHeader(
extractData(shareData, _range)
);
require(header.number > 0, "header number is 0");
// 2. Hash the header.
bytes32 headerHash = hashHeader(header);
// 3. Store the header.
require(headers[headerHash].number == 0, "header already exists");
headers[headerHash] = header;
// 4. Store the header to rblock
headerToRblock[headerHash] = _sharekeyToRblock[_shareKey];
return headerHash;
}
/// @notice Decodes the shares into a transaction and stores it
/// in the contract.
/// @param _shareKey - The share key that the transaction is related to.
/// @param _range - The range of the shares that contain the transaction.
/// @return The hash of the transaction.
function provideLegacyTx(
bytes32 _shareKey,
ShareRange[] calldata _range
) public returns (bytes32) {
bytes[] storage shareData = shares[_shareKey];
require(shareData.length > 0, "share not found");
// 1. Extract the RLP transaction from the shares.
bytes memory rlpTx = extractData(shareData, _range);
// 2. Decode the RLP transaction.
LegacyTx memory ltx = decodeLegacyTx(rlpTx);
// 3. Hash the transaction.
bytes32 txHash = keccak256(rlpTx);
// 4. Store the transaction.
require(transactions[txHash].nonce == 0, "transaction already exists");
transactions[txHash] = DepositTx({
chainId: 0,
nonce: ltx.nonce,
gasPrice: ltx.gasPrice,
gas: ltx.gas,
to: ltx.to,
value: ltx.value,
data: ltx.data,
r: ltx.r,
s: ltx.s,
v: ltx.v
});
return txHash;
}
/// @notice Calulates the share key from the rblock and share data.
/// @param _rblock - The rblock that the shares are related to.
/// @param _shareData - The share data.
/// @return The share key.
function ShareKey(
bytes32 _rblock,
bytes[] memory _shareData
) public pure returns (bytes32) {
return keccak256(abi.encode(_rblock, _shareData));
}
/// TODO: Move to a library
/// @notice Extracts the data from the shares using the range.
/// @param raw - The raw data.
/// @param ranges - The ranges of the data.
/// @return The extracted data.
function extractData(
bytes[] memory raw,
ShareRange[] memory ranges
) public pure returns (bytes memory) {
// figure out the length of the data
uint256 length = 0;
for (uint i = 0; i < ranges.length; i++) {
ShareRange memory r = ranges[i];
length += r.end - r.start;
}
// copy the data using the ranges
bytes memory data = new bytes(length);
uint256 index = 0;
for (uint i = 0; i < ranges.length; i++) {
ShareRange memory r = ranges[i];
// Ensure that the range is valid for the corresponding raw data
require(r.end <= raw[i].length, "Invalid range");
for (uint j = r.start; j < r.end; j++) {
data[index] = raw[i][j];
index++;
}
}
return data;
}
/// @notice Decodes an RLP header into the Header struct.
/// @param _data - The RLP encoded header.
/// @return The decoded header.
function decodeRLPHeader(
bytes memory _data
) public view returns (L2Header memory) {
(
bytes32 parentHash,
bytes32 sha3Uncles,
address coinbase,
bytes32 stateRoot,
bytes32 transactionsRoot,
bytes32 receiptsRoot,
uint difficulty,
uint number,
uint gasLimit,
uint gasUsed,
uint timestamp,
uint nonce
) = rlpReader.toBlockHeader(_data);
L2Header memory header = L2Header({
parentHash: parentHash,
uncleHash: sha3Uncles,
beneficiary: coinbase,
stateRoot: stateRoot,
transactionsRoot: transactionsRoot,
receiptsRoot: receiptsRoot,
logsBloom: bytes(
abi.encodePacked(
bytes32(0),
bytes32(0),
bytes32(0),
bytes32(0),
bytes32(0),
bytes32(0),
bytes32(0),
bytes32(0)
)
),
difficulty: difficulty,
number: number,
gasLimit: gasLimit,
gasUsed: gasUsed,
timestamp: timestamp,
extraData: bytes(""),
mixHash: bytes32(0),
nonce: nonce
});
return header;
}
/// @notice Hashes an Ethereum header in the same way that it is hashed on Ethereum.
/// @param _header - The header to hash.
/// @return The hash of the header.
function hashHeader(L2Header memory _header) public pure returns (bytes32) {
bytes[] memory list = new bytes[](15);
list[0] = RLPEncode.encodeBytes(abi.encodePacked(_header.parentHash));
list[1] = RLPEncode.encodeBytes(abi.encodePacked(_header.uncleHash));
list[2] = RLPEncode.encodeAddress(_header.beneficiary);
list[3] = RLPEncode.encodeBytes(abi.encodePacked(_header.stateRoot));
list[4] = RLPEncode.encodeBytes(
abi.encodePacked(_header.transactionsRoot)
);
list[5] = RLPEncode.encodeBytes(abi.encodePacked(_header.receiptsRoot));
list[6] = RLPEncode.encodeBytes(_header.logsBloom);
list[7] = RLPEncode.encodeUint(_header.difficulty);
list[8] = RLPEncode.encodeUint(_header.number);
list[9] = RLPEncode.encodeUint(_header.gasLimit);
list[10] = RLPEncode.encodeUint(_header.gasUsed);
list[11] = RLPEncode.encodeUint(_header.timestamp);
list[12] = RLPEncode.encodeBytes(_header.extraData);
list[13] = RLPEncode.encodeBytes(abi.encodePacked(_header.mixHash));
list[14] = RLPEncode.encodeUint(_header.nonce);
return keccak256(RLPEncode.encodeList(list));
}
/// @notice Decodes a legacy transaction from RLP encoded data.
/// @param _data - The RLP encoded transaction.
/// @return The decoded transaction.
function decodeLegacyTx(
bytes memory _data
) public view returns (LegacyTx memory) {
(
uint nonce,
uint gasPrice,
uint gasLimit,
address to,
uint value,
bytes memory data,
uint v,
uint r,
uint s
) = rlpReader.toLegacyTx(_data);
LegacyTx memory ltx = LegacyTx({
nonce: uint64(nonce),
gasPrice: gasPrice,
gas: uint64(gasLimit),
to: to,
value: value,
data: data,
r: uint256(r),
s: uint256(s),
v: v
});
return ltx;
}
/// @notice Decodes a deposit transaction from RLP encoded data.
/// @param _data - The RLP encoded transaction.
/// @return The decoded transaction.
function decodeDepositTx(
bytes memory _data
) public view returns (DepositTx memory) {
(
uint256 chainId,
uint nonce,
uint gasPrice,
uint gasLimit,
address to,
uint value,
bytes memory data,
uint8 v,
bytes32 r,
bytes32 s
) = rlpReader.toDepositTx(_data);
DepositTx memory dtx = DepositTx({
chainId: chainId,
nonce: uint64(nonce),
gasPrice: gasPrice,
gas: uint64(gasLimit),
to: to,
value: value,
data: data,
r: uint256(r),
s: uint256(s),
v: v
});
return dtx;
}
/// @notice Returns the header for a given header hash.
/// @param _headerHash - The hash of the header.
/// @return The header.
function getHeader(
bytes32 _headerHash
) public view returns (L2Header memory) {
return headers[_headerHash];
}
/// @notice Returns the transaction for a given transaction hash.
/// @param _txHash - The hash of the transaction.
/// @return The transaction.
function getTransaction(
bytes32 _txHash
) public view returns (DepositTx memory) {
return transactions[_txHash];
}
/// @notice Sets the RLPReader contract address.
/// @param _rlpReader - The new RLPReader address.
/// @dev Only the owner can call this function.
function setRLPReader(address _rlpReader) public onlyOwner {
rlpReader = IRLPReader(_rlpReader);
}
/// @notice Sets the data availability oracle contract address.
/// @param _daOracle The new data availability oracle address.
/// @dev Only the owner can call this function.
function setDAOracle(address _daOracle) public onlyOwner {
daOracle = IDAOracle(_daOracle);
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
/// @custom:storage-location erc7201:openzeppelin.storage.Ownable
struct OwnableStorage {
address _owner;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;
function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
assembly {
$.slot := OwnableStorageLocation
}
}
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
function __Ownable_init(address initialOwner) internal onlyInitializing {
__Ownable_init_unchained(initialOwner);
}
function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
OwnableStorage storage $ = _getOwnableStorage();
return $._owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
OwnableStorage storage $ = _getOwnableStorage();
address oldOwner = $._owner;
$._owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.20;
import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address private immutable __self = address(this);
/**
* @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
* and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
* while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
* If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
* be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
* during an upgrade.
*/
string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";
/**
* @dev The call is from an unauthorized context.
*/
error UUPSUnauthorizedCallContext();
/**
* @dev The storage `slot` is unsupported as a UUID.
*/
error UUPSUnsupportedProxiableUUID(bytes32 slot);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
_checkProxy();
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
_checkNotDelegated();
_;
}
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual notDelegated returns (bytes32) {
return ERC1967Utils.IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data);
}
/**
* @dev Reverts if the execution is not performed via delegatecall or the execution
* context is not of a proxy with an ERC1967-compliant implementation pointing to self.
* See {_onlyProxy}.
*/
function _checkProxy() internal view virtual {
if (
address(this) == __self || // Must be called through delegatecall
ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
) {
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Reverts if the execution is performed via delegatecall.
* See {notDelegated}.
*/
function _checkNotDelegated() internal view virtual {
if (address(this) != __self) {
// Must not be called through delegatecall
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
*
* As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
* is expected to be the implementation slot in ERC1967.
*
* Emits an {IERC1967-Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
revert UUPSUnsupportedProxiableUUID(slot);
}
ERC1967Utils.upgradeToAndCall(newImplementation, data);
} catch {
// The implementation is not UUPS
revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.20;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.20;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {UpgradeableBeacon} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)
pragma solidity ^0.8.20;
import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*/
library ERC1967Utils {
// We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
// This will be fixed in Solidity 0.8.21. At that point we should remove these events.
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev The `implementation` of the proxy is invalid.
*/
error ERC1967InvalidImplementation(address implementation);
/**
* @dev The `admin` of the proxy is invalid.
*/
error ERC1967InvalidAdmin(address admin);
/**
* @dev The `beacon` of the proxy is invalid.
*/
error ERC1967InvalidBeacon(address beacon);
/**
* @dev An upgrade function sees `msg.value > 0` that may be lost.
*/
error ERC1967NonPayable();
/**
* @dev Returns the current implementation address.
*/
function getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(newImplementation);
}
StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Performs implementation upgrade with additional setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
if (data.length > 0) {
Address.functionDelegateCall(newImplementation, data);
} else {
_checkNonPayable();
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
* the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
if (newAdmin == address(0)) {
revert ERC1967InvalidAdmin(address(0));
}
StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {IERC1967-AdminChanged} event.
*/
function changeAdmin(address newAdmin) internal {
emit AdminChanged(getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
if (newBeacon.code.length == 0) {
revert ERC1967InvalidBeacon(newBeacon);
}
StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
address beaconImplementation = IBeacon(newBeacon).implementation();
if (beaconImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(beaconImplementation);
}
}
/**
* @dev Change the beacon and trigger a setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-BeaconUpgraded} event.
*
* CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
* it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
* efficiency.
*/
function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
} else {
_checkNonPayable();
}
}
/**
* @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
* if an upgrade doesn't perform an initialization call.
*/
function _checkNonPayable() private {
if (msg.value > 0) {
revert ERC1967NonPayable();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
/// @dev bytes32 encoding of the string "checkpoint"
bytes32 constant VALIDATOR_SET_HASH_DOMAIN_SEPARATOR =
0x636865636b706f696e7400000000000000000000000000000000000000000000;
/// @dev bytes32 encoding of the string "transactionBatch"
bytes32 constant DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR =
0x7472616e73616374696f6e426174636800000000000000000000000000000000;// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
/// @notice A tuple of data root with metadata. Each data root is associated
/// with a Celestia block height.
/// @dev `availableDataRoot` in
/// https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#header
struct DataRootTuple {
// Celestia block height the data root was included in.
// Genesis block is height = 0.
// First queryable block is height = 1.
uint256 height;
// Data root.
bytes32 dataRoot;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
import "./DataRootTuple.sol";
import "./lib/tree/binary/BinaryMerkleProof.sol";
/// @notice Data Availability Oracle interface.
interface IDAOracle {
/// @notice Verify a Data Availability attestation.
/// @param _tupleRootNonce Nonce of the tuple root to prove against.
/// @param _tuple Data root tuple to prove inclusion of.
/// @param _proof Binary Merkle tree proof that `tuple` is in the root at `_tupleRootNonce`.
/// @return `true` is proof is valid, `false` otherwise.
function verifyAttestation(uint256 _tupleRootNonce, DataRootTuple memory _tuple, BinaryMerkleProof memory _proof)
external
view
returns (bool);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
/// @notice Merkle Tree Proof structure.
struct BinaryMerkleProof {
// List of side nodes to verify and calculate tree.
bytes32[] sideNodes;
// The key of the leaf to verify.
uint256 key;
// The number of leaves in the tree
uint256 numLeaves;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "../Constants.sol";
import "../Utils.sol";
import "./TreeHasher.sol";
import "./BinaryMerkleProof.sol";
/// @title Binary Merkle Tree.
library BinaryMerkleTree {
/// @notice Verify if element exists in Merkle tree, given data, proof, and root.
/// @param root The root of the tree in which verify the given leaf.
/// @param proof Binary Merkle proof for the leaf.
/// @param data The data of the leaf to verify.
/// @return `true` is proof is valid, `false` otherwise.
/// @dev proof.numLeaves is necessary to determine height of subtree containing the data to prove.
function verify(bytes32 root, BinaryMerkleProof memory proof, bytes memory data) internal pure returns (bool) {
// Check proof is correct length for the key it is proving
if (proof.numLeaves <= 1) {
if (proof.sideNodes.length != 0) {
return false;
}
} else if (proof.sideNodes.length != pathLengthFromKey(proof.key, proof.numLeaves)) {
return false;
}
// Check key is in tree
if (proof.key >= proof.numLeaves) {
return false;
}
// A sibling at height 1 is created by getting the hash of the data to prove.
bytes32 digest = leafDigest(data);
// Null proof is only valid if numLeaves = 1
// If so, just verify hash(data) is root
if (proof.sideNodes.length == 0) {
if (proof.numLeaves == 1) {
return (root == digest);
} else {
return false;
}
}
bytes32 computedHash = computeRootHash(proof.key, proof.numLeaves, digest, proof.sideNodes);
return (computedHash == root);
}
/// @notice Use the leafHash and innerHashes to get the root merkle hash.
/// If the length of the innerHashes slice isn't exactly correct, the result is nil.
/// Recursive impl.
function computeRootHash(uint256 key, uint256 numLeaves, bytes32 leafHash, bytes32[] memory sideNodes)
private
pure
returns (bytes32)
{
if (numLeaves == 0) {
revert("cannot call computeRootHash with 0 number of leaves");
}
if (numLeaves == 1) {
if (sideNodes.length != 0) {
revert("unexpected inner hashes");
}
return leafHash;
}
if (sideNodes.length == 0) {
revert("expected at least one inner hash");
}
uint256 numLeft = _getSplitPoint(numLeaves);
bytes32[] memory sideNodesLeft = slice(sideNodes, 0, sideNodes.length - 1);
if (key < numLeft) {
bytes32 leftHash = computeRootHash(key, numLeft, leafHash, sideNodesLeft);
return nodeDigest(leftHash, sideNodes[sideNodes.length - 1]);
}
bytes32 rightHash = computeRootHash(key - numLeft, numLeaves - numLeft, leafHash, sideNodesLeft);
return nodeDigest(sideNodes[sideNodes.length - 1], rightHash);
}
/// @notice creates a slice of bytes32 from the data slice of bytes32 containing the elements
/// that correspond to the provided range.
/// It selects a half-open range which includes the begin element, but excludes the end one.
/// @param _data The slice that we want to select data from.
/// @param _begin The beginning of the range (inclusive).
/// @param _end The ending of the range (exclusive).
/// @return _ the sliced data.
function slice(bytes32[] memory _data, uint256 _begin, uint256 _end) internal pure returns (bytes32[] memory) {
if (_begin > _end) {
revert("Invalid range: _begin is greater than _end");
}
if (_begin > _data.length || _end > _data.length) {
revert("Invalid range: _begin or _end are out of bounds");
}
bytes32[] memory out = new bytes32[](_end - _begin);
for (uint256 i = _begin; i < _end; i++) {
out[i - _begin] = _data[i];
}
return out;
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "../Constants.sol";
/// @notice Calculate the digest of a node.
/// @param left The left child.
/// @param right The right child.
/// @return digest The node digest.
/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree
// solhint-disable-next-line func-visibility
function nodeDigest(bytes32 left, bytes32 right) pure returns (bytes32 digest) {
digest = sha256(abi.encodePacked(Constants.NODE_PREFIX, left, right));
}
/// @notice Calculate the digest of a leaf.
/// @param data The data of the leaf.
/// @return digest The leaf digest.
/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree
// solhint-disable-next-line func-visibility
function leafDigest(bytes memory data) pure returns (bytes32 digest) {
digest = sha256(abi.encodePacked(Constants.LEAF_PREFIX, data));
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "./Types.sol";
library Constants {
///////////////
// Constants //
///////////////
/// @dev Maximum tree height
uint256 internal constant MAX_HEIGHT = 256;
/// @dev The prefixes of leaves and nodes
bytes1 internal constant LEAF_PREFIX = 0x00;
bytes1 internal constant NODE_PREFIX = 0x01;
}
/// @dev Parity share namespace.
/// utility function to provide the parity share namespace as a Namespace struct.
function PARITY_SHARE_NAMESPACE() pure returns (Namespace memory) {
return Namespace(0xFF, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "./NamespaceNode.sol";
/// @notice Namespace Merkle Tree Multiproof structure. Proves multiple leaves.
struct NamespaceMerkleMultiproof {
// The beginning key of the leaves to verify.
uint256 beginKey;
// The ending key of the leaves to verify.
uint256 endKey;
// List of side nodes to verify and calculate tree.
NamespaceNode[] sideNodes;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "./NamespaceNode.sol";
/// @notice Namespace Merkle Tree Proof structure.
struct NamespaceMerkleProof {
// List of side nodes to verify and calculate tree.
NamespaceNode[] sideNodes;
// The key of the leaf to verify.
uint256 key;
// The number of leaves in the tree
uint256 numLeaves;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "../Constants.sol";
import "../Types.sol";
import "../Utils.sol";
import "./NamespaceMerkleProof.sol";
import "./NamespaceMerkleMultiproof.sol";
import "./NamespaceNode.sol";
import "./TreeHasher.sol";
/// @title Namespace Merkle Tree.
library NamespaceMerkleTree {
/// @notice Verify if element exists in Merkle tree, given data, proof, and root.
/// @param root The root of the tree in which the given leaf is verified.
/// @param proof Namespace Merkle proof for the leaf.
/// @param namespace Namespace of the leaf.
/// @param data The data of the leaf to verify.
/// @return `true` if the proof is valid, `false` otherwise.
/// @dev proof.numLeaves is necessary to determine height of subtree containing the data to prove.
function verify(
NamespaceNode memory root,
NamespaceMerkleProof memory proof,
Namespace memory namespace,
bytes memory data
) internal pure returns (bool) {
// A sibling at height 1 is created by getting the leafDigest of the original data.
NamespaceNode memory node = leafDigest(namespace, data);
// Since we're verifying a leaf, height parameter is 1.
return verifyInner(root, proof, node, 1);
}
/// @notice Verify if inner node exists in Merkle tree, given node, proof, and root.
/// @param root The root of the tree in which the given leaf is verified.
/// @param proof Namespace Merkle proof for the leaf.
/// proof.key is any key in the subtree rooted at the inner node.
/// @param node The inner node to verify.
/// @param startingHeight Starting height of the proof.
/// @return `true` if the proof is valid, `false` otherwise.
/// @dev proof.numLeaves is necessary to determine height of subtree containing the data to prove.
function verifyInner(
NamespaceNode memory root,
NamespaceMerkleProof memory proof,
NamespaceNode memory node,
uint256 startingHeight
) internal pure returns (bool) {
// Check starting height is at least 1
if (startingHeight < 1) {
return false;
}
uint256 heightOffset = startingHeight - 1;
// Check proof is correct length for the key it is proving
if (proof.numLeaves <= 1) {
if (proof.sideNodes.length != 0) {
return false;
}
} else if (proof.sideNodes.length + heightOffset != pathLengthFromKey(proof.key, proof.numLeaves)) {
return false;
}
// Check key is in tree
if (proof.key >= proof.numLeaves) {
return false;
}
// Handle case where proof is empty: i.e, only one leaf exists, so verify hash(data) is root
// TODO handle case where inner node is actually the root of a tree with more than one node
if (proof.sideNodes.length == 0) {
if (proof.numLeaves == 1) {
return namespaceNodeEquals(root, node);
} else {
return false;
}
}
uint256 height = startingHeight;
uint256 stableEnd = proof.key;
// While the current subtree (of height 'height') is complete, determine
// the position of the next sibling using the complete subtree algorithm.
// 'stableEnd' tells us the ending index of the last full subtree. It gets
// initialized to 'key' because the first full subtree was the
// subtree of height 1, created above (and had an ending index of
// 'key').
while (true) {
// Determine if the subtree is complete. This is accomplished by
// rounding down the key to the nearest 1 << 'height', adding 1
// << 'height', and comparing the result to the number of leaves in the
// Merkle tree.
uint256 subTreeStartIndex = (proof.key / (1 << height)) * (1 << height);
uint256 subTreeEndIndex = subTreeStartIndex + (1 << height) - 1;
// If the Merkle tree does not have a leaf at index
// 'subTreeEndIndex', then the subtree of the current height is not
// a complete subtree.
if (subTreeEndIndex >= proof.numLeaves) {
break;
}
stableEnd = subTreeEndIndex;
// Determine if the key is in the first or the second half of
// the subtree.
if (proof.sideNodes.length + heightOffset <= height - 1) {
return false;
}
if (proof.key - subTreeStartIndex < (1 << (height - heightOffset - 1))) {
node = nodeDigest(node, proof.sideNodes[height - heightOffset - 1]);
} else {
node = nodeDigest(proof.sideNodes[height - heightOffset - 1], node);
}
height += 1;
}
// Determine if the next hash belongs to an orphan that was elevated. This
// is the case IFF 'stableEnd' (the last index of the largest full subtree)
// is equal to the number of leaves in the Merkle tree.
if (stableEnd != proof.numLeaves - 1) {
if (proof.sideNodes.length <= height - 1) {
return false;
}
node = nodeDigest(node, proof.sideNodes[height - heightOffset - 1]);
height += 1;
}
// All remaining elements in the proof set will belong to a left sibling.
while (height - heightOffset - 1 < proof.sideNodes.length) {
node = nodeDigest(proof.sideNodes[height - heightOffset - 1], node);
height += 1;
}
return namespaceNodeEquals(root, node);
}
/// @notice Verify if contiguous elements exists in Merkle tree, given leaves, mutliproof, and root.
/// @param root The root of the tree in which the given leaves are verified.
/// @param proof Namespace Merkle multiproof for the leaves.
/// @param namespace Namespace of the leaves. All leaves must have the same namespace.
/// @param data The leaves to verify. Note: leaf data must be the _entire_ share (including namespace prefixing).
/// @return `true` if the proof is valid, `false` otherwise.
function verifyMulti(
NamespaceNode memory root,
NamespaceMerkleMultiproof memory proof,
Namespace memory namespace,
bytes[] memory data
) internal pure returns (bool) {
// Hash all the leaves to get leaf nodes.
NamespaceNode[] memory nodes = new NamespaceNode[](data.length);
for (uint256 i = 0; i < data.length; ++i) {
nodes[i] = leafDigest(namespace, data[i]);
}
// Verify inclusion of leaf nodes.
return verifyMultiHashes(root, proof, nodes);
}
/// @notice Verify if contiguous leaf hashes exists in Merkle tree, given leaf nodes, multiproof, and root.
/// @param root The root of the tree in which the given leaf nodes are verified.
/// @param proof Namespace Merkle multiproof for the leaves.
/// @param leafNodes The leaf nodes to verify.
/// @return `true` if the proof is valid, `false` otherwise.
function verifyMultiHashes(
NamespaceNode memory root,
NamespaceMerkleMultiproof memory proof,
NamespaceNode[] memory leafNodes
) internal pure returns (bool) {
uint256 leafIndex = 0;
NamespaceNode[] memory leftSubtrees = new NamespaceNode[](proof.sideNodes.length);
for (uint256 i = 0; leafIndex != proof.beginKey && i < proof.sideNodes.length; ++i) {
uint256 subtreeSize = _nextSubtreeSize(leafIndex, proof.beginKey);
leftSubtrees[i] = proof.sideNodes[i];
leafIndex += subtreeSize;
}
// estimate the leaf size of the subtree containing the proof range
uint256 proofRangeSubtreeEstimate = _getSplitPoint(proof.endKey) * 2;
if (proofRangeSubtreeEstimate < 1) {
proofRangeSubtreeEstimate = 1;
}
(NamespaceNode memory rootHash, uint256 proofHead,,) =
_computeRoot(proof, leafNodes, 0, proofRangeSubtreeEstimate, 0, 0);
for (uint256 i = proofHead; i < proof.sideNodes.length; ++i) {
rootHash = nodeDigest(rootHash, proof.sideNodes[i]);
}
return namespaceNodeEquals(rootHash, root);
}
/// @notice Returns the size of the subtree adjacent to `begin` that does
/// not overlap `end`.
/// @param begin Begin index, inclusive.
/// @param end End index, exclusive.
function _nextSubtreeSize(uint256 begin, uint256 end) private pure returns (uint256) {
uint256 ideal = _bitsTrailingZeroes(begin);
uint256 max = _bitsLen(end - begin) - 1;
if (ideal > max) {
return 1 << max;
}
return 1 << ideal;
}
/// @notice Returns the number of trailing zero bits in `x`; the result is
/// 256 for `x` == 0.
/// @param x Number.
function _bitsTrailingZeroes(uint256 x) private pure returns (uint256) {
uint256 mask = 1;
uint256 count = 0;
while (x != 0 && mask & x == 0) {
count++;
x >>= 1;
}
return count;
}
/// @notice Computes the NMT root recursively.
/// @param proof Namespace Merkle multiproof for the leaves.
/// @param leafNodes Leaf nodes for which inclusion is proven.
/// @param begin Begin index, inclusive.
/// @param end End index, exclusive.
/// @param headProof Internal detail: head of proof sidenodes array. Used for recursion. Set to `0` on first call.
/// @param headLeaves Internal detail: head of leaves array. Used for recursion. Set to `0` on first call.
/// @return _ Subtree root.
/// @return _ New proof sidenodes array head. Used for recursion.
/// @return _ New leaves array head. Used for recursion.
/// @return _ If the subtree root is "nil."
function _computeRoot(
NamespaceMerkleMultiproof memory proof,
NamespaceNode[] memory leafNodes,
uint256 begin,
uint256 end,
uint256 headProof,
uint256 headLeaves
) private pure returns (NamespaceNode memory, uint256, uint256, bool) {
// reached a leaf
if (end - begin == 1) {
// if current range overlaps with proof range, pop and return a leaf
if (proof.beginKey <= begin && begin < proof.endKey) {
// Note: second return value is guaranteed to be `false` by
// construction.
return _popLeavesIfNonEmpty(leafNodes, headLeaves, leafNodes.length, headProof);
}
// if current range does not overlap with proof range,
// pop and return a proof node (leaf) if present,
// else return nil because leaf doesn't exist
return _popProofIfNonEmpty(proof.sideNodes, headProof, end, headLeaves);
}
// if current range does not overlap with proof range,
// pop and return a proof node if present,
// else return nil because subtree doesn't exist
if (end <= proof.beginKey || begin >= proof.endKey) {
return _popProofIfNonEmpty(proof.sideNodes, headProof, end, headLeaves);
}
// Recursively get left and right subtree
uint256 k = _getSplitPoint(end - begin);
(NamespaceNode memory left, uint256 newHeadProofLeft, uint256 newHeadLeavesLeft,) =
_computeRoot(proof, leafNodes, begin, begin + k, headProof, headLeaves);
(NamespaceNode memory right, uint256 newHeadProof, uint256 newHeadLeaves, bool rightIsNil) =
_computeRoot(proof, leafNodes, begin + k, end, newHeadProofLeft, newHeadLeavesLeft);
// only right leaf/subtree can be non-existent
if (rightIsNil == true) {
return (left, newHeadProof, newHeadLeaves, false);
}
NamespaceNode memory hash = nodeDigest(left, right);
return (hash, newHeadProof, newHeadLeaves, false);
}
/// @notice Pop from the leaf nodes array slice if it's not empty.
/// @param nodes Entire leaf nodes array.
/// @param headLeaves Head of leaf nodes array slice.
/// @param end End of leaf nodes array slice.
/// @param headProof Used only to return for recursion.
/// @return _ Popped node.
/// @return _ Head of proof sidenodes array slice (unchanged).
/// @return _ New head of leaf nodes array slice.
/// @return _ If the popped node is "nil."
function _popLeavesIfNonEmpty(NamespaceNode[] memory nodes, uint256 headLeaves, uint256 end, uint256 headProof)
private
pure
returns (NamespaceNode memory, uint256, uint256, bool)
{
(NamespaceNode memory node, uint256 newHead, bool isNil) = _popIfNonEmpty(nodes, headLeaves, end);
return (node, headProof, newHead, isNil);
}
/// @notice Pop from the proof sidenodes array slice if it's not empty.
/// @param nodes Entire proof sidenodes array.
/// @param headLeaves Head of proof sidenodes array slice.
/// @param end End of proof sidenodes array slice.
/// @param headProof Used only to return for recursion.
/// @return _ Popped node.
/// @return _ New head of proof sidenodes array slice.
/// @return _ Head of proof sidenodes array slice (unchanged).
/// @return _ If the popped node is "nil."
function _popProofIfNonEmpty(NamespaceNode[] memory nodes, uint256 headProof, uint256 end, uint256 headLeaves)
private
pure
returns (NamespaceNode memory, uint256, uint256, bool)
{
(NamespaceNode memory node, uint256 newHead, bool isNil) = _popIfNonEmpty(nodes, headProof, end);
return (node, newHead, headLeaves, isNil);
}
/// @notice Pop from an array slice if it's not empty.
/// @param nodes Entire array.
/// @param head Head of array slice.
/// @param end End of array slice.
/// @return _ Popped node.
/// @return _ New head of array slice.
/// @return _ If the popped node is "nil."
function _popIfNonEmpty(NamespaceNode[] memory nodes, uint256 head, uint256 end)
private
pure
returns (NamespaceNode memory, uint256, bool)
{
if (nodes.length == 0 || head >= nodes.length || head >= end) {
NamespaceNode memory node;
return (node, head, true);
}
return (nodes[head], head + 1, false);
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "../Types.sol";
/// @notice Namespace Merkle Tree node.
struct NamespaceNode {
// Minimum namespace.
Namespace min;
// Maximum namespace.
Namespace max;
// Node value.
bytes32 digest;
}
/// @notice Compares two `NamespaceNode`s.
/// @param first First node.
/// @param second Second node.
/// @return `true` is equal, `false otherwise.
// solhint-disable-next-line func-visibility
function namespaceNodeEquals(NamespaceNode memory first, NamespaceNode memory second) pure returns (bool) {
return first.min.equalTo(second.min) && first.max.equalTo(second.max) && (first.digest == second.digest);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "../Constants.sol";
import "../Types.sol";
import "./NamespaceNode.sol";
/// @notice Get the minimum namespace.
// solhint-disable-next-line func-visibility
function namespaceMin(Namespace memory l, Namespace memory r) pure returns (Namespace memory) {
if (l.lessThan(r)) {
return l;
} else {
return r;
}
}
/// @notice Get the maximum namespace.
// solhint-disable-next-line func-visibility
function namespaceMax(Namespace memory l, Namespace memory r) pure returns (Namespace memory) {
if (l.greaterThan(r)) {
return l;
} else {
return r;
}
}
/// @notice Hash a leaf node.
/// @param namespace Namespace of the leaf.
/// @param data Raw data of the leaf.
/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#namespace-merkle-tree
// solhint-disable-next-line func-visibility
function leafDigest(Namespace memory namespace, bytes memory data) pure returns (NamespaceNode memory) {
bytes32 digest = sha256(abi.encodePacked(Constants.LEAF_PREFIX, namespace.toBytes(), data));
NamespaceNode memory node = NamespaceNode(namespace, namespace, digest);
return node;
}
/// @notice Hash an internal node.
/// @param l Left child.
/// @param r Right child.
/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#namespace-merkle-tree
// solhint-disable-next-line func-visibility
function nodeDigest(NamespaceNode memory l, NamespaceNode memory r) pure returns (NamespaceNode memory) {
Namespace memory min = namespaceMin(l.min, r.min);
Namespace memory max;
if (l.min.equalTo(PARITY_SHARE_NAMESPACE())) {
max = PARITY_SHARE_NAMESPACE();
} else if (r.min.equalTo(PARITY_SHARE_NAMESPACE())) {
max = l.max;
} else {
max = namespaceMax(l.max, r.max);
}
bytes32 digest = sha256(
abi.encodePacked(
Constants.NODE_PREFIX,
l.min.toBytes(),
l.max.toBytes(),
l.digest,
r.min.toBytes(),
r.max.toBytes(),
r.digest
)
);
NamespaceNode memory node = NamespaceNode(min, max, digest);
return node;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
/// @notice A representation of the Celestia-app namespace ID and its version.
/// See: https://celestiaorg.github.io/celestia-app/specs/namespace.html
struct Namespace {
// The namespace version.
bytes1 version;
// The namespace ID.
bytes28 id;
}
using {equalTo, lessThan, greaterThan, toBytes} for Namespace global;
function equalTo(Namespace memory l, Namespace memory r) pure returns (bool) {
return l.toBytes() == r.toBytes();
}
function lessThan(Namespace memory l, Namespace memory r) pure returns (bool) {
return l.toBytes() < r.toBytes();
}
function greaterThan(Namespace memory l, Namespace memory r) pure returns (bool) {
return l.toBytes() > r.toBytes();
}
function toBytes(Namespace memory n) pure returns (bytes29) {
return bytes29(abi.encodePacked(n.version, n.id));
}
function toNamespace(bytes29 n) pure returns (Namespace memory) {
bytes memory id = new bytes(28);
for (uint256 i = 1; i < 29; i++) {
id[i - 1] = n[i];
}
return Namespace(n[0], bytes28(id));
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "./Constants.sol";
/// @notice Calculate the starting bit of the path to a leaf
/// @param numLeaves : The total number of leaves in the tree
/// @return startingBit : The starting bit of the path
// solhint-disable-next-line func-visibility
function getStartingBit(uint256 numLeaves) pure returns (uint256 startingBit) {
// Determine height of the left subtree. This is the maximum path length, so all paths start at this offset from the right-most bit
startingBit = 0;
while ((1 << startingBit) < numLeaves) {
startingBit += 1;
}
return Constants.MAX_HEIGHT - startingBit;
}
/// @notice Calculate the length of the path to a leaf
/// @param key: The key of the leaf
/// @param numLeaves: The total number of leaves in the tree
/// @return pathLength : The length of the path to the leaf
/// @dev A precondition to this function is that `numLeaves > 1`, so that `(pathLength - 1)` does not cause an underflow when pathLength = 0.
// solhint-disable-next-line func-visibility
function pathLengthFromKey(uint256 key, uint256 numLeaves) pure returns (uint256 pathLength) {
// Get the height of the left subtree. This is equal to the offset of the starting bit of the path
pathLength = Constants.MAX_HEIGHT - getStartingBit(numLeaves);
// Determine the number of leaves in the left subtree
uint256 numLeavesLeftSubTree = (1 << (pathLength - 1));
// If leaf is in left subtree, path length is full height of left subtree
if (key <= numLeavesLeftSubTree - 1) {
return pathLength;
}
// If left sub tree has only one leaf but key is not there, path has one additional step
else if (numLeavesLeftSubTree == 1) {
return 1;
}
// Otherwise, add 1 to height and recurse into right subtree
else {
return 1 + pathLengthFromKey(key - numLeavesLeftSubTree, numLeaves - numLeavesLeftSubTree);
}
}
/// @notice Returns the minimum number of bits required to represent `x`; the
/// result is 0 for `x` == 0.
/// @param x Number.
function _bitsLen(uint256 x) pure returns (uint256) {
uint256 count = 0;
while (x != 0) {
count++;
x >>= 1;
}
return count;
}
/// @notice Returns the largest power of 2 less than `x`.
/// @param x Number.
function _getSplitPoint(uint256 x) pure returns (uint256) {
// Note: since `x` is always an unsigned int * 2, the only way for this
// to be violated is if the input == 0. Since the input is the end
// index exclusive, an input of 0 is guaranteed to be invalid (it would
// be a proof of inclusion of nothing, which is vacuous).
require(x >= 1);
uint256 bitLen = _bitsLen(x);
uint256 k = 1 << (bitLen - 1);
if (k == x) {
k >>= 1;
}
return k;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.22;
import "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
import "../../Constants.sol";
import "../../DataRootTuple.sol";
import "../../IDAOracle.sol";
import "../tree/binary/BinaryMerkleProof.sol";
import "../tree/binary/BinaryMerkleTree.sol";
import "../tree/namespace/NamespaceMerkleTree.sol";
import "../tree/Types.sol";
/// @notice Contains the necessary parameters to prove that some shares, which were posted to
/// the Celestia network, were committed to by the Blobstream smart contract.
struct SharesProof {
// The shares that were committed to.
bytes[] data;
// The shares proof to the row roots. If the shares span multiple rows, we will have multiple nmt proofs.
NamespaceMerkleMultiproof[] shareProofs;
// The namespace of the shares.
Namespace namespace;
// The rows where the shares belong. If the shares span multiple rows, we will have multiple rows.
NamespaceNode[] rowRoots;
// The proofs of the rowRoots to the data root.
BinaryMerkleProof[] rowProofs;
// The proof of the data root tuple to the data root tuple root that was posted to the Blobstream contract.
AttestationProof attestationProof;
}
/// @notice Contains the necessary parameters needed to verify that a data root tuple
/// was committed to, by the Blobstream smart contract, at some specif nonce.
struct AttestationProof {
// the attestation nonce that commits to the data root tuple.
uint256 tupleRootNonce;
// the data root tuple that was committed to.
DataRootTuple tuple;
// the binary merkle proof of the tuple to the commitment.
BinaryMerkleProof proof;
}
/// @title DAVerifier: Celestia -> EVM, Data Availability verifier.
/// @dev The DAVerifier verifies that some shares, which were posted on Celestia, were committed to
/// by the Blobstream smart contract.
library DAVerifier {
/////////////////
// Error codes //
/////////////////
enum ErrorCodes {
NoError,
/// @notice The shares to the rows proof is invalid.
InvalidSharesToRowsProof,
/// @notice The rows to the data root proof is invalid.
InvalidRowsToDataRootProof,
/// @notice The row to the data root proof is invalid.
InvalidRowToDataRootProof,
/// @notice The data root tuple to the data root tuple roof proof is invalid.
InvalidDataRootTupleToDataRootTupleRootProof,
/// @notice The number of share proofs isn't equal to the number of rows roots.
UnequalShareProofsAndRowRootsNumber,
/// @notice The number of rows proofs isn't equal to the number of rows roots.
UnequalRowProofsAndRowRootsNumber,
/// @notice The verifier data length isn't equal to the number of shares in the shares proofs.
UnequalDataLengthAndNumberOfSharesProofs,
/// @notice The number of leaves in the binary merkle proof is not divisible by 4.
InvalidNumberOfLeavesInProof,
/// @notice The provided range is invalid.
InvalidRange,
/// @notice The provided range is out of bounds.
OutOfBoundsRange
}
///////////////
// Functions //
///////////////
/// @notice Verifies that the shares, which were posted to Celestia, were committed to by the Blobstream smart contract.
/// @param _bridge The Blobstream smart contract instance.
/// @param _sharesProof The proof of the shares to the data root tuple root.
/// @param _root The data root of the block that contains the shares.
/// @return `true` if the proof is valid, `false` otherwise.
/// @return an error code if the proof is invalid, ErrorCodes.NoError otherwise.
function verifySharesToDataRootTupleRoot(IDAOracle _bridge, SharesProof memory _sharesProof, bytes32 _root)
internal
view
returns (bool, ErrorCodes)
{
// checking that the data root was committed to by the Blobstream smart contract.
(bool success, ErrorCodes errorCode) = verifyMultiRowRootsToDataRootTupleRoot(
_bridge, _sharesProof.rowRoots, _sharesProof.rowProofs, _sharesProof.attestationProof, _root
);
if (!success) {
return (false, errorCode);
}
// checking that the shares were committed to by the rows roots.
if (_sharesProof.shareProofs.length != _sharesProof.rowRoots.length) {
return (false, ErrorCodes.UnequalShareProofsAndRowRootsNumber);
}
uint256 numberOfSharesInProofs = 0;
for (uint256 i = 0; i < _sharesProof.shareProofs.length; i++) {
numberOfSharesInProofs += _sharesProof.shareProofs[i].endKey - _sharesProof.shareProofs[i].beginKey;
}
if (_sharesProof.data.length != numberOfSharesInProofs) {
return (false, ErrorCodes.UnequalDataLengthAndNumberOfSharesProofs);
}
uint256 cursor = 0;
for (uint256 i = 0; i < _sharesProof.shareProofs.length; i++) {
uint256 sharesUsed = _sharesProof.shareProofs[i].endKey - _sharesProof.shareProofs[i].beginKey;
(bytes[] memory s, ErrorCodes err) = slice(_sharesProof.data, cursor, cursor + sharesUsed);
if (err != ErrorCodes.NoError) {
return (false, err);
}
if (
!NamespaceMerkleTree.verifyMulti(
_sharesProof.rowRoots[i], _sharesProof.shareProofs[i], _sharesProof.namespace, s
)
) {
return (false, ErrorCodes.InvalidSharesToRowsProof);
}
cursor += sharesUsed;
}
return (true, ErrorCodes.NoError);
}
/// @notice Verifies that a row/column root, from a Celestia block, was committed to by the Blobstream smart contract.
/// @param _bridge The Blobstream smart contract instance.
/// @param _rowRoot The row/column root to be proven.
/// @param _rowProof The proof of the row/column root to the data root.
/// @param _root The data root of the block that contains the row.
/// @return `true` if the proof is valid, `false` otherwise.
/// @return an error code if the proof is invalid, ErrorCodes.NoError otherwise.
function verifyRowRootToDataRootTupleRoot(
IDAOracle _bridge,
NamespaceNode memory _rowRoot,
BinaryMerkleProof memory _rowProof,
AttestationProof memory _attestationProof,
bytes32 _root
) internal view returns (bool, ErrorCodes) {
// checking that the data root was committed to by the Blobstream smart contract
if (
!_bridge.verifyAttestation(
_attestationProof.tupleRootNonce, _attestationProof.tuple, _attestationProof.proof
)
) {
return (false, ErrorCodes.InvalidDataRootTupleToDataRootTupleRootProof);
}
bytes memory rowRoot = abi.encodePacked(_rowRoot.min.toBytes(), _rowRoot.max.toBytes(), _rowRoot.digest);
if (!BinaryMerkleTree.verify(_root, _rowProof, rowRoot)) {
return (false, ErrorCodes.InvalidRowToDataRootProof);
}
return (true, ErrorCodes.NoError);
}
/// @notice Verifies that a set of rows/columns, from a Celestia block, were committed to by the Blobstream smart contract.
/// @param _bridge The Blobstream smart contract instance.
/// @param _rowRoots The set of row/column roots to be proved.
/// @param _rowProofs The set of proofs of the _rowRoots in the same order.
/// @param _root The data root of the block that contains the rows.
/// @return `true` if the proof is valid, `false` otherwise.
/// @return an error code if the proof is invalid, ErrorCodes.NoError otherwise.
function verifyMultiRowRootsToDataRootTupleRoot(
IDAOracle _bridge,
NamespaceNode[] memory _rowRoots,
BinaryMerkleProof[] memory _rowProofs,
AttestationProof memory _attestationProof,
bytes32 _root
) internal view returns (bool, ErrorCodes) {
// checking that the data root was committed to by the Blobstream smart contract
if (
!_bridge.verifyAttestation(
_attestationProof.tupleRootNonce, _attestationProof.tuple, _attestationProof.proof
)
) {
return (false, ErrorCodes.InvalidDataRootTupleToDataRootTupleRootProof);
}
// checking that the rows roots commit to the data root.
if (_rowProofs.length != _rowRoots.length) {
return (false, ErrorCodes.UnequalRowProofsAndRowRootsNumber);
}
for (uint256 i = 0; i < _rowProofs.length; i++) {
bytes memory rowRoot =
abi.encodePacked(_rowRoots[i].min.toBytes(), _rowRoots[i].max.toBytes(), _rowRoots[i].digest);
if (!BinaryMerkleTree.verify(_root, _rowProofs[i], rowRoot)) {
return (false, ErrorCodes.InvalidRowsToDataRootProof);
}
}
return (true, ErrorCodes.NoError);
}
/// @notice computes the Celestia block square size from a row/column root to data root binary merkle proof.
/// Note: the provided proof is not authenticated to the Blobstream smart contract. It is the user's responsibility
/// to verify that the proof is valid and was successfully committed to using
// the `DAVerifier.verifyRowRootToDataRootTupleRoot()` method
/// Note: the minimum square size is 1. Thus, we don't expect the proof to have number of leaves equal to 0.
/// @param _proof The proof of the row/column root to the data root.
/// @return The square size of the corresponding block.
/// @return an error code if the _proof is invalid, Errors.NoError otherwise.
function computeSquareSizeFromRowProof(BinaryMerkleProof memory _proof)
internal
pure
returns (uint256, ErrorCodes)
{
if (_proof.numLeaves % 4 != 0) {
return (0, ErrorCodes.InvalidNumberOfLeavesInProof);
}
// we divide the number of leaves of the proof by 4 because the rows/columns tree is constructed
// from the extended block row roots and column roots.
return (_proof.numLeaves / 4, ErrorCodes.NoError);
}
/// @notice computes the Celestia block square size from a shares to row/column root proof.
/// Note: the provided proof is not authenticated to the Blobstream smart contract. It is the user's responsibility
/// to verify that the proof is valid and that the shares were successfully committed to using
/// the `DAVerifier.verifySharesToDataRootTupleRoot()` method.
/// Note: the minimum square size is 1. Thus, we don't expect the proof not to contain any side node.
/// @param _proof The proof of the shares to the row/column root.
/// @return The square size of the corresponding block.
function computeSquareSizeFromShareProof(NamespaceMerkleMultiproof memory _proof) internal pure returns (uint256) {
uint256 extendedSquareRowSize = 2 ** _proof.sideNodes.length;
// we divide the extended square row size by 2 because the square size is the
// the size of the row of the original square size.
return extendedSquareRowSize / 2;
}
/// @notice creates a slice of bytes from the data slice of bytes containing the elements
/// that correspond to the provided range.
/// It selects a half-open range which includes the begin element, but excludes the end one.
/// @param _data The slice that we want to select data from.
/// @param _begin The beginning of the range (inclusive).
/// @param _end The ending of the range (exclusive).
/// @return _ the sliced data.
function slice(bytes[] memory _data, uint256 _begin, uint256 _end)
internal
pure
returns (bytes[] memory, ErrorCodes)
{
if (_begin > _end) {
return (_data, ErrorCodes.InvalidRange);
}
if (_begin > _data.length || _end > _data.length) {
return (_data, ErrorCodes.OutOfBoundsRange);
}
bytes[] memory out = new bytes[](_end - _begin);
for (uint256 i = _begin; i < _end; i++) {
out[i - _begin] = _data[i];
}
return (out, ErrorCodes.NoError);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ICanonicalStateChain {
/// @notice The header struct represents a block header in the rollup chain.
/// @param epoch - Epoch refers to a block number on the Ethereum blockchain.
/// @param l2Height - L2Height is the index of the Last L2 Block in this bundle.
/// @param prevHash - PrevHash is the hash of the previous block bundle.
/// @param stateRoot - The Stateroot after applying all the blocks in the Bundle.
/// @param celestiaPointers - Pointer to the blocks contents on celestia.
/// See `Span` from https://docs.celestia.org/developers/blobstream-offchain#defining-a-chain
struct Header {
uint64 epoch;
uint64 l2Height;
bytes32 prevHash;
bytes32 stateRoot;
CelestiaPointer[] celestiaPointers;
}
/// @notice A pointer to a shares on Celestia.
/// @param height - The height of the block on Celestia.
/// @param shareStart - The start index of shares in block on Celestia.
/// @param shareLen - The length of the shares in block on Celestia.
struct CelestiaPointer {
uint64 height;
uint24 shareStart;
uint16 shareLen;
}
/// @notice The metadata of a block header.
/// @param timestamp - The timestamp the block was added.
/// @param publisher - The address of the publisher that added the block.
struct HeaderMetadata {
uint64 timestamp;
address publisher;
}
/// @notice Emitted when a new block is added to the chain.
/// @param blockNumber - The block number of the new block.
event BlockAdded(uint256 indexed blockNumber);
/// @notice Emitted when the chain is rolled back.
/// @param blockNumber - The block number the chain was rolled back to.
event Rolledback(uint256 indexed blockNumber);
/// @notice Emitted when the publisher address is changed.
/// @param publisher - The new publisher address.
event PublisherChanged(address indexed publisher);
/// @notice The address of the publisher. Publisher is the verified address
/// that can add new blocks to the chain. This address can be
/// replaced by the owner of the contract, (expected to be the
/// rollup contract).
/// @return The address of the publisher.
function publisher() external view returns (address);
/// @notice The address of the challenge contract. Challenge is the address
/// of the challenge contract. This contract can rollback the chain
/// after a successful challenge is made.
/// @return The address of the challenge contract.
function challenge() external view returns (address);
/// @notice The index of the last block in the chain.
/// @return The index of the last block in the chain.
function chainHead() external view returns (uint256);
/// @notice The canonical chain of block headers.
/// @return The block header.
function headers(bytes32) external view returns (Header memory);
/// @notice Returns the block header by hash.
/// @return The block header.
function getHeaderByHash(bytes32) external view returns (Header memory);
/// @notice The metadata of a block header.
/// @return The metadata of a block header.
function headerMetadata(
bytes32
) external view returns (HeaderMetadata memory);
/// @notice Returns the block hash by number.
/// @return The block hash.
function chain(uint256) external view returns (bytes32);
/// @notice Optimistically pushes block headers to the canonical chain.
/// The only fields that are checked are the epoch and prevHash.
/// @param _header - The block header to push.
function pushBlock(Header calldata _header) external;
/// @notice Returns the hash of a block header.
/// @param _header - The block header to hash.
/// @return The hash of the block header.
function hash(Header memory _header) external pure returns (bytes32);
/// @notice Returns the hash of a block header.
/// @param _index - The block number of the header.
/// @return The hash of the block header.
function getHeaderByNum(
uint256 _index
) external view returns (Header memory);
/// @notice Returns the header of the last block in the chain.
/// @return The header of the last block in the chain.
function getHead() external view returns (Header memory);
/// @notice Rolls back the chain to a previous block number. Reverts
/// the chain to a previous state, It can only be called by
/// the challenge contract.
/// @param _blockNumber - The block number to rollback to.
/// @param _blockhash - The block hash to rollback to.
function rollback(uint256 _blockNumber, bytes32 _blockhash) external;
/// @notice Sets the publisher address.
/// @param _publisher - The new publisher address.
function setPublisher(address _publisher) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IRLPReader {
function isList(bytes memory item) external pure returns (bool);
function itemLength(bytes memory item) external pure returns (uint);
function rlpLen(bytes memory item) external pure returns (uint);
function payloadLocation(
bytes memory item
)
external
pure
returns (uint payloadMemPtr, uint payloadLen, uint itemMemPtr);
function numItems(bytes memory item) external pure returns (uint);
function rlpBytesKeccak256(
bytes memory item
) external pure returns (bytes32);
function payloadKeccak256(
bytes memory item
) external pure returns (bytes32);
function toRlpBytes(bytes memory item) external pure returns (bytes memory);
function toBytes(bytes memory item) external pure returns (bytes memory);
function toUint(bytes memory item) external pure returns (uint);
function toUintStrict(bytes memory item) external pure returns (uint);
function toAddress(bytes memory item) external pure returns (address);
function toBoolean(bytes memory item) external pure returns (bool);
function bytesToString(
bytes memory item
) external pure returns (string memory);
function toIterator(bytes memory item) external pure;
function nestedIteration(
bytes memory item
) external pure returns (string memory);
function toBlockHeader(
bytes memory rlpHeader
)
external
pure
returns (
bytes32 parentHash,
bytes32 sha3Uncles,
address coinbase,
bytes32 stateRoot,
bytes32 transactionsRoot,
bytes32 receiptsRoot,
uint difficulty,
uint number,
uint gasLimit,
uint gasUsed,
uint timestamp,
uint nonce
);
function toLegacyTx(
bytes memory rlpTx
)
external
pure
returns (
uint nonce,
uint gasPrice,
uint gasLimit,
address to,
uint value,
bytes memory data,
uint v,
uint r,
uint s
);
function toDepositTx(
bytes memory rlpTx
)
external
pure
returns (
uint256 chainId,
uint nonce,
uint gasPrice,
uint gasLimit,
address to,
uint value,
bytes memory data,
uint8 v,
bytes32 r,
bytes32 s
);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title RLPEncode
* @dev A simple RLP encoding library.
* @author Bakaoh
*/
library RLPEncode {
/*
* Internal functions
*/
/**
* @dev RLP encodes a byte string.
* @param self The byte string to encode.
* @return The RLP encoded string in bytes.
*/
function encodeBytes(
bytes memory self
) internal pure returns (bytes memory) {
bytes memory encoded;
if (self.length == 1 && uint8(self[0]) <= 128) {
encoded = self;
} else {
encoded = concat(encodeLength(self.length, 128), self);
}
return encoded;
}
/**
* @dev RLP encodes a list of RLP encoded byte byte strings.
* @param self The list of RLP encoded byte strings.
* @return The RLP encoded list of items in bytes.
*/
function encodeList(
bytes[] memory self
) internal pure returns (bytes memory) {
bytes memory list = flatten(self);
return concat(encodeLength(list.length, 192), list);
}
/**
* @dev RLP encodes a string.
* @param self The string to encode.
* @return The RLP encoded string in bytes.
*/
function encodeString(
string memory self
) internal pure returns (bytes memory) {
return encodeBytes(bytes(self));
}
/**
* @dev RLP encodes an address.
* @param self The address to encode.
* @return The RLP encoded address in bytes.
*/
function encodeAddress(address self) internal pure returns (bytes memory) {
bytes memory inputBytes;
assembly {
let m := mload(0x40)
mstore(
add(m, 20),
xor(0x140000000000000000000000000000000000000000, self)
)
mstore(0x40, add(m, 52))
inputBytes := m
}
return encodeBytes(inputBytes);
}
/**
* @dev RLP encodes a uint.
* @param self The uint to encode.
* @return The RLP encoded uint in bytes.
*/
function encodeUint(uint256 self) internal pure returns (bytes memory) {
return encodeBytes(toBinary(self));
}
/**
* @dev RLP encodes an int.
* @param self The int to encode.
* @return The RLP encoded int in bytes.
*/
function encodeInt(int256 self) internal pure returns (bytes memory) {
return encodeUint(uint256(self));
}
/**
* @dev RLP encodes a bool.
* @param self The bool to encode.
* @return The RLP encoded bool in bytes.
*/
function encodeBool(bool self) internal pure returns (bytes memory) {
bytes memory encoded = new bytes(1);
encoded[0] = (self ? bytes1(0x01) : bytes1(0x80));
return encoded;
}
/*
* Private functions
*/
/**
* @dev Encode the first byte, followed by the `len` in binary form if `length` is more than 55.
* @param len The length of the string or the payload.
* @param offset 128 if item is string, 192 if item is list.
* @return RLP encoded bytes.
*/
function encodeLength(
uint256 len,
uint256 offset
) private pure returns (bytes memory) {
bytes memory encoded;
if (len < 56) {
encoded = new bytes(1);
encoded[0] = bytes32(len + offset)[31];
} else {
uint256 lenLen;
uint256 i = 1;
while (len / i != 0) {
lenLen++;
i *= 256;
}
encoded = new bytes(lenLen + 1);
encoded[0] = bytes32(lenLen + offset + 55)[31];
for (i = 1; i <= lenLen; i++) {
encoded[i] = bytes32((len / (256 ** (lenLen - i))) % 256)[31];
}
}
return encoded;
}
/**
* @dev Encode integer in big endian binary form with no leading zeroes.
* @notice TODO: This should be optimized with assembly to save gas costs.
* @param _x The integer to encode.
* @return RLP encoded bytes.
*/
function toBinary(uint256 _x) private pure returns (bytes memory) {
bytes memory b = new bytes(32);
assembly {
mstore(add(b, 32), _x)
}
uint256 i = 0;
for (; i < 32; i++) {
if (b[i] != 0) {
break;
}
}
bytes memory res = new bytes(32 - i);
for (uint256 j = 0; j < res.length; j++) {
res[j] = b[i++];
}
return res;
}
/**
* @dev Copies a piece of memory to another location.
* @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.
* @param _dest Destination location.
* @param _src Source location.
* @param _len Length of memory to copy.
*/
function memcpy(uint256 _dest, uint256 _src, uint256 _len) private pure {
uint256 dest = _dest;
uint256 src = _src;
uint256 len = _len;
for (; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
uint256 mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
/**
* @dev Flattens a list of byte strings into one byte string.
* @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.
* @param _list List of byte strings to flatten.
* @return The flattened byte string.
*/
function flatten(bytes[] memory _list) private pure returns (bytes memory) {
if (_list.length == 0) {
return new bytes(0);
}
uint256 len;
uint256 i = 0;
for (; i < _list.length; i++) {
len += _list[i].length;
}
bytes memory flattened = new bytes(len);
uint256 flattenedPtr;
assembly {
flattenedPtr := add(flattened, 0x20)
}
for (i = 0; i < _list.length; i++) {
bytes memory item = _list[i];
uint256 listPtr;
assembly {
listPtr := add(item, 0x20)
}
memcpy(flattenedPtr, listPtr, item.length);
flattenedPtr += _list[i].length;
}
return flattened;
}
/**
* @dev Concatenates two bytes.
* @notice From: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol.
* @param _preBytes First byte string.
* @param _postBytes Second byte string.
* @return Both byte string combined.
*/
function concat(
bytes memory _preBytes,
bytes memory _postBytes
) private pure returns (bytes memory) {
bytes memory tempBytes;
assembly {
tempBytes := mload(0x40)
let length := mload(_preBytes)
mstore(tempBytes, length)
let mc := add(tempBytes, 0x20)
let end := add(mc, length)
for {
let cc := add(_preBytes, 0x20)
} lt(mc, end) {
mc := add(mc, 0x20)
cc := add(cc, 0x20)
} {
mstore(mc, mload(cc))
}
length := mload(_postBytes)
mstore(tempBytes, add(length, mload(tempBytes)))
mc := end
end := add(mc, length)
for {
let cc := add(_postBytes, 0x20)
} lt(mc, end) {
mc := add(mc, 0x20)
cc := add(cc, 0x20)
} {
mstore(mc, mload(cc))
}
mstore(
0x40,
and(
add(add(end, iszero(add(length, mload(_preBytes)))), 31),
not(31)
)
)
}
return tempBytes;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_rblock","type":"bytes32"},{"internalType":"bytes[]","name":"_shareData","type":"bytes[]"}],"name":"ShareKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canonicalStateChain","outputs":[{"internalType":"contract ICanonicalStateChain","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"daOracle","outputs":[{"internalType":"contract IDAOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decodeDepositTx","outputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint64","name":"gas","type":"uint64"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"r","type":"uint256"},{"internalType":"uint256","name":"s","type":"uint256"},{"internalType":"uint256","name":"v","type":"uint256"}],"internalType":"struct ChainOracle.DepositTx","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decodeLegacyTx","outputs":[{"components":[{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint64","name":"gas","type":"uint64"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"r","type":"uint256"},{"internalType":"uint256","name":"s","type":"uint256"},{"internalType":"uint256","name":"v","type":"uint256"}],"internalType":"struct ChainOracle.LegacyTx","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decodeRLPHeader","outputs":[{"components":[{"internalType":"bytes32","name":"parentHash","type":"bytes32"},{"internalType":"bytes32","name":"uncleHash","type":"bytes32"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"bytes32","name":"transactionsRoot","type":"bytes32"},{"internalType":"bytes32","name":"receiptsRoot","type":"bytes32"},{"internalType":"bytes","name":"logsBloom","type":"bytes"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"bytes32","name":"mixHash","type":"bytes32"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct ChainOracle.L2Header","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"raw","type":"bytes[]"},{"components":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct ChainOracle.ShareRange[]","name":"ranges","type":"tuple[]"}],"name":"extractData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_headerHash","type":"bytes32"}],"name":"getHeader","outputs":[{"components":[{"internalType":"bytes32","name":"parentHash","type":"bytes32"},{"internalType":"bytes32","name":"uncleHash","type":"bytes32"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"bytes32","name":"transactionsRoot","type":"bytes32"},{"internalType":"bytes32","name":"receiptsRoot","type":"bytes32"},{"internalType":"bytes","name":"logsBloom","type":"bytes"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"bytes32","name":"mixHash","type":"bytes32"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct ChainOracle.L2Header","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_txHash","type":"bytes32"}],"name":"getTransaction","outputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint64","name":"gas","type":"uint64"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"r","type":"uint256"},{"internalType":"uint256","name":"s","type":"uint256"},{"internalType":"uint256","name":"v","type":"uint256"}],"internalType":"struct ChainOracle.DepositTx","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"parentHash","type":"bytes32"},{"internalType":"bytes32","name":"uncleHash","type":"bytes32"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"bytes32","name":"transactionsRoot","type":"bytes32"},{"internalType":"bytes32","name":"receiptsRoot","type":"bytes32"},{"internalType":"bytes","name":"logsBloom","type":"bytes"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"bytes32","name":"mixHash","type":"bytes32"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct ChainOracle.L2Header","name":"_header","type":"tuple"}],"name":"hashHeader","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"headerToRblock","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"headers","outputs":[{"internalType":"bytes32","name":"parentHash","type":"bytes32"},{"internalType":"bytes32","name":"uncleHash","type":"bytes32"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"bytes32","name":"transactionsRoot","type":"bytes32"},{"internalType":"bytes32","name":"receiptsRoot","type":"bytes32"},{"internalType":"bytes","name":"logsBloom","type":"bytes"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"bytes32","name":"mixHash","type":"bytes32"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_canonicalStateChain","type":"address"},{"internalType":"address","name":"_daOracle","type":"address"},{"internalType":"address","name":"_rlpReader","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_shareKey","type":"bytes32"},{"components":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct ChainOracle.ShareRange[]","name":"_range","type":"tuple[]"}],"name":"provideHeader","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_shareKey","type":"bytes32"},{"components":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct ChainOracle.ShareRange[]","name":"_range","type":"tuple[]"}],"name":"provideLegacyTx","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rblock","type":"bytes32"},{"internalType":"uint8","name":"_pointer","type":"uint8"},{"components":[{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"components":[{"internalType":"uint256","name":"beginKey","type":"uint256"},{"internalType":"uint256","name":"endKey","type":"uint256"},{"components":[{"components":[{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"bytes28","name":"id","type":"bytes28"}],"internalType":"struct Namespace","name":"min","type":"tuple"},{"components":[{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"bytes28","name":"id","type":"bytes28"}],"internalType":"struct Namespace","name":"max","type":"tuple"},{"internalType":"bytes32","name":"digest","type":"bytes32"}],"internalType":"struct NamespaceNode[]","name":"sideNodes","type":"tuple[]"}],"internalType":"struct NamespaceMerkleMultiproof[]","name":"shareProofs","type":"tuple[]"},{"components":[{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"bytes28","name":"id","type":"bytes28"}],"internalType":"struct Namespace","name":"namespace","type":"tuple"},{"components":[{"components":[{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"bytes28","name":"id","type":"bytes28"}],"internalType":"struct Namespace","name":"min","type":"tuple"},{"components":[{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"bytes28","name":"id","type":"bytes28"}],"internalType":"struct Namespace","name":"max","type":"tuple"},{"internalType":"bytes32","name":"digest","type":"bytes32"}],"internalType":"struct NamespaceNode[]","name":"rowRoots","type":"tuple[]"},{"components":[{"internalType":"bytes32[]","name":"sideNodes","type":"bytes32[]"},{"internalType":"uint256","name":"key","type":"uint256"},{"internalType":"uint256","name":"numLeaves","type":"uint256"}],"internalType":"struct BinaryMerkleProof[]","name":"rowProofs","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"tupleRootNonce","type":"uint256"},{"components":[{"internalType":"uint256","name":"height","type":"uint256"},{"internalType":"bytes32","name":"dataRoot","type":"bytes32"}],"internalType":"struct DataRootTuple","name":"tuple","type":"tuple"},{"components":[{"internalType":"bytes32[]","name":"sideNodes","type":"bytes32[]"},{"internalType":"uint256","name":"key","type":"uint256"},{"internalType":"uint256","name":"numLeaves","type":"uint256"}],"internalType":"struct BinaryMerkleProof","name":"proof","type":"tuple"}],"internalType":"struct AttestationProof","name":"attestationProof","type":"tuple"}],"internalType":"struct SharesProof","name":"_proof","type":"tuple"}],"name":"provideShares","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rlpReader","outputs":[{"internalType":"contract IRLPReader","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_daOracle","type":"address"}],"name":"setDAOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rlpReader","type":"address"}],"name":"setRLPReader","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"shares","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"transactions","outputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint64","name":"gas","type":"uint64"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"r","type":"uint256"},{"internalType":"uint256","name":"s","type":"uint256"},{"internalType":"uint256","name":"v","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
0x60a0806040523461002a5730608052614a1990816100308239608051818181610ad40152610c0f0152f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c80630a9b3a32146101c757806320a5acaa146101c2578063263d5f11146101bd57806326410af6146101b857806340a2ab6e146101b35780634aae13ca146101ae5780634f1ef286146101a957806352d1902d146101a4578063642f2eaf1461019f578063715018a61461019a5780637afdc391146101955780637f2596fe146101905780638ac0606b1461018b5780638c69fa5d146101865780638da5cb5b146101815780639e7f27001461017c578063a3be653414610177578063a856759314610172578063acd23ff91461016d578063ad3cb1cc14610168578063b961587814610163578063bfcbf73e1461015e578063c0c53b8b14610159578063d82d0abe14610154578063ee223c021461014f578063efd0f9841461014a5763f2fde38b1461014557600080fd5b611bd0565b611ab5565b611a8c565b61198c565b611843565b61178d565b61169e565b611658565b6115e3565b611529565b6114e2565b611441565b61137b565b611352565b61124f565b610de4565b610db8565b610d4a565b610cca565b610bfc565b610a92565b61099a565b6108b9565b6107fe565b6105bf565b610244565b346101f05760003660031901126101f0576002546040516001600160a01b039091168152602090f35b600080fd5b60406003198201126101f057600435916024356001600160401b03928382116101f057806023830112156101f05781600401359384116101f05760248460061b830101116101f0576024019190565b346101f0576103c261029561028761028f610276610261366101f5565b94919290926000526003602052604060002090565b61028281541515611bfd565b611c3b565b923691611570565b90612b30565b6103b260206102a383612cd8565b92818151910120926102e46001600160401b036102dd60016102cf886000526005602052604060002090565b01546001600160401b031690565b1615611c90565b80516001600160401b031690828101519061030960408201516001600160401b031690565b60608201516001600160a01b0316608083015161038160a08501519261037160c08701519560e08801519861035c610100809a01519b610347610619565b9d8e6000815201906001600160401b03169052565b60408c01526001600160401b031660608b0152565b6001600160a01b03166080890152565b60a087015260c086015260e08501528301526101208201526103ad836000526005602052604060002090565b611e0d565b6040519081529081906020820190565b0390f35b634e487b7160e01b600052603260045260246000fd5b90600182811c9216801561040c575b60208310146103f657565b634e487b7160e01b600052602260045260246000fd5b91607f16916103eb565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761044757604052565b610416565b606081019081106001600160401b0382111761044757604052565b60a081019081106001600160401b0382111761044757604052565b602081019081106001600160401b0382111761044757604052565b90601f801991011681019081106001600160401b0382111761044757604052565b906040519182600082546104d1816103dc565b908184526020946001916001811690816000146105415750600114610502575b5050506105009250038361049d565b565b600090815285812095935091905b81831061052957505061050093508201013880806104f1565b85548884018501529485019487945091830191610510565b9250505061050094925060ff191682840152151560051b8201013880806104f1565b60005b8381106105765750506000910152565b8181015183820152602001610566565b9060209161059f81518092818552858086019101610563565b601f01601f1916010190565b9060206105bc928181520190610586565b90565b346101f05760403660031901126101f057602435600090600435825260036020526040822080548210156106155790602083610601936103c2955220016104be565b604051918291602083526020830190610586565b8280fd5b6040519061014082018281106001600160401b0382111761044757604052565b6040519060c082018281106001600160401b0382111761044757604052565b604051906101e082018281106001600160401b0382111761044757604052565b6040519061012082018281106001600160401b0382111761044757604052565b604051906105008261044c565b6001600160401b03811161044757601f01601f191660200190565b81601f820112156101f0578035906106d7826106a5565b926106e5604051948561049d565b828452602083830101116101f057816000926020809301838601378301015290565b60206003198201126101f057600435906001600160401b0382116101f0576105bc916004016106c0565b60208082528251828201528201516040808301919091528201516001600160a01b0316606082015260608201516080820152608082015160a082015260a082015160c082015260c08201516107946101e0918260e0850152610200840190610586565b926107e960e082015161010090818601528201516101209081860152820151610140908186015282015161016090818601528201516101809081860152820151946101a095601f198683030187870152610586565b93810151906101c09182850152015191015290565b346101f0576103c261081761081236610707565b611ff6565b60405191829182610731565b6001600160401b0381116104475760051b60200190565b81601f820112156101f05780359160209161085484610823565b93610862604051958661049d565b808552838086019160051b830101928084116101f057848301915b84831061088d5750505050505090565b82356001600160401b0381116101f05786916108ae848480948901016106c0565b81520192019161087d565b346101f05760403660031901126101f0576024356001600160401b0381116101f0576108f66108ee602092369060040161083a565b600435612173565b604051908152f35b60208082528251828201528201516001600160401b031660408201526040820151606082015261093e606083015160808301906001600160401b03169052565b60808201516001600160a01b031660a082015260a082015160c082015260c0820151610978610140918260e0850152610160840190610586565b9260e08101516101009081850152810151906101209182850152015191015290565b346101f05760203660031901126101f0576109b36121fd565b5060043560005260056020526103c2604060002060086109d1610619565b91805483526109fd6109ed60018301546001600160401b031690565b6001600160401b03166020850152565b6002810154604084015260038101546001600160401b0381166060850152610a329060401c6001600160a01b03166080850152565b600481015460a0840152610a48600582016104be565b60c0840152600681015460e084015260078101546101008401520154610120820152604051918291826108fe565b6001600160a01b038116036101f057565b359061050082610a76565b60403660031901126101f0576004803590610aac82610a76565b6024356001600160401b0381116101f057610aca90369083016106c0565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116308114908115610be0575b50610bcf579060208392610b1261330d565b6040516352d1902d60e01b8152938491829088165afa60009281610b9e575b50610b5f575050604051634c9c8ce360e01b81526001600160a01b0390921690820190815281906020010390fd5b83836000805160206149a48339815191528403610b8257610b808383613830565b005b604051632a87526960e21b815290810184815281906020010390fd5b610bc191935060203d602011610bc8575b610bb9818361049d565b8101906132fe565b9138610b31565b503d610baf565b60405163703e46dd60e11b81528390fd5b9050816000805160206149a48339815191525416141538610b00565b346101f05760003660031901126101f0577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163003610c555760206040516000805160206149a48339815191528152f35b60405163703e46dd60e11b8152600490fd5b969391610120989b9a999692610cba969294610140958a526001600160401b0380931660208b015260408a015216606088015260018060a01b0316608087015260a08601528060c0860152840190610586565b9560e08301526101008201520152565b346101f05760203660031901126101f0576004356000526005602052604060002080546103c26001600160401b0391826001850154169360028101549160038201546004830154610d1d600585016104be565b9160068501549360086007870154960154966040519a8b9a60018060a01b038560401c169416928b610c67565b346101f057600080600319360112610db557610d6461330d565b60008051602061498483398151915280546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346101f05760203660031901126101f05760043560005260076020526020604060002054604051908152f35b346101f057610e3b610df536610707565b610dfd6121fd565b50600254610e1b906001600160a01b03165b6001600160a01b031690565b906040518092633da575c960e21b825281806000968795600483016105ab565b03915afa8015610f07578280819082908390849285948698878099610ecf575b50506001600160401b038093610e6f610619565b9b8c52166001600160401b031660208b015260408a0152166001600160401b031660608801526001600160a01b0316608087015260a086015260c085015260e084015261010083015260ff166101208201526040516103c28192826108fe565b9850985050505050505050610ef692503d8091833e610eee818361049d565b81019061229d565b919791969095929492903880610e5b565b611fea565b60ff8116036101f057565b91908260409103126101f057604051610f2f8161042c565b9182908035906001600160f81b0319821682036101f057908252602001359063ffffffff19821682036101f05760200152565b81601f820112156101f0578035906020610f7b83610823565b93604090610f8c604051968761049d565b8486526020860191602060a0809702860101948286116101f057602001925b858410610fbc575050505050505090565b86848403126101f0578487918351610fd38161044c565b610fdd8688610f17565b8152610feb86868901610f17565b83820152608087013585820152815201930192610fab565b81601f820112156101f05780359160209161101d84610823565b9360409261102e604051968761049d565b818652848087019260051b840101938185116101f057858401925b85841061105a575050505050505090565b6001600160401b0384358181116101f057860191606080601f1985880301126101f0578451906110898261044c565b8a8501358252858501358b8301528401359283116101f0576110b2868b80969581960101610f62565b85820152815201930192611049565b9190916060818403126101f057604051906110db8261044c565b819381356001600160401b0381116101f057820181601f820112156101f057602091813561110881610823565b92611116604051948561049d565b818452848085019260051b8201019283116101f0578401905b82821061114e5750505083528082013590830152604090810135910152565b8135815290840190840161112f565b81601f820112156101f05780359160209161117784610823565b93611185604051958661049d565b808552838086019160051b830101928084116101f057848301915b8483106111b05750505050505090565b82356001600160401b0381116101f05786916111d1848480948901016110c1565b8152019201916111a0565b8082039291608084126101f057604051916111f68361044c565b6040839582358552601f1901126101f0576040516112138161042c565b602082013581526040820135602082015260208401526060810135916001600160401b0383116101f05760409261124a92016110c1565b910152565b346101f0576003196060368201126101f057602435600461126f82610f0c565b604435916001600160401b03938484116101f05760e09084360301126101f057611297610639565b91838101358581116101f0576112b29082369187010161083a565b835260248401358581116101f0576112cf90823691870101611003565b60208401526112e13660448601610f17565b604084015260848401358581116101f05761130190823691870101610f62565b606084015260a48401358581116101f0576113219082369187010161115d565b608084015260c48401359485116101f0576113476103b294826103c297369201016111dc565b60a08401523561283a565b346101f05760003660031901126101f0576000546040516001600160a01b039091168152602090f35b346101f05760003660031901126101f057600080516020614984833981519152546040516001600160a01b039091168152602090f35b9b9799959091949d9f9e9d61140a9460606101c09f9b978f906114369f9b976113f0916101e09884526020840152604083019060018060a01b03169052565b015260808d015260a08c01528060c08c01528a0190610586565b9560e0890152610100880152610120870152610140860152610160850152838203610180850152610586565b946101a08201520152565b346101f05760203660031901126101f057600435600052600460205260406000208054600182015490600283015461147e9060018060a01b031690565b92600381015490600481015460058201546006830161149c906104be565b60078401546008850154600986015491600a87015493600b88015495600c89016114c5906104be565b97600d8a015499600e01549a6040519e8f9e8f9e6103c29f6113b1565b346101f05760203660031901126101f0576004356114ff81610a76565b61150761330d565b600180546001600160a01b0319166001600160a01b0392909216919091179055005b346101f05760203660031901126101f05760043561154681610a76565b61154e61330d565b600280546001600160a01b0319166001600160a01b0392909216919091179055005b92919261157c82610823565b60409261158c604051928361049d565b819581835260208093019160061b8401938185116101f057915b8483106115b557505050505050565b85838303126101f05783869182516115cc8161042c565b8535815282860135838201528152019201916115a6565b346101f05760403660031901126101f0576001600160401b036004358181116101f05761161490369060040161083a565b906024359081116101f057366023820112156101f0576103c29161028f610601923690602481600401359101611570565b6040519061165282610482565b60008252565b346101f05760003660031901126101f0576103c26040516116788161042c565b60058152640352e302e360dc1b6020820152604051918291602083526020830190610586565b346101f05760203660031901126101f0576116b7611f08565b5060043560005260046020526103c26040600020600e6116d5610658565b825481526001830154602082015260028301546001600160a01b03166040820152916003810154606084015260048101546080840152600581015460a0840152611721600682016104be565b60c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b810154610160840152611768600c82016104be565b610180840152600d8101546101a084015201546101c082015260405191829182610731565b346101f0576117a361179e36610707565b612cd8565b6040518091602082526117c26020830182516001600160401b03169052565b602081015160408301526117e6604082015160608401906001600160401b03169052565b60608101516001600160a01b03166080830152608081015160a083015260a0810151611820610120918260c0860152610140850190610586565b9160c081015160e085015260e08101519061010091828601520151908301520390f35b346101f05760603660031901126101f05760043561186081610a76565b6024359061186d82610a76565b60443561187981610a76565b6000805160206149c483398151915254926001600160401b0360ff8560401c1615941680159081611984575b600114908161197a575b159081611971575b5061195f576000805160206149c4833981519152805467ffffffffffffffff191660011790556118eb928461193a57612ded565b6118f157005b6000805160206149c4833981519152805460ff60401b19169055604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b6000805160206149c4833981519152805460ff60401b1916600160401b179055612ded565b60405163f92ee8a960e01b8152600490fd5b905015386118b7565b303b1591506118af565b8591506118a5565b346101f05761028f6119c36108126119a3366101f5565b919490856000526003602052610287604060002061028281541515611bfd565b61010081015115611a5257611a2c6103c292611a1c6119e184612fd9565b93611a0360086119fb876000526004602052604060002090565b015415612e42565b611a17856000526004602052604060002090565b612e86565b6000526006602052604060002090565b54611a41826000526007602052604060002090565b556040519081529081906020820190565b60405162461bcd60e51b81526020600482015260126024820152710686561646572206e756d62657220697320360741b6044820152606490fd5b346101f05760003660031901126101f0576001546040516001600160a01b039091168152602090f35b346101f0576003196020368201126101f0576004356001600160401b03918282116101f0576101e09082360301126101f057611aef610658565b8160040135815260248201356020820152611b0c60448301610a87565b6040820152606482013560608201526084820135608082015260a482013560a082015260c48201358381116101f057611b4b90600436918501016106c0565b60c082015260e482013560e08201526101048201356101008201526101248201356101208201526101448201356101408201526101648201356101608201526101848201359283116101f0576101c46103b292611bb16103c295600436918401016106c0565b6101808401526101a48101356101a084015201356101c0820152612fd9565b346101f05760203660031901126101f057610b80600435611bf081610a76565b611bf861330d565b61328a565b15611c0457565b60405162461bcd60e51b815260206004820152600f60248201526e1cda185c99481b9bdd08199bdd5b99608a1b6044820152606490fd5b908154611c4781610823565b92611c55604051948561049d565b818452600090815260208082208186015b848410611c74575050505050565b6001838192611c82856104be565b815201920193019290611c66565b15611c9757565b60405162461bcd60e51b815260206004820152601a60248201527f7472616e73616374696f6e20616c7265616479206578697374730000000000006044820152606490fd5b818110611ce7575050565b60008155600101611cdc565b9190601f8111611d0257505050565b610500926000526020600020906020601f840160051c83019310611d2e575b601f0160051c0190611cdc565b9091508190611d21565b91909182516001600160401b03811161044757611d5f81611d5984546103dc565b84611cf3565b602080601f8311600114611da257508190611d93939495600092611d97575b50508160011b916000199060031b1c19161790565b9055565b015190503880611d7e565b90601f19831695611db885600052602060002090565b926000905b888210611df557505083600195969710611ddc575b505050811b019055565b015160001960f88460031b161c19169055388080611dd2565b80600185968294968601518155019501930190611dbd565b9061012060089180518455611e4e611e2f60208301516001600160401b031690565b60018601906001600160401b03166001600160401b0319825416179055565b60408101516002850155611ed160038501611e93611e7660608501516001600160401b031690565b825467ffffffffffffffff19166001600160401b03909116178255565b60808301516001600160a01b0316815468010000000000000000600160e01b03191660409190911b68010000000000000000600160e01b0316179055565b60a08101516004850155611eec60c082015160058601611d38565b60e0810151600685015561010081015160078501550151910155565b604051906101e082018281106001600160401b0382111761044757604052816101c06000918281528260208201528260408201528260608201528260808201528260a0820152606060c08201528260e0820152826101008201528261012082015282610140820152826101608201526060610180820152826101a08201520152565b9190826101809103126101f0578151916020810151916040820151611fae81610a76565b9160608101519160808201519160a08101519160c08201519160e081015191610100820151916101208101519161016061014083015192015190565b6040513d6000823e3d90fd5b611ffe611f08565b5060025461203990612018906001600160a01b0316610e0f565b916040518093631cec2f7f60e31b82528180610180958695600483016105ab565b03915afa908115610f075760009081938283908490859086908792889489968a988b9c612126575b506040519384602081016120a5906101009060008082528060208301528060408301528060608301528060808301528060a08301528060c083015260e08201520190565b03601f19810186526120b7908661049d565b6120bf611645565b9b6120c8610658565b908152602081019e909e526001600160a01b031660408e015260608d015260808c015260a08b015260c08a015260e089015261010088015261012087015261014086015261016085015283015260006101a08301526101c082015290565b9a5050505050505050505080935061215392503d841161216c575b61214b818361049d565b810190611f8a565b999b999a99989097919692959394939092909138612061565b503d612141565b90604051908160209160208201946060830190865260408084015281518091526080830193602060808360051b8601019301946000905b8382106121ce57505050506121c8925003601f19810183528261049d565b51902090565b91600191939550806121eb8196607f198b82030186528951610586565b970192019201869492959391956121aa565b6040519061014082018281106001600160401b0382111761044757604052816101206000918281528260208201528260408201528260608201528260808201528260a0820152606060c08201528260e0820152826101008201520152565b81601f820112156101f0578051612271816106a5565b9261227f604051948561049d565b818452602082840101116101f0576105bc9160208085019101610563565b9190610140838203126101f05782519260208101519260408201519260608301519260808101516122cd81610a76565b9260a08201519260c0830151906001600160401b0382116101f0576122f391840161225b565b9160e081015161230281610f0c565b9161012061010083015192015190565b51906001600160401b03821682036101f057565b90602080838303126101f05782516001600160401b03938482116101f057019060a0828403126101f05760409081519461235f86610467565b61236884612312565b8652612375828501612312565b8287015282840151838701526060936060810151606088015260808101519182116101f057019184601f840112156101f0578251906123b382610823565b956123c08251978861049d565b8287528360608189019402860101948186116101f0578401925b8584106123f05750505050505050608082015290565b86848303126101f0578251906124058261044c565b61240e85612312565b82528585015162ffffff811681036101f05786830152838501519061ffff821682036101f057828792868b9501528152019301926123da565b1561244e57565b60405162461bcd60e51b815260206004820152601060248201526f1c989b1bd8dac81b9bdd08199bdd5b9960821b6044820152606490fd5b8051156124935760200190565b6103c6565b8051600110156124935760400190565b8051600210156124935760600190565b8051600310156124935760800190565b8051600410156124935760a00190565b8051600510156124935760c00190565b8051600610156124935760e00190565b805160071015612493576101000190565b805160081015612493576101200190565b805160091015612493576101400190565b8051600a1015612493576101600190565b8051600b1015612493576101800190565b8051600c1015612493576101a00190565b8051600d1015612493576101c00190565b8051600e1015612493576101e00190565b80518210156124935760209160051b010190565b1561259b57565b60405162461bcd60e51b81526020600482015260166024820152750e4c4d8dec6d640d0cad2ced0e840dad2e6dac2e8c6d60531b6044820152606490fd5b156125e057565b60405162461bcd60e51b81526020600482015260136024820152721cda185c995cc81b9bdd081d995c9a599a5959606a1b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b9190916001600160401b038080941691160191821161264c57565b61261b565b908160081b91808304610100149015171561264c57565b908160011b918083046002149015171561264c57565b8181029291811591840414171561264c57565b906001820180921161264c57565b906037820180921161264c57565b600101908160011161264c57565b906080820180921161264c57565b9060c0820180921161264c57565b9190820180921161264c57565b156126eb57565b60405162461bcd60e51b815260206004820152603860248201527f70726f7669646564207368617265206d7573742062652077697468696e20746860448201527f652063656c657374696120706f696e7465722072616e676500000000000000006064820152608490fd5b815191600160401b83116104475781548383558084106127b4575b50612786602080920192600052602060002090565b6000925b848410612798575050505050565b600183826127a883945186611d38565b0192019301929061278a565b60008360005284602060002092830192015b8281106127d4575050612771565b806127e1600192546103dc565b806127ee575b50016127c6565b601f9081811184146128065750508281555b386127e7565b836128289261281a85600052602060002090565b920160051c82019101611cdc565b60008181526020812081835555612800565b600054909190612852906001600160a01b0316610e0f565b604051635bb4b8e760e11b81526004810184905290600090829060249082905afa908115610f07576000916129fa575b506001600160401b039081815161289f906001600160401b031690565b1615156128ab90612447565b6080018181519360ff1693846128c091612580565b51516001600160401b03169360a08701602095838783510151519116146128e690612594565b60015490518601518601516129059189906001600160a01b0316613366565b5061290f906125d9565b6080870190815161291f90612486565b51612929906134f9565b5090868186519061293991612580565b51015162ffffff1662ffffff1694519061295291612580565b51604001516129659061ffff1685612631565b958089015161297390612486565b5151925161298090612486565b51015161298c9161267e565b612995916126d7565b9116811015916129ad93836129ee575b5050506126e4565b6129d66129bb835183612173565b92516129d1846000526003602052604060002090565b612756565b6129ea826000526006602052604060002090565b5590565b161190503880806129a5565b612a1791503d806000833e612a0f818361049d565b810190612326565b38612882565b602003906020821161264c57565b60001981019190821161264c57565b9061010091820391821161264c57565b9190820391821161264c57565b60405190612a648261042c565b60208083523683820137565b60405190612a7d8261042c565b6001825260203681840137565b604051612a9681610482565b60008152906000368137565b90612aac826106a5565b612ab9604051918261049d565b8281528092612aca601f19916106a5565b0190602036910137565b15612adb57565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642072616e676560981b6044820152606490fd5b908151811015612493570160200190565b600019811461264c5760010190565b9091600090815b8451831015612b6f57612b67600191612b61612b538689612580565b516020810151905190612a4a565b906126d7565b920191612b37565b612b7b91949250612aa2565b926000936000935b8351851015612c1657612b968585612580565b51936020850194612bb58651612bac8986612580565b51511015612ad4565b51965b8551881015612c0757612bff600191612bec612bde8b612bd88c89612580565b51612b10565b516001600160f81b03191690565b60001a612bf98288612b10565b53612b21565b970196612bb8565b96506001909501949350612b83565b509350915050565b6040519061012082018281106001600160401b038211176104475760405281610100600091828152826020820152826040820152826060820152826080820152606060a08201528260c08201528260e08201520152565b610120818303126101f0578051926020820151926040830151926060810151612c9d81610a76565b9260808201519260a0830151906001600160401b0382116101f057612cc391840161225b565b9160c08101519161010060e083015192015190565b612d1a90612ce4612c1e565b50600254612cfa906001600160a01b0316610e0f565b9060405180926314cc59fb60e21b825281806000968795600483016105ab565b03915afa8015610f07578280819082839184938597868098612dab575b5050612d8e9291612d7e916001600160401b0391612d6883612d57610678565b9d168d906001600160401b03169052565b60208c0152166001600160401b031660408a0152565b6001600160a01b03166060880152565b608086015260a085015260c084015260e083015261010082015290565b9550955050505050612d8e9450612d7e9350612dd992503d8091833e612dd1818361049d565b810190612c75565b979950909790959194929392908290612d37565b91612df6613cca565b612dfe613cca565b612e073361328a565b60018060a01b038092816bffffffffffffffffffffffff60a01b95168560005416176000551683600154161760015516906002541617600255565b15612e4957565b60405162461bcd60e51b815260206004820152601560248201527468656164657220616c72656164792065786973747360581b6044820152606490fd5b815181556020820151600182015560408201516002820180546001600160a01b0319166001600160a01b0390921691909117905590600e906101c090606081015160038501556080810151600485015560a08101516005850155612ef160c082015160068601611d38565b60e0810151600785015561010081015160088501556101208101516009850155610140810151600a850155610160810151600b850155612f39610180820151600c8601611d38565b6101a0810151600d8501550151910155565b6040519061020082018281106001600160401b0382111761044757604052600f82528160005b6101e08110612f7e575050565b806060602080938501015201612f71565b90612f9982610823565b612fa6604051918261049d565b8281528092612fb7601f1991610823565b019060005b828110612fc857505050565b806060602080938501015201612fbc565b613282612fe4612f4b565b6132696101c084519461324e613242613025604080519061302a8261301160209d8e830160209181520190565b0392613025601f199485810183528261049d565b613517565b6130338a612486565b5261303d89612486565b506130688b8701516130258d61305c8551938492830160209181520190565b0385810183528261049d565b6130718a612498565b5261307b89612498565b5085810151613092906001600160a01b031661366a565b61309b8a6124a8565b526130a5896124a8565b506130c560608701516130258d61305c8551938492830160209181520190565b6130ce8a6124b8565b526130d8896124b8565b506130f860808701516130258d61305c8551938492830160209181520190565b6131018a6124c8565b5261310b896124c8565b5061312b60a08701516130258d61305c8551938492830160209181520190565b6131348a6124d8565b5261313e896124d8565b5061314c60c0870151613517565b6131558a6124e8565b5261315f896124e8565b5061316d60e0870151613689565b6131768a6124f8565b52613180896124f8565b5061318f610100870151613689565b6131988a612509565b526131a289612509565b506131b1610120870151613689565b6131ba8a61251a565b526131c48961251a565b506131d3610140870151613689565b6131dc8a61252b565b526131e68961252b565b506131f5610160870151613689565b6131fe8a61253c565b526132088961253c565b50613217610180870151613517565b6132208a61254d565b5261322a8961254d565b506101a086015190519384918c830160209181520190565b0390810183528261049d565b6132578561255e565b526132618461255e565b500151613689565b6132728261256f565b5261327c8161256f565b5061372e565b805191012090565b6001600160a01b039081169081156132e55760008051602061498483398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b908160209103126101f0575190565b600080516020614984833981519152546001600160a01b0316330361332e57565b60405163118cdaa760e01b8152336004820152602490fd5b600b111561335057565b634e487b7160e01b600052602160045260246000fd5b909291613385906060850192835160808701519060a088015192613960565b90156134d05750602080840191825151815151036134c357600094855b845180518810156133df57600191612b61866133c18b6133d795612580565b5101516133cf8b8a51612580565b515190612a4a565b9601956133a2565b50909550939193855151036134b657600092835b815180518610156134a6578661340c8761341a93612580565b5101516133cf878551612580565b9061343188518261342b85826126d7565b91613ac5565b61343a81613346565b80613496575061346a61346e91613452898851612580565b5161345e8a8851612580565b5160408d015191613bed565b1590565b6134865760019161347e916126d7565b9401936133f3565b5050505092505050600090600190565b9850505050505091505060009190565b5050505092505050600190600090565b5092505050600090600790565b5050509050600090600590565b92505060009190565b81156134e3570490565b634e487b7160e01b600052601260045260246000fd5b604001516003811661350e5760021c90600090565b50600090600890565b90600091805192600193600181149081613651575b501561353757509150565b815193603885101561357b5750926105bc9293613552612a70565b916001600160f81b031990613566906126bb565b60f81b16901a61357582612486565b53613d08565b8190806001915b613621575b505061359a61359582612691565b612aa2565b916001600160f81b03196135b56135b0846126bb565b61269f565b8160f89160f81b16831a6135c886612486565b5360015b848111156135e45750505050506105bc929350613d08565b808361360d6136076136016135fc61361c968b612a4a565b613cf9565b8d6134d9565b60ff1690565b841b16851a612bf98289612b10565b6135cc565b909161362d83886134d9565b1561364b5761363e61364491612b21565b92612651565b9080613582565b91613587565b905015612493576080602083015160f81c11153861352c565b6105bc9060405190600560a21b18601482015260348101604052613517565b90613692612a57565b60209260208201526000926000905b8082106136fd575b506136b661359582612a1d565b9160005b83518110156136ef576001906136dc612bde6136d586612b21565b9585612b10565b871a6136e88287612b10565b53016136ba565b5050506105bc919250613517565b9061371b61370e612bde8386612b10565b6001600160f81b03191690565b61372857600101906136a1565b906136a9565b61373790613d81565b90815160006038821060001461377a5750916105bc9192613756612a70565b906001600160f81b03199061376a906126c9565b60f81b1660001a61357582612486565b916001925b61378984846134d9565b156137a65761379a6137a091612b21565b93612651565b9261377f565b9092509290926137b861359582612691565b906001600160f81b03196137ce6135b0836126c9565b8160f89160f81b1660001a6137e285612486565b5360015b838111156137fd57505050506105bc929350613d08565b808361381b6136076138156135fc61382b968a612a4a565b8c6134d9565b841b1660001a612bf98288612b10565b6137e6565b90813b156138b6576000805160206149a483398151915280546001600160a01b0319166001600160a01b0384169081179091557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a280511561389b5761389891613e19565b50565b5050346138a457565b60405163b398979f60e01b8152600490fd5b604051634c9c8ce360e01b81526001600160a01b0383166004820152602490fd5b908160209103126101f0575180151581036101f05790565b919290825260208381945182850152015160408301526080606083015260e082019281519360606080850152845180915281610100850195019060005b81811061394c575050508160409160c093015160a0850152015191015290565b82518752958301959183019160010161392c565b92936139958551946020958691828901516040809a01519260405195869485938493631f3302a960e01b8552600485016138ef565b03916001600160a01b03165afa908115610f0757600091613a98575b5015613a8b578251825103613a7e5760005b8351811015613a7057613a5661346a6139e66139df8487612580565b5151613e5f565b613a456139ff896139f7878a612580565b510151613e5f565b91613a378b613a0e888b612580565b5101518c5162ffffff199384168d820190815293909516601d840152603a8301528391605a0190565b03601f19810183528261049d565b613a4f8488612580565b5185613ec8565b613a62576001016139c3565b505050505050600090600290565b505050505050600190600090565b5050505050600090600690565b5050505050600090600490565b613ab89150853d8711613abe575b613ab0818361049d565b8101906138d7565b386139b1565b503d613aa6565b9190818111613b4f578251808211908115613b45575b50613b3d5780820382811161264c57613af390612f8f565b92815b838110613b07575050505090600090565b613b118183612580565b51908381039181831161264c5782613b3691613b2f6001958a612580565b5287612580565b5001613af6565b505090600a90565b9050821138613adb565b505090600990565b60405190613b648261042c565b60006020838281520152565b60405190613b7d8261044c565b6000604083613b8a613b57565b8152613b94613b57565b60208201520152565b90613ba782610823565b613bb4604051918261049d565b8281528092613bc5601f1991610823565b019060005b828110613bd657505050565b602090613be1613b70565b82828501015201613bca565b92939193613bfb8151613b9d565b9260009260005b8351811015613cbb57613c158185612580565b5190613c1f613b70565b50613c2989613e5f565b9160409287613c7c8551613c716020958695858785015262ffffff1916602184015282603e91613c61815180928a8686019101610563565b810103601e81018452018261049d565b865191828092613f62565b039060025afa15610f075786516001938b613c95610698565b93818552840152820152613ca98289612580565b52613cb48188612580565b5001613c02565b5092509450506105bc92613f79565b60ff6000805160206149c48339815191525460401c1615613ce757565b604051631afcd79f60e31b8152600490fd5b601f811161264c576101000a90565b6040519181518084526020808501918501928184019282808701915b858110613d715750505080518093875182018852940193828086019201905b828110613d62575050505090603f91601f199351011501011660405290565b81518152908301908301613d43565b8251815291810191849101613d24565b805115613e105790600091825b8151841015613db757613daf600191613da78685612580565b5151906126d7565b930192613d8e565b613dc391929350612aa2565b906020808301936000945b8351861015613e0857613e00600191613df6613dea8988612580565b51868151910183614086565b613da78887612580565b950194613dce565b509350505090565b506105bc612a8a565b6000806105bc93602081519101845af43d15613e57573d91613e3a836106a5565b92613e48604051948561049d565b83523d6000602085013e6140ed565b6060916140ed565b80516020918201516040516001600160f81b031990921692820192835263ffffffff19166021820152601d8152613e958161042c565b51905162ffffff19918282169190601d8110613eb3575b5050905090565b83919250601d0360031b1b1616803880613eac565b6040820180519293919260018111613f435750835151613f3a575b6020840191825182511115613f3057613efb906141e8565b935191825115613f195790613f1593949151905190614246565b1490565b5051600114159050613f29571490565b5050600090565b5050505050600090565b50505050600090565b613f54855151916020870151614150565b14613ee35750505050600090565b90613f7560209282815194859201610563565b0190565b929091926000936040840192613f90845151613b9d565b926000965b8651808214158061407b575b15613feb5781613fb7613fdf92613fe5946143d1565b90613fc38b8a51612580565b51613fce8c8a612580565b52613fd98b89612580565b506126d7565b97612b21565b96613f95565b5050949250945061402760008061400d614008602087015161443b565b612668565b94600195869560018210614072575b83919299989961446c565b5050949094925b61403f575b5050506105bc916146b8565b8051805184101561406c5761406384959661405c85968694612580565b5190614579565b9594019261402e565b50614033565b6001915061401c565b508651518910613fa1565b92905b6020938484106140be578151815284810180911161264c5793810180911161264c5791601f19810190811161264c5791614089565b92909193506020036020811161264c576140da6140df91613cf9565b612a2b565b905182518216911916179052565b90614114575080511561410257805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580614147575b614125575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561411d565b909160005b60018481831b1015614170578101809111156141555761261b565b509291909261010090810390811161264c5761418b90612a3a565b91600161419784612a2b565b1b916141a283612a2b565b81116141ae5750505090565b91925090600183036141c257505050600190565b826141d36141df946141d993612a4a565b92612a4a565b90614150565b6105bc906126ad565b600061423360209260405161422260218287810194878652614212815180928b8686019101610563565b810103600181018452018261049d565b604051928392839251928391610563565b8101039060025afa15610f075760005190565b90918215614370576001831461431f578351156142da576142668361443b565b6142796142738651612a2b565b86614701565b928181106142b657816141d3614299969361429393612a4a565b90614246565b6142b0826142aa6105bc9451612a2b565b90612580565b516147c5565b6142c09450614246565b906142d36105bc92916142aa8151612a2b565b51906147c5565b60405162461bcd60e51b815260206004820181905260248201527f6578706563746564206174206c65617374206f6e6520696e6e657220686173686044820152606490fd5b929150505161432b5790565b60405162461bcd60e51b815260206004820152601760248201527f756e657870656374656420696e6e6572206861736865730000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152603360248201527f63616e6e6f742063616c6c20636f6d70757465526f6f744861736820776974686044820152722030206e756d626572206f66206c656176657360681b6064820152608490fd5b91829160005b83151580614430575b156143f8576143ee90612b21565b9260011c926143d7565b92509092810390811161264c5761440e90614811565b60001981019190821161264c5781600192821161442a57501b90565b90501b90565b5083600116156143e0565b600181106101f05761444c81614811565b600019810190811161264c576001901b9081146144665790565b60011c90565b93959492909261447a613b70565b5060016144878484612a4a565b146145345784518211801590614526575b61450a576144c5906144b26144ad8585612a4a565b61443b565b976144bd89866126d7565b85878961446c565b5091976144e096929591946144da91906126d7565b9161446c565b919490939290911515600114614501576144f991614579565b929190600090565b50929190600090565b93604091935061451e959692500151614851565b929391929091565b506020850151831015614498565b939495918086949294511115908161456b575b5061455a5750604061451e940151614851565b805161451e95509193919250614832565b905060208601511138614547565b90614582613b70565b50602060006146576145978551855190614867565b946145a0613b57565b506145b481516145ae61489b565b906148c9565b831461467e5761464b6145c561489b565b955b613a376145d48451613e5f565b9160406145e389870151613e5f565b950151906145f18151613e5f565b60406145ff8b840151613e5f565b920151926040519788968c88019491929360b59694600160f81b875262ffffff1980958180951660018a015216601e880152603b87015216605b85015216607883015260958201520190565b60405191828092613f62565b039060025afa15610f07576000519061466e610698565b9283526020830152604082015290565b61468b85516145ae61489b565b831461469e5761464b84820151956145c7565b61464b6146b28583015186880151906148ea565b956145c7565b906146c682518251906148c9565b91826146e6575b826146d757505090565b60409192508101519101511490565b91506146fb60208301516020830151906148c9565b916146cd565b9190825181116147685761471481610823565b90614722604051928361049d565b808252601f1961473182610823565b0136602084013760005b818110614749575090925050565b8061475660019287612580565b516147618286612580565b520161473b565b60405162461bcd60e51b815260206004820152602f60248201527f496e76616c69642072616e67653a205f626567696e206f72205f656e6420617260448201526e65206f7574206f6620626f756e647360881b6064820152608490fd5b604051916020830191600160f81b83526021840152604183015260418252608082018281106001600160401b038211176104475760209281614233600094826040528351928391610563565b806000915b61481e575090565b9061482890612b21565b9060011c80614816565b906148499291949394614843613b70565b50614919565b919392909190565b9061485f9291614843613b70565b919390929190565b90614870613b57565b5061487a82613e5f565b62ffffff198061488984613e5f565b1691161015614896575090565b905090565b6148a3613b57565b506040516148b08161042c565b6001600160f81b0319815263ffffffff19602082015290565b6148d56148e391613e5f565b9162ffffff19918291613e5f565b1691161490565b906148f3613b57565b506148fd82613e5f565b62ffffff198061490c84613e5f565b1691161115614896575090565b90809392614925613b70565b508251908115918215614978575b50811561496d575b5061495c5761494991612580565b516001830180931161264c579190600090565b5050614966613b70565b9190600190565b90508110153861493b565b83101591503861493356fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbcf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a2646970667358221220d6831083507b821c4cabb853fa315de5d021a82db1afa41d173c5deb338e331264736f6c63430008160033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80630a9b3a32146101c757806320a5acaa146101c2578063263d5f11146101bd57806326410af6146101b857806340a2ab6e146101b35780634aae13ca146101ae5780634f1ef286146101a957806352d1902d146101a4578063642f2eaf1461019f578063715018a61461019a5780637afdc391146101955780637f2596fe146101905780638ac0606b1461018b5780638c69fa5d146101865780638da5cb5b146101815780639e7f27001461017c578063a3be653414610177578063a856759314610172578063acd23ff91461016d578063ad3cb1cc14610168578063b961587814610163578063bfcbf73e1461015e578063c0c53b8b14610159578063d82d0abe14610154578063ee223c021461014f578063efd0f9841461014a5763f2fde38b1461014557600080fd5b611bd0565b611ab5565b611a8c565b61198c565b611843565b61178d565b61169e565b611658565b6115e3565b611529565b6114e2565b611441565b61137b565b611352565b61124f565b610de4565b610db8565b610d4a565b610cca565b610bfc565b610a92565b61099a565b6108b9565b6107fe565b6105bf565b610244565b346101f05760003660031901126101f0576002546040516001600160a01b039091168152602090f35b600080fd5b60406003198201126101f057600435916024356001600160401b03928382116101f057806023830112156101f05781600401359384116101f05760248460061b830101116101f0576024019190565b346101f0576103c261029561028761028f610276610261366101f5565b94919290926000526003602052604060002090565b61028281541515611bfd565b611c3b565b923691611570565b90612b30565b6103b260206102a383612cd8565b92818151910120926102e46001600160401b036102dd60016102cf886000526005602052604060002090565b01546001600160401b031690565b1615611c90565b80516001600160401b031690828101519061030960408201516001600160401b031690565b60608201516001600160a01b0316608083015161038160a08501519261037160c08701519560e08801519861035c610100809a01519b610347610619565b9d8e6000815201906001600160401b03169052565b60408c01526001600160401b031660608b0152565b6001600160a01b03166080890152565b60a087015260c086015260e08501528301526101208201526103ad836000526005602052604060002090565b611e0d565b6040519081529081906020820190565b0390f35b634e487b7160e01b600052603260045260246000fd5b90600182811c9216801561040c575b60208310146103f657565b634e487b7160e01b600052602260045260246000fd5b91607f16916103eb565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761044757604052565b610416565b606081019081106001600160401b0382111761044757604052565b60a081019081106001600160401b0382111761044757604052565b602081019081106001600160401b0382111761044757604052565b90601f801991011681019081106001600160401b0382111761044757604052565b906040519182600082546104d1816103dc565b908184526020946001916001811690816000146105415750600114610502575b5050506105009250038361049d565b565b600090815285812095935091905b81831061052957505061050093508201013880806104f1565b85548884018501529485019487945091830191610510565b9250505061050094925060ff191682840152151560051b8201013880806104f1565b60005b8381106105765750506000910152565b8181015183820152602001610566565b9060209161059f81518092818552858086019101610563565b601f01601f1916010190565b9060206105bc928181520190610586565b90565b346101f05760403660031901126101f057602435600090600435825260036020526040822080548210156106155790602083610601936103c2955220016104be565b604051918291602083526020830190610586565b8280fd5b6040519061014082018281106001600160401b0382111761044757604052565b6040519060c082018281106001600160401b0382111761044757604052565b604051906101e082018281106001600160401b0382111761044757604052565b6040519061012082018281106001600160401b0382111761044757604052565b604051906105008261044c565b6001600160401b03811161044757601f01601f191660200190565b81601f820112156101f0578035906106d7826106a5565b926106e5604051948561049d565b828452602083830101116101f057816000926020809301838601378301015290565b60206003198201126101f057600435906001600160401b0382116101f0576105bc916004016106c0565b60208082528251828201528201516040808301919091528201516001600160a01b0316606082015260608201516080820152608082015160a082015260a082015160c082015260c08201516107946101e0918260e0850152610200840190610586565b926107e960e082015161010090818601528201516101209081860152820151610140908186015282015161016090818601528201516101809081860152820151946101a095601f198683030187870152610586565b93810151906101c09182850152015191015290565b346101f0576103c261081761081236610707565b611ff6565b60405191829182610731565b6001600160401b0381116104475760051b60200190565b81601f820112156101f05780359160209161085484610823565b93610862604051958661049d565b808552838086019160051b830101928084116101f057848301915b84831061088d5750505050505090565b82356001600160401b0381116101f05786916108ae848480948901016106c0565b81520192019161087d565b346101f05760403660031901126101f0576024356001600160401b0381116101f0576108f66108ee602092369060040161083a565b600435612173565b604051908152f35b60208082528251828201528201516001600160401b031660408201526040820151606082015261093e606083015160808301906001600160401b03169052565b60808201516001600160a01b031660a082015260a082015160c082015260c0820151610978610140918260e0850152610160840190610586565b9260e08101516101009081850152810151906101209182850152015191015290565b346101f05760203660031901126101f0576109b36121fd565b5060043560005260056020526103c2604060002060086109d1610619565b91805483526109fd6109ed60018301546001600160401b031690565b6001600160401b03166020850152565b6002810154604084015260038101546001600160401b0381166060850152610a329060401c6001600160a01b03166080850152565b600481015460a0840152610a48600582016104be565b60c0840152600681015460e084015260078101546101008401520154610120820152604051918291826108fe565b6001600160a01b038116036101f057565b359061050082610a76565b60403660031901126101f0576004803590610aac82610a76565b6024356001600160401b0381116101f057610aca90369083016106c0565b6001600160a01b037f00000000000000000000000079b3e839333a74137e78b0daf84fc12512a8c7048116308114908115610be0575b50610bcf579060208392610b1261330d565b6040516352d1902d60e01b8152938491829088165afa60009281610b9e575b50610b5f575050604051634c9c8ce360e01b81526001600160a01b0390921690820190815281906020010390fd5b83836000805160206149a48339815191528403610b8257610b808383613830565b005b604051632a87526960e21b815290810184815281906020010390fd5b610bc191935060203d602011610bc8575b610bb9818361049d565b8101906132fe565b9138610b31565b503d610baf565b60405163703e46dd60e11b81528390fd5b9050816000805160206149a48339815191525416141538610b00565b346101f05760003660031901126101f0577f00000000000000000000000079b3e839333a74137e78b0daf84fc12512a8c7046001600160a01b03163003610c555760206040516000805160206149a48339815191528152f35b60405163703e46dd60e11b8152600490fd5b969391610120989b9a999692610cba969294610140958a526001600160401b0380931660208b015260408a015216606088015260018060a01b0316608087015260a08601528060c0860152840190610586565b9560e08301526101008201520152565b346101f05760203660031901126101f0576004356000526005602052604060002080546103c26001600160401b0391826001850154169360028101549160038201546004830154610d1d600585016104be565b9160068501549360086007870154960154966040519a8b9a60018060a01b038560401c169416928b610c67565b346101f057600080600319360112610db557610d6461330d565b60008051602061498483398151915280546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346101f05760203660031901126101f05760043560005260076020526020604060002054604051908152f35b346101f057610e3b610df536610707565b610dfd6121fd565b50600254610e1b906001600160a01b03165b6001600160a01b031690565b906040518092633da575c960e21b825281806000968795600483016105ab565b03915afa8015610f07578280819082908390849285948698878099610ecf575b50506001600160401b038093610e6f610619565b9b8c52166001600160401b031660208b015260408a0152166001600160401b031660608801526001600160a01b0316608087015260a086015260c085015260e084015261010083015260ff166101208201526040516103c28192826108fe565b9850985050505050505050610ef692503d8091833e610eee818361049d565b81019061229d565b919791969095929492903880610e5b565b611fea565b60ff8116036101f057565b91908260409103126101f057604051610f2f8161042c565b9182908035906001600160f81b0319821682036101f057908252602001359063ffffffff19821682036101f05760200152565b81601f820112156101f0578035906020610f7b83610823565b93604090610f8c604051968761049d565b8486526020860191602060a0809702860101948286116101f057602001925b858410610fbc575050505050505090565b86848403126101f0578487918351610fd38161044c565b610fdd8688610f17565b8152610feb86868901610f17565b83820152608087013585820152815201930192610fab565b81601f820112156101f05780359160209161101d84610823565b9360409261102e604051968761049d565b818652848087019260051b840101938185116101f057858401925b85841061105a575050505050505090565b6001600160401b0384358181116101f057860191606080601f1985880301126101f0578451906110898261044c565b8a8501358252858501358b8301528401359283116101f0576110b2868b80969581960101610f62565b85820152815201930192611049565b9190916060818403126101f057604051906110db8261044c565b819381356001600160401b0381116101f057820181601f820112156101f057602091813561110881610823565b92611116604051948561049d565b818452848085019260051b8201019283116101f0578401905b82821061114e5750505083528082013590830152604090810135910152565b8135815290840190840161112f565b81601f820112156101f05780359160209161117784610823565b93611185604051958661049d565b808552838086019160051b830101928084116101f057848301915b8483106111b05750505050505090565b82356001600160401b0381116101f05786916111d1848480948901016110c1565b8152019201916111a0565b8082039291608084126101f057604051916111f68361044c565b6040839582358552601f1901126101f0576040516112138161042c565b602082013581526040820135602082015260208401526060810135916001600160401b0383116101f05760409261124a92016110c1565b910152565b346101f0576003196060368201126101f057602435600461126f82610f0c565b604435916001600160401b03938484116101f05760e09084360301126101f057611297610639565b91838101358581116101f0576112b29082369187010161083a565b835260248401358581116101f0576112cf90823691870101611003565b60208401526112e13660448601610f17565b604084015260848401358581116101f05761130190823691870101610f62565b606084015260a48401358581116101f0576113219082369187010161115d565b608084015260c48401359485116101f0576113476103b294826103c297369201016111dc565b60a08401523561283a565b346101f05760003660031901126101f0576000546040516001600160a01b039091168152602090f35b346101f05760003660031901126101f057600080516020614984833981519152546040516001600160a01b039091168152602090f35b9b9799959091949d9f9e9d61140a9460606101c09f9b978f906114369f9b976113f0916101e09884526020840152604083019060018060a01b03169052565b015260808d015260a08c01528060c08c01528a0190610586565b9560e0890152610100880152610120870152610140860152610160850152838203610180850152610586565b946101a08201520152565b346101f05760203660031901126101f057600435600052600460205260406000208054600182015490600283015461147e9060018060a01b031690565b92600381015490600481015460058201546006830161149c906104be565b60078401546008850154600986015491600a87015493600b88015495600c89016114c5906104be565b97600d8a015499600e01549a6040519e8f9e8f9e6103c29f6113b1565b346101f05760203660031901126101f0576004356114ff81610a76565b61150761330d565b600180546001600160a01b0319166001600160a01b0392909216919091179055005b346101f05760203660031901126101f05760043561154681610a76565b61154e61330d565b600280546001600160a01b0319166001600160a01b0392909216919091179055005b92919261157c82610823565b60409261158c604051928361049d565b819581835260208093019160061b8401938185116101f057915b8483106115b557505050505050565b85838303126101f05783869182516115cc8161042c565b8535815282860135838201528152019201916115a6565b346101f05760403660031901126101f0576001600160401b036004358181116101f05761161490369060040161083a565b906024359081116101f057366023820112156101f0576103c29161028f610601923690602481600401359101611570565b6040519061165282610482565b60008252565b346101f05760003660031901126101f0576103c26040516116788161042c565b60058152640352e302e360dc1b6020820152604051918291602083526020830190610586565b346101f05760203660031901126101f0576116b7611f08565b5060043560005260046020526103c26040600020600e6116d5610658565b825481526001830154602082015260028301546001600160a01b03166040820152916003810154606084015260048101546080840152600581015460a0840152611721600682016104be565b60c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b810154610160840152611768600c82016104be565b610180840152600d8101546101a084015201546101c082015260405191829182610731565b346101f0576117a361179e36610707565b612cd8565b6040518091602082526117c26020830182516001600160401b03169052565b602081015160408301526117e6604082015160608401906001600160401b03169052565b60608101516001600160a01b03166080830152608081015160a083015260a0810151611820610120918260c0860152610140850190610586565b9160c081015160e085015260e08101519061010091828601520151908301520390f35b346101f05760603660031901126101f05760043561186081610a76565b6024359061186d82610a76565b60443561187981610a76565b6000805160206149c483398151915254926001600160401b0360ff8560401c1615941680159081611984575b600114908161197a575b159081611971575b5061195f576000805160206149c4833981519152805467ffffffffffffffff191660011790556118eb928461193a57612ded565b6118f157005b6000805160206149c4833981519152805460ff60401b19169055604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b6000805160206149c4833981519152805460ff60401b1916600160401b179055612ded565b60405163f92ee8a960e01b8152600490fd5b905015386118b7565b303b1591506118af565b8591506118a5565b346101f05761028f6119c36108126119a3366101f5565b919490856000526003602052610287604060002061028281541515611bfd565b61010081015115611a5257611a2c6103c292611a1c6119e184612fd9565b93611a0360086119fb876000526004602052604060002090565b015415612e42565b611a17856000526004602052604060002090565b612e86565b6000526006602052604060002090565b54611a41826000526007602052604060002090565b556040519081529081906020820190565b60405162461bcd60e51b81526020600482015260126024820152710686561646572206e756d62657220697320360741b6044820152606490fd5b346101f05760003660031901126101f0576001546040516001600160a01b039091168152602090f35b346101f0576003196020368201126101f0576004356001600160401b03918282116101f0576101e09082360301126101f057611aef610658565b8160040135815260248201356020820152611b0c60448301610a87565b6040820152606482013560608201526084820135608082015260a482013560a082015260c48201358381116101f057611b4b90600436918501016106c0565b60c082015260e482013560e08201526101048201356101008201526101248201356101208201526101448201356101408201526101648201356101608201526101848201359283116101f0576101c46103b292611bb16103c295600436918401016106c0565b6101808401526101a48101356101a084015201356101c0820152612fd9565b346101f05760203660031901126101f057610b80600435611bf081610a76565b611bf861330d565b61328a565b15611c0457565b60405162461bcd60e51b815260206004820152600f60248201526e1cda185c99481b9bdd08199bdd5b99608a1b6044820152606490fd5b908154611c4781610823565b92611c55604051948561049d565b818452600090815260208082208186015b848410611c74575050505050565b6001838192611c82856104be565b815201920193019290611c66565b15611c9757565b60405162461bcd60e51b815260206004820152601a60248201527f7472616e73616374696f6e20616c7265616479206578697374730000000000006044820152606490fd5b818110611ce7575050565b60008155600101611cdc565b9190601f8111611d0257505050565b610500926000526020600020906020601f840160051c83019310611d2e575b601f0160051c0190611cdc565b9091508190611d21565b91909182516001600160401b03811161044757611d5f81611d5984546103dc565b84611cf3565b602080601f8311600114611da257508190611d93939495600092611d97575b50508160011b916000199060031b1c19161790565b9055565b015190503880611d7e565b90601f19831695611db885600052602060002090565b926000905b888210611df557505083600195969710611ddc575b505050811b019055565b015160001960f88460031b161c19169055388080611dd2565b80600185968294968601518155019501930190611dbd565b9061012060089180518455611e4e611e2f60208301516001600160401b031690565b60018601906001600160401b03166001600160401b0319825416179055565b60408101516002850155611ed160038501611e93611e7660608501516001600160401b031690565b825467ffffffffffffffff19166001600160401b03909116178255565b60808301516001600160a01b0316815468010000000000000000600160e01b03191660409190911b68010000000000000000600160e01b0316179055565b60a08101516004850155611eec60c082015160058601611d38565b60e0810151600685015561010081015160078501550151910155565b604051906101e082018281106001600160401b0382111761044757604052816101c06000918281528260208201528260408201528260608201528260808201528260a0820152606060c08201528260e0820152826101008201528261012082015282610140820152826101608201526060610180820152826101a08201520152565b9190826101809103126101f0578151916020810151916040820151611fae81610a76565b9160608101519160808201519160a08101519160c08201519160e081015191610100820151916101208101519161016061014083015192015190565b6040513d6000823e3d90fd5b611ffe611f08565b5060025461203990612018906001600160a01b0316610e0f565b916040518093631cec2f7f60e31b82528180610180958695600483016105ab565b03915afa908115610f075760009081938283908490859086908792889489968a988b9c612126575b506040519384602081016120a5906101009060008082528060208301528060408301528060608301528060808301528060a08301528060c083015260e08201520190565b03601f19810186526120b7908661049d565b6120bf611645565b9b6120c8610658565b908152602081019e909e526001600160a01b031660408e015260608d015260808c015260a08b015260c08a015260e089015261010088015261012087015261014086015261016085015283015260006101a08301526101c082015290565b9a5050505050505050505080935061215392503d841161216c575b61214b818361049d565b810190611f8a565b999b999a99989097919692959394939092909138612061565b503d612141565b90604051908160209160208201946060830190865260408084015281518091526080830193602060808360051b8601019301946000905b8382106121ce57505050506121c8925003601f19810183528261049d565b51902090565b91600191939550806121eb8196607f198b82030186528951610586565b970192019201869492959391956121aa565b6040519061014082018281106001600160401b0382111761044757604052816101206000918281528260208201528260408201528260608201528260808201528260a0820152606060c08201528260e0820152826101008201520152565b81601f820112156101f0578051612271816106a5565b9261227f604051948561049d565b818452602082840101116101f0576105bc9160208085019101610563565b9190610140838203126101f05782519260208101519260408201519260608301519260808101516122cd81610a76565b9260a08201519260c0830151906001600160401b0382116101f0576122f391840161225b565b9160e081015161230281610f0c565b9161012061010083015192015190565b51906001600160401b03821682036101f057565b90602080838303126101f05782516001600160401b03938482116101f057019060a0828403126101f05760409081519461235f86610467565b61236884612312565b8652612375828501612312565b8287015282840151838701526060936060810151606088015260808101519182116101f057019184601f840112156101f0578251906123b382610823565b956123c08251978861049d565b8287528360608189019402860101948186116101f0578401925b8584106123f05750505050505050608082015290565b86848303126101f0578251906124058261044c565b61240e85612312565b82528585015162ffffff811681036101f05786830152838501519061ffff821682036101f057828792868b9501528152019301926123da565b1561244e57565b60405162461bcd60e51b815260206004820152601060248201526f1c989b1bd8dac81b9bdd08199bdd5b9960821b6044820152606490fd5b8051156124935760200190565b6103c6565b8051600110156124935760400190565b8051600210156124935760600190565b8051600310156124935760800190565b8051600410156124935760a00190565b8051600510156124935760c00190565b8051600610156124935760e00190565b805160071015612493576101000190565b805160081015612493576101200190565b805160091015612493576101400190565b8051600a1015612493576101600190565b8051600b1015612493576101800190565b8051600c1015612493576101a00190565b8051600d1015612493576101c00190565b8051600e1015612493576101e00190565b80518210156124935760209160051b010190565b1561259b57565b60405162461bcd60e51b81526020600482015260166024820152750e4c4d8dec6d640d0cad2ced0e840dad2e6dac2e8c6d60531b6044820152606490fd5b156125e057565b60405162461bcd60e51b81526020600482015260136024820152721cda185c995cc81b9bdd081d995c9a599a5959606a1b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b9190916001600160401b038080941691160191821161264c57565b61261b565b908160081b91808304610100149015171561264c57565b908160011b918083046002149015171561264c57565b8181029291811591840414171561264c57565b906001820180921161264c57565b906037820180921161264c57565b600101908160011161264c57565b906080820180921161264c57565b9060c0820180921161264c57565b9190820180921161264c57565b156126eb57565b60405162461bcd60e51b815260206004820152603860248201527f70726f7669646564207368617265206d7573742062652077697468696e20746860448201527f652063656c657374696120706f696e7465722072616e676500000000000000006064820152608490fd5b815191600160401b83116104475781548383558084106127b4575b50612786602080920192600052602060002090565b6000925b848410612798575050505050565b600183826127a883945186611d38565b0192019301929061278a565b60008360005284602060002092830192015b8281106127d4575050612771565b806127e1600192546103dc565b806127ee575b50016127c6565b601f9081811184146128065750508281555b386127e7565b836128289261281a85600052602060002090565b920160051c82019101611cdc565b60008181526020812081835555612800565b600054909190612852906001600160a01b0316610e0f565b604051635bb4b8e760e11b81526004810184905290600090829060249082905afa908115610f07576000916129fa575b506001600160401b039081815161289f906001600160401b031690565b1615156128ab90612447565b6080018181519360ff1693846128c091612580565b51516001600160401b03169360a08701602095838783510151519116146128e690612594565b60015490518601518601516129059189906001600160a01b0316613366565b5061290f906125d9565b6080870190815161291f90612486565b51612929906134f9565b5090868186519061293991612580565b51015162ffffff1662ffffff1694519061295291612580565b51604001516129659061ffff1685612631565b958089015161297390612486565b5151925161298090612486565b51015161298c9161267e565b612995916126d7565b9116811015916129ad93836129ee575b5050506126e4565b6129d66129bb835183612173565b92516129d1846000526003602052604060002090565b612756565b6129ea826000526006602052604060002090565b5590565b161190503880806129a5565b612a1791503d806000833e612a0f818361049d565b810190612326565b38612882565b602003906020821161264c57565b60001981019190821161264c57565b9061010091820391821161264c57565b9190820391821161264c57565b60405190612a648261042c565b60208083523683820137565b60405190612a7d8261042c565b6001825260203681840137565b604051612a9681610482565b60008152906000368137565b90612aac826106a5565b612ab9604051918261049d565b8281528092612aca601f19916106a5565b0190602036910137565b15612adb57565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642072616e676560981b6044820152606490fd5b908151811015612493570160200190565b600019811461264c5760010190565b9091600090815b8451831015612b6f57612b67600191612b61612b538689612580565b516020810151905190612a4a565b906126d7565b920191612b37565b612b7b91949250612aa2565b926000936000935b8351851015612c1657612b968585612580565b51936020850194612bb58651612bac8986612580565b51511015612ad4565b51965b8551881015612c0757612bff600191612bec612bde8b612bd88c89612580565b51612b10565b516001600160f81b03191690565b60001a612bf98288612b10565b53612b21565b970196612bb8565b96506001909501949350612b83565b509350915050565b6040519061012082018281106001600160401b038211176104475760405281610100600091828152826020820152826040820152826060820152826080820152606060a08201528260c08201528260e08201520152565b610120818303126101f0578051926020820151926040830151926060810151612c9d81610a76565b9260808201519260a0830151906001600160401b0382116101f057612cc391840161225b565b9160c08101519161010060e083015192015190565b612d1a90612ce4612c1e565b50600254612cfa906001600160a01b0316610e0f565b9060405180926314cc59fb60e21b825281806000968795600483016105ab565b03915afa8015610f07578280819082839184938597868098612dab575b5050612d8e9291612d7e916001600160401b0391612d6883612d57610678565b9d168d906001600160401b03169052565b60208c0152166001600160401b031660408a0152565b6001600160a01b03166060880152565b608086015260a085015260c084015260e083015261010082015290565b9550955050505050612d8e9450612d7e9350612dd992503d8091833e612dd1818361049d565b810190612c75565b979950909790959194929392908290612d37565b91612df6613cca565b612dfe613cca565b612e073361328a565b60018060a01b038092816bffffffffffffffffffffffff60a01b95168560005416176000551683600154161760015516906002541617600255565b15612e4957565b60405162461bcd60e51b815260206004820152601560248201527468656164657220616c72656164792065786973747360581b6044820152606490fd5b815181556020820151600182015560408201516002820180546001600160a01b0319166001600160a01b0390921691909117905590600e906101c090606081015160038501556080810151600485015560a08101516005850155612ef160c082015160068601611d38565b60e0810151600785015561010081015160088501556101208101516009850155610140810151600a850155610160810151600b850155612f39610180820151600c8601611d38565b6101a0810151600d8501550151910155565b6040519061020082018281106001600160401b0382111761044757604052600f82528160005b6101e08110612f7e575050565b806060602080938501015201612f71565b90612f9982610823565b612fa6604051918261049d565b8281528092612fb7601f1991610823565b019060005b828110612fc857505050565b806060602080938501015201612fbc565b613282612fe4612f4b565b6132696101c084519461324e613242613025604080519061302a8261301160209d8e830160209181520190565b0392613025601f199485810183528261049d565b613517565b6130338a612486565b5261303d89612486565b506130688b8701516130258d61305c8551938492830160209181520190565b0385810183528261049d565b6130718a612498565b5261307b89612498565b5085810151613092906001600160a01b031661366a565b61309b8a6124a8565b526130a5896124a8565b506130c560608701516130258d61305c8551938492830160209181520190565b6130ce8a6124b8565b526130d8896124b8565b506130f860808701516130258d61305c8551938492830160209181520190565b6131018a6124c8565b5261310b896124c8565b5061312b60a08701516130258d61305c8551938492830160209181520190565b6131348a6124d8565b5261313e896124d8565b5061314c60c0870151613517565b6131558a6124e8565b5261315f896124e8565b5061316d60e0870151613689565b6131768a6124f8565b52613180896124f8565b5061318f610100870151613689565b6131988a612509565b526131a289612509565b506131b1610120870151613689565b6131ba8a61251a565b526131c48961251a565b506131d3610140870151613689565b6131dc8a61252b565b526131e68961252b565b506131f5610160870151613689565b6131fe8a61253c565b526132088961253c565b50613217610180870151613517565b6132208a61254d565b5261322a8961254d565b506101a086015190519384918c830160209181520190565b0390810183528261049d565b6132578561255e565b526132618461255e565b500151613689565b6132728261256f565b5261327c8161256f565b5061372e565b805191012090565b6001600160a01b039081169081156132e55760008051602061498483398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b908160209103126101f0575190565b600080516020614984833981519152546001600160a01b0316330361332e57565b60405163118cdaa760e01b8152336004820152602490fd5b600b111561335057565b634e487b7160e01b600052602160045260246000fd5b909291613385906060850192835160808701519060a088015192613960565b90156134d05750602080840191825151815151036134c357600094855b845180518810156133df57600191612b61866133c18b6133d795612580565b5101516133cf8b8a51612580565b515190612a4a565b9601956133a2565b50909550939193855151036134b657600092835b815180518610156134a6578661340c8761341a93612580565b5101516133cf878551612580565b9061343188518261342b85826126d7565b91613ac5565b61343a81613346565b80613496575061346a61346e91613452898851612580565b5161345e8a8851612580565b5160408d015191613bed565b1590565b6134865760019161347e916126d7565b9401936133f3565b5050505092505050600090600190565b9850505050505091505060009190565b5050505092505050600190600090565b5092505050600090600790565b5050509050600090600590565b92505060009190565b81156134e3570490565b634e487b7160e01b600052601260045260246000fd5b604001516003811661350e5760021c90600090565b50600090600890565b90600091805192600193600181149081613651575b501561353757509150565b815193603885101561357b5750926105bc9293613552612a70565b916001600160f81b031990613566906126bb565b60f81b16901a61357582612486565b53613d08565b8190806001915b613621575b505061359a61359582612691565b612aa2565b916001600160f81b03196135b56135b0846126bb565b61269f565b8160f89160f81b16831a6135c886612486565b5360015b848111156135e45750505050506105bc929350613d08565b808361360d6136076136016135fc61361c968b612a4a565b613cf9565b8d6134d9565b60ff1690565b841b16851a612bf98289612b10565b6135cc565b909161362d83886134d9565b1561364b5761363e61364491612b21565b92612651565b9080613582565b91613587565b905015612493576080602083015160f81c11153861352c565b6105bc9060405190600560a21b18601482015260348101604052613517565b90613692612a57565b60209260208201526000926000905b8082106136fd575b506136b661359582612a1d565b9160005b83518110156136ef576001906136dc612bde6136d586612b21565b9585612b10565b871a6136e88287612b10565b53016136ba565b5050506105bc919250613517565b9061371b61370e612bde8386612b10565b6001600160f81b03191690565b61372857600101906136a1565b906136a9565b61373790613d81565b90815160006038821060001461377a5750916105bc9192613756612a70565b906001600160f81b03199061376a906126c9565b60f81b1660001a61357582612486565b916001925b61378984846134d9565b156137a65761379a6137a091612b21565b93612651565b9261377f565b9092509290926137b861359582612691565b906001600160f81b03196137ce6135b0836126c9565b8160f89160f81b1660001a6137e285612486565b5360015b838111156137fd57505050506105bc929350613d08565b808361381b6136076138156135fc61382b968a612a4a565b8c6134d9565b841b1660001a612bf98288612b10565b6137e6565b90813b156138b6576000805160206149a483398151915280546001600160a01b0319166001600160a01b0384169081179091557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a280511561389b5761389891613e19565b50565b5050346138a457565b60405163b398979f60e01b8152600490fd5b604051634c9c8ce360e01b81526001600160a01b0383166004820152602490fd5b908160209103126101f0575180151581036101f05790565b919290825260208381945182850152015160408301526080606083015260e082019281519360606080850152845180915281610100850195019060005b81811061394c575050508160409160c093015160a0850152015191015290565b82518752958301959183019160010161392c565b92936139958551946020958691828901516040809a01519260405195869485938493631f3302a960e01b8552600485016138ef565b03916001600160a01b03165afa908115610f0757600091613a98575b5015613a8b578251825103613a7e5760005b8351811015613a7057613a5661346a6139e66139df8487612580565b5151613e5f565b613a456139ff896139f7878a612580565b510151613e5f565b91613a378b613a0e888b612580565b5101518c5162ffffff199384168d820190815293909516601d840152603a8301528391605a0190565b03601f19810183528261049d565b613a4f8488612580565b5185613ec8565b613a62576001016139c3565b505050505050600090600290565b505050505050600190600090565b5050505050600090600690565b5050505050600090600490565b613ab89150853d8711613abe575b613ab0818361049d565b8101906138d7565b386139b1565b503d613aa6565b9190818111613b4f578251808211908115613b45575b50613b3d5780820382811161264c57613af390612f8f565b92815b838110613b07575050505090600090565b613b118183612580565b51908381039181831161264c5782613b3691613b2f6001958a612580565b5287612580565b5001613af6565b505090600a90565b9050821138613adb565b505090600990565b60405190613b648261042c565b60006020838281520152565b60405190613b7d8261044c565b6000604083613b8a613b57565b8152613b94613b57565b60208201520152565b90613ba782610823565b613bb4604051918261049d565b8281528092613bc5601f1991610823565b019060005b828110613bd657505050565b602090613be1613b70565b82828501015201613bca565b92939193613bfb8151613b9d565b9260009260005b8351811015613cbb57613c158185612580565b5190613c1f613b70565b50613c2989613e5f565b9160409287613c7c8551613c716020958695858785015262ffffff1916602184015282603e91613c61815180928a8686019101610563565b810103601e81018452018261049d565b865191828092613f62565b039060025afa15610f075786516001938b613c95610698565b93818552840152820152613ca98289612580565b52613cb48188612580565b5001613c02565b5092509450506105bc92613f79565b60ff6000805160206149c48339815191525460401c1615613ce757565b604051631afcd79f60e31b8152600490fd5b601f811161264c576101000a90565b6040519181518084526020808501918501928184019282808701915b858110613d715750505080518093875182018852940193828086019201905b828110613d62575050505090603f91601f199351011501011660405290565b81518152908301908301613d43565b8251815291810191849101613d24565b805115613e105790600091825b8151841015613db757613daf600191613da78685612580565b5151906126d7565b930192613d8e565b613dc391929350612aa2565b906020808301936000945b8351861015613e0857613e00600191613df6613dea8988612580565b51868151910183614086565b613da78887612580565b950194613dce565b509350505090565b506105bc612a8a565b6000806105bc93602081519101845af43d15613e57573d91613e3a836106a5565b92613e48604051948561049d565b83523d6000602085013e6140ed565b6060916140ed565b80516020918201516040516001600160f81b031990921692820192835263ffffffff19166021820152601d8152613e958161042c565b51905162ffffff19918282169190601d8110613eb3575b5050905090565b83919250601d0360031b1b1616803880613eac565b6040820180519293919260018111613f435750835151613f3a575b6020840191825182511115613f3057613efb906141e8565b935191825115613f195790613f1593949151905190614246565b1490565b5051600114159050613f29571490565b5050600090565b5050505050600090565b50505050600090565b613f54855151916020870151614150565b14613ee35750505050600090565b90613f7560209282815194859201610563565b0190565b929091926000936040840192613f90845151613b9d565b926000965b8651808214158061407b575b15613feb5781613fb7613fdf92613fe5946143d1565b90613fc38b8a51612580565b51613fce8c8a612580565b52613fd98b89612580565b506126d7565b97612b21565b96613f95565b5050949250945061402760008061400d614008602087015161443b565b612668565b94600195869560018210614072575b83919299989961446c565b5050949094925b61403f575b5050506105bc916146b8565b8051805184101561406c5761406384959661405c85968694612580565b5190614579565b9594019261402e565b50614033565b6001915061401c565b508651518910613fa1565b92905b6020938484106140be578151815284810180911161264c5793810180911161264c5791601f19810190811161264c5791614089565b92909193506020036020811161264c576140da6140df91613cf9565b612a2b565b905182518216911916179052565b90614114575080511561410257805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580614147575b614125575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561411d565b909160005b60018481831b1015614170578101809111156141555761261b565b509291909261010090810390811161264c5761418b90612a3a565b91600161419784612a2b565b1b916141a283612a2b565b81116141ae5750505090565b91925090600183036141c257505050600190565b826141d36141df946141d993612a4a565b92612a4a565b90614150565b6105bc906126ad565b600061423360209260405161422260218287810194878652614212815180928b8686019101610563565b810103600181018452018261049d565b604051928392839251928391610563565b8101039060025afa15610f075760005190565b90918215614370576001831461431f578351156142da576142668361443b565b6142796142738651612a2b565b86614701565b928181106142b657816141d3614299969361429393612a4a565b90614246565b6142b0826142aa6105bc9451612a2b565b90612580565b516147c5565b6142c09450614246565b906142d36105bc92916142aa8151612a2b565b51906147c5565b60405162461bcd60e51b815260206004820181905260248201527f6578706563746564206174206c65617374206f6e6520696e6e657220686173686044820152606490fd5b929150505161432b5790565b60405162461bcd60e51b815260206004820152601760248201527f756e657870656374656420696e6e6572206861736865730000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152603360248201527f63616e6e6f742063616c6c20636f6d70757465526f6f744861736820776974686044820152722030206e756d626572206f66206c656176657360681b6064820152608490fd5b91829160005b83151580614430575b156143f8576143ee90612b21565b9260011c926143d7565b92509092810390811161264c5761440e90614811565b60001981019190821161264c5781600192821161442a57501b90565b90501b90565b5083600116156143e0565b600181106101f05761444c81614811565b600019810190811161264c576001901b9081146144665790565b60011c90565b93959492909261447a613b70565b5060016144878484612a4a565b146145345784518211801590614526575b61450a576144c5906144b26144ad8585612a4a565b61443b565b976144bd89866126d7565b85878961446c565b5091976144e096929591946144da91906126d7565b9161446c565b919490939290911515600114614501576144f991614579565b929190600090565b50929190600090565b93604091935061451e959692500151614851565b929391929091565b506020850151831015614498565b939495918086949294511115908161456b575b5061455a5750604061451e940151614851565b805161451e95509193919250614832565b905060208601511138614547565b90614582613b70565b50602060006146576145978551855190614867565b946145a0613b57565b506145b481516145ae61489b565b906148c9565b831461467e5761464b6145c561489b565b955b613a376145d48451613e5f565b9160406145e389870151613e5f565b950151906145f18151613e5f565b60406145ff8b840151613e5f565b920151926040519788968c88019491929360b59694600160f81b875262ffffff1980958180951660018a015216601e880152603b87015216605b85015216607883015260958201520190565b60405191828092613f62565b039060025afa15610f07576000519061466e610698565b9283526020830152604082015290565b61468b85516145ae61489b565b831461469e5761464b84820151956145c7565b61464b6146b28583015186880151906148ea565b956145c7565b906146c682518251906148c9565b91826146e6575b826146d757505090565b60409192508101519101511490565b91506146fb60208301516020830151906148c9565b916146cd565b9190825181116147685761471481610823565b90614722604051928361049d565b808252601f1961473182610823565b0136602084013760005b818110614749575090925050565b8061475660019287612580565b516147618286612580565b520161473b565b60405162461bcd60e51b815260206004820152602f60248201527f496e76616c69642072616e67653a205f626567696e206f72205f656e6420617260448201526e65206f7574206f6620626f756e647360881b6064820152608490fd5b604051916020830191600160f81b83526021840152604183015260418252608082018281106001600160401b038211176104475760209281614233600094826040528351928391610563565b806000915b61481e575090565b9061482890612b21565b9060011c80614816565b906148499291949394614843613b70565b50614919565b919392909190565b9061485f9291614843613b70565b919390929190565b90614870613b57565b5061487a82613e5f565b62ffffff198061488984613e5f565b1691161015614896575090565b905090565b6148a3613b57565b506040516148b08161042c565b6001600160f81b0319815263ffffffff19602082015290565b6148d56148e391613e5f565b9162ffffff19918291613e5f565b1691161490565b906148f3613b57565b506148fd82613e5f565b62ffffff198061490c84613e5f565b1691161115614896575090565b90809392614925613b70565b508251908115918215614978575b50811561496d575b5061495c5761494991612580565b516001830180931161264c579190600090565b5050614966613b70565b9190600190565b90508110153861493b565b83101591503861493356fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbcf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a2646970667358221220d6831083507b821c4cabb853fa315de5d021a82db1afa41d173c5deb338e331264736f6c63430008160033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.