Browse Source

[cosmwasm] CosmWasm integration with contract manager (#1025)

* Integrate with contract manager for wormhole script

* Remove deprecated scripts and more integration with contract manager

* Remove cosmwasm tools store

These configs are now held in the contract manager

* Update docs on cosmwasm

* Split cosmwasm package into 2 for fixing dependency issues

* Fix cosmwasm README.md

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
Amin Moghaddam 2 năm trước cách đây
mục cha
commit
a7d133d063
59 tập tin đã thay đổi với 588 bổ sung2384 xóa
  1. 20 66
      contract_manager/src/contracts/cosmwasm.ts
  2. 5 1
      contract_manager/store/contracts/SuiContracts.yaml
  3. 151 128
      package-lock.json
  4. 1 0
      package.json
  5. 3 132
      target_chains/cosmwasm/README.md
  6. 27 0
      target_chains/cosmwasm/deploy-scripts/README.md
  7. 19 0
      target_chains/cosmwasm/deploy-scripts/package.json
  8. 0 0
      target_chains/cosmwasm/deploy-scripts/src/build-contract.ts
  9. 75 0
      target_chains/cosmwasm/deploy-scripts/src/configs.ts
  10. 76 0
      target_chains/cosmwasm/deploy-scripts/src/helper.ts
  11. 106 0
      target_chains/cosmwasm/deploy-scripts/src/instantiate-pyth.ts
  12. 92 0
      target_chains/cosmwasm/deploy-scripts/src/instantiate-wormhole.ts
  13. 9 0
      target_chains/cosmwasm/deploy-scripts/tsconfig.json
  14. 2 25
      target_chains/cosmwasm/tools/README.md
  15. 2 5
      target_chains/cosmwasm/tools/package.json
  16. 0 160
      target_chains/cosmwasm/tools/src/chains-manager/chains.ts
  17. 0 0
      target_chains/cosmwasm/tools/src/ci/deploy.ts
  18. 0 0
      target_chains/cosmwasm/tools/src/ci/deployer/config.ts
  19. 0 0
      target_chains/cosmwasm/tools/src/ci/deployer/index.ts
  20. 0 0
      target_chains/cosmwasm/tools/src/ci/deployer/injective.ts
  21. 0 0
      target_chains/cosmwasm/tools/src/ci/deployer/osmosis.ts
  22. 0 0
      target_chains/cosmwasm/tools/src/ci/deployer/terra.ts
  23. 0 0
      target_chains/cosmwasm/tools/src/ci/network.ts
  24. 0 178
      target_chains/cosmwasm/tools/src/configs.ts
  25. 0 9
      target_chains/cosmwasm/tools/src/contract-checksum.ts
  26. 0 181
      target_chains/cosmwasm/tools/src/deploy-pyth-bridge.ts
  27. 0 184
      target_chains/cosmwasm/tools/src/helper.ts
  28. 0 3
      target_chains/cosmwasm/tools/src/index.ts
  29. 0 151
      target_chains/cosmwasm/tools/src/instantiate-pyth.ts
  30. 0 162
      target_chains/cosmwasm/tools/src/pipeline.ts
  31. 0 175
      target_chains/cosmwasm/tools/src/pyth_config.ts
  32. 0 115
      target_chains/cosmwasm/tools/src/test.ts
  33. 0 47
      target_chains/cosmwasm/tools/src/wormhole-stub.ts
  34. 0 22
      target_chains/cosmwasm/tools/store/edge/instantiate-pyth/injective_testnet-1.2.0.json
  35. 0 22
      target_chains/cosmwasm/tools/store/edge/instantiate-pyth/juno_testnet-1.2.0.json
  36. 0 22
      target_chains/cosmwasm/tools/store/edge/instantiate-pyth/neutron_testnet_pion_1-1.2.0.json
  37. 0 22
      target_chains/cosmwasm/tools/store/edge/instantiate-pyth/osmosis_testnet_5-1.2.0.json
  38. 0 22
      target_chains/cosmwasm/tools/store/edge/instantiate-pyth/sei_testnet_atlantic_2-1.2.0.json
  39. 0 34
      target_chains/cosmwasm/tools/store/edge/test-contracts/injective_testnet-1.2.0.json
  40. 0 28
      target_chains/cosmwasm/tools/store/edge/test-contracts/juno_testnet-1.2.0.json
  41. 0 28
      target_chains/cosmwasm/tools/store/edge/test-contracts/neutron_testnet_pion_1-1.2.0.json
  42. 0 28
      target_chains/cosmwasm/tools/store/edge/test-contracts/osmosis_testnet_5-1.2.0.json
  43. 0 28
      target_chains/cosmwasm/tools/store/edge/test-contracts/sei_testnet_atlantic_2-1.2.0.json
  44. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/injective_testnet-1.2.0.json
  45. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/juno_testnet-1.2.0.json
  46. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/neutron-1.2.0.json
  47. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/neutron_testnet_pion_1-1.2.0.json
  48. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/osmosis-1.2.0.json
  49. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/osmosis_testnet_5-1.2.0.json
  50. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/sei_pacific_1-1.2.0.json
  51. 0 22
      target_chains/cosmwasm/tools/store/stable/instantiate-pyth/sei_testnet_atlantic_2-1.2.0.json
  52. 0 34
      target_chains/cosmwasm/tools/store/stable/test-contracts/injective_testnet-1.2.0.json
  53. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/juno_testnet-1.2.0.json
  54. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/neutron-1.2.0.json
  55. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/neutron_testnet_pion_1-1.2.0.json
  56. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/osmosis-1.2.0.json
  57. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/osmosis_testnet_5-1.2.0.json
  58. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/sei_pacific_1-1.2.0.json
  59. 0 28
      target_chains/cosmwasm/tools/store/stable/test-contracts/sei_testnet_atlantic_2-1.2.0.json

+ 20 - 66
contract_manager/src/contracts/cosmwasm.ts

@@ -3,16 +3,19 @@ import { readFileSync } from "fs";
 import {
   ContractInfoResponse,
   CosmwasmQuerier,
-  DeploymentType,
-  getPythConfig,
   Price,
   PythWrapperExecutor,
   PythWrapperQuerier,
 } from "@pythnetwork/cosmwasm-deploy-tools";
 import { Coin } from "@cosmjs/stargate";
-import { CHAINS, DataSource } from "xc_admin_common";
+import { DataSource } from "xc_admin_common";
 import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
-import { Contract, PrivateKey, TxResult } from "../base";
+import {
+  Contract,
+  getDefaultDeploymentConfig,
+  PrivateKey,
+  TxResult,
+} from "../base";
 import { WormholeContract } from "./wormhole";
 
 /**
@@ -85,7 +88,7 @@ export class CosmWasmContract extends Contract {
   async getDataSources(): Promise<DataSource[]> {
     const config = await this.getConfig();
     return config.config_v1.data_sources.map(
-      ({ emitter, chain_id }: { emitter: string; chain_id: string }) => {
+      ({ emitter, chain_id }: WormholeSource) => {
         return {
           emitterChain: Number(chain_id),
           emitterAddress: Buffer.from(emitter, "base64").toString("hex"),
@@ -124,19 +127,6 @@ export class CosmWasmContract extends Contract {
     return CosmWasmContract.type;
   }
 
-  static getDeploymentConfig(
-    chain: CosmWasmChain,
-    deploymentType: DeploymentType,
-    wormholeContract: string
-  ): DeploymentConfig {
-    return getPythConfig({
-      feeDenom: chain.feeDenom,
-      wormholeChainId: CHAINS[chain.wormholeChainName],
-      wormholeContract,
-      deploymentType: deploymentType,
-    });
-  }
-
   /**
    * 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
@@ -180,28 +170,6 @@ export class CosmWasmContract extends Contract {
     return new CosmWasmContract(chain, result.contractAddr);
   }
 
-  /**
-   * Uploads the wasm code and initializes a new contract to the specified chain.
-   * Use this method if you are deploying to a new chain, or you want a fresh contract in
-   * a testnet environment. Uses the default deployment configurations for governance, data sources,
-   * valid time period, etc. You can manually run the storeCode and initialize methods if you want
-   * more control over the deployment process.
-   * @param chain
-   * @param wormholeContract
-   * @param privateKey private key to use for signing the transaction in hex format without 0x prefix
-   * @param wasmPath
-   */
-  static async deploy(
-    chain: CosmWasmChain,
-    wormholeContract: string,
-    privateKey: PrivateKey,
-    wasmPath: string
-  ): Promise<CosmWasmContract> {
-    const config = this.getDeploymentConfig(chain, "beta", wormholeContract);
-    const { codeId } = await this.storeCode(chain, privateKey, wasmPath);
-    return this.initialize(chain, codeId, config, privateKey);
-  }
-
   getId(): string {
     return `${this.chain.getId()}_${this.address}`;
   }
@@ -247,9 +215,6 @@ export class CosmWasmContract extends Contract {
     return Number(config.config_v1.governance_sequence_number);
   }
 
-  // TODO: function for upgrading the contract
-  // TODO: Cleanup and more strict linter to convert let to const
-
   private parsePrice(priceInfo: Price) {
     return {
       conf: priceInfo.conf.toString(),
@@ -295,31 +260,20 @@ export class CosmWasmContract extends Contract {
 
   async getDeploymentType(): Promise<string> {
     const config = await this.getConfig();
-    const wormholeContract = config.config_v1.wormhole_contract;
-    const stableConfig = getPythConfig({
-      feeDenom: this.chain.feeDenom,
-      wormholeChainId: CHAINS[this.chain.getId() as keyof typeof CHAINS],
-      wormholeContract,
-      deploymentType: "stable",
-    });
-    const betaConfig = getPythConfig({
-      feeDenom: this.chain.feeDenom,
-      wormholeChainId: CHAINS[this.chain.getId() as keyof typeof CHAINS],
-      wormholeContract,
-      deploymentType: "beta",
-    });
-    if (
-      this.equalDataSources(
-        config.config_v1.data_sources,
-        stableConfig.data_sources
-      )
-    )
+    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);
+    if (this.equalDataSources(config.config_v1.data_sources, stableDataSources))
       return "stable";
     else if (
-      this.equalDataSources(
-        config.config_v1.data_sources,
-        betaConfig.data_sources
-      )
+      this.equalDataSources(config.config_v1.data_sources, betaDataSources)
     )
       return "beta";
     else return "unknown";

+ 5 - 1
contract_manager/store/contracts/SuiContracts.yaml

@@ -2,11 +2,15 @@
   stateId: "0xf9ff3ef935ef6cdfb659a203bf2754cebeb63346e29114a535ea6f41315e5a3f"
   wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
   type: SuiContract
+- chain: sui_mainnet
+  stateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
+  wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
+  type: SuiContract
 - chain: sui_testnet
   stateId: "0xb3142a723792001caafc601b7c6fe38f09f3684e360b56d8d90fc574e71e75f3"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
   type: SuiContract
 - chain: sui_testnet
-  stateId: "0xe8c2ddcd5b10e8ed98e53b12fcf8f0f6fd9315f810ae61fa4001858851f21c88"
+  stateId: "0x2d82612a354f0b7e52809fc2845642911c7190404620cec8688f68808f8800d8"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
   type: SuiContract

+ 151 - 128
package-lock.json

@@ -16,6 +16,7 @@
         "target_chains/aptos/sdk/js",
         "target_chains/cosmwasm/sdk/js",
         "target_chains/cosmwasm/tools",
+        "target_chains/cosmwasm/deploy-scripts",
         "target_chains/ethereum/contracts",
         "target_chains/ethereum/sdk/js",
         "target_chains/ethereum/sdk/solidity",
@@ -11963,6 +11964,10 @@
         "ieee754": "^1.2.1"
       }
     },
+    "node_modules/@pythnetwork/cosmwasm-deploy-scripts": {
+      "resolved": "target_chains/cosmwasm/deploy-scripts",
+      "link": true
+    },
     "node_modules/@pythnetwork/cosmwasm-deploy-tools": {
       "resolved": "target_chains/cosmwasm/tools",
       "link": true
@@ -41733,12 +41738,12 @@
       "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
     },
     "node_modules/path-scurry": {
-      "version": "1.9.1",
-      "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.1.tgz",
-      "integrity": "sha512-UgmoiySyjFxP6tscZDgWGEAgsW5ok8W3F5CJDnnH2pozwSTGE6eH7vwTotMwATWA2r5xqdkKdxYPkwlJjAI/3g==",
+      "version": "1.10.1",
+      "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz",
+      "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==",
       "dependencies": {
-        "lru-cache": "^9.1.1",
-        "minipass": "^5.0.0 || ^6.0.0"
+        "lru-cache": "^9.1.1 || ^10.0.0",
+        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
       },
       "engines": {
         "node": ">=16 || 14 >=14.17"
@@ -41756,9 +41761,9 @@
       }
     },
     "node_modules/path-scurry/node_modules/minipass": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.0.tgz",
-      "integrity": "sha512-mvD5U4pUen1aWcjTxUgdoMg6PB98dcV0obc/OiPzls79++IpgNoO+MCbOHRlKfWIOvjIjmjUygjZmSStP7B0Og==",
+      "version": "7.0.3",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
+      "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==",
       "engines": {
         "node": ">=16 || 14 >=14.17"
       }
@@ -58049,6 +58054,84 @@
         "node": ">=12"
       }
     },
