solana: move fee transfer; uptick 0.0.1-alpha.3
This commit is contained in:
parent
f3477691bc
commit
aa4ea707a3
|
@ -2377,7 +2377,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wormhole-cctp-solana"
|
||||
version = "0.0.1-alpha.2"
|
||||
version = "0.0.1-alpha.3"
|
||||
dependencies = [
|
||||
"anchor-lang",
|
||||
"anchor-spl",
|
||||
|
@ -2393,7 +2393,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wormhole-circle-integration-solana"
|
||||
version = "0.0.1-alpha.2"
|
||||
version = "0.0.1-alpha.3"
|
||||
dependencies = [
|
||||
"anchor-lang",
|
||||
"anchor-spl",
|
||||
|
|
|
@ -7,7 +7,7 @@ resolver = "2"
|
|||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
version = "0.0.1-alpha.2"
|
||||
version = "0.0.1-alpha.3"
|
||||
authors = ["Wormhole Contributors"]
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://wormhole.com"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{cctp, messages::Deposit, wormhole::core_bridge_program};
|
||||
use anchor_lang::{prelude::*, system_program};
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
/// Arguments used to burn Circle-supported tokens and publish a Wormhole Core Bridge message.
|
||||
#[derive(Debug, AnchorSerialize, AnchorDeserialize, Clone)]
|
||||
|
@ -88,24 +88,7 @@ pub fn burn_and_publish<'info>(
|
|||
},
|
||||
)?;
|
||||
|
||||
// Pay Wormhole message fee.
|
||||
{
|
||||
let mut data: &[_] = &wormhole_ctx.accounts.config.try_borrow_data()?;
|
||||
let config = wormhole_core_bridge_solana::state::Config::deserialize(&mut data)?;
|
||||
|
||||
system_program::transfer(
|
||||
CpiContext::new(
|
||||
wormhole_ctx.accounts.system_program.to_account_info(),
|
||||
system_program::Transfer {
|
||||
from: wormhole_ctx.accounts.payer.to_account_info(),
|
||||
to: wormhole_ctx.accounts.fee_collector.to_account_info(),
|
||||
},
|
||||
),
|
||||
config.fee_lamports,
|
||||
)?;
|
||||
}
|
||||
|
||||
// Publish message via Core Bridge.
|
||||
// Publish message via Core Bridge. This includes paying the message fee.
|
||||
core_bridge_program::cpi::post_message(
|
||||
wormhole_ctx,
|
||||
core_bridge_program::cpi::PostMessageArgs {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::wormhole::core_bridge_program::Commitment;
|
||||
use anchor_lang::prelude::*;
|
||||
use anchor_lang::{prelude::*, system_program};
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct PostMessage<'info> {
|
||||
|
@ -47,6 +47,23 @@ pub fn post_message<'info>(
|
|||
ctx: CpiContext<'_, '_, '_, 'info, PostMessage<'info>>,
|
||||
args: PostMessageArgs,
|
||||
) -> Result<()> {
|
||||
// Pay Wormhole message fee.
|
||||
{
|
||||
let mut data: &[_] = &ctx.accounts.config.try_borrow_data()?;
|
||||
let config = wormhole_core_bridge_solana::state::Config::deserialize(&mut data)?;
|
||||
|
||||
system_program::transfer(
|
||||
CpiContext::new(
|
||||
ctx.accounts.system_program.to_account_info(),
|
||||
system_program::Transfer {
|
||||
from: ctx.accounts.payer.to_account_info(),
|
||||
to: ctx.accounts.fee_collector.to_account_info(),
|
||||
},
|
||||
),
|
||||
config.fee_lamports,
|
||||
)?;
|
||||
}
|
||||
|
||||
const IX_SELECTOR: u8 = 1;
|
||||
|
||||
solana_program::program::invoke_signed(
|
||||
|
|
Loading…
Reference in New Issue