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