+    "target_chains/cosmwasm/deploy-scripts": {
+      "name": "@pythnetwork/cosmwasm-deploy-scripts",
+      "version": "1.0.0",
+      "license": "Apache-2.0",
+      "dependencies": {
+        "@pythnetwork/cosmwasm-deploy-tools": "*",
+        "contract_manager": "*",
+        "rimraf": "^5.0.0"
+      }
+    },
+    "target_chains/cosmwasm/deploy-scripts/node_modules/brace-expansion": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+      "dependencies": {
+        "balanced-match": "^1.0.0"
+      }
+    },
+    "target_chains/cosmwasm/deploy-scripts/node_modules/glob": {
+      "version": "10.3.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz",
+      "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==",
+      "dependencies": {
+        "foreground-child": "^3.1.0",
+        "jackspeak": "^2.0.3",
+        "minimatch": "^9.0.1",
+        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
+        "path-scurry": "^1.10.1"
+      },
+      "bin": {
+        "glob": "dist/cjs/src/bin.js"
+      },
+      "engines": {
+        "node": ">=16 || 14 >=14.17"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "target_chains/cosmwasm/deploy-scripts/node_modules/minimatch": {
+      "version": "9.0.3",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
+      "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
+      "dependencies": {
+        "brace-expansion": "^2.0.1"
+      },
+      "engines": {
+        "node": ">=16 || 14 >=14.17"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "target_chains/cosmwasm/deploy-scripts/node_modules/minipass": {
+      "version": "7.0.3",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
+      "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==",
+      "engines": {
+        "node": ">=16 || 14 >=14.17"
+      }
+    },
+    "target_chains/cosmwasm/deploy-scripts/node_modules/rimraf": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz",
+      "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==",
+      "dependencies": {
+        "glob": "^10.2.5"
+      },
+      "bin": {
+        "rimraf": "dist/cjs/src/bin.js"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
     "target_chains/cosmwasm/sdk/js": {
       "name": "@pythnetwork/pyth-terra-js",
       "version": "1.3.1",
@@ -58124,7 +58207,7 @@
     "target_chains/cosmwasm/tools": {
       "name": "@pythnetwork/cosmwasm-deploy-tools",
       "version": "1.1.0",
-      "license": "ISC",
+      "license": "Apache-2.0",
       "dependencies": {
         "@cosmjs/cosmwasm-stargate": "^0.29.5",
         "@cosmjs/encoding": "^0.26.2",
@@ -58141,7 +58224,6 @@
         "ethers": "^5.4.4",
         "node-downloader-helper": "^2.1.7",
         "osmojs": "^13.0.0-rc.7-i-alpha",
-        "rimraf": "^5.0.0",
         "xc_admin_common": "*",
         "yargs": "^17.0.1"
       },
@@ -58447,14 +58529,6 @@
         "follow-redirects": "^1.14.0"
       }
     },
-    "target_chains/cosmwasm/tools/node_modules/brace-expansion": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
-      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
-      "dependencies": {
-        "balanced-match": "^1.0.0"
-      }
-    },
     "target_chains/cosmwasm/tools/node_modules/cliui": {
       "version": "8.0.1",
       "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@@ -58486,49 +58560,6 @@
         "node": ">=12"
       }
     },
-    "target_chains/cosmwasm/tools/node_modules/glob": {
-      "version": "10.2.4",
-      "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.4.tgz",
-      "integrity": "sha512-fDboBse/sl1oXSLhIp0FcCJgzW9KmhC/q8ULTKC82zc+DL3TL7FNb8qlt5qqXN53MsKEUSIcb+7DLmEygOE5Yw==",
-      "dependencies": {
-        "foreground-child": "^3.1.0",
-        "jackspeak": "^2.0.3",
-        "minimatch": "^9.0.0",
-        "minipass": "^5.0.0 || ^6.0.0",
-        "path-scurry": "^1.7.0"
-      },
-      "bin": {
-        "glob": "dist/cjs/src/bin.js"
-      },
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      }
-    },
-    "target_chains/cosmwasm/tools/node_modules/minimatch": {
-      "version": "9.0.0",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz",
-      "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==",
-      "dependencies": {
-        "brace-expansion": "^2.0.1"
-      },
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      }
-    },
-    "target_chains/cosmwasm/tools/node_modules/minipass": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.0.tgz",
-      "integrity": "sha512-mvD5U4pUen1aWcjTxUgdoMg6PB98dcV0obc/OiPzls79++IpgNoO+MCbOHRlKfWIOvjIjmjUygjZmSStP7B0Og==",
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      }
-    },
     "target_chains/cosmwasm/tools/node_modules/protobufjs": {
       "version": "6.11.3",
       "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz",
@@ -58554,23 +58585,6 @@
         "pbts": "bin/pbts"
       }
     },
-    "target_chains/cosmwasm/tools/node_modules/rimraf": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.0.tgz",
-      "integrity": "sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==",
-      "dependencies": {
-        "glob": "^10.0.0"
-      },
-      "bin": {
-        "rimraf": "dist/cjs/src/bin.js"
-      },
-      "engines": {
-        "node": ">=14"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      }
-    },
     "target_chains/cosmwasm/tools/node_modules/yargs": {
       "version": "17.7.2",
       "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
@@ -68259,6 +68273,57 @@
         }
       }
     },
+    "@pythnetwork/cosmwasm-deploy-scripts": {
+      "version": "file:target_chains/cosmwasm/deploy-scripts",
+      "requires": {
+        "@pythnetwork/cosmwasm-deploy-tools": "*",
+        "contract_manager": "*",
+        "rimraf": "^5.0.0"
+      },
+      "dependencies": {
+        "brace-expansion": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+          "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+          "requires": {
+            "balanced-match": "^1.0.0"
+          }
+        },
+        "glob": {
+          "version": "10.3.3",
+          "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz",
+          "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==",
+          "requires": {
+            "foreground-child": "^3.1.0",
+            "jackspeak": "^2.0.3",
+            "minimatch": "^9.0.1",
+            "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
+            "path-scurry": "^1.10.1"
+          }
+        },
+        "minimatch": {
+          "version": "9.0.3",
+          "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
+          "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
+          "requires": {
+            "brace-expansion": "^2.0.1"
+          }
+        },
+        "minipass": {
+          "version": "7.0.3",
+          "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
+          "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg=="
+        },
+        "rimraf": {
+          "version": "5.0.1",
+          "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz",
+          "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==",
+          "requires": {
+            "glob": "^10.2.5"
+          }
+        }
+      }
+    },
     "@pythnetwork/cosmwasm-deploy-tools": {
       "version": "file:target_chains/cosmwasm/tools",
       "requires": {
@@ -68284,7 +68349,6 @@
         "ethers": "^5.4.4",
         "node-downloader-helper": "^2.1.7",
         "osmojs": "^13.0.0-rc.7-i-alpha",
-        "rimraf": "^5.0.0",
         "ts-node": "^10.9.1",
         "typescript": "^4.9.3",
         "xc_admin_common": "*",
@@ -68584,14 +68648,6 @@
             "follow-redirects": "^1.14.0"
           }
         },
-        "brace-expansion": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
-          "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
-          "requires": {
-            "balanced-match": "^1.0.0"
-          }
-        },
         "cliui": {
           "version": "8.0.1",
           "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
@@ -68617,31 +68673,6 @@
           "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
           "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
         },
-        "glob": {
-          "version": "10.2.4",
-          "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.4.tgz",
-          "integrity": "sha512-fDboBse/sl1oXSLhIp0FcCJgzW9KmhC/q8ULTKC82zc+DL3TL7FNb8qlt5qqXN53MsKEUSIcb+7DLmEygOE5Yw==",
-          "requires": {
-            "foreground-child": "^3.1.0",
-            "jackspeak": "^2.0.3",
-            "minimatch": "^9.0.0",
-            "minipass": "^5.0.0 || ^6.0.0",
-            "path-scurry": "^1.7.0"
-          }
-        },
-        "minimatch": {
-          "version": "9.0.0",
-          "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz",
-          "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==",
-          "requires": {
-            "brace-expansion": "^2.0.1"
-          }
-        },
-        "minipass": {
-          "version": "6.0.0",
-          "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.0.tgz",
-          "integrity": "sha512-mvD5U4pUen1aWcjTxUgdoMg6PB98dcV0obc/OiPzls79++IpgNoO+MCbOHRlKfWIOvjIjmjUygjZmSStP7B0Og=="
-        },
         "protobufjs": {
           "version": "6.11.3",
           "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz",
@@ -68662,14 +68693,6 @@
             "long": "^4.0.0"
           }
         },
-        "rimraf": {
-          "version": "5.0.0",
-          "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.0.tgz",
-          "integrity": "sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==",
-          "requires": {
-            "glob": "^10.0.0"
-          }
-        },
         "yargs": {
           "version": "17.7.2",
           "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
@@ -96217,12 +96240,12 @@
       "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
     },
     "path-scurry": {
-      "version": "1.9.1",
-      "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.1.tgz",
-      "integrity": "sha512-UgmoiySyjFxP6tscZDgWGEAgsW5ok8W3F5CJDnnH2pozwSTGE6eH7vwTotMwATWA2r5xqdkKdxYPkwlJjAI/3g==",
+      "version": "1.10.1",
+      "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz",
+      "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==",
       "requires": {
-        "lru-cache": "^9.1.1",
-        "minipass": "^5.0.0 || ^6.0.0"
+        "lru-cache": "^9.1.1 || ^10.0.0",
+        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
       },
       "dependencies": {
         "lru-cache": {
@@ -96231,9 +96254,9 @@
           "integrity": "sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A=="
         },
         "minipass": {
-          "version": "6.0.0",
-          "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.0.tgz",
-          "integrity": "sha512-mvD5U4pUen1aWcjTxUgdoMg6PB98dcV0obc/OiPzls79++IpgNoO+MCbOHRlKfWIOvjIjmjUygjZmSStP7B0Og=="
+          "version": "7.0.3",
+          "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
+          "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg=="
         }
       }
     },

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "target_chains/aptos/sdk/js",
     "target_chains/cosmwasm/sdk/js",
     "target_chains/cosmwasm/tools",
+    "target_chains/cosmwasm/deploy-scripts",
     "target_chains/ethereum/contracts",
     "target_chains/ethereum/sdk/js",
     "target_chains/ethereum/sdk/solidity",

+ 3 - 132
target_chains/cosmwasm/README.md

@@ -19,142 +19,13 @@ We do this on cosmwasm by assigning unique chain ids to the testnet and mainnet.
 Deploying the CosmWasm contract has three steps:
 
 1. Upload the code. This step will give you a code id.
-2. Either create a new contract or migrate an existing one:
+2. Either create a new contract or upgrade an existing one:
    1. Create a new contract that has an address with a code id as its program.
-   2. Migrating an existing contract code id to the new code id.
+   2. Upgrade an existing contract code id to the new code id using governance messages.
 3. Update contract's admin to itself.
 
-This directory contains the code to perform all the steps. Read below for the details.
-
-### Uploading the code
-
-First, build the contracts within [the current directory](./). You must have Docker installed.
-
-```
-cd ./tools
-npm ci
-
-# if you want to build specifically for one chain
-npm run build-contract -- --[injective|osmosis]
-
-# else a generic cosmwasm contract can be build using
-npm run build-contract -- --cosmwasm
-```
-
-This command will build and save the Pyth contract in the `artifacts` directory.
-
-Then, to deploy the Pyth contract (`pyth_cosmwasm.wasm`), run the following command in the `tools` directory:
-
-```sh
-npm ci # Do it only once to install the required packages
-npm run deploy-pyth -- deploy-artifact --network osmosis_local --mnemonic "online prefer ..." --artifact "../artifacts/pyth_cosmwasm.wasm"
-```
-
-If successful, this command will print something along the lines of:
-
-```sh
-Deploying artifact
-Storing WASM: ../artifacts/pyth_cosmwasm.wasm (230813 bytes)
-Broadcasted transaction hash: "BBD2E5DF5046B24287E63C53852D251D4F7DDD7755E663C9EB67A9B5560DFE4C"
-Deployed Code ID:  11
-```
+The [scripts](./deploy-scripts/README.md) directory contains the instructions and scripts to perform all the steps.
 
 #### Permissoned networks:
 
 We currently have two permissioned networks: injective and osmosis. Uploading the code on their mainnet is not possible without an authority or a governance proposal.
