Skip to content
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fff4a04
chore: base implementation for blur integration
zhoujia6139 Apr 15, 2023
307ef77
chore: merge main
zhoujia6139 Apr 15, 2023
946ce7a
chore: add comment
zhoujia6139 Apr 17, 2023
72fd6ec
chore: add pool extended logic to reduce contract size
zhoujia6139 Apr 17, 2023
dd1c390
chore: add more test case
zhoujia6139 Apr 17, 2023
33edf3b
chore: merge main
zhoujia6139 Apr 17, 2023
db7cd30
chore: fix typechain issue
zhoujia6139 Apr 18, 2023
ef0f608
chore: mint debt token before transfer asset
zhoujia6139 Apr 18, 2023
fdfa6be
chore: only support ETH listing order and user can only pay cash with…
zhoujia6139 Apr 18, 2023
0476e82
chore: Set limit count for ongoing request
zhoujia6139 Apr 18, 2023
d03a5a7
chore: add charge fee logic
zhoujia6139 Apr 18, 2023
16d7fc3
chore: separate role for enable and disable BLUR exchange
zhoujia6139 Apr 18, 2023
ac1b6b3
chore: remove Fulfilled and Rejected status
zhoujia6139 Apr 18, 2023
ecc0a8a
chore: small fix
zhoujia6139 Apr 18, 2023
2dc2418
chore: move BLUR integration to PoolExtendedLogic
zhoujia6139 Apr 18, 2023
dd8e4f3
chore: merge main
zhoujia6139 Apr 21, 2023
3ebbf0e
chore: add comment
zhoujia6139 Apr 21, 2023
5c6b0a0
chore: upgrade script
zhoujia6139 Apr 24, 2023
1fd580a
chore: add query request status interface
zhoujia6139 Apr 24, 2023
bac5df1
chore: end auction before burn user's nToken
zhoujia6139 Apr 25, 2023
76ad323
chore: should use trait boosted price to calculate listing price calc…
zhoujia6139 Apr 25, 2023
f6886b7
chore: ensureOwnsUnderlying when borrowApeAndStake
zhoujia6139 Apr 26, 2023
cfd575c
chore: check liquidation threshold when initiate request
zhoujia6139 Apr 27, 2023
17a1ed3
chore: declare event in interface file
zhoujia6139 Apr 27, 2023
3334212
Merge branch 'main' into blur_integration
zhoujia6139 Apr 27, 2023
404a425
chore: fix lint
zhoujia6139 Apr 27, 2023
b57a085
chore: support batch call
zhoujia6139 May 5, 2023
e783529
Merge branch 'main' into blur_integration
zhoujia6139 May 5, 2023
11518a1
chore: add comment
zhoujia6139 May 5, 2023
c8fc6c1
chore: update comment and testcase
zhoujia6139 May 6, 2023
0bc4f6b
chore: update listing price limit and add test case
zhoujia6139 May 6, 2023
981725d
chore: rename test case file
zhoujia6139 May 8, 2023
5b6c97e
chore: add-para-proxy-interfaces
zhoujia6139 May 12, 2023
eaf867c
Merge branch 'main' into blur_integration
zhoujia6139 May 12, 2023
c2a33bc
Merge branch 'main' into blur_integration
zhoujia6139 May 22, 2023
bbb3453
chore: merge main
zhoujia6139 Oct 10, 2023
db11144
chore: fix deploy script
zhoujia6139 Oct 10, 2023
43cb9a8
Accept underlying bids from Blur (#390)
zhoujia6139 Oct 10, 2023
de597f3
chore: add izumi check in case got forgotten
zhoujia6139 Oct 10, 2023
88741a0
chore: some optimization
zhoujia6139 Oct 11, 2023
877e67f
chore: fix typo and test case(break since market config change)
zhoujia6139 Oct 12, 2023
1d71b6f
chore: some small optimization
zhoujia6139 Oct 17, 2023
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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,22 @@ set-reserve-pause:
set-cAPE-pause:
make TASK_NAME=set-cAPE-pause run-task

.PHONY: set-blur-integration-enable
set-blur-integration-enable:
make TASK_NAME=set-blur-integration-enable run-task

.PHONY: set-blur-ongoing-request-limit
set-blur-ongoing-request-limit:
make TASK_NAME=set-blur-ongoing-request-limit run-task

.PHONY: set-blur-request-fee-rate
set-blur-request-fee-rate:
make TASK_NAME=set-blur-request-fee-rate run-task

.PHONY: set-blur-exchange-keeper
set-blur-exchange-keeper:
make TASK_NAME=set-blur-exchange-keeper run-task

.PHONY: list-facets
list-facets:
make TASK_NAME=list-facets run-task
Expand Down Expand Up @@ -600,6 +616,10 @@ upgrade:
upgrade-pool:
make TASK_NAME=upgrade:pool run-task

.PHONY: add-para-proxy-interfaces
add-para-proxy-interfaces:
make TASK_NAME=upgrade:add-para-proxy-interfaces run-task

.PHONY: upgrade-pool-core
upgrade-pool-core:
make TASK_NAME=upgrade:pool-core run-task
Expand Down
90 changes: 89 additions & 1 deletion contracts/interfaces/IPoolMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IPoolAddressesProvider} from "./IPoolAddressesProvider.sol";
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";

