Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Api3Market
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2024-05-27T14:43:24.175593Z
Constructor Arguments
0x000000000000000000000000bf660585efb7f31f68bb3375937b7c71376de6c80000000000000000000000008fd1efcb673d1438cb153783ace6b65b7eba1a60000000000000000000000000000000000000000000000000000000000000000a
Arg [0] (address) : 0xbf660585efb7f31f68bb3375937b7c71376de6c8
Arg [1] (address) : 0x8fd1efcb673d1438cb153783ace6b65b7eba1a60
Arg [2] (uint256) : 10
contracts/api3-server-v1/Api3Market.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "../access/HashRegistry.sol";
import "../utils/ExtendedSelfMulticall.sol";
import "./interfaces/IApi3Market.sol";
import "./AirseekerRegistry.sol";
import "../vendor/@openzeppelin/contracts@4.9.5/utils/math/SafeCast.sol";
import "../vendor/@openzeppelin/contracts@4.9.5/utils/cryptography/MerkleProof.sol";
import "./interfaces/IApi3ServerV1.sol";
import "./proxies/interfaces/IProxyFactory.sol";
/// @title The contract that API3 users interact with using the API3 Market
/// frontend to purchase data feed subscriptions
/// @notice API3 aims to streamline and protocolize its integration processes
/// through the API3 Market (https://market.api3.org), which is a data feed
/// subscription marketplace. The Api3Market contract is the on-chain portion
/// of this system.
/// Api3Market enables API3 to predetermine the decisions related to its data
/// feed services (such as the curation of data feed sources or subscription
/// prices) and publish them on-chain. This streamlines the intergation flow,
/// as it allows the users to initiate subscriptions immediately, without
/// requiring any two-way communication with API3. Furthermore, this removes
/// the need for API3 to have agents operating in the meatspace gathering order
/// details, quoting prices and reviewing payments, and allows all such
/// operations to be cryptographically secured with a multi-party scheme in an
/// end-to-end manner.
/// @dev The user is strongly recommended to use the API3 Market frontend while
/// interacting with this contract, mostly because doing so successfully
/// requires some amount of knowledge of other API3 contracts. Specifically,
/// Api3Market requires the data feed for which the subscription is being
/// purchased to be "readied", the correct Merkle proofs to be provided, and
/// enough payment to be made. The API3 Market frontend will fetch the
/// appropriate Merkle proofs, create a multicall transaction that will ready
/// the data feed before making the call to buy the subscription, and compute
/// the amount to be sent that will barely allow the subscription to be
/// purchased. For most users, building such a transaction themselves would be
/// impractical.
contract Api3Market is HashRegistry, ExtendedSelfMulticall, IApi3Market {
enum UpdateParametersComparisonResult {
EqualToQueued,
BetterThanQueued,
WorseThanQueued
}
// The update parameters for each subscription is kept in a hash map rather
// than in full form as an optimization. Refer to AirseekerRegistry for a
// similar scheme.
// The subscription queues are kept as linked lists, for which each
// subscription has a next subscription ID field.
struct Subscription {
bytes32 updateParametersHash;
uint32 endTimestamp;
uint224 dailyPrice;
bytes32 nextSubscriptionId;
}
/// @notice dAPI management Merkle root hash type
/// @dev "Hash type" is what HashRegistry uses to address hashes used for
/// different purposes
bytes32 public constant override DAPI_MANAGEMENT_MERKLE_ROOT_HASH_TYPE =
keccak256(abi.encodePacked("dAPI management Merkle root"));
/// @notice dAPI pricing Merkle root hash type
bytes32 public constant override DAPI_PRICING_MERKLE_ROOT_HASH_TYPE =
keccak256(abi.encodePacked("dAPI pricing Merkle root"));
/// @notice Signed API URL Merkle root hash type
bytes32 public constant override SIGNED_API_URL_MERKLE_ROOT_HASH_TYPE =
keccak256(abi.encodePacked("Signed API URL Merkle root"));
/// @notice Maximum dAPI update age. This contract cannot be used to set a
/// dAPI name to a data feed that has not been updated in the last
/// `MAXIMUM_DAPI_UPDATE_AGE`.
uint256 public constant override MAXIMUM_DAPI_UPDATE_AGE = 1 days;
/// @notice Api3ServerV1 contract address
address public immutable override api3ServerV1;
/// @notice ProxyFactory contract address
address public immutable override proxyFactory;
/// @notice AirseekerRegistry contract address
address public immutable override airseekerRegistry;
/// @notice Maximum subscription queue length for a dAPI
/// @dev Some functionality in this contract requires to iterate through
/// the entire subscription queue for a dAPI, and the queue length is
/// limited to prevent this process from being bloated. Considering that
/// each item in the subscription queue has unique update parameters, the
/// length of the subscription queue is also limited by the number of
/// unique update parameters offered in the dAPI pricing Merkle tree. For
/// reference, at the time this contract is implemented, the API3 Market
/// offers 4 update parameter options.
uint256 public immutable override maximumSubscriptionQueueLength;
/// @notice Subscriptions indexed by their IDs
mapping(bytes32 => Subscription) public override subscriptions;
/// @notice dAPI name to current subscription ID, which denotes the start
/// of the subscription queue for the dAPI
mapping(bytes32 => bytes32) public override dapiNameToCurrentSubscriptionId;
// Update parameters hash map
mapping(bytes32 => bytes) private updateParametersHashToValue;
// Length of abi.encode(address, bytes32)
uint256 private constant DATA_FEED_DETAILS_LENGTH_FOR_SINGLE_BEACON =
32 + 32;
// Length of abi.encode(uint256, int224, uint256)
uint256 private constant UPDATE_PARAMETERS_LENGTH = 32 + 32 + 32;
bytes32 private constant API3MARKET_SIGNATURE_DELEGATION_HASH_TYPE =
keccak256(abi.encodePacked("Api3Market signature delegation"));
/// @dev Api3Market deploys its own AirseekerRegistry deterministically.
/// This implies that Api3Market-specific Airseekers should be operated by
/// pointing at this contract.
/// The maximum subscription queue length should be large enough to not
/// obstruct subscription purchases under usual conditions, and small
/// enough to keep the queue at an iterable size. For example, if the
/// number of unique update parameters in the dAPI pricing Merkle trees
/// that are being used is around 5, a maximum subscription queue length of
/// 10 would be acceptable for a typical chain.
/// @param owner_ Owner address
/// @param proxyFactory_ ProxyFactory contract address
/// @param maximumSubscriptionQueueLength_ Maximum subscription queue
/// length
constructor(
address owner_,
address proxyFactory_,
uint256 maximumSubscriptionQueueLength_
) HashRegistry(owner_) {
require(
maximumSubscriptionQueueLength_ != 0,
"Maximum queue length zero"
);
proxyFactory = proxyFactory_;
address api3ServerV1_ = IProxyFactory(proxyFactory_).api3ServerV1();
api3ServerV1 = api3ServerV1_;
airseekerRegistry = address(
new AirseekerRegistry{salt: bytes32(0)}(
address(this),
api3ServerV1_
)
);
maximumSubscriptionQueueLength = maximumSubscriptionQueueLength_;
}
/// @notice Returns the owner address
/// @return Owner address
function owner()
public
view
override(HashRegistry, IOwnable)
returns (address)
{
return super.owner();
}
/// @notice Overriden to be disabled
function renounceOwnership() public pure override(HashRegistry, IOwnable) {
revert("Ownership cannot be renounced");
}
/// @notice Overriden to be disabled
function transferOwnership(
address
) public pure override(HashRegistry, IOwnable) {
revert("Ownership cannot be transferred");
}
/// @notice Buys subscription and updates the current subscription ID if
/// necessary. The user is recommended to interact with this contract over
/// the API3 Market frontend due to its complexity.
/// @dev The data feed that the dAPI name will be set to after this
/// function is called must be readied (see `validateDataFeedReadiness()`)
/// before calling this function.
/// Enough funds must be sent to put the sponsor wallet balance over its
/// expected amount after the subscription is bought. Since sponsor wallets
/// send data feed update transactions, it is not possible to determine
/// what their balance will be at the time sent transactions are confirmed.
/// To avoid transactions being reverted as a result of this, consider
/// sending some extra.
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param sponsorWallet Sponsor wallet address
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @param price Subscription price
/// @param dapiManagementAndDapiPricingMerkleData ABI-encoded dAPI
/// management and dAPI pricing Merkle roots and proofs
/// @return subscriptionId Subscription ID
function buySubscription(
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
) public payable override returns (bytes32 subscriptionId) {
require(dataFeedId != bytes32(0), "Data feed ID zero");
require(sponsorWallet != address(0), "Sponsor wallet address zero");
verifyDapiManagementAndDapiPricingMerkleProofs(
dapiName,
dataFeedId,
sponsorWallet,
updateParameters,
duration,
price,
dapiManagementAndDapiPricingMerkleData
);
subscriptionId = addSubscriptionToQueue(
dapiName,
dataFeedId,
updateParameters,
duration,
price
);
require(
sponsorWallet.balance + msg.value >=
computeExpectedSponsorWalletBalance(dapiName),
"Insufficient payment"
);
emit BoughtSubscription(
dapiName,
subscriptionId,
dataFeedId,
sponsorWallet,
updateParameters,
duration,
price,
msg.value
);
if (msg.value > 0) {
(bool success, ) = sponsorWallet.call{value: msg.value}("");
require(success, "Transfer unsuccessful");
}
}
/// @notice Called by the owner to cancel all subscriptions for a dAPI
/// that needs to be decommissioned urgently
/// @dev The root of a new dAPI pricing Merkle tree that excludes the dAPI
/// should be registered before canceling the subscriptions. Otherwise,
/// anyone can immediately buy the subscriptions again.
/// @param dapiName dAPI name
function cancelSubscriptions(bytes32 dapiName) external override onlyOwner {
require(
dapiNameToCurrentSubscriptionId[dapiName] != bytes32(0),
"Subscription queue empty"
);
dapiNameToCurrentSubscriptionId[dapiName] = bytes32(0);
AirseekerRegistry(airseekerRegistry).setDapiNameToBeDeactivated(
dapiName
);
emit CanceledSubscriptions(dapiName);
}
/// @notice If the current subscription has ended, updates it with the one
/// that will end next
/// @dev The fact that there is a current subscription that has ended would
/// mean that API3 is providing a service that was not paid for. Therefore,
/// API3 should poll this function for all active dAPI names and call it
/// whenever it is not going to revert to downgrade the specs.
/// @param dapiName dAPI name
function updateCurrentSubscriptionId(bytes32 dapiName) public override {
bytes32 currentSubscriptionId = dapiNameToCurrentSubscriptionId[
dapiName
];
require(
currentSubscriptionId != bytes32(0),
"Subscription queue empty"
);
require(
subscriptions[currentSubscriptionId].endTimestamp <=
block.timestamp,
"Current subscription not ended"
);
updateEndedCurrentSubscriptionId(dapiName, currentSubscriptionId);
}
/// @notice Updates the dAPI name to match the respective Merkle leaf
/// @dev Buying a dAPI subscription always updates the dAPI name if
/// necessary. However, API3 may also publish new Merkle roots between
/// subscription purchases, in which case API3 should call this function to
/// bring the chain state up to date. Therefore, API3 should poll this
/// function for all active dAPI names and call it whenever it will not
/// revert.
/// Similar to `buySubscription()`, this function requires the data feed
/// that the dAPI will be pointed to to be readied.
/// This function is allowed to be called even when the respective dAPI is
/// not active, which means that a dAPI name being set does not imply that
/// the respective data feed is in service. Users should only use dAPIs for
/// which there is an active subscription with update parameters that
/// satisfy their needs.
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param sponsorWallet Sponsor wallet address
/// @param dapiManagementMerkleData ABI-encoded dAPI management Merkle root
/// and proof
function updateDapiName(
bytes32 dapiName,
bytes32 dataFeedId,
address sponsorWallet,
bytes calldata dapiManagementMerkleData
) external override {
if (dataFeedId != bytes32(0)) {
require(sponsorWallet != address(0), "Sponsor wallet address zero");
} else {
require(
sponsorWallet == address(0),
"Sponsor wallet address not zero"
);
}
verifyDapiManagementMerkleProof(
dapiName,
dataFeedId,
sponsorWallet,
dapiManagementMerkleData
);
bytes32 currentDataFeedId = IApi3ServerV1(api3ServerV1)
.dapiNameHashToDataFeedId(keccak256(abi.encodePacked(dapiName)));
require(currentDataFeedId != dataFeedId, "Does not update dAPI name");
if (dataFeedId != bytes32(0)) {
validateDataFeedReadiness(dataFeedId);
}
IApi3ServerV1(api3ServerV1).setDapiName(dapiName, dataFeedId);
}
/// @notice Updates the signed API URL of the Airnode to match the
/// respective Merkle leaf
/// @dev Unlike the dAPI management and pricing Merkle leaves, the signed
/// API URL Merkle leaves are not registered by the users as a part of
/// subscription purchase transactions. API3 should poll this function for
/// all Airnodes that are used in active dAPIs and call it whenever it will
/// not revert.
/// @param airnode Airnode address
/// @param signedApiUrl Signed API URL
/// @param signedApiUrlMerkleData ABI-encoded signed API URL Merkle root
/// and proof
function updateSignedApiUrl(
address airnode,
string calldata signedApiUrl,
bytes calldata signedApiUrlMerkleData
) external override {
verifySignedApiUrlMerkleProof(
airnode,
signedApiUrl,
signedApiUrlMerkleData
);
require(
keccak256(abi.encodePacked(signedApiUrl)) !=
keccak256(
abi.encodePacked(
AirseekerRegistry(airseekerRegistry)
.airnodeToSignedApiUrl(airnode)
)
),
"Does not update signed API URL"
);
AirseekerRegistry(airseekerRegistry).setSignedApiUrl(
airnode,
signedApiUrl
);
}
/// @notice Multi-calls this contract, followed by a call with value to buy
/// the subscription
/// @dev This function is for the API3 Market frontend to call
/// `eth_estimateGas` on a single transaction that readies a data feed and
/// buys the respective subscription
/// @param multicallData Array of calldata of batched calls
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param sponsorWallet Sponsor wallet address
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @param price Subscription price
/// @param dapiManagementAndDapiPricingMerkleData ABI-encoded dAPI
/// management and dAPI pricing Merkle roots and proofs
/// @return returndata Array of returndata of batched calls
/// @return subscriptionId Subscription ID
function multicallAndBuySubscription(
bytes[] calldata multicallData,
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
)
external
payable
override
returns (bytes[] memory returndata, bytes32 subscriptionId)
{
returndata = this.multicall(multicallData);
subscriptionId = buySubscription(
dapiName,
dataFeedId,
sponsorWallet,
updateParameters,
duration,
price,
dapiManagementAndDapiPricingMerkleData
);
}
/// @notice Multi-calls this contract in a way that the transaction does
/// not revert if any of the batched calls reverts, followed by a call with
/// value to buy the subscription
/// @dev This function is for the API3 Market frontend to send a single
/// transaction that readies a data feed and buys the respective
/// subscription. `tryMulticall()` is preferred in the purchase transaction
/// because the readying calls may revert due to race conditions.
/// @param tryMulticallData Array of calldata of batched calls
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param sponsorWallet Sponsor wallet address
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @param price Subscription price
/// @param dapiManagementAndDapiPricingMerkleData ABI-encoded dAPI
/// management and dAPI pricing Merkle roots and proofs
/// @return successes Array of success conditions of batched calls
/// @return returndata Array of returndata of batched calls
/// @return subscriptionId Subscription ID
function tryMulticallAndBuySubscription(
bytes[] calldata tryMulticallData,
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
)
external
payable
override
returns (
bool[] memory successes,
bytes[] memory returndata,
bytes32 subscriptionId
)
{
(successes, returndata) = this.tryMulticall(tryMulticallData);
subscriptionId = buySubscription(
dapiName,
dataFeedId,
sponsorWallet,
updateParameters,
duration,
price,
dapiManagementAndDapiPricingMerkleData
);
}
/// @notice Calls Api3ServerV1 to update the Beacon using data signed by
/// the Airnode
/// @dev The user is intended to make a multicall transaction through the
/// API3 Market frontend to satisfy the required conditions to be able to
/// buy a subscription and buy the subscription in a single transaction.
/// The functions to which external calls must be made to to satisfy said
/// conditions (such as this one) are added to this contract so that they
/// can be multi-called by the user.
/// @param airnode Airnode address
/// @param templateId Template ID
/// @param timestamp Signature timestamp
/// @param data Update data (an `int256` encoded in contract ABI)
/// @param signature Template ID, timestamp and the update data signed by
/// the Airnode
/// @return beaconId Updated Beacon ID
function updateBeaconWithSignedData(
address airnode,
bytes32 templateId,
uint256 timestamp,
bytes calldata data,
bytes calldata signature
) external override returns (bytes32 beaconId) {
return
IApi3ServerV1(api3ServerV1).updateBeaconWithSignedData(
airnode,
templateId,
timestamp,
data,
signature
);
}
/// @notice Calls Api3ServerV1 to update the Beacon set using the current
/// values of its Beacons
/// @param beaconIds Beacon IDs
/// @return beaconSetId Updated Beacon set ID
function updateBeaconSetWithBeacons(
bytes32[] calldata beaconIds
) external override returns (bytes32 beaconSetId) {
return
IApi3ServerV1(api3ServerV1).updateBeaconSetWithBeacons(beaconIds);
}
/// @notice Calls ProxyFactory to deterministically deploy the dAPI proxy
/// @dev It is recommended for the users to read data feeds through proxies
/// deployed by ProxyFactory, rather than calling Api3ServerV1 directly.
/// Even though proxy deployment is not a condition for purchasing
/// subscriptions, the interface is implemented here to allow the user to
/// purchase a dAPI subscription and deploy the respective proxy in the
/// same transaction with a multicall.
/// @param dapiName dAPI name
/// @param metadata Metadata associated with the proxy
/// @return proxyAddress Proxy address
function deployDapiProxy(
bytes32 dapiName,
bytes calldata metadata
) external override returns (address proxyAddress) {
proxyAddress = IProxyFactory(proxyFactory).deployDapiProxy(
dapiName,
metadata
);
}
/// @notice Calls ProxyFactory to deterministically deploy the dAPI proxy
/// with OEV support
/// @param dapiName dAPI name
/// @param oevBeneficiary OEV beneficiary
/// @param metadata Metadata associated with the proxy
/// @return proxyAddress Proxy address
function deployDapiProxyWithOev(
bytes32 dapiName,
address oevBeneficiary,
bytes calldata metadata
) external override returns (address proxyAddress) {
proxyAddress = IProxyFactory(proxyFactory).deployDapiProxyWithOev(
dapiName,
oevBeneficiary,
metadata
);
}
/// @notice Calls AirseekerRegistry to register the data feed
/// @param dataFeedDetails Data feed details
/// @return dataFeedId Data feed ID
function registerDataFeed(
bytes calldata dataFeedDetails
) external override returns (bytes32 dataFeedId) {
dataFeedId = AirseekerRegistry(airseekerRegistry).registerDataFeed(
dataFeedDetails
);
}
/// @notice Computes the expected sponsor wallet balance based on the
/// current subscription queue
/// @dev API3 estimates the transaction fee cost of subscriptions, and
/// prices them accordingly. The subscription fees paid for a dAPI are sent
/// to the respective sponsor wallet, which will send the update
/// transactions. In the case that a subscription is overpriced, the extra
/// funds are automatically rolled over as a discount to the next
/// subscription bought for the same dAPI. In the case that a subscription
/// is underpriced, there is a risk of the sponsor wallet running out of
/// funds, resulting in the subscription specs to not be met. To avoid
/// this, API3 should poll this function for all active dAPI names, check
/// the respective sponsor wallet balances, and top up the sponsor wallets
/// as necessary. The conditions that result in the underpricing will most
/// likely require an updated dAPI pricing Merkle root to be published.
/// @param dapiName dAPI name
/// @return expectedSponsorWalletBalance Expected sponsor wallet balance
function computeExpectedSponsorWalletBalance(
bytes32 dapiName
) public view override returns (uint256 expectedSponsorWalletBalance) {
uint32 startTimestamp = SafeCast.toUint32(block.timestamp);
Subscription storage queuedSubscription;
for (
bytes32 queuedSubscriptionId = dapiNameToCurrentSubscriptionId[
dapiName
];
queuedSubscriptionId != bytes32(0);
queuedSubscriptionId = queuedSubscription.nextSubscriptionId
) {
queuedSubscription = subscriptions[queuedSubscriptionId];
uint32 endTimestamp = queuedSubscription.endTimestamp;
if (endTimestamp > block.timestamp) {
expectedSponsorWalletBalance +=
((endTimestamp - startTimestamp) *
queuedSubscription.dailyPrice) /
1 days;
startTimestamp = endTimestamp;
}
}
}
/// @notice Computes the expected sponsor wallet balance after the
/// respective subscription is added to the queue
/// @dev This function is intended to be used by the API3 Market frontend
/// to calculate how much the user should pay to purchase a specific
/// subscription. As mentioned in the `buySubscription()` docstring, the
/// user should aim for the sponsor wallet balance to be slightly more than
/// the required amount in case it sends a transaction in the meantime,
/// whose gas cost may decrease the sponsor wallet balance unexpectedly.
/// Unit prices of the queued subscriptions are recorded on a daily basis
/// and the expected balance is computed from these, which introduces a
/// rounding error in the order of Weis. This also applies in practice (in
/// that one can buy a subscription whose price is 1 ETH at 0.999... ETH).
/// This behavior is accepted due to its effect being negligible.
/// @param dapiName dAPI name
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @param price Subscription price
/// @return expectedSponsorWalletBalance Expected sponsor wallet balance
function computeExpectedSponsorWalletBalanceAfterSubscriptionIsAdded(
bytes32 dapiName,
bytes calldata updateParameters,
uint256 duration,
uint256 price
) external view override returns (uint256 expectedSponsorWalletBalance) {
require(
updateParameters.length == UPDATE_PARAMETERS_LENGTH,
"Update parameters length invalid"
);
(
bytes32 subscriptionId,
uint32 endTimestamp,
bytes32 previousSubscriptionId,
bytes32 nextSubscriptionId
) = prospectSubscriptionPositionInQueue(
dapiName,
updateParameters,
duration
);
uint256 dailyPrice = (price * 1 days) / duration;
uint32 startTimestamp = SafeCast.toUint32(block.timestamp);
bytes32 queuedSubscriptionId = previousSubscriptionId == bytes32(0)
? subscriptionId
: dapiNameToCurrentSubscriptionId[dapiName];
for (; queuedSubscriptionId != bytes32(0); ) {
if (queuedSubscriptionId == subscriptionId) {
expectedSponsorWalletBalance +=
((endTimestamp - startTimestamp) * dailyPrice) /
1 days;
startTimestamp = endTimestamp;
queuedSubscriptionId = nextSubscriptionId;
} else {
Subscription storage queuedSubscription = subscriptions[
queuedSubscriptionId
];
uint32 queuedSubscriptionEndTimestamp = queuedSubscription
.endTimestamp;
if (queuedSubscriptionEndTimestamp > block.timestamp) {
expectedSponsorWalletBalance +=
((queuedSubscriptionEndTimestamp - startTimestamp) *
queuedSubscription.dailyPrice) /
1 days;
startTimestamp = queuedSubscriptionEndTimestamp;
}
if (previousSubscriptionId == queuedSubscriptionId) {
queuedSubscriptionId = subscriptionId;
} else {
queuedSubscriptionId = queuedSubscription
.nextSubscriptionId;
}
}
}
}
/// @notice Gets all data about the dAPI that is available
/// @dev This function is intended to be used by the API3 Market frontend
/// to get all data related to a specific dAPI. It returns the entire
/// subscription queue, including the items whose end timestamps are in the
/// past.
/// @param dapiName dAPI name
/// @return dataFeedDetails Data feed details
/// @return dapiValue dAPI value read from Api3ServerV1
/// @return dapiTimestamp dAPI timestamp read from Api3ServerV1
/// @return beaconValues Beacon values read from Api3ServerV1
/// @return beaconTimestamps Beacon timestamps read from Api3ServerV1
/// @return updateParameters Update parameters of the subscriptions in the
/// queue
/// @return endTimestamps End timestamps of the subscriptions in the queue
/// @return dailyPrices Daily prices of the subscriptions in the queue
function getDapiData(
bytes32 dapiName
)
external
view
override
returns (
bytes memory dataFeedDetails,
int224 dapiValue,
uint32 dapiTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps,
bytes[] memory updateParameters,
uint32[] memory endTimestamps,
uint224[] memory dailyPrices
)
{
bytes32 currentDataFeedId = IApi3ServerV1(api3ServerV1)
.dapiNameHashToDataFeedId(keccak256(abi.encodePacked(dapiName)));
(
dataFeedDetails,
dapiValue,
dapiTimestamp,
beaconValues,
beaconTimestamps
) = getDataFeedData(currentDataFeedId);
uint256 queueLength = 0;
for (
bytes32 queuedSubscriptionId = dapiNameToCurrentSubscriptionId[
dapiName
];
queuedSubscriptionId != bytes32(0);
queuedSubscriptionId = subscriptions[queuedSubscriptionId]
.nextSubscriptionId
) {
queueLength++;
}
updateParameters = new bytes[](queueLength);
endTimestamps = new uint32[](queueLength);
dailyPrices = new uint224[](queueLength);
Subscription storage queuedSubscription = subscriptions[
dapiNameToCurrentSubscriptionId[dapiName]
];
for (uint256 ind = 0; ind < queueLength; ind++) {
updateParameters[ind] = updateParametersHashToValue[
queuedSubscription.updateParametersHash
];
endTimestamps[ind] = queuedSubscription.endTimestamp;
dailyPrices[ind] = queuedSubscription.dailyPrice;
queuedSubscription = subscriptions[
queuedSubscription.nextSubscriptionId
];
}
}
/// @notice Gets all data about the data feed that is available
/// @dev This function is intended to be used by the API3 Market frontend
/// to determine what needs to be done to ready the data feed to purchase
/// the respective subscription.
/// In the case that the client wants to use this to fetch the respective
/// Beacon readings for an unregistered data feed, they can do a static
/// multicall where the `getDataFeedData()` call is preceded by a
/// `registerDataFeed()` call.
/// @param dataFeedId Data feed ID
/// @return dataFeedDetails Data feed details
/// @return dataFeedValue Data feed value read from Api3ServerV1
/// @return dataFeedTimestamp Data feed timestamp read from Api3ServerV1
/// @return beaconValues Beacon values read from Api3ServerV1
/// @return beaconTimestamps Beacon timestamps read from Api3ServerV1
function getDataFeedData(
bytes32 dataFeedId
)
public
view
returns (
bytes memory dataFeedDetails,
int224 dataFeedValue,
uint32 dataFeedTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps
)
{
dataFeedDetails = AirseekerRegistry(airseekerRegistry)
.dataFeedIdToDetails(dataFeedId);
(dataFeedValue, dataFeedTimestamp) = IApi3ServerV1(api3ServerV1)
.dataFeeds(dataFeedId);
if (
dataFeedDetails.length == DATA_FEED_DETAILS_LENGTH_FOR_SINGLE_BEACON
) {
beaconValues = new int224[](1);
beaconTimestamps = new uint32[](1);
(address airnode, bytes32 templateId) = abi.decode(
dataFeedDetails,
(address, bytes32)
);
(beaconValues[0], beaconTimestamps[0]) = IApi3ServerV1(api3ServerV1)
.dataFeeds(deriveBeaconId(airnode, templateId));
} else if (dataFeedDetails.length != 0) {
(address[] memory airnodes, bytes32[] memory templateIds) = abi
.decode(dataFeedDetails, (address[], bytes32[]));
uint256 beaconCount = airnodes.length;
beaconValues = new int224[](beaconCount);
beaconTimestamps = new uint32[](beaconCount);
for (uint256 ind = 0; ind < beaconCount; ind++) {
(beaconValues[ind], beaconTimestamps[ind]) = IApi3ServerV1(
api3ServerV1
).dataFeeds(deriveBeaconId(airnodes[ind], templateIds[ind]));
}
}
}
/// @notice Subscription ID to update parameters
/// @param subscriptionId Subscription ID
/// @return updateParameters Update parameters
function subscriptionIdToUpdateParameters(
bytes32 subscriptionId
) public view override returns (bytes memory updateParameters) {
updateParameters = updateParametersHashToValue[
subscriptions[subscriptionId].updateParametersHash
];
}
/// @notice Returns the signature delegation hash type used in delegation
/// signatures
/// @return Signature delegation hash type
function signatureDelegationHashType()
public
view
virtual
override(HashRegistry, IHashRegistry)
returns (bytes32)
{
return API3MARKET_SIGNATURE_DELEGATION_HASH_TYPE;
}
/// @notice Adds the subscription to the queue if applicable
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @param price Subscription price
function addSubscriptionToQueue(
bytes32 dapiName,
bytes32 dataFeedId,
bytes calldata updateParameters,
uint256 duration,
uint256 price
) internal returns (bytes32 subscriptionId) {
uint32 endTimestamp;
bytes32 previousSubscriptionId;
bytes32 nextSubscriptionId;
(
subscriptionId,
endTimestamp,
previousSubscriptionId,
nextSubscriptionId
) = prospectSubscriptionPositionInQueue(
dapiName,
updateParameters,
duration
);
bytes32 updateParametersHash = keccak256(updateParameters);
if (updateParametersHashToValue[updateParametersHash].length == 0) {
updateParametersHashToValue[
updateParametersHash
] = updateParameters;
}
subscriptions[subscriptionId] = Subscription({
updateParametersHash: updateParametersHash,
endTimestamp: endTimestamp,
dailyPrice: SafeCast.toUint224((price * 1 days) / duration),
nextSubscriptionId: nextSubscriptionId
});
if (previousSubscriptionId == bytes32(0)) {
if (subscriptionId != dapiNameToCurrentSubscriptionId[dapiName]) {
emit UpdatedCurrentSubscriptionId(dapiName, subscriptionId);
dapiNameToCurrentSubscriptionId[dapiName] = subscriptionId;
}
AirseekerRegistry(airseekerRegistry).setDapiNameUpdateParameters(
dapiName,
updateParameters
);
AirseekerRegistry(airseekerRegistry).setDapiNameToBeActivated(
dapiName
);
} else {
subscriptions[previousSubscriptionId]
.nextSubscriptionId = subscriptionId;
bytes32 currentSubscriptionId = dapiNameToCurrentSubscriptionId[
dapiName
];
if (
subscriptions[currentSubscriptionId].endTimestamp <=
block.timestamp
) {
updateEndedCurrentSubscriptionId(
dapiName,
currentSubscriptionId
);
}
}
validateDataFeedReadiness(dataFeedId);
if (
IApi3ServerV1(api3ServerV1).dapiNameHashToDataFeedId(
keccak256(abi.encodePacked(dapiName))
) != dataFeedId
) {
IApi3ServerV1(api3ServerV1).setDapiName(dapiName, dataFeedId);
}
}
/// @notice Updates the current subscription that has ended with the one
/// that will end next
/// @param dapiName dAPI name
/// @param currentSubscriptionId Current subscription ID
function updateEndedCurrentSubscriptionId(
bytes32 dapiName,
bytes32 currentSubscriptionId
) private {
do {
currentSubscriptionId = subscriptions[currentSubscriptionId]
.nextSubscriptionId;
} while (
currentSubscriptionId != bytes32(0) &&
subscriptions[currentSubscriptionId].endTimestamp <=
block.timestamp
);
emit UpdatedCurrentSubscriptionId(dapiName, currentSubscriptionId);
dapiNameToCurrentSubscriptionId[dapiName] = currentSubscriptionId;
if (currentSubscriptionId == bytes32(0)) {
AirseekerRegistry(airseekerRegistry).setDapiNameToBeDeactivated(
dapiName
);
} else {
AirseekerRegistry(airseekerRegistry).setDapiNameUpdateParameters(
dapiName,
subscriptionIdToUpdateParameters(currentSubscriptionId)
);
}
}
/// @notice Prospects the subscription position in the queue. It iterates
/// through the entire subscription queue, which is implemented as a linked
/// list, and returns the previous and next nodes of the subscription to be
/// added.
/// It reverts if no suitable position can be found, which would be because
/// the addition of the subscription to the queue does not upgrade its
/// specs unambiguously or addition of it results in the maximum queue
/// length to be exceeded.
/// @param dapiName dAPI name
/// @param updateParameters Update parameters
/// @param duration Subscription duration
/// @return subscriptionId Subscription ID
/// @return endTimestamp End timestamp
/// @return previousSubscriptionId Previous subscription ID
/// @return nextSubscriptionId Next subscription ID
function prospectSubscriptionPositionInQueue(
bytes32 dapiName,
bytes calldata updateParameters,
uint256 duration
)
private
view
returns (
bytes32 subscriptionId,
uint32 endTimestamp,
bytes32 previousSubscriptionId,
bytes32 nextSubscriptionId
)
{
subscriptionId = keccak256(
abi.encodePacked(dapiName, keccak256(updateParameters))
);
endTimestamp = SafeCast.toUint32(block.timestamp + duration);
(
uint256 deviationThresholdInPercentage,
int224 deviationReference,
uint256 heartbeatInterval
) = abi.decode(updateParameters, (uint256, int224, uint256));
uint256 newQueueLength = 0;
Subscription storage queuedSubscription;
for (
bytes32 queuedSubscriptionId = dapiNameToCurrentSubscriptionId[
dapiName
];
queuedSubscriptionId != bytes32(0);
queuedSubscriptionId = queuedSubscription.nextSubscriptionId
) {
queuedSubscription = subscriptions[queuedSubscriptionId];
UpdateParametersComparisonResult updateParametersComparisonResult = compareUpdateParametersWithQueued(
deviationThresholdInPercentage,
deviationReference,
heartbeatInterval,
queuedSubscription.updateParametersHash
);
uint32 queuedSubscriptionEndTimestamp = queuedSubscription
.endTimestamp;
require(
updateParametersComparisonResult ==
UpdateParametersComparisonResult.BetterThanQueued ||
endTimestamp > queuedSubscriptionEndTimestamp,
"Subscription does not upgrade"
);
if (
updateParametersComparisonResult ==
UpdateParametersComparisonResult.WorseThanQueued &&
queuedSubscriptionEndTimestamp > block.timestamp
) {
previousSubscriptionId = queuedSubscriptionId;
newQueueLength++;
}
if (
updateParametersComparisonResult ==
UpdateParametersComparisonResult.BetterThanQueued &&
endTimestamp < queuedSubscriptionEndTimestamp
) {
nextSubscriptionId = queuedSubscriptionId;
for (
;
queuedSubscriptionId != bytes32(0);
queuedSubscriptionId = subscriptions[queuedSubscriptionId]
.nextSubscriptionId
) {
newQueueLength++;
}
break;
}
}
require(
newQueueLength < maximumSubscriptionQueueLength,
"Subscription queue full"
);
}
/// @notice Compares the update parameters with the ones that belong to a
/// queued subscription
/// @param deviationThresholdInPercentage Deviation threshold in percentage
/// @param deviationReference Deviation reference
/// @param heartbeatInterval Heartbeat interval
/// @param queuedUpdateParametersHash Queued update parameters hash
/// @return Update parameters comparison result
function compareUpdateParametersWithQueued(
uint256 deviationThresholdInPercentage,
int224 deviationReference,
uint256 heartbeatInterval,
bytes32 queuedUpdateParametersHash
) private view returns (UpdateParametersComparisonResult) {
// The update parameters that belong to a queued subscription are
// guaranteed to have been stored in the hash map
(
uint256 queuedDeviationThresholdInPercentage,
int224 queuedDeviationReference,
uint256 queuedHeartbeatInterval
) = abi.decode(
updateParametersHashToValue[queuedUpdateParametersHash],
(uint256, int224, uint256)
);
require(
deviationReference == queuedDeviationReference,
"Deviation references not equal"
);
if (
(deviationThresholdInPercentage ==
queuedDeviationThresholdInPercentage) &&
(heartbeatInterval == queuedHeartbeatInterval)
) {
return UpdateParametersComparisonResult.EqualToQueued;
} else if (
(deviationThresholdInPercentage <=
queuedDeviationThresholdInPercentage) &&
(heartbeatInterval <= queuedHeartbeatInterval)
) {
return UpdateParametersComparisonResult.BetterThanQueued;
} else if (
(deviationThresholdInPercentage >=
queuedDeviationThresholdInPercentage) &&
(heartbeatInterval >= queuedHeartbeatInterval)
) {
return UpdateParametersComparisonResult.WorseThanQueued;
} else {
// This is hit when the set of parameters are superior to each
// other in different aspects, in which case they should not be
// allowed to be in the same queue
revert("Update parameters incomparable");
}
}
/// @notice Validates the readiness of the data feed. The data feed must
/// have been updated on Api3ServerV1 in the last `MAXIMUM_DAPI_UPDATE_AGE`
/// and registered on AirseekerRegistry.
/// @param dataFeedId Data feed ID
function validateDataFeedReadiness(bytes32 dataFeedId) private view {
(, uint32 timestamp) = IApi3ServerV1(api3ServerV1).dataFeeds(
dataFeedId
);
require(
block.timestamp <= timestamp + MAXIMUM_DAPI_UPDATE_AGE,
"Data feed value stale"
);
require(
AirseekerRegistry(airseekerRegistry).dataFeedIsRegistered(
dataFeedId
),
"Data feed not registered"
);
}
/// @notice Verifies the dAPI management Merkle proof
/// @param dapiName dAPI name
/// @param dataFeedId Data feed ID
/// @param sponsorWallet Sponsor wallet address
/// @param dapiManagementMerkleData ABI-encoded dAPI management Merkle root
/// and proof
function verifyDapiManagementMerkleProof(
bytes32 dapiName,
bytes32 dataFeedId,
address sponsorWallet,
bytes calldata dapiManagementMerkleData
) private view {
require(dapiName != bytes32(0), "dAPI name zero");
(
bytes32 dapiManagementMerkleRoot,
bytes32[] memory dapiManagementMerkleProof
) = abi.decode(dapiManagementMerkleData, (bytes32, bytes32[]));
require(
hashes[DAPI_MANAGEMENT_MERKLE_ROOT_HASH_TYPE].value ==
dapiManagementMerkleRoot,
"Invalid root"
);
require(
MerkleProof.verify(
dapiManagementMerkleProof,
dapiManagementMerkleRoot,
keccak256(
bytes.concat(
keccak256(
abi.encode(dapiName, dataFeedId, sponsorWallet)
)
)
)
),
"Invalid proof"
);
}
function verifyDapiManagementAndDapiPricingMerkleProofs(
bytes32 dapiName,
bytes32 dataFeedId,
address sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
) private view {
require(dapiName != bytes32(0), "dAPI name zero");
require(
updateParameters.length == UPDATE_PARAMETERS_LENGTH,
"Update parameters length invalid"
);
require(duration != 0, "Duration zero");
require(price != 0, "Price zero");
(
bytes32 dapiManagementMerkleRoot,
bytes32[] memory dapiManagementMerkleProof,
bytes32 dapiPricingMerkleRoot,
bytes32[] memory dapiPricingMerkleProof
) = abi.decode(
dapiManagementAndDapiPricingMerkleData,
(bytes32, bytes32[], bytes32, bytes32[])
);
require(
hashes[DAPI_MANAGEMENT_MERKLE_ROOT_HASH_TYPE].value ==
dapiManagementMerkleRoot,
"Invalid root"
);
require(
MerkleProof.verify(
dapiManagementMerkleProof,
dapiManagementMerkleRoot,
keccak256(
bytes.concat(
keccak256(
abi.encode(dapiName, dataFeedId, sponsorWallet)
)
)
)
),
"Invalid proof"
);
require(
hashes[DAPI_PRICING_MERKLE_ROOT_HASH_TYPE].value ==
dapiPricingMerkleRoot,
"Invalid root"
);
require(
MerkleProof.verify(
dapiPricingMerkleProof,
dapiPricingMerkleRoot,
keccak256(
bytes.concat(
keccak256(
abi.encode(
dapiName,
block.chainid,
updateParameters,
duration,
price
)
)
)
)
),
"Invalid proof"
);
}
/// @notice Verifies the signed API URL Merkle proof
/// @param airnode Airnode address
/// @param signedApiUrl Signed API URL
/// @param signedApiUrlMerkleData ABI-encoded signed API URL Merkle root
/// and proof
function verifySignedApiUrlMerkleProof(
address airnode,
string calldata signedApiUrl,
bytes calldata signedApiUrlMerkleData
) private view {
(
bytes32 signedApiUrlMerkleRoot,
bytes32[] memory signedApiUrlMerkleProof
) = abi.decode(signedApiUrlMerkleData, (bytes32, bytes32[]));
require(
hashes[SIGNED_API_URL_MERKLE_ROOT_HASH_TYPE].value ==
signedApiUrlMerkleRoot,
"Invalid root"
);
require(
MerkleProof.verify(
signedApiUrlMerkleProof,
signedApiUrlMerkleRoot,
keccak256(
bytes.concat(keccak256(abi.encode(airnode, signedApiUrl)))
)
),
"Invalid proof"
);
}
/// @notice Derives the Beacon ID from the Airnode address and template ID
/// @param airnode Airnode address
/// @param templateId Template ID
/// @return beaconId Beacon ID
function deriveBeaconId(
address airnode,
bytes32 templateId
) private pure returns (bytes32 beaconId) {
beaconId = keccak256(abi.encodePacked(airnode, templateId));
}
}
contracts/access/HashRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "../vendor/@openzeppelin/contracts@4.9.5/access/Ownable.sol";
import "./interfaces/IHashRegistry.sol";
import "../vendor/@openzeppelin/contracts@4.9.5/utils/cryptography/ECDSA.sol";
/// @title A contract where a value for each hash type can be registered using
/// the signatures of the respective signers that are set by the contract owner
/// @notice Hashes are identified by a unique "hash type", which is a `bytes32`
/// type that can be determined based on any arbitrary convention. The contract
/// owner can set a list of signers for each hash type. For a hash value to be
/// registered, its signers must be set by the contract owner, and valid
/// signatures by each signer must be provided. The hash values are bundled
/// with timestamps that act as nonces, meaning that each registration must
/// be with a larger timestamp than the previous. The contract owner can
/// override previously registered hashes.
/// A signer can sign a delegation message that allows the delegate to sign
/// hashes on their behalf across all instances of this contract until the
/// specified time. This delegation is irrevocable by design (as revoking across
/// all instances would be error-prone). To undo an unwanted delegation, the
/// signer must be swapped out by the contract owner until the delegation runs
/// out.
/// @dev This contract can be used in standalone form to be referred to through
/// external calls, or inherited by the contract that will access the
/// registered hashes internally.
/// HashRegistry is intended for use-cases where signatures and delegations
/// need to apply universally across domains, which is why it is blind to the
/// domain (unlike ERC-712). However, the inheriting contract can implement the
/// type hashes to be domain-specific.
contract HashRegistry is Ownable, IHashRegistry {
struct Hash {
bytes32 value;
uint256 timestamp;
}
/// @notice Hash type to the last registered value and timestamp
mapping(bytes32 => Hash) public override hashes;
/// @notice Hash type to the hash of the array of signer addresses
mapping(bytes32 => bytes32) public override hashTypeToSignersHash;
uint256 private constant ECDSA_SIGNATURE_LENGTH = 65;
// Length of abi.encode(uint256, bytes, bytes), where the bytes types are
// ECDSA signatures padded to the next largest multiple of 32 bytes, which
// is 96
uint256 private constant DELEGATED_SIGNATURE_LENGTH =
32 + 32 + 32 + (32 + 96) + (32 + 96);
/// @param owner_ Owner address
constructor(address owner_) {
require(owner_ != address(0), "Owner address zero");
_transferOwnership(owner_);
}
/// @notice Returns the owner address
/// @return Owner address
function owner()
public
view
virtual
override(Ownable, IOwnable)
returns (address)
{
return super.owner();
}
/// @notice Called by the owner to renounce the ownership of the contract
function renounceOwnership() public virtual override(Ownable, IOwnable) {
return super.renounceOwnership();
}
/// @notice Called by the owner to transfer the ownership of the contract
/// @param newOwner New owner address
function transferOwnership(
address newOwner
) public virtual override(Ownable, IOwnable) {
return super.transferOwnership(newOwner);
}
/// @notice Called by the contract owner to set signers for a hash type.
/// The signer addresses must be in ascending order.
/// @param hashType Hash type
/// @param signers Signer addresses
function setSigners(
bytes32 hashType,
address[] calldata signers
) external override onlyOwner {
require(hashType != bytes32(0), "Hash type zero");
uint256 signersCount = signers.length;
require(signersCount != 0, "Signers empty");
require(signers[0] != address(0), "First signer address zero");
for (uint256 ind = 1; ind < signersCount; ind++) {
require(
signers[ind] > signers[ind - 1],
"Signers not in ascending order"
);
}
hashTypeToSignersHash[hashType] = keccak256(abi.encodePacked(signers));
emit SetSigners(hashType, signers);
}
/// @notice Called by the owner to set a hash. Overrides previous
/// registrations and is allowed to set the value to `bytes32(0)`.
/// @param hashType Hash type
/// @param hashValue Hash value
function setHash(
bytes32 hashType,
bytes32 hashValue
) external override onlyOwner {
hashes[hashType] = Hash({value: hashValue, timestamp: block.timestamp});
emit SetHash(hashType, hashValue, block.timestamp);
}
/// @notice Registers the hash value and timestamp for the respective type.
/// The hash value cannot be zero.
/// The timestamp must not exceed the block timestamp, yet be larger than
/// the timestamp of the previous registration.
/// The signers must have been set for the hash type, and the signatures
/// must be sorted for the respective signer addresses to be in ascending
/// order.
/// Each signature can either be a standalone signature by the respective
/// signer, or a signature by the signer's delegate, encoded along with
/// the delegation end timestamp and delegation signature.
/// @param hashType Hash type
/// @param hashValue Hash value
/// @param hashTimestamp Hash timestamp
/// @param signatures Signatures
function registerHash(
bytes32 hashType,
bytes32 hashValue,
uint256 hashTimestamp,
bytes[] calldata signatures
) external override {
require(hashValue != bytes32(0), "Hash value zero");
require(hashTimestamp <= block.timestamp, "Hash timestamp from future");
require(
hashTimestamp > hashes[hashType].timestamp,
"Hash timestamp not more recent"
);
bytes32 signersHash = hashTypeToSignersHash[hashType];
require(signersHash != bytes32(0), "Signers not set");
uint256 signaturesCount = signatures.length;
address[] memory signers = new address[](signaturesCount);
bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(
keccak256(abi.encodePacked(hashType, hashValue, hashTimestamp))
);
for (uint256 ind = 0; ind < signaturesCount; ind++) {
uint256 signatureLength = signatures[ind].length;
if (signatureLength == ECDSA_SIGNATURE_LENGTH) {
signers[ind] = ECDSA.recover(
ethSignedMessageHash,
signatures[ind]
);
} else if (signatureLength == DELEGATED_SIGNATURE_LENGTH) {
(
uint256 delegationEndTimestamp,
bytes memory delegationSignature,
bytes memory hashSignature
) = abi.decode(signatures[ind], (uint256, bytes, bytes));
require(
block.timestamp < delegationEndTimestamp,
"Delegation ended"
);
signers[ind] = ECDSA.recover(
ECDSA.toEthSignedMessageHash(
keccak256(
abi.encodePacked(
signatureDelegationHashType(),
ECDSA.recover(
ethSignedMessageHash,
hashSignature
),
delegationEndTimestamp
)
)
),
delegationSignature
);
} else {
revert("Invalid signature length");
}
}
require(
signersHash == keccak256(abi.encodePacked(signers)),
"Signature mismatch"
);
hashes[hashType] = Hash({value: hashValue, timestamp: hashTimestamp});
emit RegisteredHash(hashType, hashValue, hashTimestamp);
}
/// @notice Returns the signature delegation hash type used in delegation
/// signatures
/// @dev Delegation signatures signed with a signature delegation hash type
/// will apply universally across all HashRegistry instances that use that
/// same signature delegation hash type. The inheriting contract can
/// specify a special signature delegation hash type by overriding this
/// function.
/// @return Signature delegation hash type
function signatureDelegationHashType()
public
view
virtual
override
returns (bytes32)
{
return keccak256(abi.encodePacked("HashRegistry signature delegation"));
}
/// @notice Returns get the hash value for the type
/// @param hashType Hash type
/// @return hashValue Hash value
function getHashValue(
bytes32 hashType
) external view override returns (bytes32 hashValue) {
hashValue = hashes[hashType].value;
}
}
contracts/access/interfaces/IAccessControlRegistryAdminned.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/interfaces/ISelfMulticall.sol";
interface IAccessControlRegistryAdminned is ISelfMulticall {
function accessControlRegistry() external view returns (address);
function adminRoleDescription() external view returns (string memory);
}
contracts/access/interfaces/IAccessControlRegistryAdminnedWithManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlRegistryAdminned.sol";
interface IAccessControlRegistryAdminnedWithManager is
IAccessControlRegistryAdminned
{
function manager() external view returns (address);
function adminRole() external view returns (bytes32);
}
contracts/access/interfaces/IHashRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IOwnable.sol";
interface IHashRegistry is IOwnable {
event SetSigners(bytes32 indexed hashType, address[] signers);
event SetHash(
bytes32 indexed hashType,
bytes32 hashValue,
uint256 hashTimestamp
);
event RegisteredHash(
bytes32 indexed hashType,
bytes32 hashValue,
uint256 hashTimestamp
);
function setSigners(bytes32 hashType, address[] calldata signers) external;
function setHash(bytes32 hashType, bytes32 hashValue) external;
function registerHash(
bytes32 hashType,
bytes32 hashValue,
uint256 hashTimestamp,
bytes[] calldata signatures
) external;
function signatureDelegationHashType() external view returns (bytes32);
function getHashValue(
bytes32 hashType
) external view returns (bytes32 hashValue);
function hashes(
bytes32 hashType
) external view returns (bytes32 hashValue, uint256 hashTimestamp);
function hashTypeToSignersHash(
bytes32 hashType
) external view returns (bytes32 signersHash);
}
contracts/access/interfaces/IOwnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOwnable {
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address newOwner) external;
}
contracts/api3-server-v1/AirseekerRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "../vendor/@openzeppelin/contracts@4.9.5/access/Ownable.sol";
import "../utils/ExtendedSelfMulticall.sol";
import "./interfaces/IAirseekerRegistry.sol";
import "../vendor/@openzeppelin/contracts@4.9.5/utils/structs/EnumerableSet.sol";
import "./interfaces/IApi3ServerV1.sol";
/// @title A contract where active data feeds and their specs are registered by
/// the contract owner for the Airseeker that serves them to refer to
/// @notice Airseeker is an application that pushes API provider-signed data to
/// chain when certain conditions are met so that the data feeds served on the
/// Api3ServerV1 contract are updated according to the respective specs. In
/// other words, this contract is an on-chain configuration file for an
/// Airseeker (or multiple Airseekers in a setup with redundancy).
/// The Airseeker must know which data feeds are active (and thus need to be
/// updated), the constituting Airnode (the oracle node that API providers
/// operate to sign data) addresses and request template IDs, what the
/// respective on-chain data feed values are, what the update parameters are,
/// and the URL of the signed APIs (from which Airseeker can fetch signed data)
/// that are hosted by the respective API providers.
/// The contract owner is responsible with leaving the state of this contract
/// in a way that Airseeker expects. For example, if a dAPI name is activated
/// without registering the respective data feed, the Airseeker will not have
/// access to the data that it needs to execute updates.
contract AirseekerRegistry is
Ownable,
ExtendedSelfMulticall,
IAirseekerRegistry
{
using EnumerableSet for EnumerableSet.Bytes32Set;
/// @notice Maximum number of Beacons in a Beacon set that can be
/// registered
/// @dev Api3ServerV1 introduces the concept of a Beacon, which is a
/// single-source data feed. Api3ServerV1 allows Beacons to be read
/// individually, or arbitrary combinations of them to be aggregated
/// on-chain to form multiple-source data feeds, which are called Beacon
/// sets. This contract does not support Beacon sets that consist of more
/// than `MAXIMUM_BEACON_COUNT_IN_SET` Beacons to be registered.
uint256 public constant override MAXIMUM_BEACON_COUNT_IN_SET = 21;
/// @notice Maximum encoded update parameters length
uint256 public constant override MAXIMUM_UPDATE_PARAMETERS_LENGTH = 1024;
/// @notice Maximum signed API URL length
uint256 public constant override MAXIMUM_SIGNED_API_URL_LENGTH = 256;
/// @notice Api3ServerV1 contract address
address public immutable override api3ServerV1;
/// @notice Airnode address to signed API URL
/// @dev An Airseeker can be configured to refer to additional signed APIs
/// than the ones whose URLs are stored in this contract for redundancy
mapping(address => string) public override airnodeToSignedApiUrl;
/// @notice Data feed ID to encoded details
mapping(bytes32 => bytes) public override dataFeedIdToDetails;
// Api3ServerV1 uses Beacon IDs (see the `deriveBeaconId()` implementation)
// and Beacon set IDs (see the `deriveBeaconSetId()` implementation) to
// address data feeds. We use data feed ID as a general term to refer to a
// Beacon ID/Beacon set ID.
// A data feed ID is immutable (i.e., it always points to the same Beacon
// or Beacon set). Api3ServerV1 allows a dAPI name to be pointed to a data
// feed ID by privileged accounts to implement a mutable data feed
// addressing scheme.
// If the data feed ID or dAPI name should be used to read a data feed
// depends on the use case. To support both schemes, AirseekerRegistry
// allows data feeds specs to be defined with either the data feed ID or
// the dAPI name.
EnumerableSet.Bytes32Set private activeDataFeedIds;
EnumerableSet.Bytes32Set private activeDapiNames;
// Considering that the update parameters are typically reused between data
// feeds, a hash map is used to avoid storing the same update parameters
// redundantly
mapping(bytes32 => bytes32) private dataFeedIdToUpdateParametersHash;
mapping(bytes32 => bytes32) private dapiNameToUpdateParametersHash;
mapping(bytes32 => bytes) private updateParametersHashToValue;
// Length of abi.encode(address, bytes32)
uint256 private constant DATA_FEED_DETAILS_LENGTH_FOR_SINGLE_BEACON =
32 + 32;
// Length of abi.encode(address[2], bytes32[2])
uint256
private constant DATA_FEED_DETAILS_LENGTH_FOR_BEACON_SET_WITH_TWO_BEACONS =
32 + 32 + (32 + 2 * 32) + (32 + 2 * 32);
// Length of
// abi.encode(address[MAXIMUM_BEACON_COUNT_IN_SET], bytes32[MAXIMUM_BEACON_COUNT_IN_SET])
uint256 private constant MAXIMUM_DATA_FEED_DETAILS_LENGTH =
32 +
32 +
(32 + MAXIMUM_BEACON_COUNT_IN_SET * 32) +
(32 + MAXIMUM_BEACON_COUNT_IN_SET * 32);
/// @dev Reverts if the data feed ID is zero
/// @param dataFeedId Data feed ID
modifier onlyNonZeroDataFeedId(bytes32 dataFeedId) {
require(dataFeedId != bytes32(0), "Data feed ID zero");
_;
}
/// @dev Reverts if the dAPI name is zero
/// @param dapiName dAPI name
modifier onlyNonZeroDapiName(bytes32 dapiName) {
require(dapiName != bytes32(0), "dAPI name zero");
_;
}
/// @dev Reverts if the update parameters are too long
/// @param updateParameters Update parameters
modifier onlyValidUpdateParameters(bytes calldata updateParameters) {
require(
updateParameters.length <= MAXIMUM_UPDATE_PARAMETERS_LENGTH,
"Update parameters too long"
);
_;
}
/// @param owner_ Owner address
/// @param api3ServerV1_ Api3ServerV1 contract address
constructor(address owner_, address api3ServerV1_) {
require(owner_ != address(0), "Owner address zero");
require(api3ServerV1_ != address(0), "Api3ServerV1 address zero");
_transferOwnership(owner_);
api3ServerV1 = api3ServerV1_;
}
/// @notice Returns the owner address
/// @return Owner address
function owner() public view override(Ownable, IOwnable) returns (address) {
return super.owner();
}
/// @notice Overriden to be disabled
function renounceOwnership() public pure override(Ownable, IOwnable) {
revert("Ownership cannot be renounced");
}
/// @notice Overriden to be disabled
function transferOwnership(
address
) public pure override(Ownable, IOwnable) {
revert("Ownership cannot be transferred");
}
/// @notice Called by the owner to set the data feed ID to be activated
/// @param dataFeedId Data feed ID
function setDataFeedIdToBeActivated(
bytes32 dataFeedId
) external override onlyOwner onlyNonZeroDataFeedId(dataFeedId) {
if (activeDataFeedIds.add(dataFeedId)) {
emit ActivatedDataFeedId(dataFeedId);
}
}
/// @notice Called by the owner to set the dAPI name to be activated
/// @param dapiName dAPI name
function setDapiNameToBeActivated(
bytes32 dapiName
) external override onlyOwner onlyNonZeroDapiName(dapiName) {
if (activeDapiNames.add(dapiName)) {
emit ActivatedDapiName(dapiName);
}
}
/// @notice Called by the owner to set the data feed ID to be deactivated
/// @param dataFeedId Data feed ID
function setDataFeedIdToBeDeactivated(
bytes32 dataFeedId
) external override onlyOwner onlyNonZeroDataFeedId(dataFeedId) {
if (activeDataFeedIds.remove(dataFeedId)) {
emit DeactivatedDataFeedId(dataFeedId);
}
}
/// @notice Called by the owner to set the dAPI name to be deactivated
/// @param dapiName dAPI name
function setDapiNameToBeDeactivated(
bytes32 dapiName
) external override onlyOwner onlyNonZeroDapiName(dapiName) {
if (activeDapiNames.remove(dapiName)) {
emit DeactivatedDapiName(dapiName);
}
}
/// @notice Called by the owner to set the data feed ID update parameters.
/// The update parameters must be encoded in a format that Airseeker
/// expects.
/// @param dataFeedId Data feed ID
/// @param updateParameters Update parameters
function setDataFeedIdUpdateParameters(
bytes32 dataFeedId,
bytes calldata updateParameters
)
external
override
onlyOwner
onlyNonZeroDataFeedId(dataFeedId)
onlyValidUpdateParameters(updateParameters)
{
bytes32 updateParametersHash = keccak256(updateParameters);
if (
dataFeedIdToUpdateParametersHash[dataFeedId] != updateParametersHash
) {
dataFeedIdToUpdateParametersHash[dataFeedId] = updateParametersHash;
if (
updateParametersHashToValue[updateParametersHash].length !=
updateParameters.length
) {
updateParametersHashToValue[
updateParametersHash
] = updateParameters;
}
emit UpdatedDataFeedIdUpdateParameters(
dataFeedId,
updateParameters
);
}
}
/// @notice Called by the owner to set the dAPI name update parameters.
/// The update parameters must be encoded in a format that Airseeker
/// expects.
/// @param dapiName dAPI name
/// @param updateParameters Update parameters
function setDapiNameUpdateParameters(
bytes32 dapiName,
bytes calldata updateParameters
)
external
override
onlyOwner
onlyNonZeroDapiName(dapiName)
onlyValidUpdateParameters(updateParameters)
{
bytes32 updateParametersHash = keccak256(updateParameters);
if (dapiNameToUpdateParametersHash[dapiName] != updateParametersHash) {
dapiNameToUpdateParametersHash[dapiName] = updateParametersHash;
if (
updateParametersHashToValue[updateParametersHash].length !=
updateParameters.length
) {
updateParametersHashToValue[
updateParametersHash
] = updateParameters;
}
emit UpdatedDapiNameUpdateParameters(dapiName, updateParameters);
}
}
/// @notice Called by the owner to set the signed API URL for the Airnode.
/// The signed API must implement the specific interface that Airseeker
/// expects.
/// @param airnode Airnode address
/// @param signedApiUrl Signed API URL
function setSignedApiUrl(
address airnode,
string calldata signedApiUrl
) external override onlyOwner {
require(airnode != address(0), "Airnode address zero");
require(
abi.encodePacked(signedApiUrl).length <=
MAXIMUM_SIGNED_API_URL_LENGTH,
"Signed API URL too long"
);
if (
keccak256(abi.encodePacked(airnodeToSignedApiUrl[airnode])) !=
keccak256(abi.encodePacked(signedApiUrl))
) {
airnodeToSignedApiUrl[airnode] = signedApiUrl;
emit UpdatedSignedApiUrl(airnode, signedApiUrl);
}
}
/// @notice Registers the data feed. In the case that the data feed is a
/// Beacon, the details should be the ABI-encoded Airnode address and
/// template ID. In the case that the data feed is a Beacon set, the
/// details should be the ABI-encoded Airnode addresses array and template
/// IDs array.
/// @param dataFeedDetails Data feed details
/// @return dataFeedId Data feed ID
function registerDataFeed(
bytes calldata dataFeedDetails
) external override returns (bytes32 dataFeedId) {
uint256 dataFeedDetailsLength = dataFeedDetails.length;
if (
dataFeedDetailsLength == DATA_FEED_DETAILS_LENGTH_FOR_SINGLE_BEACON
) {
// dataFeedId maps to a Beacon
(address airnode, bytes32 templateId) = abi.decode(
dataFeedDetails,
(address, bytes32)
);
require(airnode != address(0), "Airnode address zero");
dataFeedId = deriveBeaconId(airnode, templateId);
} else if (
dataFeedDetailsLength >=
DATA_FEED_DETAILS_LENGTH_FOR_BEACON_SET_WITH_TWO_BEACONS
) {
require(
dataFeedDetailsLength <= MAXIMUM_DATA_FEED_DETAILS_LENGTH,
"Data feed details too long"
);
(address[] memory airnodes, bytes32[] memory templateIds) = abi
.decode(dataFeedDetails, (address[], bytes32[]));
require(
abi.encode(airnodes, templateIds).length ==
dataFeedDetailsLength,
"Data feed details trail"
);
uint256 beaconCount = airnodes.length;
require(
beaconCount == templateIds.length,
"Parameter length mismatch"
);
bytes32[] memory beaconIds = new bytes32[](beaconCount);
for (uint256 ind = 0; ind < beaconCount; ind++) {
require(airnodes[ind] != address(0), "Airnode address zero");
beaconIds[ind] = deriveBeaconId(
airnodes[ind],
templateIds[ind]
);
}
dataFeedId = deriveBeaconSetId(beaconIds);
} else {
revert("Data feed details too short");
}
if (dataFeedIdToDetails[dataFeedId].length != dataFeedDetailsLength) {
dataFeedIdToDetails[dataFeedId] = dataFeedDetails;
emit RegisteredDataFeed(dataFeedId, dataFeedDetails);
}
}
/// @notice In an imaginary array consisting of the the active data feed
/// IDs and active dAPI names, picks the index-th identifier, and returns
/// all data about the respective data feed that is available. Whenever
/// data is not available (including the case where index does not
/// correspond to an active data feed), returns empty values.
/// @dev Airseeker uses this function to get all the data it needs about an
/// active data feed with a single RPC call
/// @param index Index
/// @return dataFeedId Data feed ID
/// @return dapiName dAPI name (`bytes32(0)` if the active data feed is
/// identified by a data feed ID)
/// @return dataFeedDetails Data feed details
/// @return dataFeedValue Data feed value read from Api3ServerV1
/// @return dataFeedTimestamp Data feed timestamp read from Api3ServerV1
/// @return beaconValues Beacon values read from Api3ServerV1
/// @return beaconTimestamps Beacon timestamps read from Api3ServerV1
/// @return updateParameters Update parameters
/// @return signedApiUrls Signed API URLs of the Beacon Airnodes
function activeDataFeed(
uint256 index
)
external
view
override
returns (
bytes32 dataFeedId,
bytes32 dapiName,
bytes memory dataFeedDetails,
int224 dataFeedValue,
uint32 dataFeedTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps,
bytes memory updateParameters,
string[] memory signedApiUrls
)
{
uint256 activeDataFeedIdsLength = activeDataFeedIdCount();
if (index < activeDataFeedIdsLength) {
dataFeedId = activeDataFeedIds.at(index);
updateParameters = dataFeedIdToUpdateParameters(dataFeedId);
} else if (index < activeDataFeedIdsLength + activeDapiNames.length()) {
dapiName = activeDapiNames.at(index - activeDataFeedIdsLength);
dataFeedId = IApi3ServerV1(api3ServerV1).dapiNameHashToDataFeedId(
keccak256(abi.encodePacked(dapiName))
);
updateParameters = dapiNameToUpdateParameters(dapiName);
}
if (dataFeedId != bytes32(0)) {
dataFeedDetails = dataFeedIdToDetails[dataFeedId];
(dataFeedValue, dataFeedTimestamp) = IApi3ServerV1(api3ServerV1)
.dataFeeds(dataFeedId);
}
if (dataFeedDetails.length != 0) {
if (
dataFeedDetails.length ==
DATA_FEED_DETAILS_LENGTH_FOR_SINGLE_BEACON
) {
beaconValues = new int224[](1);
beaconTimestamps = new uint32[](1);
signedApiUrls = new string[](1);
(address airnode, bytes32 templateId) = abi.decode(
dataFeedDetails,
(address, bytes32)
);
(beaconValues[0], beaconTimestamps[0]) = IApi3ServerV1(
api3ServerV1
).dataFeeds(deriveBeaconId(airnode, templateId));
signedApiUrls[0] = airnodeToSignedApiUrl[airnode];
} else {
(address[] memory airnodes, bytes32[] memory templateIds) = abi
.decode(dataFeedDetails, (address[], bytes32[]));
uint256 beaconCount = airnodes.length;
beaconValues = new int224[](beaconCount);
beaconTimestamps = new uint32[](beaconCount);
signedApiUrls = new string[](beaconCount);
for (uint256 ind = 0; ind < beaconCount; ind++) {
(beaconValues[ind], beaconTimestamps[ind]) = IApi3ServerV1(
api3ServerV1
).dataFeeds(
deriveBeaconId(airnodes[ind], templateIds[ind])
);
signedApiUrls[ind] = airnodeToSignedApiUrl[airnodes[ind]];
}
}
}
}
/// @notice Returns the number of active data feeds identified by a data
/// feed ID or dAPI name
/// @return Active data feed count
function activeDataFeedCount() external view override returns (uint256) {
return activeDataFeedIdCount() + activeDapiNameCount();
}
/// @notice Returns the number of active data feeds identified by a data
/// feed ID
/// @return Active data feed ID count
function activeDataFeedIdCount() public view override returns (uint256) {
return activeDataFeedIds.length();
}
/// @notice Returns the number of active data feeds identified by a dAPI
/// name
/// @return Active dAPI name count
function activeDapiNameCount() public view override returns (uint256) {
return activeDapiNames.length();
}
/// @notice Data feed ID to update parameters
/// @param dataFeedId Data feed ID
/// @return updateParameters Update parameters
function dataFeedIdToUpdateParameters(
bytes32 dataFeedId
) public view override returns (bytes memory updateParameters) {
updateParameters = updateParametersHashToValue[
dataFeedIdToUpdateParametersHash[dataFeedId]
];
}
/// @notice dAPI name to update parameters
/// @param dapiName dAPI name
/// @return updateParameters Update parameters
function dapiNameToUpdateParameters(
bytes32 dapiName
) public view override returns (bytes memory updateParameters) {
updateParameters = updateParametersHashToValue[
dapiNameToUpdateParametersHash[dapiName]
];
}
/// @notice Returns if the data feed with ID is registered
/// @param dataFeedId Data feed ID
/// @return If the data feed with ID is registered
function dataFeedIsRegistered(
bytes32 dataFeedId
) external view override returns (bool) {
return dataFeedIdToDetails[dataFeedId].length != 0;
}
/// @notice Derives the Beacon ID from the Airnode address and template ID
/// @param airnode Airnode address
/// @param templateId Template ID
/// @return beaconId Beacon ID
function deriveBeaconId(
address airnode,
bytes32 templateId
) private pure returns (bytes32 beaconId) {
beaconId = keccak256(abi.encodePacked(airnode, templateId));
}
/// @notice Derives the Beacon set ID from the Beacon IDs
/// @param beaconIds Beacon IDs
/// @return beaconSetId Beacon set ID
function deriveBeaconSetId(
bytes32[] memory beaconIds
) private pure returns (bytes32 beaconSetId) {
beaconSetId = keccak256(abi.encode(beaconIds));
}
}
contracts/api3-server-v1/interfaces/IAirseekerRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../access/interfaces/IOwnable.sol";
import "../../utils/interfaces/IExtendedSelfMulticall.sol";
interface IAirseekerRegistry is IOwnable, IExtendedSelfMulticall {
event ActivatedDataFeedId(bytes32 indexed dataFeedId);
event ActivatedDapiName(bytes32 indexed dapiName);
event DeactivatedDataFeedId(bytes32 indexed dataFeedId);
event DeactivatedDapiName(bytes32 indexed dapiName);
event UpdatedDataFeedIdUpdateParameters(
bytes32 indexed dataFeedId,
bytes updateParameters
);
event UpdatedDapiNameUpdateParameters(
bytes32 indexed dapiName,
bytes updateParameters
);
event UpdatedSignedApiUrl(address indexed airnode, string signedApiUrl);
event RegisteredDataFeed(bytes32 indexed dataFeedId, bytes dataFeedDetails);
function setDataFeedIdToBeActivated(bytes32 dataFeedId) external;
function setDapiNameToBeActivated(bytes32 dapiName) external;
function setDataFeedIdToBeDeactivated(bytes32 dataFeedId) external;
function setDapiNameToBeDeactivated(bytes32 dapiName) external;
function setDataFeedIdUpdateParameters(
bytes32 dataFeedId,
bytes calldata updateParameters
) external;
function setDapiNameUpdateParameters(
bytes32 dapiName,
bytes calldata updateParameters
) external;
function setSignedApiUrl(
address airnode,
string calldata signedApiUrl
) external;
function registerDataFeed(
bytes calldata dataFeedDetails
) external returns (bytes32 dataFeedId);
function activeDataFeed(
uint256 index
)
external
view
returns (
bytes32 dataFeedId,
bytes32 dapiName,
bytes memory dataFeedDetails,
int224 dataFeedValue,
uint32 dataFeedTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps,
bytes memory updateParameters,
string[] memory signedApiUrls
);
function activeDataFeedCount() external view returns (uint256);
function activeDataFeedIdCount() external view returns (uint256);
function activeDapiNameCount() external view returns (uint256);
function dataFeedIdToUpdateParameters(
bytes32 dataFeedId
) external view returns (bytes memory updateParameters);
function dapiNameToUpdateParameters(
bytes32 dapiName
) external view returns (bytes memory updateParameters);
function dataFeedIsRegistered(
bytes32 dataFeedId
) external view returns (bool);
function MAXIMUM_BEACON_COUNT_IN_SET() external view returns (uint256);
function MAXIMUM_UPDATE_PARAMETERS_LENGTH() external view returns (uint256);
function MAXIMUM_SIGNED_API_URL_LENGTH() external view returns (uint256);
function api3ServerV1() external view returns (address);
function airnodeToSignedApiUrl(
address airnode
) external view returns (string memory signedApiUrl);
function dataFeedIdToDetails(
bytes32 dataFeedId
) external view returns (bytes memory dataFeedDetails);
}
contracts/api3-server-v1/interfaces/IApi3Market.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../access/interfaces/IHashRegistry.sol";
import "../../utils/interfaces/IExtendedSelfMulticall.sol";
interface IApi3Market is IHashRegistry, IExtendedSelfMulticall {
event BoughtSubscription(
bytes32 indexed dapiName,
bytes32 indexed subscriptionId,
bytes32 dataFeedId,
address sponsorWallet,
bytes updateParameters,
uint256 duration,
uint256 price,
uint256 paymentAmount
);
event CanceledSubscriptions(bytes32 indexed dapiName);
event UpdatedCurrentSubscriptionId(
bytes32 indexed dapiName,
bytes32 indexed subscriptionId
);
function buySubscription(
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
) external payable returns (bytes32 subscriptionId);
function cancelSubscriptions(bytes32 dapiName) external;
function updateCurrentSubscriptionId(bytes32 dapiName) external;
function updateDapiName(
bytes32 dapiName,
bytes32 dataFeedId,
address sponsorWallet,
bytes calldata dapiManagementMerkleData
) external;
function updateSignedApiUrl(
address airnode,
string calldata signedApiUrl,
bytes calldata signedApiUrlMerkleData
) external;
function multicallAndBuySubscription(
bytes[] calldata multicallData,
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
)
external
payable
returns (bytes[] memory returndata, bytes32 subscriptionId);
function tryMulticallAndBuySubscription(
bytes[] calldata tryMulticallData,
bytes32 dapiName,
bytes32 dataFeedId,
address payable sponsorWallet,
bytes calldata updateParameters,
uint256 duration,
uint256 price,
bytes calldata dapiManagementAndDapiPricingMerkleData
)
external
payable
returns (
bool[] memory successes,
bytes[] memory returndata,
bytes32 subscriptionId
);
function updateBeaconWithSignedData(
address airnode,
bytes32 templateId,
uint256 timestamp,
bytes calldata data,
bytes calldata signature
) external returns (bytes32 beaconId);
function updateBeaconSetWithBeacons(
bytes32[] calldata beaconIds
) external returns (bytes32 beaconSetId);
function deployDapiProxy(
bytes32 dapiName,
bytes calldata metadata
) external returns (address proxyAddress);
function deployDapiProxyWithOev(
bytes32 dapiName,
address oevBeneficiary,
bytes calldata metadata
) external returns (address proxyAddress);
function registerDataFeed(
bytes calldata dataFeedDetails
) external returns (bytes32 dataFeedId);
function computeExpectedSponsorWalletBalance(
bytes32 dapiName
) external view returns (uint256 expectedSponsorWalletBalance);
function computeExpectedSponsorWalletBalanceAfterSubscriptionIsAdded(
bytes32 dapiName,
bytes calldata updateParameters,
uint256 duration,
uint256 price
) external view returns (uint256 expectedSponsorWalletBalance);
function getDapiData(
bytes32 dapiName
)
external
view
returns (
bytes memory dataFeedDetails,
int224 dapiValue,
uint32 dapiTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps,
bytes[] memory updateParameters,
uint32[] memory endTimestamps,
uint224[] memory dailyPrices
);
function getDataFeedData(
bytes32 dataFeedId
)
external
view
returns (
bytes memory dataFeedDetails,
int224 dataFeedValue,
uint32 dataFeedTimestamp,
int224[] memory beaconValues,
uint32[] memory beaconTimestamps
);
function subscriptionIdToUpdateParameters(
bytes32 subscriptionId
) external view returns (bytes memory updateParameters);
function DAPI_MANAGEMENT_MERKLE_ROOT_HASH_TYPE()
external
view
returns (bytes32);
function DAPI_PRICING_MERKLE_ROOT_HASH_TYPE()
external
view
returns (bytes32);
function SIGNED_API_URL_MERKLE_ROOT_HASH_TYPE()
external
view
returns (bytes32);
function MAXIMUM_DAPI_UPDATE_AGE() external view returns (uint256);
function api3ServerV1() external view returns (address);
function proxyFactory() external view returns (address);
function airseekerRegistry() external view returns (address);
function maximumSubscriptionQueueLength() external view returns (uint256);
function subscriptions(
bytes32 subscriptionId
)
external
view
returns (
bytes32 updateParametersHash,
uint32 endTimestamp,
uint224 dailyPrice,
bytes32 nextSubscriptionId
);
function dapiNameToCurrentSubscriptionId(
bytes32 dapiName
) external view returns (bytes32 currentSubscriptionId);
}
contracts/api3-server-v1/interfaces/IApi3ServerV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IOevDapiServer.sol";
import "./IBeaconUpdatesWithSignedData.sol";
interface IApi3ServerV1 is IOevDapiServer, IBeaconUpdatesWithSignedData {
function readDataFeedWithId(
bytes32 dataFeedId
) external view returns (int224 value, uint32 timestamp);
function readDataFeedWithDapiNameHash(
bytes32 dapiNameHash
) external view returns (int224 value, uint32 timestamp);
function readDataFeedWithIdAsOevProxy(
bytes32 dataFeedId
) external view returns (int224 value, uint32 timestamp);
function readDataFeedWithDapiNameHashAsOevProxy(
bytes32 dapiNameHash
) external view returns (int224 value, uint32 timestamp);
function dataFeeds(
bytes32 dataFeedId
) external view returns (int224 value, uint32 timestamp);
function oevProxyToIdToDataFeed(
address proxy,
bytes32 dataFeedId
) external view returns (int224 value, uint32 timestamp);
}
contracts/api3-server-v1/interfaces/IBeaconUpdatesWithSignedData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IDataFeedServer.sol";
interface IBeaconUpdatesWithSignedData is IDataFeedServer {
function updateBeaconWithSignedData(
address airnode,
bytes32 templateId,
uint256 timestamp,
bytes calldata data,
bytes calldata signature
) external returns (bytes32 beaconId);
}
contracts/api3-server-v1/interfaces/IDapiServer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../access/interfaces/IAccessControlRegistryAdminnedWithManager.sol";
import "./IDataFeedServer.sol";
interface IDapiServer is
IAccessControlRegistryAdminnedWithManager,
IDataFeedServer
{
event SetDapiName(
bytes32 indexed dataFeedId,
bytes32 indexed dapiName,
address sender
);
function setDapiName(bytes32 dapiName, bytes32 dataFeedId) external;
function dapiNameToDataFeedId(
bytes32 dapiName
) external view returns (bytes32);
// solhint-disable-next-line func-name-mixedcase
function DAPI_NAME_SETTER_ROLE_DESCRIPTION()
external
view
returns (string memory);
function dapiNameSetterRole() external view returns (bytes32);
function dapiNameHashToDataFeedId(
bytes32 dapiNameHash
) external view returns (bytes32 dataFeedId);
}
contracts/api3-server-v1/interfaces/IDataFeedServer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/interfaces/IExtendedSelfMulticall.sol";
interface IDataFeedServer is IExtendedSelfMulticall {
event UpdatedBeaconWithSignedData(
bytes32 indexed beaconId,
int224 value,
uint32 timestamp
);
event UpdatedBeaconSetWithBeacons(
bytes32 indexed beaconSetId,
int224 value,
uint32 timestamp
);
function updateBeaconSetWithBeacons(
bytes32[] memory beaconIds
) external returns (bytes32 beaconSetId);
}
contracts/api3-server-v1/interfaces/IOevDapiServer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IOevDataFeedServer.sol";
import "./IDapiServer.sol";
interface IOevDapiServer is IOevDataFeedServer, IDapiServer {}
contracts/api3-server-v1/interfaces/IOevDataFeedServer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IDataFeedServer.sol";
interface IOevDataFeedServer is IDataFeedServer {
event UpdatedOevProxyBeaconWithSignedData(
bytes32 indexed beaconId,
address indexed proxy,
bytes32 indexed updateId,
int224 value,
uint32 timestamp
);
event UpdatedOevProxyBeaconSetWithSignedData(
bytes32 indexed beaconSetId,
address indexed proxy,
bytes32 indexed updateId,
int224 value,
uint32 timestamp
);
event Withdrew(
address indexed oevProxy,
address oevBeneficiary,
uint256 amount
);
function updateOevProxyDataFeedWithSignedData(
address oevProxy,
bytes32 dataFeedId,
bytes32 updateId,
uint256 timestamp,
bytes calldata data,
bytes[] calldata packedOevUpdateSignatures
) external payable;
function withdraw(address oevProxy) external;
function oevProxyToBalance(
address oevProxy
) external view returns (uint256 balance);
}
contracts/api3-server-v1/proxies/interfaces/IProxyFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IProxyFactory {
event DeployedDataFeedProxy(
address indexed proxyAddress,
bytes32 indexed dataFeedId,
bytes metadata
);
event DeployedDapiProxy(
address indexed proxyAddress,
bytes32 indexed dapiName,
bytes metadata
);
event DeployedDataFeedProxyWithOev(
address indexed proxyAddress,
bytes32 indexed dataFeedId,
address oevBeneficiary,
bytes metadata
);
event DeployedDapiProxyWithOev(
address indexed proxyAddress,
bytes32 indexed dapiName,
address oevBeneficiary,
bytes metadata
);
function deployDataFeedProxy(
bytes32 dataFeedId,
bytes calldata metadata
) external returns (address proxyAddress);
function deployDapiProxy(
bytes32 dapiName,
bytes calldata metadata
) external returns (address proxyAddress);
function deployDataFeedProxyWithOev(
bytes32 dataFeedId,
address oevBeneficiary,
bytes calldata metadata
) external returns (address proxyAddress);
function deployDapiProxyWithOev(
bytes32 dapiName,
address oevBeneficiary,
bytes calldata metadata
) external returns (address proxyAddress);
function computeDataFeedProxyAddress(
bytes32 dataFeedId,
bytes calldata metadata
) external view returns (address proxyAddress);
function computeDapiProxyAddress(
bytes32 dapiName,
bytes calldata metadata
) external view returns (address proxyAddress);
function computeDataFeedProxyWithOevAddress(
bytes32 dataFeedId,
address oevBeneficiary,
bytes calldata metadata
) external view returns (address proxyAddress);
function computeDapiProxyWithOevAddress(
bytes32 dapiName,
address oevBeneficiary,
bytes calldata metadata
) external view returns (address proxyAddress);
function api3ServerV1() external view returns (address);
}
contracts/utils/ExtendedSelfMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./SelfMulticall.sol";
import "./interfaces/IExtendedSelfMulticall.sol";
/// @title Contract that extends SelfMulticall to fetch some of the global
/// variables
/// @notice Available global variables are limited to the ones that Airnode
/// tends to need
contract ExtendedSelfMulticall is SelfMulticall, IExtendedSelfMulticall {
/// @notice Returns the chain ID
/// @return Chain ID
function getChainId() external view override returns (uint256) {
return block.chainid;
}
/// @notice Returns the account balance
/// @param account Account address
/// @return Account balance
function getBalance(
address account
) external view override returns (uint256) {
return account.balance;
}
/// @notice Returns if the account contains bytecode
/// @dev An account not containing any bytecode does not indicate that it
/// is an EOA or it will not contain any bytecode in the future.
/// Contract construction and `SELFDESTRUCT` updates the bytecode at the
/// end of the transaction.
/// @return If the account contains bytecode
function containsBytecode(
address account
) external view override returns (bool) {
return account.code.length > 0;
}
/// @notice Returns the current block number
/// @return Current block number
function getBlockNumber() external view override returns (uint256) {
return block.number;
}
/// @notice Returns the current block timestamp
/// @return Current block timestamp
function getBlockTimestamp() external view override returns (uint256) {
return block.timestamp;
}
/// @notice Returns the current block basefee
/// @return Current block basefee
function getBlockBasefee() external view override returns (uint256) {
return block.basefee;
}
}
contracts/utils/SelfMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/ISelfMulticall.sol";
/// @title Contract that enables calls to the inheriting contract to be batched
/// @notice Implements two ways of batching, one requires none of the calls to
/// revert and the other tolerates individual calls reverting
/// @dev This implementation uses delegatecall for individual function calls.
/// Since delegatecall is a message call, it can only be made to functions that
/// are externally visible. This means that a contract cannot multicall its own
/// functions that use internal/private visibility modifiers.
/// Refer to OpenZeppelin's Multicall.sol for a similar implementation.
contract SelfMulticall is ISelfMulticall {
/// @notice Batches calls to the inheriting contract and reverts as soon as
/// one of the batched calls reverts
/// @param data Array of calldata of batched calls
/// @return returndata Array of returndata of batched calls
function multicall(
bytes[] calldata data
) external override returns (bytes[] memory returndata) {
uint256 callCount = data.length;
returndata = new bytes[](callCount);
for (uint256 ind = 0; ind < callCount; ) {
bool success;
// solhint-disable-next-line avoid-low-level-calls
(success, returndata[ind]) = address(this).delegatecall(data[ind]);
if (!success) {
bytes memory returndataWithRevertData = returndata[ind];
if (returndataWithRevertData.length > 0) {
// Adapted from OpenZeppelin's Address.sol
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndataWithRevertData)
revert(
add(32, returndataWithRevertData),
returndata_size
)
}
} else {
revert("Multicall: No revert string");
}
}
unchecked {
ind++;
}
}
}
/// @notice Batches calls to the inheriting contract but does not revert if
/// any of the batched calls reverts
/// @param data Array of calldata of batched calls
/// @return successes Array of success conditions of batched calls
/// @return returndata Array of returndata of batched calls
function tryMulticall(
bytes[] calldata data
)
external
override
returns (bool[] memory successes, bytes[] memory returndata)
{
uint256 callCount = data.length;
successes = new bool[](callCount);
returndata = new bytes[](callCount);
for (uint256 ind = 0; ind < callCount; ) {
// solhint-disable-next-line avoid-low-level-calls
(successes[ind], returndata[ind]) = address(this).delegatecall(
data[ind]
);
unchecked {
ind++;
}
}
}
}
contracts/utils/interfaces/IExtendedSelfMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ISelfMulticall.sol";
interface IExtendedSelfMulticall is ISelfMulticall {
function getChainId() external view returns (uint256);
function getBalance(address account) external view returns (uint256);
function containsBytecode(address account) external view returns (bool);
function getBlockNumber() external view returns (uint256);
function getBlockTimestamp() external view returns (uint256);
function getBlockBasefee() external view returns (uint256);
}
contracts/utils/interfaces/ISelfMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISelfMulticall {
function multicall(
bytes[] calldata data
) external returns (bytes[] memory returndata);
function tryMulticall(
bytes[] calldata data
) external returns (bool[] memory successes, bytes[] memory returndata);
}
contracts/vendor/@openzeppelin/contracts@4.9.5/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @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,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode 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 {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]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
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);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode 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 {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
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[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
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.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// 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);
}
// 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);
}
return (signer, RecoverError.NoError);
}
/**
* @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) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/cryptography/MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/math/Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/math/SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/math/SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
contracts/vendor/@openzeppelin/contracts@4.9.5/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":1000,"enabled":true},"metadata":{"useLiteralContent":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"owner_","internalType":"address"},{"type":"address","name":"proxyFactory_","internalType":"address"},{"type":"uint256","name":"maximumSubscriptionQueueLength_","internalType":"uint256"}]},{"type":"event","name":"BoughtSubscription","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"subscriptionId","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"dataFeedId","internalType":"bytes32","indexed":false},{"type":"address","name":"sponsorWallet","internalType":"address","indexed":false},{"type":"bytes","name":"updateParameters","internalType":"bytes","indexed":false},{"type":"uint256","name":"duration","internalType":"uint256","indexed":false},{"type":"uint256","name":"price","internalType":"uint256","indexed":false},{"type":"uint256","name":"paymentAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CanceledSubscriptions","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RegisteredHash","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"hashValue","internalType":"bytes32","indexed":false},{"type":"uint256","name":"hashTimestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetHash","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"hashValue","internalType":"bytes32","indexed":false},{"type":"uint256","name":"hashTimestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetSigners","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32","indexed":true},{"type":"address[]","name":"signers","internalType":"address[]","indexed":false}],"anonymous":false},{"type":"event","name":"UpdatedCurrentSubscriptionId","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"subscriptionId","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DAPI_MANAGEMENT_MERKLE_ROOT_HASH_TYPE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DAPI_PRICING_MERKLE_ROOT_HASH_TYPE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAXIMUM_DAPI_UPDATE_AGE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"SIGNED_API_URL_MERKLE_ROOT_HASH_TYPE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"airseekerRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"api3ServerV1","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes32","name":"subscriptionId","internalType":"bytes32"}],"name":"buySubscription","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"},{"type":"address","name":"sponsorWallet","internalType":"address payable"},{"type":"bytes","name":"updateParameters","internalType":"bytes"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bytes","name":"dapiManagementAndDapiPricingMerkleData","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelSubscriptions","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"expectedSponsorWalletBalance","internalType":"uint256"}],"name":"computeExpectedSponsorWalletBalance","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"expectedSponsorWalletBalance","internalType":"uint256"}],"name":"computeExpectedSponsorWalletBalanceAfterSubscriptionIsAdded","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes","name":"updateParameters","internalType":"bytes"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"containsBytecode","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"dapiNameToCurrentSubscriptionId","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"proxyAddress","internalType":"address"}],"name":"deployDapiProxy","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes","name":"metadata","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"proxyAddress","internalType":"address"}],"name":"deployDapiProxyWithOev","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"address","name":"oevBeneficiary","internalType":"address"},{"type":"bytes","name":"metadata","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBalance","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBlockBasefee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBlockNumber","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBlockTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getChainId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"dataFeedDetails","internalType":"bytes"},{"type":"int224","name":"dapiValue","internalType":"int224"},{"type":"uint32","name":"dapiTimestamp","internalType":"uint32"},{"type":"int224[]","name":"beaconValues","internalType":"int224[]"},{"type":"uint32[]","name":"beaconTimestamps","internalType":"uint32[]"},{"type":"bytes[]","name":"updateParameters","internalType":"bytes[]"},{"type":"uint32[]","name":"endTimestamps","internalType":"uint32[]"},{"type":"uint224[]","name":"dailyPrices","internalType":"uint224[]"}],"name":"getDapiData","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"dataFeedDetails","internalType":"bytes"},{"type":"int224","name":"dataFeedValue","internalType":"int224"},{"type":"uint32","name":"dataFeedTimestamp","internalType":"uint32"},{"type":"int224[]","name":"beaconValues","internalType":"int224[]"},{"type":"uint32[]","name":"beaconTimestamps","internalType":"uint32[]"}],"name":"getDataFeedData","inputs":[{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"hashValue","internalType":"bytes32"}],"name":"getHashValue","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"hashTypeToSignersHash","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"value","internalType":"bytes32"},{"type":"uint256","name":"timestamp","internalType":"uint256"}],"name":"hashes","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maximumSubscriptionQueueLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes[]","name":"returndata","internalType":"bytes[]"}],"name":"multicall","inputs":[{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes[]","name":"returndata","internalType":"bytes[]"},{"type":"bytes32","name":"subscriptionId","internalType":"bytes32"}],"name":"multicallAndBuySubscription","inputs":[{"type":"bytes[]","name":"multicallData","internalType":"bytes[]"},{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"},{"type":"address","name":"sponsorWallet","internalType":"address payable"},{"type":"bytes","name":"updateParameters","internalType":"bytes"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bytes","name":"dapiManagementAndDapiPricingMerkleData","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proxyFactory","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"}],"name":"registerDataFeed","inputs":[{"type":"bytes","name":"dataFeedDetails","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"registerHash","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32"},{"type":"bytes32","name":"hashValue","internalType":"bytes32"},{"type":"uint256","name":"hashTimestamp","internalType":"uint256"},{"type":"bytes[]","name":"signatures","internalType":"bytes[]"}]},{"type":"function","stateMutability":"pure","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHash","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32"},{"type":"bytes32","name":"hashValue","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSigners","inputs":[{"type":"bytes32","name":"hashType","internalType":"bytes32"},{"type":"address[]","name":"signers","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"signatureDelegationHashType","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"updateParameters","internalType":"bytes"}],"name":"subscriptionIdToUpdateParameters","inputs":[{"type":"bytes32","name":"subscriptionId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"updateParametersHash","internalType":"bytes32"},{"type":"uint32","name":"endTimestamp","internalType":"uint32"},{"type":"uint224","name":"dailyPrice","internalType":"uint224"},{"type":"bytes32","name":"nextSubscriptionId","internalType":"bytes32"}],"name":"subscriptions","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"pure","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool[]","name":"successes","internalType":"bool[]"},{"type":"bytes[]","name":"returndata","internalType":"bytes[]"}],"name":"tryMulticall","inputs":[{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bool[]","name":"successes","internalType":"bool[]"},{"type":"bytes[]","name":"returndata","internalType":"bytes[]"},{"type":"bytes32","name":"subscriptionId","internalType":"bytes32"}],"name":"tryMulticallAndBuySubscription","inputs":[{"type":"bytes[]","name":"tryMulticallData","internalType":"bytes[]"},{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"},{"type":"address","name":"sponsorWallet","internalType":"address payable"},{"type":"bytes","name":"updateParameters","internalType":"bytes"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bytes","name":"dapiManagementAndDapiPricingMerkleData","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"beaconSetId","internalType":"bytes32"}],"name":"updateBeaconSetWithBeacons","inputs":[{"type":"bytes32[]","name":"beaconIds","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"beaconId","internalType":"bytes32"}],"name":"updateBeaconWithSignedData","inputs":[{"type":"address","name":"airnode","internalType":"address"},{"type":"bytes32","name":"templateId","internalType":"bytes32"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCurrentSubscriptionId","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateDapiName","inputs":[{"type":"bytes32","name":"dapiName","internalType":"bytes32"},{"type":"bytes32","name":"dataFeedId","internalType":"bytes32"},{"type":"address","name":"sponsorWallet","internalType":"address"},{"type":"bytes","name":"dapiManagementMerkleData","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSignedApiUrl","inputs":[{"type":"address","name":"airnode","internalType":"address"},{"type":"string","name":"signedApiUrl","internalType":"string"},{"type":"bytes","name":"signedApiUrlMerkleData","internalType":"bytes"}]}]
Contract Creation Code
0x6101006040523480156200001257600080fd5b5060405162008beb38038062008beb833981016040819052620000359162000263565b826200004133620001e8565b6001600160a01b038116620000925760405162461bcd60e51b81526020600482015260126024820152714f776e65722061646472657373207a65726f60701b60448201526064015b60405180910390fd5b6200009d81620001e8565b5080600003620000f05760405162461bcd60e51b815260206004820152601960248201527f4d6178696d756d207175657565206c656e677468207a65726f00000000000000604482015260640162000089565b816001600160a01b031660a0816001600160a01b0316815250506000826001600160a01b0316632d6a744e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200014b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001719190620002a4565b6001600160a01b03811660805260405190915060009030908390620001969062000238565b6001600160a01b039283168152911660208201526040018190604051809103906000f5905080158015620001ce573d6000803e3d6000fd5b506001600160a01b031660c0525060e05250620002c99050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612c7c8062005f6f83390190565b80516001600160a01b03811681146200025e57600080fd5b919050565b6000806000606084860312156200027957600080fd5b620002848462000246565b9250620002946020850162000246565b9150604084015190509250925092565b600060208284031215620002b757600080fd5b620002c28262000246565b9392505050565b60805160a05160c05160e051615bc4620003ab600039600081816107590152613c6e01526000818161054d01528181610fa3015281816110de01528181611388015281816115380152818161279901528181612fca01528181613035015281816137d70152818161386f0152613f3701526000818161085c0152818161144d015261174f01526000818161042001528181610a3201528181610e3001528181612379015281816128430152818161292101528181612b0b01528181612d9401528181612ec60152818161393001528181613a070152613e300152615bc46000f3fe6080604052600436106102f15760003560e01c8063796b89b91161018f578063b7afd507116100e1578063d7fa10071161008a578063f2fde38b11610064578063f2fde38b14610998578063f8b2cb4f146109b8578063fa013067146109e057600080fd5b8063d7fa100714610930578063d8d2f90f14610950578063e637cf001461098157600080fd5b8063c6c04e16116100bb578063c6c04e161461089e578063d5659f31146108d2578063d658d2e9146108e757600080fd5b8063b7afd50714610837578063c10f1a751461084a578063c1516e541461087e57600080fd5b806397f679d311610143578063a89307b41161011d578063a89307b4146107bb578063aa2b44e4146107dd578063ac9650d81461080a57600080fd5b806397f679d3146107475780639ae06c841461077b578063a5f36cb11461079b57600080fd5b80638c9f4c79116101745780638c9f4c79146106735780638da5cb5b146106a057806394259c6c146106be57600080fd5b8063796b89b914610633578063845ebe431461064657600080fd5b806342cbb15c116102485780635849e5ef116101fc5780635d868194116101d65780635d868194146105de57806364c2359d146105fe578063715018a61461061e57600080fd5b80635849e5ef1461056f5780635885c7711461058f5780635989eaeb146105a457600080fd5b80634dc610d41161022d5780634dc610d4146105085780634dcc19fe1461052857806353130e261461053b57600080fd5b806342cbb15c146104c7578063437b9116146104da57600080fd5b80631b1f24d8116102aa5780632d6a744e116102845780632d6a744e1461040e5780633408e4701461045a5780633adb35fe1461046d57600080fd5b80631b1f24d8146103b85780631d911b6d146103d9578063288ddb61146103f957600080fd5b8063044c9bd7116102db578063044c9bd71461034b57806318d6e2d4146103785780631a0a0b3e1461039857600080fd5b8062aae33f146102f65780630141ff4814610329575b600080fd5b34801561030257600080fd5b5061031661031136600461456c565b610a00565b6040519081526020015b60405180910390f35b34801561033557600080fd5b506103496103443660046145ae565b610ab4565b005b34801561035757600080fd5b506103166103663660046145ae565b60009081526001602052604090205490565b34801561038457600080fd5b506103496103933660046145c7565b610b8c565b3480156103a457600080fd5b506103166103b336600461466a565b610dfd565b6103cb6103c6366004614710565b610ec0565b60405161032092919061488d565b3480156103e557600080fd5b506103496103f43660046148af565b610f5e565b34801561040557600080fd5b50610316611150565b34801561041a57600080fd5b506104427f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610320565b34801561046657600080fd5b5046610316565b34801561047957600080fd5b506103166040517f417069334d61726b6574207369676e61747572652064656c65676174696f6e006020820152600090603f0160405160208183030381529060405280519060200120905090565b3480156104d357600080fd5b5043610316565b3480156104e657600080fd5b506104fa6104f536600461456c565b611196565b60405161032092919061496f565b34801561051457600080fd5b506103496105233660046145ae565b6112fc565b34801561053457600080fd5b5048610316565b34801561054757600080fd5b506104427f000000000000000000000000000000000000000000000000000000000000000081565b34801561057b57600080fd5b5061044261058a366004614994565b61141a565b34801561059b57600080fd5b506103166114d4565b3480156105b057600080fd5b506105ce6105bf3660046149f0565b6001600160a01b03163b151590565b6040519015158152602001610320565b3480156105ea57600080fd5b506103166105f9366004614a0d565b611505565b34801561060a57600080fd5b506103166106193660046145ae565b61156f565b34801561062a57600080fd5b50610349611625565b34801561063f57600080fd5b5042610316565b34801561065257600080fd5b506103166106613660046145ae565b60026020526000908152604090205481565b34801561067f57600080fd5b5061069361068e3660046145ae565b61166d565b6040516103209190614a43565b3480156106ac57600080fd5b506000546001600160a01b0316610442565b3480156106ca57600080fd5b506107146106d93660046145ae565b600360205260009081526040902080546001820154600290920154909163ffffffff8116916401000000009091046001600160e01b03169084565b6040805194855263ffffffff90931660208501526001600160e01b03909116918301919091526060820152608001610320565b34801561075357600080fd5b506103167f000000000000000000000000000000000000000000000000000000000000000081565b34801561078757600080fd5b50610442610796366004614a56565b61171c565b3480156107a757600080fd5b506103496107b6366004614a95565b6117d3565b6107ce6107c9366004614710565b611d6a565b60405161032093929190614ae5565b3480156107e957600080fd5b506103166107f83660046145ae565b60046020526000908152604090205481565b34801561081657600080fd5b5061082a61082536600461456c565b611e0d565b6040516103209190614b1b565b610316610845366004614b2e565b611f8e565b34801561085657600080fd5b506104427f000000000000000000000000000000000000000000000000000000000000000081565b34801561088a57600080fd5b50610316610899366004614bd9565b6121bc565b3480156108aa57600080fd5b506108be6108b93660046145ae565b612368565b604051610320989796959493929190614ca0565b3480156108de57600080fd5b506103166126ed565b3480156108f357600080fd5b5061091b6109023660046145ae565b6001602081905260009182526040909120805491015482565b60408051928352602083019190915201610320565b34801561093c57600080fd5b5061034961094b366004614d6b565b61271e565b34801561095c57600080fd5b5061097061096b3660046145ae565b61278f565b604051610320959493929190614d8d565b34801561098d57600080fd5b506103166201518081565b3480156109a457600080fd5b506103496109b33660046149f0565b612c83565b3480156109c457600080fd5b506103166109d33660046149f0565b6001600160a01b03163190565b3480156109ec57600080fd5b506103496109fb366004614ddb565b612ccb565b6040517eaae33f0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169062aae33f90610a689086908690600401614e34565b6020604051808303816000875af1158015610a87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aab9190614e86565b90505b92915050565b60008181526004602052604090205480610b155760405162461bcd60e51b815260206004820152601860248201527f537562736372697074696f6e20717565756520656d707479000000000000000060448201526064015b60405180910390fd5b6000818152600360205260409020600101544263ffffffff9091161115610b7e5760405162461bcd60e51b815260206004820152601e60248201527f43757272656e7420737562736372697074696f6e206e6f7420656e64656400006044820152606401610b0c565b610b888282612f32565b5050565b610b94613089565b82610be15760405162461bcd60e51b815260206004820152600e60248201527f486173682074797065207a65726f0000000000000000000000000000000000006044820152606401610b0c565b806000819003610c335760405162461bcd60e51b815260206004820152600d60248201527f5369676e65727320656d707479000000000000000000000000000000000000006044820152606401610b0c565b600083838281610c4557610c45614e9f565b9050602002016020810190610c5a91906149f0565b6001600160a01b031603610cb05760405162461bcd60e51b815260206004820152601960248201527f4669727374207369676e65722061646472657373207a65726f000000000000006044820152606401610b0c565b60015b81811015610d84578383610cc8600184614ecb565b818110610cd757610cd7614e9f565b9050602002016020810190610cec91906149f0565b6001600160a01b0316848483818110610d0757610d07614e9f565b9050602002016020810190610d1c91906149f0565b6001600160a01b031611610d725760405162461bcd60e51b815260206004820152601e60248201527f5369676e657273206e6f7420696e20617363656e64696e67206f7264657200006044820152606401610b0c565b80610d7c81614ede565b915050610cb3565b508282604051602001610d98929190614ef7565b60408051601f198184030181528282528051602091820120600088815260029092529190205584907f5a1f5ee4ceedd78b1982374b4790e8aa9f31e8af1c32aaef46b2afd8a789193a90610def9086908690614f39565b60405180910390a250505050565b6040517f1a0a0b3e0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690631a0a0b3e90610e71908b908b908b908b908b908b908b90600401614fb0565b6020604051808303816000875af1158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190614e86565b98975050505050505050565b60606000306001600160a01b031663ac9650d88e8e6040518363ffffffff1660e01b8152600401610ef2929190615000565b6000604051808303816000875af1158015610f11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f399190810190615204565b9150610f4c8b8b8b8b8b8b8b8b8b611f8e565b90509b509b9950505050505050505050565b610f6b85858585856130f4565b6040517f085df6ab0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063085df6ab90602401600060405180830381865afa158015610fea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110129190810190615239565b6040516020016110229190615282565b60405160208183030381529060405280519060200120848460405160200161104b92919061529e565b60405160208183030381529060405280519060200120036110ae5760405162461bcd60e51b815260206004820152601e60248201527f446f6573206e6f7420757064617465207369676e6564204150492055524c00006044820152606401610b0c565b6040517ffba8f22f0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fba8f22f90611117908890889088906004016152ae565b600060405180830381600087803b15801561113157600080fd5b505af1158015611145573d6000803e3d6000fd5b505050505050505050565b6040517f644150492070726963696e67204d65726b6c6520726f6f74000000000000000060208201526038015b6040516020818303038152906040528051906020012081565b606080828067ffffffffffffffff8111156111b3576111b361509c565b6040519080825280602002602001820160405280156111dc578160200160208202803683370190505b5092508067ffffffffffffffff8111156111f8576111f861509c565b60405190808252806020026020018201604052801561122b57816020015b60608152602001906001900390816112165790505b50915060005b818110156112f3573086868381811061124c5761124c614e9f565b905060200281019061125e91906152d1565b60405161126c92919061529e565b600060405180830381855af49150503d80600081146112a7576040519150601f19603f3d011682016040523d82523d6000602084013e6112ac565b606091505b508583815181106112bf576112bf614e9f565b602002602001018584815181106112d8576112d8614e9f565b60209081029190910101919091529015159052600101611231565b50509250929050565b611304613089565b60008181526004602052604090205461135f5760405162461bcd60e51b815260206004820152601860248201527f537562736372697074696f6e20717565756520656d70747900000000000000006044820152606401610b0c565b6000818152600460208190526040808320929092559051632412a9cb60e01b81529081018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632412a9cb90602401600060405180830381600087803b1580156113d457600080fd5b505af11580156113e8573d6000803e3d6000fd5b50506040518392507f07731f198aeecb61ff6de517fa82a003ba1bb3846140b23b62d7563dc2ddfb6a9150600090a250565b6040517f5849e5ef0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635849e5ef90611488908890889088908890600401615318565b6020604051808303816000875af11580156114a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cb919061534b565b95945050505050565b6040517f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000006020820152603b0161117d565b6040517f5d8681940000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635d86819490610a689086908690600401615368565b60008061157b4261323a565b600084815260046020526040812054919250905b801561161d576000818152600360205260409020600181015490925063ffffffff1642811115611611576001830154620151809064010000000090046001600160e01b03166115de868461537c565b63ffffffff166115ee91906153a0565b6115f891906153e8565b61160b906001600160e01b03168661540e565b94508093505b5050600281015461158f565b505050919050565b60405162461bcd60e51b815260206004820152601d60248201527f4f776e6572736869702063616e6e6f742062652072656e6f756e6365640000006044820152606401610b0c565b60008181526003602090815260408083205483526005909152902080546060919061169790615421565b80601f01602080910402602001604051908101604052809291908181526020018280546116c390615421565b80156117105780601f106116e557610100808354040283529160200191611710565b820191906000526020600020905b8154815290600101906020018083116116f357829003601f168201915b50505050509050919050565b6040517f9ae06c840000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ae06c84906117889087908790879060040161545b565b6020604051808303816000875af11580156117a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cb919061534b565b949350505050565b836118205760405162461bcd60e51b815260206004820152600f60248201527f486173682076616c7565207a65726f00000000000000000000000000000000006044820152606401610b0c565b428311156118705760405162461bcd60e51b815260206004820152601a60248201527f486173682074696d657374616d702066726f6d206675747572650000000000006044820152606401610b0c565b6000858152600160208190526040909120015483116118d15760405162461bcd60e51b815260206004820152601e60248201527f486173682074696d657374616d70206e6f74206d6f726520726563656e7400006044820152606401610b0c565b6000858152600260205260409020548061192d5760405162461bcd60e51b815260206004820152600f60248201527f5369676e657273206e6f742073657400000000000000000000000000000000006044820152606401610b0c565b8160008167ffffffffffffffff8111156119495761194961509c565b604051908082528060200260200182016040528015611972578160200160208202803683370190505b5060408051602081018b9052908101899052606081018890529091506000906119e2906080015b604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b905060005b83811015611c7c576000878783818110611a0357611a03614e9f565b9050602002810190611a1591906152d1565b9150506040198101611aba57611a8383898985818110611a3757611a37614e9f565b9050602002810190611a4991906152d1565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132ba92505050565b848381518110611a9557611a95614e9f565b60200260200101906001600160a01b031690816001600160a01b031681525050611c69565b6101608103611c215760008060008a8a86818110611ada57611ada614e9f565b9050602002810190611aec91906152d1565b810190611af991906154c6565b925092509250824210611b4e5760405162461bcd60e51b815260206004820152601060248201527f44656c65676174696f6e20656e646564000000000000000000000000000000006044820152606401610b0c565b611be7611be1611ba16040517f417069334d61726b6574207369676e61747572652064656c65676174696f6e006020820152600090603f0160405160208183030381529060405280519060200120905090565b611bab89856132ba565b866040516020016119999392919092835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b836132ba565b878681518110611bf957611bf9614e9f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050611c69565b60405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207369676e6174757265206c656e67746800000000000000006044820152606401610b0c565b5080611c7481614ede565b9150506119e7565b5081604051602001611c8e9190615533565b604051602081830303815290604052805190602001208414611cf25760405162461bcd60e51b815260206004820152601260248201527f5369676e6174757265206d69736d6174636800000000000000000000000000006044820152606401610b0c565b60408051808201825289815260208082018a815260008d815260019283905284902092518355519101555189907fa33e8931ee2a869317bbe04201dab2907fd39d2d7f014c15b8459986e62c279190611d57908b908b90918252602082015260400190565b60405180910390a2505050505050505050565b6060806000306001600160a01b031663437b91168f8f6040518363ffffffff1660e01b8152600401611d9d929190615000565b6000604051808303816000875af1158015611dbc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de49190810190615582565b9093509150611dfa8c8c8c8c8c8c8c8c8c611f8e565b90509b509b509b98505050505050505050565b6060818067ffffffffffffffff811115611e2957611e2961509c565b604051908082528060200260200182016040528015611e5c57816020015b6060815260200190600190039081611e475790505b50915060005b81811015611f8657600030868684818110611e7f57611e7f614e9f565b9050602002810190611e9191906152d1565b604051611e9f92919061529e565b600060405180830381855af49150503d8060008114611eda576040519150601f19603f3d011682016040523d82523d6000602084013e611edf565b606091505b50858481518110611ef257611ef2614e9f565b6020908102919091010152905080611f7d576000848381518110611f1857611f18614e9f565b60200260200101519050600081511115611f355780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e6700000000006044820152606401610b0c565b50600101611e62565b505092915050565b600088611fdd5760405162461bcd60e51b815260206004820152601160248201527f446174612066656564204944207a65726f0000000000000000000000000000006044820152606401610b0c565b6001600160a01b0388166120335760405162461bcd60e51b815260206004820152601b60248201527f53706f6e736f722077616c6c65742061646472657373207a65726f00000000006044820152606401610b0c565b6120448a8a8a8a8a8a8a8a8a6132de565b6120528a8a89898989613643565b905061205d8a61156f565b612071346001600160a01b038b163161540e565b10156120bf5760405162461bcd60e51b815260206004820152601460248201527f496e73756666696369656e74207061796d656e740000000000000000000000006044820152606401610b0c565b808a7fd44e8abecc305a9434d27a049c731a8331cee8bca6496154f47835b396ce55068b8b8b8b8b8b346040516120fc9796959493929190615645565b60405180910390a334156121af576000886001600160a01b03163460405160006040518083038185875af1925050503d8060008114612157576040519150601f19603f3d011682016040523d82523d6000602084013e61215c565b606091505b50509050806121ad5760405162461bcd60e51b815260206004820152601560248201527f5472616e7366657220756e7375636365737366756c00000000000000000000006044820152606401610b0c565b505b9998505050505050505050565b60006060841461220e5760405162461bcd60e51b815260206004820181905260248201527f55706461746520706172616d6574657273206c656e67746820696e76616c69646044820152606401610b0c565b6000806000806122208a8a8a8a613a7a565b9350935093509350600087876201518061223a919061568d565b61224491906156a4565b905060006122514261323a565b90506000841561226f5760008d815260046020526040902054612271565b865b90505b8015612358578681036122c1576201518083612290848961537c565b63ffffffff166122a0919061568d565b6122aa91906156a4565b6122b4908961540e565b9750859150839050612274565b6000818152600360205260409020600181015463ffffffff164281111561233a576001820154620151809064010000000090046001600160e01b0316612307868461537c565b63ffffffff1661231791906153a0565b61232191906153e8565b612334906001600160e01b03168b61540e565b99508093505b82870361234957889250612351565b816002015492505b5050612274565b5050505050505095945050505050565b6060600080606080606080606060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663472c22f18b6040516020016123b991815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016123ed91815260200190565b602060405180830381865afa15801561240a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242e9190614e86565b90506124398161278f565b60008f815260046020526040812054959e50939c50919a5098509650905b8015612484578161246781614ede565b600092835260036020526040909220600201549192506124579050565b508067ffffffffffffffff81111561249e5761249e61509c565b6040519080825280602002602001820160405280156124d157816020015b60608152602001906001900390816124bc5790505b5094508067ffffffffffffffff8111156124ed576124ed61509c565b604051908082528060200260200182016040528015612516578160200160208202803683370190505b5093508067ffffffffffffffff8111156125325761253261509c565b60405190808252806020026020018201604052801561255b578160200160208202803683370190505b5060008c8152600460209081526040808320548352600390915281209194505b828110156126de5781546000908152600560205260409020805461259e90615421565b80601f01602080910402602001604051908101604052809291908181526020018280546125ca90615421565b80156126175780601f106125ec57610100808354040283529160200191612617565b820191906000526020600020905b8154815290600101906020018083116125fa57829003601f168201915b505050505087828151811061262e5761262e614e9f565b60209081029190910101526001820154865163ffffffff9091169087908390811061265b5761265b614e9f565b602002602001019063ffffffff16908163ffffffff16815250508160010160049054906101000a90046001600160e01b031685828151811061269f5761269f614e9f565b6001600160e01b0390921660209283029190910182015260029092015460009081526003909252604090912090806126d681614ede565b91505061257b565b50505050919395975091939597565b6040517f5369676e6564204150492055524c204d65726b6c6520726f6f740000000000006020820152603a0161117d565b612726613089565b604080518082018252828152426020808301828152600087815260018084529086902094518555905193019290925582518481529182015283917f19cb5bc6996c2541fb44252778e9c8c952662cce4670a75a4174b50c765bd7d1910160405180910390a25050565b60606000806060807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636e85b69a876040518263ffffffff1660e01b81526004016127e591815260200190565b600060405180830381865afa158015612802573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261282a91908101906156b8565b6040516367a7cfb760e01b8152600481018890529095507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906367a7cfb7906024016040805180830381865afa158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b591906156fc565b86519195509350603f1901612a4f57604080516001808252818301909252906020808301908036833750506040805160018082528183019092529294509050602080830190803683370190505090506000808680602001905181019061291b919061573f565b915091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166367a7cfb761299a84846040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6040518263ffffffff1660e01b81526004016129b891815260200190565b6040805180830381865afa1580156129d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f891906156fc565b85600081518110612a0b57612a0b614e9f565b6020026020010185600081518110612a2557612a25614e9f565b602002602001018263ffffffff1663ffffffff1681525082601b0b601b0b81525050505050612c7a565b845115612c7a5760008086806020019051810190612a6d91906157c8565b815191935091508067ffffffffffffffff811115612a8d57612a8d61509c565b604051908082528060200260200182016040528015612ab6578160200160208202803683370190505b5094508067ffffffffffffffff811115612ad257612ad261509c565b604051908082528060200260200182016040528015612afb578160200160208202803683370190505b50935060005b81811015612c75577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166367a7cfb7612bb6868481518110612b4d57612b4d614e9f565b6020026020010151868581518110612b6757612b67614e9f565b60200260200101516040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6040518263ffffffff1660e01b8152600401612bd491815260200190565b6040805180830381865afa158015612bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1491906156fc565b878381518110612c2657612c26614e9f565b60200260200101878481518110612c3f57612c3f614e9f565b602002602001018263ffffffff1663ffffffff1681525082601b0b601b0b81525050508080612c6d90614ede565b915050612b01565b505050505b91939590929450565b60405162461bcd60e51b815260206004820152601f60248201527f4f776e6572736869702063616e6e6f74206265207472616e73666572726564006044820152606401610b0c565b8315612d2c576001600160a01b038316612d275760405162461bcd60e51b815260206004820152601b60248201527f53706f6e736f722077616c6c65742061646472657373207a65726f00000000006044820152606401610b0c565b612d83565b6001600160a01b03831615612d835760405162461bcd60e51b815260206004820152601f60248201527f53706f6e736f722077616c6c65742061646472657373206e6f74207a65726f006044820152606401610b0c565b612d908585858585613ceb565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663472c22f187604051602001612dd491815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401612e0891815260200190565b602060405180830381865afa158015612e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e499190614e86565b9050848103612e9a5760405162461bcd60e51b815260206004820152601960248201527f446f6573206e6f74207570646174652064415049206e616d65000000000000006044820152606401610b0c565b8415612ea957612ea985613e17565b6040516391eed08560e01b815260048101879052602481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906391eed08590604401600060405180830381600087803b158015612f1257600080fd5b505af1158015612f26573d6000803e3d6000fd5b50505050505050505050565b5b6000908152600360205260409020600201548015801590612f6d57506000818152600360205260409020600101544263ffffffff90911611155b612f3357604051819083907fe08aff0930a0c84c077d2ce7e690a3f910c0f8705376b2405816efb89b9869b790600090a360008281526004602052604090208190558061303357604051632412a9cb60e01b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632412a9cb906024015b600060405180830381600087803b15801561301757600080fd5b505af115801561302b573d6000803e3d6000fd5b505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d23bab148361306c8461166d565b6040518363ffffffff1660e01b8152600401612ffd929190615883565b3361309c6000546001600160a01b031690565b6001600160a01b0316146130f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0c565b565b600080613103838501856158f7565b91509150816001600060405160200161313f907f5369676e6564204150492055524c204d65726b6c6520726f6f740000000000008152601a0190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146131a35760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b6131f581838989896040516020016131bd939291906152ae565b60408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120613ff6565b6132315760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b50505050505050565b600063ffffffff8211156132b65760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608401610b0c565b5090565b60008060006132c9858561400e565b915091506132d681614053565b509392505050565b8861332b5760405162461bcd60e51b815260206004820152600e60248201527f64415049206e616d65207a65726f0000000000000000000000000000000000006044820152606401610b0c565b6060851461337b5760405162461bcd60e51b815260206004820181905260248201527f55706461746520706172616d6574657273206c656e67746820696e76616c69646044820152606401610b0c565b836000036133cb5760405162461bcd60e51b815260206004820152600d60248201527f4475726174696f6e207a65726f000000000000000000000000000000000000006044820152606401610b0c565b8260000361341b5760405162461bcd60e51b815260206004820152600a60248201527f5072696365207a65726f000000000000000000000000000000000000000000006044820152606401610b0c565b600080808061342c85870187615934565b9350935093509350836001600060405160200161346c907f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000008152601b0190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146134d05760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b60408051602081018f90529081018d90526001600160a01b038c16606082015261350090849086906080016131bd565b61353c5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b8160016000604051602001613574907f644150492070726963696e67204d65726b6c6520726f6f740000000000000000815260180190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146135d85760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b6135f881838f468e8e8e8e6040516020016131bd969594939291906159ab565b6136345760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b50505050505050505050505050565b6000806000806136558a898989613a7a565b60405193975091955093509150600090613672908a908a9061529e565b6040518091039020905060056000828152602001908152602001600020805461369a90615421565b90506000036136be5760008181526005602052604090206136bc898b83615a2b565b505b6040805160808101825282815263ffffffff861660208201529081016136fa896136eb8a6201518061568d565b6136f591906156a4565b6141bb565b6001600160e01b03908116825260209182018590526000888152600383526040908190208451815592840151908401519091166401000000000263ffffffff909116176001820155606090910151600290910155826138da5760008b81526004602052604090205485146137a75760405185908c907fe08aff0930a0c84c077d2ce7e690a3f910c0f8705376b2405816efb89b9869b790600090a360008b81526004602052604090208590555b6040517fd23bab140000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d23bab1490613810908e908d908d9060040161545b565b600060405180830381600087803b15801561382a57600080fd5b505af115801561383e573d6000803e3d6000fd5b50506040517fbe3cc74d000000000000000000000000000000000000000000000000000000008152600481018e90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316925063be3cc74d9150602401600060405180830381600087803b1580156138bd57600080fd5b505af11580156138d1573d6000803e3d6000fd5b50505050613924565b60008381526003602081815260408084206002018990558e8452600482528084205480855292909152909120600101544263ffffffff90911611613922576139228c82612f32565b505b61392d8a613e17565b897f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663472c22f18d60405160200161397091815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016139a491815260200190565b602060405180830381865afa1580156139c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139e59190614e86565b14613a6c576040516391eed08560e01b8152600481018c9052602481018b90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906391eed08590604401600060405180830381600087803b158015613a5357600080fd5b505af1158015613a67573d6000803e3d6000fd5b505050505b505050509695505050505050565b600080600080878787604051613a9192919061529e565b604051908190038120613ab09291602001918252602082015260400190565b604051602081830303815290604052805190602001209350613adc8542613ad7919061540e565b61323a565b925060008080613aee898b018b615aec565b60008e81526004602052604081205493965091945092509081905b8015613c6b5760008181526003602052604081208054909350613b319088908890889061423a565b60018085015491925063ffffffff90911690826002811115613b5557613b55615b24565b1480613b6c57508063ffffffff168b63ffffffff16115b613bb85760405162461bcd60e51b815260206004820152601d60248201527f537562736372697074696f6e20646f6573206e6f7420757067726164650000006044820152606401610b0c565b6002826002811115613bcc57613bcc615b24565b148015613bde5750428163ffffffff16115b15613bf5578299508480613bf190614ede565b9550505b6001826002811115613c0957613c09615b24565b148015613c2157508063ffffffff168b63ffffffff16105b15613c5e578298505b8215613c575784613c3a81614ede565b60009485526003602052604090942060020154939550613c2a9050565b5050613c6b565b5050506002810154613b09565b507f00000000000000000000000000000000000000000000000000000000000000008210613cdb5760405162461bcd60e51b815260206004820152601760248201527f537562736372697074696f6e2071756575652066756c6c0000000000000000006044820152606401610b0c565b5050505050945094509450949050565b84613d385760405162461bcd60e51b815260206004820152600e60248201527f64415049206e616d65207a65726f0000000000000000000000000000000000006044820152606401610b0c565b600080613d47838501856158f7565b915091508160016000604051602001613d83907f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000008152601b0190565b6040516020818303038152906040528051906020012081526020019081526020016000206000015414613de75760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b60408051602081018990529081018790526001600160a01b03861660608201526131f590829084906080016131bd565b6040516367a7cfb760e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906367a7cfb7906024016040805180830381865afa158015613e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea291906156fc565b9150613eb990506201518063ffffffff831661540e565b421115613f085760405162461bcd60e51b815260206004820152601560248201527f4461746120666565642076616c7565207374616c6500000000000000000000006044820152606401610b0c565b6040517f7a821819000000000000000000000000000000000000000000000000000000008152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690637a82181990602401602060405180830381865afa158015613f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613faa9190615b3a565b610b885760405162461bcd60e51b815260206004820152601860248201527f446174612066656564206e6f74207265676973746572656400000000000000006044820152606401610b0c565b60008261400385846143ef565b1490505b9392505050565b60008082516041036140445760208301516040840151606085015160001a61403887828585614434565b9450945050505061404c565b506000905060025b9250929050565b600081600481111561406757614067615b24565b0361406f5750565b600181600481111561408357614083615b24565b036140d05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b0c565b60028160048111156140e4576140e4615b24565b036141315760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b0c565b600381600481111561414557614145615b24565b036141b85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610b0c565b50565b60006001600160e01b038211156132b65760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152608401610b0c565b600081815260056020526040812080548291829182919061425a90615421565b80601f016020809104026020016040519081016040528092919081815260200182805461428690615421565b80156142d35780601f106142a8576101008083540402835291602001916142d3565b820191906000526020600020905b8154815290600101906020018083116142b657829003601f168201915b50505050508060200190518101906142eb9190615b55565b92509250925081601b0b87601b0b146143465760405162461bcd60e51b815260206004820152601e60248201527f446576696174696f6e207265666572656e636573206e6f7420657175616c00006044820152606401610b0c565b828814801561435457508086145b1561436557600093505050506117cb565b8288111580156143755750808611155b1561438657600193505050506117cb565b8288101580156143965750808610155b156143a757600293505050506117cb565b60405162461bcd60e51b815260206004820152601e60248201527f55706461746520706172616d657465727320696e636f6d70617261626c6500006044820152606401610b0c565b600081815b84518110156132d6576144208286838151811061441357614413614e9f565b60200260200101516144f8565b91508061442c81614ede565b9150506143f4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446b57506000905060036144ef565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144bf573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144e8576000600192509250506144ef565b9150600090505b94509492505050565b6000818310614514576000828152602084905260409020610aab565b6000838152602083905260409020610aab565b60008083601f84011261453957600080fd5b50813567ffffffffffffffff81111561455157600080fd5b6020830191508360208260051b850101111561404c57600080fd5b6000806020838503121561457f57600080fd5b823567ffffffffffffffff81111561459657600080fd5b6145a285828601614527565b90969095509350505050565b6000602082840312156145c057600080fd5b5035919050565b6000806000604084860312156145dc57600080fd5b83359250602084013567ffffffffffffffff8111156145fa57600080fd5b61460686828701614527565b9497909650939450505050565b6001600160a01b03811681146141b857600080fd5b60008083601f84011261463a57600080fd5b50813567ffffffffffffffff81111561465257600080fd5b60208301915083602082850101111561404c57600080fd5b600080600080600080600060a0888a03121561468557600080fd5b873561469081614613565b96506020880135955060408801359450606088013567ffffffffffffffff808211156146bb57600080fd5b6146c78b838c01614628565b909650945060808a01359150808211156146e057600080fd5b506146ed8a828b01614628565b989b979a50959850939692959293505050565b803561470b81614613565b919050565b60008060008060008060008060008060006101008c8e03121561473257600080fd5b67ffffffffffffffff808d35111561474957600080fd5b6147568e8e358f01614527565b909c509a5060208d0135995060408d0135985061477560608e01614700565b97508060808e0135111561478857600080fd5b6147988e60808f01358f01614628565b909750955060a08d0135945060c08d0135935060e08d01358110156147bc57600080fd5b506147cd8d60e08e01358e01614628565b81935080925050509295989b509295989b9093969950565b60005b838110156148005781810151838201526020016147e8565b50506000910152565b600081518084526148218160208601602086016147e5565b601f01601f19169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b8481101561488057601f1986840301895261486e838351614809565b98840198925090830190600101614852565b5090979650505050505050565b6040815260006148a06040830185614835565b90508260208301529392505050565b6000806000806000606086880312156148c757600080fd5b85356148d281614613565b9450602086013567ffffffffffffffff808211156148ef57600080fd5b6148fb89838a01614628565b9096509450604088013591508082111561491457600080fd5b5061492188828901614628565b969995985093965092949392505050565b600081518084526020808501945080840160005b83811015614964578151151587529582019590820190600101614946565b509495945050505050565b6040815260006149826040830185614932565b82810360208401526114cb8185614835565b600080600080606085870312156149aa57600080fd5b8435935060208501356149bc81614613565b9250604085013567ffffffffffffffff8111156149d857600080fd5b6149e487828801614628565b95989497509550505050565b600060208284031215614a0257600080fd5b813561400781614613565b60008060208385031215614a2057600080fd5b823567ffffffffffffffff811115614a3757600080fd5b6145a285828601614628565b602081526000610aab6020830184614809565b600080600060408486031215614a6b57600080fd5b83359250602084013567ffffffffffffffff811115614a8957600080fd5b61460686828701614628565b600080600080600060808688031215614aad57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff811115614ad957600080fd5b61492188828901614527565b606081526000614af86060830186614932565b8281036020840152614b0a8186614835565b915050826040830152949350505050565b602081526000610aab6020830184614835565b600080600080600080600080600060e08a8c031215614b4c57600080fd5b8935985060208a0135975060408a0135614b6581614613565b965060608a013567ffffffffffffffff80821115614b8257600080fd5b614b8e8d838e01614628565b909850965060808c0135955060a08c0135945060c08c0135915080821115614bb557600080fd5b50614bc28c828d01614628565b915080935050809150509295985092959850929598565b600080600080600060808688031215614bf157600080fd5b85359450602086013567ffffffffffffffff811115614c0f57600080fd5b614c1b88828901614628565b9699909850959660408101359660609091013595509350505050565b600081518084526020808501945080840160005b83811015614964578151601b0b87529582019590820190600101614c4b565b600081518084526020808501945080840160005b8381101561496457815163ffffffff1687529582019590820190600101614c7e565b6000610100808352614cb48184018c614809565b905060208a601b0b8185015263ffffffff8a1660408501528382036060850152614cde828a614c37565b91508382036080850152614cf28289614c6a565b915083820360a0850152614d068288614835565b915083820360c0850152614d1a8287614c6a565b84810360e0860152855180825282870193509082019060005b81811015614d585784516001600160e01b031683529383019391830191600101614d33565b50909d9c50505050505050505050505050565b60008060408385031215614d7e57600080fd5b50508035926020909101359150565b60a081526000614da060a0830188614809565b86601b0b602084015263ffffffff861660408401528281036060840152614dc78186614c37565b90508281036080840152610eb48185614c6a565b600080600080600060808688031215614df357600080fd5b85359450602086013593506040860135614e0c81614613565b9250606086013567ffffffffffffffff811115614e2857600080fd5b61492188828901614628565b6020815281602082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614e6d57600080fd5b8260051b80856040850137919091016040019392505050565b600060208284031215614e9857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610aae57610aae614eb5565b600060018201614ef057614ef0614eb5565b5060010190565b60008184825b85811015614f2e578135614f1081614613565b6001600160a01b031683526020928301929190910190600101614efd565b509095945050505050565b60208082528181018390526000908460408401835b86811015614f7c578235614f6181614613565b6001600160a01b031682529183019190830190600101614f4e565b509695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038816815286602082015285604082015260a060608201526000614fdf60a083018688614f87565b8281036080840152614ff2818587614f87565b9a9950505050505050505050565b60208082528181018390526000906040600585901b8401810190840186845b8781101561508f57868403603f190183528135368a9003601e1901811261504557600080fd5b8901858101903567ffffffffffffffff81111561506157600080fd5b80360382131561507057600080fd5b61507b868284614f87565b95505050918401919084019060010161501f565b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156150db576150db61509c565b604052919050565b600067ffffffffffffffff8211156150fd576150fd61509c565b5060051b60200190565b600067ffffffffffffffff8211156151215761512161509c565b50601f01601f191660200190565b600061514261513d84615107565b6150b2565b905082815283838301111561515657600080fd5b6140078360208301846147e5565b600082601f83011261517557600080fd5b610aab8383516020850161512f565b600082601f83011261519557600080fd5b815160206151a561513d836150e3565b82815260059290921b840181019181810190868411156151c457600080fd5b8286015b84811015614f7c57805167ffffffffffffffff8111156151e85760008081fd5b6151f68986838b0101615164565b8452509183019183016151c8565b60006020828403121561521657600080fd5b815167ffffffffffffffff81111561522d57600080fd5b6117cb84828501615184565b60006020828403121561524b57600080fd5b815167ffffffffffffffff81111561526257600080fd5b8201601f8101841361527357600080fd5b6117cb8482516020840161512f565b600082516152948184602087016147e5565b9190910192915050565b8183823760009101908152919050565b6001600160a01b03841681526040602082015260006114cb604083018486614f87565b6000808335601e198436030181126152e857600080fd5b83018035915067ffffffffffffffff82111561530357600080fd5b60200191503681900382131561404c57600080fd5b8481526001600160a01b0384166020820152606060408201526000615341606083018486614f87565b9695505050505050565b60006020828403121561535d57600080fd5b815161400781614613565b6020815260006117cb602083018486614f87565b63ffffffff82811682821603908082111561539957615399614eb5565b5092915050565b6001600160e01b038281168282168181028316929181158285048214176153c9576153c9614eb5565b50505092915050565b634e487b7160e01b600052601260045260246000fd5b60006001600160e01b0380841680615402576154026153d2565b92169190910492915050565b80820180821115610aae57610aae614eb5565b600181811c9082168061543557607f821691505b60208210810361545557634e487b7160e01b600052602260045260246000fd5b50919050565b8381526040602082015260006114cb604083018486614f87565b600082601f83011261548657600080fd5b813561549461513d82615107565b8181528460208386010111156154a957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156154db57600080fd5b83359250602084013567ffffffffffffffff808211156154fa57600080fd5b61550687838801615475565b9350604086013591508082111561551c57600080fd5b5061552986828701615475565b9150509250925092565b815160009082906020808601845b838110156155665781516001600160a01b031685529382019390820190600101615541565b50929695505050505050565b8051801515811461470b57600080fd5b6000806040838503121561559557600080fd5b825167ffffffffffffffff808211156155ad57600080fd5b818501915085601f8301126155c157600080fd5b815160206155d161513d836150e3565b82815260059290921b840181019181810190898411156155f057600080fd5b948201945b838610156156155761560686615572565b825294820194908201906155f5565b9188015191965090935050508082111561562e57600080fd5b5061563b85828601615184565b9150509250929050565b8781526001600160a01b038716602082015260c06040820152600061566e60c083018789614f87565b606083019590955250608081019290925260a090910152949350505050565b8082028115828204841417610aae57610aae614eb5565b6000826156b3576156b36153d2565b500490565b6000602082840312156156ca57600080fd5b815167ffffffffffffffff8111156156e157600080fd5b6117cb84828501615164565b80601b0b81146141b857600080fd5b6000806040838503121561570f57600080fd5b825161571a816156ed565b602084015190925063ffffffff8116811461573457600080fd5b809150509250929050565b6000806040838503121561575257600080fd5b825161575d81614613565b6020939093015192949293505050565b600082601f83011261577e57600080fd5b8151602061578e61513d836150e3565b82815260059290921b840181019181810190868411156157ad57600080fd5b8286015b84811015614f7c57805183529183019183016157b1565b600080604083850312156157db57600080fd5b825167ffffffffffffffff808211156157f357600080fd5b818501915085601f83011261580757600080fd5b8151602061581761513d836150e3565b82815260059290921b8401810191818101908984111561583657600080fd5b948201945b8386101561585d57855161584e81614613565b8252948201949082019061583b565b9188015191965090935050508082111561587657600080fd5b5061563b8582860161576d565b8281526040602082015260006117cb6040830184614809565b600082601f8301126158ad57600080fd5b813560206158bd61513d836150e3565b82815260059290921b840181019181810190868411156158dc57600080fd5b8286015b84811015614f7c57803583529183019183016158e0565b6000806040838503121561590a57600080fd5b82359150602083013567ffffffffffffffff81111561592857600080fd5b61563b8582860161589c565b6000806000806080858703121561594a57600080fd5b84359350602085013567ffffffffffffffff8082111561596957600080fd5b6159758883890161589c565b945060408701359350606087013591508082111561599257600080fd5b5061599f8782880161589c565b91505092959194509250565b86815285602082015260a0604082015260006159cb60a083018688614f87565b60608301949094525060800152949350505050565b601f821115615a2657600081815260208120601f850160051c81016020861015615a075750805b601f850160051c820191505b8181101561302b57828155600101615a13565b505050565b67ffffffffffffffff831115615a4357615a4361509c565b615a5783615a518354615421565b836159e0565b6000601f841160018114615a8b5760008515615a735750838201355b600019600387901b1c1916600186901b178355615ae5565b600083815260209020601f19861690835b82811015615abc5786850135825560209485019460019092019101615a9c565b5086821015615ad95760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600080600060608486031215615b0157600080fd5b833592506020840135615b13816156ed565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615b4c57600080fd5b610aab82615572565b600080600060608486031215615b6a57600080fd5b835192506020840151615b7c816156ed565b8092505060408401519050925092509256fea26469706673582212208b53988bfa717d03290f27f19d081f4269b84b13a8d932044f3292cb485694a964736f6c6343000811003360a06040523480156200001157600080fd5b5060405162002c7c38038062002c7c833981016040819052620000349162000173565b6200003f3362000106565b6001600160a01b038216620000905760405162461bcd60e51b81526020600482015260126024820152714f776e65722061646472657373207a65726f60701b60448201526064015b60405180910390fd5b6001600160a01b038116620000e85760405162461bcd60e51b815260206004820152601960248201527f4170693353657276657256312061646472657373207a65726f00000000000000604482015260640162000087565b620000f38262000106565b6001600160a01b031660805250620001ab565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200016e57600080fd5b919050565b600080604083850312156200018757600080fd5b620001928362000156565b9150620001a26020840162000156565b90509250929050565b608051612a99620001e36000396000818161025e01528181611327015281816114b7015281816115cb01526118b60152612a996000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063796b89b91161010f578063be3cc74d116100a2578063ddb2575211610071578063ddb2575214610420578063f2fde38b14610433578063f8b2cb4f14610446578063fba8f22f1461046157600080fd5b8063be3cc74d146103ca578063d23bab14146103dd578063d3cc6647146103f0578063d4a66d921461041857600080fd5b80638f634751116100de5780638f6347511461037c57806391af241114610384578063ac9650d814610397578063b07a0c2f146103b757600080fd5b8063796b89b91461033f5780637a821819146103455780637ca50e85146103585780638da5cb5b1461036b57600080fd5b806342cbb15c116101875780635d868194116101565780635d868194146103095780636e85b69a1461031c578063715018a61461032f578063773f2edc1461033757600080fd5b806342cbb15c146102af578063437b9116146102b55780634dcc19fe146102d65780635989eaeb146102dc57600080fd5b80632d6a744e116101c35780632d6a744e146102595780633408e4701461029857806336b7840d1461029e5780633aad52b9146102a757600080fd5b8063074244ce146101f5578063085df6ab146102115780631761c219146102315780632412a9cb14610246575b600080fd5b6101fe61010081565b6040519081526020015b60405180910390f35b61022461021f366004611f36565b610474565b6040516102089190611fa0565b61024461023f366004611ffc565b61050e565b005b610244610254366004612048565b610679565b6102807f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610208565b466101fe565b6101fe61040081565b6101fe601581565b436101fe565b6102c86102c3366004612061565b610700565b60405161020892919061212e565b486101fe565b6102f96102ea366004611f36565b6001600160a01b03163b151590565b6040519015158152602001610208565b6101fe610317366004612187565b610866565b61022461032a366004612048565b610cec565b610244610d05565b6101fe610d4d565b426101fe565b6102f9610353366004612048565b610d5e565b610224610366366004612048565b610d80565b6000546001600160a01b0316610280565b6101fe610e2f565b610244610392366004612048565b610e4b565b6103aa6103a5366004612061565b610ed3565b60405161020891906121c9565b6102446103c5366004612048565b611054565b6102446103d8366004612048565b6110dd565b6102446103eb366004611ffc565b611163565b6104036103fe366004612048565b6112b4565b60405161020899989796959493929190612272565b6101fe611ac8565b61022461042e366004612048565b611ad4565b610244610441366004611f36565b611afe565b6101fe610454366004611f36565b6001600160a01b03163190565b61024461046f366004612331565b611b46565b6001602052600090815260409020805461048d9061236d565b80601f01602080910402602001604051908101604052809291908181526020018280546104b99061236d565b80156105065780601f106104db57610100808354040283529160200191610506565b820191906000526020600020905b8154815290600101906020018083116104e957829003601f168201915b505050505081565b610516611cef565b828061055d5760405162461bcd60e51b8152602060048201526011602482015270446174612066656564204944207a65726f60781b60448201526064015b60405180910390fd5b82826104008111156105b15760405162461bcd60e51b815260206004820152601a60248201527f55706461746520706172616d657465727320746f6f206c6f6e670000000000006044820152606401610554565b600085856040516105c39291906123a7565b60405180910390209050806007600089815260200190815260200160002054146106705760008781526007602090815260408083208490558383526009909152902080548691906106139061236d565b90501461063557600081815260096020526040902061063386888361241b565b505b867f0aea1ab3b222f6786a08c16b8f93ba421dfe07d2511afa7250ec3e9163b0b4208787604051610667929190612505565b60405180910390a25b50505050505050565b610681611cef565b80806106c05760405162461bcd60e51b815260206004820152600e60248201526d64415049206e616d65207a65726f60901b6044820152606401610554565b6106cb600583611d4b565b156106fc5760405182907ff9f5c4d39275e5bd5f3c5c8c55bc35400693aeb978d180b545f88580dc4e1e7790600090a25b5050565b606080828067ffffffffffffffff81111561071d5761071d6123b7565b604051908082528060200260200182016040528015610746578160200160208202803683370190505b5092508067ffffffffffffffff811115610762576107626123b7565b60405190808252806020026020018201604052801561079557816020015b60608152602001906001900390816107805790505b50915060005b8181101561085d57308686838181106107b6576107b6612521565b90506020028101906107c89190612537565b6040516107d69291906123a7565b600060405180830381855af49150503d8060008114610811576040519150601f19603f3d011682016040523d82523d6000602084013e610816565b606091505b5085838151811061082957610829612521565b6020026020010185848151811061084257610842612521565b6020908102919091010191909152901515905260010161079b565b50509250929050565b600081603f198101610925576000806108818587018761257e565b90925090506001600160a01b0382166108dc5760405162461bcd60e51b815260206004820152601460248201527f4169726e6f64652061646472657373207a65726f0000000000000000000000006044820152606401610554565b60408051606084901b6bffffffffffffffffffffffff19166020808301919091526034808301859052835180840390910181526054909201909252805191012093505050610c6d565b6101008110610c255761093a601560206125c0565b6109459060206125d7565b610951601560206125c0565b61095c9060206125d7565b6109679060406125d7565b61097191906125d7565b8111156109c05760405162461bcd60e51b815260206004820152601a60248201527f4461746120666565642064657461696c7320746f6f206c6f6e670000000000006044820152606401610554565b6000806109cf858701876126aa565b915091508282826040516020016109e792919061279c565b6040516020818303038152906040525114610a445760405162461bcd60e51b815260206004820152601760248201527f4461746120666565642064657461696c7320747261696c0000000000000000006044820152606401610554565b815181518114610a965760405162461bcd60e51b815260206004820152601960248201527f506172616d65746572206c656e677468206d69736d61746368000000000000006044820152606401610554565b60008167ffffffffffffffff811115610ab157610ab16123b7565b604051908082528060200260200182016040528015610ada578160200160208202803683370190505b50905060005b82811015610c105760006001600160a01b0316858281518110610b0557610b05612521565b60200260200101516001600160a01b031603610b635760405162461bcd60e51b815260206004820152601460248201527f4169726e6f64652061646472657373207a65726f0000000000000000000000006044820152606401610554565b610be1858281518110610b7857610b78612521565b6020026020010151858381518110610b9257610b92612521565b60200260200101516040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b828281518110610bf357610bf3612521565b602090810291909101015280610c08816127f2565b915050610ae0565b50610c1a81611d60565b955050505050610c6d565b60405162461bcd60e51b815260206004820152601b60248201527f4461746120666565642064657461696c7320746f6f2073686f727400000000006044820152606401610554565b60008281526002602052604090208054829190610c899061236d565b905014610ce5576000828152600260205260409020610ca984868361241b565b50817f4fe18adb29a4bae727e770ff666414a639679c10704d95f308a220b9a1b7477c8585604051610cdc929190612505565b60405180910390a25b5092915050565b6002602052600090815260409020805461048d9061236d565b60405162461bcd60e51b815260206004820152601d60248201527f4f776e6572736869702063616e6e6f742062652072656e6f756e6365640000006044820152606401610554565b6000610d596003611d90565b905090565b60008181526002602052604081208054610d779061236d565b15159392505050565b600081815260076020908152604080832054835260099091529020805460609190610daa9061236d565b80601f0160208091040260200160405190810160405280929190818152602001828054610dd69061236d565b8015610e235780601f10610df857610100808354040283529160200191610e23565b820191906000526020600020905b815481529060010190602001808311610e0657829003601f168201915b50505050509050919050565b6000610e39611ac8565b610e41610d4d565b610d5991906125d7565b610e53611cef565b8080610e955760405162461bcd60e51b8152602060048201526011602482015270446174612066656564204944207a65726f60781b6044820152606401610554565b610ea0600383611d4b565b156106fc5760405182907e58637e39931c35fef05bbfd96b3881a0301ada925534f93fbfd5544df032cd90600090a25050565b6060818067ffffffffffffffff811115610eef57610eef6123b7565b604051908082528060200260200182016040528015610f2257816020015b6060815260200190600190039081610f0d5790505b50915060005b8181101561104c57600030868684818110610f4557610f45612521565b9050602002810190610f579190612537565b604051610f659291906123a7565b600060405180830381855af49150503d8060008114610fa0576040519150601f19603f3d011682016040523d82523d6000602084013e610fa5565b606091505b50858481518110610fb857610fb8612521565b6020908102919091010152905080611043576000848381518110610fde57610fde612521565b60200260200101519050600081511115610ffb5780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e6700000000006044820152606401610554565b50600101610f28565b505092915050565b61105c611cef565b808061109e5760405162461bcd60e51b8152602060048201526011602482015270446174612066656564204944207a65726f60781b6044820152606401610554565b6110a9600383611d9a565b156106fc5760405182907f0b7c1d36481aee25427040847eb1bb0fe4419a9daf1a3daa7a2ed118a20128bf90600090a25050565b6110e5611cef565b80806111245760405162461bcd60e51b815260206004820152600e60248201526d64415049206e616d65207a65726f60901b6044820152606401610554565b61112f600583611d9a565b156106fc5760405182907f240586c4e7a24b6151c6cbee3daebf773eae2e14f003cf24b204cc164c3066a790600090a25050565b61116b611cef565b82806111aa5760405162461bcd60e51b815260206004820152600e60248201526d64415049206e616d65207a65726f60901b6044820152606401610554565b82826104008111156111fe5760405162461bcd60e51b815260206004820152601a60248201527f55706461746520706172616d657465727320746f6f206c6f6e670000000000006044820152606401610554565b600085856040516112109291906123a7565b60405180910390209050806008600089815260200190815260200160002054146106705760008781526008602090815260408083208490558383526009909152902080548691906112609061236d565b90501461128257600081815260096020526040902061128086888361241b565b505b867f3ebb9b0f7d1ab582553a43d38e03a3533602282ff4fc10f5073d0b67d990dbfd8787604051610667929190612505565b600080606060008060608060608060006112cc610d4d565b9050808b10156112f3576112e160038c611da6565b99506112ec8a610d80565b92506113ea565b6112fd6005611d90565b61130790826125d7565b8b10156113ea5761132361131b828d61280b565b600590611da6565b98507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663472c22f18a60405160200161136791815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161139b91815260200190565b602060405180830381865afa1580156113b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113dc919061281e565b99506113e789611ad4565b92505b89156115325760008a815260026020526040902080546114099061236d565b80601f01602080910402602001604051908101604052809291908181526020018280546114359061236d565b80156114825780601f1061145757610100808354040283529160200191611482565b820191906000526020600020905b81548152906001019060200180831161146557829003601f168201915b50506040517f67a7cfb7000000000000000000000000000000000000000000000000000000008152600481018f9052939b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316926367a7cfb7925060240190506040805180830381865afa158015611508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152c9190612837565b90975095505b875115611aba5760408851036117b2576040805160018082528183019092529060208083019080368337505060408051600180825281830190925292975090506020808301908036833701905050604080516001808252818301909252919550816020015b6060815260200190600190039081611597579050509150600080898060200190518101906115c59190612880565b915091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166367a7cfb761164484846040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6040518263ffffffff1660e01b815260040161166291815260200190565b6040805180830381865afa15801561167e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a29190612837565b886000815181106116b5576116b5612521565b60200260200101886000815181106116cf576116cf612521565b63ffffffff909316602093840291909101830152601b9290920b9091526001600160a01b0383166000908152600190915260409020805461170f9061236d565b80601f016020809104026020016040519081016040528092919081815260200182805461173b9061236d565b80156117885780601f1061175d57610100808354040283529160200191611788565b820191906000526020600020905b81548152906001019060200180831161176b57829003601f168201915b5050505050846000815181106117a0576117a0612521565b60200260200101819052505050611aba565b600080898060200190518101906117c99190612909565b815191935091508067ffffffffffffffff8111156117e9576117e96123b7565b604051908082528060200260200182016040528015611812578160200160208202803683370190505b5097508067ffffffffffffffff81111561182e5761182e6123b7565b604051908082528060200260200182016040528015611857578160200160208202803683370190505b5096508067ffffffffffffffff811115611873576118736123b7565b6040519080825280602002602001820160405280156118a657816020015b60608152602001906001900390816118915790505b50945060005b81811015611ab5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166367a7cfb76119128684815181106118f8576118f8612521565b6020026020010151868581518110610b9257610b92612521565b6040518263ffffffff1660e01b815260040161193091815260200190565b6040805180830381865afa15801561194c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119709190612837565b8a838151811061198257611982612521565b602002602001018a848151811061199b5761199b612521565b602002602001018263ffffffff1663ffffffff1681525082601b0b601b0b8152505050600160008583815181106119d4576119d4612521565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208054611a079061236d565b80601f0160208091040260200160405190810160405280929190818152602001828054611a339061236d565b8015611a805780601f10611a5557610100808354040283529160200191611a80565b820191906000526020600020905b815481529060010190602001808311611a6357829003601f168201915b5050505050868281518110611a9757611a97612521565b60200260200101819052508080611aad906127f2565b9150506118ac565b505050505b509193959799909294969850565b6000610d596005611d90565b600081815260086020908152604080832054835260099091529020805460609190610daa9061236d565b60405162461bcd60e51b815260206004820152601f60248201527f4f776e6572736869702063616e6e6f74206265207472616e73666572726564006044820152606401610554565b611b4e611cef565b6001600160a01b038316611ba45760405162461bcd60e51b815260206004820152601460248201527f4169726e6f64652061646472657373207a65726f0000000000000000000000006044820152606401610554565b6101008282604051602001611bba9291906123a7565b604051602081830303815290604052511115611c185760405162461bcd60e51b815260206004820152601760248201527f5369676e6564204150492055524c20746f6f206c6f6e670000000000000000006044820152606401610554565b8181604051602001611c2b9291906123a7565b60408051601f1981840301815282825280516020918201206001600160a01b038716600090815260018352929092209192611c679291016129c4565b6040516020818303038152906040528051906020012014611cea576001600160a01b0383166000908152600160205260409020611ca582848361241b565b50826001600160a01b03167f1de1502db80e21e5a66f15b7adabc8c7c32f1fa1a0b7c51dbe01f4e50fe65c498383604051611ce1929190612505565b60405180910390a25b505050565b6000546001600160a01b03163314611d495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610554565b565b6000611d578383611db2565b90505b92915050565b600081604051602001611d739190612a3a565b604051602081830303815290604052805190602001209050919050565b6000611d5a825490565b6000611d578383611ea5565b6000611d578383611ef4565b60008181526001830160205260408120548015611e9b576000611dd660018361280b565b8554909150600090611dea9060019061280b565b9050818114611e4f576000866000018281548110611e0a57611e0a612521565b9060005260206000200154905080876000018481548110611e2d57611e2d612521565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e6057611e60612a4d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611d5a565b6000915050611d5a565b6000818152600183016020526040812054611eec57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611d5a565b506000611d5a565b6000826000018281548110611f0b57611f0b612521565b9060005260206000200154905092915050565b6001600160a01b0381168114611f3357600080fd5b50565b600060208284031215611f4857600080fd5b8135611f5381611f1e565b9392505050565b6000815180845260005b81811015611f8057602081850181015186830182015201611f64565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000611d576020830184611f5a565b60008083601f840112611fc557600080fd5b50813567ffffffffffffffff811115611fdd57600080fd5b602083019150836020828501011115611ff557600080fd5b9250929050565b60008060006040848603121561201157600080fd5b83359250602084013567ffffffffffffffff81111561202f57600080fd5b61203b86828701611fb3565b9497909650939450505050565b60006020828403121561205a57600080fd5b5035919050565b6000806020838503121561207457600080fd5b823567ffffffffffffffff8082111561208c57600080fd5b818501915085601f8301126120a057600080fd5b8135818111156120af57600080fd5b8660208260051b85010111156120c457600080fd5b60209290920196919550909350505050565b600082825180855260208086019550808260051b84010181860160005b8481101561212157601f1986840301895261210f838351611f5a565b988401989250908301906001016120f3565b5090979650505050505050565b604080825283519082018190526000906020906060840190828701845b8281101561216957815115158452928401929084019060010161214b565b5050508381038285015261217d81866120d6565b9695505050505050565b6000806020838503121561219a57600080fd5b823567ffffffffffffffff8111156121b157600080fd5b6121bd85828601611fb3565b90969095509350505050565b602081526000611d5760208301846120d6565b600081518084526020808501945080840160005b8381101561221257815163ffffffff16875295820195908201906001016121f0565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015612265578284038952612253848351611f5a565b9885019893509084019060010161223b565b5091979650505050505050565b60006101208b835260208b818501528160408501526122938285018c611f5a565b601b8b810b606087015263ffffffff8b16608087015285820360a08701528951808352838b019450909183019060005b818110156122e1578551840b835294840194918401916001016122c3565b505085810360c08701526122f5818a6121dc565b935050505082810360e084015261230c8186611f5a565b9050828103610100840152612321818561221d565b9c9b505050505050505050505050565b60008060006040848603121561234657600080fd5b833561235181611f1e565b9250602084013567ffffffffffffffff81111561202f57600080fd5b600181811c9082168061238157607f821691505b6020821081036123a157634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b634e487b7160e01b600052604160045260246000fd5b601f821115611cea57600081815260208120601f850160051c810160208610156123f45750805b601f850160051c820191505b8181101561241357828155600101612400565b505050505050565b67ffffffffffffffff831115612433576124336123b7565b61244783612441835461236d565b836123cd565b6000601f84116001811461247b57600085156124635750838201355b600019600387901b1c1916600186901b1783556124d5565b600083815260209020601f19861690835b828110156124ac578685013582556020948501946001909201910161248c565b50868210156124c95760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006125196020830184866124dc565b949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261254e57600080fd5b83018035915067ffffffffffffffff82111561256957600080fd5b602001915036819003821315611ff557600080fd5b6000806040838503121561259157600080fd5b823561259c81611f1e565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417611d5a57611d5a6125aa565b80820180821115611d5a57611d5a6125aa565b604051601f8201601f1916810167ffffffffffffffff81118282101715612613576126136123b7565b604052919050565b600067ffffffffffffffff821115612635576126356123b7565b5060051b60200190565b600082601f83011261265057600080fd5b813560206126656126608361261b565b6125ea565b82815260059290921b8401810191818101908684111561268457600080fd5b8286015b8481101561269f5780358352918301918301612688565b509695505050505050565b600080604083850312156126bd57600080fd5b823567ffffffffffffffff808211156126d557600080fd5b818501915085601f8301126126e957600080fd5b813560206126f96126608361261b565b82815260059290921b8401810191818101908984111561271857600080fd5b948201945b8386101561273f57853561273081611f1e565b8252948201949082019061271d565b9650508601359250508082111561275557600080fd5b506127628582860161263f565b9150509250929050565b600081518084526020808501945080840160005b8381101561221257815187529582019590820190600101612780565b604080825283519082018190526000906020906060840190828701845b828110156127de5781516001600160a01b0316845292840192908401906001016127b9565b5050508381038285015261217d818661276c565b600060018201612804576128046125aa565b5060010190565b81810381811115611d5a57611d5a6125aa565b60006020828403121561283057600080fd5b5051919050565b6000806040838503121561284a57600080fd5b825180601b0b811461285b57600080fd5b602084015190925063ffffffff8116811461287557600080fd5b809150509250929050565b6000806040838503121561289357600080fd5b825161289e81611f1e565b6020939093015192949293505050565b600082601f8301126128bf57600080fd5b815160206128cf6126608361261b565b82815260059290921b840181019181810190868411156128ee57600080fd5b8286015b8481101561269f57805183529183019183016128f2565b6000806040838503121561291c57600080fd5b825167ffffffffffffffff8082111561293457600080fd5b818501915085601f83011261294857600080fd5b815160206129586126608361261b565b82815260059290921b8401810191818101908984111561297757600080fd5b948201945b8386101561299e57855161298f81611f1e565b8252948201949082019061297c565b918801519196509093505050808211156129b757600080fd5b50612762858286016128ae565b60008083546129d28161236d565b600182811680156129ea57600181146129ff57612a2e565b60ff1984168752821515830287019450612a2e565b8760005260208060002060005b85811015612a255781548a820152908401908201612a0c565b50505082870194505b50929695505050505050565b602081526000611d57602083018461276c565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202d2355529b21fa1cea229167772a21d13bd67bbc950d4d21698af126d4a8f18364736f6c63430008110033000000000000000000000000bf660585efb7f31f68bb3375937b7c71376de6c80000000000000000000000008fd1efcb673d1438cb153783ace6b65b7eba1a60000000000000000000000000000000000000000000000000000000000000000a
Deployed ByteCode
0x6080604052600436106102f15760003560e01c8063796b89b91161018f578063b7afd507116100e1578063d7fa10071161008a578063f2fde38b11610064578063f2fde38b14610998578063f8b2cb4f146109b8578063fa013067146109e057600080fd5b8063d7fa100714610930578063d8d2f90f14610950578063e637cf001461098157600080fd5b8063c6c04e16116100bb578063c6c04e161461089e578063d5659f31146108d2578063d658d2e9146108e757600080fd5b8063b7afd50714610837578063c10f1a751461084a578063c1516e541461087e57600080fd5b806397f679d311610143578063a89307b41161011d578063a89307b4146107bb578063aa2b44e4146107dd578063ac9650d81461080a57600080fd5b806397f679d3146107475780639ae06c841461077b578063a5f36cb11461079b57600080fd5b80638c9f4c79116101745780638c9f4c79146106735780638da5cb5b146106a057806394259c6c146106be57600080fd5b8063796b89b914610633578063845ebe431461064657600080fd5b806342cbb15c116102485780635849e5ef116101fc5780635d868194116101d65780635d868194146105de57806364c2359d146105fe578063715018a61461061e57600080fd5b80635849e5ef1461056f5780635885c7711461058f5780635989eaeb146105a457600080fd5b80634dc610d41161022d5780634dc610d4146105085780634dcc19fe1461052857806353130e261461053b57600080fd5b806342cbb15c146104c7578063437b9116146104da57600080fd5b80631b1f24d8116102aa5780632d6a744e116102845780632d6a744e1461040e5780633408e4701461045a5780633adb35fe1461046d57600080fd5b80631b1f24d8146103b85780631d911b6d146103d9578063288ddb61146103f957600080fd5b8063044c9bd7116102db578063044c9bd71461034b57806318d6e2d4146103785780631a0a0b3e1461039857600080fd5b8062aae33f146102f65780630141ff4814610329575b600080fd5b34801561030257600080fd5b5061031661031136600461456c565b610a00565b6040519081526020015b60405180910390f35b34801561033557600080fd5b506103496103443660046145ae565b610ab4565b005b34801561035757600080fd5b506103166103663660046145ae565b60009081526001602052604090205490565b34801561038457600080fd5b506103496103933660046145c7565b610b8c565b3480156103a457600080fd5b506103166103b336600461466a565b610dfd565b6103cb6103c6366004614710565b610ec0565b60405161032092919061488d565b3480156103e557600080fd5b506103496103f43660046148af565b610f5e565b34801561040557600080fd5b50610316611150565b34801561041a57600080fd5b506104427f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd93381565b6040516001600160a01b039091168152602001610320565b34801561046657600080fd5b5046610316565b34801561047957600080fd5b506103166040517f417069334d61726b6574207369676e61747572652064656c65676174696f6e006020820152600090603f0160405160208183030381529060405280519060200120905090565b3480156104d357600080fd5b5043610316565b3480156104e657600080fd5b506104fa6104f536600461456c565b611196565b60405161032092919061496f565b34801561051457600080fd5b506103496105233660046145ae565b6112fc565b34801561053457600080fd5b5048610316565b34801561054757600080fd5b506104427f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a81565b34801561057b57600080fd5b5061044261058a366004614994565b61141a565b34801561059b57600080fd5b506103166114d4565b3480156105b057600080fd5b506105ce6105bf3660046149f0565b6001600160a01b03163b151590565b6040519015158152602001610320565b3480156105ea57600080fd5b506103166105f9366004614a0d565b611505565b34801561060a57600080fd5b506103166106193660046145ae565b61156f565b34801561062a57600080fd5b50610349611625565b34801561063f57600080fd5b5042610316565b34801561065257600080fd5b506103166106613660046145ae565b60026020526000908152604090205481565b34801561067f57600080fd5b5061069361068e3660046145ae565b61166d565b6040516103209190614a43565b3480156106ac57600080fd5b506000546001600160a01b0316610442565b3480156106ca57600080fd5b506107146106d93660046145ae565b600360205260009081526040902080546001820154600290920154909163ffffffff8116916401000000009091046001600160e01b03169084565b6040805194855263ffffffff90931660208501526001600160e01b03909116918301919091526060820152608001610320565b34801561075357600080fd5b506103167f000000000000000000000000000000000000000000000000000000000000000a81565b34801561078757600080fd5b50610442610796366004614a56565b61171c565b3480156107a757600080fd5b506103496107b6366004614a95565b6117d3565b6107ce6107c9366004614710565b611d6a565b60405161032093929190614ae5565b3480156107e957600080fd5b506103166107f83660046145ae565b60046020526000908152604090205481565b34801561081657600080fd5b5061082a61082536600461456c565b611e0d565b6040516103209190614b1b565b610316610845366004614b2e565b611f8e565b34801561085657600080fd5b506104427f0000000000000000000000008fd1efcb673d1438cb153783ace6b65b7eba1a6081565b34801561088a57600080fd5b50610316610899366004614bd9565b6121bc565b3480156108aa57600080fd5b506108be6108b93660046145ae565b612368565b604051610320989796959493929190614ca0565b3480156108de57600080fd5b506103166126ed565b3480156108f357600080fd5b5061091b6109023660046145ae565b6001602081905260009182526040909120805491015482565b60408051928352602083019190915201610320565b34801561093c57600080fd5b5061034961094b366004614d6b565b61271e565b34801561095c57600080fd5b5061097061096b3660046145ae565b61278f565b604051610320959493929190614d8d565b34801561098d57600080fd5b506103166201518081565b3480156109a457600080fd5b506103496109b33660046149f0565b612c83565b3480156109c457600080fd5b506103166109d33660046149f0565b6001600160a01b03163190565b3480156109ec57600080fd5b506103496109fb366004614ddb565b612ccb565b6040517eaae33f0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd933169062aae33f90610a689086908690600401614e34565b6020604051808303816000875af1158015610a87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aab9190614e86565b90505b92915050565b60008181526004602052604090205480610b155760405162461bcd60e51b815260206004820152601860248201527f537562736372697074696f6e20717565756520656d707479000000000000000060448201526064015b60405180910390fd5b6000818152600360205260409020600101544263ffffffff9091161115610b7e5760405162461bcd60e51b815260206004820152601e60248201527f43757272656e7420737562736372697074696f6e206e6f7420656e64656400006044820152606401610b0c565b610b888282612f32565b5050565b610b94613089565b82610be15760405162461bcd60e51b815260206004820152600e60248201527f486173682074797065207a65726f0000000000000000000000000000000000006044820152606401610b0c565b806000819003610c335760405162461bcd60e51b815260206004820152600d60248201527f5369676e65727320656d707479000000000000000000000000000000000000006044820152606401610b0c565b600083838281610c4557610c45614e9f565b9050602002016020810190610c5a91906149f0565b6001600160a01b031603610cb05760405162461bcd60e51b815260206004820152601960248201527f4669727374207369676e65722061646472657373207a65726f000000000000006044820152606401610b0c565b60015b81811015610d84578383610cc8600184614ecb565b818110610cd757610cd7614e9f565b9050602002016020810190610cec91906149f0565b6001600160a01b0316848483818110610d0757610d07614e9f565b9050602002016020810190610d1c91906149f0565b6001600160a01b031611610d725760405162461bcd60e51b815260206004820152601e60248201527f5369676e657273206e6f7420696e20617363656e64696e67206f7264657200006044820152606401610b0c565b80610d7c81614ede565b915050610cb3565b508282604051602001610d98929190614ef7565b60408051601f198184030181528282528051602091820120600088815260029092529190205584907f5a1f5ee4ceedd78b1982374b4790e8aa9f31e8af1c32aaef46b2afd8a789193a90610def9086908690614f39565b60405180910390a250505050565b6040517f1a0a0b3e0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9331690631a0a0b3e90610e71908b908b908b908b908b908b908b90600401614fb0565b6020604051808303816000875af1158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190614e86565b98975050505050505050565b60606000306001600160a01b031663ac9650d88e8e6040518363ffffffff1660e01b8152600401610ef2929190615000565b6000604051808303816000875af1158015610f11573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f399190810190615204565b9150610f4c8b8b8b8b8b8b8b8b8b611f8e565b90509b509b9950505050505050505050565b610f6b85858585856130f4565b6040517f085df6ab0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301527f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a169063085df6ab90602401600060405180830381865afa158015610fea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110129190810190615239565b6040516020016110229190615282565b60405160208183030381529060405280519060200120848460405160200161104b92919061529e565b60405160208183030381529060405280519060200120036110ae5760405162461bcd60e51b815260206004820152601e60248201527f446f6573206e6f7420757064617465207369676e6564204150492055524c00006044820152606401610b0c565b6040517ffba8f22f0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a169063fba8f22f90611117908890889088906004016152ae565b600060405180830381600087803b15801561113157600080fd5b505af1158015611145573d6000803e3d6000fd5b505050505050505050565b6040517f644150492070726963696e67204d65726b6c6520726f6f74000000000000000060208201526038015b6040516020818303038152906040528051906020012081565b606080828067ffffffffffffffff8111156111b3576111b361509c565b6040519080825280602002602001820160405280156111dc578160200160208202803683370190505b5092508067ffffffffffffffff8111156111f8576111f861509c565b60405190808252806020026020018201604052801561122b57816020015b60608152602001906001900390816112165790505b50915060005b818110156112f3573086868381811061124c5761124c614e9f565b905060200281019061125e91906152d1565b60405161126c92919061529e565b600060405180830381855af49150503d80600081146112a7576040519150601f19603f3d011682016040523d82523d6000602084013e6112ac565b606091505b508583815181106112bf576112bf614e9f565b602002602001018584815181106112d8576112d8614e9f565b60209081029190910101919091529015159052600101611231565b50509250929050565b611304613089565b60008181526004602052604090205461135f5760405162461bcd60e51b815260206004820152601860248201527f537562736372697074696f6e20717565756520656d70747900000000000000006044820152606401610b0c565b6000818152600460208190526040808320929092559051632412a9cb60e01b81529081018290527f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b031690632412a9cb90602401600060405180830381600087803b1580156113d457600080fd5b505af11580156113e8573d6000803e3d6000fd5b50506040518392507f07731f198aeecb61ff6de517fa82a003ba1bb3846140b23b62d7563dc2ddfb6a9150600090a250565b6040517f5849e5ef0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000008fd1efcb673d1438cb153783ace6b65b7eba1a601690635849e5ef90611488908890889088908890600401615318565b6020604051808303816000875af11580156114a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cb919061534b565b95945050505050565b6040517f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000006020820152603b0161117d565b6040517f5d8681940000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a1690635d86819490610a689086908690600401615368565b60008061157b4261323a565b600084815260046020526040812054919250905b801561161d576000818152600360205260409020600181015490925063ffffffff1642811115611611576001830154620151809064010000000090046001600160e01b03166115de868461537c565b63ffffffff166115ee91906153a0565b6115f891906153e8565b61160b906001600160e01b03168661540e565b94508093505b5050600281015461158f565b505050919050565b60405162461bcd60e51b815260206004820152601d60248201527f4f776e6572736869702063616e6e6f742062652072656e6f756e6365640000006044820152606401610b0c565b60008181526003602090815260408083205483526005909152902080546060919061169790615421565b80601f01602080910402602001604051908101604052809291908181526020018280546116c390615421565b80156117105780601f106116e557610100808354040283529160200191611710565b820191906000526020600020905b8154815290600101906020018083116116f357829003601f168201915b50505050509050919050565b6040517f9ae06c840000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000008fd1efcb673d1438cb153783ace6b65b7eba1a601690639ae06c84906117889087908790879060040161545b565b6020604051808303816000875af11580156117a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cb919061534b565b949350505050565b836118205760405162461bcd60e51b815260206004820152600f60248201527f486173682076616c7565207a65726f00000000000000000000000000000000006044820152606401610b0c565b428311156118705760405162461bcd60e51b815260206004820152601a60248201527f486173682074696d657374616d702066726f6d206675747572650000000000006044820152606401610b0c565b6000858152600160208190526040909120015483116118d15760405162461bcd60e51b815260206004820152601e60248201527f486173682074696d657374616d70206e6f74206d6f726520726563656e7400006044820152606401610b0c565b6000858152600260205260409020548061192d5760405162461bcd60e51b815260206004820152600f60248201527f5369676e657273206e6f742073657400000000000000000000000000000000006044820152606401610b0c565b8160008167ffffffffffffffff8111156119495761194961509c565b604051908082528060200260200182016040528015611972578160200160208202803683370190505b5060408051602081018b9052908101899052606081018890529091506000906119e2906080015b604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b905060005b83811015611c7c576000878783818110611a0357611a03614e9f565b9050602002810190611a1591906152d1565b9150506040198101611aba57611a8383898985818110611a3757611a37614e9f565b9050602002810190611a4991906152d1565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132ba92505050565b848381518110611a9557611a95614e9f565b60200260200101906001600160a01b031690816001600160a01b031681525050611c69565b6101608103611c215760008060008a8a86818110611ada57611ada614e9f565b9050602002810190611aec91906152d1565b810190611af991906154c6565b925092509250824210611b4e5760405162461bcd60e51b815260206004820152601060248201527f44656c65676174696f6e20656e646564000000000000000000000000000000006044820152606401610b0c565b611be7611be1611ba16040517f417069334d61726b6574207369676e61747572652064656c65676174696f6e006020820152600090603f0160405160208183030381529060405280519060200120905090565b611bab89856132ba565b866040516020016119999392919092835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b836132ba565b878681518110611bf957611bf9614e9f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050611c69565b60405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207369676e6174757265206c656e67746800000000000000006044820152606401610b0c565b5080611c7481614ede565b9150506119e7565b5081604051602001611c8e9190615533565b604051602081830303815290604052805190602001208414611cf25760405162461bcd60e51b815260206004820152601260248201527f5369676e6174757265206d69736d6174636800000000000000000000000000006044820152606401610b0c565b60408051808201825289815260208082018a815260008d815260019283905284902092518355519101555189907fa33e8931ee2a869317bbe04201dab2907fd39d2d7f014c15b8459986e62c279190611d57908b908b90918252602082015260400190565b60405180910390a2505050505050505050565b6060806000306001600160a01b031663437b91168f8f6040518363ffffffff1660e01b8152600401611d9d929190615000565b6000604051808303816000875af1158015611dbc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de49190810190615582565b9093509150611dfa8c8c8c8c8c8c8c8c8c611f8e565b90509b509b509b98505050505050505050565b6060818067ffffffffffffffff811115611e2957611e2961509c565b604051908082528060200260200182016040528015611e5c57816020015b6060815260200190600190039081611e475790505b50915060005b81811015611f8657600030868684818110611e7f57611e7f614e9f565b9050602002810190611e9191906152d1565b604051611e9f92919061529e565b600060405180830381855af49150503d8060008114611eda576040519150601f19603f3d011682016040523d82523d6000602084013e611edf565b606091505b50858481518110611ef257611ef2614e9f565b6020908102919091010152905080611f7d576000848381518110611f1857611f18614e9f565b60200260200101519050600081511115611f355780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e6700000000006044820152606401610b0c565b50600101611e62565b505092915050565b600088611fdd5760405162461bcd60e51b815260206004820152601160248201527f446174612066656564204944207a65726f0000000000000000000000000000006044820152606401610b0c565b6001600160a01b0388166120335760405162461bcd60e51b815260206004820152601b60248201527f53706f6e736f722077616c6c65742061646472657373207a65726f00000000006044820152606401610b0c565b6120448a8a8a8a8a8a8a8a8a6132de565b6120528a8a89898989613643565b905061205d8a61156f565b612071346001600160a01b038b163161540e565b10156120bf5760405162461bcd60e51b815260206004820152601460248201527f496e73756666696369656e74207061796d656e740000000000000000000000006044820152606401610b0c565b808a7fd44e8abecc305a9434d27a049c731a8331cee8bca6496154f47835b396ce55068b8b8b8b8b8b346040516120fc9796959493929190615645565b60405180910390a334156121af576000886001600160a01b03163460405160006040518083038185875af1925050503d8060008114612157576040519150601f19603f3d011682016040523d82523d6000602084013e61215c565b606091505b50509050806121ad5760405162461bcd60e51b815260206004820152601560248201527f5472616e7366657220756e7375636365737366756c00000000000000000000006044820152606401610b0c565b505b9998505050505050505050565b60006060841461220e5760405162461bcd60e51b815260206004820181905260248201527f55706461746520706172616d6574657273206c656e67746820696e76616c69646044820152606401610b0c565b6000806000806122208a8a8a8a613a7a565b9350935093509350600087876201518061223a919061568d565b61224491906156a4565b905060006122514261323a565b90506000841561226f5760008d815260046020526040902054612271565b865b90505b8015612358578681036122c1576201518083612290848961537c565b63ffffffff166122a0919061568d565b6122aa91906156a4565b6122b4908961540e565b9750859150839050612274565b6000818152600360205260409020600181015463ffffffff164281111561233a576001820154620151809064010000000090046001600160e01b0316612307868461537c565b63ffffffff1661231791906153a0565b61232191906153e8565b612334906001600160e01b03168b61540e565b99508093505b82870361234957889250612351565b816002015492505b5050612274565b5050505050505095945050505050565b6060600080606080606080606060007f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b031663472c22f18b6040516020016123b991815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016123ed91815260200190565b602060405180830381865afa15801561240a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242e9190614e86565b90506124398161278f565b60008f815260046020526040812054959e50939c50919a5098509650905b8015612484578161246781614ede565b600092835260036020526040909220600201549192506124579050565b508067ffffffffffffffff81111561249e5761249e61509c565b6040519080825280602002602001820160405280156124d157816020015b60608152602001906001900390816124bc5790505b5094508067ffffffffffffffff8111156124ed576124ed61509c565b604051908082528060200260200182016040528015612516578160200160208202803683370190505b5093508067ffffffffffffffff8111156125325761253261509c565b60405190808252806020026020018201604052801561255b578160200160208202803683370190505b5060008c8152600460209081526040808320548352600390915281209194505b828110156126de5781546000908152600560205260409020805461259e90615421565b80601f01602080910402602001604051908101604052809291908181526020018280546125ca90615421565b80156126175780601f106125ec57610100808354040283529160200191612617565b820191906000526020600020905b8154815290600101906020018083116125fa57829003601f168201915b505050505087828151811061262e5761262e614e9f565b60209081029190910101526001820154865163ffffffff9091169087908390811061265b5761265b614e9f565b602002602001019063ffffffff16908163ffffffff16815250508160010160049054906101000a90046001600160e01b031685828151811061269f5761269f614e9f565b6001600160e01b0390921660209283029190910182015260029092015460009081526003909252604090912090806126d681614ede565b91505061257b565b50505050919395975091939597565b6040517f5369676e6564204150492055524c204d65726b6c6520726f6f740000000000006020820152603a0161117d565b612726613089565b604080518082018252828152426020808301828152600087815260018084529086902094518555905193019290925582518481529182015283917f19cb5bc6996c2541fb44252778e9c8c952662cce4670a75a4174b50c765bd7d1910160405180910390a25050565b60606000806060807f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b0316636e85b69a876040518263ffffffff1660e01b81526004016127e591815260200190565b600060405180830381865afa158015612802573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261282a91908101906156b8565b6040516367a7cfb760e01b8152600481018890529095507f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b0316906367a7cfb7906024016040805180830381865afa158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b591906156fc565b86519195509350603f1901612a4f57604080516001808252818301909252906020808301908036833750506040805160018082528183019092529294509050602080830190803683370190505090506000808680602001905181019061291b919061573f565b915091507f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b03166367a7cfb761299a84846040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6040518263ffffffff1660e01b81526004016129b891815260200190565b6040805180830381865afa1580156129d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f891906156fc565b85600081518110612a0b57612a0b614e9f565b6020026020010185600081518110612a2557612a25614e9f565b602002602001018263ffffffff1663ffffffff1681525082601b0b601b0b81525050505050612c7a565b845115612c7a5760008086806020019051810190612a6d91906157c8565b815191935091508067ffffffffffffffff811115612a8d57612a8d61509c565b604051908082528060200260200182016040528015612ab6578160200160208202803683370190505b5094508067ffffffffffffffff811115612ad257612ad261509c565b604051908082528060200260200182016040528015612afb578160200160208202803683370190505b50935060005b81811015612c75577f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b03166367a7cfb7612bb6868481518110612b4d57612b4d614e9f565b6020026020010151868581518110612b6757612b67614e9f565b60200260200101516040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b6040518263ffffffff1660e01b8152600401612bd491815260200190565b6040805180830381865afa158015612bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1491906156fc565b878381518110612c2657612c26614e9f565b60200260200101878481518110612c3f57612c3f614e9f565b602002602001018263ffffffff1663ffffffff1681525082601b0b601b0b81525050508080612c6d90614ede565b915050612b01565b505050505b91939590929450565b60405162461bcd60e51b815260206004820152601f60248201527f4f776e6572736869702063616e6e6f74206265207472616e73666572726564006044820152606401610b0c565b8315612d2c576001600160a01b038316612d275760405162461bcd60e51b815260206004820152601b60248201527f53706f6e736f722077616c6c65742061646472657373207a65726f00000000006044820152606401610b0c565b612d83565b6001600160a01b03831615612d835760405162461bcd60e51b815260206004820152601f60248201527f53706f6e736f722077616c6c65742061646472657373206e6f74207a65726f006044820152606401610b0c565b612d908585858585613ceb565b60007f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b031663472c22f187604051602001612dd491815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401612e0891815260200190565b602060405180830381865afa158015612e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e499190614e86565b9050848103612e9a5760405162461bcd60e51b815260206004820152601960248201527f446f6573206e6f74207570646174652064415049206e616d65000000000000006044820152606401610b0c565b8415612ea957612ea985613e17565b6040516391eed08560e01b815260048101879052602481018690527f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b0316906391eed08590604401600060405180830381600087803b158015612f1257600080fd5b505af1158015612f26573d6000803e3d6000fd5b50505050505050505050565b5b6000908152600360205260409020600201548015801590612f6d57506000818152600360205260409020600101544263ffffffff90911611155b612f3357604051819083907fe08aff0930a0c84c077d2ce7e690a3f910c0f8705376b2405816efb89b9869b790600090a360008281526004602052604090208190558061303357604051632412a9cb60e01b8152600481018390527f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b031690632412a9cb906024015b600060405180830381600087803b15801561301757600080fd5b505af115801561302b573d6000803e3d6000fd5b505050505050565b7f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b031663d23bab148361306c8461166d565b6040518363ffffffff1660e01b8152600401612ffd929190615883565b3361309c6000546001600160a01b031690565b6001600160a01b0316146130f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b0c565b565b600080613103838501856158f7565b91509150816001600060405160200161313f907f5369676e6564204150492055524c204d65726b6c6520726f6f740000000000008152601a0190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146131a35760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b6131f581838989896040516020016131bd939291906152ae565b60408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120613ff6565b6132315760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b50505050505050565b600063ffffffff8211156132b65760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608401610b0c565b5090565b60008060006132c9858561400e565b915091506132d681614053565b509392505050565b8861332b5760405162461bcd60e51b815260206004820152600e60248201527f64415049206e616d65207a65726f0000000000000000000000000000000000006044820152606401610b0c565b6060851461337b5760405162461bcd60e51b815260206004820181905260248201527f55706461746520706172616d6574657273206c656e67746820696e76616c69646044820152606401610b0c565b836000036133cb5760405162461bcd60e51b815260206004820152600d60248201527f4475726174696f6e207a65726f000000000000000000000000000000000000006044820152606401610b0c565b8260000361341b5760405162461bcd60e51b815260206004820152600a60248201527f5072696365207a65726f000000000000000000000000000000000000000000006044820152606401610b0c565b600080808061342c85870187615934565b9350935093509350836001600060405160200161346c907f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000008152601b0190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146134d05760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b60408051602081018f90529081018d90526001600160a01b038c16606082015261350090849086906080016131bd565b61353c5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b8160016000604051602001613574907f644150492070726963696e67204d65726b6c6520726f6f740000000000000000815260180190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154146135d85760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b6135f881838f468e8e8e8e6040516020016131bd969594939291906159ab565b6136345760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210383937b7b360991b6044820152606401610b0c565b50505050505050505050505050565b6000806000806136558a898989613a7a565b60405193975091955093509150600090613672908a908a9061529e565b6040518091039020905060056000828152602001908152602001600020805461369a90615421565b90506000036136be5760008181526005602052604090206136bc898b83615a2b565b505b6040805160808101825282815263ffffffff861660208201529081016136fa896136eb8a6201518061568d565b6136f591906156a4565b6141bb565b6001600160e01b03908116825260209182018590526000888152600383526040908190208451815592840151908401519091166401000000000263ffffffff909116176001820155606090910151600290910155826138da5760008b81526004602052604090205485146137a75760405185908c907fe08aff0930a0c84c077d2ce7e690a3f910c0f8705376b2405816efb89b9869b790600090a360008b81526004602052604090208590555b6040517fd23bab140000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a169063d23bab1490613810908e908d908d9060040161545b565b600060405180830381600087803b15801561382a57600080fd5b505af115801561383e573d6000803e3d6000fd5b50506040517fbe3cc74d000000000000000000000000000000000000000000000000000000008152600481018e90527f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b0316925063be3cc74d9150602401600060405180830381600087803b1580156138bd57600080fd5b505af11580156138d1573d6000803e3d6000fd5b50505050613924565b60008381526003602081815260408084206002018990558e8452600482528084205480855292909152909120600101544263ffffffff90911611613922576139228c82612f32565b505b61392d8a613e17565b897f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b031663472c22f18d60405160200161397091815260200190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016139a491815260200190565b602060405180830381865afa1580156139c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139e59190614e86565b14613a6c576040516391eed08560e01b8152600481018c9052602481018b90527f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b0316906391eed08590604401600060405180830381600087803b158015613a5357600080fd5b505af1158015613a67573d6000803e3d6000fd5b505050505b505050509695505050505050565b600080600080878787604051613a9192919061529e565b604051908190038120613ab09291602001918252602082015260400190565b604051602081830303815290604052805190602001209350613adc8542613ad7919061540e565b61323a565b925060008080613aee898b018b615aec565b60008e81526004602052604081205493965091945092509081905b8015613c6b5760008181526003602052604081208054909350613b319088908890889061423a565b60018085015491925063ffffffff90911690826002811115613b5557613b55615b24565b1480613b6c57508063ffffffff168b63ffffffff16115b613bb85760405162461bcd60e51b815260206004820152601d60248201527f537562736372697074696f6e20646f6573206e6f7420757067726164650000006044820152606401610b0c565b6002826002811115613bcc57613bcc615b24565b148015613bde5750428163ffffffff16115b15613bf5578299508480613bf190614ede565b9550505b6001826002811115613c0957613c09615b24565b148015613c2157508063ffffffff168b63ffffffff16105b15613c5e578298505b8215613c575784613c3a81614ede565b60009485526003602052604090942060020154939550613c2a9050565b5050613c6b565b5050506002810154613b09565b507f000000000000000000000000000000000000000000000000000000000000000a8210613cdb5760405162461bcd60e51b815260206004820152601760248201527f537562736372697074696f6e2071756575652066756c6c0000000000000000006044820152606401610b0c565b5050505050945094509450949050565b84613d385760405162461bcd60e51b815260206004820152600e60248201527f64415049206e616d65207a65726f0000000000000000000000000000000000006044820152606401610b0c565b600080613d47838501856158f7565b915091508160016000604051602001613d83907f64415049206d616e6167656d656e74204d65726b6c6520726f6f7400000000008152601b0190565b6040516020818303038152906040528051906020012081526020019081526020016000206000015414613de75760405162461bcd60e51b815260206004820152600c60248201526b125b9d985b1a59081c9bdbdd60a21b6044820152606401610b0c565b60408051602081018990529081018790526001600160a01b03861660608201526131f590829084906080016131bd565b6040516367a7cfb760e01b8152600481018290526000907f0000000000000000000000001b127098d19a3d6a0417560fd7df2b927fafd9336001600160a01b0316906367a7cfb7906024016040805180830381865afa158015613e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea291906156fc565b9150613eb990506201518063ffffffff831661540e565b421115613f085760405162461bcd60e51b815260206004820152601560248201527f4461746120666565642076616c7565207374616c6500000000000000000000006044820152606401610b0c565b6040517f7a821819000000000000000000000000000000000000000000000000000000008152600481018390527f0000000000000000000000005cabc5d8f0e9ffc3ff6b0e4a6f5580ee9424b15a6001600160a01b031690637a82181990602401602060405180830381865afa158015613f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613faa9190615b3a565b610b885760405162461bcd60e51b815260206004820152601860248201527f446174612066656564206e6f74207265676973746572656400000000000000006044820152606401610b0c565b60008261400385846143ef565b1490505b9392505050565b60008082516041036140445760208301516040840151606085015160001a61403887828585614434565b9450945050505061404c565b506000905060025b9250929050565b600081600481111561406757614067615b24565b0361406f5750565b600181600481111561408357614083615b24565b036140d05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b0c565b60028160048111156140e4576140e4615b24565b036141315760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b0c565b600381600481111561414557614145615b24565b036141b85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610b0c565b50565b60006001600160e01b038211156132b65760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f32342062697473000000000000000000000000000000000000000000000000006064820152608401610b0c565b600081815260056020526040812080548291829182919061425a90615421565b80601f016020809104026020016040519081016040528092919081815260200182805461428690615421565b80156142d35780601f106142a8576101008083540402835291602001916142d3565b820191906000526020600020905b8154815290600101906020018083116142b657829003601f168201915b50505050508060200190518101906142eb9190615b55565b92509250925081601b0b87601b0b146143465760405162461bcd60e51b815260206004820152601e60248201527f446576696174696f6e207265666572656e636573206e6f7420657175616c00006044820152606401610b0c565b828814801561435457508086145b1561436557600093505050506117cb565b8288111580156143755750808611155b1561438657600193505050506117cb565b8288101580156143965750808610155b156143a757600293505050506117cb565b60405162461bcd60e51b815260206004820152601e60248201527f55706461746520706172616d657465727320696e636f6d70617261626c6500006044820152606401610b0c565b600081815b84518110156132d6576144208286838151811061441357614413614e9f565b60200260200101516144f8565b91508061442c81614ede565b9150506143f4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446b57506000905060036144ef565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144bf573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144e8576000600192509250506144ef565b9150600090505b94509492505050565b6000818310614514576000828152602084905260409020610aab565b6000838152602083905260409020610aab565b60008083601f84011261453957600080fd5b50813567ffffffffffffffff81111561455157600080fd5b6020830191508360208260051b850101111561404c57600080fd5b6000806020838503121561457f57600080fd5b823567ffffffffffffffff81111561459657600080fd5b6145a285828601614527565b90969095509350505050565b6000602082840312156145c057600080fd5b5035919050565b6000806000604084860312156145dc57600080fd5b83359250602084013567ffffffffffffffff8111156145fa57600080fd5b61460686828701614527565b9497909650939450505050565b6001600160a01b03811681146141b857600080fd5b60008083601f84011261463a57600080fd5b50813567ffffffffffffffff81111561465257600080fd5b60208301915083602082850101111561404c57600080fd5b600080600080600080600060a0888a03121561468557600080fd5b873561469081614613565b96506020880135955060408801359450606088013567ffffffffffffffff808211156146bb57600080fd5b6146c78b838c01614628565b909650945060808a01359150808211156146e057600080fd5b506146ed8a828b01614628565b989b979a50959850939692959293505050565b803561470b81614613565b919050565b60008060008060008060008060008060006101008c8e03121561473257600080fd5b67ffffffffffffffff808d35111561474957600080fd5b6147568e8e358f01614527565b909c509a5060208d0135995060408d0135985061477560608e01614700565b97508060808e0135111561478857600080fd5b6147988e60808f01358f01614628565b909750955060a08d0135945060c08d0135935060e08d01358110156147bc57600080fd5b506147cd8d60e08e01358e01614628565b81935080925050509295989b509295989b9093969950565b60005b838110156148005781810151838201526020016147e8565b50506000910152565b600081518084526148218160208601602086016147e5565b601f01601f19169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b8481101561488057601f1986840301895261486e838351614809565b98840198925090830190600101614852565b5090979650505050505050565b6040815260006148a06040830185614835565b90508260208301529392505050565b6000806000806000606086880312156148c757600080fd5b85356148d281614613565b9450602086013567ffffffffffffffff808211156148ef57600080fd5b6148fb89838a01614628565b9096509450604088013591508082111561491457600080fd5b5061492188828901614628565b969995985093965092949392505050565b600081518084526020808501945080840160005b83811015614964578151151587529582019590820190600101614946565b509495945050505050565b6040815260006149826040830185614932565b82810360208401526114cb8185614835565b600080600080606085870312156149aa57600080fd5b8435935060208501356149bc81614613565b9250604085013567ffffffffffffffff8111156149d857600080fd5b6149e487828801614628565b95989497509550505050565b600060208284031215614a0257600080fd5b813561400781614613565b60008060208385031215614a2057600080fd5b823567ffffffffffffffff811115614a3757600080fd5b6145a285828601614628565b602081526000610aab6020830184614809565b600080600060408486031215614a6b57600080fd5b83359250602084013567ffffffffffffffff811115614a8957600080fd5b61460686828701614628565b600080600080600060808688031215614aad57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff811115614ad957600080fd5b61492188828901614527565b606081526000614af86060830186614932565b8281036020840152614b0a8186614835565b915050826040830152949350505050565b602081526000610aab6020830184614835565b600080600080600080600080600060e08a8c031215614b4c57600080fd5b8935985060208a0135975060408a0135614b6581614613565b965060608a013567ffffffffffffffff80821115614b8257600080fd5b614b8e8d838e01614628565b909850965060808c0135955060a08c0135945060c08c0135915080821115614bb557600080fd5b50614bc28c828d01614628565b915080935050809150509295985092959850929598565b600080600080600060808688031215614bf157600080fd5b85359450602086013567ffffffffffffffff811115614c0f57600080fd5b614c1b88828901614628565b9699909850959660408101359660609091013595509350505050565b600081518084526020808501945080840160005b83811015614964578151601b0b87529582019590820190600101614c4b565b600081518084526020808501945080840160005b8381101561496457815163ffffffff1687529582019590820190600101614c7e565b6000610100808352614cb48184018c614809565b905060208a601b0b8185015263ffffffff8a1660408501528382036060850152614cde828a614c37565b91508382036080850152614cf28289614c6a565b915083820360a0850152614d068288614835565b915083820360c0850152614d1a8287614c6a565b84810360e0860152855180825282870193509082019060005b81811015614d585784516001600160e01b031683529383019391830191600101614d33565b50909d9c50505050505050505050505050565b60008060408385031215614d7e57600080fd5b50508035926020909101359150565b60a081526000614da060a0830188614809565b86601b0b602084015263ffffffff861660408401528281036060840152614dc78186614c37565b90508281036080840152610eb48185614c6a565b600080600080600060808688031215614df357600080fd5b85359450602086013593506040860135614e0c81614613565b9250606086013567ffffffffffffffff811115614e2857600080fd5b61492188828901614628565b6020815281602082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614e6d57600080fd5b8260051b80856040850137919091016040019392505050565b600060208284031215614e9857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610aae57610aae614eb5565b600060018201614ef057614ef0614eb5565b5060010190565b60008184825b85811015614f2e578135614f1081614613565b6001600160a01b031683526020928301929190910190600101614efd565b509095945050505050565b60208082528181018390526000908460408401835b86811015614f7c578235614f6181614613565b6001600160a01b031682529183019190830190600101614f4e565b509695505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038816815286602082015285604082015260a060608201526000614fdf60a083018688614f87565b8281036080840152614ff2818587614f87565b9a9950505050505050505050565b60208082528181018390526000906040600585901b8401810190840186845b8781101561508f57868403603f190183528135368a9003601e1901811261504557600080fd5b8901858101903567ffffffffffffffff81111561506157600080fd5b80360382131561507057600080fd5b61507b868284614f87565b95505050918401919084019060010161501f565b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156150db576150db61509c565b604052919050565b600067ffffffffffffffff8211156150fd576150fd61509c565b5060051b60200190565b600067ffffffffffffffff8211156151215761512161509c565b50601f01601f191660200190565b600061514261513d84615107565b6150b2565b905082815283838301111561515657600080fd5b6140078360208301846147e5565b600082601f83011261517557600080fd5b610aab8383516020850161512f565b600082601f83011261519557600080fd5b815160206151a561513d836150e3565b82815260059290921b840181019181810190868411156151c457600080fd5b8286015b84811015614f7c57805167ffffffffffffffff8111156151e85760008081fd5b6151f68986838b0101615164565b8452509183019183016151c8565b60006020828403121561521657600080fd5b815167ffffffffffffffff81111561522d57600080fd5b6117cb84828501615184565b60006020828403121561524b57600080fd5b815167ffffffffffffffff81111561526257600080fd5b8201601f8101841361527357600080fd5b6117cb8482516020840161512f565b600082516152948184602087016147e5565b9190910192915050565b8183823760009101908152919050565b6001600160a01b03841681526040602082015260006114cb604083018486614f87565b6000808335601e198436030181126152e857600080fd5b83018035915067ffffffffffffffff82111561530357600080fd5b60200191503681900382131561404c57600080fd5b8481526001600160a01b0384166020820152606060408201526000615341606083018486614f87565b9695505050505050565b60006020828403121561535d57600080fd5b815161400781614613565b6020815260006117cb602083018486614f87565b63ffffffff82811682821603908082111561539957615399614eb5565b5092915050565b6001600160e01b038281168282168181028316929181158285048214176153c9576153c9614eb5565b50505092915050565b634e487b7160e01b600052601260045260246000fd5b60006001600160e01b0380841680615402576154026153d2565b92169190910492915050565b80820180821115610aae57610aae614eb5565b600181811c9082168061543557607f821691505b60208210810361545557634e487b7160e01b600052602260045260246000fd5b50919050565b8381526040602082015260006114cb604083018486614f87565b600082601f83011261548657600080fd5b813561549461513d82615107565b8181528460208386010111156154a957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156154db57600080fd5b83359250602084013567ffffffffffffffff808211156154fa57600080fd5b61550687838801615475565b9350604086013591508082111561551c57600080fd5b5061552986828701615475565b9150509250925092565b815160009082906020808601845b838110156155665781516001600160a01b031685529382019390820190600101615541565b50929695505050505050565b8051801515811461470b57600080fd5b6000806040838503121561559557600080fd5b825167ffffffffffffffff808211156155ad57600080fd5b818501915085601f8301126155c157600080fd5b815160206155d161513d836150e3565b82815260059290921b840181019181810190898411156155f057600080fd5b948201945b838610156156155761560686615572565b825294820194908201906155f5565b9188015191965090935050508082111561562e57600080fd5b5061563b85828601615184565b9150509250929050565b8781526001600160a01b038716602082015260c06040820152600061566e60c083018789614f87565b606083019590955250608081019290925260a090910152949350505050565b8082028115828204841417610aae57610aae614eb5565b6000826156b3576156b36153d2565b500490565b6000602082840312156156ca57600080fd5b815167ffffffffffffffff8111156156e157600080fd5b6117cb84828501615164565b80601b0b81146141b857600080fd5b6000806040838503121561570f57600080fd5b825161571a816156ed565b602084015190925063ffffffff8116811461573457600080fd5b809150509250929050565b6000806040838503121561575257600080fd5b825161575d81614613565b6020939093015192949293505050565b600082601f83011261577e57600080fd5b8151602061578e61513d836150e3565b82815260059290921b840181019181810190868411156157ad57600080fd5b8286015b84811015614f7c57805183529183019183016157b1565b600080604083850312156157db57600080fd5b825167ffffffffffffffff808211156157f357600080fd5b818501915085601f83011261580757600080fd5b8151602061581761513d836150e3565b82815260059290921b8401810191818101908984111561583657600080fd5b948201945b8386101561585d57855161584e81614613565b8252948201949082019061583b565b9188015191965090935050508082111561587657600080fd5b5061563b8582860161576d565b8281526040602082015260006117cb6040830184614809565b600082601f8301126158ad57600080fd5b813560206158bd61513d836150e3565b82815260059290921b840181019181810190868411156158dc57600080fd5b8286015b84811015614f7c57803583529183019183016158e0565b6000806040838503121561590a57600080fd5b82359150602083013567ffffffffffffffff81111561592857600080fd5b61563b8582860161589c565b6000806000806080858703121561594a57600080fd5b84359350602085013567ffffffffffffffff8082111561596957600080fd5b6159758883890161589c565b945060408701359350606087013591508082111561599257600080fd5b5061599f8782880161589c565b91505092959194509250565b86815285602082015260a0604082015260006159cb60a083018688614f87565b60608301949094525060800152949350505050565b601f821115615a2657600081815260208120601f850160051c81016020861015615a075750805b601f850160051c820191505b8181101561302b57828155600101615a13565b505050565b67ffffffffffffffff831115615a4357615a4361509c565b615a5783615a518354615421565b836159e0565b6000601f841160018114615a8b5760008515615a735750838201355b600019600387901b1c1916600186901b178355615ae5565b600083815260209020601f19861690835b82811015615abc5786850135825560209485019460019092019101615a9c565b5086821015615ad95760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600080600060608486031215615b0157600080fd5b833592506020840135615b13816156ed565b929592945050506040919091013590565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615b4c57600080fd5b610aab82615572565b600080600060608486031215615b6a57600080fd5b835192506020840151615b7c816156ed565b8092505060408401519050925092509256fea26469706673582212208b53988bfa717d03290f27f19d081f4269b84b13a8d932044f3292cb485694a964736f6c63430008110033