- Contract name:
- HorseFarmV2
- Optimization enabled
- true
- Compiler version
- v0.8.2+commit.661d1103
- Optimization runs
- 999999
- Verified at
- 2024-10-31 06:37:08.383000Z
contracts/farm-v2/HorseFarmV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../libraries/BytesLibrary.sol";
import "../libraries/StringLibrary.sol";
import "../interfaces/ITransporter.sol";
import "../abtracts/OwnerOperator.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "../interfaces/ICollection721.sol";
contract HorseFarmV2 is ERC721HolderUpgradeable, OwnerOperator, PausableUpgradeable, ReentrancyGuardUpgradeable {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using StringLibrary for string;
using BytesLibrary for bytes32;
struct LeaseData {
address owner;
address horseAddress;
uint256 horseId;
uint256 blockExpired;
string nonce;
uint8 v;
bytes32 r;
bytes32 s;
}
struct SavedLease {
address owner;
address horseAddress;
uint256 horseId;
uint256 blockExpired;
}
struct WithdrawData {
address owner;
address horseAddress;
uint256 horseId;
uint256 blockExpired;
string nonce;
uint8 v;
bytes32 r;
bytes32 s;
}
struct SavedWithdraw {
address owner;
address horseAddress;
uint256 horseId;
uint256 blockExpired;
}
// Mapping from nft token id to owner of token
mapping(address => mapping(uint256 => address)) public ownerOf;
// Mapping from sign message to checking value
mapping(bytes32 => bool) public leaseCompleted;
// Mapping from nonce to leaseData
mapping(string => SavedLease) public leaseData;
// Mapping from user address to lease count
mapping(address => uint256) public leaseCountOf;
// Mapping from user address and lease index to lease nonce
mapping(address => mapping(uint256 => string)) public leaseNoneOf;
// Mapping from sign message to checking value
mapping(bytes32 => bool) public withdrawCompleted;
// Mapping from nonce to withdrawData
mapping(string => SavedWithdraw) public withdrawData;
// Mapping from user address to withdraw count
mapping(address => uint256) public withdrawCountOf;
// Mapping from user address and withdraw index to withdraw nonce
mapping(address => mapping(uint256 => string)) public withdrawNoneOf;
//Mapping verify horsenft
mapping(address => bool) public isHorseNFT;
event Lease(address indexed owner, address indexed signer, uint256 indexed horseId, string nonce);
event Withdraw(address indexed owner, address indexed signer, uint256 indexed horseId, string nonce);
event Signer(address signers);
ITransporter public transporter;
ICollection721 public collection721;
mapping(address => mapping(uint256 => uint256[])) public horseItems;
function init() external initializer {
super.initialize();
super.__Pausable_init();
}
function pause() external virtual onlyOwner {
_pause();
}
function unpause() external virtual onlyOwner {
_unpause();
}
function setCollection(address _collection) external operatorOrOwner {
collection721 = ICollection721(_collection);
}
function setTransporter(address _transporter) external onlyOwner {
transporter = ITransporter(_transporter);
}
function setHorseNFT(address _horseNFT) external virtual operatorOrOwner {
isHorseNFT[_horseNFT] = true;
}
/**
* @dev withdraw token that user mistakenly transferred.
*/
function withdrawToken(address token) external virtual onlyOwner {
uint256 amount = IERC20(token).balanceOf(address(this));
require(amount > 0, "HorseFarmV2: zero out amount");
IERC20(token).safeTransfer(msg.sender, amount);
}
/**
* @dev withdraw nft that user mistakenly transferred.
*/
function withdrawNFT(address token, uint256 tokenId) external virtual onlyOwner {
require(!isHorseNFT[token] || ownerOf[token][tokenId] == address(0), "HorseFarmV2: horse belong to contract");
IERC721(token).safeTransferFrom(address(this), msg.sender, tokenId);
}
/**
* @dev user lease horse.
*/
function lease(LeaseData memory data, uint256[] memory items) external virtual nonReentrant whenNotPaused {
require(isHorseNFT[data.horseAddress], "HorseFarmV2: invalid horse address");
require(msg.sender == data.owner, "HorseFarmV2: sender is not owner");
(bytes32 message, address signer) = _verifyLease(data);
leaseCompleted[message] = true;
leaseData[data.nonce] = SavedLease({
owner: data.owner,
horseAddress: data.horseAddress,
horseId: data.horseId,
blockExpired: data.blockExpired
});
leaseNoneOf[data.owner][leaseCountOf[data.owner]] = data.nonce;
leaseCountOf[data.owner] = leaseCountOf[data.owner].add(1);
ownerOf[data.horseAddress][data.horseId] = data.owner;
transporter.safeTransferNFT721From(data.horseAddress, data.owner, address(this), data.horseId);
if (items.length != 0) {
horseItems[data.horseAddress][data.horseId] = items;
collection721.batchSetLocked(items, true);
}
emit Lease(data.owner, signer, data.horseId, data.nonce);
}
function _verifyLease(LeaseData memory data) internal view returns (bytes32, address) {
bytes32 message = keccak256(
abi.encode(
address(this),
"Lease",
data.owner,
data.horseAddress,
data.horseId,
data.blockExpired,
data.nonce
)
);
address signer = message.toString().recover(data.v, data.r, data.s);
require(operators[signer], "HorseFarmV2: lease not verify");
require(block.number < data.blockExpired, "HorseFarmV2: lease expired");
require(!leaseCompleted[message], "HorseFarmV2: lease completed");
require(leaseData[data.nonce].owner == address(0), "HorseFarmV2: nonce existed");
return (message, signer);
}
/**
* @dev user withdraw horse.
*/
function withdraw(WithdrawData memory data) external virtual nonReentrant whenNotPaused {
require(isHorseNFT[data.horseAddress], "HorseFarmV2: invalid horse address");
require(ownerOf[data.horseAddress][data.horseId] != address(0), "HorseFarmV2: horse withdrawed");
require(msg.sender == data.owner, "HorseFarmV2: sender is not owner");
require(msg.sender == ownerOf[data.horseAddress][data.horseId], "HorseFarmV2: sender is not horse owner");
(bytes32 message, address signer) = _verifyWithdraw(data);
withdrawCompleted[message] = true;
withdrawData[data.nonce] = SavedWithdraw({
owner: data.owner,
horseAddress: data.horseAddress,
horseId: data.horseId,
blockExpired: data.blockExpired
});
withdrawNoneOf[msg.sender][withdrawCountOf[msg.sender]] = data.nonce;
withdrawCountOf[msg.sender] = withdrawCountOf[msg.sender].add(1);
ownerOf[data.horseAddress][data.horseId] = address(0);
IERC721(data.horseAddress).safeTransferFrom(address(this), msg.sender, data.horseId);
if (horseItems[data.horseAddress][data.horseId].length != 0) {
collection721.batchSetLocked(horseItems[data.horseAddress][data.horseId], false);
delete horseItems[data.horseAddress][data.horseId];
}
emit Withdraw(msg.sender, signer, data.horseId, data.nonce);
}
function _verifyWithdraw(WithdrawData memory data) internal view returns (bytes32, address) {
bytes32 message = keccak256(
abi.encode(
address(this),
"Withdraw",
data.owner,
data.horseAddress,
data.horseId,
data.blockExpired,
data.nonce
)
);
address signer = message.toString().recover(data.v, data.r, data.s);
require(operators[signer], "HorseFarmV2: withdraw not verify");
require(block.number < data.blockExpired, "HorseFarmV2: withdraw expired");
require(!withdrawCompleted[message], "HorseFarmV2: withdraw completed");
require(withdrawData[data.nonce].blockExpired == 0, "HorseFarmV2: nonce existed");
return (message, signer);
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721ReceiverUpgradeable.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
function __ERC721Holder_init() internal onlyInitializing {
}
function __ERC721Holder_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
contracts/abtracts/OwnerOperator.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
abstract contract OwnerOperator is OwnableUpgradeable {
mapping(address => bool) public operators;
function initialize() public initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
modifier operatorOrOwner() {
require(operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner");
_;
}
modifier onlyOperator() {
require(operators[msg.sender], "OwnerOperator: !operator");
_;
}
function addOperator(address operator) external virtual onlyOwner {
require(operator != address(0), "OwnerOperator: operator is the zero address");
operators[operator] = true;
}
function removeOperator(address operator) external virtual onlyOwner {
require(operator != address(0), "OwnerOperator: operator is the zero address");
operators[operator] = false;
}
}
contracts/interfaces/ICollection721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ICollection721 {
function batchSetLocked(uint256[] memory tokenId, bool lock) external;
}
contracts/interfaces/ITransporter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ITransporter {
function safeTransferTokenFrom(
address token_,
address from_,
address to_,
uint256 amount_
) external;
function safeTransferNFT721From(
address token_,
address from_,
address to_,
uint256 tokenId_
) external;
function safeBurnNFT721From(address token_, uint256 tokenId_) external;
function safeTransferNFT1155From(
address token_,
address from_,
address to_,
uint256 tokenId_,
uint256 amount_
) external;
function safeBurnNFT1155From(
address token_,
address from_,
uint256 tokenId_,
uint256 amount_
) external;
function safeBurnBatchNFT1155From(
address token_,
address from_,
uint256[] memory tokenId_,
uint256[] memory amount_
) external;
}
contracts/libraries/BytesLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev BytesLibrary operations.
*/
library BytesLibrary {
function toString(bytes32 value) internal pure returns (string memory) {
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(64);
for (uint256 i = 0; i < 32; i++) {
str[i * 2] = alphabet[uint8(value[i] >> 4)];
str[1 + i * 2] = alphabet[uint8(value[i] & 0x0f)];
}
return string(str);
}
}
contracts/libraries/StringLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./UintLibrary.sol";
library StringLibrary {
using UintLibrary for uint256;
function append(string memory a, string memory b) internal pure returns (string memory) {
bytes memory ba = bytes(a);
bytes memory bb = bytes(b);
bytes memory bab = new bytes(ba.length + bb.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) bab[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) bab[k++] = bb[i];
return string(bab);
}
function append(
string memory a,
string memory b,
string memory c
) internal pure returns (string memory) {
bytes memory ba = bytes(a);
bytes memory bb = bytes(b);
bytes memory bc = bytes(c);
bytes memory bbb = new bytes(ba.length + bb.length + bc.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) bbb[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) bbb[k++] = bb[i];
for (uint256 i = 0; i < bc.length; i++) bbb[k++] = bc[i];
return string(bbb);
}
function recover(
string memory message,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
bytes memory msgBytes = bytes(message);
bytes memory fullMessage = concat(
bytes("\x19Ethereum Signed Message:\n"),
bytes(msgBytes.length.toString()),
msgBytes,
new bytes(0),
new bytes(0),
new bytes(0),
new bytes(0)
);
return ecrecover(keccak256(fullMessage), v, r, s);
}
function concat(
bytes memory ba,
bytes memory bb,
bytes memory bc,
bytes memory bd,
bytes memory be,
bytes memory bf,
bytes memory bg
) internal pure returns (bytes memory) {
bytes memory resultBytes = new bytes(ba.length + bb.length + bc.length + bd.length + be.length + bf.length + bg.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) resultBytes[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) resultBytes[k++] = bb[i];
for (uint256 i = 0; i < bc.length; i++) resultBytes[k++] = bc[i];
for (uint256 i = 0; i < bd.length; i++) resultBytes[k++] = bd[i];
for (uint256 i = 0; i < be.length; i++) resultBytes[k++] = be[i];
for (uint256 i = 0; i < bf.length; i++) resultBytes[k++] = bf[i];
for (uint256 i = 0; i < bg.length; i++) resultBytes[k++] = bg[i];
return resultBytes;
}
}
contracts/libraries/UintLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
library UintLibrary {
using SafeMath for uint256;
function toString(uint256 i) internal pure returns (string memory) {
if (i == 0) {
return "0";
}
uint256 j = i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
for (uint256 k = len; k > 0; k--) {
bstr[k - 1] = bytes1(uint8(48 + (i % 10)));
i /= 10;
}
return string(bstr);
}
function bp(uint256 value, uint256 bpValue) internal pure returns (uint256) {
return value.mul(bpValue).div(10000);
}
}
Contract ABI
[{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Lease","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256","name":"horseId","internalType":"uint256","indexed":true},{"type":"string","name":"nonce","internalType":"string","indexed":false}],"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":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Signer","inputs":[{"type":"address","name":"signers","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256","name":"horseId","internalType":"uint256","indexed":true},{"type":"string","name":"nonce","internalType":"string","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICollection721"}],"name":"collection721","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"horseItems","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isHorseNFT","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lease","inputs":[{"type":"tuple","name":"data","internalType":"struct HorseFarmV2.LeaseData","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"string","name":"nonce","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"uint256[]","name":"items","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"leaseCompleted","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"leaseCountOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"}],"name":"leaseData","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"leaseNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"operators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCollection","inputs":[{"type":"address","name":"_collection","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHorseNFT","inputs":[{"type":"address","name":"_horseNFT","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTransporter","inputs":[{"type":"address","name":"_transporter","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITransporter"}],"name":"transporter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"tuple","name":"data","internalType":"struct HorseFarmV2.WithdrawData","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"string","name":"nonce","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"withdrawCompleted","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawCountOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"}],"name":"withdrawData","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawNFT","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"withdrawNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"token","internalType":"address"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c80637a2ef48b1161010f5780639f9d8c58116100a2578063e1c7392a11610071578063e1c7392a146105f2578063e42b0212146105fa578063e817d0e51461061b578063f2fde38b1461062e576101f0565b80639f9d8c5814610587578063a8ed22a3146105a8578063ab82ca12146105cc578063ac8a584a146105df576101f0565b80638da5cb5b116100de5780638da5cb5b146105235780639870d7fe1461054157806399725af1146105545780639c8dadae14610574576101f0565b80637a2ef48b146104a55780638129fc1c146105005780638456cb59146105085780638947606914610510576101f0565b806332a46144116101875780636088e93a116101565780636088e93a14610464578063715018a6146104775780637324506f1461047f578063768b5fd514610492576101f0565b806332a46144146103995780633f4ba83a146103bd5780635c975abb146103c5578063604ff5a4146103d0576101f0565b8063150b7a02116101c3578063150b7a02146102a357806317c6395d1461030b5780631ed924f11461031e5780631f29d2dc14610333576101f0565b8063037a4a4a146101f557806304d45b491461021e57806307d0ef971461025157806313e7c9d814610280575b600080fd5b610208610203366004613c72565b610641565b604051610215919061404e565b60405180910390f35b61024161022c366004613ced565b60fd6020526000908152604090205460ff1681565b6040519015158152602001610215565b61027261025f366004613bdf565b6101036020526000908152604090205481565b604051908152602001610215565b61024161028e366004613bdf565b60976020526000908152604090205460ff1681565b6102da6102b1366004613bf9565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610215565b610208610319366004613c72565b6106e7565b61033161032c366004613bdf565b61070c565b005b610374610341366004613c72565b60fc60209081526000928352604080842090915290825290205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610215565b6102416103a7366004613bdf565b6101056020526000908152604090205460ff1681565b610331610818565b60985460ff16610241565b61042c6103de366004613d05565b80518082016020908101805161010282529282019190930120915280546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff92831693919092169184565b6040805173ffffffffffffffffffffffffffffffffffffffff9586168152949093166020850152918301526060820152608001610215565b610331610472366004613c72565b61082a565b6103316109b4565b61033161048d366004613d38565b6109c6565b6103316104a0366004613bdf565b610f03565b61042c6104b3366004613d05565b80518082016020908101805160fe82529282019190930120915280546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff92831693919092169184565b610331611002565b6103316111a3565b61033161051e366004613bdf565b6111b3565b60655473ffffffffffffffffffffffffffffffffffffffff16610374565b61033161054f366004613bdf565b6112e8565b610272610562366004613bdf565b60ff6020526000908152604090205481565b610331610582366004613bdf565b6113e2565b610107546103749073ffffffffffffffffffffffffffffffffffffffff1681565b6102416105b6366004613ced565b6101016020526000908152604090205460ff1681565b6102726105da366004613c9b565b611432565b6103316105ed366004613bdf565b611471565b610331611568565b610106546103749073ffffffffffffffffffffffffffffffffffffffff1681565b610331610629366004613e02565b6116a3565b61033161063c366004613bdf565b611d63565b6101046020908152600092835260408084209091529082529020805461066690614195565b80601f016020809104026020016040519081016040528092919081815260200182805461069290614195565b80156106df5780601f106106b4576101008083540402835291602001916106df565b820191906000526020600020905b8154815290600101906020018083116106c257829003601f168201915b505050505081565b6101006020908152600092835260408084209091529082529020805461066690614195565b3360009081526097602052604090205460ff168061075d57503361074560655473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b6107c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff1660009081526101056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b610820611e17565b610828611e98565b565b610832611e17565b73ffffffffffffffffffffffffffffffffffffffff82166000908152610105602052604090205460ff161580610898575073ffffffffffffffffffffffffffffffffffffffff828116600090815260fc6020908152604080832085845290915290205416155b610924576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f486f7273654661726d56323a20686f7273652062656c6f6e6720746f20636f6e60448201527f747261637400000000000000000000000000000000000000000000000000000060648201526084016107bf565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201523360248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8316906342842e0e90606401600060405180830381600087803b15801561099857600080fd5b505af11580156109ac573d6000803e3d6000fd5b505050505050565b6109bc611e17565b6108286000611f15565b6109ce611f8c565b6109d6612000565b60208083015173ffffffffffffffffffffffffffffffffffffffff166000908152610105909152604090205460ff16610a91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f486f7273654661726d56323a20696e76616c696420686f72736520616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016107bf565b815173ffffffffffffffffffffffffffffffffffffffff163314610b11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f486f7273654661726d56323a2073656e646572206973206e6f74206f776e657260448201526064016107bf565b600080610b1d8461206d565b600082815260fd602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055815160808082018452895173ffffffffffffffffffffffffffffffffffffffff90811683528a840151169282019290925288830151818401526060808a015190820152908801519151939550919350909160fe91610bb591613e97565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff92831617835585850151600184018054909216908316179055848301516002830155606090940151600390910155608087015187518416600090815261010084528281208951909516815260ff845282812054815293835292208251610c6f9391929190910190613982565b50835173ffffffffffffffffffffffffffffffffffffffff16600090815260ff6020526040902054610ca2906001612319565b845173ffffffffffffffffffffffffffffffffffffffff908116600090815260ff6020908152604080832094909455875181890180518516845260fc8352858420868b018051865293529285902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169185169190911790556101065491518851915194517fa5bc64ca000000000000000000000000000000000000000000000000000000008152908416600482015290831660248201523060448201526064810193909352169063a5bc64ca90608401600060405180830381600087803b158015610d8f57600080fd5b505af1158015610da3573d6000803e3d6000fd5b505050508251600014610e815760208085015173ffffffffffffffffffffffffffffffffffffffff16600090815261010882526040808220818801518352835290208451610df392860190613a06565b50610107546040517fd53ae81d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063d53ae81d90610e4e908690600190600401613fc5565b600060405180830381600087803b158015610e6857600080fd5b505af1158015610e7c573d6000803e3d6000fd5b505050505b83604001518173ffffffffffffffffffffffffffffffffffffffff16856000015173ffffffffffffffffffffffffffffffffffffffff167f6c0f40da73c577567dd97a5f1acfd9d4a433a9832757bf34c6bdee20791c113d8760800151604051610eeb919061404e565b60405180910390a45050610eff600160ca55565b5050565b3360009081526097602052604090205460ff1680610f54575033610f3c60655473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b610fba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e657260448201526064016107bf565b61010780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600054610100900460ff16158080156110225750600054600160ff909116105b8061104357506110313061232c565b158015611043575060005460ff166001145b6110cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016107bf565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561112d57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61113561234c565b61113d6123e3565b80156111a057600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b6111ab611e17565b610828612483565b6111bb611e17565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b15801561122357600080fd5b505afa158015611237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125b9190613e35565b9050600081116112c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f486f7273654661726d56323a207a65726f206f757420616d6f756e740000000060448201526064016107bf565b610eff73ffffffffffffffffffffffffffffffffffffffff831633836124de565b6112f0611e17565b73ffffffffffffffffffffffffffffffffffffffff8116611393576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084016107bf565b73ffffffffffffffffffffffffffffffffffffffff16600090815260976020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6113ea611e17565b61010680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b610108602052826000526040600020602052816000526040600020818154811061145b57600080fd5b9060005260206000200160009250925050505481565b611479611e17565b73ffffffffffffffffffffffffffffffffffffffff811661151c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084016107bf565b73ffffffffffffffffffffffffffffffffffffffff16600090815260976020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600054610100900460ff16158080156115885750600054600160ff909116105b806115a957506115973061232c565b1580156115a9575060005460ff166001145b611635576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016107bf565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561169357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61169b611002565b61113d612570565b6116ab611f8c565b6116b3612000565b60208082015173ffffffffffffffffffffffffffffffffffffffff166000908152610105909152604090205460ff1661176e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f486f7273654661726d56323a20696e76616c696420686f72736520616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016107bf565b60208082015173ffffffffffffffffffffffffffffffffffffffff908116600090815260fc8352604080822081860151835290935291909120541661180f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f486f7273654661726d56323a20686f727365207769746864726177656400000060448201526064016107bf565b805173ffffffffffffffffffffffffffffffffffffffff16331461188f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f486f7273654661726d56323a2073656e646572206973206e6f74206f776e657260448201526064016107bf565b60208181015173ffffffffffffffffffffffffffffffffffffffff908116600090815260fc835260408082208186015183529093529190912054163314611958576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f486f7273654661726d56323a2073656e646572206973206e6f7420686f72736560448201527f206f776e6572000000000000000000000000000000000000000000000000000060648201526084016107bf565b6000806119648361260f565b6000828152610101602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055815160808082018452885173ffffffffffffffffffffffffffffffffffffffff90811683528984015116928201929092528783015181840152606080890151908201529087015191519395509193509091610102916119fe91613e97565b908152604080519182900360209081019092208351815473ffffffffffffffffffffffffffffffffffffffff9182167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178355858501516001840180549190931691161790558382015160028201556060909301516003909301929092556080850151336000908152610104835283812061010384528482205482528352929092208251611ab59391929190910190613982565b503360009081526101036020526040902054611ad2906001612319565b3360008181526101036020908152604080832094909455868101805173ffffffffffffffffffffffffffffffffffffffff908116845260fc83528584208987018051865293529285902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905551905193517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526024810193909352604483019390935291909116906342842e0e90606401600060405180830381600087803b158015611ba857600080fd5b505af1158015611bbc573d6000803e3d6000fd5b5050505060208381015173ffffffffffffffffffffffffffffffffffffffff16600090815261010882526040808220818701518352909252205415611ce9576101075460208085015173ffffffffffffffffffffffffffffffffffffffff90811660009081526101088352604080822081890151835290935282812092517fd53ae81d000000000000000000000000000000000000000000000000000000008152919093169263d53ae81d92611c7792909190600401614010565b600060405180830381600087803b158015611c9157600080fd5b505af1158015611ca5573d6000803e3d6000fd5b5050505060208381015173ffffffffffffffffffffffffffffffffffffffff16600090815261010882526040808220818701518352909252908120611ce991613a40565b82604001518173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c73b702b261c879bc4ebea83f44bd0c9a90cffb4aa0f324e52750d831b9cb4f8660800151604051611d4f919061404e565b60405180910390a450506111a0600160ca55565b611d6b611e17565b73ffffffffffffffffffffffffffffffffffffffff8116611e0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107bf565b6111a081611f15565b60655473ffffffffffffffffffffffffffffffffffffffff163314610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107bf565b611ea0612881565b609880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6065805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600260ca541415611ff9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107bf565b600260ca55565b60985460ff1615610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107bf565b600080600030846000015185602001518660400151876060015188608001516040516020016120a196959493929190613eb3565b60405160208183030381529060405280519060200120905060006120de8560a001518660c001518760e001516120d6866128ed565b929190612bbc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526097602052604090205490915060ff16612170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f486f7273654661726d56323a206c65617365206e6f742076657269667900000060448201526064016107bf565b846060015143106121dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f486f7273654661726d56323a206c65617365206578706972656400000000000060448201526064016107bf565b600082815260fd602052604090205460ff1615612256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f486f7273654661726d56323a206c6561736520636f6d706c657465640000000060448201526064016107bf565b600073ffffffffffffffffffffffffffffffffffffffff1660fe86608001516040516122829190613e97565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff161461230f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f486f7273654661726d56323a206e6f6e6365206578697374656400000000000060448201526064016107bf565b9092509050915091565b600061232582846140b0565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff16610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107bf565b600054610100900460ff1661247a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107bf565b61082833611f15565b61248b612000565b609880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eeb3390565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261256b908490612ccf565b505050565b600054610100900460ff16612607576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107bf565b610828612ddb565b6000806000308460000151856020015186604001518760600151886080015160405160200161264396959493929190613f43565b60405160208183030381529060405280519060200120905060006126788560a001518660c001518760e001516120d6866128ed565b73ffffffffffffffffffffffffffffffffffffffff811660009081526097602052604090205490915060ff1661270a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f486f7273654661726d56323a207769746864726177206e6f742076657269667960448201526064016107bf565b84606001514310612777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f486f7273654661726d56323a207769746864726177206578706972656400000060448201526064016107bf565b6000828152610101602052604090205460ff16156127f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f486f7273654661726d56323a20776974686472617720636f6d706c657465640060448201526064016107bf565b61010285608001516040516128069190613e97565b90815260200160405180910390206003015460001461230f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f486f7273654661726d56323a206e6f6e6365206578697374656400000000000060448201526064016107bf565b60985460ff16610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107bf565b604080518082018252601081527f30313233343536373839616263646566000000000000000000000000000000006020820152815182815260608181018452926000919060208201818036833701905050905060005b6020811015612bb457826004868360208110612988577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff16815181106129ed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682612a208360026140dc565b81518110612a57577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082858260208110612ac0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b825191901a600f16908110612afe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682612b318360026140dc565b612b3c9060016140b0565b81518110612b73577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080612bac816141e9565b915050612943565b509392505050565b6000808590506000612c346040518060400160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a000000000000815250612c078451612e9c565b60408051600080825260208201818152828401828152606084019283526080840190945288939091613031565b90506001818051906020012087878760405160008152602001604052604051612c79949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015612c9b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6000612d31826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166137989092919063ffffffff16565b80519091501561256b5780806020019051810190612d4f9190613ccd565b61256b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107bf565b600054610100900460ff16612e72576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107bf565b609880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b606081612edd575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152612347565b8160005b8115612f075780612ef1816141e9565b9150612f009050600a836140c8565b9150612ee1565b60008167ffffffffffffffff811115612f49577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612f73576020820181803683370190505b509050815b801561302857612f89600a87614222565b612f949060306140b0565b60f81b82612fa3600184614119565b81518110612fda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613014600a876140c8565b95508061302081614160565b915050612f78565b50949350505050565b6060600082518451865188518a518c518e5161304d91906140b0565b61305791906140b0565b61306191906140b0565b61306b91906140b0565b61307591906140b0565b61307f91906140b0565b67ffffffffffffffff8111156130be577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156130e8576020820181803683370190505b5090506000805b8a518110156131dd578a8181518110613131577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff00000000000000000000000000000000000000000000000000000000000000168383613163816141e9565b94508151811061319c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806131d5816141e9565b9150506130ef565b5060005b89518110156132cf57898181518110613223577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff00000000000000000000000000000000000000000000000000000000000000168383613255816141e9565b94508151811061328e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806132c7816141e9565b9150506131e1565b5060005b88518110156133c157888181518110613315577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff00000000000000000000000000000000000000000000000000000000000000168383613347816141e9565b945081518110613380577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806133b9816141e9565b9150506132d3565b5060005b87518110156134b357878181518110613407577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff00000000000000000000000000000000000000000000000000000000000000168383613439816141e9565b945081518110613472577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806134ab816141e9565b9150506133c5565b5060005b86518110156135a5578681815181106134f9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361352b816141e9565b945081518110613564577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061359d816141e9565b9150506134b7565b5060005b8551811015613697578581815181106135eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361361d816141e9565b945081518110613656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061368f816141e9565b9150506135a9565b5060005b8451811015613789578481815181106136dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361370f816141e9565b945081518110613748577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080613781816141e9565b91505061369b565b50909998505050505050505050565b60606137a784846000856137af565b949350505050565b606082471015613841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107bf565b843b6138a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107bf565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516138d29190613e97565b60006040518083038185875af1925050503d806000811461390f576040519150601f19603f3d011682016040523d82523d6000602084013e613914565b606091505b509150915061392482828661392f565b979650505050505050565b6060831561393e575081612325565b82511561394e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107bf919061404e565b82805461398e90614195565b90600052602060002090601f0160209004810192826139b057600085556139f6565b82601f106139c957805160ff19168380011785556139f6565b828001600101855582156139f6579182015b828111156139f65782518255916020019190600101906139db565b50613a02929150613a5a565b5090565b8280548282559060005260206000209081019282156139f657916020028201828111156139f65782518255916020019190600101906139db565b50805460008255906000526020600020908101906111a091905b5b80821115613a025760008155600101613a5b565b600067ffffffffffffffff831115613a8957613a89614294565b613aba60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011601614061565b9050828152838383011115613ace57600080fd5b828260208301376000602084830101529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461234757600080fd5b600082601f830112613b19578081fd5b61232583833560208501613a6f565b6000610100808385031215613b3b578182fd5b613b4481614061565b915050613b5082613ae5565b8152613b5e60208301613ae5565b60208201526040820135604082015260608201356060820152608082013567ffffffffffffffff811115613b9157600080fd5b613b9d84828501613b09565b608083015250613baf60a08301613bce565b60a082015260c082013560c082015260e082013560e082015292915050565b803560ff8116811461234757600080fd5b600060208284031215613bf0578081fd5b61232582613ae5565b60008060008060808587031215613c0e578283fd5b613c1785613ae5565b9350613c2560208601613ae5565b925060408501359150606085013567ffffffffffffffff811115613c47578182fd5b8501601f81018713613c57578182fd5b613c6687823560208401613a6f565b91505092959194509250565b60008060408385031215613c84578182fd5b613c8d83613ae5565b946020939093013593505050565b600080600060608486031215613caf578283fd5b613cb884613ae5565b95602085013595506040909401359392505050565b600060208284031215613cde578081fd5b81518015158114612325578182fd5b600060208284031215613cfe578081fd5b5035919050565b600060208284031215613d16578081fd5b813567ffffffffffffffff811115613d2c578182fd5b6137a784828501613b09565b60008060408385031215613d4a578182fd5b823567ffffffffffffffff80821115613d61578384fd5b613d6d86838701613b28565b9350602091508185013581811115613d83578384fd5b8501601f81018713613d93578384fd5b803582811115613da557613da5614294565b8381029250613db5848401614061565b8181528481019083860185850187018b1015613dcf578788fd5b8795505b83861015613df1578035835260019590950194918601918601613dd3565b508096505050505050509250929050565b600060208284031215613e13578081fd5b813567ffffffffffffffff811115613e29578182fd5b6137a784828501613b28565b600060208284031215613e46578081fd5b5051919050565b60008151808452613e65816020860160208601614130565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251613ea9818460208701614130565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600560e08401527f4c65617365000000000000000000000000000000000000000000000000000000610100840152610120818916604085015281881660608501528660808501528560a08501528060c0850152613f3581850186613e4d565b9a9950505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600860e08401527f5769746864726177000000000000000000000000000000000000000000000000610100840152610120818916604085015281881660608501528660808501528560a08501528060c0850152613f3581850186613e4d565b604080825283519082018190526000906020906060840190828701845b82811015613ffe57815184529284019290840190600101613fe2565b50505093151592019190915250919050565b6000604082016040835280855480835260608501915086845260209250828420845b82811015613ffe57815484529284019260019182019101614032565b6000602082526123256020830184613e4d565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156140a8576140a8614294565b604052919050565b600082198211156140c3576140c3614236565b500190565b6000826140d7576140d7614265565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561411457614114614236565b500290565b60008282101561412b5761412b614236565b500390565b60005b8381101561414b578181015183820152602001614133565b8381111561415a576000848401525b50505050565b60008161416f5761416f614236565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6002810460018216806141a957607f821691505b602082108114156141e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561421b5761421b614236565b5060010190565b60008261423157614231614265565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220ccb3ef75b011069839383637a6f7b27f5b0e3b27a0839c068988dfb4561c7f0864736f6c63430008020033