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

Feat/collateral swap 2 #369

Open
wants to merge 86 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
dd9f1ca
feat: support non-listed nft
0x8f701 Apr 12, 2023
9fdcc53
feat: remove collateral swap approve process & add eth support & calc…
0x8f701 Apr 12, 2023
3d77ba1
fix: seperate listingPrice & supplyAmount
0x8f701 Apr 13, 2023
e68ccf1
chore: add more comments
0x8f701 Apr 13, 2023
c1a2738
feat: add missing supplyAmount check
0x8f701 Apr 13, 2023
b0f62df
fix: looksrare & blur adapter recipient
0x8f701 Apr 13, 2023
6332ca3
fix: collateral swap test cases
0x8f701 Apr 13, 2023
89f5bce
chore: use safeTransfer instead
0x8f701 Apr 13, 2023
d77d03a
feat: add missing tests
0x8f701 Apr 14, 2023
f974534
fix: lint
0x8f701 Apr 14, 2023
555f4c0
Merge branch 'main' into feat/collateral-swap-2
0x8f701 Apr 18, 2023
3d4243e
Merge remote-tracking branch 'origin/main' into feat/collateral-swap-2
0x8f701 Apr 20, 2023
7f6f5a6
Feat/collateral swap 2 - borrow any (#373)
0x8f701 Apr 21, 2023
a6e6a8d
Feat/collateral swap 2 - ptoken (#380)
0x8f701 Apr 21, 2023
3a44155
Merge branch 'main' into feat/collateral-swap-2
0x8f701 Apr 21, 2023
5feb7ba
feat: make collateralswap only works with ptoken
0x8f701 Apr 21, 2023
18dd06e
chore: add seaport v14 config
0x8f701 Apr 21, 2023
250a773
feat: consistent naming
0x8f701 Apr 21, 2023
0526092
feat: better naming
0x8f701 Apr 21, 2023
3567955
fix: ptoken tests
0x8f701 Apr 22, 2023
0fe791a
fix: ptoken tests
0x8f701 Apr 22, 2023
2d02b7b
fix: bid ptoken tests
0x8f701 Apr 23, 2023
cdcf693
fix: bid ptoken tests
0x8f701 Apr 23, 2023
7063359
feat: remove duplicated timelock code
0x8f701 Apr 23, 2023
6f6b4b7
chore: update ci to use make
0x8f701 Apr 23, 2023
3c259e1
feat: no need to check isListingPToken when supplyAmount != 0
0x8f701 Apr 23, 2023
ecd78bd
chore: fix warnings & use another error
0x8f701 Apr 23, 2023
6857436
Update ci.yml
woshihahaha Apr 23, 2023
4f476de
Update ci.yml
woshihahaha Apr 23, 2023
d2c494a
Update ci.yml
woshihahaha Apr 23, 2023
718a36e
fix: unreachable branch
0x8f701 Apr 24, 2023
7770e40
Merge branch 'feat/collateral-swap-2' of ssh://github.com/para-space/…
0x8f701 Apr 24, 2023
9b77634
fix: restrict dstToken for marketplace
0x8f701 Apr 24, 2023
075654c
fix: revert when amount out bigger than price
0x8f701 Apr 24, 2023
d9dd713
fix: leave extra swapped assets in ptoken for rescue
0x8f701 Apr 24, 2023
d349c10
fix: add missing verify
0x8f701 Apr 27, 2023
edb5841
Merge remote-tracking branch 'origin/main' into feat/collateral-swap-2
0x8f701 May 16, 2023
faf3272
feat: add support for swap with exactOutput
0x8f701 May 16, 2023
f31c459
Feat/ptoken debt swap (#388)
0x8f701 May 22, 2023
f447e71
feat: reset allowance at the end of swap tx
0x8f701 May 22, 2023
95aa30b
fix: mint debt after validateBorrow
0x8f701 May 22, 2023
0286f9d
fix: build
0x8f701 May 22, 2023
8ffb1bd
chore: revert yarn.lock
0x8f701 May 22, 2023
4ccbf08
feat: gas optimize
0x8f701 May 23, 2023
ee48439
feat: remove unnecessary decode
0x8f701 May 23, 2023
5e071a1
feat: limit debtToSwap to userTotalDebt
0x8f701 May 23, 2023
ee93c6a
Feat/private listing sell to opensea (#392)
0x8f701 Jun 8, 2023
a4da24f
chore: cleanup
0x8f701 Jun 9, 2023
39d8185
fix: remove redundant check
0x8f701 Jun 9, 2023
6632c66
fix: finding
0x8f701 Jun 12, 2023
68e6b11
refactor: logic
0x8f701 Jun 12, 2023
8e5d95a
chore: cleanup
0x8f701 Jun 14, 2023
5058014
feat: remove unused orderInfo.id in buyWithCredit
0x8f701 Jun 14, 2023
e68b743
feat: apply optimizatiom
0x8f701 Jun 14, 2023
7c52239
Merge remote-tracking branch 'origin/main' into feat/collateral-swap-2
0x8f701 Jul 6, 2023
4c2f46f
chore: format
0x8f701 Jul 6, 2023
9d14490
feat: dont verify credit if creditAmount == 0
0x8f701 Jul 6, 2023
daf1755
feat: remove extra logic branches
0x8f701 Jul 6, 2023
e399c19
chore: add more comments
0x8f701 Jul 6, 2023
7d4c681
feat: remove ethLeft from vars
0x8f701 Jul 6, 2023
7705a25
feat: remove duplicated code
0x8f701 Jul 6, 2023
d145853
feat: remove duplicated code
0x8f701 Jul 6, 2023
5a41a31
feat: remove msg.value check
0x8f701 Jul 7, 2023
635eac6
feat: remove redundant check
0x8f701 Jul 7, 2023
d4c99c1
fix: tests
0x8f701 Jul 7, 2023
86de1ec
feat: limit marketplace offer to be same collection
0x8f701 Jul 7, 2023
f3c9768
fix: typo
0x8f701 Jul 9, 2023
83db9a9
feat: remove one if else
0x8f701 Jul 9, 2023
81cf9e5
feat: batch supply
0x8f701 Jul 9, 2023
9b07cd5
fix: typo
0x8f701 Jul 10, 2023
d4c6c6c
feat: simplify
0x8f701 Jul 10, 2023
2adfe1c
feat: resolve comments
0x8f701 Jul 10, 2023
71e189b
feat: add batchAcceptOpenseaBid
0x8f701 Jul 11, 2023
d78fa85
feat: cache requiredItemType
0x8f701 Jul 11, 2023
f35ec00
feat: batch collateralize
0x8f701 Jul 11, 2023
1d3cbbe
feat: improve gas
0x8f701 Jul 11, 2023
65c800b
feat: improve gas
0x8f701 Jul 11, 2023
fe27530
fix: typo
0x8f701 Jul 11, 2023
238acdb
chore: update lockfile
0x8f701 Jul 18, 2023
c7cfb0f
fix: unused lib
0x8f701 Jul 18, 2023
92bb4d6
fix: remove redundant check
0x8f701 Jul 18, 2023
9506a4e
fix: remove transferToken
0x8f701 Jul 18, 2023
33766a0
chore: revert husky
0x8f701 Jul 18, 2023
f7adee4
fix: remove 1 mstore
0x8f701 Jul 18, 2023
153652c
fix: remove typos
0x8f701 Jul 18, 2023
add9a62
Merge branch 'main' into feat/collateral-swap-2
0x8f701 Sep 12, 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
Prev Previous commit
Next Next commit
feat: better naming
Signed-off-by: GopherJ <[email protected]>
  • Loading branch information
0x8f701 committed Apr 21, 2023
commit 0526092e0d4caa81b7e8e635a68364abc31ac05f
20 changes: 10 additions & 10 deletions contracts/protocol/libraries/logic/MarketplaceLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@ library MarketplaceLogic {
* @param ps The pool storage pointer
* @param params The additional parameters needed to execute the buyWithCredit/acceptBidWithCredit function
* @param vars The marketplace local vars for caching storage values for future reads
* @param to The receiver of borrowed tokens
* @param originalCreditRecipient The origin receiver of borrowed tokens
*/
function _flashLoanTo(
DataTypes.PoolStorage storage ps,
DataTypes.ExecuteMarketplaceParams memory params,
MarketplaceLocalVars memory vars,
address to
address originalCreditRecipient
) internal {
if (vars.creditAmount == 0) {
return;
Expand All @@ -392,13 +392,13 @@ library MarketplaceLogic {
ValidationLogic.validateFlashloanSimple(reserve);
DataTypes.TimeLockParams memory timeLockParams;
vars.creditAmountInListingToken = vars.creditAmount;
address creditRecipient = vars.isListingTokenPToken
address newCreditRecipient = vars.isListingTokenPToken
? address(this)
: to;
: originalCreditRecipient;

if (vars.listingToken == vars.creditToken) {
IPToken(vars.creditXTokenAddress).transferUnderlyingTo(
creditRecipient,
newCreditRecipient,
vars.creditAmount,
timeLockParams
);
Expand All @@ -417,26 +417,26 @@ library MarketplaceLogic {
);
vars.creditAmountInListingToken = IPToken(vars.creditXTokenAddress)
.swapUnderlyingTo(
creditRecipient,
newCreditRecipient,
timeLockParams,
params.swapAdapter,
params.swapPayload,
swapInfo
);
}

if (vars.isListingTokenETH && creditRecipient == address(this)) {
if (vars.isListingTokenETH && newCreditRecipient == address(this)) {
// No re-entrancy because it sent to our contract address
IWETH(params.weth).withdraw(vars.creditAmountInListingToken);
} else if (vars.isListingTokenPToken) {
SupplyLogic.executeSupply(
ps._reserves,
ps._usersConfig[to],
ps._usersConfig[originalCreditRecipient],
DataTypes.ExecuteSupplyParams({
asset: vars.listingToken,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since did’t check swap.dstToken == listingToken, if pool address have locked some listingToken , will be use to by NFT.

amount: vars.creditAmountInListingToken,
onBehalfOf: to,
payer: creditRecipient,
onBehalfOf: originalCreditRecipient,
payer: newCreditRecipient,
referralCode: 0
})
);
Expand Down