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

Blur Integration #371

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 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
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,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
34 changes: 34 additions & 0 deletions contracts/interfaces/IPoolMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,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 request The detail info for the request
*/
function initiateBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest calldata request
) 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 request The detail info for the request
*/
function fulfillBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest calldata request
) external;

/**
* @notice Rejuct a buyWithCredit request for Blur exchange listing order if the blur transaction is failed.
* @dev Only keeper can call this function
* @param request The detail info for the request
*/
function rejectBlurExchangeRequest(
DataTypes.BlurBuyWithCreditRequest calldata request
) 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;
}
10 changes: 10 additions & 0 deletions contracts/protocol/libraries/helpers/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,14 @@ library Errors {
string public constant MAKER_SAME_AS_TAKER = "132"; //maker and taker shouldn't be the same address
string public constant TOKEN_ALREADY_DELEGATED = "133"; //token is already delegted
string public constant INVALID_STATE = "134"; //invalid token status
string public constant INVALID_REQUEST_STATUS = "135"; //The status of the request is invalid for this function
string public constant INVALID_ETH_VALUE = "136"; //the eth value with the transaction is invalid
string public constant INVALID_PAYMENT_TOKEN = "137"; //the invalid payment token for blur exchange request
string public constant INVALID_LISTING_PRICE = "138"; //the listing price for blur exchange request is invalid
string public constant CALLER_NOT_KEEPER = "139"; //The caller of the function is not keeper
string public constant NTOKEN_NOT_OWNS_UNDERLYING = "140"; //The ntoken does not owns the underlying nft
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
}
Loading