소스 검색

chore: last bit of linting and typing yak shaving

benduran 3 주 전
부모
커밋
b38b1aabb5
43개의 변경된 파일569개의 추가작업 그리고 280개의 파일을 삭제
  1. 1 0
      contract_manager/scripts/@types/contractManagerConfig.d.ts
  2. 31 19
      contract_manager/scripts/batchDeployReceivers.ts
  3. 11 8
      contract_manager/scripts/check_proposal.ts
  4. 25 10
      contract_manager/scripts/common.ts
  5. 10 1
      contract_manager/scripts/deploy_cosmwasm.ts
  6. 12 1
      contract_manager/scripts/deploy_evm_contract.ts
  7. 16 9
      contract_manager/scripts/deploy_evm_entropy_contracts.ts
  8. 10 4
      contract_manager/scripts/deploy_evm_executor_contracts.ts
  9. 29 17
      contract_manager/scripts/deploy_evm_lazer_contracts.ts
  10. 17 5
      contract_manager/scripts/deploy_evm_pricefeed_contracts.ts
  11. 15 9
      contract_manager/scripts/deploy_evm_pulse_contracts.ts
  12. 12 5
      contract_manager/scripts/entropy-accept-admin-and-ownership.ts
  13. 13 1
      contract_manager/scripts/entropy_debug_reveal.ts
  14. 23 12
      contract_manager/scripts/execute_vaas.ts
  15. 12 6
      contract_manager/scripts/fetch_account_balance.ts
  16. 11 2
      contract_manager/scripts/fetch_accrued_entropy_dao_fees.ts
  17. 7 1
      contract_manager/scripts/fetch_fees.ts
  18. 6 0
      contract_manager/scripts/generate_evm_lazer_update_trusted_signer_proposal.ts
  19. 8 0
      contract_manager/scripts/generate_governance_set_fee_payload.ts
  20. 11 4
      contract_manager/scripts/generate_upgrade_near_contract_proposal.ts
  21. 14 5
      contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts
  22. 3 0
      contract_manager/scripts/get_entropy_registration.ts
  23. 10 2
      contract_manager/scripts/latency_entropy.ts
  24. 9 2
      contract_manager/scripts/latency_entropy_with_callback.ts
  25. 2 0
      contract_manager/scripts/list_entropy_contracts.ts
  26. 2 0
      contract_manager/scripts/list_evm_contracts.ts
  27. 2 0
      contract_manager/scripts/list_wormhole_contracts.ts
  28. 9 1
      contract_manager/scripts/load_test_entropy.ts
  29. 4 1
      contract_manager/scripts/send_message_to_wormhole.ts
  30. 8 3
      contract_manager/scripts/sync_governance_vaas.ts
  31. 11 2
      contract_manager/scripts/sync_wormhole_guardian_set.ts
  32. 13 5
      contract_manager/scripts/transfer_balance_entropy_chains.ts
  33. 7 2
      contract_manager/scripts/update_all_pricefeeds.ts
  34. 4 1
      contract_manager/scripts/update_pricefeed.ts
  35. 11 5
      contract_manager/scripts/upgrade_evm_entropy_contracts.ts
  36. 10 4
      contract_manager/scripts/upgrade_evm_pricefeed_contracts.ts
  37. 8 2
      contract_manager/scripts/upgrade_ton_contract.ts
  38. 3 0
      contract_manager/scripts/upload_cosmwasm.ts
  39. 10 8
      contract_manager/src/core/base.ts
  40. 61 62
      contract_manager/src/core/chains.ts
  41. 15 12
      contract_manager/src/core/contracts/aptos.ts
  42. 45 32
      contract_manager/src/core/contracts/cosmwasm.ts
  43. 28 17
      contract_manager/src/core/contracts/evm.ts

+ 1 - 0
contract_manager/scripts/@types/contractManagerConfig.d.ts

@@ -0,0 +1 @@
+declare module "*contractManagerConfig.js";

+ 31 - 19
contract_manager/scripts/batchDeployReceivers.ts

@@ -1,3 +1,17 @@
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 /**
  * This script deploys the receiver contracts on all the chains and creates a governance proposal to update the
  * wormhole addresses to the deployed receiver contracts.
@@ -5,19 +19,17 @@
 
 import * as fs from "node:fs";
 
-import {
-  DefaultStore,
-  EvmChain,
-  loadHotWallet,
-  EvmWormholeContract,
-} from "@pythnetwork/contract-manager";
 import { CHAINS } from "@pythnetwork/xc-admin-common";
 import Web3 from "web3";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
-
-import { getDefaultConfig } from "../../target_chains/ethereum/contracts/scripts/contractManagerConfig";
+import { getDefaultConfig } from "../../target_chains/ethereum/contracts/scripts/contractManagerConfig.js";
+import type { PrivateKey } from "../src/core/base.js";
+import { EvmChain } from "../src/core/chains.js";
+import { EvmWormholeContract } from "../src/core/contracts/evm.js";
+import { loadHotWallet } from "../src/node/utils/governance.js";
+import { DefaultStore } from "../src/node/utils/store.js";
 
 const parser = yargs(hideBin(process.argv))
   .usage(
@@ -71,9 +83,7 @@ async function main() {
   const implementationInfo = await import(
     argv.contract + "/ReceiverImplementation.json"
   );
-  const receiverInfo = await import(
-    argv.contract + "/WormholeReceiver.json"
-  );
+  const receiverInfo = await import(argv.contract + "/WormholeReceiver.json");
 
   const payloads: Buffer[] = [];
   for (const chain of Object.values(DefaultStore.chains)) {
@@ -90,14 +100,14 @@ async function main() {
       console.log(chain.getId());
       const address = await memoize(chain.getId(), async () => {
         const setupAddress = await chain.deploy(
-          privateKey,
+          privateKey as PrivateKey,
           setupInfo.abi,
           setupInfo.bytecode,
           [],
         );
         console.log("setupAddress", setupAddress);
         const implementationAddress = await chain.deploy(
-          privateKey,
+          privateKey as PrivateKey,
           implementationInfo.abi,
           implementationInfo.bytecode,
           [],
@@ -117,14 +127,14 @@ async function main() {
 
         // deploy proxy
         const receiverAddress = await chain.deploy(
-          privateKey,
+          privateKey as PrivateKey,
           receiverInfo.abi,
           receiverInfo.bytecode,
           [setupAddress, initData],
         );
         const contract = new EvmWormholeContract(chain, receiverAddress);
         console.log("receiverAddress", receiverAddress);
-        await contract.syncMainnetGuardianSets(privateKey);
+        await contract.syncMainnetGuardianSets(privateKey as PrivateKey);
         console.log("synced");
         return contract.address;
       });
@@ -134,11 +144,13 @@ async function main() {
       payloads.push(payload);
     }
   }
-  let vaultName;
-  vaultName = network === "mainnet" ? "mainnet-beta_FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj" : "devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3";
+  const vaultName =
+    network === "mainnet"
+      ? "mainnet-beta_FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"
+      : "devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3";
   const vault = DefaultStore.vaults[vaultName];
-  vault.connect(await loadHotWallet(argv["ops-wallet"]));
-  await vault.proposeWormholeMessage(payloads);
+  vault?.connect(await loadHotWallet(argv["ops-wallet"]));
+  await vault?.proposeWormholeMessage(payloads);
 }
 
 main();

+ 11 - 8
contract_manager/scripts/check_proposal.ts

@@ -1,10 +1,15 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import { createHash } from "node:crypto";
 
 import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
-import {
-  getPythClusterApiUrl,
-  PythCluster,
-} from "@pythnetwork/client/lib/cluster";
+import type { PythCluster } from "@pythnetwork/client/lib/cluster";
+import { getPythClusterApiUrl } from "@pythnetwork/client/lib/cluster";
 import {
   CosmosUpgradeContract,
   EvmExecute,
@@ -14,7 +19,8 @@ import {
   MultisigParser,
   WormholeMultisigInstruction,
 } from "@pythnetwork/xc-admin-common";
-import { AccountMeta, Keypair, PublicKey } from "@solana/web3.js";
+import type { AccountMeta } from "@solana/web3.js";
+import { Keypair, PublicKey } from "@solana/web3.js";
 import SquadsMesh from "@sqds/mesh";
 import Web3 from "web3";
 import yargs from "yargs";
@@ -29,9 +35,6 @@ import {
 } from "../src/core/contracts/evm";
 import { DefaultStore } from "../src/node/utils/store";
 
-
-
-
 const parser = yargs(hideBin(process.argv))
   .usage("Usage: $0 --cluster <cluster_id> --proposal <proposal_address>")
   .options({

+ 25 - 10
contract_manager/scripts/common.ts

@@ -1,11 +1,24 @@
+/* eslint-disable tsdoc/syntax */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import { existsSync, readFileSync, writeFileSync } from "node:fs";
-import { join } from "node:path";
+import path from "node:path";
 
 import Web3 from "web3";
 import { Contract } from "web3-eth-contract";
