Skip to content

Commit

Permalink
reverting some code'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Jun 25, 2024
1 parent 6a47463 commit 11ce476
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
1 change: 0 additions & 1 deletion lib/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export async function claimExternal(args: {
}

function executeActionOnAccount(functionName: string, accountAddress: string, args: Calldata): Call {
// TODO WE NEED THE CLASS HASH
return {
contractAddress: accountAddress,
entrypoint: "execute_action",
Expand Down
48 changes: 21 additions & 27 deletions src/contracts/claim_account_impl.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@ use starknet_gifting::contracts::interface::{ClaimData, OutsideExecution, Starkn

#[starknet::interface]
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, args: Span<felt252>
) -> Span<felt252>;

fn is_valid_account_signature(
self: @TContractState, claim: ClaimData, hash: felt252, remaining_signature: Span<felt252>
) -> felt252;

fn execute_from_outside_v2(
ref self: TContractState, claim: ClaimData, outside_execution: OutsideExecution, signature: Span<felt252>
) -> Array<Span<felt252>>;
}
fn claim_internal(ref self: TContractState, claim: ClaimData, receiver: ContractAddress) -> Array<Span<felt252>>;

#[starknet::interface]
pub trait IExecutableAction<TContractState> {
fn claim_external(
ref self: TContractState,
claim: ClaimData,
Expand All @@ -39,6 +28,14 @@ pub trait IExecutableAction<TContractState> {
/// @param claim The claim data
/// @param receiver The address of the receiver
fn get_dust(ref self: TContractState, claim: ClaimData, receiver: ContractAddress);

fn is_valid_account_signature(
self: @TContractState, claim: ClaimData, hash: felt252, remaining_signature: Span<felt252>
) -> felt252;

fn execute_from_outside_v2(
ref self: TContractState, claim: ClaimData, outside_execution: OutsideExecution, signature: Span<felt252>
) -> Array<Span<felt252>>;
}

#[starknet::contract]
Expand Down Expand Up @@ -101,21 +98,6 @@ mod ClaimAccountImpl {
library_call_syscall(this_class_hash, selector, args).unwrap()
}

fn is_valid_account_signature(
self: @ContractState, claim: ClaimData, hash: felt252, mut remaining_signature: Span<felt252>
) -> felt252 {
0 // Accounts don't support off-chain signatures yet
}

fn execute_from_outside_v2(
ref self: ContractState, claim: ClaimData, outside_execution: OutsideExecution, signature: Span<felt252>
) -> Array<Span<felt252>> {
panic_with_felt252('not-allowed-yet')
}
}

#[abi(embed_v0)]
impl ExecutableActionImpl of super::IExecutableAction<ContractState> {
fn claim_external(
ref self: ContractState,
claim: ClaimData,
Expand Down Expand Up @@ -163,6 +145,18 @@ mod ClaimAccountImpl {
transfer_from_account(claim.fee_token, claim.sender, fee_balance);
}
}

fn is_valid_account_signature(
self: @ContractState, claim: ClaimData, hash: felt252, mut remaining_signature: Span<felt252>
) -> felt252 {
0 // Accounts don't support off-chain signatures yet
}

fn execute_from_outside_v2(
ref self: ContractState, claim: ClaimData, outside_execution: OutsideExecution, signature: Span<felt252>
) -> Array<Span<felt252>> {
panic_with_felt252('not-allowed-yet')
}
}

#[generate_trait]
Expand Down

0 comments on commit 11ce476

Please sign in to comment.