Skip to content

Commit

Permalink
chore: pull monorepo changes (#131)
Browse files Browse the repository at this point in the history
* Project import generated by Copybara.

GitOrigin-RevId: 968ada589196194c2f24c4761a5d106b4eb18e03

* chore: manual import cleanup

* chore: Update pnpm lockfile

---------

Co-authored-by: Copybara <copybara@example.com>
Co-authored-by: gallynaut <gallynaut@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 18, 2023
1 parent a99fe5a commit 7eeab51
Show file tree
Hide file tree
Showing 88 changed files with 716 additions and 445 deletions.
8 changes: 4 additions & 4 deletions examples/functions/01_basic_oracle/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/functions/01_basic_oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
switchboard-solana = { version = "=0.28.15", features = [ ] }
# switchboard-solana = { version = "0.28.4", path = "../../../rust/switchboard-solana" }
switchboard-solana = { version = "0.28.19", features = [] }
# switchboard-solana = { version = "0.28.19", path = "../../../rust/switchboard-solana" }
bytemuck = "^1"
2 changes: 1 addition & 1 deletion examples/functions/01_basic_oracle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@coral-xyz/anchor": "^0.28.0",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.78.0",
"@switchboard-xyz/solana.js": "workspace:*"
"@switchboard-xyz/solana.js": "workspace:^"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ futures = "0.3"
serde = "^1"
serde_json = "^1"
switchboard-utils = "0.8.0"
switchboard-solana = { version = "=0.28.15", features = [ "client" ] }
# switchboard-solana = { version = "0.28.4", path = "../../../../rust/switchboard-solana" }
switchboard-solana = { version = "0.28.19" }
# switchboard-solana = { version = "0.28.19", path = "../../../../rust/switchboard-solana" }
# switchboard-utils = { version = "0.8.0", path = "../../../../../../rust/switchboard-utils" }
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# syntax=docker/dockerfile:1.4
FROM switchboardlabs/sgx-function AS builder

ARG CARGO_NAME=switchboard-function
ENV CARGO_NAME=$CARGO_NAME

WORKDIR /home/root/switchboard-function
COPY ./Cargo.lock ./Cargo.toml ./
COPY ./src ./src

WORKDIR /home/root/switchboard-function/sgx-function
COPY ./sgx-function/Cargo.lock ./sgx-function/Cargo.toml ./
COPY ./sgx-function/src ./src
WORKDIR /home/root/switchboard-function/switchboard-function
COPY ./switchboard-function/Cargo.lock ./switchboard-function/Cargo.toml ./
COPY ./switchboard-function/src ./src

RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} \
--mount=type=cache,target=target,id=${TARGETPLATFORM} \
cargo build --release && \
cargo strip && \
mv target/release/${CARGO_NAME} /sgx/app
mv target/release/basic-oracle-function /sgx/app

FROM switchboardlabs/sgx-function

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# syntax=docker/dockerfile:1.4
FROM switchboardlabs/sgx-function AS builder

ARG CARGO_NAME=switchboard-function
ENV CARGO_NAME=$CARGO_NAME

WORKDIR /home/root/solana-sdk

COPY ./rust/switchboard-common/Cargo.toml \
Expand All @@ -18,9 +15,9 @@ COPY ./chains/solana/examples/functions/01_basic_oracle/Cargo.toml \
./chains/solana/examples/functions/01_basic_oracle/Cargo.lock \
./chains/solana/examples/functions/01_basic_oracle/

COPY ./chains/solana/examples/functions/01_basic_oracle/sgx-function/Cargo.toml \
./chains/solana/examples/functions/01_basic_oracle/sgx-function/Cargo.lock \
./chains/solana/examples/functions/01_basic_oracle/sgx-function/
COPY ./chains/solana/examples/functions/01_basic_oracle/switchboard-function/Cargo.toml \
./chains/solana/examples/functions/01_basic_oracle/switchboard-function/Cargo.lock \
./chains/solana/examples/functions/01_basic_oracle/switchboard-function/

COPY ./rust/switchboard-common/src \
./rust/switchboard-common/src/
Expand All @@ -31,15 +28,15 @@ COPY ./rust/switchboard-solana/src \
COPY ./chains/solana/examples/functions/01_basic_oracle/src \
./chains/solana/examples/functions/01_basic_oracle/src/

COPY ./chains/solana/examples/functions/01_basic_oracle/sgx-function/src \
./chains/solana/examples/functions/01_basic_oracle/sgx-function/src/
COPY ./chains/solana/examples/functions/01_basic_oracle/switchboard-function/src \
./chains/solana/examples/functions/01_basic_oracle/switchboard-function/src/

WORKDIR /home/root/solana-sdk/chains/solana/examples/functions/01_basic_oracle/sgx-function
WORKDIR /home/root/solana-sdk/chains/solana/examples/functions/01_basic_oracle/switchboard-function

RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --mount=type=cache,target=target,id=${TARGETPLATFORM} \
cargo build --release && \
cargo strip && \
mv target/release/${CARGO_NAME} /sgx/app
mv target/release/basic-oracle-function /sgx/app

FROM switchboardlabs/sgx-function

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
.PHONY: build clean publish

# Variables
CARGO_NAME=basic-oracle-function
DOCKER_IMAGE_NAME=${CONTAINER_NAME}
DOCKER_IMAGE_NAME ?= gallynaut/basic-oracle-function

DOCKER_BUILD_COMMAND=DOCKER_BUILDKIT=1 docker buildx build --platform linux/amd64 --build-arg CARGO_NAME=${CARGO_NAME}
DOCKER_BUILD_COMMAND=docker buildx build --platform linux/amd64

# Default make task
all: build

