Skip to content

Commit

Permalink
remove PrivateTrait on the account
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Jun 6, 2024
1 parent c037542 commit 7fe1138
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/contracts/claim_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod ClaimAccount {
let (claim, _): (ClaimData, ContractAddress) = full_deserialize(*calldata)
.expect('gift-acc/invalid-calldata');
assert(*to == claim.factory, 'gift-acc/invalid-call-to');
self.assert_valid_claim(claim);
assert_valid_claim(claim);

let tx_info = execution_info.tx_info.unbox();
// Isn't it an issue if for some reason it fails during execution?
Expand Down Expand Up @@ -83,18 +83,15 @@ mod ClaimAccount {
fn execute_factory_calls(
ref self: ContractState, claim: ClaimData, mut calls: Array<Call>
) -> Array<Span<felt252>> {
self.assert_valid_claim(claim);
assert_valid_claim(claim);
assert(get_caller_address() == claim.factory, 'gift/only-factory');
execute_multicall(calls.span())
}
}

#[generate_trait]
impl Private of PrivateTrait {
fn assert_valid_claim(self: @ContractState, claim: ClaimData) {
let calculated_address = calculate_claim_account_address(claim);
assert(calculated_address == get_contract_address(), 'gift-acc/invalid-claim-address');
}
fn assert_valid_claim(claim: ClaimData) {
let calculated_address = calculate_claim_account_address(claim);
assert(calculated_address == get_contract_address(), 'gift-acc/invalid-claim-address');
}

fn compute_max_fee_v3(mut resource_bounds: Span<ResourceBounds>, tip: u128) -> u128 {
Expand Down

0 comments on commit 7fe1138

Please sign in to comment.