Skip to content
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
12 changes: 12 additions & 0 deletions integration-tests/test/alt-l2/nft_bridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ describe('NFT Bridge Test', async () => {
const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)

const depositMap = await L1Bridge.deposits(L1ERC721.address, DUMMY_TOKEN_ID)

expect(ownerL1).to.deep.eq(L1Bridge.address)
expect(ownerL2).to.deep.eq(env.l2Wallet.address)
expect(depositMap).to.deep.eq(L2ERC721.address)
})

it('should be able to transfer NFT on L2', async () => {
Expand Down Expand Up @@ -155,6 +158,9 @@ describe('NFT Bridge Test', async () => {

const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
expect(ownerL1).to.be.deep.eq(env.l2Wallet_2.address)

const depositMap = await L1Bridge.deposits(L1ERC721.address, DUMMY_TOKEN_ID)
expect(depositMap).to.deep.eq(ethers.constants.AddressZero)
})

it('should deposit NFT to another L2 wallet', async () => {
Expand Down Expand Up @@ -410,8 +416,11 @@ describe('NFT Bridge Test', async () => {
const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)

const exitsMap = await L2Bridge.exits(L2ERC721.address, DUMMY_TOKEN_ID)

expect(ownerL1).to.deep.eq(env.l2Wallet.address)
expect(ownerL2).to.deep.eq(L2Bridge.address)
expect(exitsMap).to.deep.eq(L1ERC721.address)
})

it('should be able to transfer NFT on L1', async () => {
Expand Down Expand Up @@ -462,6 +471,9 @@ describe('NFT Bridge Test', async () => {

const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)
expect(ownerL2).to.deep.eq(env.l2Wallet.address)

const exitsMap = await L2Bridge.exits(L2ERC721.address, DUMMY_TOKEN_ID)
expect(exitsMap).to.deep.eq(ethers.constants.AddressZero)
})

it('should fail to exit NFT to another L1 wallet if not paying enough Boba', async () => {
Expand Down
12 changes: 12 additions & 0 deletions integration-tests/test/eth-l2/nft_bridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ describe('NFT Bridge Test', async () => {
const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)

const depositMap = await L1Bridge.deposits(L1ERC721.address, DUMMY_TOKEN_ID)

expect(ownerL1).to.deep.eq(L1Bridge.address)
expect(ownerL2).to.deep.eq(env.l2Wallet.address)
expect(depositMap).to.deep.eq(L2ERC721.address)
})

it('should be able to transfer NFT on L2', async () => {
Expand Down Expand Up @@ -185,6 +188,9 @@ describe('NFT Bridge Test', async () => {

const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
expect(ownerL1).to.be.deep.eq(env.l2Wallet_2.address)

const depositMap = await L1Bridge.deposits(L1ERC721.address, DUMMY_TOKEN_ID)
expect(depositMap).to.deep.eq(ethers.constants.AddressZero)
})

it('should deposit NFT to another L2 wallet', async () => {
Expand Down Expand Up @@ -518,8 +524,11 @@ describe('NFT Bridge Test', async () => {
const ownerL1 = await L1ERC721.ownerOf(DUMMY_TOKEN_ID)
const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)

const exitsMap = await L2Bridge.exits(L2ERC721.address, DUMMY_TOKEN_ID)

expect(ownerL1).to.deep.eq(env.l2Wallet.address)
expect(ownerL2).to.deep.eq(L2Bridge.address)
expect(exitsMap).to.deep.eq(L1ERC721.address)
})

it('should be able to transfer NFT on L1', async () => {
Expand Down Expand Up @@ -570,6 +579,9 @@ describe('NFT Bridge Test', async () => {

const ownerL2 = await L2ERC721.ownerOf(DUMMY_TOKEN_ID)
expect(ownerL2).to.deep.eq(env.l2Wallet.address)

const exitsMap = await L2Bridge.exits(L2ERC721.address, DUMMY_TOKEN_ID)
expect(exitsMap).to.deep.eq(ethers.constants.AddressZero)
})

it('should fail to exit NFT to another L1 wallet if not enough Boba balance', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ contract L1NFTBridge is iL1NFTBridge, CrossDomainEnabled, ERC721Holder, Reentran
// When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer
IERC721(_l1Contract).safeTransferFrom(address(this), _to, _tokenId);

deposits[_l1Contract][_tokenId] = address(0);

emit NFTWithdrawalFinalized(_l1Contract, _l2Contract, _from, _to, _tokenId, _data);
} else {
// replyNeeded helps store the status if a message needs to be sent back to the other layer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,8 @@ contract L2NFTBridge is iL2NFTBridge, CrossDomainEnabled, ERC721Holder, Reentran
_to,
_tokenId
);
exits[_l2Contract][_tokenId] = address(0);

emit DepositFinalized(_l1Contract, _l2Contract, _from, _to, _tokenId, _data);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ contract L2NFTBridgeAltL1 is iL2NFTBridgeAltL1, CrossDomainEnabled, ERC721Holder
_to,
_tokenId
);
exits[_l2Contract][_tokenId] = address(0);

emit DepositFinalized(_l1Contract, _l2Contract, _from, _to, _tokenId, _data);
}
}
Expand Down