-
-### Instantiating new contract
-
-Pyth contract needs the Wormhole core contract deployed on the same chain. Some chains won't have it deployed.
-In that case, you have to deploy wormhole contract yourself. You can build the contract using the scripts given in `wormhole-stub`.
-Run and you will get the compiled contract code in `wormhole-stub/artifacts`
-
-```sh
-./build.sh
-```
-
-This command will upload the code and instantiates a new Pyth contract with the given code id:
-
-```sh
-npm run deploy-pyth -- instantiate --network osmosis_local --code-id 10 --mnemonic "online prefer ..."
-```
-
-If successful, the output should look like so:
-
-```
-Instantiating a contract
-Broadcasted transaction hash: "5F9689ACEB5A57868F9B305A211962DEA826B1C47900904D39D61449A095ADE1"
-Instantiated pyth at osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d (0xb884f83f981dda1d2f9957cd68e1f19cb49d3c04aea2ecfbe833ddc6b7cac2f7)
-Deployed Pyth contract at osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d
-```
-
-### Migrating existing contract
-
-If you want to upgrade an existing contract pass use the `migrate` command as follows.
-This command will upload the code, and with the given code id, will migrate the existing contract to the new one:
-
-```sh
-npm run deploy-pyth -- migrate --network osmosis_local --code-id 9 --contract osmo1.. --mnemonic "online prefer ..."
-```
-
-If successful, the output should look like so:
-
-```
-Migrating contract osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d to 9
-Broadcasted transaction hash: "8CF74A7FDBA4264DC58418289D6A256DEA3BBFB89ABD6C0D74C0CEBC29418E52"
-Contract osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d code_id successfully updated to 9
-```
-
-### Updating contract's admin
-
-Pyth contracts are owner of their own. To update a smart contract's admin use the following command.
-
-```sh
-npm run deploy-pyth -- update-admin --network osmosis_local --new-admin osmo1.. --contract osmo1... --mnemonic "online prefer ..."
-```
-
-The output should be like.
-
-```
-Updating contract's admin
-Broadcasted transaction hash: "B8AA9E25F3AF28858464622AFABA0C0157BD0CB1814C6DB62ACDD2D240E5B973"
-{
-  codeId: 9,
-  address: 'osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d',
-  creator: 'osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks',
-  admin: 'osmo1hzz0s0ucrhdp6tue2lxk3c03nj6f60qy463we7lgx0wudd72ctms64096d',
-  initMsg: undefined
-}
-Contract's admin successfully updates
-```
-
-### Getting contract's info
-
-If you want to check a contract details, use the following command.
-
-```sh
-npm run deploy-pyth -- get-contract-info --network osmosis_local --contract osmo1... --mnemonic "online prefer ..."
-```
-
-The output should be like:
-
-```
-Fetching contract info for: osmo1v6qjx5smfdxnh5gr8vprswl60rstyprj3wh4gz5mg7gcl7mtl5xqkm7gje
-Fetched contract info for: osmo1v6qjx5smfdxnh5gr8vprswl60rstyprj3wh4gz5mg7gcl7mtl5xqkm7gje
-{
-  codeId: 9,
-  address: 'osmo1v6qjx5smfdxnh5gr8vprswl60rstyprj3wh4gz5mg7gcl7mtl5xqkm7gje',
-  creator: 'osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks',
-  admin: 'osmo1v6qjx5smfdxnh5gr8vprswl60rstyprj3wh4gz5mg7gcl7mtl5xqkm7gje',
-  initMsg: undefined
-}
-```
-
-### Common Errors
-
-While running the instantiation/migration commands you might get the following errors:
-
-- Gateway timeout: This error means that the request timed out. It is good to double check with terra finder as sometimes transactions succeed despite being timed out.
-- Account sequence mismatch: Transactions from an account should have an increasing sequence number. This error happens when a transaction from the same sender is not fully synchronized with the terra RPC and an old sequence number is used. This is likely to happen because the deploy script sends two transactions: one to submit the code, and one to do the instantiation/migration.
-
-Sometimes the output might have some node.js warning. But if you see a similar output as mentioned above. Transaction was successful.

+ 27 - 0
target_chains/cosmwasm/deploy-scripts/README.md

