Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 3 internal transactions
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x3d602d80 | 17659735 | 970 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 17635606 | 973 days ago | Contract Creation | 0 ETH | |||
| 0x60a06040 | 17613567 | 977 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
OpenPeerEscrowsDeployer
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2023-07-03
*/
// File: contracts/interfaces/IOpenPeerDeployer.sol
pragma solidity ^0.8.17;
interface IOpenPeerDeployer {
function partnerFeeBps(address _partner) external view returns (uint256);
}
// File: contracts/libs/ERC2771Context.sol
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Context variant with ERC2771 support.
*/
abstract contract ERC2771Context is Context {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address internal _trustedForwarder;
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(address trustedForwarder) {
_trustedForwarder = trustedForwarder;
}
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
return forwarder == _trustedForwarder;
}
function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return super._msgSender();
}
}
function _msgData() internal view virtual override returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return super._msgData();
}
}
}
// File: contracts/libs/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is ERC2771Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// 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 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
*
* 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);
}
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
// File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// OpenZeppelin Contracts (last updated v4.8.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
* ====
*
* [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://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 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 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);
}
}
}
// File: @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
/**
* @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]
* ```
* 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;
}
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
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);
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @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`.
*
* 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;
/**
* @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
// File: @openzeppelin/contracts/interfaces/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)
pragma solidity ^0.8.0;
// File: @openzeppelin/contracts/proxy/Clones.sol
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
* > a minimal bytecode implementation that delegates all calls to a known, fixed address.
*
* The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
* (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
* deterministic method.
*
* _Available since v3.4._
*/
library Clones {
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create opcode, which should never revert.
*/
function clone(address implementation) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create(0, 0x09, 0x37)
}
require(instance != address(0), "ERC1167: create failed");
}
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy
* the clone. Using the same `implementation` and `salt` multiple time will revert, since
* the clones cannot be deployed twice at the same address.
*/
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create2(0, 0x09, 0x37, salt)
}
require(instance != address(0), "ERC1167: create2 failed");
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt,
address deployer
) internal pure returns (address predicted) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(add(ptr, 0x38), deployer)
mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
mstore(add(ptr, 0x14), implementation)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
mstore(add(ptr, 0x58), salt)
mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
predicted := keccak256(add(ptr, 0x43), 0x55)
}
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt
) internal view returns (address predicted) {
return predictDeterministicAddress(implementation, salt, address(this));
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
/**
* @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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
// File: contracts/OpenPeerEscrow.sol
pragma solidity ^0.8.17;
contract OpenPeerEscrow is ERC2771Context, Initializable {
using SafeERC20 for IERC20;
mapping (bytes32 => Escrow) public escrows;
address payable public seller;
address public deployer;
address public arbitrator;
address payable public feeRecipient;
uint32 public sellerWaitingTime;
address public feeDiscountNFT;
uint256 public feeBps;
uint256 public immutable disputeFee = 0.001 ether;
mapping(bytes32 => mapping(address => bool)) public disputePayments;
/**********************
+ Events +
***********************/
event EscrowCreated(bytes32 indexed _orderHash);
event Released(bytes32 indexed _orderHash);
event CancelledByBuyer(bytes32 indexed _orderHash);
event SellerCancelDisabled(bytes32 indexed _orderHash);
event CancelledBySeller(bytes32 indexed _orderHash);
event DisputeOpened(bytes32 indexed _orderHash, address indexed _sender);
event DisputeResolved(bytes32 indexed _orderHash, address indexed _winner);
struct Escrow {
// So we know the escrow exists
bool exists;
// This is the timestamp in which the seller can cancel the escrow after.
// It has a special value:
// 1 : Permanently locked by the buyer (i.e. marked as paid; the seller can never cancel)
uint32 sellerCanCancelAfter;
uint256 fee;
bool dispute;
address payable partner;
uint256 openPeerFee;
}
/// @param _trustedForwarder Forwarder address
constructor(address _trustedForwarder) ERC2771Context(_trustedForwarder) {
_disableInitializers();
}
/// @param _seller Seller address
/// @param _feeBps OP fee (bps) ex: 30 == 0.3%
/// @param _arbitrator Address of the arbitrator (currently OP staff)
/// @param _feeRecipient Address to receive the fees
/// @param _sellerWaitingTime Number of seconds where the seller can cancel the order if the buyer did not pay
/// @param trustedForwarder Forwarder address
function initialize(
address payable _seller,
uint256 _feeBps,
address _arbitrator,
address payable _feeRecipient,
uint32 _sellerWaitingTime,
address trustedForwarder,
address _feeDiscountNFT
) external virtual initializer {
require(_seller != address(0), "Invalid seller");
require(_feeRecipient != address(0), "Invalid fee recipient");
require(_arbitrator != address(0), "Invalid arbitrator");
require(trustedForwarder != address(0), "Invalid trust forwarder");
seller = _seller;
feeBps = _feeBps;
arbitrator = _arbitrator;
feeRecipient = _feeRecipient;
sellerWaitingTime = _sellerWaitingTime;
_trustedForwarder = trustedForwarder;
feeDiscountNFT = _feeDiscountNFT;
deployer = _msgSender();
}
// Modifiers
modifier onlySeller() {
require(_msgSender() == seller, "Must be seller");
_;
}
modifier onlyArbitrator() {
require(_msgSender() == arbitrator, "Must be arbitrator");
_;
}
// Errors
error EscrowNotFound();
function createNativeEscrow(bytes32 _orderID, address payable _buyer, uint256 _amount, address payable _partner) external payable {
create(_orderID, _buyer, address(0), _amount, _partner);
}
function createERC20Escrow(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount, address payable _partner) external {
create(_orderID, _buyer, _token, _amount, _partner);
}
function create(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount, address payable _partner) private {
require(_amount > 0, "Invalid amount");
require(_buyer != address(0), "Invalid buyer");
require(_buyer != seller, "Seller and buyer must be different");
bytes32 _orderHash = keccak256(abi.encodePacked(_orderID, seller, _buyer, _token, _amount));
require(!escrows[_orderHash].exists, "Order already exists");
uint256 opFee = (_amount * openPeerFee() / 10_000);
uint256 orderFee = (_amount * sellerFee(_partner) / 10_000);
uint256 amount = orderFee + _amount;
if (_token == address(0)) {
require(msg.value == amount, "Incorrect MATIC sent");
} else {
uint256 balanceBefore = IERC20(_token).balanceOf(address(this));
IERC20(_token).safeTransferFrom(_msgSender(), address(this), amount);
uint256 balanceAfter = IERC20(_token).balanceOf(address(this));
require((balanceAfter - balanceBefore) == amount, "Wrong ERC20 amount");
}
Escrow memory escrow = Escrow(true, uint32(block.timestamp) + sellerWaitingTime, orderFee, false, _partner, opFee);
escrows[_orderHash] = escrow;
emit EscrowCreated(_orderHash);
}
/// @notice Disable the seller from cancelling
/// @return bool
function markAsPaid(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount) external returns (bool) {
require(_msgSender() == _buyer, "Must be buyer");
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
if(_escrow.sellerCanCancelAfter == 1) return false;
escrows[_orderHash].sellerCanCancelAfter = 1;
emit SellerCancelDisabled(_orderHash);
return true;
}
/// @notice Release ether or token in escrow to the buyer.
/// @return bool
function release(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount) external onlySeller returns (bool) {
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
transferEscrowAndFees(_orderHash, _buyer, _token, _buyer, _amount, _escrow.fee, _escrow.partner, _escrow.openPeerFee, false);
emit Released(_orderHash);
return true;
}
/// @notice Cancel the escrow as a buyer with 0 fees
/// @return bool
function buyerCancel(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount) external returns (bool) {
require(_msgSender() == _buyer, "Must be buyer");
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
transferEscrowAndFees(_orderHash, _buyer, _token, seller, _amount + _escrow.fee, 0, _escrow.partner, 0, false);
emit CancelledByBuyer(_orderHash);
return true;
}
/// @notice Cancel the escrow as a seller
/// @return bool
function sellerCancel(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount) external onlySeller returns (bool) {
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
if (_escrow.sellerCanCancelAfter <= 1 || _escrow.sellerCanCancelAfter > block.timestamp) {
return false;
}
transferEscrowAndFees(_orderHash, _buyer, _token, seller, _amount + _escrow.fee, 0, _escrow.partner, 0, false);
emit CancelledBySeller(_orderHash);
return true;
}
/// @notice Allow seller or buyer to open a dispute
function openDispute(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount) external payable returns (bool) {
require(_msgSender() == seller || _msgSender() == _buyer, "Must be seller or buyer");
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
require(_escrow.sellerCanCancelAfter == 1, "Cannot open a dispute yet");
require(msg.value == disputeFee, "To open a dispute, you must pay 1 MATIC");
require(!disputePayments[_orderHash][_msgSender()], "This address already paid for the dispute");
escrows[_orderHash].dispute = true;
disputePayments[_orderHash][_msgSender()] = true;
emit DisputeOpened(_orderHash, _msgSender());
return true;
}
/// @notice Allow arbitrator to resolve a dispute
/// @param _winner Address to receive the escrowed values - fees
function resolveDispute(bytes32 _orderID, address payable _buyer, address _token, uint256 _amount, address payable _winner) external onlyArbitrator returns (bool) {
Escrow memory _escrow;
bytes32 _orderHash;
(_escrow, _orderHash) = getEscrowAndHash(_orderID, _buyer, _token, _amount);
if (!_escrow.exists) {
revert EscrowNotFound();
}
require(_escrow.dispute, "Dispute is not open");
require(_winner == seller || _winner == _buyer, "Winner must be seller or buyer");
emit DisputeResolved(_orderHash, _winner);
transferEscrowAndFees(_orderHash, _buyer, _token, _winner, _amount, _escrow.fee, _escrow.partner, _escrow.openPeerFee, true);
return true;
}
/// @notice Transfer the value of an escrow
/// @param _to Recipient address
/// @param _amount Amount to be transfered
/// @param _fee Fee to be transfered
/// @param _disputeResolution Is a dispute being resolved?
function transferEscrowAndFees(
bytes32 _orderHash,
address payable _buyer,
address _token,
address payable _to,
uint256 _amount,
uint256 _fee,
address payable _partner,
uint256 _openPeerFee,
bool _disputeResolution
) private {
delete escrows[_orderHash];
bool sellerPaid = disputePayments[_orderHash][seller];
bool buyerPaid = disputePayments[_orderHash][_buyer];
delete disputePayments[_orderHash][seller];
delete disputePayments[_orderHash][_buyer];
// transfers the amount to the seller | buyer
withdraw(_token, _to, _amount);
if (_openPeerFee > 0) {
// transfers the OP fee to the fee recipient
withdraw(_token, feeRecipient, _openPeerFee);
}
if (_fee - _openPeerFee > 0) {
// transfers the OP fee to the fee recipient
withdraw(_token, _partner, _fee - _openPeerFee);
}
if (_disputeResolution) {
(bool sentToWinner,) = _to.call{value: disputeFee}("");
require(sentToWinner, "Failed to send the fee MATIC to the winner");
if (sellerPaid && buyerPaid) {
(bool sent,) = feeRecipient.call{value: disputeFee}("");
require(sent, "Failed to send the fee MATIC to the fee recipient");
}
} else if (sellerPaid && !buyerPaid) {
// only the seller paid for the dispute, returns the fee to the seller
(bool sent,) = seller.call{value: disputeFee}("");
require(sent, "Failed to send the fee MATIC to the seller");
} else if (buyerPaid && !sellerPaid) {
// only the buyer paid for the dispute, returns the fee to the buyer
(bool sent,) = _buyer.call{value: disputeFee}("");
require(sent, "Failed to send the fee MATIC to the buyer");
} else if (buyerPaid && sellerPaid) {
// seller and buyer paid for the dispute, split the fee between the winner and the fee recipient
(bool sentToWinner,) = _to.call{value: disputeFee}("");
require(sentToWinner, "Failed to send the fee MATIC to winner");
(bool sent,) = feeRecipient.call{value: disputeFee}("");
require(sent, "Failed to send the fee MATIC to the fee recipient");
}
}
/// @notice Withdraw values in the contract
/// @param _token Address of the token to withdraw fees in to
/// @param _to Address to withdraw fees in to
/// @param _amount Amount to withdraw
function withdraw(address _token, address payable _to, uint256 _amount) private {
if (_token == address(0)) {
(bool sent,) = _to.call{value: _amount}("");
require(sent, "Failed to send MATIC");
} else {
require(IERC20(_token).transfer(_to, _amount), "Failed to send tokens");
}
}
/// @notice Version recipient
function versionRecipient() external pure returns (string memory) {
return "1.0";
}
/// @notice Hashes the values and returns the matching escrow object and trade hash.
/// @dev Returns an empty escrow struct and 0 _orderHash if not found.
/// @param _orderID Escrow "_orderID" parameter
/// @param _buyer Escrow "buyer" parameter
/// @param _token Escrow "token" parameter
/// @param _amount Escrow "amount" parameter
/// @return Escrow
function getEscrowAndHash(
bytes32 _orderID,
address _buyer,
address _token,
uint256 _amount
) view private returns (Escrow memory, bytes32) {
bytes32 _orderHash = keccak256(abi.encodePacked(
_orderID,
seller,
_buyer,
_token,
_amount
));
return (escrows[_orderHash], _orderHash);
}
/***********************
+ Getters +
***********************/
function openPeerFee() public view returns (uint256) {
IERC721 discountNFT = IERC721(feeDiscountNFT);
if (feeDiscountNFT != address(0) && discountNFT.balanceOf(_msgSender()) > 0) {
return 0;
}
return feeBps;
}
function sellerFee(address _partner) public view returns (uint256) {
return openPeerFee() + IOpenPeerDeployer(deployer).partnerFeeBps(_partner);
}
}
// File: contracts/OpenPeerEscrowsDeployer.sol
pragma solidity ^0.8.17;
contract OpenPeerEscrowsDeployer is ERC2771Context, Ownable {
mapping (address => address) public sellerContracts;
mapping (address => uint256) public partnerFeeBps;
/***********************
+ Global settings +
***********************/
address public arbitrator;
address payable public feeRecipient;
uint256 private fee;
uint32 public sellerWaitingTime;
bool public stopped;
address public implementation;
// NFT contract for fee discounts
address public feeDiscountNFT;
/**********************
+ Events +
***********************/
event ContractCreated(address _seller, address _deployment);
/// @notice Settings
/// @param _arbitrator Address of the arbitrator (currently OP staff)
/// @param _feeRecipient Address to receive the fees
/// @param _fee OP fee (bps) ex: 30 == 0.3%
/// @param _sellerWaitingTime Number of seconds where the seller can cancel the order if the buyer did not pay
/// @param _trustedForwarder Forwarder address
/// @param _feeDiscountNFT NFT contract for fee discounts
constructor (
address _arbitrator,
address payable _feeRecipient,
uint256 _fee,
uint32 _sellerWaitingTime,
address _trustedForwarder,
address _feeDiscountNFT
) ERC2771Context(_trustedForwarder) {
arbitrator = _arbitrator;
feeRecipient = _feeRecipient;
fee = _fee;
sellerWaitingTime = _sellerWaitingTime;
feeDiscountNFT = _feeDiscountNFT;
implementation = address(new OpenPeerEscrow(_trustedForwarder));
}
/***********************
+ Modifiers +
***********************/
// circuit breaker modifiers
modifier stopInEmergency {
if (stopped) {
revert("Paused");
} else {
_;
}
}
function deploy() external returns (address) {
address deployment = Clones.clone(implementation);
OpenPeerEscrow(payable(deployment)).initialize(payable(_msgSender()),
fee,
arbitrator,
feeRecipient,
sellerWaitingTime,
_trustedForwarder,
feeDiscountNFT);
sellerContracts[_msgSender()] = deployment;
emit ContractCreated(_msgSender(), deployment);
return deployment;
}
/***********************
+ Setters +
***********************/
/// @notice Updates the arbitrator
/// @param _arbitrator Address of the arbitrator
function setArbitrator(address _arbitrator) public onlyOwner {
require(_arbitrator != address(0), "Invalid arbitrator");
arbitrator = _arbitrator;
}
/// @notice Updates the fee recipient
/// @param _feeRecipient Address of the arbitrator
function setFeeRecipient(address payable _feeRecipient) public onlyOwner {
require(_feeRecipient != address(0), "Invalid fee recipient");
feeRecipient = _feeRecipient;
}
/// @notice Updates the fee
/// @param _fee fee amount (bps)
function setFee(uint256 _fee) public onlyOwner {
require(_fee <= 100);
fee = _fee;
}
/// @notice Updates the seller cancelation time
/// @param _sellerWaitingTime Time in seconds
function setSellerWaitingTime(uint32 _sellerWaitingTime) public onlyOwner {
sellerWaitingTime = _sellerWaitingTime;
}
/// @notice Updates the forwarder
/// @param trustedForwarder biconomy forwarder
function setTrustedForwarder(address trustedForwarder) external onlyOwner {
require(trustedForwarder != address(0), "Invalid trust forwarder");
_trustedForwarder = trustedForwarder;
}
/// @notice Updates the implementation
/// @param _implementation Address of the implementation
function setImplementation(address payable _implementation) public onlyOwner {
require(_implementation != address(0), "Invalid implementation");
implementation = _implementation;
}
/// @notice Pauses and activate the contract
function toggleContractActive() public onlyOwner {
stopped = !stopped;
}
/// @notice Version recipient
function versionRecipient() external pure returns (string memory) {
return "1.0";
}
/// @notice Updates the NFT contract for fee discounts
function setFeeDiscountNFT(address _feeDiscountNFT) external onlyOwner {
feeDiscountNFT = _feeDiscountNFT;
}
function updatePartnerFeeBps(address[] calldata _partners, uint256[] calldata _fees) external onlyOwner {
require(_partners.length == _fees.length, "Invalid input");
for (uint256 i = 0; i < _partners.length; i++) {
require(_fees[i] <= 100, "Invalid fee bps");
require(_partners[i] != address(0), "Invalid partner address");
partnerFeeBps[_partners[i]] = _fees[i];
}
}
/***********************
+ Getters +
***********************/
function openPeerFee() public view returns (uint256) {
IERC721 discountNFT = IERC721(feeDiscountNFT);
if (feeDiscountNFT != address(0) && discountNFT.balanceOf(_msgSender()) > 0) {
return 0;
}
return fee;
}
function sellerFee(address _partner) public view returns (uint256) {
return openPeerFee() + partnerFeeBps[_partner];
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_arbitrator","type":"address"},{"internalType":"address payable","name":"_feeRecipient","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"uint32","name":"_sellerWaitingTime","type":"uint32"},{"internalType":"address","name":"_trustedForwarder","type":"address"},{"internalType":"address","name":"_feeDiscountNFT","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_seller","type":"address"},{"indexed":false,"internalType":"address","name":"_deployment","type":"address"}],"name":"ContractCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"arbitrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deploy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDiscountNFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openPeerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"partnerFeeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"sellerContracts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_partner","type":"address"}],"name":"sellerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellerWaitingTime","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_arbitrator","type":"address"}],"name":"setArbitrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeDiscountNFT","type":"address"}],"name":"setFeeDiscountNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_implementation","type":"address"}],"name":"setImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_sellerWaitingTime","type":"uint32"}],"name":"setSellerWaitingTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleContractActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_partners","type":"address[]"},{"internalType":"uint256[]","name":"_fees","type":"uint256[]"}],"name":"updatePartnerFeeBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620037df380380620037df8339810160408190526200003491620001e3565b600080546001600160a01b0319166001600160a01b038416179055620000636200005d6200012b565b62000166565b600480546001600160a01b03199081166001600160a01b038981169190911790925560058054821688841617905560068690556007805463ffffffff191663ffffffff8716179055600880549091169183169190911790556040518290620000cb90620001bc565b6001600160a01b039091168152602001604051809103906000f080158015620000f8573d6000803e3d6000fd5b50600760056101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050505062000273565b600080546001600160a01b031633036200014c575060131936013560601c90565b62000161620001b860201b62000ac91760201c565b905090565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b3390565b6126e080620010ff83390190565b6001600160a01b0381168114620001e057600080fd5b50565b60008060008060008060c08789031215620001fd57600080fd5b86516200020a81620001ca565b60208801519096506200021d81620001ca565b60408801516060890151919650945063ffffffff811681146200023f57600080fd5b60808801519093506200025281620001ca565b60a08801519092506200026581620001ca565b809150509295509295509295565b610e7c80620002836000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063775c300c116100de578063d784d42611610097578063e74b981b11610071578063e74b981b1461036a578063f1c9b1b31461037d578063f2fde38b1461039d578063f830baad146103b057600080fd5b8063d784d42614610331578063da74222814610344578063e0c8fb711461035757600080fd5b8063775c300c146102b75780638d0504e2146102bf5780638da5cb5b146102d55780639b501116146102e6578063b0eefabe146102f9578063c5af9c781461030c57600080fd5b8063572b6c0511610130578063572b6c05146102265780635c60da1b1461025857806369fe0e2d146102745780636cc6cde114610287578063715018a61461029a57806375f12b21146102a257600080fd5b80630f34542814610178578063130cd750146101be5780631385d24c146101d357806335c78b6f146101db57806346904840146101ee578063486ff0cd14610201575b600080fd5b6101a1610186366004610c6c565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d16101cc366004610cdc565b6103c3565b005b6101d161056b565b6101d16101e9366004610d48565b610596565b6005546101a1906001600160a01b031681565b60408051808201825260038152620312e360ec1b602082015290516101b59190610d6e565b610248610234366004610c6c565b6000546001600160a01b0391821691161490565b60405190151581526020016101b5565b6007546101a1906501000000000090046001600160a01b031681565b6101d1610282366004610dbc565b6105ba565b6004546101a1906001600160a01b031681565b6101d16105d5565b60075461024890640100000000900460ff1681565b6101a16105e9565b6102c7610750565b6040519081526020016101b5565b6001546001600160a01b03166101a1565b6101d16102f4366004610c6c565b610801565b6101d1610307366004610c6c565b61082b565b60075461031c9063ffffffff1681565b60405163ffffffff90911681526020016101b5565b6101d161033f366004610c6c565b6108a0565b6101d1610352366004610c6c565b610927565b6102c7610365366004610c6c565b6109a7565b6101d1610378366004610c6c565b6109d8565b6102c761038b366004610c6c565b60036020526000908152604090205481565b6101d16103ab366004610c6c565b610a50565b6008546101a1906001600160a01b031681565b6103cb610acd565b82811461040f5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b60448201526064015b60405180910390fd5b60005b8381101561056457606483838381811061042e5761042e610dd5565b9050602002013511156104755760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206665652062707360881b6044820152606401610406565b600085858381811061048957610489610dd5565b905060200201602081019061049e9190610c6c565b6001600160a01b0316036104f45760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420706172746e657220616464726573730000000000000000006044820152606401610406565b82828281811061050657610506610dd5565b905060200201356003600087878581811061052357610523610dd5565b90506020020160208101906105389190610c6c565b6001600160a01b031681526020810191909152604001600020558061055c81610e01565b915050610412565b5050505050565b610573610acd565b6007805464ff000000001981166401000000009182900460ff1615909102179055565b61059e610acd565b6007805463ffffffff191663ffffffff92909216919091179055565b6105c2610acd565b60648111156105d057600080fd5b600655565b6105dd610acd565b6105e76000610b46565b565b60008061060a600760059054906101000a90046001600160a01b0316610b98565b9050806001600160a01b0316636a977d77610623610c32565b6006546004805460055460075460005460085460405160e08a901b6001600160e01b03191681526001600160a01b039889169681019690965260248601969096529286166044850152908516606484015263ffffffff166084830152831660a4820152911660c482015260e401600060405180830381600087803b1580156106aa57600080fd5b505af11580156106be573d6000803e3d6000fd5b5050505080600260006106cf610c32565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b031916929091169190911790557f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b610729610c32565b604080516001600160a01b03928316815291841660208301520160405180910390a1919050565b6008546000906001600160a01b031680158015906107ec57506000816001600160a01b03166370a08231610782610c32565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190610e1a565b115b156107f957600091505090565b505060065490565b610809610acd565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610833610acd565b6001600160a01b03811661087e5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b6044820152606401610406565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6108a8610acd565b6001600160a01b0381166108f75760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b21034b6b83632b6b2b73a30ba34b7b760511b6044820152606401610406565b600780546001600160a01b03909216650100000000000265010000000000600160c81b0319909216919091179055565b61092f610acd565b6001600160a01b0381166109855760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f727761726465720000000000000000006044820152606401610406565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600360205260408120546109c8610750565b6109d29190610e33565b92915050565b6109e0610acd565b6001600160a01b038116610a2e5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610406565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b610a58610acd565b6001600160a01b038116610abd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610406565b610ac681610b46565b50565b3390565b610ad5610c32565b6001600160a01b0316610af06001546001600160a01b031690565b6001600160a01b0316146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610406565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610c2d5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610406565b919050565b600080546001600160a01b03163303610c52575060131936013560601c90565b503390565b6001600160a01b0381168114610ac657600080fd5b600060208284031215610c7e57600080fd5b8135610c8981610c57565b9392505050565b60008083601f840112610ca257600080fd5b50813567ffffffffffffffff811115610cba57600080fd5b6020830191508360208260051b8501011115610cd557600080fd5b9250929050565b60008060008060408587031215610cf257600080fd5b843567ffffffffffffffff80821115610d0a57600080fd5b610d1688838901610c90565b90965094506020870135915080821115610d2f57600080fd5b50610d3c87828801610c90565b95989497509550505050565b600060208284031215610d5a57600080fd5b813563ffffffff81168114610c8957600080fd5b600060208083528351808285015260005b81811015610d9b57858101830151858201604001528201610d7f565b506000604082860101526040601f19601f8301168501019250505092915050565b600060208284031215610dce57600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610e1357610e13610deb565b5060010190565b600060208284031215610e2c57600080fd5b5051919050565b808201808211156109d2576109d2610deb56fea26469706673582212209932b158b14082d208ff4c65ad1d29020670c5e6b4d278fd256b91a0960068a864736f6c6343000812003360a060405266038d7ea4c680006080523480156200001c57600080fd5b50604051620026e0380380620026e08339810160408190526200003f916200013a565b600080546001600160a01b0319166001600160a01b038316179055620000646200006b565b506200016c565b600054600160a81b900460ff1615620000da5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b9091048116101562000138576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200014d57600080fd5b81516001600160a01b03811681146200016557600080fd5b9392505050565b608051612527620001b96000396000818161042401528181610763015281816118a10152818161197b01528181611a2601528181611af301528181611bc50152611c8c01526125276000f3fe6080604052600436106101405760003560e01c80636a977d77116100b6578063c5194dc61161006f578063c5194dc614610446578063c5af9c7814610466578063cbdef6331461049f578063d5f39488146104bf578063e0c8fb71146104df578063f830baad146104ff57600080fd5b80636a977d771461037d5780636cc6cde11461039d5780638d0504e2146103bd5780638f9c2967146103d2578063a8300559146103f2578063b9ce896b1461041257600080fd5b806331e0a5631161010857806331e0a5631461028e57806346904840146102c9578063486ff0cd146102e95780634f004b151461031b578063572b6c051461032e5780635ff798af1461035d57600080fd5b8063055b89d21461014557806308551a531461015a5780631e93f1431461019757806324a9d853146101c75780632d83549c146101eb575b600080fd5b61015861015336600461211d565b61051f565b005b34801561016657600080fd5b5060025461017a906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101a357600080fd5b506101b76101b2366004612167565b610533565b604051901515815260200161018e565b3480156101d357600080fd5b506101dd60075481565b60405190815260200161018e565b3480156101f757600080fd5b5061024f6102063660046121af565b6001602081905260009182526040909120805491810154600282015460039092015460ff808516946101009081900463ffffffff16949182169291046001600160a01b03169086565b60408051961515875263ffffffff909516602087015293850192909252151560608401526001600160a01b0316608083015260a082015260c00161018e565b34801561029a57600080fd5b506101b76102a93660046121c8565b600860209081526000928352604080842090915290825290205460ff1681565b3480156102d557600080fd5b5060055461017a906001600160a01b031681565b3480156102f557600080fd5b5060408051808201825260038152620312e360ec1b6020820152905161018e919061221c565b6101b7610329366004612167565b61063d565b34801561033a57600080fd5b506101b761034936600461224f565b6000546001600160a01b0391821691161490565b34801561036957600080fd5b506101b7610378366004612273565b610915565b34801561038957600080fd5b506101586103983660046122d2565b610ad3565b3480156103a957600080fd5b5060045461017a906001600160a01b031681565b3480156103c957600080fd5b506101dd610dcf565b3480156103de57600080fd5b506101b76103ed366004612167565b610e80565b3480156103fe57600080fd5b5061015861040d366004612273565b610f83565b34801561041e57600080fd5b506101dd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045257600080fd5b506101b7610461366004612167565b610f97565b34801561047257600080fd5b5060055461048a90600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161018e565b3480156104ab57600080fd5b506101b76104ba366004612167565b611085565b3480156104cb57600080fd5b5060035461017a906001600160a01b031681565b3480156104eb57600080fd5b506101dd6104fa36600461224f565b6111b0565b34801561050b57600080fd5b5060065461017a906001600160a01b031681565b61052d848460008585611237565b50505050565b6000836001600160a01b03166105476116da565b6001600160a01b0316146105925760405162461bcd60e51b815260206004820152600d60248201526c26bab9ba10313290313abcb2b960991b60448201526064015b60405180910390fd5b61059a6120d0565b60006105a8878787876116ff565b815191935091506105cc5760405163f1d80ab160e01b815260040160405180910390fd5b816020015163ffffffff166001036105e957600092505050610635565b600081815260016020526040808220805464ffffffff0019166101001790555182917fe95fa7985c7585e90dab2dc46470726468662be06f67d79a31a5012e4bc0edeb91a26001925050505b949350505050565b6002546000906001600160a01b03166106546116da565b6001600160a01b031614806106815750836001600160a01b03166106766116da565b6001600160a01b0316145b6106cd5760405162461bcd60e51b815260206004820152601760248201527f4d7573742062652073656c6c6572206f722062757965720000000000000000006044820152606401610589565b6106d56120d0565b60006106e3878787876116ff565b815191935091506107075760405163f1d80ab160e01b815260040160405180910390fd5b816020015163ffffffff166001146107615760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74206f70656e2061206469737075746520796574000000000000006044820152606401610589565b7f000000000000000000000000000000000000000000000000000000000000000034146107e05760405162461bcd60e51b815260206004820152602760248201527f546f206f70656e206120646973707574652c20796f75206d757374207061792060448201526631204d4154494360c81b6064820152608401610589565b6000818152600860205260408120906107f76116da565b6001600160a01b0316815260208101919091526040016000205460ff16156108735760405162461bcd60e51b815260206004820152602960248201527f54686973206164647265737320616c7265616479207061696420666f7220746860448201526865206469737075746560b81b6064820152608401610589565b6000818152600160208181526040808420600201805460ff1916841790556008909152822090916108a26116da565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556108d26116da565b6001600160a01b0316817fe7b614d99462ab012c8191c9348164cd62a4aec6d211f42371fd1f0759e5c22060405160405180910390a35060019695505050505050565b6004546000906001600160a01b031661092c6116da565b6001600160a01b0316146109775760405162461bcd60e51b815260206004820152601260248201527126bab9ba1031329030b93134ba3930ba37b960711b6044820152606401610589565b61097f6120d0565b600061098d888888886116ff565b815191935091506109b15760405163f1d80ab160e01b815260040160405180910390fd5b81606001516109f85760405162461bcd60e51b81526020600482015260136024820152722234b9b83aba329034b9903737ba1037b832b760691b6044820152606401610589565b6002546001600160a01b0385811691161480610a255750866001600160a01b0316846001600160a01b0316145b610a715760405162461bcd60e51b815260206004820152601e60248201527f57696e6e6572206d7573742062652073656c6c6572206f7220627579657200006044820152606401610589565b6040516001600160a01b0385169082907fc513157869d5df7583154f47d70526162925e137610792515fae2d874b519daa90600090a3610ac58188888789876040015188608001518960a0015160016117c1565b506001979650505050505050565b600054600160a81b900460ff1615808015610afb57506000546001600160a01b90910460ff16105b80610b1c5750303b158015610b1c5750600054600160a01b900460ff166001145b610b7f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610589565b6000805460ff60a01b1916600160a01b1790558015610bac576000805460ff60a81b1916600160a81b1790555b6001600160a01b038816610bf35760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b63632b960911b6044820152606401610589565b6001600160a01b038516610c415760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610589565b6001600160a01b038616610c8c5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b6044820152606401610589565b6001600160a01b038316610ce25760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f727761726465720000000000000000006044820152606401610589565b600280546001600160a01b03808b166001600160a01b0319928316179092556007899055600480548984169083161790556005805463ffffffff8816600160a01b026001600160c01b031990911689851617179055600080548684169083161790556006805492851692909116919091179055610d5d6116da565b600380546001600160a01b0319166001600160a01b03929092169190911790558015610dc5576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6006546000906001600160a01b03168015801590610e6b57506000816001600160a01b03166370a08231610e016116da565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190612368565b115b15610e7857600091505090565b505060075490565b6000836001600160a01b0316610e946116da565b6001600160a01b031614610eda5760405162461bcd60e51b815260206004820152600d60248201526c26bab9ba10313290313abcb2b960991b6044820152606401610589565b610ee26120d0565b6000610ef0878787876116ff565b81519193509150610f145760405163f1d80ab160e01b815260040160405180910390fd5b6002546040830151610f4b918391899189916001600160a01b0390911690610f3c908a612397565b600088608001516000806117c1565b60405181907fd9b627ddaa414e8e6c82366cc9c179f6281d73968827cc17038a56852e28ac8b90600090a25060019695505050505050565b610f908585858585611237565b5050505050565b6002546000906001600160a01b0316610fae6116da565b6001600160a01b031614610ff55760405162461bcd60e51b815260206004820152600e60248201526d26bab9ba1031329039b2b63632b960911b6044820152606401610589565b610ffd6120d0565b600061100b878787876116ff565b8151919350915061102f5760405163f1d80ab160e01b815260040160405180910390fd5b61104d8187878988876040015188608001518960a0015160006117c1565b60405181907f6eec2dd2382427616d4ea7ef183b16091feac4e2e63c8b55f25215f132df8d1490600090a25060019695505050505050565b6002546000906001600160a01b031661109c6116da565b6001600160a01b0316146110e35760405162461bcd60e51b815260206004820152600e60248201526d26bab9ba1031329039b2b63632b960911b6044820152606401610589565b6110eb6120d0565b60006110f9878787876116ff565b8151919350915061111d5760405163f1d80ab160e01b815260040160405180910390fd5b6001826020015163ffffffff16111580611140575042826020015163ffffffff16115b1561115057600092505050610635565b6002546040830151611178918391899189916001600160a01b0390911690610f3c908a612397565b60405181907f366d2b4e6cc37ecebb3d7d41df6d581634fd8137412710a1e086e4ca4656bb5890600090a25060019695505050505050565b60035460405163f1c9b1b360e01b81526001600160a01b038381166004830152600092169063f1c9b1b390602401602060405180830381865afa1580156111fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121f9190612368565b611227610dcf565b6112319190612397565b92915050565b600082116112785760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610589565b6001600160a01b0384166112be5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210313abcb2b960991b6044820152606401610589565b6002546001600160a01b03908116908516036113275760405162461bcd60e51b815260206004820152602260248201527f53656c6c657220616e64206275796572206d75737420626520646966666572656044820152611b9d60f21b6064820152608401610589565b60025460405160009161134e9188916001600160a01b0316908890889088906020016123aa565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915060ff16156113bd5760405162461bcd60e51b81526020600482015260146024820152734f7264657220616c72656164792065786973747360601b6044820152606401610589565b60006127106113ca610dcf565b6113d490866123e4565b6113de91906123fb565b905060006127106113ee856111b0565b6113f890876123e4565b61140291906123fb565b905060006114108683612397565b90506001600160a01b03871661146b578034146114665760405162461bcd60e51b8152602060048201526014602482015273125b98dbdc9c9958dd081350551250c81cd95b9d60621b6044820152606401610589565b6115b2565b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa1580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d69190612368565b90506114f56114e36116da565b6001600160a01b038a16903085611d1a565b6040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a0823190602401602060405180830381865afa15801561153c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115609190612368565b90508261156d838361241d565b146115af5760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c8115490cc8c08185b5bdd5b9d60721b6044820152606401610589565b50505b6040805160c08101909152600181526005546000919060208201906115e490600160a01b900463ffffffff1642612430565b63ffffffff90811682526020808301879052600060408085018290526001600160a01b038c811660608088019190915260809687018c90528c8452600180865283852089518154978b015164ffffffffff1990981690151564ffffffff001916176101009790981687029790971787558884015190870155870151600286018054978901516001600160a81b0319909816911515610100600160a81b03191691909117969091169093029490941790915560a0840151600390920191909155905191925086917f172bd7c7b396e5e48c349fc8e1c845f01eefba35dff18954119870b39fd05e799190a250505050505050505050565b600080546001600160a01b031633036116fa575060131936013560601c90565b503390565b6117076120d0565b60025460405160009182916117329189916001600160a01b03909116908990899089906020016123aa565b60408051808303601f190181528282528051602091820120600081815260018084529084902060c086018552805460ff808216151588526101009182900463ffffffff169588019590955291810154948601949094526002840154928316151560608601529091046001600160a01b0316608084015260039091015460a0830152909890975095505050505050565b6000898152600160208181526040808420805464ffffffffff19168155928301849055600280840180546001600160a81b031916905560039093018490556008825280842092546001600160a01b039081168552929091528083208054928c1684529220805460ff198084169094558154909316905560ff9081169116611849898989611d74565b831561186757600554611867908a906001600160a01b031686611d74565b6000611873858861241d565b111561188d5761188d8986611888878a61241d565b611d74565b8215611a01576000886001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611900576040519150601f19603f3d011682016040523d82523d6000602084013e611905565b606091505b50509050806119575760405162461bcd60e51b815260206004820152602a60248201526000805160206124d28339815191526044820152693a3432903bb4b73732b960b11b6064820152608401610589565b8280156119615750815b156119fb576005546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d80600081146119d3576040519150601f19603f3d011682016040523d82523d6000602084013e6119d8565b606091505b50509050806119f95760405162461bcd60e51b815260040161058990612454565b505b50611d0d565b818015611a0c575080155b15611ad5576002546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d8060008114611a7e576040519150601f19603f3d011682016040523d82523d6000602084013e611a83565b606091505b50509050806119fb5760405162461bcd60e51b815260206004820152602a60248201526000805160206124d28339815191526044820152693a34329039b2b63632b960b11b6064820152608401610589565b808015611ae0575081155b15611ba85760008a6001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611b52576040519150601f19603f3d011682016040523d82523d6000602084013e611b57565b606091505b50509050806119fb5760405162461bcd60e51b815260206004820152602960248201526000805160206124d28339815191526044820152683a343290313abcb2b960b91b6064820152608401610589565b808015611bb25750815b15611d0d576000886001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611c24576040519150601f19603f3d011682016040523d82523d6000602084013e611c29565b606091505b5050905080611c775760405162461bcd60e51b815260206004820152602660248201526000805160206124d28339815191526044820152653bb4b73732b960d11b6064820152608401610589565b6005546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d8060008114611ce4576040519150601f19603f3d011682016040523d82523d6000602084013e611ce9565b606091505b5050905080611d0a5760405162461bcd60e51b815260040161058990612454565b50505b5050505050505050505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261052d908590611ed8565b6001600160a01b038316611e1c576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611dcf576040519150601f19603f3d011682016040523d82523d6000602084013e611dd4565b606091505b505090508061052d5760405162461bcd60e51b81526020600482015260146024820152734661696c656420746f2073656e64204d4154494360601b6044820152606401610589565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8f9190612493565b611ed35760405162461bcd60e51b81526020600482015260156024820152744661696c656420746f2073656e6420746f6b656e7360581b6044820152606401610589565b505050565b6000611f2d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fad9092919063ffffffff16565b9050805160001480611f4e575080806020019051810190611f4e9190612493565b611ed35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610589565b6060610635848460008585600080866001600160a01b03168587604051611fd491906124b5565b60006040518083038185875af1925050503d8060008114612011576040519150601f19603f3d011682016040523d82523d6000602084013e612016565b606091505b509150915061202787838387612032565b979650505050505050565b606083156120a157825160000361209a576001600160a01b0385163b61209a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610589565b5081610635565b61063583838151156120b65781518083602001fd5b8060405162461bcd60e51b8152600401610589919061221c565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b6001600160a01b038116811461211a57600080fd5b50565b6000806000806080858703121561213357600080fd5b84359350602085013561214581612105565b925060408501359150606085013561215c81612105565b939692955090935050565b6000806000806080858703121561217d57600080fd5b84359350602085013561218f81612105565b9250604085013561219f81612105565b9396929550929360600135925050565b6000602082840312156121c157600080fd5b5035919050565b600080604083850312156121db57600080fd5b8235915060208301356121ed81612105565b809150509250929050565b60005b838110156122135781810151838201526020016121fb565b50506000910152565b602081526000825180602084015261223b8160408501602087016121f8565b601f01601f19169190910160400192915050565b60006020828403121561226157600080fd5b813561226c81612105565b9392505050565b600080600080600060a0868803121561228b57600080fd5b85359450602086013561229d81612105565b935060408601356122ad81612105565b92506060860135915060808601356122c481612105565b809150509295509295909350565b600080600080600080600060e0888a0312156122ed57600080fd5b87356122f881612105565b965060208801359550604088013561230f81612105565b9450606088013561231f81612105565b9350608088013563ffffffff8116811461233857600080fd5b925060a088013561234881612105565b915060c088013561235881612105565b8091505092959891949750929550565b60006020828403121561237a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561123157611231612381565b9485526bffffffffffffffffffffffff19606094851b8116602087015292841b83166034860152921b166048830152605c820152607c0190565b808202811582820484141761123157611231612381565b60008261241857634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561123157611231612381565b63ffffffff81811683821601908082111561244d5761244d612381565b5092915050565b60208082526031908201526000805160206124d28339815191526040820152701d1a1948199959481c9958da5c1a595b9d607a1b606082015260800190565b6000602082840312156124a557600080fd5b8151801515811461226c57600080fd5b600082516124c78184602087016121f8565b919091019291505056fe4661696c656420746f2073656e642074686520666565204d4154494320746f20a2646970667358221220847e6c4beff5c1bb4209d855d9a51575fe27895f3623f6e0fd61a191564cd91d64736f6c63430008120033000000000000000000000000630220d00cf136270f553c8577af18300f7b812c000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000001518000000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a86930000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063775c300c116100de578063d784d42611610097578063e74b981b11610071578063e74b981b1461036a578063f1c9b1b31461037d578063f2fde38b1461039d578063f830baad146103b057600080fd5b8063d784d42614610331578063da74222814610344578063e0c8fb711461035757600080fd5b8063775c300c146102b75780638d0504e2146102bf5780638da5cb5b146102d55780639b501116146102e6578063b0eefabe146102f9578063c5af9c781461030c57600080fd5b8063572b6c0511610130578063572b6c05146102265780635c60da1b1461025857806369fe0e2d146102745780636cc6cde114610287578063715018a61461029a57806375f12b21146102a257600080fd5b80630f34542814610178578063130cd750146101be5780631385d24c146101d357806335c78b6f146101db57806346904840146101ee578063486ff0cd14610201575b600080fd5b6101a1610186366004610c6c565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d16101cc366004610cdc565b6103c3565b005b6101d161056b565b6101d16101e9366004610d48565b610596565b6005546101a1906001600160a01b031681565b60408051808201825260038152620312e360ec1b602082015290516101b59190610d6e565b610248610234366004610c6c565b6000546001600160a01b0391821691161490565b60405190151581526020016101b5565b6007546101a1906501000000000090046001600160a01b031681565b6101d1610282366004610dbc565b6105ba565b6004546101a1906001600160a01b031681565b6101d16105d5565b60075461024890640100000000900460ff1681565b6101a16105e9565b6102c7610750565b6040519081526020016101b5565b6001546001600160a01b03166101a1565b6101d16102f4366004610c6c565b610801565b6101d1610307366004610c6c565b61082b565b60075461031c9063ffffffff1681565b60405163ffffffff90911681526020016101b5565b6101d161033f366004610c6c565b6108a0565b6101d1610352366004610c6c565b610927565b6102c7610365366004610c6c565b6109a7565b6101d1610378366004610c6c565b6109d8565b6102c761038b366004610c6c565b60036020526000908152604090205481565b6101d16103ab366004610c6c565b610a50565b6008546101a1906001600160a01b031681565b6103cb610acd565b82811461040f5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b60448201526064015b60405180910390fd5b60005b8381101561056457606483838381811061042e5761042e610dd5565b9050602002013511156104755760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206665652062707360881b6044820152606401610406565b600085858381811061048957610489610dd5565b905060200201602081019061049e9190610c6c565b6001600160a01b0316036104f45760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420706172746e657220616464726573730000000000000000006044820152606401610406565b82828281811061050657610506610dd5565b905060200201356003600087878581811061052357610523610dd5565b90506020020160208101906105389190610c6c565b6001600160a01b031681526020810191909152604001600020558061055c81610e01565b915050610412565b5050505050565b610573610acd565b6007805464ff000000001981166401000000009182900460ff1615909102179055565b61059e610acd565b6007805463ffffffff191663ffffffff92909216919091179055565b6105c2610acd565b60648111156105d057600080fd5b600655565b6105dd610acd565b6105e76000610b46565b565b60008061060a600760059054906101000a90046001600160a01b0316610b98565b9050806001600160a01b0316636a977d77610623610c32565b6006546004805460055460075460005460085460405160e08a901b6001600160e01b03191681526001600160a01b039889169681019690965260248601969096529286166044850152908516606484015263ffffffff166084830152831660a4820152911660c482015260e401600060405180830381600087803b1580156106aa57600080fd5b505af11580156106be573d6000803e3d6000fd5b5050505080600260006106cf610c32565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b031916929091169190911790557f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b610729610c32565b604080516001600160a01b03928316815291841660208301520160405180910390a1919050565b6008546000906001600160a01b031680158015906107ec57506000816001600160a01b03166370a08231610782610c32565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190610e1a565b115b156107f957600091505090565b505060065490565b610809610acd565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610833610acd565b6001600160a01b03811661087e5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b6044820152606401610406565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6108a8610acd565b6001600160a01b0381166108f75760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b21034b6b83632b6b2b73a30ba34b7b760511b6044820152606401610406565b600780546001600160a01b03909216650100000000000265010000000000600160c81b0319909216919091179055565b61092f610acd565b6001600160a01b0381166109855760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f727761726465720000000000000000006044820152606401610406565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600360205260408120546109c8610750565b6109d29190610e33565b92915050565b6109e0610acd565b6001600160a01b038116610a2e5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610406565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b610a58610acd565b6001600160a01b038116610abd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610406565b610ac681610b46565b50565b3390565b610ad5610c32565b6001600160a01b0316610af06001546001600160a01b031690565b6001600160a01b0316146105e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610406565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610c2d5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610406565b919050565b600080546001600160a01b03163303610c52575060131936013560601c90565b503390565b6001600160a01b0381168114610ac657600080fd5b600060208284031215610c7e57600080fd5b8135610c8981610c57565b9392505050565b60008083601f840112610ca257600080fd5b50813567ffffffffffffffff811115610cba57600080fd5b6020830191508360208260051b8501011115610cd557600080fd5b9250929050565b60008060008060408587031215610cf257600080fd5b843567ffffffffffffffff80821115610d0a57600080fd5b610d1688838901610c90565b90965094506020870135915080821115610d2f57600080fd5b50610d3c87828801610c90565b95989497509550505050565b600060208284031215610d5a57600080fd5b813563ffffffff81168114610c8957600080fd5b600060208083528351808285015260005b81811015610d9b57858101830151858201604001528201610d7f565b506000604082860101526040601f19601f8301168501019250505092915050565b600060208284031215610dce57600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610e1357610e13610deb565b5060010190565b600060208284031215610e2c57600080fd5b5051919050565b808201808211156109d2576109d2610deb56fea26469706673582212209932b158b14082d208ff4c65ad1d29020670c5e6b4d278fd256b91a0960068a864736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000630220d00cf136270f553c8577af18300f7b812c000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000001518000000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a86930000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _arbitrator (address): 0x630220d00Cf136270f553c8577aF18300F7b812c
Arg [1] : _feeRecipient (address): 0xe872E7E3664F6AE78b62B360ACa667877bfEf088
Arg [2] : _fee (uint256): 30
Arg [3] : _sellerWaitingTime (uint32): 86400
Arg [4] : _trustedForwarder (address): 0x84a0856b038eaAd1cC7E297cF34A7e72685A8693
Arg [5] : _feeDiscountNFT (address): 0x0000000000000000000000000000000000000000
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000630220d00cf136270f553c8577af18300f7b812c
Arg [1] : 000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088
Arg [2] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [3] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [4] : 00000000000000000000000084a0856b038eaad1cc7e297cf34a7e72685a8693
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
67075:5884:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;67142:51;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;67142:51:0;;;;;;-1:-1:-1;;;;;566:32:1;;;548:51;;536:2;521:18;67142:51:0;;;;;;;;72013:442;;;;;;:::i;:::-;;:::i;:::-;;71592:86;;;:::i;70781:131::-;;;;;;:::i;:::-;;:::i;67379:35::-;;;;;-1:-1:-1;;;;;67379:35:0;;;71721:94;71796:12;;;;;;;;;;;-1:-1:-1;;;71796:12:0;;;;71721:94;;;;71796:12;71721:94;:::i;1533:138::-;;;;;;:::i;:::-;1609:4;1646:17;-1:-1:-1;;;;;1633:30:0;;;1646:17;;1633:30;;1533:138;;;;2983:14:1;;2976:22;2958:41;;2946:2;2931:18;1533:138:0;2818:187:1;67515:29:0;;;;;;;;-1:-1:-1;;;;;67515:29:0;;;70560:109;;;;;;:::i;:::-;;:::i;67347:25::-;;;;;-1:-1:-1;;;;;67347:25:0;;;4225:103;;;:::i;67487:19::-;;;;;;;;;;;;69022:796;;;:::i;72554:262::-;;;:::i;:::-;;;3341:25:1;;;3329:2;3314:18;72554:262:0;3195:177:1;3577:87:0;3650:6;;-1:-1:-1;;;;;3650:6:0;3577:87;;71883:122;;;;;;:::i;:::-;;:::i;70011:171::-;;;;;;:::i;:::-;;:::i;67447:31::-;;;;;;;;;;;;3551:10:1;3539:23;;;3521:42;;3509:2;3494:18;67447:31:0;3377:192:1;71331:203:0;;;;;;:::i;:::-;;:::i;71011:206::-;;;;;;:::i;:::-;;:::i;72824:132::-;;;;;;:::i;:::-;;:::i;70289:192::-;;;;;;:::i;:::-;;:::i;67200:49::-;;;;;;:::i;:::-;;;;;;;;;;;;;;4483:201;;;;;;:::i;:::-;;:::i;67592:29::-;;;;;-1:-1:-1;;;;;67592:29:0;;;72013:442;3463:13;:11;:13::i;:::-;72136:32;;::::1;72128:58;;;::::0;-1:-1:-1;;;72128:58:0;;4036:2:1;72128:58:0::1;::::0;::::1;4018:21:1::0;4075:2;4055:18;;;4048:30;-1:-1:-1;;;4094:18:1;;;4087:43;4147:18;;72128:58:0::1;;;;;;;;;72204:9;72199:249;72219:20:::0;;::::1;72199:249;;;72281:3;72269:5;;72275:1;72269:8;;;;;;;:::i;:::-;;;;;;;:15;;72261:43;;;::::0;-1:-1:-1;;;72261:43:0;;4510:2:1;72261:43:0::1;::::0;::::1;4492:21:1::0;4549:2;4529:18;;;4522:30;-1:-1:-1;;;4568:18:1;;;4561:45;4623:18;;72261:43:0::1;4308:339:1::0;72261:43:0::1;72351:1;72327:9:::0;;72337:1;72327:12;;::::1;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;72327:26:0::1;::::0;72319:62:::1;;;::::0;-1:-1:-1;;;72319:62:0;;4854:2:1;72319:62:0::1;::::0;::::1;4836:21:1::0;4893:2;4873:18;;;4866:30;4932:25;4912:18;;;4905:53;4975:18;;72319:62:0::1;4652:347:1::0;72319:62:0::1;72428:5;;72434:1;72428:8;;;;;;;:::i;:::-;;;;;;;72398:13;:27;72412:9;;72422:1;72412:12;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;72398:27:0::1;::::0;;::::1;::::0;::::1;::::0;;;;;;-1:-1:-1;72398:27:0;:38;72241:3;::::1;::::0;::::1;:::i;:::-;;;;72199:249;;;;72013:442:::0;;;;:::o;71592:86::-;3463:13;:11;:13::i;:::-;71663:7:::1;::::0;;-1:-1:-1;;71652:18:0;::::1;71663:7:::0;;;;::::1;;;71662:8;71652:18:::0;;::::1;;::::0;;71592:86::o;70781:131::-;3463:13;:11;:13::i;:::-;70866:17:::1;:38:::0;;-1:-1:-1;;70866:38:0::1;;::::0;;;::::1;::::0;;;::::1;::::0;;70781:131::o;70560:109::-;3463:13;:11;:13::i;:::-;70634:3:::1;70626:4;:11;;70618:20;;;::::0;::::1;;70651:3;:10:::0;70560:109::o;4225:103::-;3463:13;:11;:13::i;:::-;4290:30:::1;4317:1;4290:18;:30::i;:::-;4225:103::o:0;69022:796::-;69058:7;69078:18;69099:28;69112:14;;;;;;;;;-1:-1:-1;;;;;69112:14:0;69099:12;:28::i;:::-;69078:49;;69161:10;-1:-1:-1;;;;;69138:46:0;;69193:12;:10;:12::i;:::-;69271:3;;69339:10;;;69414:12;;69491:17;;69339:10;69573:17;69655:14;;69138:532;;;;;;-1:-1:-1;;;;;;69138:532:0;;;-1:-1:-1;;;;;5677:15:1;;;69138:532:0;;;5659:34:1;;;;5709:18;;;5702:34;;;;69339:10:0;;;5752:18:1;;;5745:43;69414:12:0;;;5804:18:1;;;5797:43;69491:17:0;;5856:19:1;;;5849:52;69573:17:0;;5917:19:1;;;5910:44;69655:14:0;;5970:19:1;;;5963:44;5593:19;;69138:532:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69713:10;69681:15;:29;69697:12;:10;:12::i;:::-;-1:-1:-1;;;;;69681:29:0;;;;;;;;;;;;;;-1:-1:-1;69681:29:0;:42;;-1:-1:-1;;;;;;69681:42:0;;;;;;;;;;;69739:41;69755:12;:10;:12::i;:::-;69739:41;;;-1:-1:-1;;;;;6248:15:1;;;6230:34;;6300:15;;;6295:2;6280:18;;6273:43;6165:18;69739:41:0;;;;;;;69800:10;69022:796;-1:-1:-1;69022:796:0:o;72554:262::-;72648:14;;72598:7;;-1:-1:-1;;;;;72648:14:0;72680:28;;;;;:71;;;72750:1;72712:11;-1:-1:-1;;;;;72712:21:0;;72734:12;:10;:12::i;:::-;72712:35;;-1:-1:-1;;;;;;72712:35:0;;;;;;;-1:-1:-1;;;;;566:32:1;;;72712:35:0;;;548:51:1;521:18;;72712:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:39;72680:71;72676:110;;;72773:1;72766:8;;;72554:262;:::o;72676:110::-;-1:-1:-1;;72805:3:0;;;72554:262::o;71883:122::-;3463:13;:11;:13::i;:::-;71965:14:::1;:32:::0;;-1:-1:-1;;;;;;71965:32:0::1;-1:-1:-1::0;;;;;71965:32:0;;;::::1;::::0;;;::::1;::::0;;71883:122::o;70011:171::-;3463:13;:11;:13::i;:::-;-1:-1:-1;;;;;70091:25:0;::::1;70083:56;;;::::0;-1:-1:-1;;;70083:56:0;;6718:2:1;70083:56:0::1;::::0;::::1;6700:21:1::0;6757:2;6737:18;;;6730:30;-1:-1:-1;;;6776:18:1;;;6769:48;6834:18;;70083:56:0::1;6516:342:1::0;70083:56:0::1;70150:10;:24:::0;;-1:-1:-1;;;;;;70150:24:0::1;-1:-1:-1::0;;;;;70150:24:0;;;::::1;::::0;;;::::1;::::0;;70011:171::o;71331:203::-;3463:13;:11;:13::i;:::-;-1:-1:-1;;;;;71427:29:0;::::1;71419:64;;;::::0;-1:-1:-1;;;71419:64:0;;7065:2:1;71419:64:0::1;::::0;::::1;7047:21:1::0;7104:2;7084:18;;;7077:30;-1:-1:-1;;;7123:18:1;;;7116:52;7185:18;;71419:64:0::1;6863:346:1::0;71419:64:0::1;71494:14;:32:::0;;-1:-1:-1;;;;;71494:32:0;;::::1;::::0;::::1;-1:-1:-1::0;;;;;;71494:32:0;;::::1;::::0;;;::::1;::::0;;71331:203::o;71011:206::-;3463:13;:11;:13::i;:::-;-1:-1:-1;;;;;71104:30:0;::::1;71096:66;;;::::0;-1:-1:-1;;;71096:66:0;;7416:2:1;71096:66:0::1;::::0;::::1;7398:21:1::0;7455:2;7435:18;;;7428:30;7494:25;7474:18;;;7467:53;7537:18;;71096:66:0::1;7214:347:1::0;71096:66:0::1;71173:17;:36:::0;;-1:-1:-1;;;;;;71173:36:0::1;-1:-1:-1::0;;;;;71173:36:0;;;::::1;::::0;;;::::1;::::0;;71011:206::o;72824:132::-;-1:-1:-1;;;;;72925:23:0;;72882:7;72925:23;;;:13;:23;;;;;;72909:13;:11;:13::i;:::-;:39;;;;:::i;:::-;72902:46;72824:132;-1:-1:-1;;72824:132:0:o;70289:192::-;3463:13;:11;:13::i;:::-;-1:-1:-1;;;;;70381:27:0;::::1;70373:61;;;::::0;-1:-1:-1;;;70373:61:0;;7898:2:1;70373:61:0::1;::::0;::::1;7880:21:1::0;7937:2;7917:18;;;7910:30;-1:-1:-1;;;7956:18:1;;;7949:51;8017:18;;70373:61:0::1;7696:345:1::0;70373:61:0::1;70445:12;:28:::0;;-1:-1:-1;;;;;;70445:28:0::1;-1:-1:-1::0;;;;;70445:28:0;;;::::1;::::0;;;::::1;::::0;;70289:192::o;4483:201::-;3463:13;:11;:13::i;:::-;-1:-1:-1;;;;;4572:22:0;::::1;4564:73;;;::::0;-1:-1:-1;;;4564:73:0;;8248:2:1;4564:73:0::1;::::0;::::1;8230:21:1::0;8287:2;8267:18;;;8260:30;8326:34;8306:18;;;8299:62;-1:-1:-1;;;8377:18:1;;;8370:36;8423:19;;4564:73:0::1;8046:402:1::0;4564:73:0::1;4648:28;4667:8;4648:18;:28::i;:::-;4483:201:::0;:::o;812:98::-;892:10;;812:98::o;3742:132::-;3817:12;:10;:12::i;:::-;-1:-1:-1;;;;;3806:23:0;:7;3650:6;;-1:-1:-1;;;;;3650:6:0;;3577:87;3806:7;-1:-1:-1;;;;;3806:23:0;;3798:68;;;;-1:-1:-1;;;3798:68:0;;8655:2:1;3798:68:0;;;8637:21:1;;;8674:18;;;8667:30;8733:34;8713:18;;;8706:62;8785:18;;3798:68:0;8453:356:1;4844:191:0;4937:6;;;-1:-1:-1;;;;;4954:17:0;;;-1:-1:-1;;;;;;4954:17:0;;;;;;;4987:40;;4937:6;;;4954:17;4937:6;;4987:40;;4918:16;;4987:40;4907:128;4844:191;:::o;39466:770::-;39523:16;39860:48;39842:14;39836:4;39832:25;39826:4;39822:36;39819:90;39813:4;39806:104;40069:32;40052:14;40046:4;40042:25;40039:63;40033:4;40026:77;40145:4;40139;40136:1;40129:21;40117:33;-1:-1:-1;;;;;;40179:22:0;;40171:57;;;;-1:-1:-1;;;40171:57:0;;9016:2:1;40171:57:0;;;8998:21:1;9055:2;9035:18;;;9028:30;-1:-1:-1;;;9074:18:1;;;9067:52;9136:18;;40171:57:0;8814:346:1;40171:57:0;39466:770;;;:::o;1679:410::-;1741:14;1646:17;;-1:-1:-1;;;;;1646:17:0;1791:10;1633:30;1768:314;;-1:-1:-1;;;1977:14:0;1973:23;1960:37;1956:2;1952:46;1679:410;:::o;1768:314::-;-1:-1:-1;892:10:0;;1679:410::o;14:131:1:-;-1:-1:-1;;;;;89:31:1;;79:42;;69:70;;135:1;132;125:12;150:247;209:6;262:2;250:9;241:7;237:23;233:32;230:52;;;278:1;275;268:12;230:52;317:9;304:23;336:31;361:5;336:31;:::i;:::-;386:5;150:247;-1:-1:-1;;;150:247:1:o;610:367::-;673:8;683:6;737:3;730:4;722:6;718:17;714:27;704:55;;755:1;752;745:12;704:55;-1:-1:-1;778:20:1;;821:18;810:30;;807:50;;;853:1;850;843:12;807:50;890:4;882:6;878:17;866:29;;950:3;943:4;933:6;930:1;926:14;918:6;914:27;910:38;907:47;904:67;;;967:1;964;957:12;904:67;610:367;;;;;:::o;982:773::-;1104:6;1112;1120;1128;1181:2;1169:9;1160:7;1156:23;1152:32;1149:52;;;1197:1;1194;1187:12;1149:52;1237:9;1224:23;1266:18;1307:2;1299:6;1296:14;1293:34;;;1323:1;1320;1313:12;1293:34;1362:70;1424:7;1415:6;1404:9;1400:22;1362:70;:::i;:::-;1451:8;;-1:-1:-1;1336:96:1;-1:-1:-1;1539:2:1;1524:18;;1511:32;;-1:-1:-1;1555:16:1;;;1552:36;;;1584:1;1581;1574:12;1552:36;;1623:72;1687:7;1676:8;1665:9;1661:24;1623:72;:::i;:::-;982:773;;;;-1:-1:-1;1714:8:1;-1:-1:-1;;;;982:773:1:o;1760:276::-;1818:6;1871:2;1859:9;1850:7;1846:23;1842:32;1839:52;;;1887:1;1884;1877:12;1839:52;1926:9;1913:23;1976:10;1969:5;1965:22;1958:5;1955:33;1945:61;;2002:1;1999;1992:12;2265:548;2377:4;2406:2;2435;2424:9;2417:21;2467:6;2461:13;2510:6;2505:2;2494:9;2490:18;2483:34;2535:1;2545:140;2559:6;2556:1;2553:13;2545:140;;;2654:14;;;2650:23;;2644:30;2620:17;;;2639:2;2616:26;2609:66;2574:10;;2545:140;;;2549:3;2734:1;2729:2;2720:6;2709:9;2705:22;2701:31;2694:42;2804:2;2797;2793:7;2788:2;2780:6;2776:15;2772:29;2761:9;2757:45;2753:54;2745:62;;;;2265:548;;;;:::o;3010:180::-;3069:6;3122:2;3110:9;3101:7;3097:23;3093:32;3090:52;;;3138:1;3135;3128:12;3090:52;-1:-1:-1;3161:23:1;;3010:180;-1:-1:-1;3010:180:1:o;4176:127::-;4237:10;4232:3;4228:20;4225:1;4218:31;4268:4;4265:1;4258:15;4292:4;4289:1;4282:15;5004:127;5065:10;5060:3;5056:20;5053:1;5046:31;5096:4;5093:1;5086:15;5120:4;5117:1;5110:15;5136:135;5175:3;5196:17;;;5193:43;;5216:18;;:::i;:::-;-1:-1:-1;5263:1:1;5252:13;;5136:135::o;6327:184::-;6397:6;6450:2;6438:9;6429:7;6425:23;6421:32;6418:52;;;6466:1;6463;6456:12;6418:52;-1:-1:-1;6489:16:1;;6327:184;-1:-1:-1;6327:184:1:o;7566:125::-;7631:9;;;7652:10;;;7649:36;;;7665:18;;:::i
Swarm Source
ipfs://847e6c4beff5c1bb4209d855d9a51575fe27895f3623f6e0fd61a191564cd91d
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.