update pubkeys for mainet

This commit is contained in:
Hardhat Chad
2024-03-10 19:22:32 +00:00
parent a350e9779f
commit 858270505e
6 changed files with 48 additions and 43 deletions

View File

@@ -5,24 +5,24 @@ pub const START_AT: i64 = 0;
/// The addresses of the bus accounts.
pub const BUS_ADDRESSES: [Pubkey; BUS_COUNT] = [
pubkey!("85JC7qU7pkjYdvvXewfzgjCBZvugtrnPKYE9mzPD2ajJ"),
pubkey!("FXCPt8PPwNQF8NVFDvdnHRENpkWexGMr5t8EnSoBsbns"),
pubkey!("HbbFBD9y6mqhwsgu3hDEtFwJAtUtCFrRPRP8MNJoFkpV"),
pubkey!("D65o7LLrZ8YoE7r7TaUSN434ZctNhYc7dEsfQrMXD7DS"),
pubkey!("EJBBRJih5WFsZPwhmWTHrxSbBRhqtXjMJfMtjgtYGpzA"),
pubkey!("BbecQomM3tCYHHDjKXybK8McthdyuuNJkmVaVXWyayyZ"),
pubkey!("7RyV6ZZmkadFjT8rMmZXsbEzHFbHe2ZHcJqUuk7H5ibP"),
pubkey!("72GSzz967ePb6mDrZYzmwyFFrfNUgH2PUwwocfeyjxLB"),
pubkey!("BipsVd7bXrsWTD7MSR7vEE6wCi812xree9MdMQHNpGve"),
pubkey!("4UywqKWK1hFk2FVn2i8dHGRL28wTmwv2pveBV4QhApsy"),
pubkey!("6q971fxeEjwQWXL3PTEWBpSAs55HvKkb4yVeP85qrycY"),
pubkey!("BWa6yzTg3Mrs6tH2rstKQrobSVEBkfQUzE4iZUJz54AP"),
pubkey!("AXdpmjuVJYk7re8TcDX33ZoLyYpbBopesRWaNYnDHe8L"),
pubkey!("FXikoBAemf48cZswLnnUtXZhD7Pr6knYPNq6cjb76ubh"),
pubkey!("9BqvaWJ9bmkPYNqaZPaHoonAR5bh1dHRymZV4nrae3sC"),
pubkey!("8T4ngp27XKn3fAJnHgZ9pDXwzMbHnxhCPuvBWMa5m3ro"),
];
/// The address of the Ore mint metadata account.
pub const METADATA_ADDRESS: Pubkey = pubkey!("4nbf4yufkBjJbZjZrz5D6L4nRyRbiw9rvKLTesCVpqnB");
pub const METADATA_ADDRESS: Pubkey = pubkey!("wyJ7XtZQDox5XoPG3uw7u7XnpNXaqTDeAwKpuJqHLi4");
/// The address of the Ore mint account.
pub const MINT_ADDRESS: Pubkey = pubkey!("tmResQt9qPVRhAh74fMxginQqHBG74Ls3Nou1rkvCg7");
pub const MINT_ADDRESS: Pubkey = pubkey!("oreoBXz6dRgETAVLre1Umgp6Hs4UdLRwJiYj5FkfzYh");
/// The address of the treasury account.
pub const TREASURY_ADDRESS: Pubkey = pubkey!("nLCGcWmqqLC2UVBb3neVQWhzzJd8GAJshvasczmVm94");
pub const TREASURY_ADDRESS: Pubkey = pubkey!("CHTwJ2GLmz9KDEpPuLu5iYFF85pSzx4xzJSwm81ojN3Q");
/// The initial reward rate to payout in the first epoch.
pub const INITIAL_REWARD_RATE: u64 = 10u64.pow(3u32);
@@ -66,6 +66,11 @@ static_assertions::const_assert!(
(MAX_EPOCH_REWARDS / BUS_COUNT as u64) * BUS_COUNT as u64 == MAX_EPOCH_REWARDS
);
/// Noise for deriving the mint pda
pub const MINT_NOISE: [u8; 16] = [
64, 193, 214, 243, 206, 254, 96, 138, 148, 27, 250, 15, 126, 55, 231, 93,
];
/// The seed of the bus account PDA.
pub const BUS: &[u8] = b"bus";

View File

