Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept underlying bids from Blur #390

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .husky/pre-push

This file was deleted.

94 changes: 94 additions & 0 deletions contracts/interfaces/IPoolMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,66 @@ interface IPoolMarketplace {
uint256 tokenId
);

/**
* @dev Emitted on initiateAcceptBlurBidsRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param bidingPrice The listing price of the request
* @param marketPlaceFee The market place fee taken from bidingPrice
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
* @param bidOrderHash the biding order hash
**/
event AcceptBlurBidsRequestInitiated(
address indexed initiator,
address paymentToken,
uint256 bidingPrice,
uint256 marketPlaceFee,
address collection,
uint256 tokenId,
bytes32 bidOrderHash
);

/**
* @dev Emitted on fulfillAcceptBlurBidsRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param bidingPrice The listing price of the request
* @param marketPlaceFee The market place fee taken from bidingPrice
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
* @param bidOrderHash the biding order hash
**/
event AcceptBlurBidsRequestFulfilled(
address indexed initiator,
address paymentToken,
uint256 bidingPrice,
uint256 marketPlaceFee,
address collection,
uint256 tokenId,
bytes32 bidOrderHash
);

/**
* @dev Emitted on rejectAcceptBlurBidsRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param bidingPrice The listing price of the request
* @param marketPlaceFee The market place fee taken from bidingPrice
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
* @param bidOrderHash the biding order hash
**/
event AcceptBlurBidsRequestRejected(
address indexed initiator,
address paymentToken,
uint256 bidingPrice,
uint256 marketPlaceFee,
address collection,
uint256 tokenId,
bytes32 bidOrderHash
);

/**
* @notice Implements the buyWithCredit feature. BuyWithCredit allows users to buy NFT from various NFT marketplaces
* including OpenSea, LooksRare, X2Y2 etc. Users can use NFT's credit and will need to pay at most (1 - LTV) * $NFT
Expand Down Expand Up @@ -179,4 +239,38 @@ interface IPoolMarketplace {
function getBlurExchangeRequestStatus(
DataTypes.BlurBuyWithCreditRequest calldata request
) external view returns (DataTypes.BlurBuyWithCreditRequestStatus);

/**
* @notice Initiate accept blur bids for underlying request.
* @dev Only the request initiator can call this function
* @param requests The request array
*/
function initiateAcceptBlurBidsRequest(
DataTypes.AcceptBlurBidsRequest[] calldata requests
) external payable;

/**
* @notice Fulfill accept blur bids for underlying request if the blur selling transaction is successes.
* @dev Only keeper can call this function
* @param requests The request array
*/
function fulfillAcceptBlurBidsRequest(
DataTypes.AcceptBlurBidsRequest[] calldata requests
) external payable;

/**
* @notice Reject accept blur bids for underlying request if the blur selling transaction is failed.
* @dev Only keeper can call this function
* @param requests The request array
*/
function rejectAcceptBlurBidsRequest(
DataTypes.AcceptBlurBidsRequest[] calldata requests
) external;

/**
* @notice Get a accept blur bids for underlying request status.
*/
function getAcceptBlurBidsRequestStatus(
DataTypes.AcceptBlurBidsRequest calldata request
) external view returns (DataTypes.AcceptBlurBidsRequestStatus);
}
55 changes: 54 additions & 1 deletion contracts/interfaces/IPoolParameters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,31 @@ interface IPoolParameters {
* @dev Emitted when the blur exchange keeper address update
**/
event BlurExchangeKeeperUpdated(address keeper);
/**
* @dev Emitted when the status of accept blur bids enable status update
**/
event AcceptBlurBidsEnableStatusUpdated(bool isEnable);

/**
* @dev Emitted when the limit amount of accept blur bids ongoing request update
**/
event AcceptBlurBidsOngoingRequestLimitUpdated(
uint256 oldValue,
uint256 newValue
);

/**
* @dev Emitted when the fee rate of accept blur bids request update
**/
event AcceptBlurBidsRequestFeeRateUpdated(
uint256 oldValue,
uint256 newValue
);

/**
* @dev Emitted when the accept blur bids keeper address update
**/
event AcceptBlurBidsKeeperUpdated(address keeper);

/**
* @notice Initializes a reserve, activating it, assigning an xToken and debt tokens and an
Expand Down Expand Up @@ -244,8 +269,36 @@ interface IPoolParameters {
function setBlurExchangeRequestFeeRate(uint16 feeRate) external;

/**
* @notice update blur exchange enable status, only pool admin call this function
* @notice update blur exchange keeper, only pool admin call this function
* @param keeper The new keeper address
**/
function setBlurExchangeKeeper(address keeper) external;

/**
* @notice enable accept blur bids request, only pool admin call this function
**/
function enableAcceptBlurBids() external;

/**
* @notice disable accept blur bids request, only pool admin or emergency admin call this function
**/
function disableAcceptBlurBids() external;

/**
* @notice update accept blur bids ongoing request limit amount
* @param limit The new limit amount
**/
function setAcceptBlurBidsOngoingRequestLimit(uint8 limit) external;

/**
* @notice update accept blur bids request fee rate
* @param feeRate The new fee rate
**/
function setAcceptBlurBidsRequestFeeRate(uint16 feeRate) external;

/**
* @notice update accept blur bids keeper, only pool admin call this function
* @param keeper The new keeper address
**/
function setAcceptBlurBidsKeeper(address keeper) external;
}
6 changes: 4 additions & 2 deletions contracts/protocol/libraries/helpers/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@ library Errors {
string public constant CALLER_NOT_INITIATOR = "141"; //The caller of the function is not the request initiator
string public constant INVALID_KEEPER_ADDRESS = "142"; //invalid keeper address to receive money
string public constant ONGOING_REQUEST_AMOUNT_EXCEEDED = "143"; //ongoing request amount exceeds limit
string public constant BLUR_EXCHANGE_REQUEST_DISABLED = "144"; //blur exchange request disabled
string public constant REQUEST_DISABLED = "144"; //blur exchange request disabled
string public constant INVALID_ASSET = "145"; // invalid asset.
string public constant INVALID_ETH_VALUE = "146"; //the eth value with the transaction is invalid
string public constant INVALID_REQUEST_STATUS = "147"; //The status of the request is invalid for this function
string public constant INVALID_PAYMENT_TOKEN = "148"; //the invalid payment token for blur exchange request
string public constant INVALID_LISTING_PRICE = "149"; //the listing price for blur exchange request is invalid
string public constant INVALID_REQUEST_PRICE = "149"; //the listing price for blur exchange request is invalid
string public constant CALLER_NOT_KEEPER = "150"; //The caller of the function is not keeper
string public constant NTOKEN_NOT_OWNS_UNDERLYING = "151"; //The ntoken does not owns the underlying nft
string public constant EXISTING_APE_STAKING = "152"; // Ape coin staking position existed
string public constant NOT_SAME_NTOKEN_OWNER = "153"; // ntoken have different owner

string public constant INVALID_PARAMETER = "170"; //invalid parameter
}
Loading
Loading