[cosmwasm] osmosis release (#767)

* update contract version

* update script to build for osmosis

* update pyth sdk cw version

* update release pipeline

* fix pipeline
This commit is contained in:
Dev Kalra 2023-04-17 18:25:09 +05:30 committed by GitHub
parent 6126db74fc
commit ec65d3ca81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 22 deletions

View File

@ -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 }}

View File

@ -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"

View File

@ -1,6 +1,6 @@
[package]
name = "pyth-cosmwasm"
version = "1.1.0"
version = "1.2.0"
authors = ["Wormhole Contributors <contact@certus.one>"]
edition = "2018"
description = "Pyth price receiver"

View File

@ -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"

View File

@ -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