Fix contributor
This commit is contained in:
parent
0913e608c2
commit
1d15b29de9
|
@ -13,23 +13,23 @@ pub mod wormhole;
|
||||||
pub mod icco_contributor {
|
pub mod icco_contributor {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub fn create_config(
|
pub fn create_contributor(
|
||||||
ctx: Context<CreateContributor>,
|
ctx: Context<CreateContributor>,
|
||||||
conductor_chain: u16,
|
conductor_chain: u16,
|
||||||
conductor_address: Vec<u8>,
|
conductor_address: Vec<u8>,
|
||||||
wormhole: Pubkey,
|
wormhole: Pubkey,
|
||||||
token_bridge: Pubkey,
|
token_bridge: Pubkey,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let config = &mut ctx.accounts.config;
|
let contributor = &mut ctx.accounts.contributor;
|
||||||
|
|
||||||
// there isn't a solana conductor (yet? bwahaha)
|
// there isn't a solana conductor (yet? bwahaha)
|
||||||
require!(conductor_chain != 1u16, ContributorError::InvalidConductor);
|
require!(conductor_chain != 1u16, ContributorError::InvalidConductor);
|
||||||
|
|
||||||
config.conductor_chain = conductor_chain;
|
contributor.conductor_chain = conductor_chain;
|
||||||
config.conductor_address = conductor_address.try_into().expect("incorrect byte length");
|
contributor.conductor_address =
|
||||||
config.wormhole = wormhole;
|
conductor_address.try_into().expect("incorrect byte length");
|
||||||
config.token_bridge = token_bridge;
|
contributor.wormhole = wormhole;
|
||||||
config.bump = *ctx.bumps.get("contributor-config").unwrap();
|
contributor.token_bridge = token_bridge;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ pub struct Contributor {
|
||||||
pub conductor_address: [u8; 32],
|
pub conductor_address: [u8; 32],
|
||||||
pub wormhole: Pubkey, // 32 bytes
|
pub wormhole: Pubkey, // 32 bytes
|
||||||
pub token_bridge: Pubkey, // 32 bytes
|
pub token_bridge: Pubkey, // 32 bytes
|
||||||
pub bump: u8,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Contributor {
|
impl Contributor {
|
||||||
|
@ -34,14 +33,14 @@ impl Contributor {
|
||||||
// validation struct
|
// validation struct
|
||||||
#[derive(Accounts)]
|
#[derive(Accounts)]
|
||||||
pub struct CreateContributor<'info> {
|
pub struct CreateContributor<'info> {
|
||||||
#[account(mut)]
|
|
||||||
pub owner: Signer<'info>,
|
|
||||||
|
|
||||||
#[account(
|
#[account(
|
||||||
init,
|
init,
|
||||||
payer = owner,
|
payer = owner,
|
||||||
space = 8 + Contributor::MAXIMUM_SIZE,
|
space = 8 + Contributor::MAXIMUM_SIZE,
|
||||||
)]
|
)]
|
||||||
pub config: Account<'info, Contributor>,
|
pub contributor: Account<'info, Contributor>,
|
||||||
|
|
||||||
|
#[account(mut)]
|
||||||
|
pub owner: Signer<'info>,
|
||||||
pub system_program: Program<'info, System>,
|
pub system_program: Program<'info, System>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue