diff --git a/src/contracts/interface.cairo b/src/contracts/interface.cairo index a3af8be..effe5a2 100644 --- a/src/contracts/interface.cairo +++ b/src/contracts/interface.cairo @@ -15,7 +15,7 @@ trait IGiftFactory { fn cancel(ref self: TContractState, claim: ClaimData); fn get_dust(ref self: TContractState, claim: ClaimData, receiver: ContractAddress); - fn get_claim_class_hash(self: @TContractState) -> ClassHash; + fn get_latest_claim_class_hash(self: @TContractState) -> ClassHash; fn get_claim_address( self: @TContractState, class_hash: ClassHash, diff --git a/tests-integration/account.test.ts b/tests-integration/account.test.ts index d108b26..7499aa8 100644 --- a/tests-integration/account.test.ts +++ b/tests-integration/account.test.ts @@ -164,7 +164,7 @@ describe("Gifting", function () { // wrong selector factory.connect(claimAccount); - await expectRevertWithErrorMessage("gift-acc/invalid-call-selector", () => factory.get_claim_class_hash()); + await expectRevertWithErrorMessage("gift-acc/invalid-call-selector", () => factory.get_latest_claim_class_hash()); // multicall await expectRevertWithErrorMessage("gift-acc/invalid-call-len", () => diff --git a/tests/setup.cairo b/tests/setup.cairo index 66f253c..a60cfc3 100644 --- a/tests/setup.cairo +++ b/tests/setup.cairo @@ -34,7 +34,7 @@ fn deploy_gifting_broken_erc20() -> GiftingSetup { ]; let (factory_contract_address, _) = factory_contract.deploy(@factory_calldata).expect('Failed to deploy factory'); let gift_factory = IGiftFactoryDispatcher { contract_address: factory_contract_address }; - assert(gift_factory.get_claim_class_hash() == claim_contract.class_hash, 'Incorrect factory setup'); + assert(gift_factory.get_latest_claim_class_hash() == claim_contract.class_hash, 'Incorrect factory setup'); GiftingSetup { mock_eth: broken_erc20, mock_strk: broken_erc20, gift_factory, claim_class_hash: claim_contract.class_hash @@ -83,7 +83,7 @@ fn deploy_gifting_normal() -> GiftingSetup { ]; let (factory_contract_address, _) = factory_contract.deploy(@factory_calldata).expect('Failed to deploy factory'); let gift_factory = IGiftFactoryDispatcher { contract_address: factory_contract_address }; - assert(gift_factory.get_claim_class_hash() == claim_contract.class_hash, 'Incorrect factory setup'); + assert(gift_factory.get_latest_claim_class_hash() == claim_contract.class_hash, 'Incorrect factory setup'); start_cheat_caller_address(mock_eth_address, OWNER()); start_cheat_caller_address(mock_strk.contract_address, OWNER()); diff --git a/tests/test_gift_factory.cairo b/tests/test_gift_factory.cairo index 8ad8836..f59270a 100644 --- a/tests/test_gift_factory.cairo +++ b/tests/test_gift_factory.cairo @@ -75,12 +75,17 @@ fn test_claim_account_deployed() { // un-deployed claim account should return 0 let fetched_claim_class_hash = get_class_hash(calculated_claim_address); assert(claim_class_hash == fetched_claim_class_hash, 'Claim account not deployed'); - assert(claim_class_hash == gift_factory.get_claim_class_hash(), 'Incorrect claim class hash'); + assert(claim_class_hash == gift_factory.get_latest_claim_class_hash(), 'Incorrect claim class hash'); // Check that factory calculates claim address correctly let get_claim_address = gift_factory .get_claim_address( - claim_data.sender, claim_data.amount, claim_data.max_fee, claim_data.token, claim_data.claim_pubkey + claim_data.class_hash, + claim_data.sender, + claim_data.amount, + claim_data.max_fee, + claim_data.token, + claim_data.claim_pubkey ); assert!(calculated_claim_address == get_claim_address, "Claim address not calculated correctly"); }