Skip to content

Commit ec65d3c

Browse files
author
Dev Kalra
authored
[cosmwasm] osmosis release (#767)
* update contract version * update script to build for osmosis * update pyth sdk cw version * update release pipeline * fix pipeline
1 parent 6126db7 commit ec65d3c

File tree

5 files changed

+50
-22
lines changed

5 files changed

+50
-22
lines changed

.github/workflows/release-pyth-cosmwasm-contract.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
npm run build-contract -- --injective
2727
mv ../artifacts ../injective
2828
zip -r injective.zip ../injective
29+
- name: Build osmosis cosmwasm contract
30+
run: |
31+
npm run build-contract -- --osmosis
32+
mv ../artifacts ../osmosis
33+
zip -r osmosis.zip ../osmosis
2934
3035
- name: Set env
3136
run: |
@@ -38,10 +43,12 @@ jobs:
3843
files: |
3944
target_chains/cosmwasm/tools/cosmwasm.zip
4045
target_chains/cosmwasm/tools/injective.zip
46+
target_chains/cosmwasm/tools/osmosis.zip
4147
body: |
4248
Contracts
4349
- cosmwasm.zip contains the generic cosmwasm contract for most Cosmos SDK chains.
44-
- injective.zip contains injectives specific contract.
50+
- injective.zip contains injective specific contract.
51+
- osmosis.zip contains osmosis specific contract.
4552
draft: false
4653
# Setting VERSION in set env step and hence it will be available
4754
name: Pyth Cosmwasm Contract ${{ env.VERSION }}

target_chains/cosmwasm/Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/cosmwasm/contracts/pyth/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-cosmwasm"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
authors = ["Wormhole Contributors <[email protected]>"]
55
edition = "2018"
66
description = "Pyth price receiver"

target_chains/cosmwasm/sdk/rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-sdk-cw"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
authors = ["Pyth Data Foundation"]
55
edition = "2018"
66
license = "Apache-2.0"

target_chains/cosmwasm/tools/src/build-contract.ts

+36-15
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@ const argv = yargs(hideBin(process.argv))
1212
.option("injective", {
1313
type: "boolean",
1414
})
15+
.option("osmosis", {
16+
type: "boolean",
17+
})
18+
.option("arm64", {
19+
type: "boolean",
20+
})
1521
.help()
1622
.alias("help", "h")
1723
.wrap(yargs.terminalWidth())
1824
.parseSync();
1925

20-
// we need to update the toml file to have a feature on - default=['injective']
21-
// editing and writing the toml file before building the contract for injective
22-
function injectivePreSetup(contractTomlFilePath: string) {
26+
// we need to update the toml file to have a feature on - default=[feature (passed as parameter)]
27+
// editing and writing the toml file before building the contract for other than cosmwasm
28+
function cargoPreSetup(contractTomlFilePath: string, feature: string) {
2329
const originalTomlContentStr = readFileSync(contractTomlFilePath, "utf-8");
2430
const parsedToml = toml.parse(originalTomlContentStr);
2531

26-
// add injective feature to the cargo.toml
32+
// add default feature to the cargo.toml
2733
// @ts-ignore
28-
parsedToml.features.default = ["injective"];
34+
parsedToml.features.default = [feature];
2935

3036
// @ts-ignore
3137
const updatedToml = toml.stringify(parsedToml, {
@@ -40,29 +46,44 @@ function injectivePreSetup(contractTomlFilePath: string) {
4046
writeFileSync(contractTomlFilePath, updatedToml);
4147

4248
// after contract compilation we need to reset the original content of the toml file
43-
return function injectivePostCleanup() {
49+
return function cargoPostCleanup() {
4450
writeFileSync(contractTomlFilePath, originalTomlContentStr);
4551
};
4652
}
4753

4854
function build() {
49-
if (argv.cosmwasm !== true && argv.injective !== true) {
50-
console.log("Please provide one of the options: ['cosmwasm', 'injective']");
51-
return;
52-
}
53-
5455
const contractTomlFilePath = "../contracts/pyth/Cargo.toml";
5556

5657
let cleanup = () => {};
57-
if (argv.injective === true)
58-
cleanup = injectivePreSetup(contractTomlFilePath);
58+
if (argv.cosmwasm !== true) {
59+
const feature =
60+
argv.osmosis === true
61+
? "osmosis"
62+
: argv.injective === true
63+
? "injective"
64+
: undefined;
65+
66+
if (feature === undefined) {
67+
console.log(
68+
"Please provide one of the options: ['cosmwasm', 'injective', 'osmosis']"
69+
);
70+
return;
71+
}
72+
73+
cleanup = cargoPreSetup(contractTomlFilePath, feature);
74+
}
75+
76+
const dockerImage =
77+
argv.arm64 === true
78+
? "cosmwasm/workspace-optimizer-arm64:0.12.11"
79+
: "cosmwasm/workspace-optimizer:0.12.11";
5980

6081
const buildCommand = `
6182
docker run --rm -v "$(cd ..; pwd)":/code \
62-
-v $(cd ../../../wormhole_attester; pwd):/wormhole_attester \
83+
-v "$(cd ../../../wormhole_attester; pwd)":/wormhole_attester \
6384
--mount type=volume,source="$(basename "$(cd ..; pwd)")_cache",target=/code/target \
6485
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
65-
cosmwasm/workspace-optimizer:0.12.11
86+
${dockerImage}
6687
`;
6788

6889
// build contract by running the command

0 commit comments

Comments
 (0)