Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 3 internal transactions
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 140184363 | 853 days ago | Contract Creation | 0 ETH | |||
| 122577535 | 908 days ago | Contract Creation | 0 ETH | |||
| 122275730 | 909 days ago | Contract Creation | 0 ETH |
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 Arbiscan.io on 2023-08-17
*/
// File: interfaces/IOpenPeerDeployer.sol
pragma solidity ^0.8.17;
interface IOpenPeerDeployer {
function partnerFeeBps(address _partner) external view returns (uint256);
}
// File: 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: 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.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
// File: @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// OpenZeppelin Contracts (last updated v4.9.0) (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]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
// 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.9.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.3) (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. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
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: 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;
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 trustedForwarder Forwarder address
function initialize(
address payable _seller,
uint256 _feeBps,
address _arbitrator,
address payable _feeRecipient,
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;
_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,
uint32 _sellerWaitingTime
) external payable {
create(
_orderID,
_buyer,
address(0),
_amount,
_partner,
_sellerWaitingTime
);
}
function createERC20Escrow(
bytes32 _orderID,
address payable _buyer,
address _token,
uint256 _amount,
address payable _partner,
uint32 _sellerWaitingTime
) external {
create(_orderID, _buyer, _token, _amount, _partner, _sellerWaitingTime);
}
function create(
bytes32 _orderID,
address payable _buyer,
address _token,
uint256 _amount,
address payable _partner,
uint32 _sellerWaitingTime
) private {
require(_amount > 0, "Invalid amount");
require(_buyer != address(0), "Invalid buyer");
require(_buyer != seller, "Seller and buyer must be different");
require(
_sellerWaitingTime >= 15 minutes && _sellerWaitingTime <= 1 days,
"Invalid seller waiting time"
);
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
) private view 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: 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;
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 _trustedForwarder Forwarder address
/// @param _feeDiscountNFT NFT contract for fee discounts
constructor(
address _arbitrator,
address payable _feeRecipient,
uint256 _fee,
address _trustedForwarder,
address _feeDiscountNFT
) ERC2771Context(_trustedForwarder) {
arbitrator = _arbitrator;
feeRecipient = _feeRecipient;
fee = _fee;
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,
_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 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":"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":[{"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":"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
60806040523480156200001157600080fd5b506040516200374e3803806200374e8339810160408190526200003491620001cc565b600080546001600160a01b0319166001600160a01b038416179055620000636200005d62000114565b6200014f565b600480546001600160a01b038088166001600160a01b03199283161790925560058054878416908316179055600685905560088054928416929091169190911790556040518290620000b590620001a5565b6001600160a01b039091168152602001604051809103906000f080158015620000e2573d6000803e3d6000fd5b50600760016101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050505062000240565b600080546001600160a01b0316330362000135575060131936013560601c90565b6200014a620001a160201b62000a151760201c565b905090565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b3390565b61275c8062000ff283390190565b6001600160a01b0381168114620001c957600080fd5b50565b600080600080600060a08688031215620001e557600080fd5b8551620001f281620001b3565b60208701519095506200020581620001b3565b6040870151606088015191955093506200021f81620001b3565b60808701519092506200023281620001b3565b809150509295509295909350565b610da280620002506000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063775c300c116100c3578063da7422281161007c578063da742228146102da578063e0c8fb71146102ed578063e74b981b14610300578063f1c9b1b314610313578063f2fde38b14610333578063f830baad1461034657600080fd5b8063775c300c146102725780638d0504e21461027a5780638da5cb5b146102905780639b501116146102a1578063b0eefabe146102b4578063d784d426146102c757600080fd5b8063572b6c0511610115578063572b6c05146101ed5780635c60da1b1461021f57806369fe0e2d146102375780636cc6cde11461024a578063715018a61461025d57806375f12b211461026557600080fd5b80630f34542814610152578063130cd750146101985780631385d24c146101ad57806346904840146101b5578063486ff0cd146101c8575b600080fd5b61017b610160366004610bb8565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101ab6101a6366004610c28565b610359565b005b6101ab610501565b60055461017b906001600160a01b031681565b60408051808201825260038152620312e360ec1b6020820152905161018f9190610c94565b61020f6101fb366004610bb8565b6000546001600160a01b0391821691161490565b604051901515815260200161018f565b60075461017b9061010090046001600160a01b031681565b6101ab610245366004610ce2565b61051d565b60045461017b906001600160a01b031681565b6101ab610538565b60075461020f9060ff1681565b61017b61054c565b6102826106a4565b60405190815260200161018f565b6001546001600160a01b031661017b565b6101ab6102af366004610bb8565b610755565b6101ab6102c2366004610bb8565b61077f565b6101ab6102d5366004610bb8565b6107f4565b6101ab6102e8366004610bb8565b610873565b6102826102fb366004610bb8565b6108f3565b6101ab61030e366004610bb8565b610924565b610282610321366004610bb8565b60036020526000908152604090205481565b6101ab610341366004610bb8565b61099c565b60085461017b906001600160a01b031681565b610361610a19565b8281146103a55760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b60448201526064015b60405180910390fd5b60005b838110156104fa5760648383838181106103c4576103c4610cfb565b90506020020135111561040b5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206665652062707360881b604482015260640161039c565b600085858381811061041f5761041f610cfb565b90506020020160208101906104349190610bb8565b6001600160a01b03160361048a5760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420706172746e65722061646472657373000000000000000000604482015260640161039c565b82828281811061049c5761049c610cfb565b90506020020135600360008787858181106104b9576104b9610cfb565b90506020020160208101906104ce9190610bb8565b6001600160a01b03168152602081019190915260400160002055806104f281610d27565b9150506103a8565b5050505050565b610509610a19565b6007805460ff19811660ff90911615179055565b610525610a19565b606481111561053357600080fd5b600655565b610540610a19565b61054a6000610a92565b565b60008061056d600760019054906101000a90046001600160a01b0316610ae4565b9050806001600160a01b031663a2dc2ab7610586610b7e565b6006546004805460055460005460085460405160e089901b6001600160e01b03191681526001600160a01b0397881695810195909552602485019590955291851660448401528416606483015283166084820152911660a482015260c401600060405180830381600087803b1580156105fe57600080fd5b505af1158015610612573d6000803e3d6000fd5b505050508060026000610623610b7e565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b031916929091169190911790557f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b61067d610b7e565b604080516001600160a01b03928316815291841660208301520160405180910390a1919050565b6008546000906001600160a01b0316801580159061074057506000816001600160a01b03166370a082316106d6610b7e565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e9190610d40565b115b1561074d57600091505090565b505060065490565b61075d610a19565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610787610a19565b6001600160a01b0381166107d25760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b604482015260640161039c565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6107fc610a19565b6001600160a01b03811661084b5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b21034b6b83632b6b2b73a30ba34b7b760511b604482015260640161039c565b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b61087b610a19565b6001600160a01b0381166108d15760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f72776172646572000000000000000000604482015260640161039c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600360205260408120546109146106a4565b61091e9190610d59565b92915050565b61092c610a19565b6001600160a01b03811661097a5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b604482015260640161039c565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6109a4610a19565b6001600160a01b038116610a095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161039c565b610a1281610a92565b50565b3390565b610a21610b7e565b6001600160a01b0316610a3c6001546001600160a01b031690565b6001600160a01b03161461054a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161039c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610b795760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b604482015260640161039c565b919050565b600080546001600160a01b03163303610b9e575060131936013560601c90565b503390565b6001600160a01b0381168114610a1257600080fd5b600060208284031215610bca57600080fd5b8135610bd581610ba3565b9392505050565b60008083601f840112610bee57600080fd5b50813567ffffffffffffffff811115610c0657600080fd5b6020830191508360208260051b8501011115610c2157600080fd5b9250929050565b60008060008060408587031215610c3e57600080fd5b843567ffffffffffffffff80821115610c5657600080fd5b610c6288838901610bdc565b90965094506020870135915080821115610c7b57600080fd5b50610c8887828801610bdc565b95989497509550505050565b600060208083528351808285015260005b81811015610cc157858101830151858201604001528201610ca5565b506000604082860101526040601f19601f8301168501019250505092915050565b600060208284031215610cf457600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610d3957610d39610d11565b5060010190565b600060208284031215610d5257600080fd5b5051919050565b8082018082111561091e5761091e610d1156fea26469706673582212208eeaea63724b95d34e8f643c909a622ff49922a3774ca3c2aeaf3b0c2932b66664736f6c6343000812003360a060405266038d7ea4c680006080523480156200001c57600080fd5b506040516200275c3803806200275c8339810160408190526200003f9162000139565b600080546001600160a01b0319166001600160a01b038316179055620000646200006b565b506200016b565b600054600160a81b900460ff1615620000da5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b600054600160a01b900460ff9081161462000137576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200014c57600080fd5b81516001600160a01b03811681146200016457600080fd5b9392505050565b6080516125a4620001b8600039600081816103e60152818161070b015281816113a50152818161147f0152818161152a015281816115f7015281816116c9015261179001526125a46000f3fe6080604052600436106101355760003560e01c80638d0504e2116100ab578063cbdef6331161006f578063cbdef63314610428578063d5f3948814610448578063e0c8fb7114610468578063f1f565ae14610488578063f7871aba1461049b578063f830baad146104bb57600080fd5b80638d0504e21461037d5780638f9c296714610392578063a2dc2ab7146103b2578063b9ce896b146103d4578063c5194dc61461040857600080fd5b806346904840116100fd57806346904840146102a9578063486ff0cd146102c95780634f004b15146102fb578063572b6c051461030e5780635ff798af1461033d5780636cc6cde11461035d57600080fd5b806308551a531461013a5780631e93f1431461017757806324a9d853146101a75780632d83549c146101cb57806331e0a5631461026e575b600080fd5b34801561014657600080fd5b5060025461015a906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561018357600080fd5b50610197610192366004612121565b6104db565b604051901515815260200161016e565b3480156101b357600080fd5b506101bd60075481565b60405190815260200161016e565b3480156101d757600080fd5b5061022f6101e6366004612169565b6001602081905260009182526040909120805491810154600282015460039092015460ff808516946101009081900463ffffffff16949182169291046001600160a01b03169086565b60408051961515875263ffffffff909516602087015293850192909252151560608401526001600160a01b0316608083015260a082015260c00161016e565b34801561027a57600080fd5b50610197610289366004612182565b600860209081526000928352604080842090915290825290205460ff1681565b3480156102b557600080fd5b5060055461015a906001600160a01b031681565b3480156102d557600080fd5b5060408051808201825260038152620312e360ec1b6020820152905161016e91906121d6565b610197610309366004612121565b6105e5565b34801561031a57600080fd5b50610197610329366004612209565b6000546001600160a01b0391821691161490565b34801561034957600080fd5b5061019761035836600461222d565b6108bd565b34801561036957600080fd5b5060045461015a906001600160a01b031681565b34801561038957600080fd5b506101bd610a7b565b34801561039e57600080fd5b506101976103ad366004612121565b610b2c565b3480156103be57600080fd5b506103d26103cd36600461228c565b610c2f565b005b3480156103e057600080fd5b506101bd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561041457600080fd5b50610197610423366004612121565b610f12565b34801561043457600080fd5b50610197610443366004612121565b611000565b34801561045457600080fd5b5060035461015a906001600160a01b031681565b34801561047457600080fd5b506101bd610483366004612209565b61112b565b6103d261049636600461231e565b6111b2565b3480156104a757600080fd5b506103d26104b6366004612379565b6111c8565b3480156104c757600080fd5b5060065461015a906001600160a01b031681565b6000836001600160a01b03166104ef6111de565b6001600160a01b03161461053a5760405162461bcd60e51b815260206004820152600d60248201526c26bab9ba10313290313abcb2b960991b60448201526064015b60405180910390fd5b6105426120d4565b600061055087878787611203565b815191935091506105745760405163f1d80ab160e01b815260040160405180910390fd5b816020015163ffffffff16600103610591576000925050506105dd565b600081815260016020526040808220805464ffffffff0019166101001790555182917fe95fa7985c7585e90dab2dc46470726468662be06f67d79a31a5012e4bc0edeb91a26001925050505b949350505050565b6002546000906001600160a01b03166105fc6111de565b6001600160a01b031614806106295750836001600160a01b031661061e6111de565b6001600160a01b0316145b6106755760405162461bcd60e51b815260206004820152601760248201527f4d7573742062652073656c6c6572206f722062757965720000000000000000006044820152606401610531565b61067d6120d4565b600061068b87878787611203565b815191935091506106af5760405163f1d80ab160e01b815260040160405180910390fd5b816020015163ffffffff166001146107095760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74206f70656e2061206469737075746520796574000000000000006044820152606401610531565b7f000000000000000000000000000000000000000000000000000000000000000034146107885760405162461bcd60e51b815260206004820152602760248201527f546f206f70656e206120646973707574652c20796f75206d757374207061792060448201526631204d4154494360c81b6064820152608401610531565b60008181526008602052604081209061079f6111de565b6001600160a01b0316815260208101919091526040016000205460ff161561081b5760405162461bcd60e51b815260206004820152602960248201527f54686973206164647265737320616c7265616479207061696420666f7220746860448201526865206469737075746560b81b6064820152608401610531565b6000818152600160208181526040808420600201805460ff19168417905560089091528220909161084a6111de565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905561087a6111de565b6001600160a01b0316817fe7b614d99462ab012c8191c9348164cd62a4aec6d211f42371fd1f0759e5c22060405160405180910390a35060019695505050505050565b6004546000906001600160a01b03166108d46111de565b6001600160a01b03161461091f5760405162461bcd60e51b815260206004820152601260248201527126bab9ba1031329030b93134ba3930ba37b960711b6044820152606401610531565b6109276120d4565b600061093588888888611203565b815191935091506109595760405163f1d80ab160e01b815260040160405180910390fd5b81606001516109a05760405162461bcd60e51b81526020600482015260136024820152722234b9b83aba329034b9903737ba1037b832b760691b6044820152606401610531565b6002546001600160a01b03858116911614806109cd5750866001600160a01b0316846001600160a01b0316145b610a195760405162461bcd60e51b815260206004820152601e60248201527f57696e6e6572206d7573742062652073656c6c6572206f7220627579657200006044820152606401610531565b6040516001600160a01b0385169082907fc513157869d5df7583154f47d70526162925e137610792515fae2d874b519daa90600090a3610a6d8188888789876040015188608001518960a0015160016112c5565b506001979650505050505050565b6006546000906001600160a01b03168015801590610b1757506000816001600160a01b03166370a08231610aad6111de565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1591906123e5565b115b15610b2457600091505090565b505060075490565b6000836001600160a01b0316610b406111de565b6001600160a01b031614610b865760405162461bcd60e51b815260206004820152600d60248201526c26bab9ba10313290313abcb2b960991b6044820152606401610531565b610b8e6120d4565b6000610b9c87878787611203565b81519193509150610bc05760405163f1d80ab160e01b815260040160405180910390fd5b6002546040830151610bf7918391899189916001600160a01b0390911690610be8908a612414565b600088608001516000806112c5565b60405181907fd9b627ddaa414e8e6c82366cc9c179f6281d73968827cc17038a56852e28ac8b90600090a25060019695505050505050565b600054600160a81b900460ff1615808015610c5757506000546001600160a01b90910460ff16105b80610c785750303b158015610c785750600054600160a01b900460ff166001145b610cdb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610531565b6000805460ff60a01b1916600160a01b1790558015610d08576000805460ff60a81b1916600160a81b1790555b6001600160a01b038716610d4f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b63632b960911b6044820152606401610531565b6001600160a01b038416610d9d5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b6044820152606401610531565b6001600160a01b038516610de85760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b6044820152606401610531565b6001600160a01b038316610e3e5760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f727761726465720000000000000000006044820152606401610531565b600280546001600160a01b03199081166001600160a01b038a811691909117909255600788905560048054821688841617905560058054821687841617905560008054821686841617905560068054909116918416919091179055610ea16111de565b600380546001600160a01b0319166001600160a01b03929092169190911790558015610f09576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6002546000906001600160a01b0316610f296111de565b6001600160a01b031614610f705760405162461bcd60e51b815260206004820152600e60248201526d26bab9ba1031329039b2b63632b960911b6044820152606401610531565b610f786120d4565b6000610f8687878787611203565b81519193509150610faa5760405163f1d80ab160e01b815260040160405180910390fd5b610fc88187878988876040015188608001518960a0015160006112c5565b60405181907f6eec2dd2382427616d4ea7ef183b16091feac4e2e63c8b55f25215f132df8d1490600090a25060019695505050505050565b6002546000906001600160a01b03166110176111de565b6001600160a01b03161461105e5760405162461bcd60e51b815260206004820152600e60248201526d26bab9ba1031329039b2b63632b960911b6044820152606401610531565b6110666120d4565b600061107487878787611203565b815191935091506110985760405163f1d80ab160e01b815260040160405180910390fd5b6001826020015163ffffffff161115806110bb575042826020015163ffffffff16115b156110cb576000925050506105dd565b60025460408301516110f3918391899189916001600160a01b0390911690610be8908a612414565b60405181907f366d2b4e6cc37ecebb3d7d41df6d581634fd8137412710a1e086e4ca4656bb5890600090a25060019695505050505050565b60035460405163f1c9b1b360e01b81526001600160a01b038381166004830152600092169063f1c9b1b390602401602060405180830381865afa158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a91906123e5565b6111a2610a7b565b6111ac9190612414565b92915050565b6111c18585600086868661181e565b5050505050565b6111d686868686868661181e565b505050505050565b600080546001600160a01b031633036111fe575060131936013560601c90565b503390565b61120b6120d4565b60025460405160009182916112369189916001600160a01b0390911690899089908990602001612427565b60408051808303601f190181528282528051602091820120600081815260018084529084902060c086018552805460ff808216151588526101009182900463ffffffff169588019590955291810154948601949094526002840154928316151560608601529091046001600160a01b0316608084015260039091015460a0830152909890975095505050505050565b6000898152600160208181526040808420805464ffffffffff19168155928301849055600280840180546001600160a81b031916905560039093018490556008825280842092546001600160a01b039081168552929091528083208054928c1684529220805460ff198084169094558154909316905560ff908116911661134d898989611d1d565b831561136b5760055461136b908a906001600160a01b031686611d1d565b60006113778588612461565b111561139157611391898661138c878a612461565b611d1d565b8215611505576000886001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611404576040519150601f19603f3d011682016040523d82523d6000602084013e611409565b606091505b505090508061145b5760405162461bcd60e51b815260206004820152602a602482015260008051602061254f8339815191526044820152693a3432903bb4b73732b960b11b6064820152608401610531565b8280156114655750815b156114ff576005546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d80600081146114d7576040519150601f19603f3d011682016040523d82523d6000602084013e6114dc565b606091505b50509050806114fd5760405162461bcd60e51b815260040161053190612474565b505b50611811565b818015611510575080155b156115d9576002546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d8060008114611582576040519150601f19603f3d011682016040523d82523d6000602084013e611587565b606091505b50509050806114ff5760405162461bcd60e51b815260206004820152602a602482015260008051602061254f8339815191526044820152693a34329039b2b63632b960b11b6064820152608401610531565b8080156115e4575081155b156116ac5760008a6001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611656576040519150601f19603f3d011682016040523d82523d6000602084013e61165b565b606091505b50509050806114ff5760405162461bcd60e51b8152602060048201526029602482015260008051602061254f8339815191526044820152683a343290313abcb2b960b91b6064820152608401610531565b8080156116b65750815b15611811576000886001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060405160006040518083038185875af1925050503d8060008114611728576040519150601f19603f3d011682016040523d82523d6000602084013e61172d565b606091505b505090508061177b5760405162461bcd60e51b8152602060048201526026602482015260008051602061254f8339815191526044820152653bb4b73732b960d11b6064820152608401610531565b6005546040516000916001600160a01b0316907f0000000000000000000000000000000000000000000000000000000000000000908381818185875af1925050503d80600081146117e8576040519150601f19603f3d011682016040523d82523d6000602084013e6117ed565b606091505b505090508061180e5760405162461bcd60e51b815260040161053190612474565b50505b5050505050505050505050565b6000831161185f5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610531565b6001600160a01b0385166118a55760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210313abcb2b960991b6044820152606401610531565b6002546001600160a01b039081169086160361190e5760405162461bcd60e51b815260206004820152602260248201527f53656c6c657220616e64206275796572206d75737420626520646966666572656044820152611b9d60f21b6064820152608401610531565b6103848163ffffffff161015801561192f5750620151808163ffffffff1611155b61197b5760405162461bcd60e51b815260206004820152601b60248201527f496e76616c69642073656c6c65722077616974696e672074696d6500000000006044820152606401610531565b6002546040516000916119a29189916001600160a01b031690899089908990602001612427565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915060ff1615611a115760405162461bcd60e51b81526020600482015260146024820152734f7264657220616c72656164792065786973747360601b6044820152606401610531565b6000612710611a1e610a7b565b611a2890876124b3565b611a3291906124ca565b90506000612710611a428661112b565b611a4c90886124b3565b611a5691906124ca565b90506000611a648783612414565b90506001600160a01b038816611abf57803414611aba5760405162461bcd60e51b8152602060048201526014602482015273125b98dbdc9c9958dd081350551250c81cd95b9d60621b6044820152606401610531565b611c06565b6040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a0823190602401602060405180830381865afa158015611b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2a91906123e5565b9050611b49611b376111de565b6001600160a01b038b16903085611e87565b6040516370a0823160e01b81523060048201526000906001600160a01b038b16906370a0823190602401602060405180830381865afa158015611b90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb491906123e5565b905082611bc18383612461565b14611c035760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c8115490cc8c08185b5bdd5b9d60721b6044820152606401610531565b50505b6040805160c081019091526001815260009060208101611c2688426124ec565b63ffffffff90811682526020808301879052600060408085018290526001600160a01b038d811660608088019190915260809687018c90528c8452600180865283852089518154978b015164ffffffffff1990981690151564ffffffff001916176101009790981687029790971787558884015190870155870151600286018054978901516001600160a81b0319909816911515610100600160a81b03191691909117969091169093029490941790915560a0840151600390920191909155905191925086917f172bd7c7b396e5e48c349fc8e1c845f01eefba35dff18954119870b39fd05e799190a25050505050505050505050565b6001600160a01b038316611dcb576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611d78576040519150601f19603f3d011682016040523d82523d6000602084013e611d7d565b606091505b5050905080611dc55760405162461bcd60e51b81526020600482015260146024820152734661696c656420746f2073656e64204d4154494360601b6044820152606401610531565b50505050565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190612510565b611e825760405162461bcd60e51b81526020600482015260156024820152744661696c656420746f2073656e6420746f6b656e7360581b6044820152606401610531565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611dc59085906000611f31826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fb19092919063ffffffff16565b9050805160001480611f52575080806020019051810190611f529190612510565b611e825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610531565b60606105dd848460008585600080866001600160a01b03168587604051611fd89190612532565b60006040518083038185875af1925050503d8060008114612015576040519150601f19603f3d011682016040523d82523d6000602084013e61201a565b606091505b509150915061202b87838387612036565b979650505050505050565b606083156120a557825160000361209e576001600160a01b0385163b61209e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610531565b50816105dd565b6105dd83838151156120ba5781518083602001fd5b8060405162461bcd60e51b815260040161053191906121d6565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b6001600160a01b038116811461211e57600080fd5b50565b6000806000806080858703121561213757600080fd5b84359350602085013561214981612109565b9250604085013561215981612109565b9396929550929360600135925050565b60006020828403121561217b57600080fd5b5035919050565b6000806040838503121561219557600080fd5b8235915060208301356121a781612109565b809150509250929050565b60005b838110156121cd5781810151838201526020016121b5565b50506000910152565b60208152600082518060208401526121f58160408501602087016121b2565b601f01601f19169190910160400192915050565b60006020828403121561221b57600080fd5b813561222681612109565b9392505050565b600080600080600060a0868803121561224557600080fd5b85359450602086013561225781612109565b9350604086013561226781612109565b925060608601359150608086013561227e81612109565b809150509295509295909350565b60008060008060008060c087890312156122a557600080fd5b86356122b081612109565b95506020870135945060408701356122c781612109565b935060608701356122d781612109565b925060808701356122e781612109565b915060a08701356122f781612109565b809150509295509295509295565b803563ffffffff8116811461231957600080fd5b919050565b600080600080600060a0868803121561233657600080fd5b85359450602086013561234881612109565b935060408601359250606086013561235f81612109565b915061236d60808701612305565b90509295509295909350565b60008060008060008060c0878903121561239257600080fd5b8635955060208701356123a481612109565b945060408701356123b481612109565b93506060870135925060808701356123cb81612109565b91506123d960a08801612305565b90509295509295509295565b6000602082840312156123f757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156111ac576111ac6123fe565b9485526bffffffffffffffffffffffff19606094851b8116602087015292841b83166034860152921b166048830152605c820152607c0190565b818103818111156111ac576111ac6123fe565b602080825260319082015260008051602061254f8339815191526040820152701d1a1948199959481c9958da5c1a595b9d607a1b606082015260800190565b80820281158282048414176111ac576111ac6123fe565b6000826124e757634e487b7160e01b600052601260045260246000fd5b500490565b63ffffffff818116838216019080821115612509576125096123fe565b5092915050565b60006020828403121561252257600080fd5b8151801515811461222657600080fd5b600082516125448184602087016121b2565b919091019291505056fe4661696c656420746f2073656e642074686520666565204d4154494320746f20a26469706673582212205a7a56027b6753248e5787c3bb2b812f124fb3986819251d4d62ac42db64b3e264736f6c63430008120033000000000000000000000000630220d00cf136270f553c8577af18300f7b812c000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000fe0fa3c06d03bdc7fb49c892bbb39113b534fb570000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063775c300c116100c3578063da7422281161007c578063da742228146102da578063e0c8fb71146102ed578063e74b981b14610300578063f1c9b1b314610313578063f2fde38b14610333578063f830baad1461034657600080fd5b8063775c300c146102725780638d0504e21461027a5780638da5cb5b146102905780639b501116146102a1578063b0eefabe146102b4578063d784d426146102c757600080fd5b8063572b6c0511610115578063572b6c05146101ed5780635c60da1b1461021f57806369fe0e2d146102375780636cc6cde11461024a578063715018a61461025d57806375f12b211461026557600080fd5b80630f34542814610152578063130cd750146101985780631385d24c146101ad57806346904840146101b5578063486ff0cd146101c8575b600080fd5b61017b610160366004610bb8565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101ab6101a6366004610c28565b610359565b005b6101ab610501565b60055461017b906001600160a01b031681565b60408051808201825260038152620312e360ec1b6020820152905161018f9190610c94565b61020f6101fb366004610bb8565b6000546001600160a01b0391821691161490565b604051901515815260200161018f565b60075461017b9061010090046001600160a01b031681565b6101ab610245366004610ce2565b61051d565b60045461017b906001600160a01b031681565b6101ab610538565b60075461020f9060ff1681565b61017b61054c565b6102826106a4565b60405190815260200161018f565b6001546001600160a01b031661017b565b6101ab6102af366004610bb8565b610755565b6101ab6102c2366004610bb8565b61077f565b6101ab6102d5366004610bb8565b6107f4565b6101ab6102e8366004610bb8565b610873565b6102826102fb366004610bb8565b6108f3565b6101ab61030e366004610bb8565b610924565b610282610321366004610bb8565b60036020526000908152604090205481565b6101ab610341366004610bb8565b61099c565b60085461017b906001600160a01b031681565b610361610a19565b8281146103a55760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b60448201526064015b60405180910390fd5b60005b838110156104fa5760648383838181106103c4576103c4610cfb565b90506020020135111561040b5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206665652062707360881b604482015260640161039c565b600085858381811061041f5761041f610cfb565b90506020020160208101906104349190610bb8565b6001600160a01b03160361048a5760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420706172746e65722061646472657373000000000000000000604482015260640161039c565b82828281811061049c5761049c610cfb565b90506020020135600360008787858181106104b9576104b9610cfb565b90506020020160208101906104ce9190610bb8565b6001600160a01b03168152602081019190915260400160002055806104f281610d27565b9150506103a8565b5050505050565b610509610a19565b6007805460ff19811660ff90911615179055565b610525610a19565b606481111561053357600080fd5b600655565b610540610a19565b61054a6000610a92565b565b60008061056d600760019054906101000a90046001600160a01b0316610ae4565b9050806001600160a01b031663a2dc2ab7610586610b7e565b6006546004805460055460005460085460405160e089901b6001600160e01b03191681526001600160a01b0397881695810195909552602485019590955291851660448401528416606483015283166084820152911660a482015260c401600060405180830381600087803b1580156105fe57600080fd5b505af1158015610612573d6000803e3d6000fd5b505050508060026000610623610b7e565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b031916929091169190911790557f2d49c67975aadd2d389580b368cfff5b49965b0bd5da33c144922ce01e7a4d7b61067d610b7e565b604080516001600160a01b03928316815291841660208301520160405180910390a1919050565b6008546000906001600160a01b0316801580159061074057506000816001600160a01b03166370a082316106d6610b7e565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e9190610d40565b115b1561074d57600091505090565b505060065490565b61075d610a19565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610787610a19565b6001600160a01b0381166107d25760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21030b93134ba3930ba37b960711b604482015260640161039c565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6107fc610a19565b6001600160a01b03811661084b5760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b21034b6b83632b6b2b73a30ba34b7b760511b604482015260640161039c565b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b61087b610a19565b6001600160a01b0381166108d15760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420747275737420666f72776172646572000000000000000000604482015260640161039c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600360205260408120546109146106a4565b61091e9190610d59565b92915050565b61092c610a19565b6001600160a01b03811661097a5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a5908199959481c9958da5c1a595b9d605a1b604482015260640161039c565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6109a4610a19565b6001600160a01b038116610a095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161039c565b610a1281610a92565b50565b3390565b610a21610b7e565b6001600160a01b0316610a3c6001546001600160a01b031690565b6001600160a01b03161461054a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161039c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116610b795760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b604482015260640161039c565b919050565b600080546001600160a01b03163303610b9e575060131936013560601c90565b503390565b6001600160a01b0381168114610a1257600080fd5b600060208284031215610bca57600080fd5b8135610bd581610ba3565b9392505050565b60008083601f840112610bee57600080fd5b50813567ffffffffffffffff811115610c0657600080fd5b6020830191508360208260051b8501011115610c2157600080fd5b9250929050565b60008060008060408587031215610c3e57600080fd5b843567ffffffffffffffff80821115610c5657600080fd5b610c6288838901610bdc565b90965094506020870135915080821115610c7b57600080fd5b50610c8887828801610bdc565b95989497509550505050565b600060208083528351808285015260005b81811015610cc157858101830151858201604001528201610ca5565b506000604082860101526040601f19601f8301168501019250505092915050565b600060208284031215610cf457600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610d3957610d39610d11565b5060010190565b600060208284031215610d5257600080fd5b5051919050565b8082018082111561091e5761091e610d1156fea26469706673582212208eeaea63724b95d34e8f643c909a622ff49922a3774ca3c2aeaf3b0c2932b66664736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000630220d00cf136270f553c8577af18300f7b812c000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000fe0fa3c06d03bdc7fb49c892bbb39113b534fb570000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _arbitrator (address): 0x630220d00Cf136270f553c8577aF18300F7b812c
Arg [1] : _feeRecipient (address): 0xe872E7E3664F6AE78b62B360ACa667877bfEf088
Arg [2] : _fee (uint256): 30
Arg [3] : _trustedForwarder (address): 0xfe0fa3C06d03bDC7fb49c892BbB39113B534fB57
Arg [4] : _feeDiscountNFT (address): 0x0000000000000000000000000000000000000000
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000630220d00cf136270f553c8577af18300f7b812c
Arg [1] : 000000000000000000000000e872e7e3664f6ae78b62b360aca667877bfef088
Arg [2] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [3] : 000000000000000000000000fe0fa3c06d03bdc7fb49c892bbb39113b534fb57
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
70179:5176:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;70246:50;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;70246:50:0;;;;;;-1:-1:-1;;;;;566:32:1;;;548:51;;536:2;521:18;70246:50:0;;;;;;;;74345:467;;;;;;:::i;:::-;;:::i;:::-;;73921:86;;;:::i;70481:35::-;;;;;-1:-1:-1;;;;;70481:35:0;;;74050:97;74127:12;;;;;;;;;;;-1:-1:-1;;;74127:12:0;;;;74050:97;;;;74127:12;74050:97;:::i;1513:138::-;;;;;;:::i;:::-;1589:4;1626:17;-1:-1:-1;;;;;1613:30:0;;;1626:17;;1613:30;;1513:138;;;;2702:14:1;;2695:22;2677:41;;2665:2;2650:18;1513:138:0;2537:187:1;70579:29:0;;;;;;;;-1:-1:-1;;;;;70579:29:0;;;73116:109;;;;;;:::i;:::-;;:::i;70449:25::-;;;;;-1:-1:-1;;;;;70449:25:0;;;4195:103;;;:::i;70551:19::-;;;;;;;;;71886:488;;;:::i;74911:301::-;;;:::i;:::-;;;3060:25:1;;;3048:2;3033:18;74911:301:0;2914:177:1;3547:87:0;3620:6;;-1:-1:-1;;;;;3620:6:0;3547:87;;74215:122;;;;;;:::i;:::-;;:::i;72567:171::-;;;;;;:::i;:::-;;:::i;73644:219::-;;;;;;:::i;:::-;;:::i;73324:206::-;;;;;;:::i;:::-;;:::i;75220:132::-;;;;;;:::i;:::-;;:::i;72845:192::-;;;;;;:::i;:::-;;:::i;70303:48::-;;;;;;:::i;:::-;;;;;;;;;;;;;;4453:201;;;;;;:::i;:::-;;:::i;70656:29::-;;;;;-1:-1:-1;;;;;70656:29:0;;;74345:467;3433:13;:11;:13::i;:::-;74493:32;;::::1;74485:58;;;::::0;-1:-1:-1;;;74485:58:0;;3558:2:1;74485:58:0::1;::::0;::::1;3540:21:1::0;3597:2;3577:18;;;3570:30;-1:-1:-1;;;3616:18:1;;;3609:43;3669:18;;74485:58:0::1;;;;;;;;;74561:9;74556:249;74576:20:::0;;::::1;74556:249;;;74638:3;74626:5;;74632:1;74626:8;;;;;;;:::i;:::-;;;;;;;:15;;74618:43;;;::::0;-1:-1:-1;;;74618:43:0;;4032:2:1;74618:43:0::1;::::0;::::1;4014:21:1::0;4071:2;4051:18;;;4044:30;-1:-1:-1;;;4090:18:1;;;4083:45;4145:18;;74618:43:0::1;3830:339:1::0;74618:43:0::1;74708:1;74684:9:::0;;74694:1;74684:12;;::::1;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;74684:26:0::1;::::0;74676:62:::1;;;::::0;-1:-1:-1;;;74676:62:0;;4376:2:1;74676:62:0::1;::::0;::::1;4358:21:1::0;4415:2;4395:18;;;4388:30;4454:25;4434:18;;;4427:53;4497:18;;74676:62:0::1;4174:347:1::0;74676:62:0::1;74785:5;;74791:1;74785:8;;;;;;;:::i;:::-;;;;;;;74755:13;:27;74769:9;;74779:1;74769:12;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;74755:27:0::1;::::0;;::::1;::::0;::::1;::::0;;;;;;-1:-1:-1;74755:27:0;:38;74598:3;::::1;::::0;::::1;:::i;:::-;;;;74556:249;;;;74345:467:::0;;;;:::o;73921:86::-;3433:13;:11;:13::i;:::-;73992:7:::1;::::0;;-1:-1:-1;;73981:18:0;::::1;73992:7;::::0;;::::1;73991:8;73981:18;::::0;;73921:86::o;73116:109::-;3433:13;:11;:13::i;:::-;73190:3:::1;73182:4;:11;;73174:20;;;::::0;::::1;;73207:3;:10:::0;73116:109::o;4195:103::-;3433:13;:11;:13::i;:::-;4260:30:::1;4287:1;4260:18;:30::i;:::-;4195:103::o:0;71886:488::-;71922:7;71942:18;71963:28;71976:14;;;;;;;;;-1:-1:-1;;;;;71976:14:0;71963:12;:28::i;:::-;71942:49;;72025:10;-1:-1:-1;;;;;72002:46:0;;72071:12;:10;:12::i;:::-;72099:3;;72117:10;;;72142:12;;72117:10;72169:17;72201:14;;72002:224;;;;;;-1:-1:-1;;;;;;72002:224:0;;;-1:-1:-1;;;;;5173:15:1;;;72002:224:0;;;5155:34:1;;;;5205:18;;;5198:34;;;;72117:10:0;;;5248:18:1;;;5241:43;72142:12:0;;5300:18:1;;;5293:43;72169:17:0;;5352:19:1;;;5345:44;72201:14:0;;5405:19:1;;;5398:44;5089:19;;72002:224:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;72269:10;72237:15;:29;72253:12;:10;:12::i;:::-;-1:-1:-1;;;;;72237:29:0;;;;;;;;;;;;;;-1:-1:-1;72237:29:0;:42;;-1:-1:-1;;;;;;72237:42:0;;;;;;;;;;;72295:41;72311:12;:10;:12::i;:::-;72295:41;;;-1:-1:-1;;;;;5683:15:1;;;5665:34;;5735:15;;;5730:2;5715:18;;5708:43;5600:18;72295:41:0;;;;;;;72356:10;71886:488;-1:-1:-1;71886:488:0:o;74911:301::-;75005:14;;74955:7;;-1:-1:-1;;;;;75005:14:0;75051:28;;;;;:84;;;75134:1;75096:11;-1:-1:-1;;;;;75096:21:0;;75118:12;:10;:12::i;:::-;75096:35;;-1:-1:-1;;;;;;75096:35:0;;;;;;;-1:-1:-1;;;;;566:32:1;;;75096:35:0;;;548:51:1;521:18;;75096:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:39;75051:84;75033:149;;;75169:1;75162:8;;;74911:301;:::o;75033:149::-;-1:-1:-1;;75201:3:0;;;74911:301::o;74215:122::-;3433:13;:11;:13::i;:::-;74297:14:::1;:32:::0;;-1:-1:-1;;;;;;74297:32:0::1;-1:-1:-1::0;;;;;74297:32:0;;;::::1;::::0;;;::::1;::::0;;74215:122::o;72567:171::-;3433:13;:11;:13::i;:::-;-1:-1:-1;;;;;72647:25:0;::::1;72639:56;;;::::0;-1:-1:-1;;;72639:56:0;;6153:2:1;72639:56:0::1;::::0;::::1;6135:21:1::0;6192:2;6172:18;;;6165:30;-1:-1:-1;;;6211:18:1;;;6204:48;6269:18;;72639:56:0::1;5951:342:1::0;72639:56:0::1;72706:10;:24:::0;;-1:-1:-1;;;;;;72706:24:0::1;-1:-1:-1::0;;;;;72706:24:0;;;::::1;::::0;;;::::1;::::0;;72567:171::o;73644:219::-;3433:13;:11;:13::i;:::-;-1:-1:-1;;;;;73756:29:0;::::1;73748:64;;;::::0;-1:-1:-1;;;73748:64:0;;6500:2:1;73748:64:0::1;::::0;::::1;6482:21:1::0;6539:2;6519:18;;;6512:30;-1:-1:-1;;;6558:18:1;;;6551:52;6620:18;;73748:64:0::1;6298:346:1::0;73748:64:0::1;73823:14;:32:::0;;-1:-1:-1;;;;;73823:32:0;;::::1;;;-1:-1:-1::0;;;;;;73823:32:0;;::::1;::::0;;;::::1;::::0;;73644:219::o;73324:206::-;3433:13;:11;:13::i;:::-;-1:-1:-1;;;;;73417:30:0;::::1;73409:66;;;::::0;-1:-1:-1;;;73409:66:0;;6851:2:1;73409:66:0::1;::::0;::::1;6833:21:1::0;6890:2;6870:18;;;6863:30;6929:25;6909:18;;;6902:53;6972:18;;73409:66:0::1;6649:347:1::0;73409:66:0::1;73486:17;:36:::0;;-1:-1:-1;;;;;;73486:36:0::1;-1:-1:-1::0;;;;;73486:36:0;;;::::1;::::0;;;::::1;::::0;;73324:206::o;75220:132::-;-1:-1:-1;;;;;75321:23:0;;75278:7;75321:23;;;:13;:23;;;;;;75305:13;:11;:13::i;:::-;:39;;;;:::i;:::-;75298:46;75220:132;-1:-1:-1;;75220:132:0:o;72845:192::-;3433:13;:11;:13::i;:::-;-1:-1:-1;;;;;72937:27:0;::::1;72929:61;;;::::0;-1:-1:-1;;;72929:61:0;;7333:2:1;72929:61:0::1;::::0;::::1;7315:21:1::0;7372:2;7352:18;;;7345:30;-1:-1:-1;;;7391:18:1;;;7384:51;7452:18;;72929:61:0::1;7131:345:1::0;72929:61:0::1;73001:12;:28:::0;;-1:-1:-1;;;;;;73001:28:0::1;-1:-1:-1::0;;;;;73001:28:0;;;::::1;::::0;;;::::1;::::0;;72845:192::o;4453:201::-;3433:13;:11;:13::i;:::-;-1:-1:-1;;;;;4542:22:0;::::1;4534:73;;;::::0;-1:-1:-1;;;4534:73:0;;7683:2:1;4534:73:0::1;::::0;::::1;7665:21:1::0;7722:2;7702:18;;;7695:30;7761:34;7741:18;;;7734:62;-1:-1:-1;;;7812:18:1;;;7805:36;7858:19;;4534:73:0::1;7481:402:1::0;4534:73:0::1;4618:28;4637:8;4618:18;:28::i;:::-;4453:201:::0;:::o;792:98::-;872:10;;792:98::o;3712:132::-;3787:12;:10;:12::i;:::-;-1:-1:-1;;;;;3776:23:0;:7;3620:6;;-1:-1:-1;;;;;3620:6:0;;3547:87;3776:7;-1:-1:-1;;;;;3776:23:0;;3768:68;;;;-1:-1:-1;;;3768:68:0;;8090:2:1;3768:68:0;;;8072:21:1;;;8109:18;;;8102:30;8168:34;8148:18;;;8141:62;8220:18;;3768:68:0;7888:356:1;4814:191:0;4907:6;;;-1:-1:-1;;;;;4924:17:0;;;-1:-1:-1;;;;;;4924:17:0;;;;;;;4957:40;;4907:6;;;4924:17;4907:6;;4957:40;;4888:16;;4957:40;4877:128;4814:191;:::o;40567:770::-;40624:16;40961:48;40943:14;40937:4;40933:25;40927:4;40923:36;40920:90;40914:4;40907:104;41170:32;41153:14;41147:4;41143:25;41140:63;41134:4;41127:77;41246:4;41240;41237:1;41230:21;41218:33;-1:-1:-1;;;;;;41280:22:0;;41272:57;;;;-1:-1:-1;;;41272:57:0;;8451:2:1;41272:57:0;;;8433:21:1;8490:2;8470:18;;;8463:30;-1:-1:-1;;;8509:18:1;;;8502:52;8571:18;;41272:57:0;8249:346:1;41272:57:0;40567:770;;;:::o;1659:410::-;1721:14;1626:17;;-1:-1:-1;;;;;1626:17:0;1771:10;1613:30;1748:314;;-1:-1:-1;;;1957:14:0;1953:23;1940:37;1936:2;1932:46;1659:410;:::o;1748:314::-;-1:-1:-1;872:10:0;;1659: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;1984:548::-;2096:4;2125:2;2154;2143:9;2136:21;2186:6;2180:13;2229:6;2224:2;2213:9;2209:18;2202:34;2254:1;2264:140;2278:6;2275:1;2272:13;2264:140;;;2373:14;;;2369:23;;2363:30;2339:17;;;2358:2;2335:26;2328:66;2293:10;;2264:140;;;2268:3;2453:1;2448:2;2439:6;2428:9;2424:22;2420:31;2413:42;2523:2;2516;2512:7;2507:2;2499:6;2495:15;2491:29;2480:9;2476:45;2472:54;2464:62;;;;1984:548;;;;:::o;2729:180::-;2788:6;2841:2;2829:9;2820:7;2816:23;2812:32;2809:52;;;2857:1;2854;2847:12;2809:52;-1:-1:-1;2880:23:1;;2729:180;-1:-1:-1;2729:180:1:o;3698:127::-;3759:10;3754:3;3750:20;3747:1;3740:31;3790:4;3787:1;3780:15;3814:4;3811:1;3804:15;4526:127;4587:10;4582:3;4578:20;4575:1;4568:31;4618:4;4615:1;4608:15;4642:4;4639:1;4632:15;4658:135;4697:3;4718:17;;;4715:43;;4738:18;;:::i;:::-;-1:-1:-1;4785:1:1;4774:13;;4658:135::o;5762:184::-;5832:6;5885:2;5873:9;5864:7;5860:23;5856:32;5853:52;;;5901:1;5898;5891:12;5853:52;-1:-1:-1;5924:16:1;;5762:184;-1:-1:-1;5762:184:1:o;7001:125::-;7066:9;;;7087:10;;;7084:36;;;7100:18;;:::i
Swarm Source
ipfs://5a7a56027b6753248e5787c3bb2b812f124fb3986819251d4d62ac42db64b3e2
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 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.