File tree 2 files changed +18
-9
lines changed
yarn-project/noir-contracts/src/contracts/test_contract/src
2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -486,8 +486,8 @@ const SIGNATURE_PLACEHOLDER: &str = "SIGNATURE_PLACEHOLDER";
486
486
/// Inserts the following code:
487
487
/// ```noir
488
488
/// impl SomeStruct {
489
- /// fn selector() -> Field {
490
- /// aztec::oracle::compute_selector ::compute_selector("SIGNATURE_PLACEHOLDER")
489
+ /// fn selector() -> FunctionSelector {
490
+ /// aztec::selector ::compute_selector("SIGNATURE_PLACEHOLDER")
491
491
/// }
492
492
/// }
493
493
/// ```
@@ -503,13 +503,18 @@ fn generate_selector_impl(structure: &NoirStruct) -> TypeImpl {
503
503
vec![ expression( ExpressionKind :: Literal ( Literal :: Str ( SIGNATURE_PLACEHOLDER . to_string( ) ) ) ) ] ,
504
504
) ) ) ] ) ;
505
505
506
+ // Define `FunctionSelector` return type
507
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/3590): Make this point to aztec-nr once the issue is fixed.
508
+ let return_type_path = chained_path ! ( "protocol_types" , "abis" , "function_selector" , "FunctionSelector" ) ;
509
+ let return_type = FunctionReturnType :: Ty ( make_type ( UnresolvedTypeData :: Named ( return_type_path, vec ! [ ] ) ) ) ;
510
+
506
511
let mut selector_fn_def = FunctionDefinition :: normal (
507
512
& ident ( "selector" ) ,
508
513
& vec ! [ ] ,
509
514
& [ ] ,
510
515
& selector_fun_body,
511
516
& [ ] ,
512
- & FunctionReturnType :: Ty ( make_type ( UnresolvedTypeData :: FieldElement ) ) ,
517
+ & return_type ,
513
518
) ;
514
519
515
520
selector_fn_def. visibility = FunctionVisibility :: Public ;
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ contract Test {
6
6
AztecAddress ,
7
7
EthAddress ,
8
8
};
9
+ // The following import is here in order to make the event macro work because the macro doesn't add the import.
10
+ // It doesn't add the import because in the future we will re-export all the types via aztec-nr and aztec-nr is
11
+ // already auto-imported by the macros.
12
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/3590): Remove this once the issue is fixed.
13
+ use dep::protocol_types ;
9
14
// docs:start:unencrypted_import
10
15
use dep::aztec::log::emit_unencrypted_log ;
11
16
// docs:end:unencrypted_import
@@ -32,18 +37,17 @@ contract Test {
32
37
use dep::token_portal_content_hash_lib:: {get_mint_private_content_hash , get_mint_public_content_hash };
33
38
use dep::field_note::field_note:: {FieldNote , FieldNoteMethods , FIELD_NOTE_LEN };
34
39
35
- // TODO(benesjan) https://github.com/AztecProtocol/aztec-packages/issues/3655
36
- // #[event]
37
- // struct ExampleEvent {
38
- // value: Field,
39
- // }
40
+ #[event]
41
+ struct ExampleEvent {
42
+ value : Field ,
43
+ }
40
44
41
45
struct Storage {
42
46
example_constant : ImmutableSingleton <FieldNote , FIELD_NOTE_LEN >,
43
47
}
44
48
45
49
impl Storage {
46
- fn init (context : Context ) -> pub Self {
50
+ fn init (context : Context ) -> Self {
47
51
Storage {
48
52
example_constant : ImmutableSingleton ::new (context , 1 , FieldNoteMethods ),
49
53
}
You can’t perform that action at this time.
0 commit comments