solana: make burn_source optional; uptick version 0.0.1-alpha.6
This commit is contained in:
parent
aa4ea707a3
commit
087147c36a
|
@ -2377,7 +2377,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wormhole-cctp-solana"
|
||||
version = "0.0.1-alpha.3"
|
||||
version = "0.0.1-alpha.6"
|
||||
dependencies = [
|
||||
"anchor-lang",
|
||||
"anchor-spl",
|
||||
|
@ -2393,7 +2393,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wormhole-circle-integration-solana"
|
||||
version = "0.0.1-alpha.3"
|
||||
version = "0.0.1-alpha.6"
|
||||
dependencies = [
|
||||
"anchor-lang",
|
||||
"anchor-spl",
|
||||
|
|
|
@ -7,7 +7,7 @@ resolver = "2"
|
|||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
version = "0.0.1-alpha.3"
|
||||
version = "0.0.1-alpha.6"
|
||||
authors = ["Wormhole Contributors"]
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://wormhole.com"
|
||||
|
|
|
@ -7,7 +7,7 @@ pub struct BurnAndPublishArgs {
|
|||
/// Token account where assets originated from. This pubkey is encoded in the [Deposit] message.
|
||||
/// If this will be useful to an integrator, he should encode where the assets have been burned
|
||||
/// from if it was not burned directly when calling [burn_and_publish].
|
||||
pub burn_source: Pubkey,
|
||||
pub burn_source: Option<Pubkey>,
|
||||
|
||||
/// Destination caller address, which is encoded in the CCTP message. Only this address can
|
||||
/// receive a CCTP message via the CCTP Message Transmitter.
|
||||
|
@ -73,6 +73,9 @@ pub fn burn_and_publish<'info>(
|
|||
};
|
||||
|
||||
let token_address = cctp_ctx.accounts.mint.key.to_bytes();
|
||||
let burn_source = burn_source
|
||||
.unwrap_or(cctp_ctx.accounts.src_token.key())
|
||||
.to_bytes();
|
||||
|
||||
// We want to make this call as early as possible because the deposit for burn
|
||||
// message is an Anchor event (i.e. written to the program log). We hope that integrators will
|
||||
|
@ -99,7 +102,7 @@ pub fn burn_and_publish<'info>(
|
|||
source_cctp_domain,
|
||||
destination_cctp_domain,
|
||||
cctp_nonce,
|
||||
burn_source: burn_source.to_bytes(),
|
||||
burn_source,
|
||||
mint_recipient,
|
||||
payload,
|
||||
}),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::wormhole::core_bridge_program::Commitment;
|
||||
use anchor_lang::{prelude::*, system_program};
|
||||
use wormhole_core_bridge_solana::state::Config;
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct PostMessage<'info> {
|
||||
|
@ -50,7 +51,7 @@ pub fn post_message<'info>(
|
|||
// Pay Wormhole message fee.
|
||||
{
|
||||
let mut data: &[_] = &ctx.accounts.config.try_borrow_data()?;
|
||||
let config = wormhole_core_bridge_solana::state::Config::deserialize(&mut data)?;
|
||||
let Config { fee_lamports, .. } = Config::deserialize(&mut data)?;
|
||||
|
||||
system_program::transfer(
|
||||
CpiContext::new(
|
||||
|
@ -60,7 +61,7 @@ pub fn post_message<'info>(
|
|||
to: ctx.accounts.fee_collector.to_account_info(),
|
||||
},
|
||||
),
|
||||
config.fee_lamports,
|
||||
fee_lamports,
|
||||
)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ pub fn transfer_tokens_with_payload(
|
|||
&[custodian_seeds],
|
||||
),
|
||||
wormhole_cctp_solana::cpi::BurnAndPublishArgs {
|
||||
burn_source: ctx.accounts.burn_source.key(),
|
||||
burn_source: Some(ctx.accounts.burn_source.key()),
|
||||
destination_caller: ctx.accounts.registered_emitter.address,
|
||||
destination_cctp_domain: ctx.accounts.registered_emitter.cctp_domain,
|
||||
amount,
|
||||
|
|
Loading…
Reference in New Issue