@@ -11,9 +11,15 @@ trait IAccount<T> {
11
11
fn is_valid_signature (self : @ T , hash : felt252 , signature : Array <felt252 >) -> felt252 ;
12
12
fn supports_interface (self : @ T , interface_id : felt252 ) -> bool ;
13
13
fn public_key (self : @ T ) -> felt252 ;
14
+ fn __validate__ (ref self : T , calls : Array <Call >) -> felt252 ;
15
+ fn __execute__ (ref self : T , calls : Array <Call >) -> Array <Span <felt252 >>;
16
+ fn __validate_declare__ (self : @ T , class_hash : felt252 ) -> felt252 ;
17
+ fn __validate_deploy__ (
18
+ self : @ T , class_hash : felt252 , salt : felt252 , public_key : felt252 ,
19
+ ) -> felt252 ;
14
20
}
15
21
16
- #[starknet:: contract]
22
+ #[starknet:: contract(account) ]
17
23
mod Account {
18
24
use super :: {Call , IAccount , SUPPORTED_TX_VERSION };
19
25
use starknet :: {get_caller_address, call_contract_syscall, get_tx_info, VALIDATED };
@@ -36,7 +42,7 @@ mod Account {
36
42
self . public_key. write (public_key );
37
43
}
38
44
39
- #[external(v0 )]
45
+ #[abi(embed_v0 )]
40
46
impl AccountImpl of IAccount <ContractState > {
41
47
fn is_valid_signature (self : @ ContractState , hash : felt252 , signature : Array <felt252 >) -> felt252 {
42
48
let is_valid = self . is_valid_signature_bool (hash , signature . span ());
@@ -50,11 +56,7 @@ mod Account {
50
56
fn public_key (self : @ ContractState ) -> felt252 {
51
57
self . public_key. read ()
52
58
}
53
- }
54
59
55
- #[external(v0)]
56
- #[generate_trait]
57
- impl ProtocolImpl of ProtocolTrait {
58
60
fn __execute__ (ref self : ContractState , calls : Array <Call >) -> Array <Span <felt252 >> {
59
61
let arr = ArrayTrait :: new ();
60
62
panic_with_felt252 (' panic' );
@@ -64,7 +66,7 @@ mod Account {
64
66
// self.execute_multiple_calls(calls)
65
67
}
66
68
67
- fn __validate__ (self : @ ContractState , calls : Array <Call >) -> felt252 {
69
+ fn __validate__ (ref self : ContractState , calls : Array <Call >) -> felt252 {
68
70
panic_with_felt252 (' panic' );
69
71
0
70
72
// self.only_protocol();
@@ -116,7 +118,7 @@ mod Account {
116
118
117
119
fn execute_single_call (self : @ ContractState , call : Call ) -> Span <felt252 > {
118
120
let Call {to , selector , calldata } = call ;
119
- call_contract_syscall (to , selector , calldata . span () ). unwrap ()
121
+ call_contract_syscall (to , selector , calldata ). unwrap ()
120
122
}
121
123
122
124
fn execute_multiple_calls (self : @ ContractState , mut calls : Array <Call >) -> Array <Span <felt252 >> {
0 commit comments