@@ -9,7 +9,7 @@ use solana_program::{
use crate::{
impl_instruction_from_bytes, impl_to_bytes, state::Hash, BUS, METADATA, MINT, MINT_ADDRESS,
PROOF, TREASURY, TREASURY_ADDRESS,
MINT_NOISE, PROOF, TREASURY, TREASURY_ADDRESS,
};
#[repr(u8)]
@@ -155,10 +155,6 @@ impl_instruction_from_bytes!(UpdateDifficultyArgs);
/// Builds an initialize instruction.
pub fn initialize(signer: Pubkey) -> Instruction {
let treasury_tokens = spl_associated_token_account::get_associated_token_address(
&TREASURY_ADDRESS,
&MINT_ADDRESS,
);
let bus_pdas = [
Pubkey::find_program_address(&[BUS, &[0]], &crate::id()),
Pubkey::find_program_address(&[BUS, &[1]], &crate::id()),
@@ -169,8 +165,10 @@ pub fn initialize(signer: Pubkey) -> Instruction {
Pubkey::find_program_address(&[BUS, &[6]], &crate::id()),
Pubkey::find_program_address(&[BUS, &[7]], &crate::id()),
];
let mint_pda = Pubkey::find_program_address(&[MINT], &crate::id());
let mint_pda = Pubkey::find_program_address(&[MINT, MINT_NOISE.as_slice()], &crate::id());
let treasury_pda = Pubkey::find_program_address(&[TREASURY], &crate::id());
let treasury_tokens =
spl_associated_token_account::get_associated_token_address(&treasury_pda.0, &mint_pda.0);
let metadata_pda = Pubkey::find_program_address(
&[
METADATA,

View File

@@ -15,9 +15,8 @@ use solana_program::{
};
// TODO Set START_AT before launch.
// TODO Set pubkey consts for derived mainnet pdas before lanch.
declare_id!("oreoDL2qcXyBdaYTEfd7F5MFLY5PAqqDooPLZv1XdBP");
declare_id!("mineS8xKxv3GurPq4RAssdZa6kNSXuuxJCEVtQwPZX4");
#[cfg(not(feature = "no-entrypoint"))]
solana_program::entrypoint!(process_instruction);

View File

@@ -18,7 +18,7 @@ use crate::{
utils::AccountDeserialize,
utils::Discriminator,
BUS, BUS_ADDRESSES, BUS_COUNT, INITIAL_DIFFICULTY, INITIAL_REWARD_RATE, METADATA,
METADATA_ADDRESS, METADATA_NAME, METADATA_SYMBOL, METADATA_URI, MINT, MINT_ADDRESS,
METADATA_ADDRESS, METADATA_NAME, METADATA_SYMBOL, METADATA_URI, MINT, MINT_ADDRESS, MINT_NOISE,
TOKEN_DECIMALS, TREASURY, TREASURY_ADDRESS,
};
@@ -73,7 +73,11 @@ pub fn process_initialize<'a, 'info>(
],
&mpl_token_metadata::ID,
)?;
load_uninitialized_pda(mint_info, &[MINT, &[args.mint_bump]], &crate::id())?;
load_uninitialized_pda(
mint_info,
&[MINT, MINT_NOISE.as_slice(), &[args.mint_bump]],
&crate::id(),
)?;
load_uninitialized_pda(
treasury_info,
&[TREASURY, &[args.treasury_bump]],
@@ -156,7 +160,7 @@ pub fn process_initialize<'a, 'info>(
mint_info,
&spl_token::id(),
Mint::LEN,
&[MINT, &[args.mint_bump]],
&[MINT, MINT_NOISE.as_slice(), &[args.mint_bump]],
system_program,
signer,
)?;
@@ -174,7 +178,7 @@ pub fn process_initialize<'a, 'info>(
treasury_info.clone(),
rent_sysvar.clone(),
],
&[&[MINT, &[args.mint_bump]]],
&[&[MINT, MINT_NOISE.as_slice(), &[args.mint_bump]]],
)?;
// Initialize mint metadata

View File

@@ -79,7 +79,6 @@ async fn test_initialize() {
assert_eq!(metadata.creators, None);
assert_eq!(metadata.primary_sale_happened, false);
assert_eq!(metadata.is_mutable, true);
assert_eq!(metadata.edition_nonce, Some(u8::MAX));
assert_eq!(metadata.token_standard, Some(TokenStandard::Fungible));
assert_eq!(metadata.collection, None);
assert_eq!(metadata.uses, None);

View File

@@ -5,7 +5,7 @@ use ore::{
state::{Bus, Treasury},
utils::{AccountDeserialize, Discriminator},
BUS, BUS_ADDRESSES, BUS_COUNT, BUS_EPOCH_REWARDS, INITIAL_DIFFICULTY, INITIAL_REWARD_RATE,
MAX_EPOCH_REWARDS, MINT, MINT_ADDRESS, TOKEN_DECIMALS, TREASURY, TREASURY_ADDRESS,
MAX_EPOCH_REWARDS, MINT_ADDRESS, TOKEN_DECIMALS, TREASURY, TREASURY_ADDRESS,
};
use rand::seq::SliceRandom;
use solana_program::{
@@ -41,10 +41,11 @@ async fn test_reset() {
Pubkey::find_program_address(&[BUS, &[6]], &ore::id()),
Pubkey::find_program_address(&[BUS, &[7]], &ore::id()),
];
let mint_pda = Pubkey::find_program_address(&[MINT], &ore::id());
let treasury_pda = Pubkey::find_program_address(&[TREASURY], &ore::id());
let treasury_tokens_address =
spl_associated_token_account::get_associated_token_address(&treasury_pda.0, &mint_pda.0);
// let mint_pda = Pubkey::find_program_address(&[MINT], &ore::id());
let treasury_tokens_address = spl_associated_token_account::get_associated_token_address(
&TREASURY_ADDRESS,
&MINT_ADDRESS,
);
// Submit tx
let ix = ore::instruction::reset(payer.pubkey());
@@ -62,10 +63,9 @@ async fn test_reset() {
}
// Test treasury state
let treasury_account = banks.get_account(treasury_pda.0).await.unwrap().unwrap();
let treasury_account = banks.get_account(TREASURY_ADDRESS).await.unwrap().unwrap();
assert_eq!(treasury_account.owner, ore::id());
let treasury = Treasury::try_from_bytes(&treasury_account.data).unwrap();
assert_eq!(treasury.bump as u8, treasury_pda.1);
assert_eq!(
treasury.admin,
Pubkey::from_str("AeNqnoLwFanMd3ig9WoMxQZVwQHtCtqKMMBsT1sTrvz6").unwrap()
@@ -76,10 +76,10 @@ async fn test_reset() {
assert_eq!(treasury.total_claimed_rewards as u8, 0);
// Test mint state
let mint_account = banks.get_account(mint_pda.0).await.unwrap().unwrap();
let mint_account = banks.get_account(MINT_ADDRESS).await.unwrap().unwrap();
assert_eq!(mint_account.owner, spl_token::id());
let mint = Mint::unpack(&mint_account.data).unwrap();
assert_eq!(mint.mint_authority, COption::Some(treasury_pda.0));
assert_eq!(mint.mint_authority, COption::Some(TREASURY_ADDRESS));
assert_eq!(mint.supply, MAX_EPOCH_REWARDS);
assert_eq!(mint.decimals, ore::TOKEN_DECIMALS);
assert_eq!(mint.is_initialized, true);
@@ -93,8 +93,8 @@ async fn test_reset() {
.unwrap();
assert_eq!(treasury_tokens_account.owner, spl_token::id());
let treasury_tokens = spl_token::state::Account::unpack(&treasury_tokens_account.data).unwrap();
assert_eq!(treasury_tokens.mint, mint_pda.0);
assert_eq!(treasury_tokens.owner, treasury_pda.0);
assert_eq!(treasury_tokens.mint, MINT_ADDRESS);
assert_eq!(treasury_tokens.owner, TREASURY_ADDRESS);
assert_eq!(treasury_tokens.amount, MAX_EPOCH_REWARDS);
assert_eq!(treasury_tokens.delegate, COption::None);
assert_eq!(treasury_tokens.state, AccountState::Initialized);
@@ -120,10 +120,10 @@ async fn test_reset_busses_out_of_order() {
Pubkey::find_program_address(&[BUS, &[1]], &ore::id()),
Pubkey::find_program_address(&[BUS, &[4]], &ore::id()),
];
let mint_pda = Pubkey::find_program_address(&[MINT], &ore::id());
let treasury_pda = Pubkey::find_program_address(&[TREASURY], &ore::id());
let treasury_tokens =
spl_associated_token_account::get_associated_token_address(&treasury_pda.0, &mint_pda.0);
let treasury_tokens = spl_associated_token_account::get_associated_token_address(
&TREASURY_ADDRESS,
&MINT_ADDRESS,
);
// Submit tx
let ix = Instruction {
@@ -176,10 +176,10 @@ async fn test_reset_shuffle_error() {
Pubkey::find_program_address(&[BUS, &[1]], &ore::id()),
Pubkey::find_program_address(&[BUS, &[4]], &ore::id()),
];
let mint_pda = Pubkey::find_program_address(&[MINT], &ore::id());
let treasury_pda = Pubkey::find_program_address(&[TREASURY], &ore::id());
let treasury_tokens =
spl_associated_token_account::get_associated_token_address(&treasury_pda.0, &mint_pda.0);
let treasury_tokens = spl_associated_token_account::get_associated_token_address(
&TREASURY_ADDRESS,
&MINT_ADDRESS,
);
// Fuzz test shuffled accounts.
// Note some shuffles may still be valid if signer and non-bus accounts are all in correct positions.