docker_build:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile -t ${DOCKER_IMAGE_NAME}:latest --load ../
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile -t ${DOCKER_IMAGE_NAME}:latest ../

docker_publish:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile -t ${DOCKER_IMAGE_NAME}:latest --push ../

dev_docker_build:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile.dev -t ${DOCKER_IMAGE_NAME}:latest --load ../../../../../../
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile.dev -t ${DOCKER_IMAGE_NAME}:latest ../../../../../../

dev_docker_publish:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile.dev -t ${DOCKER_IMAGE_NAME}:latest --push ../../../../../../
Expand Down
19 changes: 17 additions & 2 deletions examples/functions/02_liquidity_oracle/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/functions/02_liquidity_oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
switchboard-solana = "0.28.4"
# switchboard-solana = { version = "0.28.4", path = "../../../rust/switchboard-solana" }
switchboard-solana = "0.28.19"
# switchboard-solana = { version = "0.28.19", path = "../../../rust/switchboard-solana" }
bytemuck = "^1"
anchor-lang = { version = "0.28.0", features = [
"init-if-needed",
Expand Down
44 changes: 0 additions & 44 deletions examples/functions/02_liquidity_oracle/sgx-function/Dockerfile.dev

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct TriggerFunction<'info> {
}

#[derive(Clone, AnchorSerialize, AnchorDeserialize)]
pub struct TriggerFunctionParams { }
pub struct TriggerFunctionParams {}

impl TriggerFunction<'_> {
pub fn validate(
Expand All @@ -32,12 +32,16 @@ impl TriggerFunction<'_> {
Ok(())
}

pub fn actuate(ctx: &Context<Self>, _params: &TriggerFunctionParams) -> anchor_lang::Result<()> {
pub fn actuate(
ctx: &Context<Self>,
_params: &TriggerFunctionParams,
) -> anchor_lang::Result<()> {
FunctionTrigger {
function: ctx.accounts.function.clone(),
authority: ctx.accounts.authority.clone(),
attestation_queue: ctx.accounts.attestation_queue.clone(),
}.invoke(ctx.accounts.attestation_program.clone())?;
function: ctx.accounts.function.to_account_info(),
authority: ctx.accounts.authority.to_account_info(),
attestation_queue: ctx.accounts.attestation_queue.to_account_info(),
}
.invoke(ctx.accounts.attestation_program.clone())?;
Ok(())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ futures = "0.3"
serde = "^1"
serde_json = "^1"
switchboard-utils = { version = "0.8.0" }
switchboard-solana = "0.28.4"
# switchboard-solana = { version = "0.28.4", path = "../../../../rust/switchboard-solana" }
switchboard-solana = "0.28.19"
# switchboard-solana = { version = "0.28.19", path = "../../../../rust/switchboard-solana" }
bytemuck = "1.13.1"
rust_decimal = "1.30.0"
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ WORKDIR /home/root/switchboard-function
COPY ./Anchor.toml ./Cargo.lock ./Cargo.toml ./
COPY ./src ./src

WORKDIR /home/root/switchboard-function/sgx-function
COPY ./sgx-function/Cargo.lock ./sgx-function/Cargo.toml ./
COPY ./sgx-function/src ./src
WORKDIR /home/root/switchboard-function/switchboard-function
COPY ./switchboard-function/Cargo.lock ./switchboard-function/Cargo.toml ./
COPY ./switchboard-function/src ./src

RUN --mount=target=/home/root/.cargo/git,type=cache \
--mount=target=/home/root/.cargo/registry,type=cache \
--mount=type=cache,target=/home/root/switchboard-function/sgx-function/target \
--mount=type=cache,target=/home/root/switchboard-function/switchboard-function/target \
cargo build --release && \
cargo strip && \
mv target/release/basic-oracle-function /sgx/app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ COPY ./examples/functions/01_basic_oracle/Cargo.toml \
./examples/functions/01_basic_oracle/Cargo.lock \
./examples/functions/01_basic_oracle/

COPY ./examples/functions/01_basic_oracle/sgx-function/Cargo.toml \
./examples/functions/01_basic_oracle/sgx-function/Cargo.lock \
./examples/functions/01_basic_oracle/sgx-function/
COPY ./examples/functions/01_basic_oracle/switchboard-function/Cargo.toml \
./examples/functions/01_basic_oracle/switchboard-function/Cargo.lock \
./examples/functions/01_basic_oracle/switchboard-function/

COPY ./rust/switchboard-solana/src \
./rust/switchboard-solana/src/

COPY ./examples/functions/01_basic_oracle/src \
./examples/functions/01_basic_oracle/src/

COPY ./examples/functions/01_basic_oracle/sgx-function/src \
./examples/functions/01_basic_oracle/sgx-function/src/
COPY ./examples/functions/01_basic_oracle/switchboard-function/src \
./examples/functions/01_basic_oracle/switchboard-function/src/

WORKDIR /home/root/solana-sdk/examples/functions/01_basic_oracle/sgx-function
WORKDIR /home/root/solana-sdk/examples/functions/01_basic_oracle/switchboard-function

RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --mount=type=cache,target=target,id=${TARGETPLATFORM} \
cargo build --release && \
cargo strip && \
mv /home/root/solana-sdk/examples/functions/01_basic_oracle/sgx-function/target/release/${CARGO_NAME} /sgx
mv /home/root/solana-sdk/examples/functions/01_basic_oracle/switchboard-function/target/release/${CARGO_NAME} /sgx

FROM switchboardlabs/sgx-function

Expand Down
19 changes: 17 additions & 2 deletions examples/functions/03_candles_oracle/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7eeab51

Please sign in to comment.