1
1
use super :: helpers:: check_account_length;
2
+ use crate :: fallback:: burn_and_post:: PostMessageDerivedAccounts ;
2
3
use crate :: state:: {
3
4
Auction , AuctionConfig , AuctionStatus , Custodian , FastMarketOrder as FastMarketOrderState ,
4
5
MessageProtocol , RouterEndpoint ,
5
6
} ;
6
- use crate :: utils;
7
7
use crate :: utils:: auction:: DepositPenalty ;
8
+ use crate :: { utils, ID } ;
8
9
use anchor_lang:: prelude:: * ;
9
10
use anchor_spl:: token:: { spl_token, TokenAccount } ;
10
11
use common:: messages:: Fill ;
@@ -35,7 +36,7 @@ pub struct ExecuteOrderShimAccounts<'ix> {
35
36
pub active_auction_config : & ' ix Pubkey , // 6
36
37
/// The token account of the auction's best offer
37
38
pub active_auction_best_offer_token : & ' ix Pubkey , // 7
38
- /// ???
39
+ /// The token account of the executor
39
40
pub executor_token : & ' ix Pubkey , // 8
40
41
/// The token account of the auction's initial offer
41
42
pub initial_offer_token : & ' ix Pubkey , // 9
@@ -45,10 +46,10 @@ pub struct ExecuteOrderShimAccounts<'ix> {
45
46
pub to_router_endpoint : & ' ix Pubkey , // 11
46
47
/// The program id of the post message shim program
47
48
pub post_message_shim_program : & ' ix Pubkey , // 12
48
- /// The sequence account of the post message shim program (can be derived)
49
- pub post_message_sequence : & ' ix Pubkey , // 13
49
+ /// The emitter sequence of the core bridge program (can be derived)
50
+ pub core_bridge_emitter_sequence : & ' ix Pubkey , // 13
50
51
/// The message account of the post message shim program (can be derived)
51
- pub post_message_message : & ' ix Pubkey , // 14
52
+ pub post_shim_message : & ' ix Pubkey , // 14
52
53
/// The mint account of the CCTP token to be burned
53
54
pub cctp_deposit_for_burn_mint : & ' ix Pubkey , // 15
54
55
/// The token messenger minter sender authority account of the CCTP token to be burned
@@ -101,8 +102,8 @@ impl<'ix> ExecuteOrderShimAccounts<'ix> {
101
102
AccountMeta :: new( * self . initial_participant, false ) ,
102
103
AccountMeta :: new_readonly( * self . to_router_endpoint, false ) ,
103
104
AccountMeta :: new_readonly( * self . post_message_shim_program, false ) ,
104
- AccountMeta :: new( * self . post_message_sequence , false ) ,
105
- AccountMeta :: new( * self . post_message_message , false ) ,
105
+ AccountMeta :: new( * self . core_bridge_emitter_sequence , false ) ,
106
+ AccountMeta :: new( * self . post_shim_message , false ) ,
106
107
AccountMeta :: new( * self . cctp_deposit_for_burn_mint, false ) ,
107
108
AccountMeta :: new_readonly(
108
109
* self . cctp_deposit_for_burn_token_messenger_minter_sender_authority,
@@ -158,7 +159,7 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
158
159
// This saves stack space whereas having that in the body does not
159
160
check_account_length ( accounts, 31 ) ?;
160
161
161
- let program_id = & crate :: ID ;
162
+ let program_id = & ID ;
162
163
163
164
// Get the accounts
164
165
let signer_account = & accounts[ 0 ] ;
@@ -174,8 +175,8 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
174
175
let initial_participant_account = & accounts[ 10 ] ;
175
176
let to_router_endpoint_account = & accounts[ 11 ] ;
176
177
let _post_message_shim_program_account = & accounts[ 12 ] ;
177
- let _post_message_sequence_account = & accounts[ 13 ] ;
178
- let _post_message_message_account = & accounts[ 14 ] ;
178
+ let core_bridge_emitter_sequence_account = & accounts[ 13 ] ;
179
+ let post_shim_message_account = & accounts[ 14 ] ;
179
180
let cctp_deposit_for_burn_mint_account = & accounts[ 15 ] ;
180
181
let cctp_deposit_for_burn_token_messenger_minter_sender_authority_account = & accounts[ 16 ] ;
181
182
let cctp_deposit_for_burn_message_transmitter_config_account = & accounts[ 17 ] ;
@@ -441,12 +442,7 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
441
442
// the fast fill will most likely require an additional transaction, so this buffer allows
442
443
// the best offer participant to perform his duty without the risk of getting slashed by
443
444
// another executor.
444
- let additional_grace_period = match active_auction. target_protocol {
445
- MessageProtocol :: Local { .. } => {
446
- crate :: EXECUTE_FAST_ORDER_LOCAL_ADDITIONAL_GRACE_PERIOD . into ( )
447
- }
448
- _ => None ,
449
- } ;
445
+ let additional_grace_period = Some ( crate :: EXECUTE_FAST_ORDER_LOCAL_ADDITIONAL_GRACE_PERIOD ) ;
450
446
451
447
let DepositPenalty {
452
448
penalty,
@@ -634,9 +630,14 @@ pub fn handle_execute_order_shim(accounts: &[AccountInfo]) -> Result<()> {
634
630
. unwrap ( ) ,
635
631
} ;
636
632
637
- let post_message_accounts =
638
- PostMessageAccounts :: new ( custodian_account. key ( ) , signer_account. key ( ) ) ;
639
- // Lets print the auction account balance
633
+ let post_message_accounts = PostMessageAccounts {
634
+ emitter : custodian_account. key ( ) ,
635
+ payer : signer_account. key ( ) ,
636
+ derived : PostMessageDerivedAccounts {
637
+ message : post_shim_message_account. key ( ) ,
638
+ sequence : core_bridge_emitter_sequence_account. key ( ) ,
639
+ } ,
640
+ } ;
640
641
641
642
burn_and_post (
642
643
CpiContext :: new_with_signer (
0 commit comments