Skip to content

Commit

Permalink
commit at expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Jun 27, 2023
1 parent e7884e5 commit cea10b0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions test/upgrade/2.2.1-2.3.0.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const hre = require("hardhat");
const ethers = hre.ethers;
const { getSnapshot, revertToSnapshot } = require("../util/utils");
const { assert, expect } = require("chai");

const { RevertReasons } = require("../../scripts/config/revert-reasons.js");
const SellerUpdateFields = require("../../scripts/domain/SellerUpdateFields");
const DisputeResolverUpdateFields = require("../../scripts/domain/DisputeResolverUpdateFields");
Expand All @@ -12,7 +13,6 @@ const Bundle = require("../../scripts/domain/Bundle");
const ExchangeState = require("../../scripts/domain/ExchangeState");

const { getStateModifyingFunctionsHashes } = require("../../scripts/util/diamond-utils.js");
const { assert, expect } = require("chai");
const {
mockSeller,
mockAuthToken,
Expand All @@ -21,6 +21,7 @@ const {
mockOffer,
mockTwin,
} = require("../util/mock");
const { getSnapshot, revertToSnapshot, setNextBlockTimestamp } = require("../util/utils");

const { deploySuite, populateProtocolContract, getProtocolContractState, revertState } = require("../util/upgrade");
const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens");
Expand Down Expand Up @@ -542,7 +543,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
id: sellerId,
offerIds: [offerId],
} = sellers[0];
const { price } = offers[offerId - 1];
const {
offer: { price },
} = offers[offerId - 1];

const [foreign20gt, foreign20gt_2] = await deployMockTokens(["Foreign20GasTheft", "Foreign20GasTheft"]);

Expand Down Expand Up @@ -591,6 +594,18 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
// It should match ExchangeState.Revoked
assert.equal(response, ExchangeState.Revoked, "Exchange state is incorrect");
});

it("commit exactly at offer expiration timestamp", async function () {
const { offers } = preUpgradeEntities;
const { offer, offerDates } = offers[0];

await setNextBlockTimestamp(Number(offerDates.validUntil) + 1);

// Commit to offer, retrieving the event
await expect(
exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price })
).to.emit(exchangeHandler, "BuyerCommitted");
});
});

context("MetaTransactionHandler", async function () {
Expand Down

0 comments on commit cea10b0

Please sign in to comment.