More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 147 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Market Order | 18069013 | 490 days ago | IN | 0 ETH | 0.00162986 | ||||
Market Order | 18069012 | 490 days ago | IN | 0 ETH | 0.00187633 | ||||
Market Order | 18068998 | 490 days ago | IN | 0 ETH | 0.00216729 | ||||
Market Order | 18068991 | 490 days ago | IN | 0 ETH | 0.0014571 | ||||
Market Order | 18068908 | 490 days ago | IN | 0 ETH | 0.0019237 | ||||
Market Order | 18068907 | 490 days ago | IN | 0 ETH | 0.0021472 | ||||
Market Order | 18068898 | 490 days ago | IN | 0 ETH | 0.0018276 | ||||
Market Order | 18068891 | 490 days ago | IN | 0 ETH | 0.00139372 | ||||
Market Order | 18068759 | 490 days ago | IN | 0 ETH | 0.0015344 | ||||
Market Order | 18068758 | 490 days ago | IN | 0 ETH | 0.0017527 | ||||
Market Order | 18068582 | 490 days ago | IN | 0 ETH | 0.00170081 | ||||
Market Order | 18068575 | 490 days ago | IN | 0 ETH | 0.00126483 | ||||
Add Tokens | 18068544 | 490 days ago | IN | 0 ETH | 0.00052221 | ||||
Cancel Order | 18036383 | 495 days ago | IN | 0 ETH | 0.00282372 | ||||
Market Order | 18036367 | 495 days ago | IN | 0 ETH | 0.00371061 | ||||
Market Order | 18035123 | 495 days ago | IN | 0 ETH | 0.00321873 | ||||
Market Order | 18035122 | 495 days ago | IN | 0 ETH | 0.0040421 | ||||
Market Order | 18035113 | 495 days ago | IN | 0 ETH | 0.00407844 | ||||
Market Order | 18035105 | 495 days ago | IN | 0 ETH | 0.0040342 | ||||
Market Order | 18034036 | 495 days ago | IN | 0 ETH | 0.00139854 | ||||
Market Order | 18034034 | 495 days ago | IN | 0 ETH | 0.00183225 | ||||
Cancel Order | 18033999 | 495 days ago | IN | 0 ETH | 0.00086165 | ||||
Market Order | 18033972 | 495 days ago | IN | 0 ETH | 0.00172644 | ||||
Market Order | 18033966 | 495 days ago | IN | 0 ETH | 0.00177712 | ||||
Market Order | 18033958 | 495 days ago | IN | 0 ETH | 0.00175805 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
P2PEscrow
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 300 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /** * @title P2PEscrow * @author Vamsi Krishna Srungarapu * @notice Smart Contract aiding two users to swap tokens while acting as an escrow */ contract P2PEscrow is Ownable, ReentrancyGuard { using SafeERC20 for IERC20; // Events emitted during the contract functions execution event OrderDeposit(bytes16 indexed orderId); event OrderSuccessful(bytes16 indexed orderId); event RefundedOrder(bytes16 indexed orderId); event CancelledOrder(bytes16 indexed orderId); // End of Events // errors error OrderFailure(OrderFailureReason reason); error RefundFailure(RefundFailureReason reason); error CancelOrderFailure(CancelOrderFailureReason reason); enum OrderType { MARKET_ORDER, LIMIT_ORDER } enum OrderStatus { AWAITING_DELIVERY, SUCCESS, REFUNDED, CANCELLED } enum OrderFailureReason { INVALID_STATE, INSUFFICIENT_BALANCE, DUPLICATE_ORDER, INVALID_ORDER_DETAILS } enum RefundFailureReason { REFUND_ONLY_AFTER_TIMEOUT, INVALID_STATE } enum CancelOrderFailureReason { ONLY_ORDER_CREATOR_CANCEL, INVALID_STATE } // Order struct saving the state of order details struct Order { address sender; uint96 swapTokenAmount; uint96 tokenAmount; uint32 timeoutTime; uint16 tokenId; uint16 swapTokenId; OrderStatus status; OrderType orderType; } // Default order time out duration in // seconds saved at contract level uint32 public orderTimeoutDuration; // Mapping between order id and the order object mapping(bytes16 => Order) orderMap; // List of whitelisted token addresses address[] tokens; constructor(address[] memory _tokens) { // Set default order time out to 300 seconds orderTimeoutDuration = 300; tokens = _tokens; } /** * Helper function for transferring asset from user in to the smart contract * @param user address from which the tokens are pulled in to this contract * @param asset token address which is being pulled from the user * @param amount amount of token address that is being pulled from user */ function _pullTokens(address user, address asset, uint256 amount) private { if (asset == address(0)) return; IERC20(asset).safeTransferFrom(user, address(this), amount); } /** * Helper function for transferring asset from this smart contract to user * @param user asset receiving address * @param asset token address which is sent to user * @param amount amount of token address that is being sent to user */ function _pushTokens(address user, address asset, uint256 amount) private { if (asset == address(0)) return; IERC20(asset).safeTransfer(user, amount); } /** * Helper function for transferring asset from sender to receiver * @param sender token sending address * @param receiver token receiving address * @param asset token address which is being sent from sender to receiver * @param amount amount of token address that is being sent from sender to receiver */ function _sendTokens( address sender, address receiver, address asset, uint256 amount ) private { if (asset == address(0)) return; IERC20(asset).safeTransferFrom(sender, receiver, amount); } /** * Set the default time out duration. Only contract owner can invoke this functionality * @param timeoutDuration default time out duration in seconds */ function setOrderTimeout(uint32 timeoutDuration) external onlyOwner { orderTimeoutDuration = timeoutDuration; } /** * @notice executes a market order or limit order * @dev execute a market order or a limit order. A user who wants to * trade in and a user who wants to trade out should use the same order id. * A valid combination can be as below: * Let us assume that block.timestamp is less than given timeout time while placing the order * User 1 --> (tokenId: 1, tokenAmount: 1_000_000, swapTokenId: 2, swapTokenAmount: 2_000_000, timeoutTime: 1686927958, orderId: o1, orderType: 0) * User 2 --> (tokenId: 2, tokenAmount: 2_000_000, swapTokenId: 1, swapTokenAmount: 1_000_000, timeoutTime: 1686927958, orderId: o1, orderType: 0) * Now, when user 1 executes the order, tokenId:1 amount is deposited into the escrow amount. * Later when user 2 executes the order before the timeoutTime: 1686927958, * tokenId:1 amount is moved from escrow to user and tokenId: 2 amount is moved from user 2 to user 1 * @param tokenId id of the token that user wants to trade in * @param tokenAmount amount of token user wants to trade in * @param swapTokenId id of the token that a user wants to trade out * @param swapTokenAmount amount of token user wants to trade out * @param timeoutTime expiry time of the order * @param orderId unique order id * @param orderType can be market order or limit order */ function executeOrder( uint16 tokenId, uint96 tokenAmount, uint16 swapTokenId, uint96 swapTokenAmount, uint32 timeoutTime, bytes16 orderId, OrderType orderType ) private nonReentrant returns (bytes16) { require(tokenId < tokensLength(), "invalid tokenId"); require(swapTokenId < tokensLength(), "invalid swap token id"); if (orderMap[orderId].sender == msg.sender) revert OrderFailure(OrderFailureReason.DUPLICATE_ORDER); if (orderMap[orderId].sender == address(0)) { orderMap[orderId].sender = msg.sender; orderMap[orderId].tokenId = tokenId; orderMap[orderId].swapTokenId = swapTokenId; orderMap[orderId].tokenAmount = tokenAmount; orderMap[orderId].swapTokenAmount = swapTokenAmount; orderMap[orderId].timeoutTime = timeoutTime; orderMap[orderId].status = OrderStatus.AWAITING_DELIVERY; orderMap[orderId].orderType = orderType; emit OrderDeposit(orderId); _pullTokens(msg.sender, tokens[tokenId], tokenAmount); return orderId; } if (orderMap[orderId].status != OrderStatus.AWAITING_DELIVERY) revert OrderFailure(OrderFailureReason.INVALID_STATE); if (block.timestamp > orderMap[orderId].timeoutTime) revert OrderFailure(OrderFailureReason.INVALID_STATE); if ( orderMap[orderId].tokenId != swapTokenId || orderMap[orderId].tokenAmount != swapTokenAmount || orderMap[orderId].swapTokenId != tokenId || orderMap[orderId].swapTokenAmount != tokenAmount || orderMap[orderId].orderType != orderType ) revert OrderFailure(OrderFailureReason.INVALID_ORDER_DETAILS); orderMap[orderId].status = OrderStatus.SUCCESS; emit OrderSuccessful(orderId); address swapToken = tokens[swapTokenId]; _pushTokens(msg.sender, swapToken, swapTokenAmount); _sendTokens( msg.sender, orderMap[orderId].sender, tokens[tokenId], tokenAmount ); return orderId; } /** * @notice executes a market order * @dev see executeOrder comments. this function is just a wrapper on top of executeOrder * @param tokenId id of the token that user wants to trade in * @param tokenAmount amount of token user wants to trade in * @param swapTokenId id of the token that a user wants to trade out * @param swapTokenAmount amount of token user wants to trade out * @param orderId unique order id */ function marketOrder( uint16 tokenId, uint96 tokenAmount, uint16 swapTokenId, uint96 swapTokenAmount, bytes16 orderId ) external returns (bytes16) { return executeOrder( tokenId, tokenAmount, swapTokenId, swapTokenAmount, uint32(block.timestamp + orderTimeoutDuration), orderId, OrderType.MARKET_ORDER ); } /** * @notice executes a limit order * @dev see executeOrder comments. this function is just a wrapper on top of executeOrder * @param tokenId id of the token that user wants to trade in * @param tokenAmount amount of token user wants to trade in * @param swapTokenId id of the token that a user wants to trade out * @param swapTokenAmount amount of token user wants to trade out * @param timeoutTime expiry time of the order * @param orderId unique order id */ function limitOrder( uint16 tokenId, uint96 tokenAmount, uint16 swapTokenId, uint96 swapTokenAmount, uint32 timeoutTime, bytes16 orderId ) external returns (bytes16) { return executeOrder( tokenId, tokenAmount, swapTokenId, swapTokenAmount, timeoutTime, orderId, OrderType.LIMIT_ORDER ); } /** * @notice Cancel a waiting order * @dev a user who created the order first with the given order id or the smart contract owner can only cancel the order * @param orderId order id that has to be cancelled */ function cancelOrder(bytes16 orderId) external { Order memory order = orderMap[orderId]; if (!(msg.sender == order.sender || msg.sender == owner())) revert CancelOrderFailure( CancelOrderFailureReason.ONLY_ORDER_CREATOR_CANCEL ); if (order.status != OrderStatus.AWAITING_DELIVERY) revert CancelOrderFailure(CancelOrderFailureReason.INVALID_STATE); orderMap[orderId].status = OrderStatus.CANCELLED; emit CancelledOrder(orderId); _pushTokens(order.sender, tokens[order.tokenId], order.tokenAmount); } /** * fetch order details by order id * @param orderId order id */ function getOrder(bytes16 orderId) external view returns (Order memory) { require(orderMap[orderId].sender != address(0), "invalid order id"); return orderMap[orderId]; } /** * get index of the whitelisted token address * @param token whitelisted token address */ function getTokenIndex(address token) external view returns (int) { for (uint i = 0; i < tokens.length; i++) { if (tokens[i] == token) return int(i); } return -1; } /** * get whitelisted token address by index * @param index whitelisted token index */ function getTokenAddressByIndex( uint index ) external view returns (address) { require(index < tokensLength(), "invalid index"); return tokens[index]; } /** * @notice The smart contract owner can add tokens to the contract and whitelist them * for using in executing the market order or limit order * @param inputTokens tokens that have to be whitelisted */ function addTokens(address[] calldata inputTokens) external onlyOwner { for (uint i = 0; i < inputTokens.length; i++) { tokens.push(inputTokens[i]); } } /** * @notice helper function to find the total number of whitelisted * tokens in the smart contract */ function tokensLength() public view returns (uint) { return tokens.length; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { 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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // 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); }
// SPDX-License-Identifier: MIT // 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.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) { return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 300 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"enum P2PEscrow.CancelOrderFailureReason","name":"reason","type":"uint8"}],"name":"CancelOrderFailure","type":"error"},{"inputs":[{"internalType":"enum P2PEscrow.OrderFailureReason","name":"reason","type":"uint8"}],"name":"OrderFailure","type":"error"},{"inputs":[{"internalType":"enum P2PEscrow.RefundFailureReason","name":"reason","type":"uint8"}],"name":"RefundFailure","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"CancelledOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"OrderDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"OrderSuccessful","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"RefundedOrder","type":"event"},{"inputs":[{"internalType":"address[]","name":"inputTokens","type":"address[]"}],"name":"addTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"cancelOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"getOrder","outputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint96","name":"swapTokenAmount","type":"uint96"},{"internalType":"uint96","name":"tokenAmount","type":"uint96"},{"internalType":"uint32","name":"timeoutTime","type":"uint32"},{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint16","name":"swapTokenId","type":"uint16"},{"internalType":"enum P2PEscrow.OrderStatus","name":"status","type":"uint8"},{"internalType":"enum P2PEscrow.OrderType","name":"orderType","type":"uint8"}],"internalType":"struct P2PEscrow.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTokenAddressByIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenIndex","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint96","name":"tokenAmount","type":"uint96"},{"internalType":"uint16","name":"swapTokenId","type":"uint16"},{"internalType":"uint96","name":"swapTokenAmount","type":"uint96"},{"internalType":"uint32","name":"timeoutTime","type":"uint32"},{"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"limitOrder","outputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint96","name":"tokenAmount","type":"uint96"},{"internalType":"uint16","name":"swapTokenId","type":"uint16"},{"internalType":"uint96","name":"swapTokenAmount","type":"uint96"},{"internalType":"bytes16","name":"orderId","type":"bytes16"}],"name":"marketOrder","outputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"orderTimeoutDuration","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"timeoutDuration","type":"uint32"}],"name":"setOrderTimeout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162001a5438038062001a54833981016040819052620000349162000175565b6200003f3362000071565b600180556002805463ffffffff191661012c179055805162000069906004906020840190620000c1565b505062000247565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000119579160200282015b828111156200011957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620000e2565b50620001279291506200012b565b5090565b5b808211156200012757600081556001016200012c565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200017057600080fd5b919050565b600060208083850312156200018957600080fd5b82516001600160401b0380821115620001a157600080fd5b818501915085601f830112620001b657600080fd5b815181811115620001cb57620001cb62000142565b8060051b604051601f19603f83011681018181108582111715620001f357620001f362000142565b6040529182528482019250838101850191888311156200021257600080fd5b938501935b828510156200023b576200022b8562000158565b8452938501939285019262000217565b98975050505050505050565b6117fd80620002576000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80638da5cb5b1161008c578063d92fc67b11610066578063d92fc67b146101da578063ed4ad7f8146101e2578063f07319be146101f5578063f2fde38b1461021557600080fd5b80638da5cb5b14610191578063b25eaeae146101a2578063cf9b5560146101b557600080fd5b8063625bb8de116100bd578063625bb8de1461013c57806366c0bd2414610168578063715018a61461018957600080fd5b806329fd5984146100e45780634ae05c7d146100f95780635715c5b71461010c575b600080fd5b6100f76100f23660046113b9565b610228565b005b6100f76101073660046113db565b61024c565b61011f61011a366004611450565b6102d1565b6040516001600160a01b0390911681526020015b60405180910390f35b61014f61014a3660046114aa565b61034d565b6040516001600160801b03199091168152602001610133565b61017b61017636600461151e565b61036a565b604051908152602001610133565b6100f76103d1565b6000546001600160a01b031661011f565b6100f76101b0366004611547565b6103e5565b6002546101c59063ffffffff1681565b60405163ffffffff9091168152602001610133565b60045461017b565b61014f6101f0366004611562565b6105fe565b610208610203366004611547565b610632565b6040516101339190611613565b6100f761022336600461151e565b6107dc565b610230610855565b6002805463ffffffff191663ffffffff92909216919091179055565b610254610855565b60005b818110156102cc576004838383818110610273576102736116b4565b9050602002016020810190610288919061151e565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055806102c4816116e0565b915050610257565b505050565b60006102dc60045490565b821061031f5760405162461bcd60e51b815260206004820152600d60248201526c0d2dcecc2d8d2c840d2dcc8caf609b1b60448201526064015b60405180910390fd5b60048281548110610332576103326116b4565b6000918252602090912001546001600160a01b031692915050565b600061035f87878787878760016108af565b979650505050505050565b6000805b6004548110156103c757826001600160a01b031660048281548110610395576103956116b4565b6000918252602090912001546001600160a01b0316036103b55792915050565b806103bf816116e0565b91505061036e565b5060001992915050565b6103d9610855565b6103e36000610f8e565b565b6001600160801b03198116600090815260036020818152604080842081516101008101835281546001600160a01b03811682526001600160601b03600160a01b9182900481169583019590955260018301549485169382019390935263ffffffff600160601b850416606082015261ffff600160801b850481166080830152600160901b85041660a082015293909260c085019260ff9104169081111561048e5761048e6115c7565b600381111561049f5761049f6115c7565b81526020016001820160159054906101000a900460ff1660018111156104c7576104c76115c7565b60018111156104d8576104d86115c7565b90525080519091506001600160a01b031633148061050057506000546001600160a01b031633145b61052057600060405163e070a7b960e01b815260040161031691906116f9565b60008160c001516003811115610538576105386115c7565b1461055957600160405163e070a7b960e01b815260040161031691906116f9565b6001600160801b03198216600081815260036020526040808220600101805460ff60a01b1916600360a01b179055517ffc22e6fdd88184e8d67a296586efdbe7fc841bdd51e3dcfafb84993ca3e396169190a26105fa81600001516004836080015161ffff16815481106105cf576105cf6116b4565b60009182526020909120015460408401516001600160a01b03909116906001600160601b0316610fde565b5050565b6002546000906106289087908790879087906106209063ffffffff164261170c565b8760006108af565b9695505050505050565b6106796040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082019081526020016000905290565b6001600160801b031982166000908152600360205260409020546001600160a01b03166106db5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a59081bdc99195c881a5960821b6044820152606401610316565b6001600160801b0319821660009081526003602081815260409283902083516101008101855281546001600160a01b03811682526001600160601b03600160a01b9182900481169483019490945260018301549384169582019590955263ffffffff600160601b840416606082015261ffff600160801b840481166080830152600160901b84041660a082015293909260c085019260ff9290049190911690811115610789576107896115c7565b600381111561079a5761079a6115c7565b81526020016001820160159054906101000a900460ff1660018111156107c2576107c26115c7565b60018111156107d3576107d36115c7565b90525092915050565b6107e4610855565b6001600160a01b0381166108495760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610316565b61085281610f8e565b50565b6000546001600160a01b031633146103e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610316565b60006108b9611005565b6004548861ffff16106109005760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081d1bdad95b9259608a1b6044820152606401610316565b6004548661ffff16106109555760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964207377617020746f6b656e20696400000000000000000000006044820152606401610316565b6001600160801b03198316600090815260036020526040902054336001600160a01b039091160361099c57600260405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b031983166000908152600360205260409020546001600160a01b0316610c98573360036000856001600160801b0319166001600160801b031916815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508760036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160106101000a81548161ffff021916908361ffff1602179055508560036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160126101000a81548161ffff021916908361ffff1602179055508660036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160006101000a8154816001600160601b0302191690836001600160601b031602179055508460036000856001600160801b0319166001600160801b031916815260200190815260200160002060000160146101000a8154816001600160601b0302191690836001600160601b031602179055508360036000856001600160801b0319166001600160801b0319168152602001908152602001600020600101600c6101000a81548163ffffffff021916908363ffffffff160217905550600060036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160146101000a81548160ff02191690836003811115610bd057610bd06115c7565b02179055506001600160801b03198316600090815260036020526040902060019081018054849260ff60a81b1990911690600160a81b908490811115610c1857610c186115c7565b02179055506040516001600160801b03198416907f6d4470ffbc34b0ee68d3b84b82df89e9e99ee0800a474ce5a51bb6449a97d02390600090a2610c913360048a61ffff1681548110610c6d57610c6d6116b4565b6000918252602090912001546001600160a01b03166001600160601b038a1661105e565b5081610f85565b6001600160801b031983166000908152600360208190526040822060010154600160a01b900460ff1690811115610cd157610cd16115c7565b14610cf257600060405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b03198316600090815260036020526040902060010154600160601b900463ffffffff16421115610d3f57600060405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b0319831660009081526003602052604090206001015461ffff878116600160801b90920416141580610da057506001600160801b031983166000908152600360205260409020600101546001600160601b03868116911614155b80610dd557506001600160801b0319831660009081526003602052604090206001015461ffff898116600160901b9092041614155b80610e0c57506001600160801b031983166000908152600360205260409020546001600160601b03888116600160a01b9092041614155b80610e605750816001811115610e2457610e246115c7565b6001600160801b031984166000908152600360205260409020600190810154600160a81b900460ff1690811115610e5d57610e5d6115c7565b14155b15610e8157600360405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b03198316600081815260036020526040808220600101805460ff60a01b1916600160a01b179055517f4c4d2e0ab8731570c5565273949d17fab1e419633d66979a151714142304403d9190a2600060048761ffff1681548110610eed57610eed6116b4565b6000918252602090912001546001600160a01b03169050610f1833826001600160601b038916610fde565b6001600160801b0319841660009081526003602052604090205460048054610f809233926001600160a01b039091169161ffff8e16908110610f5c57610f5c6116b4565b6000918252602090912001546001600160a01b03166001600160601b038c16611086565b839150505b61035f60018055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216610ff157505050565b6102cc6001600160a01b03831684836110b0565b6002600154036110575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610316565b6002600155565b6001600160a01b03821661107157505050565b6102cc6001600160a01b038316843084611113565b6001600160a01b038216156110aa576110aa6001600160a01b038316858584611113565b50505050565b6040516001600160a01b0383166024820152604481018290526102cc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261114b565b6040516001600160a01b03808516602483015283166044820152606481018290526110aa9085906323b872dd60e01b906084016110dc565b60006111a0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112209092919063ffffffff16565b90508051600014806111c15750808060200190518101906111c19190611732565b6102cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610316565b606061122f8484600085611237565b949350505050565b6060824710156112985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610316565b600080866001600160a01b031685876040516112b49190611778565b60006040518083038185875af1925050503d80600081146112f1576040519150601f19603f3d011682016040523d82523d6000602084013e6112f6565b606091505b509150915061035f878383876060831561137157825160000361136a576001600160a01b0385163b61136a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610316565b508161122f565b61122f83838151156113865781518083602001fd5b8060405162461bcd60e51b81526004016103169190611794565b803563ffffffff811681146113b457600080fd5b919050565b6000602082840312156113cb57600080fd5b6113d4826113a0565b9392505050565b600080602083850312156113ee57600080fd5b823567ffffffffffffffff8082111561140657600080fd5b818501915085601f83011261141a57600080fd5b81358181111561142957600080fd5b8660208260051b850101111561143e57600080fd5b60209290920196919550909350505050565b60006020828403121561146257600080fd5b5035919050565b803561ffff811681146113b457600080fd5b80356001600160601b03811681146113b457600080fd5b80356001600160801b0319811681146113b457600080fd5b60008060008060008060c087890312156114c357600080fd5b6114cc87611469565b95506114da6020880161147b565b94506114e860408801611469565b93506114f66060880161147b565b9250611504608088016113a0565b915061151260a08801611492565b90509295509295509295565b60006020828403121561153057600080fd5b81356001600160a01b03811681146113d457600080fd5b60006020828403121561155957600080fd5b6113d482611492565b600080600080600060a0868803121561157a57600080fd5b61158386611469565b94506115916020870161147b565b935061159f60408701611469565b92506115ad6060870161147b565b91506115bb60808701611492565b90509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60048110610852576108526115c7565b6115f6816115dd565b9052565b60028110610852576108526115c7565b6115f6816115fa565b6000610100820190506001600160a01b03835116825260208301516001600160601b038082166020850152806040860151166040850152505063ffffffff60608401511660608301526080830151611671608084018261ffff169052565b5060a083015161168760a084018261ffff169052565b5060c083015161169a60c08401826115ed565b5060e08301516116ad60e084018261160a565b5092915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016116f2576116f26116ca565b5060010190565b60208101611706836115fa565b91905290565b8082018082111561171f5761171f6116ca565b92915050565b60208101611706836115dd565b60006020828403121561174457600080fd5b815180151581146113d457600080fd5b60005b8381101561176f578181015183820152602001611757565b50506000910152565b6000825161178a818460208701611754565b9190910192915050565b60208152600082518060208401526117b3816040850160208701611754565b601f01601f1916919091016040019291505056fea26469706673582212207636be76410fd359a4c5fc54ca91bd79cc109669f203cb41362b740c812ad56a64736f6c634300081200330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9840000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b320000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae90000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd520000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2000000000000000000000000163f8c2467924be0ae7b5347228cabf2603187530000000000000000000000004d224452801aced8b2f0aebe155379bb5d59438100000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce0000000000000000000000006982508145454ce325ddbe47a25d4ec3d23119330000000000000000000000007d1afa7b718fb893db30a3abc0cfc608aacfebb0
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100df5760003560e01c80638da5cb5b1161008c578063d92fc67b11610066578063d92fc67b146101da578063ed4ad7f8146101e2578063f07319be146101f5578063f2fde38b1461021557600080fd5b80638da5cb5b14610191578063b25eaeae146101a2578063cf9b5560146101b557600080fd5b8063625bb8de116100bd578063625bb8de1461013c57806366c0bd2414610168578063715018a61461018957600080fd5b806329fd5984146100e45780634ae05c7d146100f95780635715c5b71461010c575b600080fd5b6100f76100f23660046113b9565b610228565b005b6100f76101073660046113db565b61024c565b61011f61011a366004611450565b6102d1565b6040516001600160a01b0390911681526020015b60405180910390f35b61014f61014a3660046114aa565b61034d565b6040516001600160801b03199091168152602001610133565b61017b61017636600461151e565b61036a565b604051908152602001610133565b6100f76103d1565b6000546001600160a01b031661011f565b6100f76101b0366004611547565b6103e5565b6002546101c59063ffffffff1681565b60405163ffffffff9091168152602001610133565b60045461017b565b61014f6101f0366004611562565b6105fe565b610208610203366004611547565b610632565b6040516101339190611613565b6100f761022336600461151e565b6107dc565b610230610855565b6002805463ffffffff191663ffffffff92909216919091179055565b610254610855565b60005b818110156102cc576004838383818110610273576102736116b4565b9050602002016020810190610288919061151e565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b03909216919091179055806102c4816116e0565b915050610257565b505050565b60006102dc60045490565b821061031f5760405162461bcd60e51b815260206004820152600d60248201526c0d2dcecc2d8d2c840d2dcc8caf609b1b60448201526064015b60405180910390fd5b60048281548110610332576103326116b4565b6000918252602090912001546001600160a01b031692915050565b600061035f87878787878760016108af565b979650505050505050565b6000805b6004548110156103c757826001600160a01b031660048281548110610395576103956116b4565b6000918252602090912001546001600160a01b0316036103b55792915050565b806103bf816116e0565b91505061036e565b5060001992915050565b6103d9610855565b6103e36000610f8e565b565b6001600160801b03198116600090815260036020818152604080842081516101008101835281546001600160a01b03811682526001600160601b03600160a01b9182900481169583019590955260018301549485169382019390935263ffffffff600160601b850416606082015261ffff600160801b850481166080830152600160901b85041660a082015293909260c085019260ff9104169081111561048e5761048e6115c7565b600381111561049f5761049f6115c7565b81526020016001820160159054906101000a900460ff1660018111156104c7576104c76115c7565b60018111156104d8576104d86115c7565b90525080519091506001600160a01b031633148061050057506000546001600160a01b031633145b61052057600060405163e070a7b960e01b815260040161031691906116f9565b60008160c001516003811115610538576105386115c7565b1461055957600160405163e070a7b960e01b815260040161031691906116f9565b6001600160801b03198216600081815260036020526040808220600101805460ff60a01b1916600360a01b179055517ffc22e6fdd88184e8d67a296586efdbe7fc841bdd51e3dcfafb84993ca3e396169190a26105fa81600001516004836080015161ffff16815481106105cf576105cf6116b4565b60009182526020909120015460408401516001600160a01b03909116906001600160601b0316610fde565b5050565b6002546000906106289087908790879087906106209063ffffffff164261170c565b8760006108af565b9695505050505050565b6106796040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082019081526020016000905290565b6001600160801b031982166000908152600360205260409020546001600160a01b03166106db5760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a59081bdc99195c881a5960821b6044820152606401610316565b6001600160801b0319821660009081526003602081815260409283902083516101008101855281546001600160a01b03811682526001600160601b03600160a01b9182900481169483019490945260018301549384169582019590955263ffffffff600160601b840416606082015261ffff600160801b840481166080830152600160901b84041660a082015293909260c085019260ff9290049190911690811115610789576107896115c7565b600381111561079a5761079a6115c7565b81526020016001820160159054906101000a900460ff1660018111156107c2576107c26115c7565b60018111156107d3576107d36115c7565b90525092915050565b6107e4610855565b6001600160a01b0381166108495760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610316565b61085281610f8e565b50565b6000546001600160a01b031633146103e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610316565b60006108b9611005565b6004548861ffff16106109005760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081d1bdad95b9259608a1b6044820152606401610316565b6004548661ffff16106109555760405162461bcd60e51b815260206004820152601560248201527f696e76616c6964207377617020746f6b656e20696400000000000000000000006044820152606401610316565b6001600160801b03198316600090815260036020526040902054336001600160a01b039091160361099c57600260405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b031983166000908152600360205260409020546001600160a01b0316610c98573360036000856001600160801b0319166001600160801b031916815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508760036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160106101000a81548161ffff021916908361ffff1602179055508560036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160126101000a81548161ffff021916908361ffff1602179055508660036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160006101000a8154816001600160601b0302191690836001600160601b031602179055508460036000856001600160801b0319166001600160801b031916815260200190815260200160002060000160146101000a8154816001600160601b0302191690836001600160601b031602179055508360036000856001600160801b0319166001600160801b0319168152602001908152602001600020600101600c6101000a81548163ffffffff021916908363ffffffff160217905550600060036000856001600160801b0319166001600160801b031916815260200190815260200160002060010160146101000a81548160ff02191690836003811115610bd057610bd06115c7565b02179055506001600160801b03198316600090815260036020526040902060019081018054849260ff60a81b1990911690600160a81b908490811115610c1857610c186115c7565b02179055506040516001600160801b03198416907f6d4470ffbc34b0ee68d3b84b82df89e9e99ee0800a474ce5a51bb6449a97d02390600090a2610c913360048a61ffff1681548110610c6d57610c6d6116b4565b6000918252602090912001546001600160a01b03166001600160601b038a1661105e565b5081610f85565b6001600160801b031983166000908152600360208190526040822060010154600160a01b900460ff1690811115610cd157610cd16115c7565b14610cf257600060405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b03198316600090815260036020526040902060010154600160601b900463ffffffff16421115610d3f57600060405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b0319831660009081526003602052604090206001015461ffff878116600160801b90920416141580610da057506001600160801b031983166000908152600360205260409020600101546001600160601b03868116911614155b80610dd557506001600160801b0319831660009081526003602052604090206001015461ffff898116600160901b9092041614155b80610e0c57506001600160801b031983166000908152600360205260409020546001600160601b03888116600160a01b9092041614155b80610e605750816001811115610e2457610e246115c7565b6001600160801b031984166000908152600360205260409020600190810154600160a81b900460ff1690811115610e5d57610e5d6115c7565b14155b15610e8157600360405163f0ebcc4360e01b81526004016103169190611725565b6001600160801b03198316600081815260036020526040808220600101805460ff60a01b1916600160a01b179055517f4c4d2e0ab8731570c5565273949d17fab1e419633d66979a151714142304403d9190a2600060048761ffff1681548110610eed57610eed6116b4565b6000918252602090912001546001600160a01b03169050610f1833826001600160601b038916610fde565b6001600160801b0319841660009081526003602052604090205460048054610f809233926001600160a01b039091169161ffff8e16908110610f5c57610f5c6116b4565b6000918252602090912001546001600160a01b03166001600160601b038c16611086565b839150505b61035f60018055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216610ff157505050565b6102cc6001600160a01b03831684836110b0565b6002600154036110575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610316565b6002600155565b6001600160a01b03821661107157505050565b6102cc6001600160a01b038316843084611113565b6001600160a01b038216156110aa576110aa6001600160a01b038316858584611113565b50505050565b6040516001600160a01b0383166024820152604481018290526102cc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261114b565b6040516001600160a01b03808516602483015283166044820152606481018290526110aa9085906323b872dd60e01b906084016110dc565b60006111a0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112209092919063ffffffff16565b90508051600014806111c15750808060200190518101906111c19190611732565b6102cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610316565b606061122f8484600085611237565b949350505050565b6060824710156112985760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610316565b600080866001600160a01b031685876040516112b49190611778565b60006040518083038185875af1925050503d80600081146112f1576040519150601f19603f3d011682016040523d82523d6000602084013e6112f6565b606091505b509150915061035f878383876060831561137157825160000361136a576001600160a01b0385163b61136a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610316565b508161122f565b61122f83838151156113865781518083602001fd5b8060405162461bcd60e51b81526004016103169190611794565b803563ffffffff811681146113b457600080fd5b919050565b6000602082840312156113cb57600080fd5b6113d4826113a0565b9392505050565b600080602083850312156113ee57600080fd5b823567ffffffffffffffff8082111561140657600080fd5b818501915085601f83011261141a57600080fd5b81358181111561142957600080fd5b8660208260051b850101111561143e57600080fd5b60209290920196919550909350505050565b60006020828403121561146257600080fd5b5035919050565b803561ffff811681146113b457600080fd5b80356001600160601b03811681146113b457600080fd5b80356001600160801b0319811681146113b457600080fd5b60008060008060008060c087890312156114c357600080fd5b6114cc87611469565b95506114da6020880161147b565b94506114e860408801611469565b93506114f66060880161147b565b9250611504608088016113a0565b915061151260a08801611492565b90509295509295509295565b60006020828403121561153057600080fd5b81356001600160a01b03811681146113d457600080fd5b60006020828403121561155957600080fd5b6113d482611492565b600080600080600060a0868803121561157a57600080fd5b61158386611469565b94506115916020870161147b565b935061159f60408701611469565b92506115ad6060870161147b565b91506115bb60808701611492565b90509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60048110610852576108526115c7565b6115f6816115dd565b9052565b60028110610852576108526115c7565b6115f6816115fa565b6000610100820190506001600160a01b03835116825260208301516001600160601b038082166020850152806040860151166040850152505063ffffffff60608401511660608301526080830151611671608084018261ffff169052565b5060a083015161168760a084018261ffff169052565b5060c083015161169a60c08401826115ed565b5060e08301516116ad60e084018261160a565b5092915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016116f2576116f26116ca565b5060010190565b60208101611706836115fa565b91905290565b8082018082111561171f5761171f6116ca565b92915050565b60208101611706836115dd565b60006020828403121561174457600080fd5b815180151581146113d457600080fd5b60005b8381101561176f578181015183820152602001611757565b50506000910152565b6000825161178a818460208701611754565b9190910192915050565b60208152600082518060208401526117b3816040850160208701611754565b601f01601f1916919091016040019291505056fea26469706673582212207636be76410fd359a4c5fc54ca91bd79cc109669f203cb41362b740c812ad56a64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9840000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b320000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae90000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd520000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2000000000000000000000000163f8c2467924be0ae7b5347228cabf2603187530000000000000000000000004d224452801aced8b2f0aebe155379bb5d59438100000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce0000000000000000000000006982508145454ce325ddbe47a25d4ec3d23119330000000000000000000000007d1afa7b718fb893db30a3abc0cfc608aacfebb0
-----Decoded View---------------
Arg [0] : _tokens (address[]): 0xdAC17F958D2ee523a2206206994597C13D831ec7,0x514910771AF9Ca656af840dff83E8264EcF986CA,0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984,0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32,0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,0xD533a949740bb3306d119CC777fa900bA034cd52,0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2,0x163f8C2467924be0ae7B5347228CABF260318753,0x4d224452801ACEd8B2F0aebE155379bb5D594381,0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE,0x6982508145454Ce325dDbE47a25d4ec3d2311933,0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [2] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [4] : 0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984
Arg [5] : 0000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b32
Arg [6] : 0000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae9
Arg [7] : 0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599
Arg [8] : 000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52
Arg [9] : 0000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2
Arg [10] : 000000000000000000000000163f8c2467924be0ae7b5347228cabf260318753
Arg [11] : 0000000000000000000000004d224452801aced8b2f0aebe155379bb5d594381
Arg [12] : 00000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce
Arg [13] : 0000000000000000000000006982508145454ce325ddbe47a25d4ec3d2311933
Arg [14] : 0000000000000000000000007d1afa7b718fb893db30a3abc0cfc608aacfebb0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $1 | 52 | $52 |
Loading...
Loading
[ 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.