Set correct mutability on Attest
Change-Id: Ib9ead9dcc7c150292dcc00be60ac0a9b73935b48
This commit is contained in:
parent
5f0707c75d
commit
f8174b7355
|
@ -1189,6 +1189,12 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hex-literal"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b"
|
||||
|
||||
[[package]]
|
||||
name = "hidapi"
|
||||
version = "1.2.6"
|
||||
|
@ -3442,10 +3448,16 @@ dependencies = [
|
|||
"borsh",
|
||||
"bridge",
|
||||
"byteorder",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"primitive-types",
|
||||
"rand 0.7.3",
|
||||
"rocksalt",
|
||||
"sha3",
|
||||
"solana-client",
|
||||
"solana-program",
|
||||
"solana-sdk",
|
||||
"solitaire",
|
||||
"solitaire-client",
|
||||
"spl-token",
|
||||
|
|
|
@ -26,3 +26,12 @@ solana-program = "*"
|
|||
spl-token = { version = "=3.1.0", features = ["no-entrypoint"] }
|
||||
primitive-types = { version = "0.9.0", default-features = false }
|
||||
solitaire-client = { path = "../../../solitaire/client", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex = "*"
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = { version = "0.3.5", features = [] }
|
||||
rand = "0.7.3"
|
||||
solana-client = "1.7.0"
|
||||
solana-sdk = "=1.7.0"
|
||||
spl-token = { version = "=3.1.0", features = ["no-entrypoint"] }
|
||||
|
|
|
@ -6,6 +6,7 @@ use crate::{
|
|||
use bridge::{
|
||||
api::{PostMessage, PostMessageData},
|
||||
vaa::SerializePayload,
|
||||
types::ConsistencyLevel,
|
||||
};
|
||||
use primitive_types::U256;
|
||||
use solana_program::{
|
||||
|
@ -26,27 +27,28 @@ use std::ops::{Deref, DerefMut};
|
|||
|
||||
#[derive(FromAccounts)]
|
||||
pub struct AttestToken<'b> {
|
||||
pub payer: Signer<AccountInfo<'b>>,
|
||||
pub config: ConfigAccount<'b, { AccountState::Initialized }>,
|
||||
pub payer: Mut<Signer<AccountInfo<'b>>>,
|
||||
|
||||
pub config: Mut<ConfigAccount<'b, { AccountState::Initialized }>>,
|
||||
|
||||
/// Mint to attest
|
||||
pub mint: Data<'b, SplMint, { AccountState::Initialized }>,
|
||||
pub mint_meta: Data<'b, SplMint, { AccountState::MaybeInitialized }>,
|
||||
|
||||
/// CPI Context
|
||||
pub bridge: Info<'b>,
|
||||
pub bridge: Mut<Info<'b>>,
|
||||
|
||||
/// Account to store the posted message
|
||||
pub message: Info<'b>,
|
||||
pub message: Mut<Info<'b>>,
|
||||
|
||||
/// Emitter of the VAA
|
||||
pub emitter: EmitterAccount<'b>,
|
||||
|
||||
/// Tracker for the emitter sequence
|
||||
pub sequence: Info<'b>,
|
||||
pub sequence: Mut<Info<'b>>,
|
||||
|
||||
/// Account to collect tx fee
|
||||
pub fee_collector: Info<'b>,
|
||||
pub fee_collector: Mut<Info<'b>>,
|
||||
|
||||
pub clock: Sysvar<'b, Clock>,
|
||||
}
|
||||
|
@ -87,14 +89,14 @@ pub fn attest_token(
|
|||
let params = (bridge::instruction::Instruction::PostMessage, PostMessageData {
|
||||
nonce: data.nonce,
|
||||
payload: payload.try_to_vec()?,
|
||||
persist: true,
|
||||
consistency_level: ConsistencyLevel::Confirmed,
|
||||
});
|
||||
|
||||
let ix = Instruction::new_with_bytes(
|
||||
accs.config.wormhole_bridge,
|
||||
params.try_to_vec()?.as_slice(),
|
||||
vec![
|
||||
AccountMeta::new_readonly(*accs.bridge.key, false),
|
||||
AccountMeta::new(*accs.bridge.key, false),
|
||||
AccountMeta::new(*accs.message.key, false),
|
||||
AccountMeta::new_readonly(*accs.emitter.key, true),
|
||||
AccountMeta::new(*accs.sequence.key, false),
|
||||
|
|
|
@ -311,7 +311,7 @@ pub fn transfer_native(
|
|||
AccountMeta::new(custody_key, false),
|
||||
AccountMeta::new_readonly(authority_signer_key, false),
|
||||
AccountMeta::new_readonly(custody_signer_key, false),
|
||||
AccountMeta::new_readonly(bridge_config, false),
|
||||
AccountMeta::new(bridge_config, false),
|
||||
AccountMeta::new(message_key, false),
|
||||
AccountMeta::new_readonly(emitter_key, false),
|
||||
AccountMeta::new(sequence_key, false),
|
||||
|
@ -461,7 +461,7 @@ pub fn attest(
|
|||
AccountMeta::new_readonly(mint, false),
|
||||
AccountMeta::new_readonly(mint_meta, false),
|
||||
// Bridge accounts
|
||||
AccountMeta::new_readonly(bridge_config, false),
|
||||
AccountMeta::new(bridge_config, false),
|
||||
AccountMeta::new(message_key, false),
|
||||
AccountMeta::new_readonly(emitter_key, false),
|
||||
AccountMeta::new(sequence_key, false),
|
||||
|
|
Loading…
Reference in New Issue