Skip to content

Commit

Permalink
feat: update account contracts to pay fees on init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Apr 4, 2024
1 parent e405423 commit 1bbdc57
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ contract EcdsaAccount {
let this = context.this_address();
let mut pub_key_note = EcdsaPublicKeyNote::new(signing_pub_key_x, signing_pub_key_y, this);
storage.public_key.initialize(&mut pub_key_note, true);

let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.initialize_account_contract();
}

// Note: If you globally change the entrypoint signature don't forget to update default_entrypoint.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ contract SchnorrHardcodedAccount {

global ACCOUNT_ACTIONS_STORAGE_SLOT = 1;

#[aztec(private)]
#[aztec(initializer)]
fn constructor() {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.initialize_account_contract();
}

// Note: If you globally change the entrypoint signature don't forget to update default_entrypoint.ts
#[aztec(private)]
fn entrypoint(app_payload: pub AppPayload, fee_payload: pub FeePayload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ contract SchnorrSingleKeyAccount {

global ACCOUNT_ACTIONS_STORAGE_SLOT = 1;

#[aztec(private)]
#[aztec(initializer)]
fn constructor() {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.initialize_account_contract();
}

// Note: If you globally change the entrypoint signature don't forget to update default_entrypoint.ts
#[aztec(private)]
fn entrypoint(app_payload: pub AppPayload, fee_payload: pub FeePayload) {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/accounts/src/single_key/account_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class SingleKeyAccountContract extends DefaultAccountContract {
super(SchnorrSingleKeyAccountContractArtifact as ContractArtifact);
}

getDeploymentArgs(): undefined {
return undefined;
getDeploymentArgs(): Array<void> {
return [];
}

getAuthWitnessProvider({ partialAddress }: CompleteAddress): AuthWitnessProvider {
Expand Down

0 comments on commit 1bbdc57

Please sign in to comment.