@@ -0,0 +1,27 @@
+# How to add a new chain or contract
+
+1. Add the chain information to contract manager `CosmWasmChains.yaml`. You can lookup for rpc endpoints in [this repo](https://github.com/cosmos/chain-registry). The `gasPrice` is the `average_gas_price` of the chain + the chain token `denom` (Available in chain-registry `chain.json` file).
+2. If the wormhole contract is not deployed on the target chain run the following command:
+
+   ```
+   npm run instantiate-wormhole -- --private-key <YOUR_PRIVATE_KEY_HEX> --deploy <stable or edge> --chain <chain id>
+   ```
+
+   You can re-build the wormhole contract using the scripts given in `wormhole-stub`.
+   Run `build.sh` and you will get the compiled contract code in `wormhole-stub/artifacts`
+
+3. Deploy the pyth contract:
+
+   ```
+   npm run instantiate-pyth --contract-version <X.Y.Z> --private-key <YOUR_PRIVATE_KEY_HEX> --deploy <stable or edge>
+   ```
+
+4. You can test the new contract via contract manager scripts like this:
+
+   ```
+   cd ../../../contract_manager
+   npx ts-node scripts/update_pricefeed.ts --private-key <YOUR_PRIVATE_KEY_HEX> --contract <CONTRACT_ID> --feed-id <FEED_ID>
+   ```
+
+5. Commit the new entries added to contract manager yaml files
+6. Update documentation repos and add the new contract address

+ 19 - 0
target_chains/cosmwasm/deploy-scripts/package.json

@@ -0,0 +1,19 @@
+{
+  "name": "@pythnetwork/cosmwasm-deploy-scripts",
+  "version": "1.0.0",
+  "description": "",
+  "private": "true",
+  "scripts": {
+    "build": "tsc",
+    "build-contract": "ts-node ./src/build-contract.ts",
+    "instantiate-wormhole": "ts-node ./src/instantiate-wormhole.ts",
+    "instantiate-pyth": "ts-node ./src/instantiate-pyth.ts"
+  },
+  "author": "",
+  "license": "Apache-2.0",
+  "dependencies": {
+    "rimraf": "^5.0.0",
+    "@pythnetwork/cosmwasm-deploy-tools": "*",
+    "contract_manager": "*"
+  }
+}

+ 0 - 0
target_chains/cosmwasm/tools/src/build-contract.ts → target_chains/cosmwasm/deploy-scripts/src/build-contract.ts


+ 75 - 0
target_chains/cosmwasm/deploy-scripts/src/configs.ts

@@ -0,0 +1,75 @@
+import { getDefaultDeploymentConfig } from "contract_manager";
+import { DeploymentType } from "./helper";
+
+function getPythSources(deploymentType: DeploymentType) {
+  const config = getDefaultDeploymentConfig(deploymentType);
+  return {
+    data_sources: config.dataSources.map((source) => {
+      return {
+        emitter: Buffer.from(source.emitterAddress, "hex").toString("base64"),
+        chain_id: source.emitterChain,
+      };
+    }),
+    governance_source: {
+      emitter: Buffer.from(
+        config.governanceDataSource.emitterAddress,
+        "hex"
+      ).toString("base64"),
+      chain_id: config.governanceDataSource.emitterChain,
+    },
+  };
+}
+
+export function getPythConfig({
+  feeDenom,
+  wormholeContract,
+  wormholeChainId,
+  deploymentType,
+}: {
+  feeDenom: string;
+  wormholeContract: string;
+  wormholeChainId: number;
+  deploymentType: DeploymentType;
+}) {
+  return {
+    wormhole_contract: wormholeContract,
+    governance_source_index: 0,
+    governance_sequence_number: 0,
+    chain_id: wormholeChainId,
+    valid_time_period_secs: 60,
+    fee: {
+      amount: "1",
+      denom: feeDenom,
+    },
+    ...getPythSources(deploymentType),
+  };
+}
+
+interface ReqWormholeConfig {
+  feeDenom: string;
+  wormholeChainId: number;
+  deploymentType: DeploymentType;
+}
+
+export function getWormholeConfig({
+  feeDenom,
+  wormholeChainId,
+  deploymentType,
+}: ReqWormholeConfig) {
+  const config = getDefaultDeploymentConfig(deploymentType).wormholeConfig;
+  return {
+    chain_id: wormholeChainId,
+    fee_denom: feeDenom,
+    gov_chain: config.governanceChainId,
+    gov_address: Buffer.from(config.governanceContract, "hex").toString(
+      "base64"
+    ),
+    guardian_set_expirity: 86400,
+    initial_guardian_set: {
+      addresses: config.initialGuardianSet.map((guardian) => ({
+        bytes: Buffer.from(guardian, "hex").toString("base64"),
+      })),
+      expiration_time: 0,
+    },
+  };
+}

+ 76 - 0
target_chains/cosmwasm/deploy-scripts/src/helper.ts

@@ -0,0 +1,76 @@
+import { existsSync, mkdirSync, readFileSync } from "fs";
+import { rimrafSync } from "rimraf";
+import AdmZip from "adm-zip";
+import path from "path";
+import { DownloaderHelper } from "node-downloader-helper";
+
+export type DeploymentType = "stable" | "beta";
+
+// We have released the compile contacts on github. If a chain needs some specific
+// feature in a contract, a version of the contract with that specific features is
+// released. For example, "injective.zip" for injective.
+// NOTE that each zip file should contain the compiled code with the same file
+// name `pyth_cosmwasm.wasm`
+// Given a contract version (eg 1.3.0) and  zipFileNames (eg ["injective", "osmosis"])
+// this method will return an object with key = zipFileName and value = compiledCode
+export async function getContractBytesDict(
+  artifactZipFileNames: string[],
+  version: string
+) {
+  const githubArtifactsLink = `https://github.com/pyth-network/pyth-crosschain/releases/download/pyth-cosmwasm-contract-v${version}/`;
+  const tmpCodeStorageDir = "./tmp";
+  // clear tmp directory before downloading contracts
+  rimrafSync(tmpCodeStorageDir);
+
+  if (existsSync(tmpCodeStorageDir) === false) {
+    mkdirSync(tmpCodeStorageDir, { recursive: true });
+  }
+
+  const uniqueArtifactsZipName = Array.from(new Set(artifactZipFileNames));
+
+  // download zip files
+  await Promise.all(
+    uniqueArtifactsZipName.map(async (artifactZipName) => {
+      return new Promise<void>((resolve, reject) => {
+        const dl = new DownloaderHelper(
+          githubArtifactsLink + artifactZipName + ".zip",
+          tmpCodeStorageDir
+        );
+
+        dl.on("end", () => {
+          console.log("Download Completed");
+          resolve();
+        });
+        dl.on("error", (err) => {
+          console.log("Download Failed", err);
+          reject(err);
+        });
+        dl.start().catch((err) => {
+          console.error(err);
+          reject(err);
+        });
+      });
+    })
+  );
+
+  // extract zip files
+  uniqueArtifactsZipName.map(async (artifactZipName) => {
+    const zip = new AdmZip(
+      path.resolve(tmpCodeStorageDir + "/" + artifactZipName + ".zip")
+    );
+    zip.extractAllTo(path.resolve(tmpCodeStorageDir));
+  });
+
+  let contractBytesDict: { [fileName: string]: Buffer } = {};
+  for (let uniqueArtifactZipName of uniqueArtifactsZipName) {
+    const contractBytes = readFileSync(
+      tmpCodeStorageDir + "/" + uniqueArtifactZipName + "/pyth_cosmwasm.wasm"
+    );
+    contractBytesDict[uniqueArtifactZipName] = contractBytes;
+  }
+
+  // clear tmp directory after downloading contracts
+  rimrafSync(tmpCodeStorageDir);
+
+  return contractBytesDict;
+}

+ 106 - 0
target_chains/cosmwasm/deploy-scripts/src/instantiate-pyth.ts

@@ -0,0 +1,106 @@
+import yargs from "yargs";
+import { hideBin } from "yargs/helpers";
+import { sha256 } from "@cosmjs/crypto";
+import { getPythConfig } from "./configs";
+import {
+  CosmWasmChain,
+  CosmWasmContract,
+  DefaultStore,
+  Store,
+  toPrivateKey,
+} from "contract_manager";
+import { CHAINS } from "xc_admin_common";
+import { DeploymentType, getContractBytesDict } from "./helper";
+
+const argv = yargs(hideBin(process.argv))
+  .usage("USAGE: npm run instantiate-pyth -- <command>")
+  .option("private-key", {
+    type: "string",
+    demandOption: "Please provide the private key",
+  })
+  .option("contract-version", {
+    type: "string",
+    demandOption: `Please input the contract-version of the pyth contract.`,
+  })
+  .option("deploy", {
+    type: "string",
+    desc: "Execute this script for the given networks.",
+    choices: ["beta", "stable"],
+    demandOption: "Please provide the deployment type",
+  })
+  .option("wormhole", {
+    type: "string",
+    desc: "Wormhole contract address deployed on the chain",
+    demandOption: "Please provide the wormhole contract address",
+  })
+  .option("chain", {
+    type: "string",
+    desc: "Deploy the wormhole contract to the given chain",
+    demandOption: "Please provide a chain to deploy the contract to",
+  })
+  .help()
+  .alias("help", "h")
+  .wrap(yargs.terminalWidth())
+  .parseSync();
+
+async function run() {
+  const chain = DefaultStore.chains[argv.chain];
+  if (!(chain instanceof CosmWasmChain)) {
+    throw new Error(`Chain ${argv.chain} not found or not a CosmWasmChain`);
+  }
+  const privateKey = argv["private-key"];
+
+  const chainExecutor = await chain.getExecutor(toPrivateKey(privateKey));
+  let pythArtifactZipName = "cosmwasm";
+  if (chain.getId().indexOf("osmosis") !== -1) {
+    pythArtifactZipName = "osmosis";
+  }
+  if (chain.getId().indexOf("injective") !== -1) {
+    pythArtifactZipName = "injective";
+  }
+  // get the wasm code from github
+  let contractBytesDict = await getContractBytesDict(
+    [pythArtifactZipName],
+    argv.contractVersion
+  );
+
+  const checksum = Buffer.from(
+    sha256(contractBytesDict[pythArtifactZipName])
+  ).toString("hex");
+
+  console.log(`Downloaded wasm checksum ${checksum}`);
+
+  const storeCodeRes = await chainExecutor.storeCode({
+    contractBytes: contractBytesDict[pythArtifactZipName],
+  });
+
+  console.log(
+    `Code stored on chain ${chain.getId()} at ${storeCodeRes.codeId}`
+  );
+
+  const instantiateContractRes = await chainExecutor.instantiateContract({
+    codeId: storeCodeRes.codeId,
+    instMsg: getPythConfig({
+      feeDenom: chain.feeDenom,
+      wormholeChainId: CHAINS[chain.wormholeChainName],
+      wormholeContract: argv.wormhole,
+      deploymentType: argv.deploy as DeploymentType,
+    }),
+    label: "pyth",
+  });
+  const address = instantiateContractRes.contractAddr;
+  console.log(`Contract instantiated at ${address}`);
+  await chainExecutor.updateContractAdmin({
+    newAdminAddr: address,
+    contractAddr: address,
+  });
+  console.log(`Contract admin set to ${address}`);
+
+  const contract = new CosmWasmContract(chain, address);
+  DefaultStore.contracts[contract.getId()] = contract;
+  DefaultStore.saveAllContracts();
+  console.log("Added the following to your CosmWasm contracts configs");
+  console.log(Store.serialize(contract));
+}
+
+run();

+ 92 - 0
target_chains/cosmwasm/deploy-scripts/src/instantiate-wormhole.ts

@@ -0,0 +1,92 @@
+import yargs from "yargs";
+import { hideBin } from "yargs/helpers";
+import { getWormholeConfig } from "./configs";
+import {
+  CosmWasmChain,
+  CosmWasmContract,
+  DefaultStore,
+  toPrivateKey,
+  WormholeCosmWasmContract,
+} from "contract_manager";
+import { CHAINS } from "xc_admin_common";
+import { DeploymentType } from "./helper";
+
+const argv = yargs(hideBin(process.argv))
+  .usage("USAGE: npm run wormhole-stub -- <command>")
+  .option("private-key", {
+    type: "string",
+    demandOption: "Please provide the private key",
+  })
+  .option("contract-version", {
+    type: "string",
+    desc: `Please input the contract-version of the wormhole contract.
+    There should be a compiled code at the path - "../wormhole-stub/artifacts/wormhole-\${contract-version}.wasm"`,
+    default: "2.14.9",
+  })
+  .option("deploy", {
+    type: "string",
+    desc: "Execute this script for the given deployment type.",
+    choices: ["stable", "beta"],
+    demandOption: "Please provide the deployment type",
+  })
+  .option("chain", {
+    type: "string",
+    desc: "Deploy the wormhole contract to the given chain",
+    demandOption: "Please provide a chain to deploy the contract to",
+  })
+  .help()
+  .alias("help", "h")
+  .wrap(yargs.terminalWidth())
+  .parseSync();
+
+async function run() {
+  const wasmFilePath = `../wormhole-stub/artifacts/wormhole-${argv.contractVersion}.wasm`;
+
+  const chain = DefaultStore.chains[argv.chain];
+  if (!(chain instanceof CosmWasmChain)) {
+    throw new Error(`Chain ${argv.chain} not found or not a CosmWasmChain`);
+  }
+  const privateKey = toPrivateKey(argv["private-key"]);
+  const storeCodeRes = await CosmWasmContract.storeCode(
+    chain,
+    privateKey,
+    wasmFilePath
+  );
+  console.log(
+    `Code stored on chain ${chain.getId()} at ${storeCodeRes.codeId}`
+  );
+  const chainExecutor = await chain.getExecutor(privateKey);
+  const instantiateContractRes = await chainExecutor.instantiateContract({
+    codeId: storeCodeRes.codeId,
+    instMsg: getWormholeConfig({
+      feeDenom: chain.feeDenom,
+      wormholeChainId: CHAINS[chain.wormholeChainName],
+      deploymentType: argv.deploy as DeploymentType, // TODO: use branded types
+    }),
+    label: "wormhole",
+  });
+  console.log(
+    `Contract instantiated at ${instantiateContractRes.contractAddr}`
+  );
+
+  await chainExecutor.updateContractAdmin({
+    newAdminAddr: instantiateContractRes.contractAddr,
+    contractAddr: instantiateContractRes.contractAddr,
+  });
+  console.log(`Contract admin set to ${instantiateContractRes.contractAddr}`);
+
+  const contract = new WormholeCosmWasmContract(
+    chain,
+    instantiateContractRes.contractAddr
+  );
+  if (argv.deploy === "stable") {
+    console.log("Syncing guardian sets for mainnet contract");
+    await contract.syncMainnetGuardianSets(privateKey);
+    console.log("Sync complete");
+  }
+  console.log(
+    `Contract deployed on chain ${chain.getId()} at ${contract.address}`
+  );
+}
+
+run();

+ 9 - 0
target_chains/cosmwasm/deploy-scripts/tsconfig.json

@@ -0,0 +1,9 @@
+{
+  "extends": "../../../tsconfig.base.json",
+  "include": ["src"],
+  "exclude": ["node_modules", "**/__tests__/*"],
+  "compilerOptions": {
+    "rootDir": "src/",
+    "outDir": "./lib"
+  }
+}

+ 2 - 25
target_chains/cosmwasm/tools/README.md

@@ -1,26 +1,3 @@
-# How to add a new chain for deployment
+# CosmWasm Js Tools
 
-1. Add the chain name to `ChainId` enum in `chains-manager/chains.ts`
-2. Add the network configs to `CHAINS_NETWORK_CONFIG` in `chains-manager/chains.ts`. You can lookup for rpc endpoints in [this repo](https://github.com/cosmos/chain-registry). The `gasPrice` is the `average_gas_price` of the chain + the chain token `denom` (Available in chain-registry `chain.json` file).
-3. Add the contract configs to `CHAINS_CONTRACT_CONFIG` in `configs.ts`
-4. Add the ChainId either to `getChainIdsForStableDeployment` or `getChainIdsForEdgeDeployment` functions in `helper.ts`
-5. If the wormhole contract is not deployed on the target chain run the following command:
-
-```
-ts-node src/wormhole-stub.ts --mnemonic "<YOUR_MNEMONIC>" --deploy <stable or edge>
-```
-
-6. Deploy the pyth contract:
-
-```
-ts-node src/instantiate-pyth.ts --contract-version <X.Y.Z> --mnemonic "<YOUR_MNEMONIC>" --deploy <stable or edge>
-```
-
-7. Test the new contract:
-
-```
-ts-node src/test.ts --mnemonic "<YOUR_MNEMONIC>" --deploy <stable or edge>
-```
-
-8. Commit the new json files to the repo
-9. Update documentation repos and add the new contract address
+This package contains minimal wrappers needed to interact with CosmWasm contracts.

+ 2 - 5
target_chains/cosmwasm/tools/package.json

@@ -6,12 +6,10 @@
   "private": "true",
   "scripts": {
     "build": "tsc",
-    "build-contract": "ts-node ./src/build-contract.ts",
-    "deploy-pyth": "ts-node ./src/deploy-pyth-bridge.ts",
-    "deploy": "ts-node ./src/deploy.ts"
+    "deploy": "ts-node ./src/ci/deploy.ts"
   },
   "author": "",
-  "license": "ISC",
+  "license": "Apache-2.0",
   "dependencies": {
     "@cosmjs/cosmwasm-stargate": "^0.29.5",
     "@cosmjs/encoding": "^0.26.2",
@@ -28,7 +26,6 @@
     "ethers": "^5.4.4",
     "node-downloader-helper": "^2.1.7",
     "osmojs": "^13.0.0-rc.7-i-alpha",
-    "rimraf": "^5.0.0",
     "yargs": "^17.0.1",
     "@pythnetwork/price-service-client": "*"
   },

+ 0 - 160
target_chains/cosmwasm/tools/src/chains-manager/chains.ts

@@ -1,160 +0,0 @@
-import { ChainExecutor } from "./chain-executor";
-import { CosmwasmExecutor } from "./cosmwasm";
-import { InjectiveExecutor } from "./injective";
-import { Network } from "@injectivelabs/networks";
-
-export enum ChainType {
-  INJECTIVE = "injective",
-  COSMWASM = "cosmwasm",
-}
-
-// GUIDELINES: to add new chains
-// ENUM Key should be of the form:
-// CHAINNAME{_OPTIONAL-IDENTIFIER}
-// ENUM Value should be of the form:
-// chainname{_optional-identifier}
-export enum ChainId {
-  INJECTIVE_TESTNET = "injective_testnet",
-  OSMOSIS_TESTNET_5 = "osmosis_testnet_5",
-  SEI_TESTNET_ATLANTIC_2 = "sei_testnet_atlantic_2",
-  NEUTRON_TESTNET_PION_1 = "neutron_testnet_pion_1",
-  JUNO_TESTNET = "juno_testnet",
-
-  // Below are mainnet chain ids
-  INJECTIVE = "injective",
-  OSMOSIS = "osmosis",
-  SEI_PACIFIC_1 = "sei_pacific_1",
-  NEUTRON = "neutron",
-}
-
-export const ChainIds = Object.values(ChainId);
-
-export type ChainNetworkConfig =
-  | {
-      // usually the chain name
-      // osmosis, injective
-      chainId: ChainId;
-      chainType: ChainType.INJECTIVE;
-
-      // endpoints to create executor and querier for a particular chain
-      querierEndpoint: string;
-      executorEndpoint: string;
-    }
-  | {
-      // usually the chain name
-      // osmosis, injective
-      chainId: ChainId;
-      chainType: ChainType.COSMWASM;
-
-      // endpoints to create executor and querier for a particular chain
-      querierEndpoint: string;
-      executorEndpoint: string;
-
-      // some extra fields
-      // prefix of the particular cosmwasm chain
-      // eg "osmo"
-      prefix: string;
-      // gas price for that chain
-      // eg "0.025 uosmo"
-      gasPrice: string;
-    };
-
-export const CHAINS_NETWORK_CONFIG: Record<ChainId, ChainNetworkConfig> = {
-  [ChainId.INJECTIVE_TESTNET]: {
-    chainId: ChainId.INJECTIVE_TESTNET,
-    chainType: ChainType.INJECTIVE,
-    querierEndpoint: "https://k8s.testnet.tm.injective.network:443",
-    executorEndpoint: "https://k8s.testnet.chain.grpc-web.injective.network",
-  },
-  [ChainId.OSMOSIS_TESTNET_5]: {
-    chainId: ChainId.OSMOSIS_TESTNET_5,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc.osmotest5.osmosis.zone/",
-    querierEndpoint: "https://rpc.osmotest5.osmosis.zone/",
-    prefix: "osmo",
-    gasPrice: "0.025uosmo",
-  },
-  [ChainId.SEI_TESTNET_ATLANTIC_2]: {
-    chainId: ChainId.SEI_TESTNET_ATLANTIC_2,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc.atlantic-2.seinetwork.io/",
-    querierEndpoint: "https://rpc.atlantic-2.seinetwork.io/",
-    prefix: "sei",
-    gasPrice: "0.01usei",
-  },
-  [ChainId.NEUTRON_TESTNET_PION_1]: {
-    chainId: ChainId.NEUTRON_TESTNET_PION_1,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc-palvus.pion-1.ntrn.tech/",
-    querierEndpoint: "https://rpc-palvus.pion-1.ntrn.tech/",
-    prefix: "neutron",
-    gasPrice: "0.025untrn",
-  },
-  [ChainId.JUNO_TESTNET]: {
-    chainId: ChainId.JUNO_TESTNET,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc.uni.junonetwork.io/",
-    querierEndpoint: "https://rpc.uni.junonetwork.io/",
-    prefix: "juno",
-    gasPrice: "0.025ujunox",
-  },
-
-  // Mainnet chains
-  [ChainId.INJECTIVE]: {
-    chainId: ChainId.INJECTIVE,
-    chainType: ChainType.INJECTIVE,
-    querierEndpoint: "https://k8s.testnet.tm.injective.network:443",
-    executorEndpoint: "https://k8s.testnet.chain.grpc-web.injective.network",
-  },
-  [ChainId.OSMOSIS]: {
-    chainId: ChainId.OSMOSIS,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc.osmosis.zone:443",
-    querierEndpoint: "https://rpc.osmosis.zone:443",
-    prefix: "osmo",
-    gasPrice: "0.025uosmo",
-  },
-  [ChainId.SEI_PACIFIC_1]: {
-    chainId: ChainId.SEI_PACIFIC_1,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://sei-rpc.polkachu.com",
-    querierEndpoint: "https://sei-rpc.polkachu.com",
-    prefix: "sei",
-    gasPrice: "0.025usei",
-  },
-  [ChainId.NEUTRON]: {
-    chainId: ChainId.NEUTRON,
-    chainType: ChainType.COSMWASM,
-    executorEndpoint: "https://rpc-kralum.neutron-1.neutron.org",
-    querierEndpoint: "https://rpc-kralum.neutron-1.neutron.org",
-    prefix: "neutron",
-    gasPrice: "0.025untrn",
-  },
-};
-
-/**
- * This method will return an executor for given chainConfig.
- */
-export async function createExecutorForChain(
-  chainConfig: ChainNetworkConfig,
-  mnemonic: string
-): Promise<ChainExecutor> {
-  const chainType = chainConfig.chainType;
-
-  if (chainType === ChainType.INJECTIVE) {
-    return InjectiveExecutor.fromMnemonic(
-      chainConfig.chainId === ChainId.INJECTIVE_TESTNET
-        ? Network.Testnet
-        : Network.Mainnet,
-      mnemonic
-    );
-  } else
-    return new CosmwasmExecutor(
-      chainConfig.executorEndpoint,
-      await CosmwasmExecutor.getSignerFromMnemonic(
-        mnemonic,
-        chainConfig.prefix
-      ),
-      chainConfig.gasPrice
-    );
-}

+ 0 - 0
target_chains/cosmwasm/tools/src/deploy.ts → target_chains/cosmwasm/tools/src/ci/deploy.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/deployer/config.ts → target_chains/cosmwasm/tools/src/ci/deployer/config.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/deployer/index.ts → target_chains/cosmwasm/tools/src/ci/deployer/index.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/deployer/injective.ts → target_chains/cosmwasm/tools/src/ci/deployer/injective.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/deployer/osmosis.ts → target_chains/cosmwasm/tools/src/ci/deployer/osmosis.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/deployer/terra.ts → target_chains/cosmwasm/tools/src/ci/deployer/terra.ts


+ 0 - 0
target_chains/cosmwasm/tools/src/network.ts → target_chains/cosmwasm/tools/src/ci/network.ts


+ 0 - 178
target_chains/cosmwasm/tools/src/configs.ts

@@ -1,178 +0,0 @@
-import { CHAINS } from "xc_admin_common";
-import { ChainId } from "./chains-manager/chains";
-import { DeploymentType } from "./helper";
-
-type ChainContractConfig = {
-  feeDenom: string;
-  pythArtifactZipName: string;
-  wormholeChainId: number;
-};
-
-export const CHAINS_CONTRACT_CONFIG: Record<ChainId, ChainContractConfig> = {
-  [ChainId.INJECTIVE_TESTNET]: {
-    feeDenom: "inj",
-    pythArtifactZipName: "injective",
-    wormholeChainId: CHAINS.injective_testnet,
-  },
-  [ChainId.OSMOSIS_TESTNET_5]: {
-    feeDenom: "uosmo",
-    pythArtifactZipName: "osmosis",
-    wormholeChainId: CHAINS.osmosis_testnet_5,
-  },
-  [ChainId.SEI_TESTNET_ATLANTIC_2]: {
-    feeDenom: "usei",
-    pythArtifactZipName: "cosmwasm",
-    wormholeChainId: CHAINS.sei_testnet_atlantic_2,
-  },
-  [ChainId.NEUTRON_TESTNET_PION_1]: {
-    feeDenom: "untrn",
-    pythArtifactZipName: "cosmwasm",
-    wormholeChainId: CHAINS.neutron_testnet_pion_1,
-  },
-  [ChainId.JUNO_TESTNET]: {
-    feeDenom: "ujunox",
-    pythArtifactZipName: "cosmwasm",
-    wormholeChainId: CHAINS.juno_testnet,
-  },
-
-  // mainnet
-  [ChainId.INJECTIVE]: {
-    feeDenom: "inj",
-    pythArtifactZipName: "injective",
-    wormholeChainId: CHAINS.injective,
-  },
-  [ChainId.OSMOSIS]: {
-    feeDenom: "uosmo",
-    pythArtifactZipName: "osmosis",
-    wormholeChainId: CHAINS.osmosis,
-  },
-  [ChainId.SEI_PACIFIC_1]: {
-    feeDenom: "usei",
-    pythArtifactZipName: "cosmwasm",
-    wormholeChainId: CHAINS.sei_pacific_1,
-  },
-  [ChainId.NEUTRON]: {
-    feeDenom: "untrn",
-    pythArtifactZipName: "cosmwasm",
-    wormholeChainId: CHAINS.neutron,
-  },
-};
-
-function getPythSources(deploymentType: DeploymentType) {
-  if (deploymentType === "stable") {
-    return {
-      data_sources: [
-        {
-          emitter: Buffer.from(
-            "6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25",
-            "hex"
-          ).toString("base64"),
-          chain_id: 1,
-        },
-        {
-          emitter: Buffer.from(
-            "f8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0",
-            "hex"
-          ).toString("base64"),
-          chain_id: 26,
-        },
-      ],
-      governance_source: {
-        emitter: Buffer.from(
-          "5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e",
-          "hex"
-        ).toString("base64"),
-        chain_id: 1,
-      },
-    };
-  }
-
-  return {
-    data_sources: [
-      {
-        emitter: Buffer.from(
-          "f346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0",
-          "hex"
-        ).toString("base64"),
-        chain_id: 1,
-      },
-      {
-        emitter: Buffer.from(
-          "a27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6",
-          "hex"
-        ).toString("base64"),
-        chain_id: 26,
-      },
-    ],
-    governance_source: {
-      emitter: Buffer.from(
-        "63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385",
-        "hex"
-      ).toString("base64"),
-      chain_id: 1,
-    },
-  };
-}
-
-export function getPythConfig({
-  feeDenom,
-  wormholeContract,
-  wormholeChainId,
-  deploymentType,
-}: {
-  feeDenom: string;
-  wormholeContract: string;
-  wormholeChainId: number;
-  deploymentType: DeploymentType;
-}) {
-  return {
-    wormhole_contract: wormholeContract,
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: wormholeChainId,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: feeDenom,
-    },
-    ...getPythSources(deploymentType),
-  };
-}
-
-interface ReqWormholeConfig {
-  feeDenom: string;
-  wormholeChainId: number;
-  deploymentType: DeploymentType;
-}
-
-export function getWormholeConfig({
-  feeDenom,
-  wormholeChainId,
-  deploymentType,
-}: ReqWormholeConfig) {
-  if (deploymentType === "stable") {
-    return {
-      chain_id: wormholeChainId,
-      fee_denom: feeDenom,
-      gov_chain: 1,
-      gov_address: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ=",
-      guardian_set_expirity: 86400,
-      initial_guardian_set: {
-        addresses: [{ bytes: "WMw65cCXshPOPIGXnhuflXB0aqU=" }],
-        expiration_time: 0,
-      },
-    };
-  }
-
-  return {
-    chain_id: wormholeChainId,
-    fee_denom: feeDenom,
-    gov_chain: 1,
-    gov_address: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ=",
-    guardian_set_expirity: 86400,
-    initial_guardian_set: {
-      addresses: [{ bytes: "E5R71IsY5T/a7ud/NHM5Gscnxjg=" }],
-      expiration_time: 0,
-    },
-  };
-}

+ 0 - 9
target_chains/cosmwasm/tools/src/contract-checksum.ts

@@ -1,9 +0,0 @@
-export const CHECKSUM: any = {
-  "1.2.0": {
-    osmosis: "9ac1f9a70316c09ff4e1c25e36499a02b9f46ed60486b10164f5bd4b7c0a0cac",
-    injective:
-      "4f7508a76317737eba784400ec1feb443dc5cc3ecce62acbcf4e8a9832e36f06",
-    cosmwasm:
-      "788ade6d9ccaca40cea29a6a795319548e8b3ab8925dc33eb902ed6ca615557f",
-  },
-};

+ 0 - 181
target_chains/cosmwasm/tools/src/deploy-pyth-bridge.ts

@@ -1,181 +0,0 @@
-import yargs from "yargs";
-import { hideBin } from "yargs/helpers";
-import { Deployer, DeployerFactory } from "./deployer";
-import { NETWORKS, NETWORKS_OPTIONS } from "./network";
-import { CONFIG as PythConfig } from "./pyth_config";
-import { CONFIG as NetworkConfig } from "./deployer/config";
-
-const sharedOptions: { [key: string]: yargs.Options } = {
-  network: {
-    describe: "Which network to deploy to",
-    choices: NETWORKS_OPTIONS,
-    demandOption: true,
-  },
-  mnemonic: {
-    type: "string",
-    demandOption: true,
-    describe: "Mnemonic (private key)",
-  },
-};
-
-const argv = yargs(hideBin(process.argv))
-  .usage("USAGE: npm run deploy-pyth -- <command>")
-  .command(
-    "deploy-artifact",
-    "to deploy artifacts (.wasm files)",
-    {
-      artifact: {
-        type: "string",
-        demandOption: true,
-        describe: "Path to contract artifact",
-      },
-      ...sharedOptions,
-    },
-    deployArtifactHandler
-  )
-  .example(
-    'npm run deploy-pyth -- deploy-artifact --network osmosis_local --mnemonic "online prefer ..." --artifact "../artifacts/pyth_cosmwasm.wasm"',
-    ""
-  )
-  .command(
-    "instantiate",
-    "to instantiate contract",
-    {
-      "code-id": {
-        describe: "code-id requred to instantiate contract",
-        type: "number",
-        demandOption: true,
-      },
-      ...sharedOptions,
-    },
-    instantiateHandler
-  )
-  .example(
-    'npm run deploy-pyth -- instantiate --network osmosis_local --code-id 10 --mnemonic "online prefer ..."',
-    ""
-  )
-  .command(
-    "migrate",
-    "to migrate given contract",
-    {
-      "code-id": {
-        describe: "code-id to which to migrate contract",
-        type: "number",
-        demandOption: true,
-      },
-      contract: {
-        description: "contract address is required",
-        type: "string",
-        demandOption: true,
-      },
-      ...sharedOptions,
-    },
-    migrateHandler
-  )
-  .example(
-    'npm run deploy-pyth -- migrate --network osmosis_local --code-id 9 --contract osmo1.. --mnemonic "online prefer ..."',
-    ""
-  )
-  .command(
-    "update-admin",
-    "to update a contract's admin",
-    {
-      "new-admin": {
-        description: "please input he new admin address",
-        type: "string",
-        demandOption: true,
-      },
-      contract: {
-        description: "contract address is required",
-        type: "string",
-        demandOption: true,
-      },
-      ...sharedOptions,
-    },
-    updateAdminHandler
-  )
-  .example(
-    'npm run deploy-pyth -- update-admin --network osmosis_local --new-admin osmo1.. --contract osmo1... --mnemonic "online prefer ..."',
-    ""
-  )
-  .command(
-    "get-contract-info",
-    "get a contract info",
-    {
-      contract: {
-        description: "contract address is required",
-        type: "string",
-        demandOption: true,
-      },
-      ...sharedOptions,
-    },
-    getContractInfoHandler
-  )
-  .example(
-    'npm run deploy-pyth -- get-contract-info --network osmosis_local --contract osmo1... --mnemonic "online prefer ..."',
-    ""
-  )
-  .demandCommand()
-  .help()
-  .alias("help", "h")
-  .wrap(yargs.terminalWidth())
-  .parse();
-
-function getDeployer(network: NETWORKS, mnemonic: string): Deployer {
-  const networkConfig = NetworkConfig[network];
-  return DeployerFactory.create(networkConfig, mnemonic);
-}
-
-async function deployArtifactHandler(argv: any) {
-  const { network, mnemonic, artifact } = argv;
-  console.log("Deploying artifact");
-  const codeId = await getDeployer(
-    network as NETWORKS,
-    mnemonic as string
-  ).deployArtifact(artifact);
-  console.log("Deployed Code ID: ", codeId);
-}
-
-async function instantiateHandler(argv: any) {
-  const { network, mnemonic, codeId } = argv;
-  const pythConfig = PythConfig[network as NETWORKS];
-  console.log("Instantiating a contract");
-  const contractAddress = await getDeployer(
-    network as NETWORKS,
-    mnemonic as string
-  ).instantiate(codeId, pythConfig, "pyth");
-  console.log(`Deployed Pyth contract at ${contractAddress}`);
-}
-
-async function migrateHandler(argv: any) {
-  const { network, mnemonic, codeId, contract } = argv;
-
-  console.log(`Migrating contract ${contract} to ${codeId}`);
-  await getDeployer(network as NETWORKS, mnemonic as string).migrate(
-    contract,
-    codeId
-  );
-  console.log(`Contract ${contract} code_id successfully updated to ${codeId}`);
-}
-
-async function updateAdminHandler(argv: any) {
-  const { network, mnemonic, newAdmin, contract } = argv;
-  console.log("Updating contract's admin");
-  const deployer = getDeployer(network as NETWORKS, mnemonic as string);
-  await deployer.updateAdmin(newAdmin, contract);
-  const info = await deployer.getContractInfo(contract);
-  console.log(info);
-  console.log("Contract's admin successfully updates");
-}
-
-async function getContractInfoHandler(argv: any) {
-  const { network, mnemonic, contract } = argv;
-
-  console.log(`Fetching contract info for: ${contract}`);
-  const info = await getDeployer(
-    network as NETWORKS,
-    mnemonic as string
-  ).getContractInfo(contract);
-  console.log(`Fetched contract info for: ${contract}`);
-  console.log(info);
-}

+ 0 - 184
target_chains/cosmwasm/tools/src/helper.ts

@@ -1,184 +0,0 @@
-import { readFileSync, existsSync, mkdirSync } from "fs";
-import { rimrafSync } from "rimraf";
-import AdmZip from "adm-zip";
-import path from "path";
-import { DownloaderHelper } from "node-downloader-helper";
-import { ChainId } from "./chains-manager/chains";
-
-export function getChainIdsForStableDeployment(): ChainId[] {
-  return [
-    ChainId.INJECTIVE_TESTNET,
-    ChainId.OSMOSIS_TESTNET_5,
-    ChainId.OSMOSIS,
-    ChainId.SEI_TESTNET_ATLANTIC_2,
-    ChainId.NEUTRON_TESTNET_PION_1,
-    ChainId.JUNO_TESTNET,
-    ChainId.SEI_PACIFIC_1,
-    ChainId.NEUTRON,
-  ];
-}
-
-export function getChainIdsForBetaDeployment(): ChainId[] {
-  return [
-    ChainId.INJECTIVE_TESTNET,
-    ChainId.OSMOSIS_TESTNET_5,
-    ChainId.SEI_TESTNET_ATLANTIC_2,
-    ChainId.NEUTRON_TESTNET_PION_1,
-    ChainId.JUNO_TESTNET,
-  ];
-}
-
-export type DeploymentType = "stable" | "beta";
-
-// We have released the compile contacts on github. If a chain needs some specific
-// feature in a contract, a version of the contract with that specific features is
-// released. For example, "injective.zip" for injective.
-// NOTE that the each zip file should contain the compiled code with the same file
-// name `pyth_cosmwasm.wasm`
-// Given a contract version (eg 1.2.0) and  zipFileNames (eg ["injective", "osmosis"])
-// this method will return an object with key = zipFileName and value = compiledCode
-export async function getContractBytesDict(
-  artifactZipFileNames: string[],
-  version: string
-) {
-  const githubArtifactsLink = `https://github.com/pyth-network/pyth-crosschain/releases/download/pyth-cosmwasm-contract-v${version}/`;
-  const tmpCodeStorageDir = "./tmp";
-  // clear tmp directory before downloading contracts
-  rimrafSync(tmpCodeStorageDir);
-
-  if (existsSync(tmpCodeStorageDir) === false) {
-    mkdirSync(tmpCodeStorageDir, { recursive: true });
-  }
-
-  const uniqueArtifactsZipName = Array.from(new Set(artifactZipFileNames));
-
-  // download zip files
-  await Promise.all(
-    uniqueArtifactsZipName.map(async (artifactZipName) => {
-      return new Promise<void>((resolve, reject) => {
-        const dl = new DownloaderHelper(
-          githubArtifactsLink + artifactZipName + ".zip",
-          tmpCodeStorageDir
-        );
-
-        dl.on("end", () => {
-          console.log("Download Completed");
-          resolve();
-        });
-        dl.on("error", (err) => {
-          console.log("Download Failed", err);
-          reject(err);
-        });
-        dl.start().catch((err) => {
-          console.error(err);
-          reject(err);
-        });
-      });
-    })
-  );
-
-  // extract zip files
-  uniqueArtifactsZipName.map(async (artifactZipName) => {
-    const zip = new AdmZip(
-      path.resolve(tmpCodeStorageDir + "/" + artifactZipName + ".zip")
-    );
-    zip.extractAllTo(path.resolve(tmpCodeStorageDir));
-  });
-
-  let contractBytesDict: { [fileName: string]: Buffer } = {};
-  for (let uniqueArtifactZipName of uniqueArtifactsZipName) {
-    const contractBytes = readFileSync(
-      tmpCodeStorageDir + "/" + uniqueArtifactZipName + "/pyth_cosmwasm.wasm"
-    );
-    contractBytesDict[uniqueArtifactZipName] = contractBytes;
-  }
-
-  // clear tmp directory after downloading contracts
-  rimrafSync(tmpCodeStorageDir);
-
-  return contractBytesDict;
-}
-
-export const WORMHOLE_CONTRACT_VERSION = "2.14.9";
-// This method returns the file name which stores the deployment result for
-// wormhole stub
-export function getWormholeFileName(
-  chainId: string,
-  version: string,
-  deploymentType: DeploymentType
-): string {
-  const WORMHOLE_STORAGE_DIR = "../wormhole-stub/" + deploymentType;
-  return `${WORMHOLE_STORAGE_DIR}/${chainId}-${version}.json`;
-}
-
-// This method will read the wormhole file with the deployment resutt and will
-// return the deployed wormhole contract address
-export function getWormholeContractAddress(
-  chainId: string,
-  version: string,
-  deploymentType: DeploymentType
-): string {
-  let deployedFilePath = getWormholeFileName(chainId, version, deploymentType);
-  const wormholeContractAddress = JSON.parse(
-    readFileSync(deployedFilePath).toString()
-  )["instantiate-contract"].result.contractAddr;
-
-  if (wormholeContractAddress === undefined)
-    throw new Error(
-      "Wormhole contract address should be present in the file" +
-        deployedFilePath
-    );
-
-  return wormholeContractAddress;
-}
-
-// This method returns the file name which stores the deployment result for
-// pyth instantiation
-export function getPythInstantiateFileName(
-  chainId: string,
-  version: string,
-  deploymentType: DeploymentType
-): string {
-  const STORAGE_DIR = `./store/${deploymentType}/instantiate-pyth`;
-  return `${STORAGE_DIR}/${chainId}-${version}.json`;
-}
-
-// This method returns the file name which stores the deployment result for
-// test pyth contract
-export function getTestPythContractFileName(
-  chainId: string,
-  version: string,
-  deploymentType: DeploymentType
-): string {
-  const STORAGE_DIR = `./store/${deploymentType}/test-contracts`;
-  return `${STORAGE_DIR}/${chainId}-${version}.json`;
-}
-
-// This method will read the pyth file with the deployment resutt and will
-// return the deployed pyth contract address
-export function getPythContractAddress(
-  chainId: string,
-  version: string,
-  deploymentType: DeploymentType
-): string {
-  let deployedFilePath = getPythInstantiateFileName(
-    chainId,
-    version,
-    deploymentType
-  );
-  const pythContractAddress = JSON.parse(
-    readFileSync(deployedFilePath).toString()
-  )["instantiate-contract"].result.contractAddr;
-
-  if (pythContractAddress === undefined)
-    throw new Error(
-      "Wormhole contract address should be present in the file" +
-        deployedFilePath
-    );
-
-  return pythContractAddress;
-}
-
-export function hexToBase64(hex: string): string {
-  return Buffer.from(hex, "hex").toString("base64");
-}

+ 0 - 3
target_chains/cosmwasm/tools/src/index.ts

@@ -1,5 +1,2 @@
-export * from "./deployer";
 export * from "./chains-manager";
 export * from "./pyth-wrapper";
-export * from "./configs";
-export * from "./helper";

+ 0 - 151
target_chains/cosmwasm/tools/src/instantiate-pyth.ts

@@ -1,151 +0,0 @@
-import {
-  createExecutorForChain,
-  CHAINS_NETWORK_CONFIG,
-} from "./chains-manager/chains";
-import yargs from "yargs";
-import { hideBin } from "yargs/helpers";
-import {
-  InstantiateContractResponse,
-  StoreCodeResponse,
-} from "./chains-manager/chain-executor";
-import { Pipeline } from "./pipeline";
-import {
-  DeploymentType,
-  WORMHOLE_CONTRACT_VERSION,
-  getChainIdsForBetaDeployment,
-  getChainIdsForStableDeployment,
-  getContractBytesDict,
-  getPythInstantiateFileName,
-  getWormholeContractAddress,
-} from "./helper";
-import { sha256 } from "@cosmjs/crypto";
-import { CHECKSUM } from "./contract-checksum";
-import { CHAINS_CONTRACT_CONFIG, getPythConfig } from "./configs";
-
-const argv = yargs(hideBin(process.argv))
-  .usage("USAGE: npm run instantiate-pyth -- <command>")
-  .option("mnemonic", {
-    type: "string",
-    demandOption: "Please provide the mnemonic",
-  })
-  .option("contract-version", {
-    type: "string",
-    demandOption: `Please input the contract-version of the pyth contract.`,
-  })
-  .option("deploy", {
-    type: "string",
-    desc: "Execute this script for the given networks.",
-    choices: ["beta", "stable"],
-    demandOption: "Please provide the deployment type",
-  })
-  .help()
-  .alias("help", "h")
-  .wrap(yargs.terminalWidth())
-  .parseSync();
-
-async function run() {
-  let chainIds;
-  if (argv.deploy === "stable") {
-    chainIds = getChainIdsForStableDeployment();
-  } else {
-    chainIds = getChainIdsForBetaDeployment();
-  }
-
-  // get the wasm code from github
-  let contractBytesDict = await getContractBytesDict(
-    chainIds.map(
-      (chainId) => CHAINS_CONTRACT_CONFIG[chainId].pythArtifactZipName
-    ),
-    argv.contractVersion
-  );
-
-  // check that the downloaded code has the same checksum as the one hardcoded in contract-checksum.ts
-  for (let key in contractBytesDict) {
-    const hardcodedChecksum = CHECKSUM[argv.contractVersion][key];
-    if (hardcodedChecksum === undefined)
-      throw new Error(
-        `Contract for ${key} doesn't have a checksum in "contract-checksum.ts"`
-      );
-
-    const downloadedCodeChecksum = Buffer.from(
-      sha256(contractBytesDict[key])
-    ).toString("hex");
-
-    if (downloadedCodeChecksum !== hardcodedChecksum)
-      throw new Error(
-        `Checksum doesn't match for ${key}. \n Downloaded file checksum ${downloadedCodeChecksum}. Hardcoded checksum ${hardcodedChecksum}`
-      );
-  }
-
-  for (let chainId of chainIds) {
-    let chainConfig = CHAINS_NETWORK_CONFIG[chainId];
-    let contractConfig = CHAINS_CONTRACT_CONFIG[chainId];
-
-    const pipeline = new Pipeline(
-      chainId,
-      getPythInstantiateFileName(
-        chainId,
-        argv.contractVersion,
-        argv.deploy as DeploymentType
-      )
-    );
-
-    const chainExecutor = await createExecutorForChain(
-      chainConfig,
-      argv.mnemonic
-    );
-
-    // add stages
-    // 1 deploy artifact
-    pipeline.addStage({
-      id: "deploy-pyth-code",
-      executor: async () => {
-        return chainExecutor.storeCode({
-          contractBytes: contractBytesDict[contractConfig.pythArtifactZipName],
-        });
-      },
-    });
-
-    // 2 instantiate contract
-    pipeline.addStage({
-      id: "instantiate-contract",
-      executor: (getResultOfPastStage) => {
-        const storeCodeRes: StoreCodeResponse =
-          getResultOfPastStage("deploy-pyth-code");
-
-        return chainExecutor.instantiateContract({
-          codeId: storeCodeRes.codeId,
-          instMsg: getPythConfig({
-            feeDenom: contractConfig.feeDenom,
-            wormholeChainId: contractConfig.wormholeChainId,
-            wormholeContract: getWormholeContractAddress(
-              chainId,
-              WORMHOLE_CONTRACT_VERSION,
-              argv.deploy as DeploymentType
-            ),
-            deploymentType: argv.deploy as DeploymentType,
-          }),
-          label: "pyth",
-        });
-      },
-    });
-
-    // 3 set its own admin
-    pipeline.addStage({
-      id: "set-own-admin",
-      executor: (getResultOfPastStage) => {
-        const instantiateContractRes: InstantiateContractResponse =
-          getResultOfPastStage("instantiate-contract");
-
-        return chainExecutor.updateContractAdmin({
-          newAdminAddr: instantiateContractRes.contractAddr,
-          contractAddr: instantiateContractRes.contractAddr,
-        });
-      },
-    });
-
-    await pipeline.run();
-  }
-}
-
-run();

+ 0 - 162
target_chains/cosmwasm/tools/src/pipeline.ts

@@ -1,162 +0,0 @@
-import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
-import path from "path";
-
-// The stage executor is where the stage functionality is defined
-// Optionally it can take in a method `getResultOfPastStage` as a parameter
-// if it wants to access the result of the previous stages
-
-// Each stage should have exactly one atomic operation (like sending a transaction),
-// The pipeline doesn't enforce atomicity. So if you have 2 atomic operations in
-// one stage, then you could end up fulfilling one and failing the other.
-export type StageExecutor =
-  | ((
-      // get the result of a past stage using it's id
-      // It will return the result for the same step id
-      // It will return undefined if the previous stage data has not been stored locally
-      // or if a future stage data is being asked
-      getResultOfPastStage: <Y>(stageId: string) => Y
-    ) => Promise<any>)
-  | (() => Promise<any>);
-
-export type Stage = {
-  id: string;
-  executor: StageExecutor;
-};
-
-type StageResult<T = any> =
-  | {
-      status: "rejected";
-      reason: any;
-    }
-  | {
-      status: "fulfilled";
-      result: T;
-    };
-
-export class Pipeline {
-  private stages: Stage[] = [];
-  private readonly pipelineStore: PipelineStore;
-
-  constructor(
-    // osmosis_testnet_4
-    private readonly id: string,
-    readonly storageFilePath: string
-  ) {
-    this.pipelineStore = new PipelineStore(storageFilePath);
-  }
-
-  addStage(stage: Stage) {
-    this.stages.push(stage);
-  }
-
-  private stageExecutorWrapper(executor: StageExecutor) {
-    // We want to wrap the executor provided by the pipeline consumer
-    // In order to wrap the response of the executor in the StageResult
-    // also in this method we inject the `getResultOfPastStage` to the stage executor
-    return async (): Promise<StageResult> => {
-      // method to inject
-      const getResultOfPastStage = <Y>(stageId: string): Y => {
-        let result = this.pipelineStore.getStageState<StageResult<Y>>(stageId);
-
-        // This if condition will execute only if the stage executor is
-        // trying to reading a stage's state with stage id that doesn't exist
-        // past results will all be fulfilled and the pipeline will make sure of that
-        if (
-          result === undefined ||
-          (result !== undefined && result.status === "rejected")
-        ) {
-          throw new Error(
-            `${this.id}: Stage id seems to be invalid: ${stageId}`
-          );
-        }
-        return result.result;
-      };
-      try {
-        // wrapping result
-        const result = await executor(getResultOfPastStage);
-        return {
-          status: "fulfilled",
-          result,
-        };
-      } catch (e) {
-        return {
-          status: "rejected",
-          reason: e,
-        };
-      }
-    };
-  }
-
-  private async processStage(stage: Stage): Promise<boolean> {
-    // Here we will check if there is a past result that has been fulfilled
-    // If yes, we are not going to process any further
-    let currentResult = this.pipelineStore.getStageState<StageResult>(stage.id);
-    if (currentResult !== undefined && currentResult.status === "fulfilled")
-      return true;
-
-    // Else we will process the new stage and store the result
-    const newResult = await this.stageExecutorWrapper(stage.executor)();
-    this.pipelineStore.setStageState(stage.id, newResult);
-
-    if (newResult.status === "fulfilled") return true;
-
-    console.log(`${this.id}: Stage with id: ${stage.id} failed.`);
-    console.log(`Please fix the error and re run the pipeline`);
-    return false;
-  }
-
-  async run() {
-    console.log("Running pipeline with id: ", this.id);
-    for (let stage of this.stages) {
-      console.log(`${this.id}: Running stage with id: ${stage.id}`);
-
-      // This method is only going to process stage if all the past ones have been fulfilled
-      let fulfilled = await this.processStage(stage);
-
-      console.log(`${this.id}: Processed stage with id: ${stage.id}`);
-
-      // store the whole processing locally after every stage
-      this.pipelineStore.commit();
-      if (fulfilled === false) break;
-    }
-  }
-}
-
-// PipelineStore helps in getting and setting the state locally
-// It manipulates data in-memory and once the consumer has finished manipulating it
-// They need to commit the data to permanent storage using the commit method
-class PipelineStore {
-  private readonly store: {
-    [stageId: string]: any;
-  };
-
-  constructor(private readonly filePath: string) {
-    if (!existsSync(this.filePath)) {
-      this.store = {};
-      return;
-    }
-
-    this.store = JSON.parse(readFileSync(this.filePath).toString());
-  }
-
-  // It gets the latest state for the given stage
-  // the state after the last operation
-  // if there is no stage state, in case it was no process it will return undefined.
-  // the caller can provide the T and this method will cast the result into it.
-  getStageState<T = any>(stageId: string): T | undefined {
-    return this.store[stageId];
-  }
-
-  // It sets the latest state for the given step
-  setStageState(stageId: string, state: any) {
-    this.store[stageId] = state;
-  }
-
-  // After all the in memory operations one can commit to the local file
-  // for permanent storage
-  commit() {
-    mkdirSync(path.dirname(this.filePath), { recursive: true });
-    // The "\n" at the end of the line is to satisfy the formatting rules
-    writeFileSync(this.filePath, JSON.stringify(this.store, null, 2) + "\n");
-  }
-}

+ 0 - 175
target_chains/cosmwasm/tools/src/pyth_config.ts

@@ -1,175 +0,0 @@
-import { NETWORKS } from "./network";
-
-const PYTH_SOURCES_TESTNET = {
-  data_sources: [
-    {
-      emitter: Buffer.from(
-        "f346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0",
-        "hex"
-      ).toString("base64"),
-      chain_id: 1,
-    },
-    {
-      emitter: Buffer.from(
-        "a27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5b6",
-        "hex"
-      ).toString("base64"),
-      chain_id: 26,
-    },
-  ],
-  governance_source: {
-    emitter: Buffer.from(
-      "63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385",
-      "hex"
-    ).toString("base64"),
-    chain_id: 1,
-  },
-};
-
-const PYTH_SOURCES_MAINNET = {
-  data_sources: [
-    {
-      emitter: Buffer.from(
-        "6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25",
-        "hex"
-      ).toString("base64"),
-      chain_id: 1,
-    },
-    {
-      emitter: Buffer.from(
-        "f8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bba0",
-        "hex"
-      ).toString("base64"),
-      chain_id: 26,
-    },
-  ],
-  governance_source: {
-    emitter: Buffer.from(
-      "5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e",
-      "hex"
-    ).toString("base64"),
-    chain_id: 1,
-  },
-};
-
-export type PythConfig = {
-  wormhole_contract: string;
-  data_sources: DataSource[];
-  governance_source: DataSource;
-  governance_source_index: number;
-  governance_sequence_number: number;
-  chain_id: number;
-  valid_time_period_secs: number;
-  fee: Fee;
-};
-
-export type DataSource = {
-  emitter: string;
-  chain_id: number;
-};
-
-export type Fee = {
-  amount: string;
-  denom: string;
-};
-
-type Config = Record<NETWORKS, PythConfig>;
-
-export const CONFIG: Config = {
-  [NETWORKS.TERRA_MAINNET]: {
-    wormhole_contract:
-      "terra12mrnzvhx3rpej6843uge2yyfppfyd3u9c3uq223q8sl48huz9juqffcnh",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 18,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "uluna",
-    },
-    ...PYTH_SOURCES_MAINNET,
-  },
-  [NETWORKS.TERRA_TESTNET]: {
-    wormhole_contract:
-      "terra19nv3xr5lrmmr7egvrk2kqgw4kcn43xrtd5g0mpgwwvhetusk4k7s66jyv0",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 18,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "uluna",
-    },
-    ...PYTH_SOURCES_TESTNET,
-  },
-  [NETWORKS.TERRA_LOCAL]: {
-    // random contract for local testing
-    wormhole_contract:
-      "terra19nv3xr5lrmmr7egvrk2kqgw4kcn43xrtd5g0mpgwwvhetusk4k7s66jyv0",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 18,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "uluna",
-    },
-    // invalid contract info for local testing
-    ...PYTH_SOURCES_TESTNET,
-  },
-  [NETWORKS.INJECTIVE_MAINNET]: {
-    wormhole_contract: "inj17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9l2q74d",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 19,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "inj",
-    },
-    ...PYTH_SOURCES_MAINNET,
-  },
-  [NETWORKS.INJECTIVE_TESTNET]: {
-    wormhole_contract: "inj1xx3aupmgv3ce537c0yce8zzd3sz567syuyedpg",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 19,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "inj",
-    },
-    ...PYTH_SOURCES_TESTNET,
-  },
-  [NETWORKS.OSMOSIS_TESTNET]: {
-    wormhole_contract:
-      "osmo1hggkxr0hpw83f8vuft7ruvmmamsxmwk2hzz6nytdkzyup9krt0dq27sgyx",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 20,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "uosmo",
-    },
-    ...PYTH_SOURCES_TESTNET,
-  },
-  // this details below are invalid and random
-  // they are to be used only for for testing purposes
-  [NETWORKS.OSMOSIS_LOCAL]: {
-    // random wormhole contract
-    wormhole_contract:
-      "osmo1mypljhatv0prfr9cjzzvamxdf2ctg34xkt50sudxads9zhqnyneqjuvy26",
-    governance_source_index: 0,
-    governance_sequence_number: 0,
-    chain_id: 19,
-    valid_time_period_secs: 60,
-    fee: {
-      amount: "1",
-      denom: "uosmo",
-    },
-    // these are same as testnet but are being used in LocalOsmosis (local blockchain)
-    // used only for development and testing purposes
-    ...PYTH_SOURCES_TESTNET,
-  },
-};

