// SPDX-License-Identifier: MIT// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)pragmasolidity ^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.
*/abstractcontractContext{
function_msgSender() internalviewvirtualreturns (address) {
returnmsg.sender;
}
function_msgData() internalviewvirtualreturns (bytescalldata) {
returnmsg.data;
}
}
Contract Source Code
File 3 of 6: IERC20.sol
// SPDX-License-Identifier: MITpragmasolidity >=0.6.2;/// @dev Interface of the ERC20 standard as defined in the EIP./// @dev This includes the optional name, symbol, and decimals metadata.interfaceIERC20{
/// @dev Emitted when `value` tokens are moved from one account (`from`) to another (`to`).eventTransfer(addressindexedfrom, addressindexed to, uint256 value);
/// @dev Emitted when the allowance of a `spender` for an `owner` is set, where `value`/// is the new allowance.eventApproval(addressindexed owner, addressindexed spender, uint256 value);
/// @notice Returns the amount of tokens in existence.functiontotalSupply() externalviewreturns (uint256);
/// @notice Returns the amount of tokens owned by `account`.functionbalanceOf(address account) externalviewreturns (uint256);
/// @notice Moves `amount` tokens from the caller's account to `to`.functiontransfer(address to, uint256 amount) externalreturns (bool);
/// @notice Returns the remaining number of tokens that `spender` is allowed/// to spend on behalf of `owner`functionallowance(address owner, address spender) externalviewreturns (uint256);
/// @notice Sets `amount` as the allowance of `spender` over the caller's tokens./// @dev Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729functionapprove(address spender, uint256 amount) externalreturns (bool);
/// @notice Moves `amount` tokens from `from` to `to` using the allowance mechanism./// `amount` is then deducted from the caller's allowance.functiontransferFrom(addressfrom, address to, uint256 amount) externalreturns (bool);
/// @notice Returns the name of the token.functionname() externalviewreturns (stringmemory);
/// @notice Returns the symbol of the token.functionsymbol() externalviewreturns (stringmemory);
/// @notice Returns the decimals places of the token.functiondecimals() externalviewreturns (uint8);
}
Contract Source Code
File 4 of 6: MerkleProofLib.sol
// SPDX-License-Identifier: MITpragmasolidity >=0.8.0;/// @notice Gas optimized merkle proof verification library./// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)/// @author Modified from Solady (https://github.com/Vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)libraryMerkleProofLib{
functionverify(bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internalpurereturns (bool isValid) {
/// @solidity memory-safe-assemblyassembly {
if proof.length {
// Left shifting by 5 is like multiplying by 32.let end :=add(proof.offset, shl(5, proof.length))
// Initialize offset to the offset of the proof in calldata.let offset := proof.offset// Iterate over proof elements to compute root hash.// prettier-ignorefor {} 1 {} {
// Slot where the leaf should be put in scratch space. If// leaf > calldataload(offset): slot 32, otherwise: slot 0.let leafSlot :=shl(5, gt(leaf, calldataload(offset)))
// Store elements to hash contiguously in scratch space.// The xor puts calldataload(offset) in whichever slot leaf// is not occupying, so 0 if leafSlot is 32, and 32 otherwise.mstore(leafSlot, leaf)
mstore(xor(leafSlot, 32), calldataload(offset))
// Reuse leaf to store the hash to reduce stack operations.
leaf :=keccak256(0, 64) // Hash both slots of scratch space.
offset :=add(offset, 32) // Shift 1 word per cycle.// prettier-ignoreifiszero(lt(offset, end)) { break }
}
}
isValid :=eq(leaf, root) // The proof is valid if the roots match.
}
}
}
Contract Source Code
File 5 of 6: Ownable.sol
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)pragmasolidity ^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.
*/abstractcontractOwnableisContext{
addressprivate _owner;
eventOwnershipTransferred(addressindexed previousOwner, addressindexed 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.
*/modifieronlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/functionowner() publicviewvirtualreturns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/function_checkOwner() internalviewvirtual{
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.
*/functionrenounceOwnership() publicvirtualonlyOwner{
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/functiontransferOwnership(address newOwner) publicvirtualonlyOwner{
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) internalvirtual{
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Contract Source Code
File 6 of 6: Ownable2Step.sol
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)pragmasolidity ^0.8.0;import"./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.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/abstractcontractOwnable2StepisOwnable{
addressprivate _pendingOwner;
eventOwnershipTransferStarted(addressindexed previousOwner, addressindexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/functionpendingOwner() publicviewvirtualreturns (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.
*/functiontransferOwnership(address newOwner) publicvirtualoverrideonlyOwner{
_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) internalvirtualoverride{
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/functionacceptOwnership() publicvirtual{
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}