Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SystemProgram,
TransactionInstruction,
} from "@solana/web3.js";
import { OPS_KEY } from "./multisig";
import { PRICE_FEED_OPS_KEY } from "./multisig";

/**
* Get seed for deterministic creation of a price/product account
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function findDetermisticAccountAddress(
): Promise<[PublicKey, string]> {
const seed: string = getSeed(type, symbol);
const address: PublicKey = await PublicKey.createWithSeed(
OPS_KEY,
PRICE_FEED_OPS_KEY,
seed,
getPythProgramKeyForCluster(cluster)
);
Expand Down
44 changes: 42 additions & 2 deletions governance/xc_admin/packages/xc_admin_common/src/multisig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PublicKey } from "@solana/web3.js";
import { Cluster, PublicKey } from "@solana/web3.js";
import Squads, {
DEFAULT_MULTISIG_PROGRAM_ID,
getIxPDA,
Expand All @@ -8,13 +8,53 @@ import { InstructionAccount, TransactionAccount } from "@sqds/mesh/lib/types";
import BN from "bn.js";
import lodash from "lodash";

/**
* Address of the upgrade multisig
*/
export const UPGRADE_MULTISIG: Record<Cluster | "localnet", PublicKey> = {
"mainnet-beta": new PublicKey("FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"),
testnet: new PublicKey("FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"),
devnet: new PublicKey("6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3"),
localnet: new PublicKey("FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"),
};

/**
* Address of the price feed multisig
*/
export const PRICE_FEED_MULTISIG: Record<Cluster | "localnet", PublicKey> = {
"mainnet-beta": new PublicKey("92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8"),
testnet: new PublicKey("92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8"),
devnet: new PublicKey("92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8"),
localnet: new PublicKey("92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8"),
};