+ 0 - 115
target_chains/cosmwasm/tools/src/test.ts

@@ -1,115 +0,0 @@
-import {
-  CHAINS_NETWORK_CONFIG,
-  createExecutorForChain,
-} from "./chains-manager/chains";
-import yargs from "yargs";
-import { hideBin } from "yargs/helpers";
-import { Pipeline } from "./pipeline";
-import { PythWrapperExecutor, PythWrapperQuerier } from "./pyth-wrapper";
-import {
-  DeploymentType,
-  getChainIdsForBetaDeployment,
-  getChainIdsForStableDeployment,
-  getPythContractAddress,
-  getTestPythContractFileName,
-} from "./helper";
-import { PriceServiceConnection } from "@pythnetwork/price-service-client";
-import { CosmwasmQuerier } from "./chains-manager/chain-querier";
-const argv = yargs(hideBin(process.argv))
-  .usage("USAGE: npm run test -- <command>")
-  .option("mnemonic", {
-    type: "string",
-    demandOption: "Please provide the mnemonic",
-  })
-  .option("contract-version", {
-    type: "string",
-    description: `Please input the contract-version of the pyth contract.`,
-    default: "1.2.0",
-  })
-  .option("deploy", {
-    type: "string",
-    desc: "test the following deployment type.",
-    choices: ["stable", "beta"],
-    demandOption: "Please provide the deployment type",
-  })
-  .help()
-  .alias("help", "h")
-  .wrap(yargs.terminalWidth())
-  .parseSync();
-
-async function run() {
-  let chainIds;
-  if (argv.deploy === "stable") {
-    chainIds = getChainIdsForStableDeployment();
-  } else {
-    chainIds = getChainIdsForBetaDeployment();
-  }
-
-  for (let chainId of chainIds) {
-    let chainConfig = CHAINS_NETWORK_CONFIG[chainId];
-    const pipeline = new Pipeline(
-      chainId,
-      getTestPythContractFileName(
-        chainId,
-        argv.contractVersion,
-        argv.deploy as DeploymentType
-      )
-    );
-
-    const chainExecutor = await createExecutorForChain(
-      chainConfig,
-      argv.mnemonic
-    );
-    const pythExecutor = new PythWrapperExecutor(chainExecutor);
-    const chainQuerier = await CosmwasmQuerier.connect(
-      chainConfig.querierEndpoint
-    );
-    const pythQuerier = new PythWrapperQuerier(chainQuerier);
-
-    const priceServiceConnection = new PriceServiceConnection(
-      argv.deploy === "stable"
-        ? "https://xc-mainnet.pyth.network"
-        : "https://xc-testnet.pyth.network"
-    );
-
-    const priceFeedId =
-      argv.deploy === "stable"
-        ? "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
-        : "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b";
-
-    const pythContractAddr = getPythContractAddress(
-      chainId,
-      argv.contractVersion,
-      argv.deploy as DeploymentType
-    );
-
-    // add stages
-    // 1 push price update
-    pipeline.addStage({
-      id: "push-price-update",
-      executor: async () => {
-        const vaas = await priceServiceConnection.getLatestVaas([priceFeedId]);
-
-        const fund = await pythQuerier.getUpdateFee(pythContractAddr, vaas);
-
-        return pythExecutor.executeUpdatePriceFeeds({
-          contractAddr: pythContractAddr,
-          vaas,
-          fund,
-        });
-      },
-    });
-
-    // 2 fetch the updated price feed
-    pipeline.addStage({
-      id: "fetch-price-feed-update",
-      executor: () => {
-        return pythQuerier.getPriceFeed(pythContractAddr, priceFeedId);
-      },
-    });
-
-    await pipeline.run();
-  }
-}
-
-run();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 47
target_chains/cosmwasm/tools/src/wormhole-stub.ts


