-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathIMarketWrapper.sol
89 lines (83 loc) · 3.5 KB
/
IMarketWrapper.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// SPDX-License-Identifier: Beta Software
pragma solidity ^0.8;
/**
* @title IMarketWrapper
* @author Anna Carroll
* @notice IMarketWrapper provides a common interface for
* interacting with NFT auction markets.
* Contracts can abstract their interactions with
* different NFT markets using IMarketWrapper.
* NFT markets can become compatible with any contract
* using IMarketWrapper by deploying a MarketWrapper contract
* that implements this interface using the logic of their Market.
*
* WARNING: MarketWrapper contracts should NEVER write to storage!
* When implementing a MarketWrapper, exercise caution; a poorly implemented
* MarketWrapper contract could permanently lose access to the NFT or user funds.
*/
interface IMarketWrapper {
/**
* @notice Given the auctionId, nftContract, and tokenId, check that:
* 1. the auction ID matches the token
* referred to by tokenId + nftContract
* 2. the auctionId refers to an *ACTIVE* auction
* (e.g. an auction that will accept bids)
* within this market contract
* 3. any additional validation to ensure that
* a PartyBid can bid on this auction
* (ex: if the market allows arbitrary bidding currencies,
* check that the auction currency is ETH)
* Note: This function probably should have been named "isValidAuction"
* @dev Called in PartyBid.sol in `initialize` at line 174
* @return TRUE if the auction is valid
*/
function auctionIdMatchesToken(
uint256 auctionId,
address nftContract,
uint256 tokenId
) external view returns (bool);
/**
* @notice Calculate the minimum next bid for this auction.
* PartyBid contracts always submit the minimum possible
* bid that will be accepted by the Market contract.
* usually, this is either the reserve price (if there are no bids)
* or a certain percentage increase above the current highest bid
* @dev Called in PartyBid.sol in `bid` at line 251
* @return minimum bid amount
*/
function getMinimumBid(uint256 auctionId) external view returns (uint256);
/**
* @notice Query the current highest bidder for this auction
* It is assumed that there is always 1 winning highest bidder for an auction
* This is used to ensure that PartyBid cannot outbid itself if it is already winning
* @dev Called in PartyBid.sol in `bid` at line 241
* @return highest bidder
*/
function getCurrentHighestBidder(uint256 auctionId)
external
view
returns (address);
/**
* @notice Submit bid to Market contract
* @dev Called in PartyBid.sol in `bid` at line 259
*/
function bid(uint256 auctionId, uint256 bidAmount) external;
/**
* @notice Determine whether the auction has been finalized
* Used to check if it is still possible to bid
* And to determine whether the PartyBid should finalize the auction
* @dev Called in PartyBid.sol in `bid` at line 247
* @dev and in `finalize` at line 288
* @return TRUE if the auction has been finalized
*/
function isFinalized(uint256 auctionId) external view returns (bool);
/**
* @notice Finalize the results of the auction
* on the Market contract
* It is assumed that this operation is performed once for each auction,
* that after it is done the auction is over and the NFT has been
* transferred to the auction winner.
* @dev Called in PartyBid.sol in `finalize` at line 289
*/
function finalize(uint256 auctionId) external;
}