diff --git a/integration-tests/test/alt-l2/nft_bridge.spec.ts b/integration-tests/test/alt-l2/nft_bridge.spec.ts index 065abbb482..300a683d1c 100644 --- a/integration-tests/test/alt-l2/nft_bridge.spec.ts +++ b/integration-tests/test/alt-l2/nft_bridge.spec.ts @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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 () => { diff --git a/integration-tests/test/eth-l2/nft_bridge.spec.ts b/integration-tests/test/eth-l2/nft_bridge.spec.ts index 4847675d50..aa37d8d363 100644 --- a/integration-tests/test/eth-l2/nft_bridge.spec.ts +++ b/integration-tests/test/eth-l2/nft_bridge.spec.ts @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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 () => { diff --git a/packages/boba/contracts/contracts/ERC721Bridges/L1NFTBridge.sol b/packages/boba/contracts/contracts/ERC721Bridges/L1NFTBridge.sol index 906d3c1366..a8b053dd4b 100644 --- a/packages/boba/contracts/contracts/ERC721Bridges/L1NFTBridge.sol +++ b/packages/boba/contracts/contracts/ERC721Bridges/L1NFTBridge.sol @@ -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 diff --git a/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridge.sol b/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridge.sol index bf8208ef42..0eb6b696f6 100644 --- a/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridge.sol +++ b/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridge.sol @@ -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); } } diff --git a/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridgeAltL1.sol b/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridgeAltL1.sol index 168e7fca1b..858586131e 100644 --- a/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridgeAltL1.sol +++ b/packages/boba/contracts/contracts/ERC721Bridges/L2NFTBridgeAltL1.sol @@ -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); } }