Skip to content

Commit

Permalink
adding factory test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Jun 28, 2024
1 parent ec2e32f commit bea8081
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/contracts/gift_factory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ mod GiftFactory {
gift_pubkey: felt252
) {
self.pausable.assert_not_paused();
// Not tested
assert(fee_token == STRK_ADDRESS() || fee_token == ETH_ADDRESS(), 'gift-fac/invalid-fee-token');
if gift_token == fee_token {
// This is needed so we can tell if a gift has been claimed or not just by looking at the balances
Expand All @@ -160,7 +159,6 @@ mod GiftFactory {
let constructor_arguments = AccountConstructorArguments {
sender, gift_token, gift_amount, fee_token, fee_amount, gift_pubkey
};
// Not tested
let (escrow_contract, _) = deploy_syscall(
escrow_class_hash, 0, // salt
serialize(@constructor_arguments).span(), false // deploy_from_zero
Expand Down
14 changes: 14 additions & 0 deletions tests-integration/deposit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ describe("Deposit", function () {
return txReceipt;
});
});

it(`Fee not ETH nor STRK`, async function () {
const { factory } = await setupGiftProtocol();
const mockERC20 = await deployMockERC20();

await expectRevertWithErrorMessage("gift-fac/invalid-fee-token", async () => {
const { txReceipt } = await defaultDepositTestSetup({
factory,
useTxV3,
overrides: { feeTokenAddress: mockERC20.address },
});
return txReceipt;
});
});
}

it("Deposit fails class hash passed != class hash in factory storage", async function () {
Expand Down

0 comments on commit bea8081

Please sign in to comment.