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

test partial fill #114

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

test partial fill #114

wants to merge 5 commits into from

Conversation

snreynolds
Copy link
Member

No description provided.

@snreynolds snreynolds marked this pull request as ready for review October 28, 2022 18:23
@snreynolds snreynolds requested a review from ewilz October 28, 2022 18:23
const covenBalanceBefore = await covenContract.balanceOf(alice.address)
await router['execute(bytes,bytes[],uint256)'](commands, inputs, DEADLINE)
const covenBalanceAfter = await covenContract.balanceOf(alice.address)
expect(covenBalanceAfter.sub(covenBalanceBefore)).to.eq(numCovensNFTX)
Copy link
Member

Choose a reason for hiding this comment

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

we need to make sure that the user gets their money back for the NFT's they did not receive

expect(owner1Before.toLowerCase()).to.eq(params1.offerer)
expect(owner0After).to.eq(alice.address)
expect(owner1After).to.eq(alice.address)
expect(ethDelta).to.eq(gasSpent) // eth spent only on gas bc trade came from DAI
Copy link
Member

Choose a reason for hiding this comment

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

if this was a partial fill, does some ether get stuck in the router?? might be good to check that router balance is 0 and that Alice got refunded for her partial fill....I may have forgetten to do this in my other partial fill tests. 😬

it('completes a trade for ERC20 --> ETH --> NFTs, invalid Seaport order', async () => {
const maxAmountIn = expandTo18DecimalsBN(100_000)
// in this case there is leftover dai in the router, and the unspent eth gets sent to alice
await daiContract.transfer(router.address, maxAmountIn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should now use permit2 to transfer in the tokens 👯

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can just add a

dai.approve(permit2)
permit2.approve(router, amount)

so that then during v2 it can pull in the tokens from the user :)

it('completes a trade for ERC20 --> ETH --> NFTs with Seaport, fulfillAvailableAdvancedOrders fill', async () => {
const maxAmountIn = expandTo18DecimalsBN(100_000)
// in this case there is leftover dai in the router and all eth gets spent on the nfts
await daiContract.transfer(router.address, maxAmountIn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

aaand again
basically these dai transfers used to be our way to make tests before we could integrate with permit2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants