Skip to content

Commit

Permalink
Merge branch 'main' into ton-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
cctdaniel committed Oct 16, 2024
2 parents 5ad83ce + c7d5cf0 commit 6e0eca5
Show file tree
Hide file tree
Showing 24 changed files with 669 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci-ethereum-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
working-directory: target_chains/ethereum/contracts/
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version-file: "package.json"

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down
2 changes: 1 addition & 1 deletion apps/price_pusher/config.fuel.testnet.sample.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"endpoint": "https://testnet.fuel.network/v1/graphql",
"pyth-contract-address": "0xe31e04946c67fb41923f93d50ee7fc1c6c99d6e07c02860c6bea5f4a13919277",
"pyth-contract-address": "0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7",
"price-service-endpoint": "https://hermes.pyth.network",
"private-key-file": "./mnemonic",
"price-config-file": "./price-config.stable.sample.yaml"
Expand Down
2 changes: 1 addition & 1 deletion apps/staking/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,5 +427,5 @@ export const optPublisherOut = async (
stakeAccount: PublicKey,
publisherKey: PublicKey,
): Promise<void> => {
await client.removePublisherStakeAccount(stakeAccount, publisherKey);
await client.removePublisherStakeAccount(publisherKey, stakeAccount);
};
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ const PublisherIdentity = ({
<span className={clsx(className, withNameClassName)}>
<span>
{createElement(props.children.identity.icon, {
className: "mr-2 inline-block size-[20px] align-sub",
className: "mr-2 inline-block h-[20px] align-sub",
})}
<span className="mr-[0.5em]">{props.children.identity.name}</span>
</span>
Expand Down
5 changes: 5 additions & 0 deletions apps/staking/src/known-publishers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import blocksize from "./publisher-icons/blocksize.svg";
import elfomo from "./publisher-icons/elfomo.svg";
import finazon from "./publisher-icons/finazon.svg";
import sentio from "./publisher-icons/sentio.svg";

Expand All @@ -15,4 +16,8 @@ export const KNOWN_PUBLISHERS = {
name: "Finazon",
icon: finazon,
},
"5giNPEh9PytXcnKNgufofmQPdS4jHoySgFpiu8f7QxP4": {
name: "Elfomo",
icon: elfomo,
},
};
3 changes: 3 additions & 0 deletions apps/staking/src/publisher-icons/elfomo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 20 additions & 13 deletions governance/xc_admin/packages/xc_admin_cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
PROGRAM_AUTHORITY_ESCROW,
createDetermisticPriceStoreInitializePublisherInstruction,
createPriceStoreInstruction,
fetchStakeAccounts,
findDetermisticStakeAccountAddress,
getMultisigCluster,
getProposalInstructions,
Expand All @@ -59,6 +60,7 @@ import {
DEFAULT_PRIORITY_FEE_CONFIG,
TransactionBuilder,
} from "@pythnetwork/solana-utils";
import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

export async function loadHotWalletOrLedger(
wallet: string,
Expand Down Expand Up @@ -389,8 +391,8 @@ multisigCommand(
"Deactivate the delegated stake from the account"
)
.requiredOption(
"-s, --stake-accounts <comma_separated_stake_account>",
"stake accounts to be deactivated"
"-d, --vote-pubkeys <comma_separated_voter_pubkeys>",
"vote account unstake from"
)
.action(async (options: any) => {
const vault = await loadVaultFromOptions(options);
Expand All @@ -399,20 +401,25 @@ multisigCommand(
cluster
);

const stakeAccounts = options.stakeAccounts
? options.stakeAccounts.split(",").map((m: string) => new PublicKey(m))
const voteAccounts: PublicKey[] = options.votePubkeys
? options.votePubkeys.split(",").map((m: string) => new PublicKey(m))
: [];

const instructions = stakeAccounts.reduce(
(instructions: TransactionInstruction[], stakeAccount: PublicKey) => {
const transaction = StakeProgram.deactivate({
stakePubkey: stakeAccount,
authorizedPubkey,
});
const stakeAccounts = (
await Promise.all(
voteAccounts.map((voteAccount: PublicKey) =>
fetchStakeAccounts(
new Connection(getPythClusterApiUrl(cluster)),
voteAccount
)
)
)
).flat();

return instructions.concat(transaction.instructions);
},
[]
const instructions = stakeAccounts.flatMap(
(stakeAccount) =>
StakeProgram.deactivate({ stakePubkey: stakeAccount, authorizedPubkey })
.instructions
);

await vault.proposeInstructions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { TransactionInstruction } from "@solana/web3.js";
import {
Connection,
PublicKey,
StakeProgram,
TransactionInstruction,
} from "@solana/web3.js";
import {
MultisigInstruction,
MultisigInstructionProgram,
UNRECOGNIZED_INSTRUCTION,
} from ".";
import { AnchorAccounts } from "./anchor";
import { StakeInstruction } from "@solana/web3.js";
import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

export class SolanaStakingMultisigInstruction implements MultisigInstruction {
readonly program = MultisigInstructionProgram.SolanaStakingProgram;
Expand Down Expand Up @@ -115,3 +121,31 @@ export class SolanaStakingMultisigInstruction implements MultisigInstruction {
}
}
}

export async function fetchStakeAccounts(
connection: Connection,
voterAccount: PublicKey
) {
const stakeAccounts = await connection.getProgramAccounts(
StakeProgram.programId,
{
encoding: "base64",
filters: [
{
memcmp: {
offset: 0,
bytes: bs58.encode(Buffer.from([2, 0, 0, 0])),
},
},
{
memcmp: {
offset: 124,
bytes: voterAccount.toBase58(),
},
},
],
}
);

return stakeAccounts.map((account) => account.pubkey);
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,7 @@ export { PythMultisigInstruction } from "./PythMultisigInstruction";
export { AnchorMultisigInstruction } from "./MessageBufferMultisigInstruction";
export { SystemProgramMultisigInstruction } from "./SystemProgramInstruction";
export { BpfUpgradableLoaderInstruction } from "./BpfUpgradableLoaderMultisigInstruction";
export { SolanaStakingMultisigInstruction } from "./SolanaStakingMultisigInstruction";
export {
SolanaStakingMultisigInstruction,
fetchStakeAccounts,
} from "./SolanaStakingMultisigInstruction";
Loading

0 comments on commit 6e0eca5

Please sign in to comment.