-import { InferredOptionType } from "yargs";
+import type { InferredOptionType } from "yargs";
 
-import { PrivateKey, getDefaultDeploymentConfig } from "../src/core/base";
+import type { PrivateKey } from "../src/core/base";
+import { getDefaultDeploymentConfig } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import {
   EvmEntropyContract,
@@ -19,7 +32,7 @@ export type BaseDeployConfig = {
   gasPriceMultiplier: number;
   jsonOutputDir: string;
   privateKey: PrivateKey;
-}
+};
 
 // Deploys a contract if it was not deployed before.
 // It will check for the past deployments in file `cacheFile` against a key
@@ -38,7 +51,7 @@ export async function deployIfNotCached(
   return runIfNotCached(key, async () => {
     const artifact = JSON.parse(
       readFileSync(
-        join(
+        path.join(
           config.jsonOutputDir,
           `${artifactName}.sol`,
           `${artifactName}.json`,
@@ -84,7 +97,7 @@ export function getWeb3Contract(
 ): Contract {
   const artifact = JSON.parse(
     readFileSync(
-      join(jsonOutputDir, `${artifactName}.sol`, `${artifactName}.json`),
+      path.join(jsonOutputDir, `${artifactName}.sol`, `${artifactName}.json`),
       "utf8",
     ),
   );
@@ -182,7 +195,7 @@ export function makeCacheFunction(
     }
     const result = await fn();
     cache[cacheKey] = result;
-    writeFileSync(cacheFile, JSON.stringify(cache, null, 2));
+    writeFileSync(cacheFile, JSON.stringify(cache, undefined, 2));
     return result;
   }
 
@@ -214,7 +227,7 @@ export function getSelectedChains(argv: {
         .toString()}`,
     );
   for (const chain of selectedChains) {
-    if (chain.isMainnet() != selectedChains[0].isMainnet())
+    if (chain.isMainnet() != selectedChains[0]?.isMainnet())
       throw new Error("All chains must be either mainnet or testnet");
   }
   return selectedChains;
@@ -251,6 +264,7 @@ export function findWormholeContract(
       return contract;
     }
   }
+  return;
 }
 
 /**
@@ -272,12 +286,13 @@ export function findExecutorContract(
       return contract;
     }
   }
+  return;
 }
 
 export type DeployWormholeReceiverContractsConfig = {
   saveContract: boolean;
   type: "stable" | "beta";
-} & BaseDeployConfig
+} & BaseDeployConfig;
 /**
  * Deploys the wormhole receiver contract for a given EVM chain.
  * @param {EvmChain} chain The EVM chain to find the wormhole receiver contract for.
@@ -373,7 +388,7 @@ export async function getOrDeployWormholeContract(
 export type DefaultAddresses = {
   mainnet: string;
   testnet: string;
-}
+};
 
 export async function topupAccountsIfNecessary(
   chain: EvmChain,

+ 10 - 1
contract_manager/scripts/deploy_cosmwasm.ts

@@ -1,3 +1,11 @@
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -6,7 +14,6 @@ import { CosmWasmChain } from "../src/core/chains";
 import { CosmWasmPriceFeedContract } from "../src/core/contracts/cosmwasm";
 import { DefaultStore } from "../src/node/utils/store";
 
-
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_cosmwasm.ts")
   .usage(
@@ -35,6 +42,8 @@ async function main() {
   const argv = await parser.argv;
   const { code, wormholeContract } = argv;
   console.log(
+    // @ts-expect-error - TODO: The typings do not indicate that the deploy() function
+    // exists on the COsmWasmPriceFeedContract(), so this may explode at runtime
     await CosmWasmPriceFeedContract.deploy(
       DefaultStore.chains[argv.chain] as CosmWasmChain,
       wormholeContract,

+ 12 - 1
contract_manager/scripts/deploy_evm_contract.ts

@@ -1,3 +1,14 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import { readFileSync } from "node:fs";
 
 import yargs from "yargs";
@@ -40,7 +51,7 @@ async function main() {
     toPrivateKey(argv["private-key"]),
     artifact.abi,
     artifact.bytecode.object, // As per the artifacts generated by forge, bytecode is an object with an 'object' property
-    argv["deploy-args"] || [],
+    argv["deploy-args"] ?? [],
   );
 
   console.log(`Deployed contract at ${address}`);

+ 16 - 9
contract_manager/scripts/deploy_evm_entropy_contracts.ts

@@ -1,21 +1,28 @@
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
+import type { BaseDeployConfig, DefaultAddresses } from "./common";
 import {
   COMMON_DEPLOY_OPTIONS,
   deployIfNotCached,
   getWeb3Contract,
   getOrDeployWormholeContract,
-  BaseDeployConfig,
   topupAccountsIfNecessary,
-  DefaultAddresses,
 } from "./common";
 import { getOrDeployExecutorContract } from "./deploy_evm_executor_contracts";
-import {
-  DeploymentType,
-  toDeploymentType,
-  toPrivateKey,
-} from "../src/core/base";
+import type { DeploymentType } from "../src/core/base";
+import { toDeploymentType, toPrivateKey } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import {
   ENTROPY_DEFAULT_KEEPER,
@@ -27,7 +34,7 @@ import { DefaultStore } from "../src/node/utils/store";
 type DeploymentConfig = {
   type: DeploymentType;
   saveContract: boolean;
-} & BaseDeployConfig
+} & BaseDeployConfig;
 
 const CACHE_FILE = ".cache-deploy-evm-entropy-contracts";
 
@@ -128,7 +135,7 @@ async function main() {
     privateKey: deploymentConfig.privateKey ? `<REDACTED>` : undefined,
   };
   console.log(
-    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, null, 2)}\n`,
+    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, undefined, 2)}\n`,
   );
 
   console.log(`Deploying entropy contracts on ${chain.getId()}...`);

+ 10 - 4
contract_manager/scripts/deploy_evm_executor_contracts.ts

@@ -1,16 +1,21 @@
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable tsdoc/syntax */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
+import type { BaseDeployConfig } from "./common";
 import {
-  BaseDeployConfig,
   COMMON_DEPLOY_OPTIONS,
   deployIfNotCached,
   findExecutorContract,
   getOrDeployWormholeContract,
   getWeb3Contract,
 } from "./common";
+import type { DeploymentType } from "../src/core/base";
 import {
-  DeploymentType,
   getDefaultDeploymentConfig,
   toDeploymentType,
   toPrivateKey,
@@ -38,7 +43,7 @@ const parser = yargs(hideBin(process.argv))
 type DeploymentConfig = {
   type: DeploymentType;
   saveContract: boolean;
-} & BaseDeployConfig
+} & BaseDeployConfig;
 
 export async function getOrDeployExecutorContract(
   chain: EvmChain,
@@ -126,7 +131,7 @@ export async function main() {
     privateKey: deploymentConfig.privateKey ? `<REDACTED>` : undefined,
   };
   console.log(
-    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, null, 2)}\n`,
+    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, undefined, 2)}\n`,
   );
 
   console.log(`Deploying executor contracts on ${chain.getId()}...`);
@@ -149,4 +154,5 @@ export async function main() {
   );
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 29 - 17
contract_manager/scripts/deploy_evm_lazer_contracts.ts

@@ -1,3 +1,13 @@
+/* eslint-disable @typescript-eslint/require-await */
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/no-process-exit */
+/* eslint-disable n/no-process-exit */
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 /**
  * PythLazer EVM Contract Deployment and Management Script
  *
@@ -39,12 +49,13 @@
  */
 
 import { execSync } from "node:child_process";
-import { join } from "node:path";
+import path from "node:path";
 
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
-import { toPrivateKey, PrivateKey } from "../src/core/base";
+import type { PrivateKey } from "../src/core/base";
+import { toPrivateKey } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import { EvmLazerContract } from "../src/core/contracts/evm";
 import { DefaultStore } from "../src/node/utils/store";
@@ -117,10 +128,10 @@ const parser = yargs(hideBin(process.argv))
 
 /**
  * Deploys the PythLazer contract using forge script
- * @param chain The EVM chain to deploy to
- * @param privateKey The private key for deployment
- * @param verify Whether to verify the contract
- * @param etherscanApiKey The Etherscan API key for verification
+ * @param chain - The EVM chain to deploy to
+ * @param privateKey - The private key for deployment
+ * @param verify - Whether to verify the contract
+ * @param etherscanApiKey - The Etherscan API key for verification
  * @returns The deployed contract address
  */
 async function deployPythLazerContract(
@@ -129,7 +140,7 @@ async function deployPythLazerContract(
   verify: boolean,
   etherscanApiKey?: string,
 ): Promise<string> {
-  const lazerContractsDir = join(__dirname, "../../lazer/contracts/evm");
+  const lazerContractsDir = path.resolve("../../lazer/contracts/evm");
   const rpcUrl = chain.rpcUrl;
 
   console.log(`Deploying PythLazer contract to ${chain.getId()}...`);
@@ -163,7 +174,7 @@ async function deployPythLazerContract(
     const proxyAddress = proxyMatch[1];
     console.log(`\nPythLazer proxy deployed at: ${proxyAddress}`);
 
-    return proxyAddress;
+    return proxyAddress ?? "";
   } catch (error) {
     console.error("Deployment failed:", error);
     throw error;
@@ -172,8 +183,8 @@ async function deployPythLazerContract(
 
 /**
  * Updates the EvmLazerContracts.json file with the new deployment
- * @param chain The chain where the contract was deployed
- * @param address The deployed contract address
+ * @param chain - The chain where the contract was deployed
+ * @param address - The deployed contract address
  */
 function updateContractsFile(chain: EvmChain, address: string): void {
   console.log(`Updating contracts file for ${chain.getId()}`);
@@ -188,8 +199,8 @@ function updateContractsFile(chain: EvmChain, address: string): void {
 
 /**
  * Gets or creates an EvmLazerContract instance
- * @param chain The EVM chain
- * @param address The contract address
+ * @param chain - The EVM chain
+ * @param address - The contract address
  * @returns The EvmLazerContract instance
  */
 function getOrCreateLazerContract(
@@ -201,11 +212,11 @@ function getOrCreateLazerContract(
 
 /**
  * Updates the trusted signer for a PythLazer contract
- * @param chain The EVM chain
- * @param contractAddress The contract address
- * @param trustedSigner The trusted signer address
- * @param expiresAt The expiration timestamp
- * @param privateKey The private key for the transaction
+ * @param chain - The EVM chain
+ * @param contractAddress - The contract address
+ * @param trustedSigner - The trusted signer address
+ * @param expiresAt - The expiration timestamp
+ * @param privateKey - The private key for the transaction
  */
 async function updateTrustedSigner(
   chain: EvmChain,
@@ -230,6 +241,7 @@ function findLazerContract(chain: EvmChain): EvmLazerContract | undefined {
       return contract;
     }
   }
+  return;
 }
 
 export async function findOrDeployPythLazerContract(

+ 17 - 5
contract_manager/scripts/deploy_evm_pricefeed_contracts.ts

@@ -1,16 +1,28 @@
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import { HermesClient } from "@pythnetwork/hermes-client";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
+import type { BaseDeployConfig } from "./common";
 import {
   COMMON_DEPLOY_OPTIONS,
   deployIfNotCached,
   getWeb3Contract,
   getOrDeployWormholeContract,
-  BaseDeployConfig,
 } from "./common";
+import type { DeploymentType } from "../src/core/base";
 import {
-  DeploymentType,
   getDefaultDeploymentConfig,
   toDeploymentType,
   toPrivateKey,
@@ -24,7 +36,7 @@ type DeploymentConfig = {
   validTimePeriodSeconds: number;
   singleUpdateFeeInWei: number;
   saveContract: boolean;
-} & BaseDeployConfig
+} & BaseDeployConfig;
 
 const CACHE_FILE = ".cache-deploy-evm";
 
@@ -132,7 +144,7 @@ async function main() {
       },
     );
 
-    const price = priceObject.parsed?.[0].price;
+    const price = priceObject.parsed?.[0]?.price;
     if (price == undefined) {
       throw new Error("Failed to get price of the native token");
     }
@@ -161,7 +173,7 @@ async function main() {
     privateKey: deploymentConfig.privateKey ? `<REDACTED>` : undefined,
   };
   console.log(
-    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, null, 2)}\n`,
+    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, undefined, 2)}\n`,
   );
 
   const chainNames = argv.chain;

+ 15 - 9
contract_manager/scripts/deploy_evm_pulse_contracts.ts

@@ -1,23 +1,29 @@
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import fs from "node:fs";
 import path from "node:path";
 
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
+import type { BaseDeployConfig, DefaultAddresses } from "./common";
 import {
   COMMON_DEPLOY_OPTIONS,
   deployIfNotCached,
   getWeb3Contract,
   getOrDeployWormholeContract,
-  BaseDeployConfig,
   topupAccountsIfNecessary,
-  DefaultAddresses,
 } from "./common";
-import {
-  DeploymentType,
-  toDeploymentType,
-  toPrivateKey,
-} from "../src/core/base";
+import type { DeploymentType } from "../src/core/base";
+import { toDeploymentType, toPrivateKey } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import {
   PULSE_DEFAULT_PROVIDER,
@@ -29,7 +35,7 @@ import { DefaultStore } from "../src/node/utils/store";
 type DeploymentConfig = {
   type: DeploymentType;
   saveContract: boolean;
-} & BaseDeployConfig
+} & BaseDeployConfig;
 
 const CACHE_FILE = ".cache-deploy-evm-pulse-contracts";
 
@@ -155,7 +161,7 @@ async function main() {
     privateKey: deploymentConfig.privateKey ? `<REDACTED>` : undefined,
   };
   console.log(
-    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, null, 2)}\n`,
+    `Deployment config: ${JSON.stringify(maskedDeploymentConfig, undefined, 2)}\n`,
   );
 
   console.log(`Deploying pulse contracts on ${chain.getId()}...`);

+ 12 - 5
contract_manager/scripts/entropy-accept-admin-and-ownership.ts

@@ -1,3 +1,9 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -56,7 +62,7 @@ async function main() {
         .toString()}`,
     );
   for (const chain of selectedChains) {
-    if (chain.isMainnet() != selectedChains[0].isMainnet())
+    if (chain.isMainnet() != selectedChains[0]?.isMainnet())
       throw new Error("All chains must be either mainnet or testnet");
   }
 
@@ -78,12 +84,13 @@ async function main() {
     }
   }
 
-  console.log("Using vault at for proposal", vault.getId());
+  console.log("Using vault at for proposal", vault?.getId());
   const wallet = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet", wallet.publicKey.toBase58());
-  await vault.connect(wallet);
-  const proposal = await vault.proposeWormholeMessage(payloads);
-  console.log("Proposal address", proposal.address.toBase58());
+  // eslint-disable-next-line @typescript-eslint/await-thenable
+  await vault?.connect(wallet);
+  const proposal = await vault?.proposeWormholeMessage(payloads);
+  console.log("Proposal address", proposal?.address.toBase58());
 }
 
 main();

+ 13 - 1
contract_manager/scripts/entropy_debug_reveal.ts

@@ -1,3 +1,14 @@
+/* eslint-disable @typescript-eslint/restrict-plus-operands */
+
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -37,7 +48,7 @@ async function main() {
   const privateKey = toPrivateKey(argv.privateKey);
   let startingSequenceNumber: number, endingSequenceNumber: number;
   if (argv.sequenceNumber.includes(":")) {
-    [startingSequenceNumber, endingSequenceNumber] = argv.sequenceNumber
+    [startingSequenceNumber = 0, endingSequenceNumber = 0] = argv.sequenceNumber
       .split(":")
       .map(Number);
   } else {
@@ -83,6 +94,7 @@ async function main() {
       return;
     }
     const payload = await fortunaResponse.json();
+    // @ts-expect-error - TODO payload.value is unknown and the typing needs to be fixed
     const providerRevelation = "0x" + payload.value.data;
     try {
       await contract.revealWithCallback(

+ 23 - 12
contract_manager/scripts/execute_vaas.ts

@@ -1,3 +1,11 @@
+/* eslint-disable @typescript-eslint/no-non-null-assertion */
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import { parseVaa } from "@certusone/wormhole-sdk";
 import { decodeGovernancePayload } from "@pythnetwork/xc-admin-common";
 import yargs from "yargs";
@@ -6,7 +14,7 @@ import { hideBin } from "yargs/helpers";
 import { COMMON_DEPLOY_OPTIONS } from "./common";
 import { toPrivateKey } from "../src/core/base";
 import { executeVaa } from "../src/node/utils/executor";
-import { Vault , SubmittedWormholeMessage } from "../src/node/utils/governance";
+import { SubmittedWormholeMessage } from "../src/node/utils/governance";
 import { DefaultStore } from "../src/node/utils/store";
 
 const parser = yargs(hideBin(process.argv))
@@ -48,14 +56,17 @@ const parser = yargs(hideBin(process.argv))
 
 async function main() {
   const argv = await parser.argv;
-  let vault: Vault;
-  vault = argv.vault === "mainnet" ? DefaultStore.vaults[
-        "mainnet-beta_FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"
-      ] : DefaultStore.vaults.devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3;
-  console.log("Executing VAAs for vault", vault.getId());
+  const vault =
+    argv.vault === "mainnet"
+      ? DefaultStore.vaults[
+          "mainnet-beta_FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"
+        ]
+      : DefaultStore.vaults.devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3;
+  console.log("Executing VAAs for vault", vault?.getId());
   console.log(
     "Executing VAAs for emitter",
-    (await vault.getEmitter()).toBase58(),
+    // eslint-disable-next-line unicorn/no-await-expression-member
+    (await vault?.getEmitter())?.toBase58(),
   );
 
   let startSequenceNumber: number;
@@ -68,9 +79,9 @@ async function main() {
     // this is unreachable but it makes the typescript linter happy.
     throw new Error("Either --offset or --sequence must be provided");
   } else {
-    const lastSequenceNumber = await vault.getLastSequenceNumber();
-    startSequenceNumber = lastSequenceNumber - argv.offset;
-    endSequenceNumber = lastSequenceNumber;
+    const lastSequenceNumber = await vault?.getLastSequenceNumber();
+    startSequenceNumber = (lastSequenceNumber ?? 0) - argv.offset;
+    endSequenceNumber = lastSequenceNumber ?? 0;
   }
 
   console.log(
@@ -83,9 +94,9 @@ async function main() {
     seqNumber++
   ) {
     const submittedWormholeMessage = new SubmittedWormholeMessage(
-      await vault.getEmitter(),
+      await vault!.getEmitter(),
       seqNumber,
-      vault.cluster,
+      vault!.cluster,
     );
     const vaa = await submittedWormholeMessage.fetchVaa();
     const decodedAction = decodeGovernancePayload(parseVaa(vaa).payload);

+ 12 - 6
contract_manager/scripts/fetch_account_balance.ts

@@ -1,7 +1,13 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
-import { PrivateKey, toPrivateKey } from "../src/core/base";
+import type { PrivateKey } from "../src/core/base";
+import { toPrivateKey } from "../src/core/base";
 import { DefaultStore } from "../src/node/utils/store";
 
 const parser = yargs(hideBin(process.argv))
@@ -30,11 +36,11 @@ async function getBalance(
   privateKey: PrivateKey,
 ): Promise<AccountBalance | undefined> {
   const address =
-    await DefaultStore.chains[chain].getAccountAddress(privateKey);
+    await DefaultStore.chains[chain]?.getAccountAddress(privateKey);
 
   try {
     const balance =
-      await DefaultStore.chains[chain].getAccountBalance(privateKey);
+      await DefaultStore.chains[chain]?.getAccountBalance(privateKey);
     return { chain, address, balance };
   } catch (error) {
     console.error(`Error fetching balance for ${chain}`, error);
@@ -44,9 +50,9 @@ async function getBalance(
 
 async function main() {
   const argv = await parser.argv;
-  const chains = argv.chain
-    ? argv.chain
-    : Object.keys(DefaultStore.chains).filter((chain) => chain !== "global");
+  const chains =
+    argv.chain ??
+    Object.keys(DefaultStore.chains).filter((chain) => chain !== "global");
 
   const privateKey = toPrivateKey(argv["private-key"]);
 

+ 11 - 2
contract_manager/scripts/fetch_accrued_entropy_dao_fees.ts

@@ -1,3 +1,12 @@
+/* eslint-disable @typescript-eslint/use-unknown-in-catch-callback-variable */
+/* eslint-disable 
+  unicorn/prefer-top-level-await,
+  @typescript-eslint/restrict-template-expressions,
+  no-console,
+  unicorn/no-process-exit,
+  n/no-process-exit
+*/
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -40,10 +49,10 @@ type FeeResult = {
   chainId: string;
   contractAddress: string;
   accruedFees: string;
-  accruedFeesEth?: string;
+  accruedFeesEth?: string | undefined;
   isMainnet: boolean;
   error?: string;
-}
+};
 
 async function fetchAccruedFees(
   contract: EvmEntropyContract,

+ 7 - 1
contract_manager/scripts/fetch_fees.ts

@@ -1,3 +1,9 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -45,7 +51,7 @@ async function main() {
         const fee = await contract.getTotalFee();
         let feeUsd = 0;
         if (fee.denom !== undefined && prices[fee.denom] !== undefined) {
-          feeUsd = Number(fee.amount) * prices[fee.denom];
+          feeUsd = Number(fee.amount) * (prices[fee.denom] ?? 0);
           totalFeeUsd += feeUsd;
           console.log(
             `${contract.getId()} ${fee.amount} ${fee.denom} ($${feeUsd})`,

+ 6 - 0
contract_manager/scripts/generate_evm_lazer_update_trusted_signer_proposal.ts

@@ -1,3 +1,8 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -63,6 +68,7 @@ async function main() {
   console.log("Using vault at for proposal", vault.getId());
   const wallet = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet", wallet.publicKey.toBase58());
+  // eslint-disable-next-line @typescript-eslint/await-thenable, @typescript-eslint/no-confusing-void-expression
   await vault.connect(wallet);
   const proposal = await vault.proposeWormholeMessage(updatePayloads);
   console.log("Proposal address", proposal.address.toBase58());

+ 8 - 0
contract_manager/scripts/generate_governance_set_fee_payload.ts

@@ -1,3 +1,11 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+/* eslint-disable unicorn/prefer-top-level-await */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 

+ 11 - 4
contract_manager/scripts/generate_upgrade_near_contract_proposal.ts

@@ -1,3 +1,10 @@
+/* eslint-disable @typescript-eslint/use-unknown-in-catch-callback-variable */
+/* eslint-disable unicorn/no-process-exit */
+/* eslint-disable n/no-process-exit */
+/* eslint-disable unicorn/prefer-top-level-await */
+
+/* eslint-disable no-console */
+
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -55,12 +62,12 @@ async function main() {
   console.log("Governance payload:", payload);
 
   // Create and submit governance proposal
-  console.log("Using vault for proposal:", vault.getId());
+  console.log("Using vault for proposal:", vault?.getId());
   const keypair = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet:", keypair.publicKey.toBase58());
-  vault.connect(keypair);
-  const proposal = await vault.proposeWormholeMessage([payload]);
-  console.log("Proposal address:", proposal.address.toBase58());
+  vault?.connect(keypair);
+  const proposal = await vault?.proposeWormholeMessage([payload]);
+  console.log("Proposal address:", proposal?.address.toBase58());
 }
 
 main().catch((error) => {

+ 14 - 5
contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts

@@ -1,3 +1,13 @@
+/* eslint-disable @typescript-eslint/use-unknown-in-catch-callback-variable */
+/* eslint-disable unicorn/no-process-exit */
+/* eslint-disable n/no-process-exit */
+/* eslint-disable unicorn/prefer-top-level-await */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+
 import fs from "node:fs";
 import path from "node:path";
 
@@ -62,7 +72,6 @@ async function main() {
   // Read the compiled contract from the build directory
   // NOTE: Remember to rebuild contract_manager before running this script because it will also build the ton contract
   const compiledPath = path.resolve(
-    __dirname,
     "../../target_chains/ton/contracts/build/Main.compiled.json",
   );
   const compiled = JSON.parse(fs.readFileSync(compiledPath, "utf8"));
@@ -75,12 +84,12 @@ async function main() {
   console.log("Payload:", payload);
 
   // Create and submit governance proposal
-  console.log("Using vault for proposal:", vault.getId());
+  console.log("Using vault for proposal:", vault?.getId());
   const keypair = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet:", keypair.publicKey.toBase58());
-  vault.connect(keypair);
-  const proposal = await vault.proposeWormholeMessage([payload]);
-  console.log("Proposal address:", proposal.address.toBase58());
+  vault?.connect(keypair);
+  const proposal = await vault?.proposeWormholeMessage([payload]);
+  console.log("Proposal address:", proposal?.address.toBase58());
 }
 
 main().catch((error) => {

+ 3 - 0
contract_manager/scripts/get_entropy_registration.ts

@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -62,4 +64,5 @@ async function main() {
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 10 - 2
contract_manager/scripts/latency_entropy.ts

@@ -1,3 +1,8 @@
+/* eslint-disable @typescript-eslint/restrict-plus-operands */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -40,11 +45,13 @@ async function main() {
   const sequenceNumber = providerInfo.sequenceNumber;
   const revealUrl = providerInfo.uri + `/revelations/${sequenceNumber}`;
   console.log("Checking this url for revelation:", revealUrl);
-   
+
+  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
   while (true) {
     const fortunaResponse = await fetch(revealUrl);
     if (fortunaResponse.status === 200) {
-      const payload = await fortunaResponse.json();
+      // eslint-disable-next-line @typescript-eslint/no-explicit-any
+      const payload = (await fortunaResponse.json()) as any;
       const endTime = Date.now();
       console.log(`Fortuna Latency: ${endTime - startTime}ms`);
       const providerRevelation = "0x" + payload.value.data;
@@ -62,4 +69,5 @@ async function main() {
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 9 - 2
contract_manager/scripts/latency_entropy_with_callback.ts

@@ -1,8 +1,14 @@
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
 import { COMMON_DEPLOY_OPTIONS, findEntropyContract } from "./common";
-import { PrivateKey, toPrivateKey } from "../src/core/base";
+import type { PrivateKey } from "../src/core/base";
+import { toPrivateKey } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import { EvmEntropyContract } from "../src/core/contracts";
 import { DefaultStore } from "../src/node/utils/store";
@@ -58,7 +64,7 @@ async function testLatency(
   const web3 = contract.chain.getWeb3();
   const entropyContract = contract.getContract();
 
-   
+  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
   while (true) {
     await new Promise((resolve) => setTimeout(resolve, 1000));
     const currentBlock = await web3.eth.getBlockNumber();
@@ -117,4 +123,5 @@ async function main() {
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 2 - 0
contract_manager/scripts/list_entropy_contracts.ts

@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
 import Web3 from "web3";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
@@ -66,4 +67,5 @@ async function main() {
   console.table(entries);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 2 - 0
contract_manager/scripts/list_evm_contracts.ts

@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -40,4 +41,5 @@ async function main() {
   console.table(entries);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 2 - 0
contract_manager/scripts/list_wormhole_contracts.ts

@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -45,4 +46,5 @@ async function main() {
   console.table(entries);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 9 - 1
contract_manager/scripts/load_test_entropy.ts

@@ -1,3 +1,10 @@
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-explicit-any */
+/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -64,7 +71,7 @@ const ABI = [
     stateMutability: "nonpayable",
     type: "function",
   },
-] as any; // eslint-disable-line @typescript-eslint/no-explicit-any
+] as any;
 
 async function main() {
   const argv = await parser.argv;
@@ -92,4 +99,5 @@ async function main() {
   console.log("Submitted transaction", result.transactionHash);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 4 - 1
contract_manager/scripts/send_message_to_wormhole.ts

@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -34,7 +36,7 @@ async function main() {
   const emitter = new WormholeEmitter(cluster, wallet);
 
   console.log(`Sending message to wormhole using cluster ${cluster}...`);
-  const payload = Buffer.from(message, "utf-8");
+  const payload = Buffer.from(message, "utf8");
   const submittedMessage = await emitter.sendMessage(payload);
   console.log(
     `Message sent. Emitter: ${submittedMessage.emitter.toBase58()}, Sequence Number: ${
@@ -52,4 +54,5 @@ async function main() {
   console.log(`VAA: ${vaa.toString("hex")}`);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 8 - 3
contract_manager/scripts/sync_governance_vaas.ts

@@ -1,3 +1,6 @@
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-non-null-assertion */
+/* eslint-disable unicorn/no-await-expression-member */
 import { parseVaa } from "@certusone/wormhole-sdk";
 import { decodeGovernancePayload } from "@pythnetwork/xc-admin-common";
 import yargs from "yargs";
@@ -40,9 +43,9 @@ async function main() {
   const mainnetVault =
     DefaultStore.vaults[
       "mainnet-beta_FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj"
-    ];
+    ]!;
   const devnetVault =
-    DefaultStore.vaults.devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3;
+    DefaultStore.vaults.devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3!;
   let matchedVault: Vault;
   if (
     (await devnetVault.getEmitter()).toBuffer().toString("hex") ===
@@ -68,7 +71,8 @@ async function main() {
     lastExecuted = argv.offset - 1;
   }
   console.log("Starting from sequence number", lastExecuted);
-   
+
+  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
   while (true) {
     const submittedWormholeMessage = new SubmittedWormholeMessage(
       await matchedVault.getEmitter(),
@@ -107,4 +111,5 @@ async function main() {
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 11 - 2
contract_manager/scripts/sync_wormhole_guardian_set.ts

@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -48,7 +50,10 @@ async function main() {
         index = await contract.getCurrentGuardianSetIndex();
         console.log("Guardian Index at End:", index);
       } catch (error) {
-        console.error(`Error updating Guardianset for ${contract.getId()}`, error);
+        console.error(
+          `Error updating Guardianset for ${contract.getId()}`,
+          error,
+        );
       }
     }
   }
@@ -86,10 +91,14 @@ async function main() {
         await wormhole.syncMainnetGuardianSets(privateKey);
         console.log(`Updated Guardianset for ${contract.getId()}`);
       } catch (error) {
-        console.error(`Error updating Guardianset for ${contract.getId()}`, error);
+        console.error(
+          `Error updating Guardianset for ${contract.getId()}`,
+          error,
+        );
       }
     }
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 13 - 5
contract_manager/scripts/transfer_balance_entropy_chains.ts

@@ -1,8 +1,13 @@
+/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
+/* eslint-disable unicorn/no-nested-ternary */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
 import Web3 from "web3";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
-import { PrivateKey, toPrivateKey } from "../src/core/base";
+import type { PrivateKey } from "../src/core/base";
+import { toPrivateKey } from "../src/core/base";
 import { EvmChain } from "../src/core/chains";
 import { DefaultStore } from "../src/node/utils/store";
 
@@ -16,7 +21,7 @@ type TransferResult = {
   remainingBalance: string;
   transactionHash?: string;
   error?: string;
-}
+};
 
 const parser = yargs(hideBin(process.argv))
   .usage(
@@ -327,9 +332,9 @@ function getSelectedChains(argv: {
   if (selectedChains.length === 0) {
     const mode = argv.testnets
       ? "testnet"
-      : (argv.mainnets
+      : argv.mainnets
         ? "mainnet"
-        : "specified");
+        : "specified";
     throw new Error(`No valid ${mode} entropy chains found`);
   }
 
@@ -364,6 +369,7 @@ async function main() {
   }
 
   const sourcePrivateKey = toPrivateKey(argv.sourcePrivateKey);
+  // @ts-expect-error - TODO: Typing mismatch between argv and the expected array type for getSelectedChains()
   const selectedChains = getSelectedChains(argv);
 
   // Determine transfer method for display
@@ -379,7 +385,7 @@ async function main() {
 
   console.log(`\nConfiguration:`);
   console.log(
-    `   Network: ${argv.testnets ? "Testnet" : (argv.mainnets ? "Mainnet" : "Specific chains")}`,
+    `   Network: ${argv.testnets ? "Testnet" : argv.mainnets ? "Mainnet" : "Specific chains"}`,
   );
   console.log(`   Destination: ${argv.destinationAddress}`);
   console.log(`   Transfer method: ${transferMethod}`);
@@ -448,7 +454,9 @@ async function main() {
   console.log("\nTransfer process completed!");
 }
 
+// eslint-disable-next-line unicorn/prefer-top-level-await, @typescript-eslint/use-unknown-in-catch-callback-variable
 main().catch((error) => {
   console.error("Script failed:", error);
+  // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
   process.exit(1);
 });

+ 7 - 2
contract_manager/scripts/update_all_pricefeeds.ts

@@ -1,4 +1,8 @@
-import { HermesClient, PriceFeedMetadata } from "@pythnetwork/hermes-client";
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
+import type { PriceFeedMetadata } from "@pythnetwork/hermes-client";
+import { HermesClient } from "@pythnetwork/hermes-client";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -67,7 +71,7 @@ async function main() {
       parsed: false,
     });
     console.log(
-      await contract.executeUpdatePriceFeed(
+      await contract?.executeUpdatePriceFeed(
         privateKey,
         updates.binary.data.map((update) =>
           encoding === "hex"
@@ -81,4 +85,5 @@ async function main() {
   }
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 4 - 1
contract_manager/scripts/update_pricefeed.ts

@@ -1,3 +1,5 @@
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
 import { PriceServiceConnection } from "@pythnetwork/price-service-client";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
@@ -38,7 +40,7 @@ async function main() {
     throw new Error(
       `Contract ${argv.contract} not found. Contracts found: ${Object.keys(
         DefaultStore.contracts,
-      )}`,
+      ).join(" ")}`,
     );
   }
   const priceService = new PriceServiceConnection(
@@ -54,4 +56,5 @@ async function main() {
   );
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 11 - 5
contract_manager/scripts/upgrade_evm_entropy_contracts.ts

@@ -1,6 +1,11 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable no-console */
 import { readFileSync } from "node:fs";
 
-import { PythCluster } from "@pythnetwork/client/lib/cluster";
+import type { PythCluster } from "@pythnetwork/client/lib/cluster";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -107,12 +112,13 @@ async function main() {
     );
   }
 
-  console.log("Using vault at for proposal", vault.getId());
+  console.log("Using vault at for proposal", vault?.getId());
   const wallet = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet", wallet.publicKey.toBase58());
-  vault.connect(wallet, registry);
-  const proposal = await vault.proposeWormholeMessage(payloads);
-  console.log("Proposal address", proposal.address.toBase58());
+  vault?.connect(wallet, registry);
+  const proposal = await vault?.proposeWormholeMessage(payloads);
+  console.log("Proposal address", proposal?.address.toBase58());
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 10 - 4
contract_manager/scripts/upgrade_evm_pricefeed_contracts.ts

@@ -1,3 +1,8 @@
+/* eslint-disable @typescript-eslint/await-thenable */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable no-console */
 import { readFileSync } from "node:fs";
 
 import yargs from "yargs";
@@ -56,12 +61,13 @@ async function main() {
     );
   }
 
-  console.log("Using vault at for proposal", vault.getId());
+  console.log("Using vault at for proposal", vault?.getId());
   const wallet = await loadHotWallet(argv["ops-key-path"]);
   console.log("Using wallet", wallet.publicKey.toBase58());
-  await vault.connect(wallet);
-  const proposal = await vault.proposeWormholeMessage(payloads);
-  console.log("Proposal address", proposal.address.toBase58());
+  await vault?.connect(wallet);
+  const proposal = await vault?.proposeWormholeMessage(payloads);
+  console.log("Proposal address", proposal?.address.toBase58());
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 8 - 2
contract_manager/scripts/upgrade_ton_contract.ts

@@ -1,3 +1,11 @@
+/* eslint-disable @typescript-eslint/use-unknown-in-catch-callback-variable */
+/* eslint-disable unicorn/no-process-exit */
+/* eslint-disable n/no-process-exit */
+/* eslint-disable unicorn/prefer-top-level-await */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
 import fs from "node:fs";
 import path from "node:path";
 
@@ -9,7 +17,6 @@ import { toPrivateKey } from "../src/core/base";
 import { TonPriceFeedContract } from "../src/core/contracts";
 import { DefaultStore } from "../src/node/utils/store";
 
-
 // This script upgrades the Pyth contract on TON after the governance has authorized the upgrade
 // If you are starting over, the process is like the following:
 // 1. create a governance proposal using generate_upgrade_ton_contract_proposal script
@@ -43,7 +50,6 @@ async function main() {
   // Read the compiled contract from the build directory
   // NOTE: Remember to rebuild contract_manager before running this script because it will also build the ton contract
   const compiledPath = path.resolve(
-    __dirname,
     "../../target_chains/ton/contracts/build/Main.compiled.json",
   );
   const compiled = JSON.parse(fs.readFileSync(compiledPath, "utf8"));

+ 3 - 0
contract_manager/scripts/upload_cosmwasm.ts

@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable no-console */
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 
@@ -39,4 +41,5 @@ async function main() {
   console.log(`Successfully uploaded code with id ${codeId}`);
 }
 
+// eslint-disable-next-line @typescript-eslint/no-floating-promises, unicorn/prefer-top-level-await
 main();

+ 10 - 8
contract_manager/src/core/base.ts

@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-unnecessary-condition */
 import type { DataSource } from "@pythnetwork/xc-admin-common";
 
 import { Chain } from "./chains";
@@ -5,7 +7,7 @@ import { Chain } from "./chains";
 export type TxResult = {
   id: string;
   info: unknown; // chain specific info
-}
+};
 
 export type DeploymentType = "stable" | "beta";
 export type PrivateKey = string & { __type: "PrivateKey" };
@@ -51,12 +53,12 @@ export type Price = {
   conf: string;
   publishTime: string;
   expo: string;
-}
+};
 
 export type PriceFeed = {
   price: Price;
   emaPrice: Price;
-}
+};
 
 export abstract class PriceFeedContract extends Storable {
   /**
@@ -94,14 +96,14 @@ export abstract class PriceFeedContract extends Storable {
 
   /**
    * Returns the price feed for the given feed id or undefined if not found
-   * @param feedId hex encoded feed id without 0x prefix
+   * @param feedId - hex encoded feed id without 0x prefix
    */
   abstract getPriceFeed(feedId: string): Promise<PriceFeed | undefined>;
 
   /**
    * Executes the update instructions contained in the VAAs using the sender credentials
-   * @param senderPrivateKey private key of the sender in hex format without 0x prefix
-   * @param vaas an array of VAAs containing price update messages to execute
+   * @param senderPrivateKey - private key of the sender in hex format without 0x prefix
+   * @param vaas - an array of VAAs containing price update messages to execute
    */
   abstract executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
@@ -110,8 +112,8 @@ export abstract class PriceFeedContract extends Storable {
 
   /**
    * Executes the governance instruction contained in the VAA using the sender credentials
-   * @param senderPrivateKey private key of the sender in hex format without 0x prefix
-   * @param vaa the VAA to execute
+   * @param senderPrivateKey - private key of the sender in hex format without 0x prefix
+   * @param vaa - the VAA to execute
    */
   abstract executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,

+ 61 - 62
contract_manager/src/core/chains.ts

@@ -1,57 +1,62 @@
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/require-await */
+/* eslint-disable @typescript-eslint/no-unnecessary-condition */
+/* eslint-disable n/no-process-env */
 import { Network } from "@injectivelabs/networks";
 import { IotaClient } from "@iota/iota-sdk/client";
 import { Ed25519Keypair as IotaEd25519Keypair } from "@iota/iota-sdk/keypairs/ed25519";
-import { Contract, RpcProvider, Signer, ec, shortString } from "starknet";
-import {
-  TonClient,
-  WalletContractV4,
-  type ContractProvider,
-  Address,
-  type OpenedContract,
-  type Sender,
-} from "@ton/ton";
-import { keyPairFromSeed } from "@ton/crypto";
-import { PythContract } from "@pythnetwork/pyth-ton-js";
-import * as nearAPI from "near-api-js";
-import * as bs58 from "bs58";
-import { MIST_PER_SUI } from "@mysten/sui/utils";
 import { NANOS_PER_IOTA } from "@iota/iota-sdk/utils";
 import { SuiClient } from "@mysten/sui/client";
 import { Ed25519Keypair as SuiEd25519Keypair } from "@mysten/sui/keypairs/ed25519";
+import { MIST_PER_SUI } from "@mysten/sui/utils";
 import {
   CosmwasmExecutor,
   CosmwasmQuerier,
   InjectiveExecutor,
 } from "@pythnetwork/cosmwasm-deploy-tools";
 import { FUEL_ETH_ASSET_ID } from "@pythnetwork/pyth-fuel-js";
-import type {ChainName, DataSource} from "@pythnetwork/xc-admin-common";
+import { PythContract } from "@pythnetwork/pyth-ton-js";
+import type { ChainName, DataSource } from "@pythnetwork/xc-admin-common";
 import {
-  
   SetFee,
   CosmosUpgradeContract,
   EvmUpgradeContract,
   toChainId,
   SetDataSources,
   SetValidPeriod,
-  
   EvmSetWormholeAddress,
   UpgradeContract256Bit,
-  EvmExecute
+  EvmExecute,
 } from "@pythnetwork/xc-admin-common";
+import { keyPairFromSeed } from "@ton/crypto";
+import type { ContractProvider, OpenedContract, Sender } from "@ton/ton";
+import { TonClient, WalletContractV4, Address } from "@ton/ton";
 import { AptosClient, AptosAccount, CoinClient, TxnBuilderTypes } from "aptos";
+import * as bs58 from "bs58";
 import { BN, Provider, Wallet, WalletUnlocked } from "fuels";
+import * as nearAPI from "near-api-js";
+import { Contract, RpcProvider, Signer, ec, shortString } from "starknet";
 import * as chains from "viem/chains";
 import Web3 from "web3";
 
-import type {KeyValueConfig, PrivateKey, TxResult} from "./base";
-import {
-  
-  
-  Storable
-  
-} from "./base";
+import type { KeyValueConfig, PrivateKey, TxResult } from "./base";
+import { Storable } from "./base";
 import type { TokenId } from "./token";
 
+function computeHashOnElements(elements: string[]): string {
+  let hash = "0";
+  for (const item of elements) {
+    hash = ec.starkCurve.pedersen(hash, item);
+  }
+  return ec.starkCurve.pedersen(hash, elements.length);
+}
+
 /**
  * Returns the chain rpc url with any environment variables replaced or throws an error if any are missing
  */
@@ -83,12 +88,11 @@ export abstract class Chain extends Storable {
 
   /**
    * Creates a new Chain object
-   * @param id unique id representing this chain
-   * @param mainnet whether this chain is mainnet or testnet/devnet
-   * @param wormholeChainName the name of the wormhole chain that this chain is associated with.
+   * @param id - unique id representing this chain
+   * @param mainnet - whether this chain is mainnet or testnet/devnet
+   * @param wormholeChainName - the name of the wormhole chain that this chain is associated with.
    * Note that pyth has included additional chain names and ids to the wormhole spec.
-   * @param nativeToken the id of the token used to pay gas on this chain
-   * @protected
+   * @param nativeToken - the id of the token used to pay gas on this chain
    */
   protected constructor(
     protected id: string,
@@ -120,8 +124,8 @@ export abstract class Chain extends Storable {
 
   /**
    * Returns the payload for a governance SetFee instruction for contracts deployed on this chain
-   * @param fee the new fee to set
-   * @param exponent the new fee exponent to set
+   * @param fee - the new fee to set
+   * @param exponent - the new fee exponent to set
    */
   generateGovernanceSetFeePayload(fee: number, exponent: number): Buffer {
     return new SetFee(
@@ -133,7 +137,7 @@ export abstract class Chain extends Storable {
 
   /**
    * Returns the payload for a governance SetDataSources instruction for contracts deployed on this chain
-   * @param datasources the new datasources
+   * @param datasources - the new datasources
    */
   generateGovernanceSetDataSources(datasources: DataSource[]): Buffer {
     return new SetDataSources(this.wormholeChainName, datasources).encode();
@@ -141,7 +145,7 @@ export abstract class Chain extends Storable {
 
   /**
    * Returns the payload for a governance SetStalePriceThreshold instruction for contracts deployed on this chain
-   * @param newValidStalePriceThreshold the new stale price threshold in seconds
+   * @param newValidStalePriceThreshold - the new stale price threshold in seconds
    */
   generateGovernanceSetStalePriceThreshold(
     newValidStalePriceThreshold: bigint,
@@ -154,19 +158,19 @@ export abstract class Chain extends Storable {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param upgradeInfo based on the contract type, this can be a contract address, codeId, package digest, etc.
+   * @param upgradeInfo - based on the contract type, this can be a contract address, codeId, package digest, etc.
    */
   abstract generateGovernanceUpgradePayload(upgradeInfo: unknown): Buffer;
 
   /**
    * Returns the account address associated with the given private key.
-   * @param privateKey the account private key
+   * @param privateKey - the account private key
    */
   abstract getAccountAddress(privateKey: PrivateKey): Promise<string>;
 
   /**
    * Returns the balance of the account associated with the given private key.
-   * @param privateKey the account private key
+   * @param privateKey - the account private key
    */
   abstract getAccountBalance(privateKey: PrivateKey): Promise<number>;
 }
@@ -285,7 +289,9 @@ export class CosmWasmChain extends Chain {
 
   async getAccountAddress(privateKey: PrivateKey): Promise<string> {
     const executor = await this.getExecutor(privateKey);
-    return executor instanceof InjectiveExecutor ? executor.getAddress() : (await executor.getAddress());
+    return executor instanceof InjectiveExecutor
+      ? executor.getAddress()
+      : await executor.getAddress();
   }
 
   async getAccountBalance(privateKey: PrivateKey): Promise<number> {
@@ -334,7 +340,7 @@ export class SuiChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the 32 byte digest for the new package without the 0x prefix
+   * @param digest - hex string of the 32 byte digest for the new package without the 0x prefix
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, digest).encode();
@@ -400,7 +406,7 @@ export class IotaChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the 32 byte digest for the new package without the 0x prefix
+   * @param digest - hex string of the 32 byte digest for the new package without the 0x prefix
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, digest).encode();
@@ -476,7 +482,7 @@ export class EvmChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param address hex string of the 20 byte address of the contract to upgrade to without the 0x prefix
+   * @param address - hex string of the 20 byte address of the contract to upgrade to without the 0x prefix
    */
   generateGovernanceUpgradePayload(address: string): Buffer {
     return new EvmUpgradeContract(this.wormholeChainName, address).encode();
@@ -484,9 +490,9 @@ export class EvmChain extends Chain {
 
   /**
    * Returns the payload for a governance action from the executor contract
-   * @param executor the address of the executor contract live on this chain
-   * @param callAddress the address of the contract to call
-   * @param calldata the calldata to pass to the contract
+   * @param executor - the address of the executor contract live on this chain
+   * @param callAddress - the address of the contract to call
+   * @param calldata - the calldata to pass to the contract
    * @returns the payload for the governance action
    */
   generateExecutorPayload(
@@ -548,10 +554,10 @@ export class EvmChain extends Chain {
 
   /**
    * Deploys a contract on this chain
-   * @param privateKey hex string of the 32 byte private key without the 0x prefix
-   * @param abi the abi of the contract, can be obtained from the compiled contract json file
-   * @param bytecode bytecode of the contract, can be obtained from the compiled contract json file
-   * @param deployArgs arguments to pass to the constructor. Each argument must begin with 0x if it's a hex string
+   * @param privateKey - hex string of the 32 byte private key without the 0x prefix
+   * @param abi - the abi of the contract, can be obtained from the compiled contract json file
+   * @param bytecode - bytecode of the contract, can be obtained from the compiled contract json file
+   * @param deployArgs - arguments to pass to the constructor. Each argument must begin with 0x if it's a hex string
    * @returns the address of the deployed contract
    */
   async deploy(
@@ -634,7 +640,7 @@ export class AptosChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the 32 byte digest for the new package without the 0x prefix
+   * @param digest - hex string of the 32 byte digest for the new package without the 0x prefix
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, digest).encode();
@@ -725,7 +731,7 @@ export class FuelChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the 32 byte digest for the new package without the 0x prefix
+   * @param digest - hex string of the 32 byte digest for the new package without the 0x prefix
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     // This might throw an error because the Fuel contract doesn't support upgrades yet (blocked on Fuel releasing Upgradeability standard)
@@ -807,7 +813,7 @@ export class StarknetChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the felt252 class hash of the new contract class extended to uint256 in BE
+   * @param digest - hex string of the felt252 class hash of the new contract class extended to uint256 in BE
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, digest).encode();
@@ -817,15 +823,8 @@ export class StarknetChain extends Chain {
     const ARGENT_CLASS_HASH =
       "0x029927c8af6bccf3f6fda035981e765a7bdbf18a2dc0d630494f8758aa908e2b";
     const ADDR_BOUND =
-      0x7_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_00n;
-
-    function computeHashOnElements(elements: string[]): string {
-      let hash = "0";
-      for (const item of elements) {
-        hash = ec.starkCurve.pedersen(hash, item);
-      }
-      return ec.starkCurve.pedersen(hash, elements.length);
-    }
+      // eslint-disable-next-line unicorn/number-literal-case
+      0x7_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_ff_00n;
 
     const publicKey = await new Signer("0x" + privateKey).getPubKey();
 
@@ -916,7 +915,7 @@ export class TonChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param digest hex string of the 32 byte digest for the new package without the 0x prefix
+   * @param digest - hex string of the 32 byte digest for the new package without the 0x prefix
    */
   generateGovernanceUpgradePayload(digest: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, digest).encode();
@@ -1003,7 +1002,7 @@ export class NearChain extends Chain {
 
   /**
    * Returns the payload for a governance contract upgrade instruction for contracts deployed on this chain
-   * @param codeHash hex string of the 32 byte code hash for the new contract without the 0x prefix
+   * @param codeHash - hex string of the 32 byte code hash for the new contract without the 0x prefix
    */
   generateGovernanceUpgradePayload(codeHash: string): Buffer {
     return new UpgradeContract256Bit(this.wormholeChainName, codeHash).encode();

+ 15 - 12
contract_manager/src/core/contracts/aptos.ts

@@ -1,13 +1,13 @@
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-base-to-string */
 import type { DataSource } from "@pythnetwork/xc-admin-common";
 import { ApiError, BCS, CoinClient, TxnBuilderTypes } from "aptos";
 
-import type {PriceFeed, PrivateKey, TxResult} from "../base";
-import {
-  PriceFeedContract
-  
-  
-  
-} from "../base";
+import type { PriceFeed, PrivateKey, TxResult } from "../base";
+import { PriceFeedContract } from "../base";
 import { AptosChain, Chain } from "../chains";
 import type { TokenQty } from "../token";
 import { WormholeContract } from "./wormhole";
@@ -124,9 +124,9 @@ export class AptosPriceFeedContract extends PriceFeedContract {
    * Given the ids of the pyth state and wormhole state, create a new AptosContract
    * The package ids are derived based on the state ids
    *
-   * @param chain the chain which this contract is deployed on
-   * @param stateId id of the pyth state for the deployed contract
-   * @param wormholeStateId id of the wormhole state for the wormhole contract that pyth binds to
+   * @param chain - the chain which this contract is deployed on
+   * @param stateId - id of the pyth state for the deployed contract
+   * @param wormholeStateId - id of the wormhole state for the wormhole contract that pyth binds to
    */
   constructor(
     public chain: AptosChain,
@@ -196,7 +196,7 @@ export class AptosPriceFeedContract extends PriceFeedContract {
 
   /**
    * Returns the first occurrence of a resource with the given type in the pyth package state
-   * @param type
+   * @param type - the type of resource to find
    */
   async findResource(type: string) {
     const resources = await this.getStateResources();
@@ -254,7 +254,10 @@ export class AptosPriceFeedContract extends PriceFeedContract {
         emaPrice: this.parsePrice(priceItemRes.price_feed.ema_price),
       };
     } catch (error) {
-      if (error instanceof ApiError && error.errorCode === "table_item_not_found")
+      if (
+        error instanceof ApiError &&
+        error.errorCode === "table_item_not_found"
+      )
         return undefined;
       throw error;
     }

+ 45 - 32
contract_manager/src/core/contracts/cosmwasm.ts

@@ -1,24 +1,28 @@
+/* eslint-disable @typescript-eslint/restrict-plus-operands */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-base-to-string */
 import { readFileSync } from "node:fs";
 
 import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
 import type { Coin } from "@cosmjs/stargate";
-import type {ContractInfoResponse, Price} from "@pythnetwork/cosmwasm-deploy-tools";
+import type {
+  ContractInfoResponse,
+  Price,
+} from "@pythnetwork/cosmwasm-deploy-tools";
 import {
-  
   CosmwasmQuerier,
-  
   PythWrapperExecutor,
-  PythWrapperQuerier
+  PythWrapperQuerier,
 } from "@pythnetwork/cosmwasm-deploy-tools";
 import type { DataSource } from "@pythnetwork/xc-admin-common";
 
-import type {PrivateKey, TxResult} from "../base";
-import {
-  PriceFeedContract,
-  getDefaultDeploymentConfig
-  
-  
-} from "../base";
+import type { PrivateKey, TxResult } from "../base";
+import { PriceFeedContract, getDefaultDeploymentConfig } from "../base";
 import { Chain, CosmWasmChain } from "../chains";
 import type { TokenQty } from "../token";
 import { WormholeContract } from "./wormhole";
@@ -29,7 +33,7 @@ import { WormholeContract } from "./wormhole";
 export type WormholeSource = {
   emitter: string;
   chain_id: number;
-}
+};
 
 export type DeploymentConfig = {
   data_sources: WormholeSource[];
@@ -40,7 +44,14 @@ export type DeploymentConfig = {
   chain_id: number;
   valid_time_period_secs: number;
   fee: { amount: string; denom: string };
-}
+};
+
+const convertDataSource = (source: DataSource) => {
+  return {
+    emitter: Buffer.from(source.emitterAddress, "hex").toString("base64"),
+    chain_id: source.emitterChain,
+  };
+};
 
 export class CosmWasmWormholeContract extends WormholeContract {
   static type = "CosmWasmWormholeContract";
@@ -98,10 +109,16 @@ export class CosmWasmWormholeContract extends WormholeContract {
 
   async getGuardianSet(): Promise<string[]> {
     const config = await this.getConfig();
-    const guardianSetIndex = JSON.parse(config["\u0000\u0006config"] ?? "{}").guardian_set_index;
+    const guardianSetIndex = JSON.parse(
+      config["\u0000\u0006config"] ?? "{}",
+    ).guardian_set_index;
     let key = "\u0000\fguardian_set";
     //append guardianSetIndex as 4 bytes to key string
-    key += Buffer.from(guardianSetIndex.toString(16).padStart(8, "0"), "hex");
+
+    key += Buffer.from(
+      guardianSetIndex.toString(16).padStart(8, "0"),
+      "hex",
+    ).toString();
 
     const guardianSet = JSON.parse(config[key] ?? "{}").addresses;
     return guardianSet.map((entry: { bytes: string }) =>
@@ -173,9 +190,9 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
   /**
    * Stores the wasm code on the specified chain using the provided private key as the signer
    * You can find the wasm artifacts from the repo releases
-   * @param chain chain to store the code on
-   * @param privateKey private key to use for signing the transaction in hex format without 0x prefix
-   * @param wasmPath path in your local filesystem to the wasm artifact
+   * @param chain - chain to store the code on
+   * @param privateKey - private key to use for signing the transaction in hex format without 0x prefix
+   * @param wasmPath - path in your local filesystem to the wasm artifact
    */
   static async storeCode(
     chain: CosmWasmChain,
@@ -189,10 +206,10 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
 
   /**
    * Deploys a new contract to the specified chain using the uploaded wasm code codeId
-   * @param chain chain to deploy to
-   * @param codeId codeId of the uploaded wasm code. You can get this from the storeCode result
-   * @param config deployment config for initializing the contract (data sources, governance source, etc)
-   * @param privateKey private key to use for signing the transaction in hex format without 0x prefix
+   * @param chain - chain to deploy to
+   * @param codeId - codeId of the uploaded wasm code. You can get this from the storeCode result
+   * @param config - deployment config for initializing the contract (data sources, governance source, etc)
+   * @param privateKey - private key to use for signing the transaction in hex format without 0x prefix
    */
   static async initialize(
     chain: CosmWasmChain,
@@ -305,16 +322,12 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
 
   async getDeploymentType(): Promise<string> {
     const config = await this.getConfig();
-    const convertDataSource = (source: DataSource) => {
-      return {
-        emitter: Buffer.from(source.emitterAddress, "hex").toString("base64"),
-        chain_id: source.emitterChain,
-      };
-    };
-    const stableDataSources =
-      getDefaultDeploymentConfig("stable").dataSources.map(convertDataSource);
-    const betaDataSources =
-      getDefaultDeploymentConfig("beta").dataSources.map(convertDataSource);
+    const stableDataSources = getDefaultDeploymentConfig(
+      "stable",
+    ).dataSources.map((ds) => convertDataSource(ds));
+    const betaDataSources = getDefaultDeploymentConfig("beta").dataSources.map(
+      (ds) => convertDataSource(ds),
+    );
     if (this.equalDataSources(config.config_v1.data_sources, stableDataSources))
       return "stable";
     else if (

+ 28 - 17
contract_manager/src/core/contracts/evm.ts

@@ -1,9 +1,20 @@
+/* eslint-disable tsdoc/syntax */
+/* eslint-disable @typescript-eslint/await-thenable */
+/* eslint-disable no-console */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
+/* eslint-disable @typescript-eslint/no-base-to-string */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/require-await */
 import type { DataSource } from "@pythnetwork/xc-admin-common";
 import Web3 from "web3";
 import type { Contract } from "web3-eth-contract";
 
-import type {PrivateKey} from "../base";
-import { PriceFeedContract,  Storable } from "../base";
+import type { PrivateKey } from "../base";
+import { PriceFeedContract, Storable } from "../base";
 import { Chain, EvmChain } from "../chains";
 import type { TokenQty } from "../token";
 import {
@@ -138,7 +149,7 @@ type EntropyProviderInfo = {
   currentCommitment: string;
   currentCommitmentSequenceNumber: string;
   feeManager: string;
-}
+};
 
 type EntropyRequest = {
   provider: string;
@@ -149,7 +160,7 @@ type EntropyRequest = {
   requester: string;
   useBlockhash: boolean;
   isRequestWithCallback: boolean;
-}
+};
 
 export const ENTROPY_DEFAULT_PROVIDER = {
   mainnet: "0x52DeaA1c84233F7bb8C8A45baeDE41091c616506",
@@ -283,8 +294,8 @@ export class EvmEntropyContract extends Storable {
   /**
    * Returns the request for the given provider and sequence number
    * This will return a EntropyRequest object with sequenceNumber "0" if the request does not exist
-   * @param provider The entropy provider address
-   * @param sequenceNumber The sequence number of the request for the provider
+   * @param provider - The entropy provider address
+   * @param sequenceNumber - The sequence number of the request for the provider
    */
   async getRequest(
     provider: string,
@@ -299,9 +310,9 @@ export class EvmEntropyContract extends Storable {
    * This method assumes the request was made with a callback option and fetches the user random number
    * by finding the `RequestedWithCallback` log. The block number at which the request was made is required
    * to find the log.
-   * @param provider The entropy provider address
-   * @param sequenceNumber The sequence number of the request for the provider
-   * @param block The block number at which the request was made, you can find this using the `getRequest` method
+   * @param provider - The entropy provider address
+   * @param sequenceNumber - The sequence number of the request for the provider
+   * @param block - The block number at which the request was made, you can find this using the `getRequest` method
    */
   async getUserRandomNumber(
     provider: string,
@@ -322,11 +333,11 @@ export class EvmEntropyContract extends Storable {
 
   /**
    * Submits a transaction to the entropy contract to reveal the random number and call the callback function
-   * @param userRandomNumber The random number generated by the user, you can find this using the `getUserRandomNumber` method
-   * @param providerRevelation The random number generated by the provider, you can find this via the provider server
-   * @param provider The entropy provider address
-   * @param sequenceNumber The sequence number of the request for the provider
-   * @param senderPrivateKey The private key to use for submitting the transaction on-chain
+   * @param userRandomNumber - The random number generated by the user, you can find this using the `getUserRandomNumber` method
+   * @param providerRevelation - The random number generated by the provider, you can find this via the provider server
+   * @param provider - The entropy provider address
+   * @param sequenceNumber - The sequence number of the request for the provider
+   * @param senderPrivateKey - The private key to use for submitting the transaction on-chain
    */
   async revealWithCallback(
     userRandomNumber: string,
@@ -1009,9 +1020,9 @@ export class EvmLazerContract extends Storable {
 
   /**
    * Updates the trusted signer for the PythLazer contract
-   * @param trustedSigner The address of the trusted signer
-   * @param expiresAt The expiration timestamp for the signer
-   * @param privateKey The private key to sign the transaction
+   * @param trustedSigner - The address of the trusted signer
+   * @param expiresAt - The expiration timestamp for the signer
+   * @param privateKey - The private key to sign the transaction
    * @note The privateKey should be the owner of the Lazer contract. It's not possible to run this function if the executor contract is the owner.
    */
   async updateTrustedSigner(