Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Airdrop
- Optimization enabled
- false
- Compiler version
- v0.8.23+commit.f704f362
- EVM Version
- shanghai
- Verified at
- 2026-03-08T07:03:34.602651Z
Constructor Arguments
d306f70d3ac83cfbb52aa2e3b07dceef8e5dd5f48fa791edb70f89c3ffce631f000000000000000000000000bb3851fc2daabecbf652f88337fc0fd0eb12fb31000000000000000000000000d4b58a72469222efad11cc06e40ac24a9f860008
Arg [0] (bytes32) : d306f70d3ac83cfbb52aa2e3b07dceef8e5dd5f48fa791edb70f89c3ffce631f
Arg [1] (address) : 0xbb3851fc2daabecbf652f88337fc0fd0eb12fb31
Arg [2] (address) : 0xd4b58a72469222efad11cc06e40ac24a9f860008
src/Airdrop.sol
// SPDX-License-Identifier: MIT
pragma abicoder v2;
pragma solidity 0.8.23;
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {ValidationData} from "./structs/PandaXStructs.sol";
/// @notice Airdrop contract for Sparta
contract Airdrop is Ownable2Step {
IERC20 public pandaX;
bytes32 public merkleRoot;
mapping(address => bool) public isClaimed;
error Airdrop__InvalidProof();
error Airdrop__AlreadyClaimed();
error Airdrop__ZeroAddress();
error Airdrop__ZeroValue();
modifier verifyProof(ValidationData calldata _data, address _addr) {
bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(_addr, _data.amount))));
if (!MerkleProof.verifyCalldata(_data.proof, merkleRoot, leaf)) {
revert Airdrop__InvalidProof();
}
_;
}
modifier notZeroValue(bytes32 _data) {
if (_data == bytes32(0)) revert Airdrop__ZeroValue();
_;
}
constructor(bytes32 _merkleRoot, address _pandaX, address _owner) notZeroValue(_merkleRoot) Ownable(_owner) {
if (_pandaX == address(0)) revert Airdrop__ZeroAddress();
merkleRoot = _merkleRoot;
pandaX = IERC20(_pandaX);
}
function claim(ValidationData calldata _data) public verifyProof(_data, msg.sender) {
if (isClaimed[msg.sender]) revert Airdrop__AlreadyClaimed();
isClaimed[msg.sender] = true;
pandaX.transfer(msg.sender, _data.amount);
}
function batchClaim(ValidationData[] calldata _validationDatas) external {
for (uint256 i; i < _validationDatas.length; i++) {
claim(_validationDatas[i]);
}
}
function changeMerkleRoot(bytes32 _merkleRoot) external onlyOwner notZeroValue(_merkleRoot) {
merkleRoot = _merkleRoot;
}
function withdrawPandaX(uint256 _amount) external onlyOwner {
pandaX.transfer(owner(), _amount);
}
function setPandaX(address _pandaX) external onlyOwner {
if (_pandaX == address(0)) revert Airdrop__ZeroAddress();
pandaX = IERC20(_pandaX);
}
}
/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
}
/cryptography/Hashes.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol)
pragma solidity ^0.8.20;
/**
* @dev Library of standard hash functions.
*
* _Available since v5.1._
*/
library Hashes {
/**
* @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
*
* NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
*/
function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly ("memory-safe") {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
struct AddLiquidityETHParams {
/// @notice pandaAmountDesired The amount of PandaX to add to the liquidity pool.
uint256 pandaAmountDesired;
/// @notice amountTokenMin The minimum amount of token to add to the liquidity pool.
uint256 amountTokenMin;
/// @notice amountETHMin The minimum amount of ETH to add to the liquidity pool.
uint256 amountETHMin;
/// @notice deadline The deadline for the liquidity add.
uint256 deadline;
}
struct AddLiquidityETHResult {
/// @notice pandaAdded The amount of PandaX added to the liquidity pool.
uint256 pandaAdded;
/// @notice amountETH The amount of ETH added to the liquidity pool.
uint256 amountETH;
/// @notice liquidity The amount of liquidity added to the liquidity pool.
uint256 liquidity;
}
struct AddLiquidityParams {
/// @notice pair The address of the liquidity pair.
address pair;
/// @notice token0AmountDesired The amount of token0 to add to the liquidity pool.
uint256 token0AmountDesired;
/// @notice token1AmountDesired The amount of token1 to add to the liquidity pool.
uint256 token1AmountDesired;
/// @notice amountAMin The minimum amount of token0 to add to the liquidity pool.
uint256 amountAMin;
/// @notice amountBMin The minimum amount of token1 to add to the liquidity pool.
uint256 amountBMin;
/// @notice deadline The deadline for the liquidity add.
uint256 deadline;
}
struct AddLiquidityResult {
/// @notice token0Added The amount of token0 added to the liquidity pool.
uint256 token0Added;
/// @notice token1Added The amount of token1 added to the liquidity pool.
uint256 token1Added;
/// @notice liquidity The amount of liquidity added to the liquidity pool.
uint256 liquidity;
}
struct RemoveLiquidityETHParams {
/// @notice pair The address of the liquidity pair.
IERC20 pair;
/// @notice liquidity The amount of liquidity to remove.
uint256 liquidity;
/// @notice amountTokenMin The minimum amount of token to remove from the liquidity pool.
uint256 amountTokenMin;
/// @notice amountETHMin The minimum amount of ETH to remove from the liquidity pool.
uint256 amountETHMin;
/// @notice deadline The deadline for the liquidity remove.
uint256 deadline;
}
struct RemoveLiquidityParams {
/// @notice pair The address of the liquidity pair.
IERC20 pair;
/// @notice liquidity The amount of liquidity to remove.
uint256 liquidity;
/// @notice amountAMin The minimum amount of token0 to remove from the liquidity pool.
uint256 amountAMin;
/// @notice amountBMin The minimum amount of token1 to remove from the liquidity pool.
uint256 amountBMin;
/// @notice deadline The deadline for the liquidity remove.
uint256 deadline;
}
/// @notice Validation data for airdrop claims
struct ValidationData {
bytes32[] proof;
uint256 amount;
}
/// @dev Struct to avoid stack too deep errors.
struct Balances {
/// @notice token0Balance The balance of token0.
uint256 token0Balance;
/// @notice token1Balance The balance of token1.
uint256 token1Balance;
/// @notice token0BalanceAfter The balance of token0 after the operation.
uint256 token0BalanceAfter;
/// @notice token1BalanceAfter The balance of token1 after the operation.
uint256 token1BalanceAfter;
/// @notice token0AmountDesired The amount of token0 desired.
uint256 token0AmountDesired;
/// @notice token1AmountDesired The amount of token1 desired.
uint256 token1AmountDesired;
}
/cryptography/MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol)
// This file was procedurally generated from scripts/generate/templates/MerkleProof.js.
pragma solidity ^0.8.20;
import {Hashes} from "./Hashes.sol";
/**
* @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.
*
* IMPORTANT: Consider memory side-effects when using custom hashing functions
* that access memory in an unsafe way.
*
* NOTE: This library supports proof verification for merkle trees built using
* custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving
* leaf inclusion in trees built using non-commutative hashing functions requires
* additional logic that is not supported by this library.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @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.
*
* This version handles proofs in memory with the default hashing function.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in memory with a custom hashing function.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProof(proof, leaf, hasher) == 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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function processProof(
bytes32[] memory proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in calldata with the default hashing function.
*/
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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @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.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProofCalldata(proof, leaf, hasher) == 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 leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function processProofCalldata(
bytes32[] calldata proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(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}.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(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.
*
* This version handles multiproofs in memory with the default hashing function.
*
* 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).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
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 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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[](proofFlagsLen);
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 < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @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}.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProof(proof, proofFlags, leaves, hasher) == 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.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* 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).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view 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 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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[](proofFlagsLen);
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 < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @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}.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
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.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* 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).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
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 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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[](proofFlagsLen);
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 < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @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}.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == 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.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* 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).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view 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 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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[](proofFlagsLen);
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 < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
}
/Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This extension of the {Ownable} contract includes a two-step mechanism to transfer
* ownership, where the new owner must call {acceptOwnership} in order to replace the
* old one. This can help prevent common mistakes, such as transfers of ownership to
* incorrect accounts, or to contracts that are unable to interact with the
* permission system.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}
/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
Compiler Settings
{"remappings":[":@core/=src/",":@interfaces/=src/interfaces/",":@libs/=src/libs/",":@mocks/=test/mocks/",":@openzeppelin/=node_modules/@openzeppelin/",":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",":@script/=script/",":@structs/=src/structs/",":@test/=test/",":@utils/=src/utils/",":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",":forge-std/=lib/forge-std/src/",":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",":murky/=lib/murky/",":openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"runs":200,"enabled":false},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"shanghai","compilationTarget":{"src/Airdrop.sol":"Airdrop"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"bytes32","name":"_merkleRoot","internalType":"bytes32"},{"type":"address","name":"_pandaX","internalType":"address"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"error","name":"Airdrop__AlreadyClaimed","inputs":[]},{"type":"error","name":"Airdrop__InvalidProof","inputs":[]},{"type":"error","name":"Airdrop__ZeroAddress","inputs":[]},{"type":"error","name":"Airdrop__ZeroValue","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","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":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchClaim","inputs":[{"type":"tuple[]","name":"_validationDatas","internalType":"struct ValidationData[]","components":[{"type":"bytes32[]","name":"proof","internalType":"bytes32[]"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeMerkleRoot","inputs":[{"type":"bytes32","name":"_merkleRoot","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[{"type":"tuple","name":"_data","internalType":"struct ValidationData","components":[{"type":"bytes32[]","name":"proof","internalType":"bytes32[]"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isClaimed","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"merkleRoot","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"pandaX","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPandaX","inputs":[{"type":"address","name":"_pandaX","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPandaX","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801562000010575f80fd5b506040516200134938038062001349833981810160405281019062000036919062000346565b805f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000aa575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401620000a19190620003b0565b60405180910390fd5b620000bb81620001b060201b60201c565b50825f801b8103620000f9576040517f154beffe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036200015f576040517fc9d3115c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836003819055508260025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050620003cb565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055620001e581620001e860201b60201c565b50565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f80fd5b5f819050919050565b620002c181620002ad565b8114620002cc575f80fd5b50565b5f81519050620002df81620002b6565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6200031082620002e5565b9050919050565b620003228162000304565b81146200032d575f80fd5b50565b5f81519050620003408162000317565b92915050565b5f805f6060848603121562000360576200035f620002a9565b5b5f6200036f86828701620002cf565b9350506020620003828682870162000330565b9250506040620003958682870162000330565b9150509250925092565b620003aa8162000304565b82525050565b5f602082019050620003c55f8301846200039f565b92915050565b610f7080620003d95f395ff3fe608060405234801561000f575f80fd5b50600436106100cd575f3560e01c80638cc080251161008a578063b26cd7c711610064578063b26cd7c7146101c3578063e30c3978146101df578063ebcea3db146101fd578063f2fde38b14610219576100cd565b80638cc08025146101575780638da5cb5b14610187578063a217ad95146101a5576100cd565b80630d36e7ce146100d15780632758652a146100ed5780632eb4a7ab14610109578063715018a61461012757806379ba50971461013157806387b766fc1461013b575b5f80fd5b6100eb60048036038101906100e69190610ac0565b610235565b005b61010760048036038101906101029190610b0d565b6102e5565b005b61011161050b565b60405161011e9190610b6c565b60405180910390f35b61012f610511565b005b610139610524565b005b61015560048036038101906101509190610bb8565b6105b2565b005b610171600480360381019061016c9190610ac0565b610661565b60405161017e9190610bfd565b60405180910390f35b61018f61067e565b60405161019c9190610c25565b60405180910390f35b6101ad6106a5565b6040516101ba9190610c99565b60405180910390f35b6101dd60048036038101906101d89190610d13565b6106ca565b005b6101e7610716565b6040516101f49190610c25565b60405180910390f35b61021760048036038101906102129190610d88565b61073e565b005b610233600480360381019061022e9190610ac0565b61078d565b005b61023d610839565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036102a2576040517fc9d3115c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b80335f8183602001356040516020016102ff929190610dc2565b604051602081830303815290604052805190602001206040516020016103259190610e09565b60405160208183030381529060405280519060200120905061035883805f019061034f9190610e2f565b600354846108c0565b61038e576040517fdf9ead0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161561040f576040517ffed135e800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3386602001356040518363ffffffff1660e01b81526004016104c4929190610dc2565b6020604051808303815f875af11580156104e0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105049190610ebb565b5050505050565b60035481565b610519610839565b6105225f6108d8565b565b5f61052d610908565b90508073ffffffffffffffffffffffffffffffffffffffff1661054e610716565b73ffffffffffffffffffffffffffffffffffffffff16146105a657806040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161059d9190610c25565b60405180910390fd5b6105af816108d8565b50565b6105ba610839565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6105ff61067e565b836040518363ffffffff1660e01b815260040161061d929190610dc2565b6020604051808303815f875af1158015610639573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061065d9190610ebb565b5050565b6004602052805f5260405f205f915054906101000a900460ff1681565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5b82829050811015610711576107048383838181106106ed576106ec610ee6565b5b90506020028101906106ff9190610f13565b6102e5565b80806001019150506106cc565b505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610746610839565b805f801b8103610782576040517f154beffe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816003819055505050565b610795610839565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166107f461067e565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610841610908565b73ffffffffffffffffffffffffffffffffffffffff1661085f61067e565b73ffffffffffffffffffffffffffffffffffffffff16146108be57610882610908565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016108b59190610c25565b60405180910390fd5b565b5f826108cd86868561090f565b149050949350505050565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556109058161095f565b50565b5f33905090565b5f808290505f5b85859050811015610953576109448287878481811061093857610937610ee6565b5b90506020020135610a20565b91508080600101915050610916565b50809150509392505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f818310610a3757610a328284610a4a565b610a42565b610a418383610a4a565b5b905092915050565b5f825f528160205260405f20905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a8f82610a66565b9050919050565b610a9f81610a85565b8114610aa9575f80fd5b50565b5f81359050610aba81610a96565b92915050565b5f60208284031215610ad557610ad4610a5e565b5b5f610ae284828501610aac565b91505092915050565b5f80fd5b5f60408284031215610b0457610b03610aeb565b5b81905092915050565b5f60208284031215610b2257610b21610a5e565b5b5f82013567ffffffffffffffff811115610b3f57610b3e610a62565b5b610b4b84828501610aef565b91505092915050565b5f819050919050565b610b6681610b54565b82525050565b5f602082019050610b7f5f830184610b5d565b92915050565b5f819050919050565b610b9781610b85565b8114610ba1575f80fd5b50565b5f81359050610bb281610b8e565b92915050565b5f60208284031215610bcd57610bcc610a5e565b5b5f610bda84828501610ba4565b91505092915050565b5f8115159050919050565b610bf781610be3565b82525050565b5f602082019050610c105f830184610bee565b92915050565b610c1f81610a85565b82525050565b5f602082019050610c385f830184610c16565b92915050565b5f819050919050565b5f610c61610c5c610c5784610a66565b610c3e565b610a66565b9050919050565b5f610c7282610c47565b9050919050565b5f610c8382610c68565b9050919050565b610c9381610c79565b82525050565b5f602082019050610cac5f830184610c8a565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610cd357610cd2610cb2565b5b8235905067ffffffffffffffff811115610cf057610cef610cb6565b5b602083019150836020820283011115610d0c57610d0b610cba565b5b9250929050565b5f8060208385031215610d2957610d28610a5e565b5b5f83013567ffffffffffffffff811115610d4657610d45610a62565b5b610d5285828601610cbe565b92509250509250929050565b610d6781610b54565b8114610d71575f80fd5b50565b5f81359050610d8281610d5e565b92915050565b5f60208284031215610d9d57610d9c610a5e565b5b5f610daa84828501610d74565b91505092915050565b610dbc81610b85565b82525050565b5f604082019050610dd55f830185610c16565b610de26020830184610db3565b9392505050565b5f819050919050565b610e03610dfe82610b54565b610de9565b82525050565b5f610e148284610df2565b60208201915081905092915050565b5f80fd5b5f80fd5b5f80fd5b5f8083356001602003843603038112610e4b57610e4a610e23565b5b80840192508235915067ffffffffffffffff821115610e6d57610e6c610e27565b5b602083019250602082023603831315610e8957610e88610e2b565b5b509250929050565b610e9a81610be3565b8114610ea4575f80fd5b50565b5f81519050610eb581610e91565b92915050565b5f60208284031215610ed057610ecf610a5e565b5b5f610edd84828501610ea7565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82356001604003833603038112610f2e57610f2d610e23565b5b8083019150509291505056fea26469706673582212204bd0fe871d836a92d2cd8ba348fa43c07446bed3a46adbdad39ac45500d246b464736f6c63430008170033d306f70d3ac83cfbb52aa2e3b07dceef8e5dd5f48fa791edb70f89c3ffce631f000000000000000000000000bb3851fc2daabecbf652f88337fc0fd0eb12fb31000000000000000000000000d4b58a72469222efad11cc06e40ac24a9f860008
Deployed ByteCode
0x608060405234801561000f575f80fd5b50600436106100cd575f3560e01c80638cc080251161008a578063b26cd7c711610064578063b26cd7c7146101c3578063e30c3978146101df578063ebcea3db146101fd578063f2fde38b14610219576100cd565b80638cc08025146101575780638da5cb5b14610187578063a217ad95146101a5576100cd565b80630d36e7ce146100d15780632758652a146100ed5780632eb4a7ab14610109578063715018a61461012757806379ba50971461013157806387b766fc1461013b575b5f80fd5b6100eb60048036038101906100e69190610ac0565b610235565b005b61010760048036038101906101029190610b0d565b6102e5565b005b61011161050b565b60405161011e9190610b6c565b60405180910390f35b61012f610511565b005b610139610524565b005b61015560048036038101906101509190610bb8565b6105b2565b005b610171600480360381019061016c9190610ac0565b610661565b60405161017e9190610bfd565b60405180910390f35b61018f61067e565b60405161019c9190610c25565b60405180910390f35b6101ad6106a5565b6040516101ba9190610c99565b60405180910390f35b6101dd60048036038101906101d89190610d13565b6106ca565b005b6101e7610716565b6040516101f49190610c25565b60405180910390f35b61021760048036038101906102129190610d88565b61073e565b005b610233600480360381019061022e9190610ac0565b61078d565b005b61023d610839565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036102a2576040517fc9d3115c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b80335f8183602001356040516020016102ff929190610dc2565b604051602081830303815290604052805190602001206040516020016103259190610e09565b60405160208183030381529060405280519060200120905061035883805f019061034f9190610e2f565b600354846108c0565b61038e576040517fdf9ead0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161561040f576040517ffed135e800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3386602001356040518363ffffffff1660e01b81526004016104c4929190610dc2565b6020604051808303815f875af11580156104e0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105049190610ebb565b5050505050565b60035481565b610519610839565b6105225f6108d8565b565b5f61052d610908565b90508073ffffffffffffffffffffffffffffffffffffffff1661054e610716565b73ffffffffffffffffffffffffffffffffffffffff16146105a657806040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161059d9190610c25565b60405180910390fd5b6105af816108d8565b50565b6105ba610839565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6105ff61067e565b836040518363ffffffff1660e01b815260040161061d929190610dc2565b6020604051808303815f875af1158015610639573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061065d9190610ebb565b5050565b6004602052805f5260405f205f915054906101000a900460ff1681565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5b82829050811015610711576107048383838181106106ed576106ec610ee6565b5b90506020028101906106ff9190610f13565b6102e5565b80806001019150506106cc565b505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610746610839565b805f801b8103610782576040517f154beffe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816003819055505050565b610795610839565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166107f461067e565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610841610908565b73ffffffffffffffffffffffffffffffffffffffff1661085f61067e565b73ffffffffffffffffffffffffffffffffffffffff16146108be57610882610908565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016108b59190610c25565b60405180910390fd5b565b5f826108cd86868561090f565b149050949350505050565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556109058161095f565b50565b5f33905090565b5f808290505f5b85859050811015610953576109448287878481811061093857610937610ee6565b5b90506020020135610a20565b91508080600101915050610916565b50809150509392505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f818310610a3757610a328284610a4a565b610a42565b610a418383610a4a565b5b905092915050565b5f825f528160205260405f20905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a8f82610a66565b9050919050565b610a9f81610a85565b8114610aa9575f80fd5b50565b5f81359050610aba81610a96565b92915050565b5f60208284031215610ad557610ad4610a5e565b5b5f610ae284828501610aac565b91505092915050565b5f80fd5b5f60408284031215610b0457610b03610aeb565b5b81905092915050565b5f60208284031215610b2257610b21610a5e565b5b5f82013567ffffffffffffffff811115610b3f57610b3e610a62565b5b610b4b84828501610aef565b91505092915050565b5f819050919050565b610b6681610b54565b82525050565b5f602082019050610b7f5f830184610b5d565b92915050565b5f819050919050565b610b9781610b85565b8114610ba1575f80fd5b50565b5f81359050610bb281610b8e565b92915050565b5f60208284031215610bcd57610bcc610a5e565b5b5f610bda84828501610ba4565b91505092915050565b5f8115159050919050565b610bf781610be3565b82525050565b5f602082019050610c105f830184610bee565b92915050565b610c1f81610a85565b82525050565b5f602082019050610c385f830184610c16565b92915050565b5f819050919050565b5f610c61610c5c610c5784610a66565b610c3e565b610a66565b9050919050565b5f610c7282610c47565b9050919050565b5f610c8382610c68565b9050919050565b610c9381610c79565b82525050565b5f602082019050610cac5f830184610c8a565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610cd357610cd2610cb2565b5b8235905067ffffffffffffffff811115610cf057610cef610cb6565b5b602083019150836020820283011115610d0c57610d0b610cba565b5b9250929050565b5f8060208385031215610d2957610d28610a5e565b5b5f83013567ffffffffffffffff811115610d4657610d45610a62565b5b610d5285828601610cbe565b92509250509250929050565b610d6781610b54565b8114610d71575f80fd5b50565b5f81359050610d8281610d5e565b92915050565b5f60208284031215610d9d57610d9c610a5e565b5b5f610daa84828501610d74565b91505092915050565b610dbc81610b85565b82525050565b5f604082019050610dd55f830185610c16565b610de26020830184610db3565b9392505050565b5f819050919050565b610e03610dfe82610b54565b610de9565b82525050565b5f610e148284610df2565b60208201915081905092915050565b5f80fd5b5f80fd5b5f80fd5b5f8083356001602003843603038112610e4b57610e4a610e23565b5b80840192508235915067ffffffffffffffff821115610e6d57610e6c610e27565b5b602083019250602082023603831315610e8957610e88610e2b565b5b509250929050565b610e9a81610be3565b8114610ea4575f80fd5b50565b5f81519050610eb581610e91565b92915050565b5f60208284031215610ed057610ecf610a5e565b5b5f610edd84828501610ea7565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82356001604003833603038112610f2e57610f2d610e23565b5b8083019150509291505056fea26469706673582212204bd0fe871d836a92d2cd8ba348fa43c07446bed3a46adbdad39ac45500d246b464736f6c63430008170033