Skip to content

Commit

Permalink
failing entrypoint not found
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Jun 25, 2024
1 parent 7c128fa commit 688a23e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function executeActionOnAccount(functionName: string, accountAddress: string, ar
return {
contractAddress: accountAddress,
entrypoint: "execute_action",
calldata: CallData.compile([[hash.getSelectorFromName(functionName), ...args]]),
calldata: { selector: hash.getSelectorFromName(functionName), calldata: args },
};
}

Expand Down
6 changes: 2 additions & 4 deletions src/contracts/claim_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ mod ClaimAccount {

#[abi(embed_v0)]
impl GiftAccountImpl of IGiftAccount<ContractState> {
fn execute_action(ref self: ContractState, calldata: Array<felt252>) -> Span<felt252> {
fn execute_action(ref self: ContractState, selector: felt252, calldata: Array<felt252>) -> Span<felt252> {
let mut calldata_span = calldata.span();
let selector = *calldata_span.pop_front().expect('gift-acc/missing-selector');
let claim: ClaimData = Serde::deserialize(ref calldata_span).expect('gift-acc/invalid-claim');
let implementation_class_hash = get_validated_impl(claim);

IClaimAccountImplLibraryDispatcher { class_hash: implementation_class_hash }
.execute_action(implementation_class_hash, selector, claim, calldata_span)
.execute_action(implementation_class_hash, selector, calldata.span())
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/contracts/claim_account_impl.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub trait IClaimAccountImpl<TContractState> {
fn claim_internal(ref self: TContractState, claim: ClaimData, receiver: ContractAddress) -> Array<Span<felt252>>;

fn execute_action(
ref self: TContractState, this_class_hash: ClassHash, selector: felt252, claim: ClaimData, args: Span<felt252>
ref self: TContractState, this_class_hash: ClassHash, selector: felt252, args: Span<felt252>
) -> Span<felt252>;

fn is_valid_account_signature(
Expand Down Expand Up @@ -92,11 +92,7 @@ mod ClaimAccountImpl {
}

fn execute_action(
ref self: ContractState,
this_class_hash: ClassHash,
selector: felt252,
claim: ClaimData,
args: Span<felt252>
ref self: ContractState, this_class_hash: ClassHash, selector: felt252, args: Span<felt252>
) -> Span<felt252> {
let is_whitelisted = selector == selector!("claim_external")
|| selector == selector!("get_dust")
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait IGiftFactory<TContractState> {
#[starknet::interface]
pub trait IGiftAccount<TContractState> {
/// @notice delegates an action to the account implementation
fn execute_action(ref self: TContractState, calldata: Array<felt252>) -> Span<felt252>;
fn execute_action(ref self: TContractState, selector: felt252, calldata: Array<felt252>) -> Span<felt252>;
}

/// @notice As defined in SNIP-9 https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-9.md
Expand Down

0 comments on commit 688a23e

Please sign in to comment.