/**
* Address of the ops key (same on all networks)
*/
export const OPS_KEY = new PublicKey(
export const PRICE_FEED_OPS_KEY = new PublicKey(
"ACzP6RC98vcBk9oTeAwcH1o5HJvtBzU59b5nqdwc7Cxy"
);

export const UPGRADE_OPS_KEY = new PublicKey(
"opsLibxVY7Vz5eYMmSfX8cLFCFVYTtH6fr6MiifMpA7"
);

export function getOpsKey(vault: PublicKey): PublicKey {
if (
Object.values(PRICE_FEED_MULTISIG).some((pubkey) => {
return pubkey.equals(vault);
})
)
return PRICE_FEED_OPS_KEY;
else if (
Object.values(UPGRADE_MULTISIG).some((pubkey) => {
return pubkey.equals(vault);
})
)
return UPGRADE_OPS_KEY;
else throw new Error("Unrecognized multisig vault");
}

/**
* Find all proposals for vault `vault` using Squads client `squad`
* @param squad Squads client
Expand Down
12 changes: 9 additions & 3 deletions governance/xc_admin/packages/xc_admin_common/src/propose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
deriveFeeCollectorKey,
} from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole";
import { ExecutePostedVaa } from "./governance_payload/ExecutePostedVaa";
import { OPS_KEY } from "./multisig";
import { getOpsKey, PRICE_FEED_OPS_KEY } from "./multisig";

export const MAX_EXECUTOR_PAYLOAD_SIZE = PACKET_DATA_SIZE - 687; // Bigger payloads won't fit in one addInstruction call when adding to the proposal
export const SIZE_OF_SIGNED_BATCH = 30;
Expand Down Expand Up @@ -311,7 +311,12 @@ export async function wrapAsRemoteInstruction(

const buffer: Buffer = new ExecutePostedVaa("pythnet", instructions).encode();

const accounts = getPostMessageAccounts(wormholeAddress, emitter, messagePDA);
const accounts = getPostMessageAccounts(
wormholeAddress,
emitter,
getOpsKey(vault),
messagePDA
);

return {
instruction: await wormholeProgram.methods
Expand All @@ -326,14 +331,15 @@ export async function wrapAsRemoteInstruction(
function getPostMessageAccounts(
wormholeAddress: PublicKey,
emitter: PublicKey,
payer: PublicKey,
message: PublicKey
) {
return {
bridge: deriveWormholeBridgeDataKey(wormholeAddress),
message,
emitter,
sequence: deriveEmitterSequenceKey(emitter, wormholeAddress),
payer: OPS_KEY,
payer,
feeCollector: deriveFeeCollectorKey(wormholeAddress),
clock: SYSVAR_CLOCK_PUBKEY,
rent: SYSVAR_RENT_PUBKEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
getMultisigCluster,
isRemoteCluster,
mapKey,
PRICE_FEED_MULTISIG,
proposeInstructions,
WORMHOLE_ADDRESS,
} from 'xc_admin_common'
import { ClusterContext } from '../contexts/ClusterContext'
import { usePythContext } from '../contexts/PythContext'
import { PRICE_FEED_MULTISIG } from '../hooks/useMultisig'
import { ProductRawConfig } from '../hooks/usePyth'
import Arrow from '../images/icons/down.inline.svg'
import { capitalizeFirstLetter } from '../utils/capitalizeFirstLetter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
getMultisigCluster,
isRemoteCluster,
mapKey,
PRICE_FEED_MULTISIG,
proposeInstructions,
WORMHOLE_ADDRESS,
} from 'xc_admin_common'
import { ClusterContext } from '../../contexts/ClusterContext'
import { useMultisigContext } from '../../contexts/MultisigContext'
import { usePythContext } from '../../contexts/PythContext'
import { PRICE_FEED_MULTISIG } from '../../hooks/useMultisig'
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
import ClusterSwitch from '../ClusterSwitch'
import Modal from '../common/Modal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
getRemoteCluster,
MultisigInstruction,
MultisigParser,
PRICE_FEED_MULTISIG,
PythMultisigInstruction,
UnrecognizedProgram,
WormholeMultisigInstruction,
Expand All @@ -27,7 +28,6 @@ import { ClusterContext } from '../../contexts/ClusterContext'
import { useMultisigContext } from '../../contexts/MultisigContext'
import { usePythContext } from '../../contexts/PythContext'
import { StatusFilterContext } from '../../contexts/StatusFilterContext'
import { PRICE_FEED_MULTISIG } from '../../hooks/useMultisig'
import VerifiedIcon from '../../images/icons/verified.inline.svg'
import VotedIcon from '../../images/icons/voted.inline.svg'
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import {
mapKey,
proposeInstructions,
WORMHOLE_ADDRESS,
UPGRADE_MULTISIG,
} from 'xc_admin_common'
import { ClusterContext } from '../../contexts/ClusterContext'
import { useMultisigContext } from '../../contexts/MultisigContext'
import { usePythContext } from '../../contexts/PythContext'
import { UPGRADE_MULTISIG } from '../../hooks/useMultisig'
import CopyIcon from '../../images/icons/copy.inline.svg'
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
import ClusterSwitch from '../ClusterSwitch'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,15 @@ import {
isRemoteCluster,
MultisigInstruction,
MultisigParser,
PRICE_FEED_MULTISIG,
PythMultisigInstruction,
UnrecognizedProgram,
UPGRADE_MULTISIG,
WormholeMultisigInstruction,
} from 'xc_admin_common'
import { ClusterContext } from '../contexts/ClusterContext'
import { pythClusterApiUrls } from '../utils/pythClusterApiUrl'

export const UPGRADE_MULTISIG: Record<Cluster | 'localnet', PublicKey> = {
'mainnet-beta': new PublicKey('FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj'),
testnet: new PublicKey('FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj'),
devnet: new PublicKey('6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3'),
localnet: new PublicKey('FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj'),
}

export const PRICE_FEED_MULTISIG: Record<Cluster | 'localnet', PublicKey> = {
'mainnet-beta': new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'),
testnet: new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'),
devnet: new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'),
localnet: new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'),
}

interface MultisigHookData {
isLoading: boolean
error: any // TODO: fix any
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.