mirror of https://github.com/certusone/oyster.git
Merge pull request #84 from SebastianBor/feat/check-upgrade-authority-when-governance-created
Governance: Pass program data account and upgrade authority accounts
This commit is contained in:
commit
9d30c4b12e
|
@ -127,10 +127,17 @@ export const registerProgramGovernance = async (
|
||||||
PROGRAM_IDS.timelock.programId,
|
PROGRAM_IDS.timelock.programId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [programDataAccount] = await PublicKey.findProgramAddress(
|
||||||
|
[uninitializedTimelockConfig.program.toBuffer()],
|
||||||
|
PROGRAM_IDS.bpf_upgrade_loader,
|
||||||
|
);
|
||||||
|
|
||||||
instructions.push(
|
instructions.push(
|
||||||
createEmptyTimelockConfigInstruction(
|
createEmptyTimelockConfigInstruction(
|
||||||
timelockConfigKey,
|
timelockConfigKey,
|
||||||
uninitializedTimelockConfig.program,
|
uninitializedTimelockConfig.program,
|
||||||
|
programDataAccount,
|
||||||
|
wallet.publicKey,
|
||||||
uninitializedTimelockConfig.governanceMint,
|
uninitializedTimelockConfig.governanceMint,
|
||||||
wallet.publicKey,
|
wallet.publicKey,
|
||||||
uninitializedTimelockConfig.councilMint,
|
uninitializedTimelockConfig.councilMint,
|
||||||
|
|
|
@ -20,6 +20,8 @@ import * as Layout from '../utils/layout';
|
||||||
export const createEmptyTimelockConfigInstruction = (
|
export const createEmptyTimelockConfigInstruction = (
|
||||||
timelockConfigAccount: PublicKey,
|
timelockConfigAccount: PublicKey,
|
||||||
programAccount: PublicKey,
|
programAccount: PublicKey,
|
||||||
|
programDataAccount: PublicKey,
|
||||||
|
programUpgradeAuthority: PublicKey,
|
||||||
governanceMint: PublicKey,
|
governanceMint: PublicKey,
|
||||||
payer: PublicKey,
|
payer: PublicKey,
|
||||||
councilMint?: PublicKey,
|
councilMint?: PublicKey,
|
||||||
|
@ -40,15 +42,16 @@ export const createEmptyTimelockConfigInstruction = (
|
||||||
const keys = [
|
const keys = [
|
||||||
{ pubkey: timelockConfigAccount, isSigner: false, isWritable: false },
|
{ pubkey: timelockConfigAccount, isSigner: false, isWritable: false },
|
||||||
{ pubkey: programAccount, isSigner: false, isWritable: false },
|
{ pubkey: programAccount, isSigner: false, isWritable: false },
|
||||||
|
{ pubkey: programDataAccount, isSigner: false, isWritable: true },
|
||||||
|
{ pubkey: programUpgradeAuthority, isSigner: true, isWritable: false },
|
||||||
{ pubkey: governanceMint, isSigner: false, isWritable: false },
|
{ pubkey: governanceMint, isSigner: false, isWritable: false },
|
||||||
{ pubkey: payer, isSigner: true, isWritable: false },
|
{ pubkey: payer, isSigner: true, isWritable: false },
|
||||||
|
{ pubkey: PROGRAM_IDS.system, isSigner: false, isWritable: false },
|
||||||
{
|
{
|
||||||
pubkey: PROGRAM_IDS.timelock.programId,
|
pubkey: PROGRAM_IDS.bpf_upgrade_loader,
|
||||||
isSigner: false,
|
isSigner: false,
|
||||||
isWritable: false,
|
isWritable: false,
|
||||||
},
|
},
|
||||||
{ pubkey: PROGRAM_IDS.system, isSigner: false, isWritable: false },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (councilMint) {
|
if (councilMint) {
|
||||||
|
|
Loading…
Reference in New Issue