From ad10f479180f528b927f029b01667f59f7c2dbdf Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Thu, 22 Aug 2024 11:34:18 -0300 Subject: [PATCH] add test --- .../zevm-app-contracts/data/addresses.json | 2 +- .../zevm-app-contracts/test/xp-nft/xp-nft.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/zevm-app-contracts/data/addresses.json b/packages/zevm-app-contracts/data/addresses.json index 789e08a..fd47be7 100644 --- a/packages/zevm-app-contracts/data/addresses.json +++ b/packages/zevm-app-contracts/data/addresses.json @@ -7,7 +7,7 @@ "zetaSwapBtcInbound": "0x358E2cfC0E16444Ba7D3164Bbeeb6bEA7472c559", "invitationManager": "0x3649C03C472B698213926543456E9c21081e529d", "withdrawERC20": "0xa349B9367cc54b47CAb8D09A95836AE8b4D1d84E", - "ZetaXP": "0xE1DfA5dfd1d6c6b47C8c9b8726EdD019D365491D" + "ZetaXP": "0xfafd6Aaaa836E7744523Ea934D1da28187faE9F8" }, "zeta_mainnet": { "disperse": "0x23ce409Ea60c3d75827d04D9db3d52F3af62e44d", diff --git a/packages/zevm-app-contracts/test/xp-nft/xp-nft.ts b/packages/zevm-app-contracts/test/xp-nft/xp-nft.ts index 2109d98..49ce680 100644 --- a/packages/zevm-app-contracts/test/xp-nft/xp-nft.ts +++ b/packages/zevm-app-contracts/test/xp-nft/xp-nft.ts @@ -355,4 +355,22 @@ describe("XP NFT Contract test", () => { expect(ownerAddr).to.be.eq(user.address); } }); + + it("Should revert if signatured expired", async () => { + const currentBlock = await ethers.provider.getBlock("latest"); + const sigTimestamp = currentBlock.timestamp; + const signatureExpiration = sigTimestamp - 1000; + + const signature = await getSignature(signer, signatureExpiration, sigTimestamp, sampleNFT.to, sampleNFT); + + const nftParams: UpdateParam = { + ...sampleNFT, + sigTimestamp, + signature, + signatureExpiration, + } as UpdateParam; + + const tx = zetaXP.mintNFT(nftParams); + await expect(tx).to.be.revertedWith("SignatureExpired"); + }); });