deploy_cosmwasm.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import yargs from "yargs";
  2. import { hideBin } from "yargs/helpers";
  3. import { CosmWasmChain } from "../src/core/chains";
  4. import { CosmWasmPriceFeedContract } from "../src/core/contracts/cosmwasm";
  5. import { DefaultStore } from "../src/node/utils/store";
  6. import { COMMON_DEPLOY_OPTIONS } from "./common";
  7. const parser = yargs(hideBin(process.argv))
  8. .scriptName("deploy_cosmwasm.ts")
  9. .usage(
  10. "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>",
  11. )
  12. .options({
  13. code: {
  14. type: "string",
  15. demandOption: true,
  16. desc: "Path to the artifact .wasm file",
  17. },
  18. "private-key": COMMON_DEPLOY_OPTIONS["private-key"],
  19. chain: {
  20. type: "string",
  21. demandOption: true,
  22. desc: "Chain to upload the code on. Can be one of the chains available in the store",
  23. },
  24. wormholeContract: {
  25. type: "string",
  26. demandOption: true,
  27. desc: "Wormhole contract address deployed on this chain",
  28. },
  29. });
  30. async function main() {
  31. const argv = await parser.argv;
  32. const { code, wormholeContract } = argv;
  33. console.log(
  34. await CosmWasmPriceFeedContract.deploy(
  35. DefaultStore.chains[argv.chain] as CosmWasmChain,
  36. wormholeContract,
  37. argv["private-key"],
  38. code,
  39. ),
  40. );
  41. }
  42. main();