mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-13 23:16:52 +00:00
automations
This commit is contained in:
@@ -31,6 +31,9 @@ async fn main() {
|
||||
.expect("Missing COMMAND env var")
|
||||
.as_str()
|
||||
{
|
||||
"automations" => {
|
||||
log_automations(&rpc).await.unwrap();
|
||||
}
|
||||
"boost" => {
|
||||
boost(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
@@ -266,6 +269,21 @@ async fn set_fee_collector(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn log_automations(rpc: &RpcClient) -> Result<(), anyhow::Error> {
|
||||
let automations = get_automations(rpc).await?;
|
||||
for (i, (address, automation)) in automations.iter().enumerate() {
|
||||
println!("[{}/{}] {}", i + 1, automations.len(), address);
|
||||
println!(" authority: {}", automation.authority);
|
||||
println!(" balance: {}", automation.balance);
|
||||
println!(" executor: {}", automation.executor);
|
||||
println!(" fee: {}", automation.fee);
|
||||
println!(" mask: {}", automation.mask);
|
||||
println!(" strategy: {}", automation.strategy);
|
||||
println!();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn log_treasury(rpc: &RpcClient) -> Result<(), anyhow::Error> {
|
||||
let treasury_address = ore_api::state::treasury_pda().0;
|
||||
let treasury = get_treasury(rpc).await?;
|
||||
@@ -354,6 +372,16 @@ fn print_board(board: Board, clock: &Clock) {
|
||||
);
|
||||
}
|
||||
|
||||
async fn get_automations(rpc: &RpcClient) -> Result<Vec<(Pubkey, Automation)>, anyhow::Error> {
|
||||
const REGOLITH_EXECUTOR: Pubkey = pubkey!("HNWhK5f8RMWBqcA7mXJPaxdTPGrha3rrqUrri7HSKb3T");
|
||||
let filter = RpcFilterType::Memcmp(Memcmp::new_base58_encoded(
|
||||
56,
|
||||
®OLITH_EXECUTOR.to_bytes(),
|
||||
));
|
||||
let automations = get_program_accounts::<Automation>(rpc, ore_api::ID, vec![filter]).await?;
|
||||
Ok(automations)
|
||||
}
|
||||
|
||||
async fn get_board(rpc: &RpcClient) -> Result<Board, anyhow::Error> {
|
||||
let board_pda = ore_api::state::board_pda();
|
||||
let account = rpc.get_account(&board_pda.0).await?;
|
||||
|
||||
@@ -117,7 +117,8 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul
|
||||
.assert_mut(|m| {
|
||||
if let Some(automation) = &automation {
|
||||
// only run automation once per round
|
||||
m.authority == automation.authority && m.round_id < board.id
|
||||
m.authority == automation.authority
|
||||
&& (m.round_id < board.id || board.slot_hash != [0; 32])
|
||||
} else {
|
||||
m.authority == *signer_info.key
|
||||
}
|
||||
@@ -169,7 +170,7 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul
|
||||
|
||||
// Update square
|
||||
if is_first_move {
|
||||
square.miners[square_id][square.count[square_id] as usize] = *signer_info.key;
|
||||
square.miners[square_id][square.count[square_id] as usize] = miner.authority;
|
||||
square.count[square_id] += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use solana_program::pubkey;
|
||||
use steel::*;
|
||||
|
||||
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 3] = [
|
||||
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 4] = [
|
||||
pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS"),
|
||||
pubkey!("HNWhK5f8RMWBqcA7mXJPaxdTPGrha3rrqUrri7HSKb3T"),
|
||||
pubkey!("6B9PjpHfbhPcSakS5UQ7ZctgbPujfsryVRpDecskGLiz"),
|
||||
pubkey!("HBUh9g46wk2X89CvaNN15UmsznP59rh6od1h8JwYAopk"),
|
||||
// pubkey!("By5JFFueXCqeqLk5MzR8ZSwFxASz3SKWX2TVfT1LTFbX"),
|
||||
|
||||
Reference in New Issue
Block a user