SHA256
Обновить казну и управление Shine Payments
This commit is contained in:
@@ -3,6 +3,7 @@ use pyth_solana_receiver_sdk::error::GetPriceError;
|
||||
use pyth_solana_receiver_sdk::price_update::{get_feed_id_from_hex, FeedId, PriceUpdateV2};
|
||||
use solana_program::{
|
||||
account_info::{next_account_info, AccountInfo},
|
||||
bpf_loader_upgradeable,
|
||||
clock::Clock,
|
||||
entrypoint,
|
||||
entrypoint::ProgramResult,
|
||||
@@ -30,6 +31,7 @@ const IX_BUY_TICKET_SOL: u8 = 6;
|
||||
const IX_MANAGER_ADD_TICKET: u8 = 7;
|
||||
const IX_STEP_PAYOUT: u8 = 8;
|
||||
const IX_CHANGE_TICKET_RECIPIENT: u8 = 9;
|
||||
const IX_UPDATE_DAO_TREASURY: u8 = 10;
|
||||
|
||||
/// Значение байта статуса тикета «закрыт пропуском без выплаты».
|
||||
const TICKET_STATUS_SKIPPED: u8 = 2;
|
||||
@@ -42,9 +44,9 @@ enum PaymentsError {
|
||||
InvalidPdaAddress = 3,
|
||||
EmptyState = 4,
|
||||
InvalidAccountData = 5,
|
||||
InvalidSettingsWallet = 6,
|
||||
InvalidSettingsTreasury = 6,
|
||||
InvalidInflowVault = 7,
|
||||
InvalidDaoWallet = 8,
|
||||
InvalidDaoTreasury = 8,
|
||||
UnauthorizedManager = 9,
|
||||
UnauthorizedDao = 10,
|
||||
InvalidCoefficient = 11,
|
||||
@@ -74,6 +76,7 @@ enum PaymentsError {
|
||||
InvalidSystemProgram = 35,
|
||||
PdaAlreadyExists = 36,
|
||||
TicketPurchaseTooSmall = 37,
|
||||
InvalidUpgradeAuthority = 38,
|
||||
}
|
||||
|
||||
impl From<PaymentsError> for ProgramError {
|
||||
@@ -145,10 +148,17 @@ pub struct ChangeTicketRecipientArgs {
|
||||
pub new_recipient_wallet: Pubkey,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct UpdateDaoTreasuryArgs {
|
||||
pub new_treasury: Pubkey,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ConfigState {
|
||||
pub version: u8,
|
||||
pub dao_wallet: Pubkey,
|
||||
/// Получатель доходов DAO. Это не административный signer: административные
|
||||
/// инструкции проверяют текущую upgrade authority ProgramData.
|
||||
pub dao_treasury: Pubkey,
|
||||
pub inflow_vault: Pubkey,
|
||||
}
|
||||
|
||||
@@ -274,7 +284,7 @@ impl StateCodec for ConfigState {
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
let mut out = Vec::with_capacity(65);
|
||||
out.push(self.version);
|
||||
out.extend_from_slice(self.dao_wallet.as_ref());
|
||||
out.extend_from_slice(self.dao_treasury.as_ref());
|
||||
out.extend_from_slice(self.inflow_vault.as_ref());
|
||||
out
|
||||
}
|
||||
@@ -282,10 +292,10 @@ impl StateCodec for ConfigState {
|
||||
fn decode(data: &[u8]) -> Result<Self, ProgramError> {
|
||||
let mut reader = Reader::new(data, PaymentsError::InvalidAccountData.into());
|
||||
let version = reader.read_u8()?;
|
||||
let dao_wallet = reader.read_pubkey()?;
|
||||
let dao_treasury = reader.read_pubkey()?;
|
||||
let inflow_vault = reader.read_pubkey()?;
|
||||
require!(reader.cursor == data.len(), PaymentsError::InvalidAccountData);
|
||||
Ok(Self { version, dao_wallet, inflow_vault })
|
||||
Ok(Self { version, dao_treasury, inflow_vault })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +462,7 @@ enum Instruction {
|
||||
ManagerAddTicket(ManagerAddTicketArgs),
|
||||
StepPayout,
|
||||
ChangeTicketRecipient(ChangeTicketRecipientArgs),
|
||||
UpdateDaoTreasury(UpdateDaoTreasuryArgs),
|
||||
}
|
||||
|
||||
pub fn process_instruction(
|
||||
@@ -469,6 +480,7 @@ pub fn process_instruction(
|
||||
Instruction::ManagerAddTicket(args) => process_manager_add_ticket(program_id, accounts, args),
|
||||
Instruction::StepPayout => process_step_payout(program_id, accounts),
|
||||
Instruction::ChangeTicketRecipient(args) => process_change_ticket_recipient(program_id, accounts, args),
|
||||
Instruction::UpdateDaoTreasury(args) => process_update_dao_treasury(program_id, accounts, args),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,6 +525,9 @@ fn parse_instruction(data: &[u8]) -> Result<Instruction, ProgramError> {
|
||||
IX_CHANGE_TICKET_RECIPIENT => Instruction::ChangeTicketRecipient(ChangeTicketRecipientArgs {
|
||||
new_recipient_wallet: reader.read_pubkey()?,
|
||||
}),
|
||||
IX_UPDATE_DAO_TREASURY => Instruction::UpdateDaoTreasury(UpdateDaoTreasuryArgs {
|
||||
new_treasury: reader.read_pubkey()?,
|
||||
}),
|
||||
_ => return Err(ProgramError::InvalidInstructionData),
|
||||
};
|
||||
reader.finish()?;
|
||||
@@ -535,12 +550,12 @@ fn process_init(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult
|
||||
require!(is_uninitialized_account(queues_pda), PaymentsError::SystemAlreadyInitialized);
|
||||
require!(is_uninitialized_account(inflow_vault_pda), PaymentsError::SystemAlreadyInitialized);
|
||||
|
||||
let dao_wallet = Pubkey::from_str(settings::DAO_WALLET)
|
||||
.map_err(|_| ProgramError::from(PaymentsError::InvalidSettingsWallet))?;
|
||||
let dao_treasury = Pubkey::from_str(settings::DEFAULT_DAO_TREASURY)
|
||||
.map_err(|_| ProgramError::from(PaymentsError::InvalidSettingsTreasury))?;
|
||||
|
||||
let config = ConfigState {
|
||||
version: 1,
|
||||
dao_wallet,
|
||||
dao_treasury,
|
||||
inflow_vault: *inflow_vault_pda.key,
|
||||
};
|
||||
create_and_store_state(
|
||||
@@ -617,12 +632,13 @@ fn process_update_coef_limit(
|
||||
let signer = next_signer_account(account_iter)?;
|
||||
let config_pda = next_account_info(account_iter)?;
|
||||
let coef_limit_pda = next_account_info(account_iter)?;
|
||||
let program_ai = next_account_info(account_iter)?;
|
||||
let programdata_ai = next_account_info(account_iter)?;
|
||||
require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction);
|
||||
|
||||
validate_upgrade_authority(program_id, signer, program_ai, programdata_ai)?;
|
||||
validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?;
|
||||
validate_singleton_state_pda(program_id, coef_limit_pda, settings::COEF_LIMIT_SEED)?;
|
||||
let config = read_state::<ConfigState>(config_pda)?;
|
||||
require_keys_eq!(config.dao_wallet, *signer.key, PaymentsError::UnauthorizedDao);
|
||||
require!(args.coef_ppm > 0, PaymentsError::InvalidCoefficient);
|
||||
require!(args.limit_usd_cents > 0, PaymentsError::InvalidLimit);
|
||||
require!(
|
||||
@@ -643,16 +659,22 @@ fn process_grant_manager_limits(
|
||||
args: GrantManagerLimitsArgs,
|
||||
) -> ProgramResult {
|
||||
let account_iter = &mut accounts.iter();
|
||||
let signer = next_signer_account(account_iter)?;
|
||||
let authority = next_signer_account(account_iter)?;
|
||||
// Authority и плательщик rent разделены: после передачи authority DAO
|
||||
// governance PDA может авторизовать лимит, а обычный подписант оплатит
|
||||
// создание нового manager_allowance PDA.
|
||||
let rent_payer = next_signer_account(account_iter)?;
|
||||
let config_pda = next_account_info(account_iter)?;
|
||||
let manager_allowance_pda = next_account_info(account_iter)?;
|
||||
let system_program_ai = next_account_info(account_iter)?;
|
||||
let program_ai = next_account_info(account_iter)?;
|
||||
let programdata_ai = next_account_info(account_iter)?;
|
||||
require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction);
|
||||
require_system_program(system_program_ai)?;
|
||||
require!(rent_payer.is_writable, PaymentsError::InvalidSigner);
|
||||
|
||||
validate_upgrade_authority(program_id, authority, program_ai, programdata_ai)?;
|
||||
validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?;
|
||||
let config = read_state::<ConfigState>(config_pda)?;
|
||||
require_keys_eq!(config.dao_wallet, *signer.key, PaymentsError::UnauthorizedDao);
|
||||
require!(
|
||||
args.add_q1_usd_cents > 0 || args.add_q2_usd_cents > 0 || args.add_q3_usd_cents > 0,
|
||||
PaymentsError::InvalidAmount
|
||||
@@ -671,7 +693,7 @@ fn process_grant_manager_limits(
|
||||
};
|
||||
create_state_with_seeds(
|
||||
program_id,
|
||||
signer,
|
||||
rent_payer,
|
||||
system_program_ai,
|
||||
manager_allowance_pda,
|
||||
&[
|
||||
@@ -694,6 +716,29 @@ fn process_grant_manager_limits(
|
||||
write_state(manager_allowance_pda, &state)
|
||||
}
|
||||
|
||||
/// Меняет только адрес, куда программа направляет DAO-доходы. Право берётся
|
||||
/// из ProgramData, поэтому после передачи upgrade authority оно автоматически
|
||||
/// переходит governance PDA DAO.
|
||||
fn process_update_dao_treasury(
|
||||
program_id: &Pubkey,
|
||||
accounts: &[AccountInfo],
|
||||
args: UpdateDaoTreasuryArgs,
|
||||
) -> ProgramResult {
|
||||
let account_iter = &mut accounts.iter();
|
||||
let signer = next_signer_account(account_iter)?;
|
||||
let config_pda = next_account_info(account_iter)?;
|
||||
let program_ai = next_account_info(account_iter)?;
|
||||
let programdata_ai = next_account_info(account_iter)?;
|
||||
require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction);
|
||||
|
||||
validate_upgrade_authority(program_id, signer, program_ai, programdata_ai)?;
|
||||
validate_singleton_state_pda(program_id, config_pda, settings::CONFIG_SEED)?;
|
||||
require!(config_pda.is_writable, PaymentsError::InvalidAccountData);
|
||||
let mut config = read_state::<ConfigState>(config_pda)?;
|
||||
config.dao_treasury = args.new_treasury;
|
||||
write_state(config_pda, &config)
|
||||
}
|
||||
|
||||
fn process_buy_ticket(
|
||||
program_id: &Pubkey,
|
||||
accounts: &[AccountInfo],
|
||||
@@ -812,7 +857,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program
|
||||
let inflow_vault_pda = next_account_info(account_iter)?;
|
||||
let next_ticket_pda = next_account_info(account_iter)?;
|
||||
let ticket_recipient_wallet = next_account_info(account_iter)?;
|
||||
let dao_wallet = next_account_info(account_iter)?;
|
||||
let dao_treasury = next_account_info(account_iter)?;
|
||||
let sol_usd_price_update = next_account_info(account_iter)?;
|
||||
require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction);
|
||||
|
||||
@@ -825,7 +870,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program
|
||||
let mut queues = read_state::<QueuesState>(queues_pda)?;
|
||||
let _vault_state = read_state::<VaultState>(inflow_vault_pda)?;
|
||||
|
||||
require_keys_eq!(*dao_wallet.key, config.dao_wallet, PaymentsError::InvalidDaoWallet);
|
||||
require_keys_eq!(*dao_treasury.key, config.dao_treasury, PaymentsError::InvalidDaoTreasury);
|
||||
require_keys_eq!(*inflow_vault_pda.key, config.inflow_vault, PaymentsError::InvalidInflowVault);
|
||||
|
||||
let q1_pending = checked_sub(queues.q1_tickets_total, queues.q1_tickets_paid)?;
|
||||
@@ -833,7 +878,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program
|
||||
let q3_pending = checked_sub(queues.q3_tickets_total, queues.q3_tickets_paid)?;
|
||||
|
||||
if q1_pending == 0 && q2_pending == 0 && q3_pending == 0 {
|
||||
transfer_all_available_to_dao(inflow_vault_pda, dao_wallet)?;
|
||||
transfer_all_available_to_dao(inflow_vault_pda, dao_treasury)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -882,7 +927,7 @@ fn process_step_payout(program_id: &Pubkey, accounts: &[AccountInfo]) -> Program
|
||||
require!(available_vault_lamports(inflow_vault_pda)? >= needed, PaymentsError::NotEnoughInflowForStep);
|
||||
|
||||
transfer_from_vault(inflow_vault_pda, ticket_recipient_wallet, ticket_lamports)?;
|
||||
transfer_from_vault(inflow_vault_pda, dao_wallet, dao_lamports)?;
|
||||
transfer_from_vault(inflow_vault_pda, dao_treasury, dao_lamports)?;
|
||||
transfer_from_vault(inflow_vault_pda, signer, coef_limit.call_reward_lamports)?;
|
||||
|
||||
ticket.is_paid = true;
|
||||
@@ -948,7 +993,7 @@ struct BuyTicketAccounts<'a, 'info> {
|
||||
coef_limit_pda: &'a AccountInfo<'info>,
|
||||
queues_pda: &'a AccountInfo<'info>,
|
||||
ticket_pda: &'a AccountInfo<'info>,
|
||||
dao_wallet: &'a AccountInfo<'info>,
|
||||
dao_treasury: &'a AccountInfo<'info>,
|
||||
sol_usd_price_update: &'a AccountInfo<'info>,
|
||||
system_program_ai: &'a AccountInfo<'info>,
|
||||
}
|
||||
@@ -961,7 +1006,7 @@ impl<'a, 'info> BuyTicketAccounts<'a, 'info> {
|
||||
let coef_limit_pda = next_account_info(account_iter)?;
|
||||
let queues_pda = next_account_info(account_iter)?;
|
||||
let ticket_pda = next_account_info(account_iter)?;
|
||||
let dao_wallet = next_account_info(account_iter)?;
|
||||
let dao_treasury = next_account_info(account_iter)?;
|
||||
let sol_usd_price_update = next_account_info(account_iter)?;
|
||||
let system_program_ai = next_account_info(account_iter)?;
|
||||
require!(account_iter.next().is_none(), PaymentsError::InvalidInstruction);
|
||||
@@ -972,7 +1017,7 @@ impl<'a, 'info> BuyTicketAccounts<'a, 'info> {
|
||||
coef_limit_pda,
|
||||
queues_pda,
|
||||
ticket_pda,
|
||||
dao_wallet,
|
||||
dao_treasury,
|
||||
sol_usd_price_update,
|
||||
system_program_ai,
|
||||
})
|
||||
@@ -1008,6 +1053,46 @@ fn validate_singleton_state_pda(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Проверяет не переданный клиентом адрес, а текущую upgrade authority ProgramData
|
||||
/// именно этой программы. Layout соответствует UpgradeableLoaderState:
|
||||
/// Program = [2:u32LE, programdata:32], ProgramData =
|
||||
/// [3:u32LE, slot:u64LE, Option<Pubkey>:1+32].
|
||||
fn validate_upgrade_authority(
|
||||
program_id: &Pubkey,
|
||||
signer: &AccountInfo,
|
||||
program_ai: &AccountInfo,
|
||||
programdata_ai: &AccountInfo,
|
||||
) -> ProgramResult {
|
||||
require!(signer.is_signer, PaymentsError::InvalidSigner);
|
||||
require_keys_eq!(*program_ai.key, *program_id, PaymentsError::InvalidUpgradeAuthority);
|
||||
require!(
|
||||
program_ai.executable && *program_ai.owner == bpf_loader_upgradeable::id(),
|
||||
PaymentsError::InvalidUpgradeAuthority
|
||||
);
|
||||
let program_data = program_ai.try_borrow_data()?;
|
||||
require!(
|
||||
program_data.len() >= 36 && program_data[0..4] == 2u32.to_le_bytes(),
|
||||
PaymentsError::InvalidUpgradeAuthority
|
||||
);
|
||||
require!(
|
||||
program_data[4..36] == programdata_ai.key.to_bytes(),
|
||||
PaymentsError::InvalidUpgradeAuthority
|
||||
);
|
||||
require!(
|
||||
*programdata_ai.owner == bpf_loader_upgradeable::id(),
|
||||
PaymentsError::InvalidUpgradeAuthority
|
||||
);
|
||||
let programdata = programdata_ai.try_borrow_data()?;
|
||||
require!(
|
||||
programdata.len() >= 45
|
||||
&& programdata[0..4] == 3u32.to_le_bytes()
|
||||
&& programdata[12] == 1
|
||||
&& programdata[13..45] == signer.key.to_bytes(),
|
||||
PaymentsError::InvalidUpgradeAuthority
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn find_single_pda(program_id: &Pubkey, seed: &[u8]) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[seed], program_id)
|
||||
}
|
||||
@@ -1050,7 +1135,7 @@ fn buy_ticket_by_purchase_usd(
|
||||
let coef_limit = read_state::<CoefLimitState>(ctx.coef_limit_pda)?;
|
||||
let mut queues = read_state::<QueuesState>(ctx.queues_pda)?;
|
||||
|
||||
require_keys_eq!(*ctx.dao_wallet.key, config.dao_wallet, PaymentsError::InvalidDaoWallet);
|
||||
require_keys_eq!(*ctx.dao_treasury.key, config.dao_treasury, PaymentsError::InvalidDaoTreasury);
|
||||
// Получатель тикета не должен совпадать с inflow-вольтом: иначе в step_payout
|
||||
// вольт окажется и источником, и получателем перевода (алиасинг одного аккаунта),
|
||||
// второй mutable-займ в transfer_from_vault упадёт, и такой тикет навсегда
|
||||
@@ -1074,7 +1159,7 @@ fn buy_ticket_by_purchase_usd(
|
||||
let payout_usd_cents = checked_mul(purchase_usd_cents, coef_limit.coef_ppm)? / settings::COEF_SCALE_PPM;
|
||||
require!(payout_usd_cents > 0, PaymentsError::InvalidPayoutAmount);
|
||||
|
||||
transfer_from_signer_to_target(ctx.signer, ctx.dao_wallet, ctx.system_program_ai, transfer_lamports)?;
|
||||
transfer_from_signer_to_target(ctx.signer, ctx.dao_treasury, ctx.system_program_ai, transfer_lamports)?;
|
||||
|
||||
let ticket = TicketState {
|
||||
version: 1,
|
||||
@@ -1348,9 +1433,9 @@ fn credit_leaves_rent_exempt(lamports: u64, amount: u64, min_balance: u64) -> bo
|
||||
lamports.saturating_add(amount) >= min_balance
|
||||
}
|
||||
|
||||
fn transfer_all_available_to_dao(vault: &AccountInfo, dao_wallet: &AccountInfo) -> ProgramResult {
|
||||
fn transfer_all_available_to_dao(vault: &AccountInfo, dao_treasury: &AccountInfo) -> ProgramResult {
|
||||
let available = available_vault_lamports(vault)?;
|
||||
transfer_from_vault(vault, dao_wallet, available)
|
||||
transfer_from_vault(vault, dao_treasury, available)
|
||||
}
|
||||
|
||||
fn next_signer_account<'a, 'info>(
|
||||
@@ -1553,4 +1638,86 @@ mod tests {
|
||||
// Награда за шаг выплаты — не больше 10% минимального тикета.
|
||||
assert!(settings::MAX_CALL_REWARD_LAMPORTS * 10 <= settings::MIN_TICKET_PURCHASE_LAMPORTS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_treasury_keeps_existing_binary_layout() {
|
||||
let config = ConfigState {
|
||||
version: 1,
|
||||
dao_treasury: Pubkey::new_from_array([4; 32]),
|
||||
inflow_vault: Pubkey::new_from_array([5; 32]),
|
||||
};
|
||||
let encoded = config.encode();
|
||||
assert_eq!(encoded.len(), ConfigState::encoded_len());
|
||||
assert_eq!(encoded[0], 1);
|
||||
assert_eq!(&encoded[1..33], &[4; 32]);
|
||||
assert_eq!(&encoded[33..65], &[5; 32]);
|
||||
let decoded = ConfigState::decode(&encoded).unwrap();
|
||||
assert_eq!(decoded.dao_treasury, config.dao_treasury);
|
||||
assert_eq!(decoded.inflow_vault, config.inflow_vault);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_dao_treasury_instruction_is_parsed() {
|
||||
let treasury = Pubkey::new_from_array([6; 32]);
|
||||
let mut data = vec![IX_UPDATE_DAO_TREASURY];
|
||||
data.extend_from_slice(treasury.as_ref());
|
||||
match parse_instruction(&data).unwrap() {
|
||||
Instruction::UpdateDaoTreasury(args) => assert_eq!(args.new_treasury, treasury),
|
||||
_ => panic!("ожидалась инструкция update_dao_treasury"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn upgrade_authority_is_read_only_from_own_programdata() {
|
||||
let signer_key = Pubkey::new_from_array([7; 32]);
|
||||
let programdata_key = Pubkey::new_from_array([8; 32]);
|
||||
let loader = bpf_loader_upgradeable::id();
|
||||
let system_owner = system_program::id();
|
||||
|
||||
let mut signer_lamports = 0;
|
||||
let mut signer_data: [u8; 0] = [];
|
||||
let signer = AccountInfo::new(
|
||||
&signer_key,
|
||||
true,
|
||||
false,
|
||||
&mut signer_lamports,
|
||||
&mut signer_data,
|
||||
&system_owner,
|
||||
false,
|
||||
0,
|
||||
);
|
||||
|
||||
let mut program_lamports = 0;
|
||||
let mut program_data = vec![0; 36];
|
||||
program_data[..4].copy_from_slice(&2u32.to_le_bytes());
|
||||
program_data[4..36].copy_from_slice(programdata_key.as_ref());
|
||||
let program = AccountInfo::new(
|
||||
&ID,
|
||||
false,
|
||||
false,
|
||||
&mut program_lamports,
|
||||
&mut program_data,
|
||||
&loader,
|
||||
true,
|
||||
0,
|
||||
);
|
||||
|
||||
let mut programdata_lamports = 0;
|
||||
let mut programdata_data = vec![0; 45];
|
||||
programdata_data[..4].copy_from_slice(&3u32.to_le_bytes());
|
||||
programdata_data[12] = 1;
|
||||
programdata_data[13..45].copy_from_slice(signer_key.as_ref());
|
||||
let programdata = AccountInfo::new(
|
||||
&programdata_key,
|
||||
false,
|
||||
false,
|
||||
&mut programdata_lamports,
|
||||
&mut programdata_data,
|
||||
&loader,
|
||||
false,
|
||||
0,
|
||||
);
|
||||
|
||||
assert!(validate_upgrade_authority(&ID, &signer, &program, &programdata).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,5 +112,7 @@ pub const RESERVED_RECIPIENTS: &[Pubkey] = &[
|
||||
pubkey!("SHiGxGsXGioQYCYhchQ5R7KWoxN5UjFAFsucPf6sfnh"),
|
||||
];
|
||||
|
||||
/// `DAO_WALLET` — адрес кошелька DAO-казны для `shine_payments`.
|
||||
pub const DAO_WALLET: &str = "aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq";
|
||||
/// `DEFAULT_DAO_TREASURY` — адрес native treasury основного DAO. Он записывается
|
||||
/// в новый Config PDA при публичном `init`; для каждого кластера его можно заменить
|
||||
/// отдельной инструкцией, подписанной текущей upgrade authority программы.
|
||||
pub const DEFAULT_DAO_TREASURY: &str = "AcJRevXj3Yux2ecxXromMwwxEpPBz6AN53hH6KdqWJ9A";
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<div class="panel">
|
||||
<h3>Коэффициент, лимит и награда шага выплат</h3>
|
||||
<div class="muted">Право изменения: <code id="daoAllowed">загрузка...</code></div>
|
||||
<div class="muted">Право изменения: текущая upgrade authority <code id="upgradeAuthority">загрузка...</code></div>
|
||||
<div class="row">
|
||||
<label>Коэффициент (например 5): <input id="coefInput" value="5" /></label>
|
||||
<label>Лимит (USD): <input id="limitInput" value="10000" /></label>
|
||||
@@ -71,6 +71,16 @@
|
||||
<div id="updateResult" class="muted"></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>Казна DAO</h3>
|
||||
<div class="muted">Получатель покупок тикетов, DAO-доли выплат и остатка inflow vault. Менять адрес может только текущая upgrade authority.</div>
|
||||
<div class="row">
|
||||
<label>Адрес native treasury: <input id="daoTreasuryInput" placeholder="Base58" /></label>
|
||||
<button id="updateTreasuryBtn">Обновить казну</button>
|
||||
</div>
|
||||
<div id="updateTreasuryResult" class="muted"></div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>Shine Users: экономические параметры</h3>
|
||||
<div class="muted">Право изменения: <code id="usersDaoAllowed">загрузка...</code></div>
|
||||
@@ -124,7 +134,7 @@
|
||||
ticketQ2: "shine_payments_q2_ticket",
|
||||
ticketQ3: "shine_payments_q3_ticket",
|
||||
};
|
||||
const IX = { init: 1, updateCoefLimit: 2 };
|
||||
const IX = { init: 1, updateCoefLimit: 2, updateDaoTreasury: 10 };
|
||||
const USERS_IX = { initUsersEconomyConfig: 1, updateUsersEconomyConfig: 2 };
|
||||
const USERS_SEEDS = {
|
||||
economyConfig: "shine_users_v1_economy_config",
|
||||
@@ -175,10 +185,6 @@
|
||||
function ixData(tag, ...parts) {
|
||||
return concat(new Uint8Array([tag]), ...parts);
|
||||
}
|
||||
function isUnauthorizedDao(msg) {
|
||||
const s = String(msg || "").toLowerCase();
|
||||
return s.includes("unauthorizeddao") || s.includes("0x1775");
|
||||
}
|
||||
function isUsersDaoUnauthorized(msg) {
|
||||
const s = String(msg || "").toLowerCase();
|
||||
return s.includes("invalidsigner") || s.includes("0x3ed");
|
||||
@@ -187,9 +193,9 @@
|
||||
function parseConfig(data) {
|
||||
let o = 0;
|
||||
const version = data[o++];
|
||||
const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
return { version, dao, inflow };
|
||||
return { version, daoTreasury, inflow };
|
||||
}
|
||||
function parseCoef(data) {
|
||||
let o = 0;
|
||||
@@ -289,6 +295,22 @@
|
||||
return pda;
|
||||
}
|
||||
|
||||
async function loadPaymentsProgramControl() {
|
||||
const programAi = await connection.getAccountInfo(PROGRAM_ID, "confirmed");
|
||||
if (!programAi || !programAi.executable || programAi.data.length < 36) {
|
||||
throw new Error("Не удалось прочитать ProgramData shine_payments");
|
||||
}
|
||||
const programData = new solanaWeb3.PublicKey(programAi.data.slice(4, 36));
|
||||
const programDataAi = await connection.getAccountInfo(programData, "confirmed");
|
||||
if (!programDataAi || programDataAi.data.length < 45 || programDataAi.data[12] !== 1) {
|
||||
throw new Error("У программы нет доступной upgrade authority");
|
||||
}
|
||||
return {
|
||||
programData,
|
||||
upgradeAuthority: new solanaWeb3.PublicKey(programDataAi.data.slice(13, 45)),
|
||||
};
|
||||
}
|
||||
|
||||
async function loadCore() {
|
||||
const pdas = derivePdas();
|
||||
const [cfgAi, coefAi, qAi, inflowAi] = await Promise.all([
|
||||
@@ -305,7 +327,7 @@
|
||||
const coef = parseCoef(coefAi.data);
|
||||
const queues = parseQueues(qAi.data);
|
||||
const [daoBal, inflowRent] = await Promise.all([
|
||||
connection.getBalance(config.dao, "confirmed"),
|
||||
connection.getBalance(config.daoTreasury, "confirmed"),
|
||||
connection.getMinimumBalanceForRentExemption(inflowAi.data.length, "confirmed"),
|
||||
]);
|
||||
cache = {
|
||||
@@ -327,10 +349,12 @@
|
||||
}
|
||||
const coefText = trimZeros((Number(core.coef.coefPpm) / 1_000_000).toFixed(6));
|
||||
const limitRemain = core.coef.limitUsdCents > core.queues.q1SumTotal ? (core.coef.limitUsdCents - core.queues.q1SumTotal) : 0n;
|
||||
document.getElementById("daoAllowed").textContent = core.config.dao.toBase58();
|
||||
const control = await loadPaymentsProgramControl();
|
||||
document.getElementById("upgradeAuthority").textContent = control.upgradeAuthority.toBase58();
|
||||
document.getElementById("daoTreasuryInput").value = core.config.daoTreasury.toBase58();
|
||||
el.innerHTML = `
|
||||
<div>DAO: <code>${core.config.dao.toBase58()}</code></div>
|
||||
<div class="muted">Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.</div>
|
||||
<div>Казна DAO: <code>${core.config.daoTreasury.toBase58()}</code></div>
|
||||
<div>Upgrade authority: <code>${control.upgradeAuthority.toBase58()}</code></div>
|
||||
<div>Inflow vault: <code>${core.config.inflow.toBase58()}</code></div>
|
||||
<div class="muted">Inflow vault — входящий PDA-кошелек выплат программы.</div>
|
||||
<div>Награда за шаг: <b>${lamportsToSolStr(core.coef.reward)} SOL</b></div>
|
||||
@@ -345,7 +369,7 @@
|
||||
`;
|
||||
} catch (e) {
|
||||
el.innerHTML = `<span class="err">${String(e.message || e)}</span>`;
|
||||
document.getElementById("daoAllowed").textContent = "не определен";
|
||||
document.getElementById("upgradeAuthority").textContent = "не определена";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,23 +443,50 @@
|
||||
if (rewardLamports > MAX_REWARD_LAMPORTS) throw new Error("Награда не должна быть больше 0.01 SOL");
|
||||
|
||||
const data = ixData(IX.updateCoefLimit, u64ToBytes(coefPpm), u64ToBytes(limitUsdCents), u64ToBytes(rewardLamports));
|
||||
const control = await loadPaymentsProgramControl();
|
||||
const keys = [
|
||||
{ pubkey: walletPubkey, isSigner: true, isWritable: true },
|
||||
{ pubkey: core.pdas.configPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: core.pdas.configPda, isSigner: false, isWritable: false },
|
||||
{ pubkey: core.pdas.coefPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false },
|
||||
{ pubkey: control.programData, isSigner: false, isWritable: false },
|
||||
];
|
||||
const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data });
|
||||
const sig = await sendInstruction(ix);
|
||||
out.innerHTML = `<span class="ok">Обновлено. Tx: <code>${sig}</code></span>`;
|
||||
await refreshAll();
|
||||
} catch (e) {
|
||||
const raw = String(e.message || e);
|
||||
if (isUnauthorizedDao(raw)) {
|
||||
const dao = document.getElementById("daoAllowed").textContent;
|
||||
out.innerHTML = `<span class="warn">Вы подключены не под тем аккаунтом. Изменение доступно только DAO-кошельку: <code>${dao}</code>.</span>`;
|
||||
return;
|
||||
}
|
||||
out.innerHTML = `<span class="err">${raw}</span>`;
|
||||
out.innerHTML = `<span class="err">${String(e.message || e)}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
async function updateDaoTreasury() {
|
||||
const out = document.getElementById("updateTreasuryResult");
|
||||
out.textContent = "";
|
||||
try {
|
||||
const provider = getProvider();
|
||||
if (!walletPubkey) await connectWallet();
|
||||
else if (!provider.isConnected) await provider.connect();
|
||||
const core = await loadCore();
|
||||
if (core.notInited) throw new Error("Сначала выполните init");
|
||||
const newTreasury = new solanaWeb3.PublicKey(document.getElementById("daoTreasuryInput").value.trim());
|
||||
const control = await loadPaymentsProgramControl();
|
||||
const keys = [
|
||||
{ pubkey: walletPubkey, isSigner: true, isWritable: true },
|
||||
{ pubkey: core.pdas.configPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false },
|
||||
{ pubkey: control.programData, isSigner: false, isWritable: false },
|
||||
];
|
||||
const ix = new solanaWeb3.TransactionInstruction({
|
||||
programId: PROGRAM_ID,
|
||||
keys,
|
||||
data: ixData(IX.updateDaoTreasury, newTreasury.toBytes()),
|
||||
});
|
||||
const sig = await sendInstruction(ix);
|
||||
out.innerHTML = `<span class="ok">Казна обновлена. Tx: <code>${sig}</code></span>`;
|
||||
await refreshAll();
|
||||
} catch (e) {
|
||||
out.innerHTML = `<span class="err">${String(e.message || e)}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,6 +620,7 @@
|
||||
document.getElementById("refreshBtn").addEventListener("click", refreshAll);
|
||||
document.getElementById("initBtn").addEventListener("click", runInit);
|
||||
document.getElementById("updateCoefBtn").addEventListener("click", updateCoefLimit);
|
||||
document.getElementById("updateTreasuryBtn").addEventListener("click", updateDaoTreasury);
|
||||
document.getElementById("usersInitBtn").addEventListener("click", initUsersEconomy);
|
||||
document.getElementById("usersUpdateBtn").addEventListener("click", updateUsersEconomy);
|
||||
document.getElementById("loadQ1Btn").addEventListener("click", () => showQueue(1));
|
||||
|
||||
@@ -188,9 +188,9 @@
|
||||
function parseConfig(data) {
|
||||
let o = 0;
|
||||
const version = data[o++];
|
||||
const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32;
|
||||
const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32;
|
||||
const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)).toBase58(); o += 32;
|
||||
return { version, dao, inflow };
|
||||
return { version, daoTreasury, inflow };
|
||||
}
|
||||
function parseCoef(data) {
|
||||
let o = 0;
|
||||
@@ -335,9 +335,9 @@
|
||||
const remainingByTotal = coef.limitUsdCents > queues.q1SumTotal ? (coef.limitUsdCents - queues.q1SumTotal) : 0n;
|
||||
const paused = queues.q1SumTotal >= coef.limitUsdCents;
|
||||
el.innerHTML = `
|
||||
<div>DAO: <code>${config.dao}</code></div>
|
||||
<div>Казна DAO: <code>${config.daoTreasury}</code></div>
|
||||
<div>Inflow vault: <code>${config.inflow}</code></div>
|
||||
<div class="muted">Тестовый DAO-кошелек. В production будет реальный адрес DAO.</div>
|
||||
<div class="muted">Адрес берётся из Config PDA текущего кластера.</div>
|
||||
<div>Курс SOL/USD (Pyth): <b>${trimZeros((Number(pyth.num) / Number(pyth.den) / 100).toFixed(6))}</b></div>
|
||||
<div>Коэффициент: <b>${coefText}</b></div>
|
||||
<div>Лимит очереди 1: <b>${centsToUsdStr(coef.limitUsdCents)} USD</b></div>
|
||||
@@ -382,7 +382,7 @@
|
||||
{ pubkey: pdas.coefPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: pdas.queuesPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: ticketPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: new solanaWeb3.PublicKey(config.dao), isSigner: false, isWritable: true },
|
||||
{ pubkey: new solanaWeb3.PublicKey(config.daoTreasury), isSigner: false, isWritable: true },
|
||||
{ pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false },
|
||||
{ pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false },
|
||||
];
|
||||
@@ -422,7 +422,7 @@
|
||||
{ pubkey: pdas.coefPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: pdas.queuesPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: ticketPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: new solanaWeb3.PublicKey(config.dao), isSigner: false, isWritable: true },
|
||||
{ pubkey: new solanaWeb3.PublicKey(config.daoTreasury), isSigner: false, isWritable: true },
|
||||
{ pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false },
|
||||
{ pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false },
|
||||
];
|
||||
|
||||
@@ -43,11 +43,7 @@
|
||||
<div class="muted">Программа: <code id="programId"></code></div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="warn">
|
||||
Пока реального DAO-голосования нет: роль DAO выполняет тестовый кошелек
|
||||
<code>aiShm43fZjm3YkMs22sYL1bpXaL3bVxv7SSraPHzVgq</code>.<br />
|
||||
Позже это заменяется на вызов из настоящего DAO-казначейства/голосования.
|
||||
</div>
|
||||
<div class="warn">Лимиты менеджеров выдаёт текущая upgrade authority программы. После передачи upgrade authority governance PDA это действие должно исполняться DAO proposal.</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
@@ -70,6 +66,7 @@
|
||||
<div class="row">
|
||||
<button id="grantBtn">Выдать лимиты</button>
|
||||
</div>
|
||||
<div class="muted">Текущий подключённый кошелёк оплачивает rent нового allowance PDA. При DAO proposal authority и rent payer могут быть разными signer-аккаунтами.</div>
|
||||
<div id="grantResult" class="muted"></div>
|
||||
</div>
|
||||
|
||||
@@ -129,17 +126,12 @@
|
||||
function ixData(tag, ...parts) {
|
||||
return concat(new Uint8Array([tag]), ...parts);
|
||||
}
|
||||
function isUnauthorizedDao(msg) {
|
||||
const s = String(msg || "").toLowerCase();
|
||||
return s.includes("unauthorizeddao");
|
||||
}
|
||||
|
||||
function parseConfig(data) {
|
||||
let o = 0;
|
||||
const version = data[o++];
|
||||
const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
return { version, dao, inflow };
|
||||
return { version, daoTreasury, inflow };
|
||||
}
|
||||
function parseManagerAllowance(data) {
|
||||
let o = 0;
|
||||
@@ -190,6 +182,22 @@
|
||||
return pda;
|
||||
}
|
||||
|
||||
async function loadPaymentsProgramControl() {
|
||||
const programAi = await connection.getAccountInfo(PROGRAM_ID, "confirmed");
|
||||
if (!programAi || !programAi.executable || programAi.data.length < 36) {
|
||||
throw new Error("Не удалось прочитать ProgramData shine_payments");
|
||||
}
|
||||
const programData = new solanaWeb3.PublicKey(programAi.data.slice(4, 36));
|
||||
const programDataAi = await connection.getAccountInfo(programData, "confirmed");
|
||||
if (!programDataAi || programDataAi.data.length < 45 || programDataAi.data[12] !== 1) {
|
||||
throw new Error("У программы нет доступной upgrade authority");
|
||||
}
|
||||
return {
|
||||
programData,
|
||||
upgradeAuthority: new solanaWeb3.PublicKey(programDataAi.data.slice(13, 45)),
|
||||
};
|
||||
}
|
||||
|
||||
async function loadConfig() {
|
||||
const configPda = deriveConfigPda();
|
||||
const ai = await connection.getAccountInfo(configPda, "confirmed");
|
||||
@@ -201,10 +209,11 @@
|
||||
async function refresh() {
|
||||
const el = document.getElementById("daoInfo");
|
||||
try {
|
||||
const { config } = await loadConfig();
|
||||
const [{ config }, control] = await Promise.all([loadConfig(), loadPaymentsProgramControl()]);
|
||||
el.innerHTML = `
|
||||
<div>DAO-кошелек: <code>${config.dao.toBase58()}</code></div>
|
||||
<div class="muted">Выдавать лимиты может только этот кошелек.</div>
|
||||
<div>Казна DAO: <code>${config.daoTreasury.toBase58()}</code></div>
|
||||
<div>Upgrade authority: <code>${control.upgradeAuthority.toBase58()}</code></div>
|
||||
<div class="muted">Выдавать лимиты может только upgrade authority через прямую подпись или DAO proposal.</div>
|
||||
`;
|
||||
} catch (e) {
|
||||
el.innerHTML = `<span class="err">${String(e.message || e)}</span>`;
|
||||
@@ -228,23 +237,21 @@
|
||||
|
||||
const allowancePda = deriveManagerAllowancePda(manager);
|
||||
const data = ixData(IX.grantManagerLimits, manager.toBytes(), u64ToBytes(addQ1), u64ToBytes(addQ2), u64ToBytes(addQ3));
|
||||
const control = await loadPaymentsProgramControl();
|
||||
const keys = [
|
||||
{ pubkey: walletPubkey, isSigner: true, isWritable: true },
|
||||
{ pubkey: configPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: walletPubkey, isSigner: true, isWritable: true },
|
||||
{ pubkey: configPda, isSigner: false, isWritable: false },
|
||||
{ pubkey: allowancePda, isSigner: false, isWritable: true },
|
||||
{ pubkey: solanaWeb3.SystemProgram.programId, isSigner: false, isWritable: false },
|
||||
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false },
|
||||
{ pubkey: control.programData, isSigner: false, isWritable: false },
|
||||
];
|
||||
const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data });
|
||||
const sig = await sendInstruction(ix);
|
||||
out.innerHTML = `<span class="ok">Лимиты выданы. Tx: <code>${sig}</code></span>`;
|
||||
} catch (e) {
|
||||
const raw = String(e.message || e);
|
||||
if (isUnauthorizedDao(raw)) {
|
||||
const dao = configCache?.config?.dao?.toBase58?.() || "не определен";
|
||||
out.innerHTML = `<span class="warn">Вы подключены не под DAO-кошельком. Нужен: <code>${dao}</code>.</span>`;
|
||||
return;
|
||||
}
|
||||
out.innerHTML = `<span class="err">${raw}</span>`;
|
||||
out.innerHTML = `<span class="err">${String(e.message || e)}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,9 +165,9 @@
|
||||
function parseConfig(data) {
|
||||
let o = 0;
|
||||
const version = data[o++];
|
||||
const dao = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const daoTreasury = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
const inflow = new solanaWeb3.PublicKey(data.slice(o, o + 32)); o += 32;
|
||||
return { version, dao, inflow };
|
||||
return { version, daoTreasury, inflow };
|
||||
}
|
||||
function parseCoef(data) {
|
||||
let o = 0;
|
||||
@@ -298,8 +298,8 @@
|
||||
if (queue === 0) {
|
||||
el.innerHTML = `
|
||||
<div>Курс SOL/USD (Pyth): <b>${trimZeros((Number(core.pyth.num) / Number(core.pyth.den) / 100).toFixed(6))}</b>, возраст <b>${pythAge} сек</b></div>
|
||||
<div>DAO: <code>${core.config.dao.toBase58()}</code></div>
|
||||
<div class="muted">Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.</div>
|
||||
<div>Казна DAO: <code>${core.config.daoTreasury.toBase58()}</code></div>
|
||||
<div class="muted">Адрес берётся из Config PDA текущего кластера.</div>
|
||||
<div>Все очереди пусты/полностью выплачены.</div>
|
||||
<div>На inflow vault доступно (сверх ренты): <b>${lamportsToSolStr(core.available)} SOL</b></div>
|
||||
<div class="warn">При шаге эта сумма уйдет в DAO, награда не начисляется.</div>
|
||||
@@ -321,8 +321,8 @@
|
||||
const missing = core.available >= need ? 0n : (need - core.available);
|
||||
el.innerHTML = `
|
||||
<div>Курс SOL/USD (Pyth): <b>${trimZeros((Number(core.pyth.num) / Number(core.pyth.den) / 100).toFixed(6))}</b>, возраст <b>${pythAge} сек</b></div>
|
||||
<div>DAO: <code>${core.config.dao.toBase58()}</code></div>
|
||||
<div class="muted">Сейчас это тестовый DAO-кошелек. В production здесь будет адрес реального DAO.</div>
|
||||
<div>Казна DAO: <code>${core.config.daoTreasury.toBase58()}</code></div>
|
||||
<div class="muted">Адрес берётся из Config PDA текущего кластера.</div>
|
||||
<div>Следующий шаг выплат: <b>очередь ${queue}</b></div>
|
||||
<div>Следующий тикет: <b>#${next.index.toString()}</b></div>
|
||||
<div>Тикет: <b>${centsToUsdStr(next.payoutUsdCents)} USD</b> (~${usdCentsToSolStr(next.payoutUsdCents, core.pyth)} SOL)</div>
|
||||
@@ -483,7 +483,7 @@
|
||||
{ pubkey: core.config.inflow, isSigner: false, isWritable: true },
|
||||
{ pubkey: nextTicketPda, isSigner: false, isWritable: true },
|
||||
{ pubkey: recipient, isSigner: false, isWritable: true },
|
||||
{ pubkey: core.config.dao, isSigner: false, isWritable: true },
|
||||
{ pubkey: core.config.daoTreasury, isSigner: false, isWritable: true },
|
||||
{ pubkey: ORACLE_ACCOUNT, isSigner: false, isWritable: false },
|
||||
];
|
||||
const ix = new solanaWeb3.TransactionInstruction({ programId: PROGRAM_ID, keys, data });
|
||||
|
||||
Reference in New Issue
Block a user