+ 0 - 22
target_chains/cosmwasm/tools/store/edge/instantiate-pyth/injective_testnet-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "98A1B62C8BAC210199EE846EB24FC1D5A0A51D98660DDFCC638C09A6A17472AE",
-      "codeId": 1334
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "8609103EBE76DB87221F1BA8C53BFB86BAA4DFF869B4411B74B4727CD95D5472",
-      "contractAddr": "inj18rlflp3735h25jmjx97d22c72sxk260amdjxlu"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "D20FD21F51590048A9A639FF86EAA1B8C6F000B2B02F4215A725C7B3956515AD"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/edge/instantiate-pyth/juno_testnet-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 1888,
-      "txHash": "76869C7ACD433D74783668D7459957AF708A408E3C93E89BF6E18D045F420190"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "juno1h93q9kwlnfml2gum4zj54al9w4jdmuhtzrh6vhycnemsqlqv9l9snnznxs",
-      "txHash": "8FC3116C3BD6B4D1BEFCA7148AB9E0E244E0FD47A380C8B3DBDD5EB9505987B0"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "7496B9A7BFC9EAAB2F283B8AA3ACDDC20D1DBF108B5E783AA77D8288344711EA"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/edge/instantiate-pyth/neutron_testnet_pion_1-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 1175,
-      "txHash": "5A9961A345856E14C2F42D04A881BEF1678A90DEDCC5C9F7B87EE2F6CAA7CA0C"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "neutron16zwrmx3zgggmxhzau86xfycm42cr4sj888hdvzsxya3qarp6zhhqzhlkvz",
-      "txHash": "1B483BFC11C7D155167E8BAB1D4083B685B69E3A7667CA541C9AE7B9F8C8611B"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "5E160580E230DA5ADD0576ACFDEA02FD0776E272AB84E0AE4C520DD8E5CF70C5"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/edge/instantiate-pyth/osmosis_testnet_5-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 214,
-      "txHash": "435D94FBBF4523CAF79386C2B73E0C723947DF15ECF61C5AE96422B1C288840D"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "osmo1lltupx02sj99suakmuk4sr4ppqf34ajedaxut3ukjwkv6469erwqtpg9t3",
-      "txHash": "39D765F72AF267BC24C68E186963A97A3A2199D0DEB12731F5A597CDB5755FD1"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "194D4654AACBF996E3A35660E0E5C999E9A29A5639B65A1A8FEA597218DECDAF"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/edge/instantiate-pyth/sei_testnet_atlantic_2-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 602,
-      "txHash": "F45F0DCE87AB83355AA92E14A51E858CBB54D60D573B0CAD78995667F2E0705E"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "sei1kpntez76v38yuxhhaaahdmvjxnr5tkr8tq077smefs7uw70rj5yqw2aewy",
-      "txHash": "F1580B833B201CCFA1EDD5A9FB4FAE6D96BF1FFD0B32E442E22AC395AC53ED84"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "E0F79003312915307DB2FAB1BE5A6C17A9322D9FEDE283467C89F37F3ED62698"
-    }
-  }
-}

