Skip to content

Commit

Permalink
chore(Aztec.nr): remove implicit imports (#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 authored Aug 31, 2023
1 parent 8d5f548 commit c7d5190
Show file tree
Hide file tree
Showing 22 changed files with 13 additions and 137 deletions.
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/abis/ecdsa_account_contract.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/abis/schnorr_account_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ mod storage;

// A contract used along with `Parent` contract to test nested calls.
contract Child {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::PublicContextInputs;
use dep::aztec::context::{
PrivateContext,
PublicContext
};
use crate::storage::Storage;
use dep::aztec::oracle::logs::emit_unencrypted_log;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ contract EcdsaAccount {
use dep::std;
use dep::aztec::entrypoint;
use dep::aztec::entrypoint::EntrypointPayload;
use dep::aztec::abi;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::CallContext;
use dep::aztec::abi::Hasher;
use dep::aztec::context::PrivateContext;
use dep::aztec::log::emit_encrypted_log;
use dep::aztec::oracle::get_public_key::get_public_key;
use dep::aztec::types::vec::BoundedVec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ mod private_token_contract_interface;
// Sample escrow contract that stores a balance of a private token on behalf of an owner.
contract Escrow {
use dep::std;
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::CallContext;
use dep::aztec::private_call_stack_item::PrivateCallStackItem;
use dep::aztec::context::PrivateContext;
use dep::aztec::log::emit_encrypted_log;
use dep::aztec::oracle::get_public_key::get_public_key;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ mod test_contract_interface;
// Contract that uses the autogenerated interface of the Test contract for calling its functions.
// Used for testing calling into other contracts via autogenerated interfaces.
contract ImportTest {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::{ PrivateContextInputs, PublicContextInputs };
use dep::aztec::context::{ PrivateContext, PublicContext };

use crate::test_contract_interface::{
TestPrivateContextInterface,
TestPublicContextInterface,
Expand Down Expand Up @@ -79,15 +74,13 @@ contract ImportTest {
// Calls the createNullifierPublic on the Test contract at the target address
// Used for testing calling an open function from another open function
// See yarn-project/end-to-end/src/e2e_nested_contract.test.ts
#[aztec(public)]
open fn pubCallOpenFn(
inputs: PublicContextInputs,
target: Field,
) -> pub abi::PublicCircuitPublicInputs {
let mut context = PublicContext::new(inputs, abi::hash_args([target]));
) {
let test_contract_instance = TestPublicContextInterface::at(target);
let ret = test_contract_instance.createNullifierPublic(context, 1, 2);
context.return_values.push(ret[0]);
context.finish()
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ mod interfaces;
// - A way to repay all debt at once
// - Liquidations
contract Lending {
use dep::aztec::{
abi,
abi::{
PrivateContextInputs,
PublicContextInputs,
Hasher
}
};
use dep::aztec::context::{
PrivateContext,
PublicContext
};
use dep::aztec::public_call_stack_item::PublicCallStackItem;
use crate::storage::{Storage, Asset};
use dep::safe_math::SafeU120;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// Demonstrates how to perform 4 x 4 = 16 transfers in one transaction. Uses the private airdrop contract in the backend.
contract MultiTransfer {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::PublicContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::oracle::public_call;
use dep::aztec::private_call_stack_item::PrivateCallStackItem;
use dep::aztec::public_call_stack_item::PublicCallStackItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ contract NativeToken {

use crate::storage::Storage;

use dep::aztec::context::{
PrivateContext,
PublicContext,
};
use dep::aztec::types::point::Point;
use dep::aztec::{
abi,
abi::{
Hasher,
PublicContextInputs,
PrivateContextInputs,
},
note::{
note_header::NoteHeader,
utils as note_utils,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,8 @@ contract NonNativeToken {
use crate::storage::Storage;
use crate::hash::{get_mint_content_hash, get_withdraw_content_hash};

use dep::aztec::context::{
PrivateContext,
PublicContext,
};
use dep::aztec::types::point::Point;
use dep::aztec::{
abi,
abi::{
PublicContextInputs,
PrivateContextInputs,
Hasher
},
note::{
note_header::NoteHeader,
utils as note_utils,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// A contract used along with `Child` contract to test nested calls.
contract Parent {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::PublicContextInputs;
use dep::aztec::context::{
PrivateContext,
PublicContext,
};

#[aztec(private)]
fn constructor() {}
Expand All @@ -32,7 +24,7 @@ contract Parent {
targetContract: Field,
targetSelector: Field,
initValue: Field
) -> pub abi::PublicCircuitPublicInputs {
) {
let return_values = context.call_public_function(targetContract, targetSelector, [initValue]);

context.return_values.push(return_values[0]);
Expand All @@ -44,7 +36,7 @@ contract Parent {
targetContract: Field,
targetSelector: Field,
initValue: Field
) -> pub abi::PublicCircuitPublicInputs {
) {
let returnValue = context.call_public_function(targetContract, targetSelector, [initValue])[0];
let return_values = context.call_public_function(targetContract, targetSelector, [returnValue]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ contract PendingCommitments {
use crate::storage::Storage;

use dep::aztec::constants_gen::ARGS_LENGTH;
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::note::{
note_getter::NoteGetterOptions,
note_header::NoteHeader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ contract PokeableToken {
utils::increment,
value_note::{VALUE_NOTE_LEN, ValueNoteMethods, ValueNote},
};
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::note::{
note_getter::NoteGetterOptions,
note_header::{NoteHeader},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
mod storage;

contract PriceFeed {
use dep::aztec::{
abi,
abi::{
PrivateContextInputs,
PublicContextInputs,
Hasher
}
};
use dep::aztec::context::{
PrivateContext,
PublicContext
};
use crate::storage::{Storage, Asset};

#[aztec(private)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ contract PrivateTokenAirdrop {
value_note::{VALUE_NOTE_LEN, ValueNoteMethods},
};

use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::note::{
note_getter_options::NoteGetterOptions,
note_header::NoteHeader,
Expand All @@ -25,7 +21,6 @@ contract PrivateTokenAirdrop {
use crate::claim_note::{ClaimNote, ClaimNoteMethods};
use crate::interface::PrivateTokenAirdropPrivateContextInterface;


// Constructs the contract and sets `initial_supply` which is fully owned by `owner`.
#[aztec(private)]
fn constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ contract PrivateToken {
value_note::{VALUE_NOTE_LEN, ValueNoteMethods},
};

use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::note::{
note_header::NoteHeader,
utils as note_utils,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
mod storage;

contract PublicToken {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::PublicContextInputs;
use dep::aztec::context::{
PrivateContext,
PublicContext,
};

// docs:start:unencrypted_import
use dep::aztec::oracle::logs::emit_unencrypted_log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ contract SchnorrAccount {
use dep::std;
use dep::aztec::entrypoint;
use dep::aztec::entrypoint::EntrypointPayload;
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::CallContext;
use dep::aztec::private_call_stack_item::PrivateCallStackItem;
use dep::aztec::public_call_stack_item::PublicCallStackItem;
use dep::aztec::context::PrivateContext;
use dep::aztec::log::emit_encrypted_log;
use dep::aztec::oracle::get_public_key::get_public_key;
use dep::aztec::types::vec::BoundedVec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ contract SchnorrSingleKeyAccount {
use dep::std;
use dep::aztec::entrypoint;
use dep::aztec::entrypoint::EntrypointPayload;
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::CallContext;
use dep::aztec::private_call_stack_item::PrivateCallStackItem;
use dep::aztec::public_call_stack_item::PublicCallStackItem;
use dep::aztec::context::PrivateContext;
use dep::aztec::types::vec::BoundedVec;
use dep::aztec::types::point::Point;
use dep::aztec::constants_gen::GENERATOR_INDEX__CONTRACT_ADDRESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ contract Test {
use dep::aztec::{
abi,
types::vec::BoundedVec,
abi::{
PublicContextInputs,
PrivateContextInputs,
Hasher
}
};
use dep::aztec::context::{
PrivateContext,
PublicContext
abi::PrivateContextInputs,
};
use dep::aztec::context::PrivateContext;

use dep::aztec::oracle::{
get_public_key::get_public_key,
Expand Down Expand Up @@ -56,6 +49,7 @@ contract Test {

// Test codegen for noir interfaces
// See yarn-project/acir-simulator/src/client/private_execution.test.ts 'nested calls through autogenerated interface'
// Note; this function is deliberately NOT annotated with #[aztec(private)] due to its use in tests
fn testCodeGen(
inputs: PrivateContextInputs,
aField: Field,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// Demonstrates how to send a message to a portal contract on L1. We use Uniswap here as it's the most typical example.
contract Uniswap {
use dep::aztec::abi;
use dep::aztec::abi::Hasher;
use dep::aztec::abi::PrivateContextInputs;
use dep::aztec::abi::PublicContextInputs;
use dep::aztec::context::PrivateContext;
use dep::aztec::oracle::{
public_call,
context::get_portal_address
Expand Down

0 comments on commit c7d5190

Please sign in to comment.