diff --git a/.github/workflows/release-pyth-cosmwasm-contract.yml b/.github/workflows/release-pyth-cosmwasm-contract.yml index 31138d69..f5538d40 100644 --- a/.github/workflows/release-pyth-cosmwasm-contract.yml +++ b/.github/workflows/release-pyth-cosmwasm-contract.yml @@ -26,6 +26,11 @@ jobs: npm run build-contract -- --injective mv ../artifacts ../injective zip -r injective.zip ../injective + - name: Build osmosis cosmwasm contract + run: | + npm run build-contract -- --osmosis + mv ../artifacts ../osmosis + zip -r osmosis.zip ../osmosis - name: Set env run: | @@ -38,10 +43,12 @@ jobs: files: | target_chains/cosmwasm/tools/cosmwasm.zip target_chains/cosmwasm/tools/injective.zip + target_chains/cosmwasm/tools/osmosis.zip body: | Contracts - cosmwasm.zip contains the generic cosmwasm contract for most Cosmos SDK chains. - - injective.zip contains injectives specific contract. + - injective.zip contains injective specific contract. + - osmosis.zip contains osmosis specific contract. draft: false # Setting VERSION in set env step and hence it will be available name: Pyth Cosmwasm Contract ${{ env.VERSION }} diff --git a/target_chains/cosmwasm/Cargo.lock b/target_chains/cosmwasm/Cargo.lock index c614368f..8fd785ea 100644 --- a/target_chains/cosmwasm/Cargo.lock +++ b/target_chains/cosmwasm/Cargo.lock @@ -1316,7 +1316,7 @@ dependencies = [ [[package]] name = "pyth-cosmwasm" -version = "1.1.0" +version = "1.2.0" dependencies = [ "bigint", "byteorder", @@ -1369,7 +1369,7 @@ dependencies = [ [[package]] name = "pyth-sdk-cw" -version = "1.1.0" +version = "1.2.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1511,9 +1511,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" diff --git a/target_chains/cosmwasm/contracts/pyth/Cargo.toml b/target_chains/cosmwasm/contracts/pyth/Cargo.toml index b3a727f2..0d00ab4f 100644 --- a/target_chains/cosmwasm/contracts/pyth/Cargo.toml +++ b/target_chains/cosmwasm/contracts/pyth/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-cosmwasm" -version = "1.1.0" +version = "1.2.0" authors = ["Wormhole Contributors "] edition = "2018" description = "Pyth price receiver" diff --git a/target_chains/cosmwasm/sdk/rust/Cargo.toml b/target_chains/cosmwasm/sdk/rust/Cargo.toml index 6e5b0198..2c5da70f 100644 --- a/target_chains/cosmwasm/sdk/rust/Cargo.toml +++ b/target_chains/cosmwasm/sdk/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-sdk-cw" -version = "1.1.0" +version = "1.2.0" authors = ["Pyth Data Foundation"] edition = "2018" license = "Apache-2.0" diff --git a/target_chains/cosmwasm/tools/src/build-contract.ts b/target_chains/cosmwasm/tools/src/build-contract.ts index d4050380..cedc39c7 100644 --- a/target_chains/cosmwasm/tools/src/build-contract.ts +++ b/target_chains/cosmwasm/tools/src/build-contract.ts @@ -12,20 +12,26 @@ const argv = yargs(hideBin(process.argv)) .option("injective", { type: "boolean", }) + .option("osmosis", { + type: "boolean", + }) + .option("arm64", { + type: "boolean", + }) .help() .alias("help", "h") .wrap(yargs.terminalWidth()) .parseSync(); -// we need to update the toml file to have a feature on - default=['injective'] -// editing and writing the toml file before building the contract for injective -function injectivePreSetup(contractTomlFilePath: string) { +// we need to update the toml file to have a feature on - default=[feature (passed as parameter)] +// editing and writing the toml file before building the contract for other than cosmwasm +function cargoPreSetup(contractTomlFilePath: string, feature: string) { const originalTomlContentStr = readFileSync(contractTomlFilePath, "utf-8"); const parsedToml = toml.parse(originalTomlContentStr); - // add injective feature to the cargo.toml + // add default feature to the cargo.toml // @ts-ignore - parsedToml.features.default = ["injective"]; + parsedToml.features.default = [feature]; // @ts-ignore const updatedToml = toml.stringify(parsedToml, { @@ -40,29 +46,44 @@ function injectivePreSetup(contractTomlFilePath: string) { writeFileSync(contractTomlFilePath, updatedToml); // after contract compilation we need to reset the original content of the toml file - return function injectivePostCleanup() { + return function cargoPostCleanup() { writeFileSync(contractTomlFilePath, originalTomlContentStr); }; } function build() { - if (argv.cosmwasm !== true && argv.injective !== true) { - console.log("Please provide one of the options: ['cosmwasm', 'injective']"); - return; - } - const contractTomlFilePath = "../contracts/pyth/Cargo.toml"; let cleanup = () => {}; - if (argv.injective === true) - cleanup = injectivePreSetup(contractTomlFilePath); + if (argv.cosmwasm !== true) { + const feature = + argv.osmosis === true + ? "osmosis" + : argv.injective === true + ? "injective" + : undefined; + + if (feature === undefined) { + console.log( + "Please provide one of the options: ['cosmwasm', 'injective', 'osmosis']" + ); + return; + } + + cleanup = cargoPreSetup(contractTomlFilePath, feature); + } + + const dockerImage = + argv.arm64 === true + ? "cosmwasm/workspace-optimizer-arm64:0.12.11" + : "cosmwasm/workspace-optimizer:0.12.11"; const buildCommand = ` docker run --rm -v "$(cd ..; pwd)":/code \ - -v $(cd ../../../wormhole_attester; pwd):/wormhole_attester \ + -v "$(cd ../../../wormhole_attester; pwd)":/wormhole_attester \ --mount type=volume,source="$(basename "$(cd ..; pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/workspace-optimizer:0.12.11 + ${dockerImage} `; // build contract by running the command