/**
* @title IPool
* @title IPoolMarketplace
*
* @notice Defines the basic interface for an ParaSpace Pool.
**/
Expand All @@ -22,6 +22,60 @@ interface IPoolMarketplace {
DataTypes.Credit credit
);

/**
* @dev Emitted on initiateBlurExchangeRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param listingPrice The listing price of the request
* @param borrowAmount The borrow amount for the request
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
**/
event BlurExchangeRequestInitiated(
address indexed initiator,
address paymentToken,
uint256 listingPrice,
uint256 borrowAmount,
address collection,
uint256 tokenId
);

/**
* @dev Emitted on fulfillBlurExchangeRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param listingPrice The listing price of the request
* @param borrowAmount The borrow amount for the request
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
**/
event BlurExchangeRequestFulfilled(
address indexed initiator,
address paymentToken,
uint256 listingPrice,
uint256 borrowAmount,
address collection,
uint256 tokenId
);

/**
* @dev Emitted on rejectBlurExchangeRequest()
* @param initiator The address of initiator of the request
* @param paymentToken The address of paymentToken of the request
* @param listingPrice The listing price of the request
* @param borrowAmount The borrow amount for the request
* @param collection the collection address of the erc721
* @param tokenId the tokenId address of the erc721
**/
event BlurExchangeRequestRejected(
address indexed initiator,
address paymentToken,
uint256 listingPrice,
uint256 borrowAmount,
address collection,
uint256 tokenId
);

/**
* @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 @@ -91,4 +145,38 @@ interface IPoolMarketplace {
address onBehalfOf,
uint16 referralCode
) external;

/**
* @notice Initiate a buyWithCredit request for Blur exchange listing order.
* @dev Only the request initiator can call this function
* @param requests The request array
*/
function initiateBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest[] calldata requests
) external payable;

/**
* @notice Fulfill a buyWithCredit request for Blur exchange listing order if the blur transaction is successes.
* @dev Only keeper can call this function
* @param requests The request array
*/
function fulfillBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest[] calldata requests
) external;

/**
* @notice Reject a buyWithCredit request for Blur exchange listing order if the blur transaction is failed.
* @dev Only keeper can call this function
* @param requests The request array
*/
function rejectBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest[] calldata requests
) external payable;

/**
* @notice Get a buyWithCredit request status for Blur exchange listing order.
*/
function getBlurExchangeRequestStatus(
DataTypes.BlurBuyWithCreditRequest calldata request
) external view returns (DataTypes.BlurBuyWithCreditRequestStatus);
}
48 changes: 48 additions & 0 deletions contracts/interfaces/IPoolParameters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ interface IPoolParameters {
**/
event ClaimApeForYieldIncentiveUpdated(uint256 oldValue, uint256 newValue);

/**
* @dev Emitted when the status of blur exchange enable status update
**/
event BlurExchangeEnableStatusUpdated(bool isEnable);

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

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

/**
* @dev Emitted when the blur exchange keeper address update
**/
event BlurExchangeKeeperUpdated(address keeper);

/**
* @notice Initializes a reserve, activating it, assigning an xToken and debt tokens and an
* interest rate strategy
Expand Down Expand Up @@ -199,4 +219,32 @@ interface IPoolParameters {
external
view
returns (uint256 ltv, uint256 lt);

/**
* @notice enable blur exchange request, only pool admin call this function
**/
function enableBlurExchange() external;

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

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

/**
* @notice update blur exchange request fee rate
* @param feeRate The new fee rate
**/
function setBlurExchangeRequestFeeRate(uint16 feeRate) external;

/**
* @notice update blur exchange enable status, only pool admin call this function
* @param keeper The new keeper address
**/
function setBlurExchangeKeeper(address keeper) external;
}
11 changes: 11 additions & 0 deletions contracts/protocol/libraries/helpers/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,15 @@ library Errors {
string public constant CALLER_NOT_OPERATOR = "138"; // The caller of the function is not operator
string public constant INVALID_FEE_VALUE = "139"; // invalid fee rate value
string public constant TOKEN_NOT_ALLOW_RESCUE = "140"; // token is not allow rescue
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 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 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
}
Loading