-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config to pool program to track pool_authority
- Loading branch information
Nick Garfield
committed
Aug 31, 2022
1 parent
ed05c4b
commit 5d5cd06
Showing
25 changed files
with
263 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use anchor_lang::{ | ||
solana_program::{ | ||
instruction::{AccountMeta, Instruction}, | ||
pubkey::Pubkey, | ||
system_program, | ||
}, | ||
InstructionData, | ||
}; | ||
|
||
pub fn initialize(admin: Pubkey) -> Instruction { | ||
let config_pubkey = clockwork_pool::state::Config::pubkey(); | ||
let pool_authority = clockwork_network::state::Rotator::pubkey(); | ||
|
||
Instruction { | ||
program_id: clockwork_pool::ID, | ||
accounts: vec![ | ||
AccountMeta::new(admin, true), | ||
AccountMeta::new(config_pubkey, false), | ||
AccountMeta::new_readonly(system_program::ID, false), | ||
], | ||
data: clockwork_pool::instruction::Initialize { pool_authority }.data(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod initialize; | ||
|
||
pub use initialize::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod instruction; | ||
|
||
pub use clockwork_pool::state; | ||
pub use clockwork_pool::ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use {crate::state::*, anchor_lang::prelude::*}; | ||
|
||
#[derive(Accounts)] | ||
#[instruction(settings: ConfigSettings)] | ||
pub struct ConfigUpdate<'info> { | ||
#[account(mut)] | ||
pub admin: Signer<'info>, | ||
|
||
#[account(mut, seeds = [SEED_CONFIG], bump, has_one = admin)] | ||
pub config: Account<'info, Config>, | ||
} | ||
|
||
pub fn handler(ctx: Context<ConfigUpdate>, settings: ConfigSettings) -> Result<()> { | ||
let config = &mut ctx.accounts.config; | ||
config.update(settings) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use {crate::state::*, anchor_lang::prelude::*}; | ||
|
||
#[derive(Accounts)] | ||
#[instruction(settings: ConfigSettings)] | ||
pub struct ConfigUpdate<'info> { | ||
#[account(mut)] | ||
pub admin: Signer<'info>, | ||
|
||
#[account(mut, seeds = [SEED_CONFIG], bump, has_one = admin)] | ||
pub config: Account<'info, Config>, | ||
} | ||
|
||
pub fn handler(ctx: Context<ConfigUpdate>, settings: ConfigSettings) -> Result<()> { | ||
let config = &mut ctx.accounts.config; | ||
config.update(settings) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use { | ||
crate::state::*, | ||
anchor_lang::{prelude::*, solana_program::system_program}, | ||
std::mem::size_of, | ||
}; | ||
|
||
#[derive(Accounts)] | ||
#[instruction(pool_authority: Pubkey)] | ||
pub struct Initialize<'info> { | ||
#[account(mut)] | ||
pub admin: Signer<'info>, | ||
|
||
#[account( | ||
init, | ||
seeds = [SEED_CONFIG], | ||
bump, | ||
payer = admin, | ||
space = 8 + size_of::<Config>(), | ||
)] | ||
pub config: Account<'info, Config>, | ||
|
||
#[account(address = system_program::ID)] | ||
pub system_program: Program<'info, System>, | ||
} | ||
|
||
pub fn handler(ctx: Context<Initialize>, pool_authority: Pubkey) -> Result<()> { | ||
let admin = &ctx.accounts.admin; | ||
let config = &mut ctx.accounts.config; | ||
|
||
config.init(admin.key(), pool_authority)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
pub mod config_update; | ||
pub mod initialize; | ||
pub mod pool_create; | ||
pub mod pool_rotate; | ||
pub mod pool_update; | ||
|
||
pub use config_update::*; | ||
pub use initialize::*; | ||
pub use pool_create::*; | ||
pub use pool_rotate::*; | ||
pub use pool_update::*; |
Oops, something went wrong.