File tree 2 files changed +13
-2
lines changed
crates/bolt-helpers/attribute/world-apply/src
examples/system-apply-velocity/src
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ pub fn apply_system(attr: TokenStream, item: TokenStream) -> TokenStream {
43
43
if !ctx. accounts. authority. is_signer && ctx. accounts. authority. key != & ID {
44
44
return Err ( WorldError :: InvalidAuthority . into( ) ) ;
45
45
}
46
+ if !ctx. accounts. world. permissionless
47
+ && !ctx
48
+ . accounts
49
+ . world
50
+ . systems( )
51
+ . approved_systems
52
+ . contains( & ctx. accounts. bolt_system. key( ) )
53
+ {
54
+ return Err ( WorldError :: SystemNotApproved . into( ) ) ;
55
+ }
46
56
let remaining_accounts: Vec <AccountInfo <' info>> = ctx. remaining_accounts. to_vec( ) ;
47
57
let res = bolt_system:: cpi:: #execute_func_name(
48
58
ctx. accounts
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ pub mod system_apply_velocity {
19
19
ctx. accounts . position . x += 10 * ( ctx. accounts . velocity . x + 2 ) + 3 ;
20
20
msg ! ( "last applied: {}" , ctx. accounts. velocity. last_applied) ;
21
21
msg ! ( "Position: {}" , ctx. accounts. position. x) ;
22
- msg ! ( "Remaining accounts: {}" , ctx. remaining_accounts. len( ) ) ;
22
+ msg ! ( "Remaining accounts len: {}" , ctx. remaining_accounts. len( ) ) ;
23
+ msg ! ( "Remaining accounts: {:?}" , ctx. remaining_accounts) ;
23
24
msg ! ( "Authority: {}" , ctx. accounts. authority. key) ;
24
25
Ok ( ctx. accounts )
25
26
}
@@ -34,7 +35,7 @@ pub mod system_apply_velocity {
34
35
pub struct ExtraAccounts {
35
36
#[ account( address = bolt_lang:: solana_program:: sysvar:: clock:: id( ) ) ]
36
37
pub sysvar_clock : AccountInfo ,
37
- #[ account( address = pubkey!( "6LHhFVwif6N9Po3jHtSmMVtPjF6zRfL3xMosSzcrQAS8 " ) ) ]
38
+ #[ account( address = pubkey!( "tEsT3eV6RFCWs1BZ7AXTzasHqTtMnMLCB2tjQ42TDXD " ) ) ]
38
39
pub some_extra_account : AccountInfo ,
39
40
#[ account( address = Metadata :: id( ) ) ]
40
41
pub program_metadata : Program < Metadata > ,
You can’t perform that action at this time.
0 commit comments