Skip to content

Commit b4c8f2e

Browse files
authored
Refactor our CW contract + cleanups (#262)
* Use the cw sdk * Fix clippy warnings * Use Addr instead of String * Format the code (cargo +nightly fmt) * Depend on wormhole git instead of local dependency * Add error enum * refactor * Refactor errors * certusone->wormhole-foundation rename It will fix some compile problems * Build wormhole contract from their repo * remove wormhole package * Remove memmap2 patch It was not needed anymore with the newer verison of solana (wormhole removed it too) * Rename pyth-bridge to pyth-cosmwasm
1 parent 8cea878 commit b4c8f2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+500
-2641
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
defaults:
1616
run:
17-
working-directory: ./cosmwasm/contracts/pyth-bridge
17+
working-directory: ./cosmwasm/contracts/pyth
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Build

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ and code reviews are our most important tools to accomplish that.
2828
well-defined changes.
2929

3030
Documentation for the in-the-wild deployments lives in the
31-
[wormhole-networks](https://github.com/certusone/wormhole-networks) repository.
31+
[wormhole-networks](https://github.com/wormhole-foundation/wormhole-networks) repository.
3232

3333
See [DEVELOP.md](./DEVELOP.md) for more information on how to run the development environment.
3434

Dockerfile.client

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ RUN --mount=type=cache,target=/root/.cache \
2525
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
2626
--mount=type=cache,target=target,id=cargo_registry \
2727
set -xe && \
28-
cargo install bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local && \
29-
cargo install token_bridge_client --git https://github.com/certusone/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local
28+
cargo install bridge_client --git https://github.com/wormhole-foundation/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local && \
29+
cargo install token_bridge_client --git https://github.com/wormhole-foundation/wormhole --tag $WORMHOLE_TAG --locked --root /usr/local

Dockerfile.cosmwasm

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
# This is a multi-stage docker file, first stage builds contracts
2-
# And the second one creates node.js environment to deploy them
3-
FROM cosmwasm/workspace-optimizer:0.12.6@sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08 AS builder
1+
# This is a multi-stage docker file, first and second stage builds contracts
2+
# And the third one creates node.js environment to deploy them
3+
4+
FROM cosmwasm/workspace-optimizer:0.12.6@sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08 AS wormhole_builder
5+
6+
WORKDIR /tmp/wormhole-repo
7+
8+
ARG WORMHOLE_REV=2.8.9
9+
ADD https://github.com/certusone/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz .
10+
RUN tar -xvf v${WORMHOLE_REV}.tar.gz
11+
RUN mv wormhole-${WORMHOLE_REV}/cosmwasm/Cargo.lock /code/
12+
RUN mv wormhole-${WORMHOLE_REV}/cosmwasm/Cargo.toml /code/
13+
RUN mv wormhole-${WORMHOLE_REV}/cosmwasm/contracts /code/contracts
14+
15+
WORKDIR /code
16+
RUN --mount=type=cache,target=/code/target,id=cosmwasm_wormhole_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
17+
18+
FROM cosmwasm/workspace-optimizer:0.12.6@sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08 AS pyth_builder
419

520
COPY cosmwasm/Cargo.lock /code/
621
COPY cosmwasm/Cargo.toml /code/
722
COPY cosmwasm/contracts /code/contracts
823
COPY third_party/pyth/p2w-sdk/rust /third_party/pyth/p2w-sdk/rust
9-
RUN --mount=type=cache,target=/code/target,id=cosmwasm_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
24+
RUN --mount=type=cache,target=/code/target,id=cosmwasm_pyth_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
1025

1126
# Contract deployment stage
1227
FROM node:16-buster-slim@sha256:93c9fc3550f5f7d159f282027228e90e3a7f8bf38544758024f005e82607f546
@@ -15,7 +30,8 @@ RUN apt update && apt install netcat curl jq -y
1530

1631
WORKDIR /app/tools
1732

18-
COPY --from=builder /code/artifacts /app/artifacts
33+
COPY --from=wormhole_builder /code/artifacts/wormhole.wasm /app/artifacts/wormhole.wasm
34+
COPY --from=pyth_builder /code/artifacts/pyth_cosmwasm.wasm /app/artifacts/pyth_cosmwasm.wasm
1935

2036
COPY ./cosmwasm/tools/package.json ./cosmwasm/tools/package-lock.json /app/tools/
2137
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \

Dockerfile.solana

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN cargo init --lib /tmp/decoy-crate && \
2929
WORKDIR /usr/src/bridge
3030

3131
ARG WORMHOLE_REV=2.8.9
32-
ADD https://github.com/certusone/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz .
32+
ADD https://github.com/wormhole-foundation/wormhole/archive/refs/tags/v${WORMHOLE_REV}.tar.gz .
3333
RUN tar -xvf v${WORMHOLE_REV}.tar.gz
3434
RUN mv wormhole-${WORMHOLE_REV} wormhole
3535
# RUN mkdir -p /usr/src/bridge/wormhole/solana/target

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Pyth2Wormhole. The base repository is a fork from Certus One's reference
66
for building projects based on Wormhole's various SDKs. Much of the existing
77
documentation from there will also apply to this repository.
88

9-
[Wormhole]: https://github.com/certusone/wormhole
9+
[Wormhole]: https://github.com/wormhole-foundation/wormhole
1010

1111
Within this monorepo you will find the following subprojects:
1212

0 commit comments

Comments
 (0)