+ 0 - 34
target_chains/cosmwasm/tools/store/edge/test-contracts/injective_testnet-1.2.0.json

@@ -1,34 +0,0 @@
-{
-  "push-price-update": {
-    "status": "rejected",
-    "reason": {
-      "code": 2,
-      "metadata": {
-        "headersMap": {
-          "date": ["Wed, 24 May 2023 16:04:26 GMT"],
-          "content-type": ["application/grpc-web+proto"],
-          "transfer-encoding": ["chunked"],
-          "connection": ["close"],
-          "set-cookie": [
-            "chain-cookie=bbab683274350dcd5a89b660b92d6fb9; Expires=Fri, 26-May-23 16:04:26 GMT; Max-Age=172800; Path=/; Secure; HttpOnly"
-          ],
-          "access-control-expose-headers": [
-            "Content-Type, X-Cosmos-Block-Height, Grpc-Status, Grpc-Message, Grpc-Status-Details-Bin, Date, Vary, grpc-status, grpc-message"
-          ],
-          "grpc-message": [
-            "failed to execute message; message index: 0: dispatch: submessages: unauthorized Pyth price relay [!injective!labs/wasmd@v0.40.0-rc.1-inj/x/wasm/keeper/keeper.go:1209] With gas wanted: '50000000' and gas used: '320388'"
-          ],
-          "grpc-status": ["2"],
-          "grpc-status-details-bin": [
-            "CAIS2wFmYWlsZWQgdG8gZXhlY3V0ZSBtZXNzYWdlOyBtZXNzYWdlIGluZGV4OiAwOiBkaXNwYXRjaDogc3VibWVzc2FnZXM6IHVuYXV0aG9yaXplZCBQeXRoIHByaWNlIHJlbGF5IFshaW5qZWN0aXZlIWxhYnMvd2FzbWRAdjAuNDAuMC1yYy4xLWluai94L3dhc20va2VlcGVyL2tlZXBlci5nbzoxMjA5XSBXaXRoIGdhcyB3YW50ZWQ6ICc1MDAwMDAwMCcgYW5kIGdhcyB1c2VkOiAnMzIwMzg4JyAacAoodHlwZS5nb29nbGVhcGlzLmNvbS9nb29nbGUucnBjLkVycm9ySW5mbxJECh11bmF1dGhvcml6ZWQgUHl0aCBwcmljZSByZWxheRoTCglDb2Rlc3BhY2USBm9yYWNsZRoOCghBQkNJQ29kZRICMzU"
-          ],
-          "vary": ["Origin, Origin"],
-          "x-cosmos-block-height": ["11771258"],
-          "strict-transport-security": ["max-age=15724800; includeSubDomains"],
-          "access-control-allow-origin": ["*"],
-          "access-control-allow-credentials": ["true"]
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/edge/test-contracts/juno_testnet-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "105E1B8D72A3DB3AD414D95586248B89CA1EA710C5754C56A3B65CCF607EDCFE"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
-        "price": {
-          "price": "2629694500000",
-          "conf": "1029648000",
-          "expo": -8,
-          "publish_time": 1684939973
-        },
-        "ema_price": {
-          "price": "2646517690000",
-          "conf": "829556420",
-          "expo": -8,
-          "publish_time": 1684939973
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/edge/test-contracts/neutron_testnet_pion_1-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "ECA134B6CB6C9240AA80B49CF15C8215CA08949C3F68B7720D7E8B9B8E998E41"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
-        "price": {
-          "price": "3012903119923",
-          "conf": "722024077",
-          "expo": -8,
-          "publish_time": 1689590826
-        },
-        "ema_price": {
-          "price": "3017327600000",
-          "conf": "741279200",
-          "expo": -8,
-          "publish_time": 1689590826
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/edge/test-contracts/osmosis_testnet_5-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "570218013CF48B72BB00E5DF8349EF3967962C399B2659FFA36663C6D97CFF4B"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
-        "price": {
-          "price": "2691128116226",
-          "conf": "783518657",
-          "expo": -8,
-          "publish_time": 1684765109
-        },
-        "ema_price": {
-          "price": "2687631700000",
-          "conf": "644643440",
-          "expo": -8,
-          "publish_time": 1684765109
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/edge/test-contracts/sei_testnet_atlantic_2-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "921F078514FCB952A33BEE283A256B982D48D459C10452780587B38CD4703C46"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
-        "price": {
-          "price": "2630612726999",
-          "conf": "922474431",
-          "expo": -8,
-          "publish_time": 1684944259
-        },
-        "ema_price": {
-          "price": "2634133140000",
-          "conf": "935673010",
-          "expo": -8,
-          "publish_time": 1684944259
-        }
-      }
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/injective_testnet-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "152C096B601252279BCBB9FB15D6B6E4C0FFF2A4E428F24C8F47B86BBFB757BA",
-      "codeId": 1333
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "8B9B0533E6839BD9590C73D57CB7D39C92466FFF074C5129243202E980356B18",
-      "contractAddr": "inj18hckkzqf47mdhd734g6papk6wj20y24rm43sk9"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "CE314088E6B871635B4658EC0398B2C1AFA73D18AE00034A95E725CE93D956E0"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/juno_testnet-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 1887,
-      "txHash": "7295D9B243928F66B786C74FAC622533F68B5C19F7B1F1C701BCFF3E33268383"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "juno1eacsrua27njc35pxz37y97gmcjs899t59f8pf0rkejjyvtmhws5q6lxsdd",
-      "txHash": "86EAA6199D84199FDA9852101887ED6D6685823E806FD67C2BE37B3C448B0379"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "04DB775BE839F4D39C27D38ABFE24CF56904BDEF2DB197D863117003BB8F0240"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/neutron-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 67,
-      "txHash": "8324A0429E8460E0F58F214E17D07ADCD689236A95B433F721E8757D7F8038E6"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "neutron1m2emc93m9gpwgsrsf2vylv9xvgqh654630v7dfrhrkmr5slly53spg85wv",
-      "txHash": "12D99EBE9E9C3772EB321FC313C0741C792DD3FFF39D86093F4AF441E50A9821"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "0A8FE81BB3253FD4233990F27087FDCF0642E5C5631FEA034369503AAE48F737"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/neutron_testnet_pion_1-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 1176,
-      "txHash": "E71CB5A163B58222D0458F4C661369D00190C81FF6BBF0C6A5442CE5E8558235"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "neutron15ldst8t80982akgr8w8ekcytejzkmfpgdkeq4xgtge48qs7435jqp87u3t",
-      "txHash": "EA0B91043F0281D4A4E58D9749C109304BEC3C5A309E70C3918F5C0F8951A079"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "572A32BCFF99FB5A83DD5B50A77A20214FA54064F2D4FEA3BD8E70F8372FEA02"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/osmosis-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "THIS WAS GENERATED THROUGH A PROPOSAL. CODE LINK: https://celatone.osmosis.zone/mainnet/codes/45",
-      "codeId": 45
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7",
-      "txHash": "240AA1BCA6EEF29D98691FDC23F6BA99FD6D584F0DD7289996CC961A86F840B0"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "F6C1E68454D42193A617BE0A53B9AD424DCF1839E1BE6F4AAA6E176F7E9D0D79"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/osmosis_testnet_5-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 213,
-      "txHash": "667B97258DE10844A41FDA7B773DABE680FF3A272027F82C3FF8F94B9198ED27"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "osmo1hpdzqku55lmfmptpyj6wdlugqs5etr6teqf7r4yqjjrxjznjhtuqqu5kdh",
-      "txHash": "AAAD47840F0FA21C7B2727025C5A6AD54015EBFBCD894EA066464AEB26197330"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "A814C2DACA2C3CE31D49022216A00F728FA4FE3B6EC55715E5DA1E7F14A16BC0"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/sei_pacific_1-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 28,
-      "txHash": "B15B78416FB49059E5F144A21A31A338A149CE5BCF20F77284FF2F53AD4DA36F"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "sei15d2tyq2jzxmpg32y3am3w62dts32qgzmds9qnr6c87r0gwwr7ynqal0x38",
-      "txHash": "7628939C647068F428724A20946C6BA217729C9004D7B3D3D09219D90DB48134"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "20E9FB619BACF7B684DBF0DC04A681EDC9D47A5FA9AAEE0C15B4DE7AD0673002"
-    }
-  }
-}

+ 0 - 22
target_chains/cosmwasm/tools/store/stable/instantiate-pyth/sei_testnet_atlantic_2-1.2.0.json

@@ -1,22 +0,0 @@
-{
-  "deploy-pyth-code": {
-    "status": "fulfilled",
-    "result": {
-      "codeId": 601,
-      "txHash": "4F1F02928CE9FD40318A455B8D2B9133776834450CF139841A9B889221B3A54F"
-    }
-  },
-  "instantiate-contract": {
-    "status": "fulfilled",
-    "result": {
-      "contractAddr": "sei1w2rxq6eckak47s25crxlhmq96fzjwdtjgdwavn56ggc0qvxvw7rqczxyfy",
-      "txHash": "B76DCF960D24788580BF5A7D009CA88D64AFC70F26E926EC3E244F11E31E044A"
-    }
-  },
-  "set-own-admin": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "A9D9851A2DB48390441F099D9D99ED5F3DB4EAB37C5A4114FEE694D4B815C1B4"
-    }
-  }
-}

+ 0 - 34
target_chains/cosmwasm/tools/store/stable/test-contracts/injective_testnet-1.2.0.json

@@ -1,34 +0,0 @@
-{
-  "push-price-update": {
-    "status": "rejected",
-    "reason": {
-      "code": 2,
-      "metadata": {
-        "headersMap": {
-          "date": ["Wed, 24 May 2023 16:04:01 GMT"],
-          "content-type": ["application/grpc-web+proto"],
-          "transfer-encoding": ["chunked"],
-          "connection": ["close"],
-          "set-cookie": [
-            "chain-cookie=27030ac2692e1e9b8cfcc76e8426fd4a; Expires=Fri, 26-May-23 16:04:01 GMT; Max-Age=172800; Path=/; Secure; HttpOnly"
-          ],
-          "access-control-expose-headers": [
-            "Grpc-Status, Grpc-Message, Grpc-Status-Details-Bin, Date, Content-Type, Vary, X-Cosmos-Block-Height, grpc-status, grpc-message"
-          ],
-          "grpc-message": [
-            "failed to execute message; message index: 0: dispatch: submessages: unauthorized Pyth price relay [!injective!labs/wasmd@v0.40.0-rc.1-inj/x/wasm/keeper/keeper.go:1209] With gas wanted: '50000000' and gas used: '447554'"
-          ],
-          "grpc-status": ["2"],
-          "grpc-status-details-bin": [
-            "CAIS2wFmYWlsZWQgdG8gZXhlY3V0ZSBtZXNzYWdlOyBtZXNzYWdlIGluZGV4OiAwOiBkaXNwYXRjaDogc3VibWVzc2FnZXM6IHVuYXV0aG9yaXplZCBQeXRoIHByaWNlIHJlbGF5IFshaW5qZWN0aXZlIWxhYnMvd2FzbWRAdjAuNDAuMC1yYy4xLWluai94L3dhc20va2VlcGVyL2tlZXBlci5nbzoxMjA5XSBXaXRoIGdhcyB3YW50ZWQ6ICc1MDAwMDAwMCcgYW5kIGdhcyB1c2VkOiAnNDQ3NTU0JyAacAoodHlwZS5nb29nbGVhcGlzLmNvbS9nb29nbGUucnBjLkVycm9ySW5mbxJECh11bmF1dGhvcml6ZWQgUHl0aCBwcmljZSByZWxheRoTCglDb2Rlc3BhY2USBm9yYWNsZRoOCghBQkNJQ29kZRICMzU"
-          ],
-          "vary": ["Origin, Origin"],
-          "x-cosmos-block-height": ["11771247"],
-          "strict-transport-security": ["max-age=15724800; includeSubDomains"],
-          "access-control-allow-origin": ["*"],
-          "access-control-allow-credentials": ["true"]
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/juno_testnet-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "9EA6EAD6C605A46025D0EB9863534A200D362E9B83543348E8A00BF6A35F577F"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "2629589964988",
-          "conf": "1079964988",
-          "expo": -8,
-          "publish_time": 1684939879
-        },
-        "ema_price": {
-          "price": "2648485050000",
-          "conf": "803681530",
-          "expo": -8,
-          "publish_time": 1684939879
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/neutron-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "7EB152F2171A6AA3EEC3DB3183C8B756337D9A38105A234D75A79BDF1EDAB163"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "3080340250000",
-          "conf": "613359448",
-          "expo": -8,
-          "publish_time": 1688123199
-        },
-        "ema_price": {
-          "price": "3079387100000",
-          "conf": "795037770",
-          "expo": -8,
-          "publish_time": 1688123199
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/neutron_testnet_pion_1-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "0747A3C2A608C154B291BB11C621E1C7C3F30A1356FAA051E138659471765F4E"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "3015369873290",
-          "conf": "941626709",
-          "expo": -8,
-          "publish_time": 1689590919
-        },
-        "ema_price": {
-          "price": "3017698600000",
-          "conf": "899541390",
-          "expo": -8,
-          "publish_time": 1689590919
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/osmosis-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "3741C27A656354E2ACF2CBE901F282A68AE425D77AFEE24010CB5627E77B1E24"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "2738164413138",
-          "conf": "605476721",
-          "expo": -8,
-          "publish_time": 1684822184
-        },
-        "ema_price": {
-          "price": "2738288100000",
-          "conf": "610717010",
-          "expo": -8,
-          "publish_time": 1684822184
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/osmosis_testnet_5-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "82EEEF5980B69EC8A5DC86B3E0C8E936DAF2EC428F14C1B3FDC5D0DF8E05866A"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "2693155000000",
-          "conf": "741500000",
-          "expo": -8,
-          "publish_time": 1684765163
-        },
-        "ema_price": {
-          "price": "2687039700000",
-          "conf": "646255300",
-          "expo": -8,
-          "publish_time": 1684765163
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/sei_pacific_1-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "CC286BC1D1CA697BEE32EF1FBCFA22401E7F34ED32AC4DBA402BE6A1ABC920D0"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "2791547792485",
-          "conf": "691207514",
-          "expo": -8,
-          "publish_time": 1685365671
-        },
-        "ema_price": {
-          "price": "2789639300000",
-          "conf": "694481460",
-          "expo": -8,
-          "publish_time": 1685365671
-        }
-      }
-    }
-  }
-}

+ 0 - 28
target_chains/cosmwasm/tools/store/stable/test-contracts/sei_testnet_atlantic_2-1.2.0.json

@@ -1,28 +0,0 @@
-{
-  "push-price-update": {
-    "status": "fulfilled",
-    "result": {
-      "txHash": "80995171494F23D28F73C34915CCF1550700C1A850E2EFB285AA2B183EC59F74"
-    }
-  },
-  "fetch-price-feed-update": {
-    "status": "fulfilled",
-    "result": {
-      "price_feed": {
-        "id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
-        "price": {
-          "price": "2630928100000",
-          "conf": "806100000",
-          "expo": -8,
-          "publish_time": 1684944241
-        },
-        "ema_price": {
-          "price": "2635231300000",
-          "conf": "925800960",
-          "expo": -8,
-          "publish_time": 1684944241
-        }
-      }
-    }
-  }
-}

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác